I’ve used Juce for a long time now, and feel like i’m probably the only one who hasn’t been interested in doing audio stuff with it!
I’m still not really (one day…), but i wanted a way to put sounds into my programs. As easy as juce is to use, i think the audio stuff is probably the scariest part of it! :-o
So i’ve made this. It’s called SimpleAudio. It’s a really basic (probably a bit crude… feel free to improve it, this is literally my first ever audio coding) way to add simple sound-file playback to an app.
Here are the files.
Steps to use:
#include “SimpleAudio.h”, and make sure the files are in your project.
Create a SimpleAudioManager. Either make your base Component inherit SimpleAudioManager, or give it a member SimpleAudioManager [it just needs to exist, outside the scope of all SimpleAudioObjects]
Then it’s just a simple case of creating and using SimpleAudioObjects. Give your Components a member SimpleAudioObject for each sound you want to play. Set their files, and call myAudioObject.play() to play the sound.
That’s all there is to it.
The SimpleAudioPlayer is a Singleton, so the SimpleAudioObjects can find it themselves. The SimpleAudioManager is simply there to ensure that the SimpleAudioPlayer instance is created and destroyed properly at each end of the program’s duration. However, it could be enhanced to allow for event callbacks from the player (e.g. audioObjectPlaybackStarted (SimpleAudioObject*)).
For now though, this will do! Hopefully it should be sufficient for newbies to get basic sound events in their apps.