Commit 3a58e3a1 authored by David Reid's avatar David Reid

Fix resampling tests.

parent f30f75a8
...@@ -17,7 +17,7 @@ mal_uint32 on_read(mal_resampler* pResampler, mal_uint32 frameCount, void** ppFr ...@@ -17,7 +17,7 @@ mal_uint32 on_read(mal_resampler* pResampler, mal_uint32 frameCount, void** ppFr
{ {
mal_assert(pResampler->config.format == mal_format_f32); mal_assert(pResampler->config.format == mal_format_f32);
return (mal_uint32)mal_sine_wave_read_ex(&sineWave, frameCount, pResampler->config.channels, pResampler->config.layout, (float**)ppFramesOut); return (mal_uint32)mal_sine_wave_read_f32_ex(&sineWave, frameCount, pResampler->config.channels, pResampler->config.layout, (float**)ppFramesOut);
} }
int main(int argc, char** argv) int main(int argc, char** argv)
......
...@@ -40,7 +40,7 @@ mal_uint32 srcNextSampleIndex = mal_countof(srcInput); ...@@ -40,7 +40,7 @@ mal_uint32 srcNextSampleIndex = mal_countof(srcInput);
void reload_src_input() void reload_src_input()
{ {
mal_sine_wave_read(&sineWave, mal_countof(srcInput), srcInput); mal_sine_wave_read_f32(&sineWave, mal_countof(srcInput), srcInput);
srcNextSampleIndex = 0; srcNextSampleIndex = 0;
} }
...@@ -64,13 +64,15 @@ mal_uint32 on_src(mal_src* pSRC, mal_uint32 frameCount, void** ppSamplesOut, voi ...@@ -64,13 +64,15 @@ mal_uint32 on_src(mal_src* pSRC, mal_uint32 frameCount, void** ppSamplesOut, voi
return framesToRead; return framesToRead;
} }
mal_uint32 on_send_to_device(mal_device* pDevice, mal_uint32 frameCount, void* pFrames) void on_send_to_device(mal_device* pDevice, void* pOutput, const void* pInput, mal_uint32 frameCount)
{ {
(void)pDevice; (void)pDevice;
mal_assert(pDevice->format == mal_format_f32); (void)pInput;
mal_assert(pDevice->channels == 1);
float* pFramesF32 = (float*)pFrames; mal_assert(pDevice->playback.format == mal_format_f32);
mal_assert(pDevice->playback.channels == 1);
float* pFramesF32 = (float*)pOutput;
// To reproduce the case we are needing to test, we need to read from the SRC in a very specific way. We keep looping // To reproduce the case we are needing to test, we need to read from the SRC in a very specific way. We keep looping
// until we've read the requested frame count, however we have an inner loop that keeps running until mal_src_read() // until we've read the requested frame count, however we have an inner loop that keeps running until mal_src_read()
...@@ -95,7 +97,6 @@ mal_uint32 on_send_to_device(mal_device* pDevice, mal_uint32 frameCount, void* p ...@@ -95,7 +97,6 @@ mal_uint32 on_send_to_device(mal_device* pDevice, mal_uint32 frameCount, void* p
} }
mal_assert(totalFramesRead == frameCount); mal_assert(totalFramesRead == frameCount);
return frameCount;
} }
int main(int argc, char** argv) int main(int argc, char** argv)
...@@ -104,14 +105,18 @@ int main(int argc, char** argv) ...@@ -104,14 +105,18 @@ int main(int argc, char** argv)
(void)argv; (void)argv;
mal_device_config config = mal_device_config_init_playback(mal_format_f32, 1, 0, on_send_to_device); mal_device_config config = mal_device_config_init(mal_device_type_playback);
config.playback.format = mal_format_f32;
config.playback.channels = 1;
config.dataCallback = on_send_to_device;
mal_device device; mal_device device;
mal_result result; mal_result result;
config.bufferSizeInFrames = 8192*1; config.bufferSizeInFrames = 8192*1;
// We first play the sound the way it's meant to be played. // We first play the sound the way it's meant to be played.
result = mal_device_init(NULL, mal_device_type_playback, NULL, &config, NULL, &device); result = mal_device_init(NULL, &config, &device);
if (result != MAL_SUCCESS) { if (result != MAL_SUCCESS) {
return -1; return -1;
} }
......
...@@ -310,14 +310,6 @@ ...@@ -310,14 +310,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="mal_blocking.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="mal_dithering.c"> <ClCompile Include="mal_dithering.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
...@@ -335,14 +327,6 @@ ...@@ -335,14 +327,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="mal_no_device_io.c"> <ClCompile Include="mal_no_device_io.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="mal_profiling.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
...@@ -350,7 +334,7 @@ ...@@ -350,7 +334,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="mal_resampling.c"> <ClCompile Include="mal_profiling.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
...@@ -358,6 +342,14 @@ ...@@ -358,6 +342,14 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="mal_resampling.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="mal_stop.c"> <ClCompile Include="mal_stop.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
......
...@@ -45,9 +45,6 @@ ...@@ -45,9 +45,6 @@
<ClCompile Include="..\debugging\source\mal_router_1.c"> <ClCompile Include="..\debugging\source\mal_router_1.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="mal_blocking.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\examples\simple_enumeration.c"> <ClCompile Include="..\examples\simple_enumeration.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
......
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