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
5b4b7fa2
Commit
5b4b7fa2
authored
Feb 24, 2019
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work on full-duplex with WebAudio.
parent
51ebb048
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
202 additions
and
47 deletions
+202
-47
mini_al.h
mini_al.h
+181
-44
tests/mal_duplex.c
tests/mal_duplex.c
+21
-3
No files found.
mini_al.h
View file @
5b4b7fa2
This diff is collapsed.
Click to expand it.
tests/mal_duplex.c
View file @
5b4b7fa2
...
...
@@ -6,6 +6,12 @@
#define DR_WAV_IMPLEMENTATION
#include "../extras/dr_wav.h"
#ifdef __EMSCRIPTEN__
void
main_loop__em
()
{
}
#endif
void
log_callback
(
mal_context
*
pContext
,
mal_device
*
pDevice
,
mal_uint32
logLevel
,
const
char
*
message
)
{
(
void
)
pContext
;
...
...
@@ -25,17 +31,20 @@ void data_callback(mal_device* pDevice, void* pOutput, const void* pInput, mal_u
/* 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
->
capture
.
format
,
pDevice
->
capture
.
channels
));
#if 0
/* Also write to a wav file for debugging. */
drwav* pWav = (drwav*)pDevice->pUserData;
mal_assert(pWav != NULL);
drwav_write_pcm_frames(pWav, frameCount, pInput);
#endif
}
int
main
(
int
argc
,
char
**
argv
)
{
mal_result
result
;
#if 0
drwav_data_format wavFormat;
wavFormat.container = drwav_container_riff;
wavFormat.format = DR_WAVE_FORMAT_PCM;
...
...
@@ -48,9 +57,10 @@ int main(int argc, char** argv)
printf("Failed to initialize output file.\n");
return -1;
}
#endif
mal_backend
backend
=
mal_backend_
dsound
;
mal_backend
backend
=
mal_backend_
webaudio
;
mal_context_config
contextConfig
=
mal_context_config_init
();
contextConfig
.
logCallback
=
log_callback
;
...
...
@@ -74,7 +84,7 @@ int main(int argc, char** argv)
deviceConfig
.
periods
=
2
;
deviceConfig
.
dataCallback
=
data_callback
;
deviceConfig
.
stopCallback
=
stop_callback
;
deviceConfig
.
pUserData
=
&
wav
;
deviceConfig
.
pUserData
=
NULL
;
/*&wav;*/
mal_device
device
;
result
=
mal_device_init
(
&
context
,
&
deviceConfig
,
&
device
);
...
...
@@ -82,13 +92,21 @@ int main(int argc, char** argv)
return
result
;
}
#ifdef __EMSCRIPTEN__
getchar
();
#endif
mal_device_start
(
&
device
);
#ifdef __EMSCRIPTEN__
emscripten_set_main_loop
(
main_loop__em
,
0
,
1
);
#else
printf
(
"Press Enter to quit...
\n
"
);
getchar
();
#endif
mal_device_uninit
(
&
device
);
drwav_uninit
(
&
wav
);
/*drwav_uninit(&wav);*/
(
void
)
argc
;
(
void
)
argv
;
...
...
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