Skip to content

Commit

Permalink
Fixes some pitch-related crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Sep 16, 2024
1 parent cba3a81 commit 41a297d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/__VinylClassMix/__VinylClassMix.gml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function __VinylClassMix(_mixName, _gainPattern, _membersLoop, _membersDuckOn, _
__gainLocalSpeed = infinity;

__pitchLocal = 1;
__pitchLocalTarget = _pitchLocal;
__pitchLocalTarget = __pitchLocal;
__pitchLocalSpeed = infinity;

__cleanUpIndex = 0;
Expand Down
14 changes: 11 additions & 3 deletions scripts/__VinylClassVoiceShuffle/__VinylClassVoiceShuffle.gml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function __VinylClassVoiceShuffle(_sound, _voice, _loopLocal, _gainPattern, _gai
if (__pitchLocal != __pitchLocalTarget)
{
__pitchLocal += clamp(__pitchLocalTarget - __pitchLocal, -_delta*__pitchLocalSpeed, _delta*__pitchLocalSpeed);
audio_sound_pitch(__voiceCurrent, __VINYL_VOICE_PITCH_SxPxLxM);
audio_sound_pitch(__voiceReference, __VINYL_VOICE_PITCH_SxPxLxM);
}

return true;
Expand Down Expand Up @@ -218,14 +218,22 @@ function __VinylClassVoiceShuffle(_sound, _voice, _loopLocal, _gainPattern, _gai
if (_rateOfChange > 100)
{
__pitchLocal = _pitch;
audio_sound_pitch(__voiceCurrent, __VINYL_VOICE_PITCH_SxPxLxM);
audio_sound_pitch(__voiceReference, __VINYL_VOICE_PITCH_SxPxLxM);
}
else
{
if (not __inUpdateArray)
{
__inUpdateArray = true;
array_push(_voiceUpdateArray, self);
}
}
}

static __SetMixPitch = function(_pitch)
{
__pitchMix = _pitch;
audio_sound_pitch(__voiceCurrent, __VINYL_VOICE_PITCH_SxPxLxM);
audio_sound_pitch(__voiceReference, __VINYL_VOICE_PITCH_SxPxLxM);
}

static __QueueUpdateForSound = function(_sound)
Expand Down
14 changes: 11 additions & 3 deletions scripts/__VinylClassVoiceSound/__VinylClassVoiceSound.gml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function __VinylClassVoiceSound(_voice, _loopLocal, _gainSound, _gainLocal, _gai
if (__pitchLocal != __pitchLocalTarget)
{
__pitchLocal += clamp(__pitchLocalTarget - __pitchLocal, -_delta*__pitchLocalSpeed, _delta*__pitchLocalSpeed);
audio_sound_pitch(__voiceCurrent, __VINYL_VOICE_PITCH_SxLxM);
audio_sound_pitch(__voiceReference, __VINYL_VOICE_PITCH_SxLxM);
}

return true;
Expand Down Expand Up @@ -215,14 +215,22 @@ function __VinylClassVoiceSound(_voice, _loopLocal, _gainSound, _gainLocal, _gai
if (_rateOfChange > 100)
{
__pitchLocal = _pitch;
audio_sound_pitch(__voiceCurrent, __VINYL_VOICE_PITCH_SxLxM);
audio_sound_pitch(__voiceReference, __VINYL_VOICE_PITCH_SxLxM);
}
else
{
if (not __inUpdateArray)
{
__inUpdateArray = true;
array_push(_voiceUpdateArray, self);
}
}
}

static __SetMixPitch = function(_pitch)
{
__pitchMix = _pitch;
audio_sound_pitch(__voiceCurrent, __VINYL_VOICE_PITCH_SxLxM);
audio_sound_pitch(__voiceReference, __VINYL_VOICE_PITCH_SxLxM);
}

static __QueueUpdateForSound = function(_sound)
Expand Down

0 comments on commit 41a297d

Please sign in to comment.