remove unused loop argument from sound instance wrapper

main
cosmonaut 2021-11-08 08:45:24 -08:00
parent 57d3ffbc0e
commit 6ef79855ab
1 changed files with 53 additions and 53 deletions

View File

@ -18,7 +18,7 @@ function LoadStaticSound(filename)
function StaticSound(_staticSoundID) constructor function StaticSound(_staticSoundID) constructor
{ {
staticSoundID = _staticSoundID; staticSoundID = _staticSoundID;
// Create a sound instance from this static sound. // Create a sound instance from this static sound.
static CreateSoundInstance = function() static CreateSoundInstance = function()
{ {
@ -26,7 +26,7 @@ function StaticSound(_staticSoundID) constructor
var instance = new SoundInstance(instanceID); var instance = new SoundInstance(instanceID);
return instance; return instance;
} }
// Plays and returns a sound instance! // Plays and returns a sound instance!
// MUST be destroyed when you aren't referencing it any more or you will leak memory! // MUST be destroyed when you aren't referencing it any more or you will leak memory!
static Play = function(pan = 0, pitch = 1, volume = 1, loop = false, loopStartInMilliseconds = 0, loopEndInMilliseconds = 0) static Play = function(pan = 0, pitch = 1, volume = 1, loop = false, loopStartInMilliseconds = 0, loopEndInMilliseconds = 0)
@ -44,7 +44,7 @@ function StaticSound(_staticSoundID) constructor
instance.Play(); instance.Play();
return instance; return instance;
} }
// Automatically destroys the SoundInstance when playback is finished. // Automatically destroys the SoundInstance when playback is finished.
// Does NOT return an instance! // Does NOT return an instance!
static PlayOneOff = function(pan = 0, pitch = 1, volume = 1) static PlayOneOff = function(pan = 0, pitch = 1, volume = 1)
@ -52,8 +52,8 @@ function StaticSound(_staticSoundID) constructor
var instance = Play(pan, pitch, volume, false); var instance = Play(pan, pitch, volume, false);
instance.DestroyWhenFinished(); instance.DestroyWhenFinished();
} }
// Plays and returns a sound instance! // Plays and returns a sound instance!
// MUST be destroyed when you aren't referencing it any more or you will leak memory! // MUST be destroyed when you aren't referencing it any more or you will leak memory!
static PlaySpatial = function(xPosition, yPosition, zPosition, pitch = 1, volume = 1, loop = false) static PlaySpatial = function(xPosition, yPosition, zPosition, pitch = 1, volume = 1, loop = false)
{ {
@ -66,7 +66,7 @@ function StaticSound(_staticSoundID) constructor
instance.Play(loop); instance.Play(loop);
return instance; return instance;
} }
// Automatically destroys the SoundInstance when playback is finished. // Automatically destroys the SoundInstance when playback is finished.
// Does NOT return an instance! // Does NOT return an instance!
static PlaySpatialOneOff = function(xPosition, yPosition, zPosition, pitch = 1, volume = 1) static PlaySpatialOneOff = function(xPosition, yPosition, zPosition, pitch = 1, volume = 1)
@ -80,7 +80,7 @@ function StaticSound(_staticSoundID) constructor
// If you call this while there are still instances of the StaticSound, you are going to have a bad time. // If you call this while there are still instances of the StaticSound, you are going to have a bad time.
static Destroy = function() static Destroy = function()
{ {
FAudioGMS_StaticSound_Destroy(staticSoundID); FAudioGMS_StaticSound_Destroy(staticSoundID);
} }
} }
@ -100,54 +100,54 @@ function SoundInstance(_soundInstanceID) constructor
soundInstanceID = _soundInstanceID; soundInstanceID = _soundInstanceID;
// Plays the sound or resumes from pause. // Plays the sound or resumes from pause.
static Play = function(loop = false) static Play = function()
{ {
FAudioGMS_SoundInstance_Play(soundInstanceID); FAudioGMS_SoundInstance_Play(soundInstanceID);
} }
// Pauses playback. // Pauses playback.
static Pause = function() static Pause = function()
{ {
FAudioGMS_SoundInstance_Pause(soundInstanceID); FAudioGMS_SoundInstance_Pause(soundInstanceID);
} }
// Stops playback completely. If Play is called it will resume from the beginning of the sound. // Stops playback completely. If Play is called it will resume from the beginning of the sound.
static Stop = function() static Stop = function()
{ {
FAudioGMS_SoundInstance_Stop(soundInstanceID); FAudioGMS_SoundInstance_Stop(soundInstanceID);
} }
// Sets the 3-dimensional position of the sound. You probably want to use SetListenerPosition too. // Sets the 3-dimensional position of the sound. You probably want to use SetListenerPosition too.
static Set3DPosition = function(xPosition, yPosition, zPosition) static Set3DPosition = function(xPosition, yPosition, zPosition)
{ {
FAudioGMS_SoundInstance_Set3DPosition(soundInstanceID, xPosition, yPosition, zPosition); FAudioGMS_SoundInstance_Set3DPosition(soundInstanceID, xPosition, yPosition, zPosition);
} }
// Sets the 3-dimensional velocity of the sound. You probably want to use SetListenerVelocity too. // Sets the 3-dimensional velocity of the sound. You probably want to use SetListenerVelocity too.
static Set3DVelocity = function(xVelocity, yVelocity, zVelocity) static Set3DVelocity = function(xVelocity, yVelocity, zVelocity)
{ {
FAudioGMS_SoundInstance_Set3DVelocity(soundInstanceID, xVelocity, yVelocity, zVelocity); FAudioGMS_SoundInstance_Set3DVelocity(soundInstanceID, xVelocity, yVelocity, zVelocity);
} }
// Sets whether the sound instance loops (true) or does not (false). // Sets whether the sound instance loops (true) or does not (false).
static SetLoop = function(loop) static SetLoop = function(loop)
{ {
FAudioGMS_SoundInstance_SetLoop(soundInstanceID, loop); FAudioGMS_SoundInstance_SetLoop(soundInstanceID, loop);
} }
// Sets the panning value of the sound. -1 is farthest left, 1 is farthest right, 0 is center. // Sets the panning value of the sound. -1 is farthest left, 1 is farthest right, 0 is center.
// NOTE: This is ignored if you have called Set3DPosition. // NOTE: This is ignored if you have called Set3DPosition.
static SetPan = function(pan) static SetPan = function(pan)
{ {
FAudioGMS_SoundInstance_SetPan(soundInstanceID, pan); FAudioGMS_SoundInstance_SetPan(soundInstanceID, pan);
} }
// Sets the pitch of the sound. Default is 1. Lower than 1 is pitched down, higher than 1 is pitched up. // Sets the pitch of the sound. Default is 1. Lower than 1 is pitched down, higher than 1 is pitched up.
static SetPitch = function(pitch) static SetPitch = function(pitch)
{ {
FAudioGMS_SoundInstance_SetPitch(soundInstanceID, pitch); FAudioGMS_SoundInstance_SetPitch(soundInstanceID, pitch);
} }
// Sets the volume of the sound. Default is 1. Lower than 1 is quieter, greater than 1 is louder. // Sets the volume of the sound. Default is 1. Lower than 1 is quieter, greater than 1 is louder.
// If you set the milliseconds value then this will fade over time. // If you set the milliseconds value then this will fade over time.
static SetVolume = function(volume, milliseconds = 0) static SetVolume = function(volume, milliseconds = 0)
@ -158,22 +158,22 @@ function SoundInstance(_soundInstanceID) constructor
} }
else else
{ {
FAudioGMS_SoundInstance_SetVolume(soundInstanceID, volume); FAudioGMS_SoundInstance_SetVolume(soundInstanceID, volume);
} }
} }
// Sets the position of track playback. // Sets the position of track playback.
static SetTrackPosition = function(seconds) static SetTrackPosition = function(seconds)
{ {
FAudioGMS_SoundInstance_SetTrackPositionInSeconds(soundInstanceID, seconds); FAudioGMS_SoundInstance_SetTrackPositionInSeconds(soundInstanceID, seconds);
} }
// Sets the playback region for the sound instance. // Sets the playback region for the sound instance.
static SetPlayRegion = function(loopStartInMilliseconds, loopEndInMilliseconds) static SetPlayRegion = function(loopStartInMilliseconds, loopEndInMilliseconds)
{ {
FAudioGMS_SoundInstance_SetPlayRegion(soundInstanceID, loopStartInMilliseconds, loopEndInMilliseconds); FAudioGMS_SoundInstance_SetPlayRegion(soundInstanceID, loopStartInMilliseconds, loopEndInMilliseconds);
} }
// Sets a low pass filter on the sound. // Sets a low pass filter on the sound.
// frequency: 0.0 <-> 1.0. 1.0 means all sound gets through. // frequency: 0.0 <-> 1.0. 1.0 means all sound gets through.
// Q: set this to 1 unless you know what you're doing // Q: set this to 1 unless you know what you're doing
@ -181,7 +181,7 @@ function SoundInstance(_soundInstanceID) constructor
{ {
FAudioGMS_SoundInstance_SetLowPassFilter(soundInstanceID, frequency, Q); FAudioGMS_SoundInstance_SetLowPassFilter(soundInstanceID, frequency, Q);
} }
// Sets a high pass filter on the sound. // Sets a high pass filter on the sound.
// frequency: 0.0 <-> 1.0. 0.0 means all sound gets through. // frequency: 0.0 <-> 1.0. 0.0 means all sound gets through.
// Q: set this to 1 unless you know what you're doing // Q: set this to 1 unless you know what you're doing
@ -189,7 +189,7 @@ function SoundInstance(_soundInstanceID) constructor
{ {
FAudioGMS_SoundInstance_SetHighPassFilter(soundInstanceID, frequency, Q); FAudioGMS_SoundInstance_SetHighPassFilter(soundInstanceID, frequency, Q);
} }
// Sets a band pass filter ont he sound. // Sets a band pass filter ont he sound.
// frequency: 0.0 <-> 1.0 // frequency: 0.0 <-> 1.0
// Q: set this to 1 unless you know what you're doing // Q: set this to 1 unless you know what you're doing
@ -197,7 +197,7 @@ function SoundInstance(_soundInstanceID) constructor
{ {
FAudioGMS_SoundInstance_SetBandPassFilter(soundInstanceID, frequency, Q); FAudioGMS_SoundInstance_SetBandPassFilter(soundInstanceID, frequency, Q);
} }
// Sets an effect chain on the sound. // Sets an effect chain on the sound.
// Gain is how much the effect chain "affects" the sound. 1.0 is max. // Gain is how much the effect chain "affects" the sound. 1.0 is max.
// NOTE: Any changes to the effect chain will NOT apply automatically after this is set! // NOTE: Any changes to the effect chain will NOT apply automatically after this is set!
@ -206,58 +206,58 @@ function SoundInstance(_soundInstanceID) constructor
{ {
FAudioGMS_SoundInstance_SetEffectChain(soundInstanceID, effectChain.effectChainID, gain); FAudioGMS_SoundInstance_SetEffectChain(soundInstanceID, effectChain.effectChainID, gain);
} }
// Sets the effect gain of the current effect chain. // Sets the effect gain of the current effect chain.
// Does nothing if no effect chain is set. // Does nothing if no effect chain is set.
static SetEffectGain = function(gain) static SetEffectGain = function(gain)
{ {
FAudioGMS_SoundInstance_SetEffectGain(soundInstanceID, gain); FAudioGMS_SoundInstance_SetEffectGain(soundInstanceID, gain);
} }
static QueueSoundInstance = function(queueSoundInstance) static QueueSoundInstance = function(queueSoundInstance)
{ {
FAudioGMS_SoundInstance_QueueSoundInstance(soundInstanceID, queueSoundInstance.soundInstanceID); FAudioGMS_SoundInstance_QueueSoundInstance(soundInstanceID, queueSoundInstance.soundInstanceID);
} }
// Gets the pitch of the sound. // Gets the pitch of the sound.
static GetPitch = function() static GetPitch = function()
{ {
return FAudioGMS_SoundInstance_GetPitch(soundInstanceID); return FAudioGMS_SoundInstance_GetPitch(soundInstanceID);
} }
// Gets the volume of the sound. // Gets the volume of the sound.
static GetVolume = function() static GetVolume = function()
{ {
return FAudioGMS_SoundInstance_GetVolume(soundInstanceID); return FAudioGMS_SoundInstance_GetVolume(soundInstanceID);
} }
// Gets the total length of the track. // Gets the total length of the track.
static GetTrackLengthInSeconds = function() static GetTrackLengthInSeconds = function()
{ {
return FAudioGMS_SoundInstance_GetTrackLengthInSeconds(soundInstanceID); return FAudioGMS_SoundInstance_GetTrackLengthInSeconds(soundInstanceID);
} }
// Gets the current track position. // Gets the current track position.
static GetTrackPositionInSeconds = function() static GetTrackPositionInSeconds = function()
{ {
return FAudioGMS_SoundInstance_GetTrackPositionInSeconds(soundInstanceID); return FAudioGMS_SoundInstance_GetTrackPositionInSeconds(soundInstanceID);
} }
// Destroys the FAudioGMS sound instance. // Destroys the FAudioGMS sound instance.
// If you use the SoundInstance after calling this you are going to have a bad time. // If you use the SoundInstance after calling this you are going to have a bad time.
static Destroy = function() static Destroy = function()
{ {
FAudioGMS_SoundInstance_Destroy(soundInstanceID); FAudioGMS_SoundInstance_Destroy(soundInstanceID);
} }
// Sets the FAudioGMS sound instance to destroy itself when playback is done. // Sets the FAudioGMS sound instance to destroy itself when playback is done.
// Calling this on a looping sound is not a good idea. // Calling this on a looping sound is not a good idea.
// If you use the SoundInstance after calling this you might have a bad time. // If you use the SoundInstance after calling this you might have a bad time.
static DestroyWhenFinished = function() static DestroyWhenFinished = function()
{ {
FAudioGMS_SoundInstance_DestroyWhenFinished(soundInstanceID); FAudioGMS_SoundInstance_DestroyWhenFinished(soundInstanceID);
} }
SetPan(0); SetPan(0);
SetPitch(1); SetPitch(1);
SetVolume(1); SetVolume(1);
@ -268,7 +268,7 @@ function SoundInstance(_soundInstanceID) constructor
function EffectChain() constructor function EffectChain() constructor
{ {
effectChainID = FAudioGMS_EffectChain_Create(); effectChainID = FAudioGMS_EffectChain_Create();
// Adds a reverb effect to the effect chain. // Adds a reverb effect to the effect chain.
static AddReverb = function( static AddReverb = function(
wetDryMix, wetDryMix,
@ -304,7 +304,7 @@ function EffectChain() constructor
roomSize roomSize
); );
} }
// Adds a default reverb effect to the effect chain. // Adds a default reverb effect to the effect chain.
// This is a good place to start if you don't know what all the reverb params do. // This is a good place to start if you don't know what all the reverb params do.
static AddDefaultReverb = function() static AddDefaultReverb = function()
@ -327,12 +327,12 @@ function EffectChain() constructor
100 100
); );
} }
// Destroys the FAudioGMS effect chain. // Destroys the FAudioGMS effect chain.
// If you use the EffectChain after calling this you are going to have a bad time. // If you use the EffectChain after calling this you are going to have a bad time.
static Destroy = function() static Destroy = function()
{ {
FAudioGMS_EffectChain_Destroy(effectChainID); FAudioGMS_EffectChain_Destroy(effectChainID);
} }
} }
@ -345,11 +345,11 @@ function SetListenerPosition(xPosition, yPosition, zPosition)
// Sets the velocity of the listener for 3D audio. // Sets the velocity of the listener for 3D audio.
function SetListenerVelocity(xVelocity, yVelocity, zVelocity) function SetListenerVelocity(xVelocity, yVelocity, zVelocity)
{ {
FAudioGMS_SetListenerVelocity(xVelocity, yVelocity, zVelocity); FAudioGMS_SetListenerVelocity(xVelocity, yVelocity, zVelocity);
} }
// Stops all audio playback. // Stops all audio playback.
function StopAllAudio() function StopAllAudio()
{ {
FAudioGMS_StopAll(); FAudioGMS_StopAll();
} }