forked from MoonsideGames/FAudioGMS
remove unused loop argument from sound instance wrapper
parent
57d3ffbc0e
commit
6ef79855ab
|
@ -18,7 +18,7 @@ function LoadStaticSound(filename)
|
|||
function StaticSound(_staticSoundID) constructor
|
||||
{
|
||||
staticSoundID = _staticSoundID;
|
||||
|
||||
|
||||
// Create a sound instance from this static sound.
|
||||
static CreateSoundInstance = function()
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ function StaticSound(_staticSoundID) constructor
|
|||
var instance = new SoundInstance(instanceID);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
// Plays and returns a sound instance!
|
||||
// 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)
|
||||
|
@ -44,7 +44,7 @@ function StaticSound(_staticSoundID) constructor
|
|||
instance.Play();
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
// Automatically destroys the SoundInstance when playback is finished.
|
||||
// Does NOT return an instance!
|
||||
static PlayOneOff = function(pan = 0, pitch = 1, volume = 1)
|
||||
|
@ -52,8 +52,8 @@ function StaticSound(_staticSoundID) constructor
|
|||
var instance = Play(pan, pitch, volume, false);
|
||||
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!
|
||||
static PlaySpatial = function(xPosition, yPosition, zPosition, pitch = 1, volume = 1, loop = false)
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ function StaticSound(_staticSoundID) constructor
|
|||
instance.Play(loop);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
// Automatically destroys the SoundInstance when playback is finished.
|
||||
// Does NOT return an instance!
|
||||
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.
|
||||
static Destroy = function()
|
||||
{
|
||||
FAudioGMS_StaticSound_Destroy(staticSoundID);
|
||||
FAudioGMS_StaticSound_Destroy(staticSoundID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,54 +100,54 @@ function SoundInstance(_soundInstanceID) constructor
|
|||
soundInstanceID = _soundInstanceID;
|
||||
|
||||
// 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.
|
||||
static Pause = function()
|
||||
{
|
||||
FAudioGMS_SoundInstance_Pause(soundInstanceID);
|
||||
}
|
||||
|
||||
|
||||
// Stops playback completely. If Play is called it will resume from the beginning of the sound.
|
||||
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.
|
||||
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.
|
||||
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).
|
||||
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.
|
||||
// NOTE: This is ignored if you have called Set3DPosition.
|
||||
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.
|
||||
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.
|
||||
// If you set the milliseconds value then this will fade over time.
|
||||
static SetVolume = function(volume, milliseconds = 0)
|
||||
|
@ -158,22 +158,22 @@ function SoundInstance(_soundInstanceID) constructor
|
|||
}
|
||||
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)
|
||||
{
|
||||
FAudioGMS_SoundInstance_SetTrackPositionInSeconds(soundInstanceID, seconds);
|
||||
}
|
||||
|
||||
|
||||
// Sets the playback region for the sound instance.
|
||||
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.
|
||||
// frequency: 0.0 <-> 1.0. 1.0 means all sound gets through.
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
// Sets a high pass filter on the sound.
|
||||
// frequency: 0.0 <-> 1.0. 0.0 means all sound gets through.
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
// Sets a band pass filter ont he sound.
|
||||
// frequency: 0.0 <-> 1.0
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
// Sets an effect chain on the sound.
|
||||
// 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!
|
||||
|
@ -206,58 +206,58 @@ function SoundInstance(_soundInstanceID) constructor
|
|||
{
|
||||
FAudioGMS_SoundInstance_SetEffectChain(soundInstanceID, effectChain.effectChainID, gain);
|
||||
}
|
||||
|
||||
|
||||
// Sets the effect gain of the current effect chain.
|
||||
// Does nothing if no effect chain is set.
|
||||
static SetEffectGain = function(gain)
|
||||
{
|
||||
FAudioGMS_SoundInstance_SetEffectGain(soundInstanceID, gain);
|
||||
}
|
||||
|
||||
|
||||
static QueueSoundInstance = function(queueSoundInstance)
|
||||
{
|
||||
FAudioGMS_SoundInstance_QueueSoundInstance(soundInstanceID, queueSoundInstance.soundInstanceID);
|
||||
}
|
||||
|
||||
|
||||
// Gets the pitch of the sound.
|
||||
static GetPitch = function()
|
||||
{
|
||||
return FAudioGMS_SoundInstance_GetPitch(soundInstanceID);
|
||||
return FAudioGMS_SoundInstance_GetPitch(soundInstanceID);
|
||||
}
|
||||
|
||||
|
||||
// Gets the volume of the sound.
|
||||
static GetVolume = function()
|
||||
{
|
||||
return FAudioGMS_SoundInstance_GetVolume(soundInstanceID);
|
||||
return FAudioGMS_SoundInstance_GetVolume(soundInstanceID);
|
||||
}
|
||||
|
||||
|
||||
// Gets the total length of the track.
|
||||
static GetTrackLengthInSeconds = function()
|
||||
{
|
||||
return FAudioGMS_SoundInstance_GetTrackLengthInSeconds(soundInstanceID);
|
||||
return FAudioGMS_SoundInstance_GetTrackLengthInSeconds(soundInstanceID);
|
||||
}
|
||||
|
||||
|
||||
// Gets the current track position.
|
||||
static GetTrackPositionInSeconds = function()
|
||||
{
|
||||
return FAudioGMS_SoundInstance_GetTrackPositionInSeconds(soundInstanceID);
|
||||
}
|
||||
|
||||
|
||||
// Destroys the FAudioGMS sound instance.
|
||||
// If you use the SoundInstance after calling this you are going to have a bad time.
|
||||
static Destroy = function()
|
||||
{
|
||||
FAudioGMS_SoundInstance_Destroy(soundInstanceID);
|
||||
FAudioGMS_SoundInstance_Destroy(soundInstanceID);
|
||||
}
|
||||
|
||||
|
||||
// Sets the FAudioGMS sound instance to destroy itself when playback is done.
|
||||
// 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.
|
||||
static DestroyWhenFinished = function()
|
||||
{
|
||||
FAudioGMS_SoundInstance_DestroyWhenFinished(soundInstanceID);
|
||||
FAudioGMS_SoundInstance_DestroyWhenFinished(soundInstanceID);
|
||||
}
|
||||
|
||||
|
||||
SetPan(0);
|
||||
SetPitch(1);
|
||||
SetVolume(1);
|
||||
|
@ -268,7 +268,7 @@ function SoundInstance(_soundInstanceID) constructor
|
|||
function EffectChain() constructor
|
||||
{
|
||||
effectChainID = FAudioGMS_EffectChain_Create();
|
||||
|
||||
|
||||
// Adds a reverb effect to the effect chain.
|
||||
static AddReverb = function(
|
||||
wetDryMix,
|
||||
|
@ -304,7 +304,7 @@ function EffectChain() constructor
|
|||
roomSize
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// 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.
|
||||
static AddDefaultReverb = function()
|
||||
|
@ -327,12 +327,12 @@ function EffectChain() constructor
|
|||
100
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Destroys the FAudioGMS effect chain.
|
||||
// If you use the EffectChain after calling this you are going to have a bad time.
|
||||
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.
|
||||
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()
|
||||
{
|
||||
FAudioGMS_StopAll();
|
||||
FAudioGMS_StopAll();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue