diff --git a/engine/samples/CMakeLists.txt b/engine/samples/CMakeLists.txt index db72823397..8385590cfe 100644 --- a/engine/samples/CMakeLists.txt +++ b/engine/samples/CMakeLists.txt @@ -33,6 +33,7 @@ macro(make_sample) endif() endmacro() # Add samples +make_sample(DIR "audio" ASSETS) make_sample(DIR "hello-cubos") make_sample(DIR "settings") make_sample(DIR "events") diff --git a/engine/samples/audio/assets/bg_music.mp3 b/engine/samples/audio/assets/bg_music.mp3 new file mode 100644 index 0000000000..688585bef0 Binary files /dev/null and b/engine/samples/audio/assets/bg_music.mp3 differ diff --git a/engine/samples/audio/assets/bg_music.mp3.meta b/engine/samples/audio/assets/bg_music.mp3.meta new file mode 100644 index 0000000000..dd5bdcaa5f --- /dev/null +++ b/engine/samples/audio/assets/bg_music.mp3.meta @@ -0,0 +1,3 @@ +{ + "id": "059c16e7-a439-44c7-9bdc-7f133dba0c80" +} diff --git a/engine/samples/audio/assets/input.bind b/engine/samples/audio/assets/input.bind new file mode 100644 index 0000000000..18a3fecc3c --- /dev/null +++ b/engine/samples/audio/assets/input.bind @@ -0,0 +1,13 @@ +{ + "actions": { + "skip": [ + {"keys": ["Return"]} + ], + "play_pause": [ + {"keys": ["Space"]} + ], + "stop": [ + {"keys": ["BackSpace"]} + ] + } +} diff --git a/engine/samples/audio/assets/input.bind.meta b/engine/samples/audio/assets/input.bind.meta new file mode 100644 index 0000000000..813969c690 --- /dev/null +++ b/engine/samples/audio/assets/input.bind.meta @@ -0,0 +1,3 @@ +{ + "id": "6709a9ce-8651-4295-bdf2-848b052ce1f7" +} diff --git a/engine/samples/audio/assets/medieval_fanfare.wav b/engine/samples/audio/assets/medieval_fanfare.wav new file mode 100644 index 0000000000..d961da7227 Binary files /dev/null and b/engine/samples/audio/assets/medieval_fanfare.wav differ diff --git a/engine/samples/audio/assets/medieval_fanfare.wav.meta b/engine/samples/audio/assets/medieval_fanfare.wav.meta new file mode 100644 index 0000000000..af052bba40 --- /dev/null +++ b/engine/samples/audio/assets/medieval_fanfare.wav.meta @@ -0,0 +1,3 @@ +{ + "id": "3f93e774-888c-4ead-8819-67fc7e873df0" +} diff --git a/engine/samples/audio/assets/sample1.flac b/engine/samples/audio/assets/sample1.flac new file mode 100644 index 0000000000..6cdf25779e Binary files /dev/null and b/engine/samples/audio/assets/sample1.flac differ diff --git a/engine/samples/audio/assets/sample1.flac.meta b/engine/samples/audio/assets/sample1.flac.meta new file mode 100644 index 0000000000..37412e42ae --- /dev/null +++ b/engine/samples/audio/assets/sample1.flac.meta @@ -0,0 +1,3 @@ +{ + "id": "ccf3b646-1307-430d-bf3e-a23e06430043" +} diff --git a/engine/samples/audio/main.cpp b/engine/samples/audio/main.cpp new file mode 100644 index 0000000000..78b9d151b0 --- /dev/null +++ b/engine/samples/audio/main.cpp @@ -0,0 +1,120 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cubos/core/tel/logging.hpp" +#include "cubos/engine/audio/pause.hpp" +#include "cubos/engine/audio/play.hpp" +#include "cubos/engine/audio/stop.hpp" + +using namespace cubos::engine; + +/// [Get handles to assets] +static const Asset