Now I can play a sound! Yay!
This commit is contained in:
parent
f83c0c7ff9
commit
7309ec2f40
7 changed files with 47 additions and 8 deletions
BIN
assets/click.mp3
Normal file
BIN
assets/click.mp3
Normal file
Binary file not shown.
32
audiotest.cpp
Normal file
32
audiotest.cpp
Normal file
|
@ -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;
|
||||
}
|
1
dbc.hpp
1
dbc.hpp
|
@ -46,6 +46,7 @@ namespace dbc {
|
|||
void check(bool test, const string &message) {
|
||||
if(!test) {
|
||||
string err = fmt::format("[CHECK!] {}\n", message);
|
||||
fmt::println("{}", err);
|
||||
throw CheckError{err};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
url = https://github.com/SpartanJ/efsw.git
|
||||
revision = 1.3.1
|
||||
depth = 1
|
||||
method = cmake
|
||||
# patch_filename =
|
||||
# patch_hash =
|
||||
|
||||
|
|
|
@ -7,6 +7,5 @@ wrapdb_version = 2.4.1-3
|
|||
# patch_filename =
|
||||
# patch_hash =
|
||||
|
||||
|
||||
[provide]
|
||||
libgit2 = libgit2_dep
|
||||
|
|
11
meson.build
11
meson.build
|
@ -13,20 +13,18 @@ opts.add_cmake_defines({
|
|||
libgit2_proj = cmake.subproject('libgit2', options: opts)
|
||||
libgit2package_dep = libgit2_proj.dependency('libgit2package')
|
||||
|
||||
efsw_proj = cmake.subproject('efsw')
|
||||
efsw_dep = efsw_proj.dependency('efsw')
|
||||
|
||||
efsw_dep = dependency('efsw')
|
||||
fmt = dependency('fmt')
|
||||
ftxui_screen = dependency('ftxui-screen')
|
||||
ftxui_dom = dependency('ftxui-dom')
|
||||
ftxui_component = dependency('ftxui-component')
|
||||
catch2 = dependency('catch2-with-main')
|
||||
openal = dependency('openal')
|
||||
sfml = dependency('sfml')
|
||||
|
||||
dependencies = [
|
||||
fmt, libgit2package_dep, efsw_dep,
|
||||
ftxui_screen, ftxui_dom, ftxui_component,
|
||||
openal
|
||||
sfml
|
||||
]
|
||||
|
||||
executable('escape_turings_tarpit',
|
||||
|
@ -46,6 +44,9 @@ executable('ftxtest', 'ftxtest.cpp',
|
|||
executable('ftx_thread_test', 'ftx_thread_test.cpp',
|
||||
dependencies: dependencies)
|
||||
|
||||
executable('audiotest', 'audiotest.cpp',
|
||||
dependencies: dependencies)
|
||||
|
||||
runtests = executable('runtests', [
|
||||
'game_engine.cpp',
|
||||
'tests/game_engine.cpp'],
|
||||
|
|
|
@ -3,14 +3,19 @@ rm -recurse -force .\subprojects\,.\builddir\
|
|||
mkdir subprojects
|
||||
mv .\packagecache .\subprojects\
|
||||
cp *.wrap subprojects
|
||||
# cp -recurse -force packagefiles subprojects
|
||||
mkdir builddir
|
||||
meson wrap install fmt
|
||||
meson wrap install openal-soft
|
||||
meson wrap install sqlite3
|
||||
meson wrap install sqlitecpp
|
||||
meson wrap install ftxui
|
||||
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:CXX="clang++"
|
||||
meson setup --default-library=static --prefer-static builddir
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue