SetAudioStreamVolume(object, int, float, float)

From NWN Lexicon
Jump to navigationJump to search

Change volume of an audio stream.

void SetAudioStreamVolume(
    object oPlayer,
    int nStreamIdentifier,
    float fVolume = 1.0,
    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.
fVolume
Volume is from 0.0 to 1.0 (
fFadeTime
The amount of seconds to gradually change the volume (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.

Subsequent calls to this function with fFadeTime >0.0f while already fading the volume will start the new fade with the previous' fade's progress as starting point.

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


Remarks

This can dip a volume as someone moves away from a source of audio.


Version

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


Example

// Sets the audio track 0 volume to 50% with a fade time of 5 seconds
void main()
{
    object oPC = GetFirstPC();

    SetAudioStreamVolume(oPlayer, AUDIOSTREAM_IDENTIFIER_0, 0.5, 5.0);
}

See Also

functions: 

StartAudioStream StopAudioStream SetAudioStreamPaused SeekAudioStream