forked from openFrameworks-RaspberryPi/openFrameworks
-
Notifications
You must be signed in to change notification settings - Fork 0
Sound programming notes
damiannz edited this page Oct 3, 2012
·
57 revisions
- ofSoundStream's isSetup() calls getNumInputChannels() and getNumOutputChannels() to determine if the streaming system is setup or not. Make sure your subclass returns 0 for these immediately after construction.
- Wait for the call to
buffersChanged()before setting up your internal buffers. Ensure you can cleanly tear down and setup again ifbuffersChanged()is called twice with different settings. - Until we have an internal FIFO on the ofSoundStream,
audioOutis called on the sound card's timer thread, not the main thread. Make sure your audioOut is threadsafe but try not to do things that might block for a long time, like file I/O. If you need to do a lot of work, do it in a different thread that writes to a lock-free FIFO and read from this FIFO in audioOut. See Ross Bencina's guide for tips. -
audioOut()'sfloat* outputcomes pre-cleared:audioOutdoes not need to set to 0 if it doesn't render anything
damian is developing on OSX
- test iOS
- test Linux
- test Windows
- test Android
- ✓ move ofMixer instance out of ofBasicSoundPlayer, make singleton
- damian wip deal with singleton/root ofSoundStream instance: need some way of selecting the output at startup
- implement buffersChanged() method (called when buffer sizes changed, before audioOut is called: subclasses should overload this if they have an internal buffer that needs to be allocated to match the buffer size in audioOut()) damian wip
- migrate all subclasses to use audioOut( ofSoundBuffer& buffer ) instead of audioOut( float*, int, int )
- change all testApp (examples, templates, ...) to use audioOut( ofSoundBuffer& buffer )
- refactor bufferSize->numFrames, nChannels->nChannelsPerFrame damian wip
- implement FIFO in ofSoundStream, default to calling audioOut on the main thread (increasing latency but making audio more robust and avoiding thread-safety issues)
- allow users to switch audioOut calls from main thread to their own thread (for low-latency applications)
- refactor bufferSize->numFrames
- inspection methods? ofSoundBuffer::drawSpectrum()?
- FFT methods
- test libaudiodecoder streaming on iOS/OSX
- build libaudiodecoder on Windows, test
- optionally route audio from ofVideoPlayer through the system ofMixer