scone
scone copied to clipboard
Audio
Allow playing sound files. Ideally some sort of sound handling system as well.
The user should be able to
- play a sound
- stop a sound
I have no experience with audio systems, but here is how I imagine it would function.
- The user registers an audio file
void register(size_t id, string filePath)
, and uses it asaudio.register(42, "./audio/my-file.flac");
- The user plays the audio file by providing the id, and also gets some sort of audio handle.
auto handle = audio.play(42);
. - The user can stop the audio with
audio.stop(handle)
, and the handle is invalidated.
P.S. Maybe the file path should be some cross-platform variant, where you can provide one path which will work for both Windows and POSIX.
Some other features which would be great, but not necessary would be
- setting the volume of specific audio
- fading the volume
- looping the audio
- pausing the audio
The user registers an audio file
void register(size_t id, string filePath)
I wonder if it should be up to the user or scone
to give a sound file an id. Personally I feel like it should be up to scone
to do so, but I think it would be much easier if the user themselves set up the ids.