expose Q parameter on filters

mastering_effects
cosmonaut 2021-10-28 15:05:28 -07:00
parent 97924093ee
commit 6c182a6de2
2 changed files with 15 additions and 15 deletions

View File

@ -535,69 +535,69 @@ double FAudioGMS_StaticSound_LoadWAV(char *filePath)
return (double)sound->id; return (double)sound->id;
} }
static void FAudioGMS_INTERNAL_SoundInstance_SetLowPassFilter(FAudioGMS_SoundInstance* instance, float lowPassFilter) static void FAudioGMS_INTERNAL_SoundInstance_SetLowPassFilter(FAudioGMS_SoundInstance* instance, float lowPassFilter, float Q)
{ {
FAudioFilterParameters p; FAudioFilterParameters p;
p.Type = FAudioLowPassFilter; p.Type = FAudioLowPassFilter;
p.Frequency = lowPassFilter; p.Frequency = lowPassFilter;
p.OneOverQ = 1.0f; p.OneOverQ = 1.0f / Q;
FAudioVoice_SetFilterParameters(instance->handle, &p, 0); FAudioVoice_SetFilterParameters(instance->handle, &p, 0);
instance->lowPassFilter = lowPassFilter; instance->lowPassFilter = lowPassFilter;
} }
void FAudioGMS_SoundInstance_SetLowPassFilter(double soundInstanceID, double lowPassFilter) void FAudioGMS_SoundInstance_SetLowPassFilter(double soundInstanceID, double lowPassFilter, double Q)
{ {
FAudioGMS_SoundInstance *instance = FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_SoundInstance *instance = FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
if (instance != NULL) if (instance != NULL)
{ {
FAudioGMS_INTERNAL_SoundInstance_SetLowPassFilter(instance, lowPassFilter); FAudioGMS_INTERNAL_SoundInstance_SetLowPassFilter(instance, lowPassFilter, Q);
} }
} }
static void FAudioGMS_INTERNAL_SoundInstance_SetHighPassFilter(FAudioGMS_SoundInstance* instance, float highPassFilter) static void FAudioGMS_INTERNAL_SoundInstance_SetHighPassFilter(FAudioGMS_SoundInstance* instance, float highPassFilter, float Q)
{ {
FAudioFilterParameters p; FAudioFilterParameters p;
p.Type = FAudioHighPassFilter; p.Type = FAudioHighPassFilter;
p.Frequency = highPassFilter; p.Frequency = highPassFilter;
p.OneOverQ = 1.0f; p.OneOverQ = 1.0f / Q;
FAudioVoice_SetFilterParameters(instance->handle, &p, 0); FAudioVoice_SetFilterParameters(instance->handle, &p, 0);
instance->highPassFilter = highPassFilter; instance->highPassFilter = highPassFilter;
} }
void FAudioGMS_SoundInstance_SetHighPassFilter(double soundInstanceID, double highPassFilter) void FAudioGMS_SoundInstance_SetHighPassFilter(double soundInstanceID, double highPassFilter, double Q)
{ {
FAudioGMS_SoundInstance* instance = FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_SoundInstance* instance = FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
if (instance != NULL) if (instance != NULL)
{ {
FAudioGMS_INTERNAL_SoundInstance_SetHighPassFilter(instance, highPassFilter); FAudioGMS_INTERNAL_SoundInstance_SetHighPassFilter(instance, highPassFilter, Q);
} }
} }
static void FAudioGMS_INTERNAL_SoundInstance_SetBandPassFilter(FAudioGMS_SoundInstance* instance, float bandPassFilter) static void FAudioGMS_INTERNAL_SoundInstance_SetBandPassFilter(FAudioGMS_SoundInstance* instance, float bandPassFilter, float Q)
{ {
FAudioFilterParameters p; FAudioFilterParameters p;
p.Type = FAudioBandPassFilter; p.Type = FAudioBandPassFilter;
p.Frequency = bandPassFilter; p.Frequency = bandPassFilter;
p.OneOverQ = 1.0f; p.OneOverQ = 1.0f / Q;
FAudioVoice_SetFilterParameters(instance->handle, &p, 0); FAudioVoice_SetFilterParameters(instance->handle, &p, 0);
instance->bandPassFilter = bandPassFilter; instance->bandPassFilter = bandPassFilter;
} }
void FAudioGMS_SoundInstance_SetBandPassFilter(double soundInstanceID, double bandPassFilter) void FAudioGMS_SoundInstance_SetBandPassFilter(double soundInstanceID, double bandPassFilter, double Q)
{ {
FAudioGMS_SoundInstance* instance = FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_SoundInstance* instance = FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
if (instance != NULL) if (instance != NULL)
{ {
FAudioGMS_INTERNAL_SoundInstance_SetBandPassFilter(instance, bandPassFilter); FAudioGMS_INTERNAL_SoundInstance_SetBandPassFilter(instance, bandPassFilter, Q);
} }
} }

View File

@ -60,9 +60,9 @@ FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetVolume(double soundInstanceID, doub
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Set3DPosition(double soundInstanceID, double x, double y, double z); FAUDIOGMSAPI void FAudioGMS_SoundInstance_Set3DPosition(double soundInstanceID, double x, double y, double z);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetTrackPositionInSeconds(double soundInstanceID, double trackPositionInSeconds); FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetTrackPositionInSeconds(double soundInstanceID, double trackPositionInSeconds);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetVolumeOverTime(double soundInstanceID, double volume, double milliseconds); FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetVolumeOverTime(double soundInstanceID, double volume, double milliseconds);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetLowPassFilter(double soundInstanceID, double lowPassFilter); FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetLowPassFilter(double soundInstanceID, double lowPassFilter, double Q);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetHighPassFilter(double soundInstanceID, double highPassFilter); FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetHighPassFilter(double soundInstanceID, double highPassFilter, double Q);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetBandPassFilter(double soundInstanceID, double bandPassFilter); FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetBandPassFilter(double soundInstanceID, double bandPassFilter, double Q);
FAUDIOGMSAPI double FAudioGMS_SoundInstance_GetPitch(double soundInstanceID); FAUDIOGMSAPI double FAudioGMS_SoundInstance_GetPitch(double soundInstanceID);
FAUDIOGMSAPI double FAudioGMS_SoundInstance_GetVolume(double soundInstanceID); FAUDIOGMSAPI double FAudioGMS_SoundInstance_GetVolume(double soundInstanceID);