Urho
1.0.0.0
Urho.UrhoObject
Audio subsystem, used to playback both regular audio and 3D sound.
The Audio subsystem implements an audio output stream. Once it has been initialized, the following operations are supported:
-
Playing raw audio, Ogg Vorbis or WAV resources using the component. This allows manual stereo panning of mono sounds; stereo sounds will be output with their original stereo mix.
-
Playing the above sound formats in pseudo-3D using the component. It has stereo positioning and distance attenuation, but does not (at least yet) filter the sound depending on the direction.
To hear pseudo-3D positional sounds, a component must exist in a scene node and be assigned to the audio subsystem by setting the property. If the sound listener's scene node exists within a specific scene, it will only hear sounds from that scene, but if it has been created into a "sceneless" node it will hear sounds from all scenes.
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 can be classified into a user defined group which is multiplied with a master category and the individual gain set using for the final volume level.
To control the category volumes, set the , which defines the category if it didn't already exist.
The components support automatic removal from the node they belong to, once playback is finished. To use, set the on them. This may be useful when a game object plays several "fire and forget" sound effects.
Sound Parameters
A standard WAV file can not tell whether it should loop, and raw audio does not contain any header information. Parameters for the resource can optionally be specified through an XML file that has the same name as the sound, but .xml extension. Possible elements are “format” which allows optional attributes “frequency” (and a value in Hz), “sixteenbits” (with either “true” and “false” values) and “stereo” (with either “true” and “false” values). The other element is “loop” and it allows the optional attributes “enable” (with either “true” and “false” values) and “start” and “end”
The frequency is in Hz, and loop start and end are bytes from the start of audio data. If a loop is enabled without specifying the start and end, it is assumed to be the whole sound. Ogg Vorbis compressed sounds do not support specifying the loop range, only whether whole sound looping is enabled or disabled.
The subsystem is always instantiated, but in headless mode it is not active. In headless mode the playback of sounds is simulated, taking the sound length and frequency into account. This allows basing logic on whether a specific sound is still playing or not, even in server code.
Sound Streaming
In addition to playing existing sound resources, sound can be generated during runtime using the class and its subclasses. To start playback of a stream on a , call .
Sound streaming is used internally to implement on-the-fly Ogg Vorbis decoding. See the SoundSynthesis sample for an example of using the subclass, which allows the sound data to be queued for playback from the main thread.
Constructor
1.0.0.0
Pointer to the raw unmanaged Urho object.
Constructs a new instance of Audio, given a raw pointer to an unmanaged object
This creates a new managed wrapper for the type using the raw pointer to an unmanaged object.
Objects that are created in this fashion get registered with the UrhoSharp runtime.
This is intended to be used by the UrhoSharp runtime, and is not intended to be used by users.
Constructor
1.0.0.0
The context that this object will be attached to.
Creates an instance of Audio that is attached to an execution context.
This creates an instance of Audio attached to the specified execution context.
Constructor
1.0.0.0
Pass UrhoObjectFlag.Empty.
Empty constructor, chain to this constructor when you provide your own constructor that sets the handle field.
This constructor should be invoked by your code if you provide your own constructor that sets the handle field.
This essentially circumvents the default path that creates a new object and sets the handle and does not call RegisterObject on the target, you must do this on your own constructor.
You would typically chain to this constructor from your own, and then set the handle to the unmanaged object from your code, and then register your object.
Method
1.0.0.0
System.Void
To be added.
Add a sound source to keep track of. Called by SoundSource.
To be added.
Property
1.0.0.0
Urho.StringHash
Urho's type system base type.
StringHash representing the base type for this Urho type.
This returns the Urho type system base type and is surfaced for low-level Urho code.
Method
1.0.0.0
System.Single
To be added.
Return master gain for a specific sound source type. Unknown sound types will return full gain (1).
To be added.
To be added.
Method
1.0.0.0
System.Single
To be added.
Return sound type specific gain multiplied by master gain.
To be added.
To be added.
Method
1.0.0.0
System.Boolean
To be added.
Return whether the specified master gain has been defined.
To be added.
To be added.
Property
1.0.0.0
System.Boolean
Return whether output is interpolated.
To be added.
To be added.
Method
1.0.0.0
System.Boolean
Return whether an audio stream has been reserved.
To be added.
To be added.
Method
1.0.0.0
System.Boolean
Return whether audio is being output.
To be added.
To be added.
Method
1.0.0.0
System.Boolean
Return whether output is stereo.
To be added.
To be added.
Property
1.0.0.0
Urho.SoundListener
Return active sound listener.
Or
Set active sound listener for 3D sounds.
To be added.
To be added.
Method
1.0.0.0
System.Void
To be added.
To be added.
Mix sound sources into the buffer.
To be added.
Property
1.0.0.0
System.Int32
Return mixing rate.
To be added.
To be added.
Method
1.0.0.0
System.Boolean
Restart sound output.
To be added.
To be added.
Method
1.0.0.0
System.Void
To be added.
Remove a sound source. Called by SoundSource.
To be added.
Property
1.0.0.0
System.UInt32
Return byte size of one sample.
To be added.
To be added.
Method
1.0.0.0
System.Void
To be added.
To be added.
Set master gain on a specific sound type such as sound effects, music or voice.
To be added.
Method
1.0.0.0
System.Boolean
To be added.
To be added.
To be added.
To be added.
Initialize sound output with specified buffer length and output mode.
To be added.
To be added.
Method
1.0.0.0
System.Void
Suspend sound output.
To be added.
Method
1.0.0.0
System.Void
To be added.
Stop any sound source playing a certain sound clip.
To be added.
Property
1.0.0.0
Urho.StringHash
Urho's type system type.
StringHash representing the type for this C# type.
This returns the Urho's type and is surfaced for low-level Urho code.
Property
1.0.0.0
System.String
Urho's low-level type name.
Stringified low-level type name.
Property
1.0.0.0
System.String
Urho's low-level type name, accessible as a static method.
Stringified low-level type name.
Property
1.0.0.0
Urho.StringHash
To be added.
To be added.
To be added.
Method
1.0.0.0
System.Void
To be added.
To be added.
To be added.