#include <sonix.h>
Collaboration diagram for sonix:

Public Methods | |
| virtual void | trigger (const std::string &alias, const int &repeat=1) |
| @input alias of the sound to trigger, and number of times to play, -1 to repeat infinately, 1 (single shot) is default. More... | |
| virtual bool | isPlaying (const std::string &alias) |
| is the sound currently playing? More... | |
| virtual void | setRetriggerable (const std::string &alias, bool onOff) |
| virtual bool | isRetriggerable (const std::string &alias) |
| is the sound retriggerable? More... | |
| virtual void | stop (const std::string &alias) |
| @semantics stop the sound @input alias of the sound to be stopped. More... | |
| virtual void | pause (const std::string &alias) |
| pause the sound, use unpause to return playback where you left off... More... | |
| virtual void | unpause (const std::string &alias) |
| resume playback from a paused state. More... | |
| virtual bool | isPaused (const std::string &alias) |
| if the sound is paused, then return true. More... | |
| virtual void | setAmbient (const std::string &alias, bool setting=false) |
| ambient or positional sound. More... | |
| virtual bool | isAmbient (const std::string &alias) |
| is the sound ambient? More... | |
| virtual void | setPitchBend (const std::string &alias, float amount) |
| alters the frequency of the sample. More... | |
| virtual void | setVolume (const std::string &alias, float amount) |
| affect volume. More... | |
| virtual void | setCutoff (const std::string &alias, float amount) |
| affect cutoff. More... | |
| virtual void | setPosition (const std::string &alias, const float &x, const float &y, const float &z) |
| set sound's 3D position @input x,y,z are in OpenGL coordinates. More... | |
| virtual void | getPosition (const std::string &alias, float &x, float &y, float &z) |
| get sound's 3D position @input alias is a name that has been associate()d with some sound data @output x,y,z are returned in OpenGL coordinates. More... | |
| virtual void | setListenerPosition (const gmtl::Matrix44f &mat) |
| set the position of the listener. More... | |
| virtual void | getListenerPosition (gmtl::Matrix44f &mat) |
| get the position of the listener. More... | |
| virtual void | changeAPI (const std::string &apiName) |
| change the underlying sound API to something else. More... | |
| virtual void | configure (const snx::SoundAPIInfo &sai) |
| virtual void | configure (const std::string &alias, const snx::SoundInfo &description) |
| configure/reconfigure a sound configure: associate a name (alias) to the description if not already done reconfigure: change properties of the sound to the descriptino provided. More... | |
| virtual void | remove (const std::string alias) |
| remove a configured sound, any future reference to the alias will not cause an error, but will not result in a rendered sound. More... | |
| virtual void | step (const float &timeElapsed) |
| @semantics call once per sound frame (doesn't have to be same as your graphics frame) @input time elapsed since last frame. More... | |
Protected Methods | |
| sonix () | |
| virtual | ~sonix () |
| snx::ISoundImplementation & | impl () |
|
|
Definition at line 62 of file sonix.h.
00062 : mImplementation( NULL )
00063 {
00064 }
|
|
|
Definition at line 61 of file sonix.cpp. References snx::ISoundImplementation::shutdownAPI, and snx::ISoundImplementation::unbindAll.
00062 {
00063 // release the implementation
00064 if (mImplementation != NULL)
00065 {
00066 // unload all sound data
00067 mImplementation->unbindAll();
00068
00069 // shutdown old api if exists
00070 mImplementation->shutdownAPI();
00071 delete mImplementation;
00072 mImplementation = NULL;
00073 }
00074 }
|
|
||||||||||||
|
@input alias of the sound to trigger, and number of times to play, -1 to repeat infinately, 1 (single shot) is default. @preconditions alias does not have to be associated with a loaded sound. @postconditions if it is, then the loaded sound is triggered. if it isn't then nothing happens. @semantics Triggers a sound Definition at line 83 of file sonix.cpp. References impl, and snx::ISoundImplementation::trigger.
|
|
|
is the sound currently playing?
Definition at line 91 of file sonix.cpp. References impl, and snx::ISoundImplementation::isPlaying.
|
|
||||||||||||
|
Definition at line 100 of file sonix.cpp. References impl, and snx::ISoundImplementation::setRetriggerable.
00101 {
00102 this->impl().setRetriggerable( alias, onOff );
00103 }
|
|
|
is the sound retriggerable?
Definition at line 108 of file sonix.cpp. References impl, and snx::ISoundImplementation::isRetriggerable.
00109 {
00110 return this->impl().isRetriggerable( alias );
00111 }
|
|
|
@semantics stop the sound @input alias of the sound to be stopped.
Definition at line 117 of file sonix.cpp. References impl, and snx::ISoundImplementation::stop.
|
|
|
pause the sound, use unpause to return playback where you left off...
Definition at line 125 of file sonix.cpp. References impl, and snx::ISoundImplementation::pause.
|
|
|
resume playback from a paused state. does nothing if sound was not paused. Definition at line 133 of file sonix.cpp. References impl, and snx::ISoundImplementation::unpause.
|
|
|
if the sound is paused, then return true.
Definition at line 139 of file sonix.cpp. References impl, and snx::ISoundImplementation::isPaused.
|
|
||||||||||||
|
ambient or positional sound. is the sound ambient - attached to the listener, doesn't change volume when listener moves... or is the sound positional - changes volume as listener nears or retreats.. Definition at line 150 of file sonix.cpp. References impl, and snx::ISoundImplementation::setAmbient.
00151 {
00152 this->impl().setAmbient( alias, setting );
00153 }
|
|
|
is the sound ambient?
Definition at line 156 of file sonix.cpp. References impl, and snx::ISoundImplementation::isAmbient.
|
|
||||||||||||
|
alters the frequency of the sample. 1 is no change < 1 is low > 1 is high. Definition at line 166 of file sonix.cpp. References impl, and snx::ISoundImplementation::setPitchBend.
00167 {
00168 this->impl().setPitchBend( alias, amount );
00169 }
|
|
||||||||||||
|
affect volume. set to a value between [0..1]. Definition at line 172 of file sonix.cpp. References impl, and snx::ISoundImplementation::setVolume.
|
|
||||||||||||
|
affect cutoff. set to a value between [0..1]... 1 is no change. 0 is total cutoff. Definition at line 180 of file sonix.cpp. References impl, and snx::ISoundImplementation::setCutoff.
|
|
||||||||||||||||||||
|
set sound's 3D position @input x,y,z are in OpenGL coordinates. alias is a name that has been associate()d with some sound data Definition at line 189 of file sonix.cpp. References impl, and snx::ISoundImplementation::setPosition.
00190 {
00191 this->impl().setPosition( alias, x, y, z );
00192 }
|
|
||||||||||||||||||||
|
get sound's 3D position @input alias is a name that has been associate()d with some sound data @output x,y,z are returned in OpenGL coordinates.
Definition at line 199 of file sonix.cpp. References snx::ISoundImplementation::getPosition, and impl.
00200 {
00201 this->impl().getPosition( alias, x, y, z );
00202 }
|
|
|
set the position of the listener.
Definition at line 207 of file sonix.cpp. References impl, and snx::ISoundImplementation::setListenerPosition.
00208 {
00209 this->impl().setListenerPosition( mat );
00210 }
|
|
|
get the position of the listener.
Definition at line 215 of file sonix.cpp. References snx::ISoundImplementation::getListenerPosition, and impl.
00216 {
00217 this->impl().getListenerPosition( mat );
00218 }
|
|
|
change the underlying sound API to something else. @input usually a name of a valid registered sound API implementation @preconditions sound implementation should be registered @postconditions underlying API is changed to the requested API name. if apiName's implementation is not registered, then underlying API is changed to the stub version. @semantics function is safe: always returns a valid implementation. @time O(1) @output a valid sound API. if apiName is invalid, then a stub implementation is returned. Definition at line 230 of file sonix.cpp. References snx::ISoundImplementation::bindAll, snx::SoundImplementation::copy, impl, snx::ISoundImplementation::name, snx::ISoundImplementation::shutdownAPI, snxDBG, snx::ISoundImplementation::startAPI, and snx::ISoundImplementation::unbindAll.
00231 {
00232 snx::ISoundImplementation& oldImpl = this->impl();
00233 vprASSERT( &oldImpl != NULL && "this->impl() should ensure that oldImpl is non-NULL" );
00234
00235 // change the current api to the newly requested one.
00236 snx::SoundFactory::instance()->createImplementation( apiName, mImplementation );
00237
00238 vprDEBUG(snxDBG, vprDBG_CRITICAL_LVL) << "Changing sound API from '"
00239 << oldImpl.name() << "' to '"
00240 << mImplementation->name() << "'\n"
00241 << vprDEBUG_FLUSH;
00242
00243 // copy sound state from old to current (doesn't do binding yet)
00244 snx::SoundImplementation* si = dynamic_cast<snx::SoundImplementation*>( mImplementation );
00245 vprASSERT( NULL != si && "implementation is not of type SoundImplementation, cast fails" );
00246 snx::SoundImplementation& old_si = dynamic_cast<snx::SoundImplementation&>( oldImpl );
00247 vprASSERT( NULL != &old_si && "implementation is not of type SoundImplementation, cast fails" );
00248 si->copy( old_si );
00249
00250 // unload all sound data
00251 oldImpl.unbindAll();
00252
00253 // shutdown old api if exists
00254 oldImpl.shutdownAPI();
00255
00256 // delete old api, we're done with it...
00257 delete &oldImpl;
00258
00259 // startup the new API
00260 if(!mImplementation->startAPI()) // if it fails to start then we revert back to stub
00261 {
00262 vprDEBUG(snxDBG, vprDBG_CRITICAL_LVL)
00263 << clrOutBOLD(clrRED, "ERROR:") << " Failed to start new API--"
00264 << "changing back to Stub\n" << vprDEBUG_FLUSH;
00265 changeAPI("stub");
00266 }
00267
00268 // load all sound data
00269 mImplementation->bindAll();
00270 }
|
|
|
Definition at line 275 of file sonix.cpp. References snx::ISoundImplementation::configure, and impl.
|
|
||||||||||||
|
configure/reconfigure a sound configure: associate a name (alias) to the description if not already done reconfigure: change properties of the sound to the descriptino provided. @preconditions provide an alias and a SoundInfo which describes the sound @postconditions alias will point to loaded sound data @semantics associate an alias to sound data. later this alias can be used to operate on this sound data. Definition at line 288 of file sonix.cpp. References snx::ISoundImplementation::configure, and impl.
|
|
|
remove a configured sound, any future reference to the alias will not cause an error, but will not result in a rendered sound.
Definition at line 297 of file sonix.cpp. References impl, and snx::ISoundImplementation::remove.
|
|
|
@semantics call once per sound frame (doesn't have to be same as your graphics frame) @input time elapsed since last frame.
Definition at line 306 of file sonix.cpp. References impl, and snx::ISoundImplementation::step.
|
|
|
Definition at line 311 of file sonix.cpp. References snx::ISoundImplementation::bindAll, and snx::ISoundImplementation::startAPI. Referenced by changeAPI, configure, getListenerPosition, getPosition, isAmbient, isPaused, isPlaying, isRetriggerable, pause, remove, setAmbient, setCutoff, setListenerPosition, setPitchBend, setPosition, setRetriggerable, setVolume, step, stop, trigger, and unpause.
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002