Skip to content

DirectSound::SetFrequency usage/emulation? #475

Answered by mackron
dethrace-labs asked this question in Q&A
Discussion options

You must be logged in to vote

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 use ma_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…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dethrace-labs
Comment options

@mackron
Comment options

Answer selected by dethrace-labs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants