SetAudioStreamPaused(object, int, int, float)

From NWN Lexicon
Jump to navigationJump to search

Un/pauses the given audio stream.

void SetAudioStreamPaused(
    object oPlayer,
    int nStreamIdentifier,
    int bPaused,
    float fFadeTime = 0.0
);

Parameters

oPlayer
The player to play an audio stream for.
nStreamIdentifier
Which AUDIOSTREAM_IDENTIFIER_* to start. There are 10 available in total.
bPaused
Pause the stream or not
fFadeTime
The amount of seconds to gradually fade the audio out/in instead of pausing/resuming directly (default: 0.0f)


Description

Un/pauses the given audio stream.

Only one type of fading can be active at once, for example: If you call StartAudioStream() with fFadeInTime = 10.0f, any other audio stream functions with a fade time >0.0f will have no effect until StartAudioStream() is done fading.

Will do nothing if the stream is currently not in use.


Remarks

This allows you to keep a stream "active" but pause for instance during dialogue, or if a band member doing a song drops out for a bit.


Version

This function was added in 88.8193.36-11 of NWN:EE.


Example

// Pauses the audio track 0 with a fade time of 5 seconds then starts it again after 10 seconds with a 3 second fade
void main()
{
    object oPC = GetFirstPC();

    SetAudioStreamPaused(oPlayer, AUDIOSTREAM_IDENTIFIER_0, TRUE, 5.0);

    DelayCommand(10.0, SetAudioStreamPaused(oPlayer, AUDIOSTREAM_IDENTIFIER_0, FALSE, 3.0));
}

See Also

functions: 

StartAudioStream StopAudioStream SetAudioStreamVolume SeekAudioStream