PlayingSfxInstance (class)
-- PAGE INCOMPLETE -- This is class that manages the properties of a currently-playing sound effect. Objects of this class are generated for each audio clip played via the Audio.___Obj functions.
| PlayingSfxInstance class | |||
|---|---|---|---|
| Type | Function/Field | Return values/Value type | Description |
| function | PlayingSfxInstance:Pause() | nil | Pauses the object's sound or loop |
| function | PlayingSfxInstance:Resume() | nil | Resume the object's paused sound or loop |
| function | PlayingSfxInstance:Stop() | int | Stops the object's sound or loop. always returns 0 |
| function | PlayingSfxInstance:Expire(int ticks) | int | Change the timed stoppage of the object's sound |
| function | PlayingSfxInstance:FadeOut(int Channel, int fade_ms) | int | Fading out and stops playing sound or sound loop in specific channel with fade in lenght in milliseconds. Returns: The number of channels set to fade out. |
| function | PlayingSfxInstance:IsPlaying(int Channel) | int | Tells you if channel is playing, or not. Returns: Zero if the channel is not playing. Otherwise if you passed in -1, the number of channels playing is returned. If you passed in a specific channel, then 1 is returned if it is playing. |
| function | PlayingSfxInstance:IsPaused(int Channel) | int | Tells you if channel is paused, or not. Returns: Zero if the channel is not paused. Otherwise if you passed in -1, the number of paused channels is returned. If you passed in a specific channel, then 1 is returned if it is paused. |
| function | PlayingSfxInstance:IsFading(int Channel) | int | Tells you if which channel is fading in, out, or not. Does not tell you if the channel is playing anything, or paused, so you'd need to test that separately. Returns: the fading status. Never returns an error. |
| function | PlayingSfxInstance:Volume(int Channel, int volume) | int | Sets volume (from 0 to 128) to the specific channel. Returns: current volume of the channel. If channel is -1, the average volume is returned. |
| function | PlayingSfxInstance:SetPanning(int Channel, int left, int right) | int | Panning stereo effects. This effect will only work on stereo audio. Meaning you called Mix_OpenAudio with 2 channels. The easiest way to do true panning is to call SfxSetPanning(channel, left, 254 - left); so that the total volume is correct, if you consider the maximum volume to be 127 per channel for center, or 254 max for left, this works, but about halves the effective volume.
This Function registers the effect for you, so don't try to Mix_RegisterEffect it yourself. NOTE: Setting both left and right to 255 will unregister the effect from channel. You cannot unregister it any other way, unless you use Mix_UnregisterAllEffects on the channel. NOTE: Using this function on a mono audio device will not register the effect, nor will it return an error status. Returns: Zero on errors, such as bad channel, or if Mix_RegisterEffect failed. |
| function | PlayingSfxInstance:SetDistance(int Channel, int distance) | int | This effect simulates a simple attenuation of volume due to distance. The volume never quite reaches silence, even at max distance.
NOTE: Using a distance of 0 will cause the effect to unregister itself from channel. You cannot unregister it any other way, unless you use Mix_UnregisterAllEffects on the channel. Returns: Zero on errors, such as an invalid channel, or if Mix_RegisterEffect failed. |
| function | PlayingSfxInstance:Set3DPosition(int Channel, int angle, int distance) | int | This effect emulates a simple 3D audio effect. It's not all that realistic, but it can help improve some level of realism. By giving it the angle and distance from the camera's point of view, the effect pans and attenuates volumes. If you are looking for better positional audio, using OpenAL is suggested.
NOTE: Using angle and distance of 0, will cause the effect to unregister itself from channel. You cannot unregister it any other way, unless you use Mix_UnregisterAllEffects on the channel. Returns: Zero on errors, such as an invalid channel, or if Mix_RegisterEffect failed. |
| function | PlayingSfxInstance:ReverseStereo(int Channel, int flip) | int | Simple reverse stereo, swaps left and right channel sound.
NOTE: Using a flip of 0, will cause the effect to unregister itself from channel. You cannot unregister it any other way, unless you use Mix_UnregisterAllEffects on the channel. Returns: Zero on errors, such as an invalid channel, or if Mix_RegisterEffect failed. |