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
24167ba3
Commit
24167ba3
authored
Jan 13, 2019
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API CHANGE: Remove the device type and ID from mal_device_init/_ex().
parent
661115f1
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
125 additions
and
116 deletions
+125
-116
mini_al.h
mini_al.h
+91
-96
tests/mal_dithering.c
tests/mal_dithering.c
+12
-4
tests/mal_stop.c
tests/mal_stop.c
+5
-4
tests/mal_test_0.c
tests/mal_test_0.c
+8
-3
tests/mal_test_0.vcxproj
tests/mal_test_0.vcxproj
+9
-9
No files found.
mini_al.h
View file @
24167ba3
This diff is collapsed.
Click to expand it.
tests/mal_dithering.c
View file @
24167ba3
...
...
@@ -56,12 +56,18 @@ void on_send_to_device__dithered(mal_device* pDevice, void* pOutput, const void*
int
do_dithering_test
()
{
mal_device_config
config
=
mal_device_config_init
(
mal_format_f32
,
1
,
0
,
on_send_to_device__original
,
NULL
)
;
mal_device_config
config
;
mal_device
device
;
mal_result
result
;
config
=
mal_device_config_init
(
mal_device_type_playback
);
config
.
format
=
mal_format_f32
;
config
.
channels
=
1
;
config
.
sampleRate
=
0
;
config
.
dataCallback
=
on_send_to_device__original
;
// We first play the sound the way it's meant to be played.
result
=
mal_device_init
(
NULL
,
mal_device_type_playback
,
NULL
,
&
config
,
&
device
);
result
=
mal_device_init
(
NULL
,
&
config
,
&
device
);
if
(
result
!=
MAL_SUCCESS
)
{
return
-
1
;
}
...
...
@@ -106,9 +112,11 @@ int do_dithering_test()
return
-
3
;
}
config
=
mal_device_config_init
(
converterOutConfig
.
formatOut
,
1
,
0
,
on_send_to_device__dithered
,
&
converterOut
);
result
=
mal_device_init
(
NULL
,
mal_device_type_playback
,
NULL
,
&
config
,
&
device
);
config
.
dataCallback
=
on_send_to_device__dithered
;
config
.
pUserData
=
&
converterOut
;
result
=
mal_device_init
(
NULL
,
&
config
,
&
device
);
if
(
result
!=
MAL_SUCCESS
)
{
return
-
1
;
}
...
...
tests/mal_stop.c
View file @
24167ba3
...
...
@@ -14,7 +14,7 @@ void on_stop(mal_device* pDevice)
printf
(
"STOPPED
\n
"
);
}
void
data_callback
(
mal_device
*
pDevice
,
void
*
pOutput
,
const
void
*
pInput
,
mal_uint32
frameCount
)
void
on_data
(
mal_device
*
pDevice
,
void
*
pOutput
,
const
void
*
pInput
,
mal_uint32
frameCount
)
{
(
void
)
pInput
;
/* Not used yet. */
...
...
@@ -54,15 +54,16 @@ int main(int argc, char** argv)
mal_sine_wave_init
(
0
.
25
,
400
,
44100
,
&
sineWave
);
mal_device_config
config
=
mal_device_config_init
_default
(
data_callback
,
NULL
);
mal_device_config
config
=
mal_device_config_init
(
mal_device_type_playback
);
config
.
format
=
mal_format_f32
;
config
.
channels
=
2
;
config
.
sampleRate
=
44100
;
config
.
onStopCallback
=
on_stop
;
config
.
dataCallback
=
on_data
;
config
.
stopCallback
=
on_stop
;
config
.
bufferSizeInFrames
=
16384
*
4
;
mal_device
device
;
result
=
mal_device_init_ex
(
&
backend
,
1
,
NULL
,
mal_device_type_playback
,
NULL
,
&
config
,
&
device
);
result
=
mal_device_init_ex
(
&
backend
,
1
,
NULL
,
&
config
,
&
device
);
if
(
result
!=
MAL_SUCCESS
)
{
printf
(
"Failed to initialize device.
\n
"
);
return
result
;
...
...
tests/mal_test_0.c
View file @
24167ba3
...
...
@@ -2254,6 +2254,8 @@ void on_send__playback_test(mal_device* pDevice, void* pOutput, const void* pInp
}
}
#endif
(
void
)
pInput
;
}
void
on_stop__playback_test
(
mal_device
*
pDevice
)
...
...
@@ -2284,14 +2286,17 @@ int do_playback_test(mal_backend backend)
printf
(
" Opening Device... "
);
{
mal_context_config
contextConfig
=
mal_context_config_init
(
on_log
);
mal_device_config
deviceConfig
=
mal_device_config_init_default
(
on_send__playback_test
,
&
callbackData
);
deviceConfig
.
onStopCallback
=
on_stop__playback_test
;
mal_device_config
deviceConfig
=
mal_device_config_init
(
mal_device_type_playback
);
deviceConfig
.
pUserData
=
&
callbackData
;
deviceConfig
.
dataCallback
=
on_send__playback_test
;
deviceConfig
.
stopCallback
=
on_stop__playback_test
;
#if defined(__EMSCRIPTEN__)
deviceConfig
.
format
=
mal_format_f32
;
#endif
result
=
mal_device_init_ex
(
&
backend
,
1
,
&
contextConfig
,
mal_device_type_playback
,
NULL
,
&
deviceConfig
,
&
device
);
result
=
mal_device_init_ex
(
&
backend
,
1
,
&
contextConfig
,
&
deviceConfig
,
&
device
);
if
(
result
==
MAL_SUCCESS
)
{
printf
(
"Done
\n
"
);
}
else
{
...
...
tests/mal_test_0.vcxproj
View file @
24167ba3
...
...
@@ -351,21 +351,21 @@
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
true
</ExcludedFromBuild>
</ClCompile>
<ClCompile
Include=
"mal_stop.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_test_0.c"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
true
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|ARM'"
>
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_test_0.c"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
false
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|ARM'"
>
false
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
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_test_0.cpp"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
true
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|ARM'"
>
true
</ExcludedFromBuild>
...
...
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