clamp filter frequency params

pull/1/head
cosmonaut 2021-10-28 15:07:30 -07:00
parent 6ff2682149
commit 2568e9869b
1 changed files with 3 additions and 3 deletions

View File

@ -539,7 +539,7 @@ static void FAudioGMS_INTERNAL_SoundInstance_SetLowPassFilter(FAudioGMS_SoundIns
{ {
FAudioFilterParameters p; FAudioFilterParameters p;
p.Type = FAudioLowPassFilter; p.Type = FAudioLowPassFilter;
p.Frequency = lowPassFilter; p.Frequency = SDL_max(0.0, SDL_min(1.0, lowPassFilter));
p.OneOverQ = 1.0f / Q; p.OneOverQ = 1.0f / Q;
FAudioVoice_SetFilterParameters(instance->handle, &p, 0); FAudioVoice_SetFilterParameters(instance->handle, &p, 0);
@ -561,7 +561,7 @@ static void FAudioGMS_INTERNAL_SoundInstance_SetHighPassFilter(FAudioGMS_SoundIn
{ {
FAudioFilterParameters p; FAudioFilterParameters p;
p.Type = FAudioHighPassFilter; p.Type = FAudioHighPassFilter;
p.Frequency = highPassFilter; p.Frequency = SDL_max(0.0, SDL_min(1.0, highPassFilter));
p.OneOverQ = 1.0f / Q; p.OneOverQ = 1.0f / Q;
FAudioVoice_SetFilterParameters(instance->handle, &p, 0); FAudioVoice_SetFilterParameters(instance->handle, &p, 0);
@ -583,7 +583,7 @@ static void FAudioGMS_INTERNAL_SoundInstance_SetBandPassFilter(FAudioGMS_SoundIn
{ {
FAudioFilterParameters p; FAudioFilterParameters p;
p.Type = FAudioBandPassFilter; p.Type = FAudioBandPassFilter;
p.Frequency = bandPassFilter; p.Frequency = SDL_max(0.0, SDL_min(1.0, bandPassFilter));
p.OneOverQ = 1.0f / Q; p.OneOverQ = 1.0f / Q;
FAudioVoice_SetFilterParameters(instance->handle, &p, 0); FAudioVoice_SetFilterParameters(instance->handle, &p, 0);