Urho.Audio.Audio Class

Audio subsystem, used to playback both regular audio and 3D sound.

See Also: Audio


public class Audio : UrhoObject


The Audio class represents the audio subsystem, which implements an audio output stream. It is the hub for audio operations in your application.  See the Urho.Audio documentation for more information.

To hear pseudo-3D positional sounds, a SoundListener component must exist in a scene node and be assigned to the audio subsystem by setting the Audio.Listener property. 

The output is software mixed for an unlimited amount of simultaneous sounds. Ogg Vorbis sounds are decoded on the fly, and decoding them can be memory- and CPU-intensive, so WAV files are recommended when a large number of short sound effects need to be played.

For purposes of volume control, each SoundSource can be classified into a user defined group which is multiplied with a master category and the individual SoundSource gain set using SoundSource.Gain for the final volume level.

To control the category volumes, set the Audio.SetMasterGain, which defines the category if it didn't already exist.

It is possible to control the playback of a class of sounds identified by their type by using the Audio.PauseSoundTypeAudio.ResumeSoundType and Audio.ResumeAll methods.  You can probe whether a specific sound type is paused by calling the Audio.IsSoundTypePaused.   The list of possible sound types are the strings “Master”, “Effect”, “Ambient”, “Voice” and “Music”.


Namespace: Urho.Audio
Assembly: Urho (in Urho.dll)
Assembly Versions:

The members of Urho.Audio.Audio are listed below.

See Also: UrhoObject

Public Constructors

Constructs a new instance of Urho.Audio.Audio which is tied to the Application.CurrentContext.
Constructs a new instance of Urho.Audio.Audio, given a raw pointer to an unmanaged object
Constructs a new instance of Urho.Audio.Audio linked to a specific Context.

Protected Constructors

Empty constructor, chain to this constructor when you provide your own constructor that sets the handle field.

Public Properties

InitializedBoolean. Return whether an audio stream has been reserved.
InterpolationBoolean. Return whether output is interpolated.
ListenerSoundListener. Return active sound listener. Or Set active sound listener for 3D sounds.
MixRateInt32. Return mixing rate.
PlayingBoolean. Return whether audio is being output.
SampleSizeUInt32. Return byte size of one sample.
StereoBoolean. Determines whether output is stereo.
TypeStringHash. Urho's type system type.
TypeNameString. Urho's low-level type name.
TypeNameStaticString. Urho's low-level type name, accessible as a static method.
TypeStaticStringHash. Urho's low-level type, accessible as a static method.

Public Methods

Add a sound source to keep track of. Called by SoundSource.
GetMasterGain(String) : Single
Return master gain for a specific sound source type. Unknown sound types will return full gain (1).
GetSoundSourceMasterGain(StringHash) : Single
Return sound type specific gain multiplied by master gain.
HasMasterGain(String) : Boolean
Return whether the specified master gain has been defined.
IsSoundTypePaused(String) : Boolean
Returns whether the specified sound type is currently paused.
MixOutput(IntPtr, UInt32)
Mix sound sources into the buffer.
Pause playing back the sounds of the specific type.
Play() : Boolean
Restart sound output.
Remove a sound source. Called by SoundSource.
Resumes playback of all sound types.
Resumes playing back the sounds of the specific type.
SetMasterGain(String, Single)
Set master gain on a specific sound type such as sound effects, music or voice.
SetMode(Int32, Int32, Boolean, Boolean) : Boolean
Initialize sound output with specified buffer length and output mode.
Suspend sound output.
Stop any sound source playing a certain sound clip.