Now I can play a sound! Yay!

master
Zed A. Shaw 4 months ago
parent f83c0c7ff9
commit 7309ec2f40
  1. BIN
      assets/click.mp3
  2. 32
      audiotest.cpp
  3. 1
      dbc.hpp
  4. 1
      efsw.wrap
  5. 1
      libgit2.wrap
  6. 11
      meson.build
  7. 9
      scripts/reset_build.ps1

Binary file not shown.

@ -0,0 +1,32 @@
#include <SFML/Audio.hpp>
#include <thread> // for sleep_for
#include <iostream>
#include <fmt/core.h>
#include <chrono>
int main(int argc, char *argv[]) {
sf::SoundBuffer buffer;
sf::Sound click;
if(argc != 2) {
fmt::println("USAGE: audiotest click.mp3");
return 0;
}
const char *in_file = argv[1];
if(!buffer.loadFromFile(in_file)) {
fmt::println("Failed to load {}", in_file);
}
click.setBuffer(buffer);
fmt::println("Playing {}. Hit ctrl-c to exit.", in_file);
while(true) {
click.play();
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
return 0;
}

@ -46,6 +46,7 @@ namespace dbc {
void check(bool test, const string &message) { void check(bool test, const string &message) {
if(!test) { if(!test) {
string err = fmt::format("[CHECK!] {}\n", message); string err = fmt::format("[CHECK!] {}\n", message);
fmt::println("{}", err);
throw CheckError{err}; throw CheckError{err};
} }
} }

@ -2,6 +2,7 @@
url = https://github.com/SpartanJ/efsw.git url = https://github.com/SpartanJ/efsw.git
revision = 1.3.1 revision = 1.3.1
depth = 1 depth = 1
method = cmake
# patch_filename = # patch_filename =
# patch_hash = # patch_hash =

@ -7,6 +7,5 @@ wrapdb_version = 2.4.1-3
# patch_filename = # patch_filename =
# patch_hash = # patch_hash =
[provide] [provide]
libgit2 = libgit2_dep libgit2 = libgit2_dep

@ -13,20 +13,18 @@ opts.add_cmake_defines({
libgit2_proj = cmake.subproject('libgit2', options: opts) libgit2_proj = cmake.subproject('libgit2', options: opts)
libgit2package_dep = libgit2_proj.dependency('libgit2package') libgit2package_dep = libgit2_proj.dependency('libgit2package')
efsw_proj = cmake.subproject('efsw') efsw_dep = dependency('efsw')
efsw_dep = efsw_proj.dependency('efsw')
fmt = dependency('fmt') fmt = dependency('fmt')
ftxui_screen = dependency('ftxui-screen') ftxui_screen = dependency('ftxui-screen')
ftxui_dom = dependency('ftxui-dom') ftxui_dom = dependency('ftxui-dom')
ftxui_component = dependency('ftxui-component') ftxui_component = dependency('ftxui-component')
catch2 = dependency('catch2-with-main') catch2 = dependency('catch2-with-main')
openal = dependency('openal') sfml = dependency('sfml')
dependencies = [ dependencies = [
fmt, libgit2package_dep, efsw_dep, fmt, libgit2package_dep, efsw_dep,
ftxui_screen, ftxui_dom, ftxui_component, ftxui_screen, ftxui_dom, ftxui_component,
openal sfml
] ]
executable('escape_turings_tarpit', executable('escape_turings_tarpit',
@ -46,6 +44,9 @@ executable('ftxtest', 'ftxtest.cpp',
executable('ftx_thread_test', 'ftx_thread_test.cpp', executable('ftx_thread_test', 'ftx_thread_test.cpp',
dependencies: dependencies) dependencies: dependencies)
executable('audiotest', 'audiotest.cpp',
dependencies: dependencies)
runtests = executable('runtests', [ runtests = executable('runtests', [
'game_engine.cpp', 'game_engine.cpp',
'tests/game_engine.cpp'], 'tests/game_engine.cpp'],

@ -3,14 +3,19 @@ rm -recurse -force .\subprojects\,.\builddir\
mkdir subprojects mkdir subprojects
mv .\packagecache .\subprojects\ mv .\packagecache .\subprojects\
cp *.wrap subprojects cp *.wrap subprojects
# cp -recurse -force packagefiles subprojects
mkdir builddir mkdir builddir
meson wrap install fmt meson wrap install fmt
meson wrap install openal-soft
meson wrap install sqlite3 meson wrap install sqlite3
meson wrap install sqlitecpp meson wrap install sqlitecpp
meson wrap install ftxui meson wrap install ftxui
meson wrap install catch2 meson wrap install catch2
meson wrap install libpng
meson wrap install vorbis
meson wrap install ogg
meson wrap install flac
meson wrap install freetype2
meson wrap install openal-soft
meson wrap install sfml
# $env:CC="clang" # $env:CC="clang"
# $env:CXX="clang++" # $env:CXX="clang++"
meson setup --default-library=static --prefer-static builddir meson setup --default-library=static --prefer-static builddir

Loading…
Cancel
Save