This is a simple audio library using OpenAL. It was built as a simple tool for playing sound/music in a game or another multimedia application.
Add the remote:
conan remote add https://bintray.com/statelessstudio/simple-audio-library
Create your conanfile:
conanfile.txt
[requires]
simple-audio-library/1.0.0@demo/testing
[options]
[generators]
cmake
Create your CMake file:
CMakeLists.txt
cmake_minimum_required (VERSION 3.8)
project(SalTest)
include(dependencies/conanbuildinfo.cmake)
conan_basic_setup()
# Add source to this project's executable.
file(GLOB source_files
"*.h"
"*.cpp"
)
add_executable(SalTest ${source_files})
target_link_libraries(SalTest ${CONAN_LIBS})
And install!
mkdir dependencies && cd dependencies
conan install ..
Create a listener to "hear" the sound, and to register a device to hear with:
SimpleAudio::Listener listener;
listener.initWithDefaultDevice();
listener.setPosition(0, 0, 0);
listener.setVelocity(0, 0, 0);
As of v1.0.0, you can create multiple listeners, but only if you know what you're doing! Most applications will only need a single listener.
Load a wave file into a Sound
:
SimpleAudio::Sound ouch;
ouch.loadWaveFile("../resources/ouch.wav");
In addition to loading a sound, you'll also need somewhere to play it:
SimpleAudio::Source player;
player.setPosition(1, 0, 0);
player.play(ouch.getBuffer());
Build the docs:
doxygen
You'll see the docs folder appear, find and open index.html
.