Unigine::Sound Class
Unigine sound. This interface provides access to Unigine sound functions.
To use this class, include the UnigineSound.h file.
Unigine::Sound Class
Members
virtual ~Sound ()
Virtual destructor.static Sound * get ()
Returns a pointer to the existing sound.Return value
Pointer to the existing sound.virtual void setEnabled (int enable) const =0
Enables or disables the sound.Arguments
- int enable - 1 to enable the sound, 0 to disable it.
virtual int isEnabled () const =0
Returns a value indicating if the sound is enabled.Return value
Returns 1 if the sound is enabled; otherwise, 0.virtual void setData (const char * data) const =0
Sets user data associated with the world. In the *.world file, the data is set in the data tag.Arguments
- const char * data - New user data.
virtual const char * getData () const =0
Returns user string data associated with the world. This string is written directly into the data tag of the *.world file.Return value
User string data.virtual void setVolume (float volume) const =0
Sets the sound volume in range [0;1]. The default is 1 that means maximum volume.Arguments
- float volume - Sound volume. 0 means muted sound, 1 means maximum volume.
virtual float getVolume () const =0
Returns the current sound volume.Return value
Sound volume. 0 means muted sound, 1 means maximum volume.virtual void setSourceVolume (int source, float volume) const =0
Sets the volume of the specified sound channel.Arguments
- int source - Number of the sound channel (from 0 to 31).
- float volume - Channel volume. The provided value is saturated within [0;1] range, where 0 means muted sound and 1 is the maximum volume.
virtual float getSourceVolume (int source) const =0
Returns the current volume of the specified sound channel.Arguments
- int source - Number of the sound channel (from 0 to 31).
Return value
Volume of the specified sound channel. The returning value is in range [0;1], where 0 means muted sound and 1 is the maximum volume.virtual void renderWorld (int force) const =0
Forces update of the sound system: all sound settings will be applied at once (such as play, stop events and change of parameters). A sound system has its own fixed frame rate (30 fps), while a script update rate can be much higher, which sometimes cause commands being skipped, unless a forced update is used.Arguments
- int force - 1 to force update of the sound system; otherwise, 0.
virtual int loadSettings (const char * name) const =0
Loads the sound settings from a given file.Arguments
- const char * name - Sound settings file name.
Return value
Returns 1 if the settings are loaded successfully; otherwise, 0.virtual int saveSettings (const char * name, int Forced) const =0
Saves the current sound settings to a given file.Arguments
- const char * name - Sound settings file name.
- int Forced - saving of sound settings.
Return value
Returns 1 if the settings are saved successfully ; otherwise, 0.virtual int loadWorld (const XmlPtr & xml) const =0
Loads a sound state from the Xml. The sound state includes such settings as the volume, velocity, adaptation, Doppler factor, time scale and number of sound sources and their volumes.Arguments
- const XmlPtr & xml - Xml smart pointer.
Return value
Returns 1 if the the sound state is loaded successfully; otherwise, 0 is returned.virtual int saveWorld (const XmlPtr & xml, int Forced) const =0
Saves a sound state into the Xml. The sound state includes such settings as the volume, velocity, adaptation, Doppler factor, time scale and number of sound sources and their volumes.Arguments
- const XmlPtr & xml - Xml smart pointer.
- int Forced - saving of the sound state.
Return value
Returns 1 if the sound state is saved successfully; otherwise, 0.virtual int saveState (const StreamPtr & stream) const =0
Saves a sound state into the stream. The sound state includes such settings as the volume, velocity, adaptation, Doppler factor, time scale and number of sound sources and their volumes.Arguments
- const StreamPtr & stream - Stream smart pointer.
Return value
Returns 1 if the sound state is saved successfully; otherwise, 0.virtual int restoreState (const StreamPtr & stream) const =0
Restores a sound state from the stream. The sound state includes such settings as the volume, velocity, adaptation, Doppler factor, time scale and number of sound sources and their volumes.Arguments
- const StreamPtr & stream - Stream smart pointer.
Return value
Returns 1 if the sound state is restored successfully; otherwise, 0 is returned.Last update: 03.07.2017
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter