Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
3a58e3a1
Commit
3a58e3a1
authored
Mar 06, 2019
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix resampling tests.
parent
f30f75a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
29 deletions
+23
-29
research/tests/mal_resampler_test_0.c
research/tests/mal_resampler_test_0.c
+1
-1
tests/mal_resampling.c
tests/mal_resampling.c
+13
-8
tests/mal_test_0.vcxproj
tests/mal_test_0.vcxproj
+9
-17
tests/mal_test_0.vcxproj.filters
tests/mal_test_0.vcxproj.filters
+0
-3
No files found.
research/tests/mal_resampler_test_0.c
View file @
3a58e3a1
...
@@ -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
)
...
...
tests/mal_resampling.c
View file @
3a58e3a1
...
@@ -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
;
}
}
...
...
tests/mal_test_0.vcxproj
View file @
3a58e3a1
...
@@ -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_
resamp
ling.c"
>
<ClCompile
Include=
"mal_
profi
ling.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>
...
...
tests/mal_test_0.vcxproj.filters
View file @
3a58e3a1
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment