Update ma_noise_set_type() to prevent a crash.

Updating the noise type should not be supported. An oversight on my
part. Users should reinitialize a fresh `ma_noise` object instead.

This change simply returns an error and triggers an assert in debug
mode.

Public issue: https://github.com/mackron/miniaudio/issues/585
This commit is contained in:
David Reid
2022-12-03 11:07:34 +10:00
parent bd1c156e5f
commit b7159b76d5
+8 -2
View File
@@ -65046,8 +65046,14 @@ MA_API ma_result ma_noise_set_type(ma_noise* pNoise, ma_noise_type type)
return MA_INVALID_ARGS;
}
pNoise->config.type = type;
return MA_SUCCESS;
/*
This function should never have been implemented in the first place. Changing the type dynamically is not
supported. Instead you need to uninitialize and reinitiailize a fresh `ma_noise` object. This function
will be removed in version 0.12.
*/
MA_ASSERT(MA_FALSE);
return MA_INVALID_OPERATION;
}
static MA_INLINE float ma_noise_f32_white(ma_noise* pNoise)