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 system is setup or not. Make sure your subclass returns 0 for these immediately after construction.
- Wait for the call to ofBaseSoundOutput::audioConnect() before setting up your internal buffers. Ensure you can cleanly tear down and setup again if audioConnect() is called twice with different settings.
- Until we have an internal FIFO on the ofSoundStream, AudioOut is called on the sound card's timer thread, not the main thread. Make sure your audioOut is threadsafe but DON'T do this by using standard mutexes etc. Don't block! Don't do 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()'s
float* outputcomes pre-cleared: audioOut does not need to set to 0 if it doesn't render anything
✓ 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 damian wip
- implement FIFO in ofSoundStream so that audioOut can run on the main thread
- test streaming on iOS/OSX