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
1eaf97d0
Commit
1eaf97d0
authored
Jun 30, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update test to show a message when a device is stopped.
parent
1e9e2759
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
6 deletions
+25
-6
mini_al.h
mini_al.h
+18
-6
tests/mal_test_0.c
tests/mal_test_0.c
+7
-0
No files found.
mini_al.h
View file @
1eaf97d0
...
@@ -42,9 +42,7 @@
...
@@ -42,9 +42,7 @@
//
//
// You can then #include this file in other parts of the program as you would with any other header file.
// You can then #include this file in other parts of the program as you would with any other header file.
//
//
// The implementation of this library will try #include-ing necessary headers for some backends. If you do not have
// If you want to disable a specific backend, #define the appropriate MAL_NO_* option before the implementation.
// the development packages for any particular backend you can disable it by #define-ing the appropriate MAL_NO_*
// option before the implementation.
//
//
// Note that GCC and Clang requires "-msse2", "-mavx2", etc. for SIMD optimizations.
// Note that GCC and Clang requires "-msse2", "-mavx2", etc. for SIMD optimizations.
//
//
...
@@ -56,6 +54,7 @@
...
@@ -56,6 +54,7 @@
//
//
// Building for macOS
// Building for macOS
// ------------------
// ------------------
// The macOS build requires -framework CoreFoundation -framework CoreAudio -framework AudioToolbox.
//
//
// Building for Linux
// Building for Linux
// ------------------
// ------------------
...
@@ -12499,6 +12498,12 @@ mal_result mal_device__stop_backend__jack(mal_device* pDevice)
...
@@ -12499,6 +12498,12 @@ mal_result mal_device__stop_backend__jack(mal_device* pDevice)
if (((mal_jack_deactivate_proc)pContext->jack.jack_deactivate)((mal_jack_client_t*)pDevice->jack.pClient) != 0) {
if (((mal_jack_deactivate_proc)pContext->jack.jack_deactivate)((mal_jack_client_t*)pDevice->jack.pClient) != 0) {
return mal_post_error(pDevice, "[JACK] An error occurred when deactivating the JACK client.", MAL_ERROR);
return mal_post_error(pDevice, "[JACK] An error occurred when deactivating the JACK client.", MAL_ERROR);
}
}
mal_device__set_state(pDevice, MAL_STATE_STOPPED);
mal_stop_proc onStop = pDevice->onStop;
if (onStop) {
onStop(pDevice);
}
return MAL_SUCCESS;
return MAL_SUCCESS;
}
}
...
@@ -13847,7 +13852,7 @@ mal_result mal_device_init__coreaudio(mal_context* pContext, mal_device_type dev
...
@@ -13847,7 +13852,7 @@ mal_result mal_device_init__coreaudio(mal_context* pContext, mal_device_type dev
#endif
#endif
// Backend tax. Need to fiddle with this.
// Backend tax. Need to fiddle with this.
float fBackend = 1.
0;
float fBackend = 1.
5f; // <-- mini_al's implementation is actually kind of bad at the moment. TODO: Revisit this after AudioUnit implementation.
requestedBufferSizeInFrames = mal_calculate_default_buffer_size_in_frames(pConfig->performanceProfile, pConfig->sampleRate, fCPUSpeed*fType*fBackend);
requestedBufferSizeInFrames = mal_calculate_default_buffer_size_in_frames(pConfig->performanceProfile, pConfig->sampleRate, fCPUSpeed*fType*fBackend);
if (requestedBufferSizeInFrames == 0) {
if (requestedBufferSizeInFrames == 0) {
...
@@ -15202,8 +15207,9 @@ mal_result mal_device__stop_backend__opensl(mal_device* pDevice)
...
@@ -15202,8 +15207,9 @@ mal_result mal_device__stop_backend__opensl(mal_device* pDevice)
// Make sure the client is aware that the device has stopped. There may be an OpenSL|ES callback for this, but I haven't found it.
// Make sure the client is aware that the device has stopped. There may be an OpenSL|ES callback for this, but I haven't found it.
mal_device__set_state(pDevice, MAL_STATE_STOPPED);
mal_device__set_state(pDevice, MAL_STATE_STOPPED);
if (pDevice->onStop) {
mal_stop_proc onStop = pDevice->onStop;
pDevice->onStop(pDevice);
if (onStop) {
onStop(pDevice);
}
}
return MAL_SUCCESS;
return MAL_SUCCESS;
...
@@ -16727,6 +16733,12 @@ mal_result mal_device__stop_backend__sdl(mal_device* pDevice)
...
@@ -16727,6 +16733,12 @@ mal_result mal_device__stop_backend__sdl(mal_device* pDevice)
{
{
((MAL_PFN_SDL_PauseAudio)pDevice->pContext->sdl.SDL_PauseAudio)(1);
((MAL_PFN_SDL_PauseAudio)pDevice->pContext->sdl.SDL_PauseAudio)(1);
}
}
mal_device__set_state(pDevice, MAL_STATE_STOPPED);
mal_stop_proc onStop = pDevice->onStop;
if (onStop) {
onStop(pDevice);
}
return MAL_SUCCESS;
return MAL_SUCCESS;
}
}
tests/mal_test_0.c
View file @
1eaf97d0
...
@@ -43,6 +43,12 @@ void on_log(mal_context* pContext, mal_device* pDevice, const char* message)
...
@@ -43,6 +43,12 @@ void on_log(mal_context* pContext, mal_device* pDevice, const char* message)
printf
(
"%s
\n
"
,
message
);
printf
(
"%s
\n
"
,
message
);
}
}
void
on_stop
(
mal_device
*
pDevice
)
{
(
void
)
pDevice
;
printf
(
"Device Stopped.
\n
"
);
}
FILE
*
mal_fopen
(
const
char
*
filePath
,
const
char
*
openMode
)
FILE
*
mal_fopen
(
const
char
*
filePath
,
const
char
*
openMode
)
{
{
FILE
*
pFile
;
FILE
*
pFile
;
...
@@ -2272,6 +2278,7 @@ int do_playback_test(mal_backend backend)
...
@@ -2272,6 +2278,7 @@ int do_playback_test(mal_backend backend)
{
{
mal_context_config
contextConfig
=
mal_context_config_init
(
on_log
);
mal_context_config
contextConfig
=
mal_context_config_init
(
on_log
);
mal_device_config
deviceConfig
=
mal_device_config_init_default_playback
(
on_send__playback_test
);
mal_device_config
deviceConfig
=
mal_device_config_init_default_playback
(
on_send__playback_test
);
deviceConfig
.
onStopCallback
=
on_stop
;
#if defined(__EMSCRIPTEN__)
#if defined(__EMSCRIPTEN__)
deviceConfig
.
format
=
mal_format_f32
;
deviceConfig
.
format
=
mal_format_f32
;
...
...
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