Add support for disabling pitching.

This provides an optimization by allowing processing to bypass the
resampler. Audio data needs to pass through the resampler even for the
case where pitch=1 because it needs to update internal buffers which if
it didn't do, would result in a glitch when moving away from 1.

In practice most sounds won't require individual pitch control, however
in the interest in being consistent with miniaudio's philosophy of
things "Just Working", pitching is enabled by default. Pitching can be
disabled with MA_SOUND_FLAG_DISABLE_PITCH in ma_sound_init_*() and
ma_sound_group_init().
This commit is contained in:
David Reid
2021-01-12 20:33:53 +10:00
parent b5c0f6f6d3
commit 56e0e62497
2 changed files with 19 additions and 15 deletions
+2 -3
View File
@@ -84,7 +84,6 @@ int main(int argc, char** argv)
ma_engine_uninit(&engine);
return -1;
}
#if 0
result = ma_sound_init_from_file(&engine, argv[1], MA_DATA_SOURCE_FLAG_DECODE /*| MA_DATA_SOURCE_FLAG_ASYNC | MA_DATA_SOURCE_FLAG_STREAM*/, &loadNotification, NULL, &sound2);
if (result != MA_SUCCESS) {
@@ -102,7 +101,7 @@ int main(int argc, char** argv)
//ma_sound_group_set_fade_in_milliseconds(&group, 0, 1, 5000);
ma_sound_set_fade_in_milliseconds(&sound, 0, 1, 5000);
//ma_sound_set_fade_in_milliseconds(&sound, 0, 1, 5000);
/*ma_sound_set_volume(&sound, 0.25f);*/
/*ma_sound_set_pitch(&sound, 1.2f);*/
/*ma_sound_set_pan(&sound, 0.0f);*/
@@ -135,7 +134,7 @@ int main(int argc, char** argv)
ma_engine_play_sound(&engine, argv[3], NULL);*/
#endif
#if 0
#if 1
float pitch = 1;
float pitchStep = 0.01f;
float pitchMin = 0.125f;