| Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
SoundManager Class ReferenceProvides sound effects and caching services, as well as mixing buffers for the SoundPlay process. More...
Detailed DescriptionProvides sound effects and caching services, as well as mixing buffers for the SoundPlay process. Provides easy methods for playing back sounds, either from files on the memory stick, or from dynamically generated buffers. You can chain playback commands so that when one sound finishes, another picks up automatically. This might be handy if, say, someone wants to write an MP3 player ;) The sounds would be too large to load into memory all at once, but you could load a block at a time and chain them so it seamlessly moves from one to the other. You can also preload sounds (loadFile()) before playing them (play() / playFile()) so there's no delay between requesting a sound and having it start playing while it is loaded from disk/memory stick. Just be sure to release the file (releaseFile()) again when you're done with it ;) All functions will attempt to lock the SoundManager. Remember, this is running in a shared memory region, accessible by the SoundPlay process and both the Main and Motion processes (so MotionCommands can play sounds!) One could be tempted to draw parallels to the MotionManager, and envision a system with SoundCommands that are handed over and can dynamically compute sound buffers as needed. If you have the time and inclination, the job's all yours... (Midi players, speech synthesizer, ...?)
Definition at line 58 of file SoundManager.h. Member Typedef Documentation
For convenience. Definition at line 265 of file SoundManager.h.
This is for referring to instances of the play command so you can stop, pause, or monitor progress (later versions will send events upon completion). Definition at line 79 of file SoundManager.h.
For convenience. Definition at line 261 of file SoundManager.h. This is used for referring to sound data so you can start playing it or release it. Definition at line 74 of file SoundManager.h.
For convenience. Definition at line 248 of file SoundManager.h. Member Enumeration DocumentationUsed to set the mode for mixing multiple sound channels. Feel free to add a higher quality mixer if you're an audiophile - I'm pretty new to sound processing
Definition at line 87 of file SoundManager.h. indicates how to handle channel overflow (trying to play more sounds than maximum number of mixing channels). See queue_mode
Definition at line 94 of file SoundManager.h. Constructor & Destructor Documentation
destructor Definition at line 50 of file SoundManager.cc.
constructor, should only be called by the receiving process (SoundPlay) Definition at line 33 of file SoundManager.cc.
don't call Member Function Documentation
allows automatic queuing of sounds - good for dynamic sound sources! if you chain more than once to the same base, the new buffers are appended to the end of the chain - the new buffer doesn't replace the current chain
Definition at line 330 of file SoundManager.cc.
allows automatic queuing of sounds - good for dynamic sound sources! if you chain more than once to the same base, the new buffers are appended to the end of the chain - the new buffer doesn't replace the current chain
Definition at line 310 of file SoundManager.cc. Referenced by SpeakerServer::QueueFrame().
allows automatic queuing of sounds - good for dynamic sound sources! if you chain more than once to the same base, the new buffers are appended to the end of the chain - the new buffer doesn't replace the current chain
Definition at line 290 of file SoundManager.cc.
Copies the sound data to the specified memory buffer, ready to be passed to the system.
Definition at line 626 of file SoundManager.cc. called when a buffer end is reached, may reset buffer to next in chain, or just stopPlay() Definition at line 896 of file SoundManager.cc. Referenced by mixChannel(), mixChannelAdditively(), selectChannels(), and updateChannels().
return the next region serial number -- doesn't actually increment it though, repeated calls will return the same value until the value is actually used Definition at line 202 of file SoundManager.h.
returns number of sounds currently playing Definition at line 199 of file SoundManager.h. Gives the time until the sound finishes, in milliseconds. Subtract 32 to get guarranteed valid time for this ID. You should be passing the beginning of a chain to get proper results... Definition at line 501 of file SoundManager.cc. Referenced by SpeakerServer::QueueFrame().
Each process (except SoundPlay) needs to call this before it can send sounds to the SoundPlay process. Definition at line 45 of file SoundManager.cc. Sets up a shared region to hold a sound - rounds to nearest page size. Definition at line 768 of file SoundManager.cc. Referenced by loadBuffer(), play(), and release().
loads raw samples from a buffer (assumes matches Config::sound_config settings) The sound data will be cached until release() is called a matching number of times. Definition at line 113 of file SoundManager.cc. Referenced by chainBuffer(), loadFile(), and playBuffer().
loads a wav file (if it matches Config::sound_config settings - can't do resampling yet) Since the SoundManager does the loading, if the same file is being played more than once, only once copy is stored in memory
Definition at line 69 of file SoundManager.cc. Referenced by chainFile(), Controller::DoStart(), and playFile().
Looks to see if name matches any of the sounds in sndlist (converts to absolute path if not already). Definition at line 787 of file SoundManager.cc. Referenced by loadFile(), and releaseFile().
Mixes the channel into the buffer. Definition at line 513 of file SoundManager.cc. Referenced by CopyTo().
Mixes the channel into the buffer additively. If mode is Quality, then the size of the buffer should be double the normal size. Definition at line 543 of file SoundManager.cc. Referenced by CopyTo().
don't call
Lets you pause playback. Definition at line 470 of file SoundManager.cc.
plays a previously loaded buffer or file Definition at line 244 of file SoundManager.cc. Referenced by chain(), playBuffer(), and playFile().
loads raw samples from a buffer (assumes buffer matches Config::sound_config settings) The sound data will be released after done playing Definition at line 232 of file SoundManager.cc. Referenced by chainBuffer(), and SpeakerServer::QueueFrame().
play a wav file (if it matches Config::sound_config settings - can't do resampling yet) Will do a call to loadFile() first, and then automatically release the sound again when complete.
Definition at line 218 of file SoundManager.cc. Referenced by chainFile(), ControlBase::doCancel(), ControlBase::doNextItem(), ControlBase::doPrevItem(), ControlBase::doReadStdIn(), WalkCalibration::doSelect(), SensorObserverControl::doSelect(), EventLogger::doSelect(), ControlBase::doSelect(), WalkCalibration::err(), Transition::fire(), RandomTrans::fire(), WalkCalibration::processEvent(), AutoGetupBehavior::processEvent(), TorqueCalibrate::record(), UPennWalkControllerBehavior::runCommand(), RunSequenceControl< SequenceSize >::selectedFile(), PlaySoundControl::selectedFile(), LoadPostureControl::selectedFile(), ControlBase::setHilights(), EmergencyStopMC::setStopped(), speak(), SoundNode::startPlaying(), WalkCalibration::takeInput(), TorqueCalibrate::TakeMeasurementControl::takeInput(), and TorqueCalibrate::TakeMeasurementControl::transition().
updates internal data structures on the SoundPlay side - you shouldn't be calling this Definition at line 702 of file SoundManager.cc.
Marks the sound buffer to be released after the last play command completes (or right now if not being played). Definition at line 167 of file SoundManager.cc. Referenced by endPlay(), releaseFile(), and stopPlay().
Marks the sound buffer to be released after the last play command completes (or right now if not being played). Definition at line 161 of file SoundManager.cc. Referenced by Controller::DoStop().
Lets you resume playback. Definition at line 482 of file SoundManager.cc.
selects which of the channels are actually to be mixed together, depending on queue_mode Definition at line 803 of file SoundManager.cc. Referenced by CopyTo().
Lets you control the maximum number of channels (currently playing sounds), method for mixing (applies when max_chan>1), and queuing method (for when overflow channels). Definition at line 493 of file SoundManager.cc.
Speaks its argument using the Mary text-to-speech system to generate a WAV file. On Aperios or unsupported platforms, simply displays the text on stdout Definition at line 385 of file SoundManager.cc. Referenced by Transition::fire(), SpeechNode::start(), StateNode::startCommon(), SpeechNode::startEvent(), and BatteryMonitorBehavior::startWarning().
Lets you stop playback of a sound. Definition at line 441 of file SoundManager.cc.
Lets you stop playback of all sounds. Definition at line 435 of file SoundManager.cc. Referenced by SpeakerServer::DoStop(), endPlay(), SpeakerServer::QueueFrame(), PlaySoundControl::selectedFile(), SpeechNode::stopPlay(), SoundNode::stopPlay(), and ~SoundManager().
update the offsets of sounds which weren't mixed (when needed depending on queue_mode) Definition at line 848 of file SoundManager.cc. Referenced by CopyTo(). Member Data Documentation
Holds a list of all currently playing sounds, ordered newest (front) to oldest(back). Definition at line 267 of file SoundManager.h. Referenced by CopyTo(), getNumPlaying(), pausePlay(), play(), resumePlay(), selectChannels(), stopPlay(), and updateChannels().
for reporting errors Definition at line 80 of file SoundManager.h. Referenced by chain(), chainBuffer(), chainFile(), SpeakerServer::DoStart(), SpeakerServer::DoStop(), endPlay(), getRemainTime(), pausePlay(), play(), playBuffer(), playFile(), SpeechNode::processEvent(), SoundNode::processEvent(), SpeakerServer::QueueFrame(), resumePlay(), speak(), SpeechNode::stopPlay(), SoundNode::stopPlay(), and stopPlay().
for reporting errors Definition at line 75 of file SoundManager.h. Referenced by chain(), chainBuffer(), chainFile(), loadBuffer(), loadFile(), lookupPath(), play(), playBuffer(), playFile(), and release().
Prevents multiple processes from accessing at the same time. Definition at line 279 of file SoundManager.h. Referenced by CopyTo(), getRemainTime(), loadBuffer(), loadFile(), pausePlay(), play(), playBuffer(), playFile(), release(), releaseFile(), resumePlay(), setMode(), and stopPlay().
Current maximum number of sounds to mix together. Definition at line 276 of file SoundManager.h. Referenced by selectChannels(), and setMode().
maximum length of a path Definition at line 83 of file SoundManager.h. Referenced by loadFile(), and lookupPath().
the number of sounds that can be enqueued at the same time (see MixMode_t) Definition at line 81 of file SoundManager.h.
the number of sounds that can be loaded at any given time Definition at line 76 of file SoundManager.h.
Current mixing mode, set by setMode();. Definition at line 270 of file SoundManager.h.
The intermediate mixer buffer used for Quality mode mixing. Definition at line 214 of file SoundManager.h. Referenced by CopyTo(), and ~SoundManager().
Size (in bytes) of the intermediate mixer buffer. Definition at line 217 of file SoundManager.h. Referenced by CopyTo().
the size of a SoundManagerMsg, which is prefixed before each region sent/received by SoundManager (rounded up to nearest even word boundary) Definition at line 292 of file SoundManager.h. Referenced by loadBuffer(), play(), ProcessMsg(), and release().
Holds a list of all sounds currently enqueued. Definition at line 263 of file SoundManager.h. Referenced by chain(), chainBuffer(), chainFile(), endPlay(), getRemainTime(), mixChannel(), mixChannelAdditively(), play(), playBuffer(), playFile(), ProcessMsg(), selectChannels(), stopPlay(), and updateChannels().
Current queuing mode, set by setMode();. Definition at line 273 of file SoundManager.h. Referenced by selectChannels(), setMode(), and updateChannels().
A serial number, incremented for each sound which is created. This is used to verify that a sound message from a process refers to a current sound. If you imaging a pathological process, which rapidly creates and releases sounds, it would run through the sndlist ids, possibly before the sound process can process the incoming buffers. So this is used to ensure that a given message refers to the current sound, and not one that was already released and then reassigned. Definition at line 289 of file SoundManager.h. Referenced by getNextKey(), initRegion(), and loadBuffer().
Holds a list of all currently loaded sounds. Definition at line 250 of file SoundManager.h. Referenced by endPlay(), getRemainTime(), loadBuffer(), loadFile(), lookupPath(), mixChannel(), mixChannelAdditively(), play(), playBuffer(), playFile(), ProcessMsg(), release(), selectChannels(), stopPlay(), updateChannels(), and ~SoundManager().
Storage of each process's attachment of the message queue, used to internally transmit sound buffers to SoundPlay. Definition at line 299 of file SoundManager.h. Referenced by InitAccess(), loadBuffer(), play(), and release(). The documentation for this class was generated from the following files: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Tekkotsu v5.0CVS |
Generated Sun Jan 10 11:20:40 2010 by Doxygen 1.6.2 |