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
e8e41984
Commit
e8e41984
authored
Jan 27, 2019
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A little bit of prep work for the full-duplex example.
parent
97c7c0a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
21 deletions
+42
-21
tests/mal_duplex.c
tests/mal_duplex.c
+30
-9
tests/mal_test_0.vcxproj
tests/mal_test_0.vcxproj
+12
-12
No files found.
tests/mal_duplex.c
View file @
e8e41984
...
...
@@ -3,7 +3,15 @@
#define MINI_AL_IMPLEMENTATION
#include "../mini_al.h"
void
on_stop
(
mal_device
*
pDevice
)
void
log_callback
(
mal_context
*
pContext
,
mal_device
*
pDevice
,
mal_uint32
logLevel
,
const
char
*
message
)
{
(
void
)
pContext
;
(
void
)
pDevice
;
(
void
)
logLevel
;
printf
(
"%s
\n
"
,
message
);
}
void
stop_callback
(
mal_device
*
pDevice
)
{
(
void
)
pDevice
;
printf
(
"STOPPED
\n
"
);
...
...
@@ -11,7 +19,7 @@ void on_stop(mal_device* pDevice)
void
data_callback
(
mal_device
*
pDevice
,
void
*
pOutput
,
const
void
*
pInput
,
mal_uint32
frameCount
)
{
/* In
our this test the format and channel count is
the same for both input and output which means we can just memcpy(). */
/* In
this test the format and channel count are
the same for both input and output which means we can just memcpy(). */
mal_copy_memory
(
pOutput
,
pInput
,
frameCount
*
mal_get_bytes_per_frame
(
pDevice
->
format
,
pDevice
->
channels
));
}
...
...
@@ -24,15 +32,28 @@ int main(int argc, char** argv)
mal_backend
backend
=
mal_backend_wasapi
;
mal_device_config
config
=
mal_device_config_init_default
(
data_callback
,
NULL
);
config
.
format
=
mal_format_f32
;
config
.
channels
=
2
;
config
.
sampleRate
=
44100
;
config
.
onStopCallback
=
on_stop
;
config
.
bufferSizeInFrames
=
16384
*
4
;
mal_context_config
contextConfig
=
mal_context_config_init
(
log_callback
);
mal_context
context
;
result
=
mal_context_init
(
&
backend
,
1
,
&
contextConfig
,
&
context
);
if
(
result
!=
MAL_SUCCESS
)
{
printf
(
"Failed to initialize context.
\n
"
);
return
result
;
}
mal_device_config
deviceConfig
=
mal_device_config_init
(
mal_device_type_duplex
);
deviceConfig
.
pDeviceID
=
NULL
;
deviceConfig
.
format
=
mal_format_f32
;
deviceConfig
.
channels
=
2
;
deviceConfig
.
sampleRate
=
44100
;
deviceConfig
.
bufferSizeInMilliseconds
=
50
;
deviceConfig
.
periods
=
3
;
deviceConfig
.
shareMode
=
mal_share_mode_shared
;
deviceConfig
.
dataCallback
=
data_callback
;
deviceConfig
.
stopCallback
=
stop_callback
;
deviceConfig
.
pUserData
=
NULL
;
mal_device
device
;
result
=
mal_device_init
_ex
(
&
backend
,
1
,
NULL
,
mal_device_type_playback
,
NULL
,
&
c
onfig
,
&
device
);
result
=
mal_device_init
(
&
context
,
&
deviceC
onfig
,
&
device
);
if
(
result
!=
MAL_SUCCESS
)
{
return
result
;
}
...
...
tests/mal_test_0.vcxproj
View file @
e8e41984
...
...
@@ -319,12 +319,12 @@
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
true
</ExcludedFromBuild>
</ClCompile>
<ClCompile
Include=
"mal_duplex.c"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|ARM'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|ARM'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|ARM'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|ARM'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
fals
e
</ExcludedFromBuild>
</ClCompile>
<ClCompile
Include=
"mal_no_device_io.c"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
true
</ExcludedFromBuild>
...
...
@@ -359,12 +359,12 @@
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
true
</ExcludedFromBuild>
</ClCompile>
<ClCompile
Include=
"mal_test_0.c"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|ARM'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|ARM'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|ARM'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|ARM'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
tru
e
</ExcludedFromBuild>
</ClCompile>
<ClCompile
Include=
"mal_test_0.cpp"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
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