Commit 84d5040d authored by David Reid's avatar David Reid

API CHANGE: Remove the f32 sine wave APIs.

The following APIs are removed:

  * ma_sine_wave_read_f32()
  * ma_sine_wave_read_f32_ex()

Use ma_sine_wave_read_pcm_frames() as a replacement. This allows you to
generate sine wave samples in any format, controlled by a parameter.
parent 02a5cc0b
...@@ -3582,9 +3582,6 @@ typedef struct ...@@ -3582,9 +3582,6 @@ typedef struct
ma_result ma_sine_wave_init(double amplitude, double period, ma_uint32 sampleRate, ma_sine_wave* pSineWave); ma_result ma_sine_wave_init(double amplitude, double period, ma_uint32 sampleRate, ma_sine_wave* pSineWave);
ma_uint64 ma_sine_wave_read_pcm_frames(ma_sine_wave* pSineWave, void* pFramesOut, ma_uint64 frameCount, ma_format format, ma_uint32 channels); ma_uint64 ma_sine_wave_read_pcm_frames(ma_sine_wave* pSineWave, void* pFramesOut, ma_uint64 frameCount, ma_format format, ma_uint32 channels);
ma_uint64 ma_sine_wave_read_f32(ma_sine_wave* pSineWave, ma_uint64 count, float* pSamples);
ma_uint64 ma_sine_wave_read_f32_ex(ma_sine_wave* pSineWave, ma_uint64 frameCount, ma_uint32 channels, ma_stream_layout layout, float** ppFrames);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
...@@ -36196,11 +36193,6 @@ ma_result ma_sine_wave_init(double amplitude, double periodsPerSecond, ma_uint32 ...@@ -36196,11 +36193,6 @@ ma_result ma_sine_wave_init(double amplitude, double periodsPerSecond, ma_uint32
return MA_SUCCESS; return MA_SUCCESS;
} }
ma_uint64 ma_sine_wave_read_f32(ma_sine_wave* pSineWave, ma_uint64 count, float* pSamples)
{
return ma_sine_wave_read_f32_ex(pSineWave, count, 1, ma_stream_layout_interleaved, &pSamples);
}
ma_uint64 ma_sine_wave_read_pcm_frames(ma_sine_wave* pSineWave, void* pFramesOut, ma_uint64 frameCount, ma_format format, ma_uint32 channels) ma_uint64 ma_sine_wave_read_pcm_frames(ma_sine_wave* pSineWave, void* pFramesOut, ma_uint64 frameCount, ma_format format, ma_uint32 channels)
{ {
if (pSineWave == NULL) { if (pSineWave == NULL) {
...@@ -36230,37 +36222,6 @@ ma_uint64 ma_sine_wave_read_pcm_frames(ma_sine_wave* pSineWave, void* pFramesOut ...@@ -36230,37 +36222,6 @@ ma_uint64 ma_sine_wave_read_pcm_frames(ma_sine_wave* pSineWave, void* pFramesOut
return frameCount; return frameCount;
} }
ma_uint64 ma_sine_wave_read_f32_ex(ma_sine_wave* pSineWave, ma_uint64 frameCount, ma_uint32 channels, ma_stream_layout layout, float** ppFrames)
{
if (pSineWave == NULL) {
return 0;
}
if (ppFrames != NULL) {
ma_uint64 iFrame;
for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
ma_uint32 iChannel;
float s = (float)(sin(pSineWave->time * pSineWave->periodsPerSecond) * pSineWave->amplitude);
pSineWave->time += pSineWave->delta;
if (layout == ma_stream_layout_interleaved) {
for (iChannel = 0; iChannel < channels; iChannel += 1) {
ppFrames[0][iFrame*channels + iChannel] = s;
}
} else {
for (iChannel = 0; iChannel < channels; iChannel += 1) {
ppFrames[iChannel][iFrame] = s;
}
}
}
} else {
pSineWave->time += pSineWave->delta * (ma_int64)frameCount; /* Cast to int64 required for VC6. */
}
return frameCount;
}
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma warning(pop) #pragma warning(pop)
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment