DirectSound::SetFrequency usage/emulation? #475
-
Hi, I'm reverse engineering a game originally written for DOS/windows (https://github.com/dethrace-labs/dethrace), and have been working on its audio functionality, replacing calls to The original game calls I'm currently looking at // sound_buffer->lpVtbl->SetFrequency(sound_buffer, rate);
ma_sound_set_pitch(pSound, ...?); Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The way I understand it, DirectSound uses resampling to achieve the effect which is exactly what miniaudio does with Off the top of my head, it would look something like this (untested):
|
Beta Was this translation helpful? Give feedback.
The way I understand it, DirectSound uses resampling to achieve the effect which is exactly what miniaudio does with
ma_sound_set_pitch()
. The difference is the input parameter. miniaudio uses a scale which means a value of 1.0 will set it to the sound's default pitch, whereas a value of 2.0 will double the pitch (will make it higher) and 0.5 will halve it, etc. It looks like DirectSound uses an actual sample rate for it's input so you would need to do a conversion. You can usema_sound_get_data_format()
to retrieve the sound's default rate (just set the unneeded parameters to NULL). That will then give you enough information to set the scale.Off the top of my head, it would look somethi…