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
668e4181
Commit
668e4181
authored
Jul 15, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start using the new callback system for the OpenSL backend.
parent
4f453014
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
54 deletions
+59
-54
mini_al.h
mini_al.h
+59
-54
No files found.
mini_al.h
View file @
668e4181
...
...
@@ -12667,7 +12667,6 @@ mal_result mal_context_init__jack(mal_context* pContext)
pContext->onDeviceIDEqual = mal_context_is_device_id_equal__jack;
pContext->onEnumDevices = mal_context_enumerate_devices__jack;
pContext->onGetDeviceInfo = mal_context_get_device_info__jack;
pContext->onGetDeviceInfo = mal_context_get_device_info__jack;
pContext->onDeviceInit = mal_device_init__jack;
pContext->onDeviceUninit = mal_device_uninit__jack;
pContext->onDeviceStart = mal_device__start_backend__jack;
...
...
@@ -15351,54 +15350,6 @@ return_detailed_info:
return MAL_SUCCESS;
}
mal_result mal_context_init__opensl(mal_context* pContext)
{
mal_assert(pContext != NULL);
(void)pContext;
// Initialize global data first if applicable.
if (mal_atomic_increment_32(&g_malOpenSLInitCounter) == 1) {
SLresult resultSL = slCreateEngine(&g_malEngineObjectSL, 0, NULL, 0, NULL, NULL);
if (resultSL != SL_RESULT_SUCCESS) {
mal_atomic_decrement_32(&g_malOpenSLInitCounter);
return MAL_NO_BACKEND;
}
(*g_malEngineObjectSL)->Realize(g_malEngineObjectSL, SL_BOOLEAN_FALSE);
resultSL = (*g_malEngineObjectSL)->GetInterface(g_malEngineObjectSL, SL_IID_ENGINE, &g_malEngineSL);
if (resultSL != SL_RESULT_SUCCESS) {
(*g_malEngineObjectSL)->Destroy(g_malEngineObjectSL);
mal_atomic_decrement_32(&g_malOpenSLInitCounter);
return MAL_NO_BACKEND;
}
}
pContext->isBackendAsynchronous = MAL_TRUE;
pContext->onDeviceIDEqual = mal_context_is_device_id_equal__opensl;
pContext->onEnumDevices = mal_context_enumerate_devices__opensl;
pContext->onGetDeviceInfo = mal_context_get_device_info__opensl;
return MAL_SUCCESS;
}
mal_result mal_context_uninit__opensl(mal_context* pContext)
{
mal_assert(pContext != NULL);
mal_assert(pContext->backend == mal_backend_opensl);
(void)pContext;
// Uninit global data.
if (g_malOpenSLInitCounter > 0) {
if (mal_atomic_decrement_32(&g_malOpenSLInitCounter) == 0) {
(*g_malEngineObjectSL)->Destroy(g_malEngineObjectSL);
}
}
return MAL_SUCCESS;
}
#ifdef MAL_ANDROID
//void mal_buffer_queue_callback__opensl_android(SLAndroidSimpleBufferQueueItf pBufferQueue, SLuint32 eventFlags, const void* pBuffer, SLuint32 bufferSize, SLuint32 dataUsed, void* pContext)
...
...
@@ -15811,6 +15762,60 @@ mal_result mal_device__stop_backend__opensl(mal_device* pDevice)
return MAL_SUCCESS;
}
mal_result mal_context_uninit__opensl(mal_context* pContext)
{
mal_assert(pContext != NULL);
mal_assert(pContext->backend == mal_backend_opensl);
(void)pContext;
// Uninit global data.
if (g_malOpenSLInitCounter > 0) {
if (mal_atomic_decrement_32(&g_malOpenSLInitCounter) == 0) {
(*g_malEngineObjectSL)->Destroy(g_malEngineObjectSL);
}
}
return MAL_SUCCESS;
}
mal_result mal_context_init__opensl(mal_context* pContext)
{
mal_assert(pContext != NULL);
(void)pContext;
// Initialize global data first if applicable.
if (mal_atomic_increment_32(&g_malOpenSLInitCounter) == 1) {
SLresult resultSL = slCreateEngine(&g_malEngineObjectSL, 0, NULL, 0, NULL, NULL);
if (resultSL != SL_RESULT_SUCCESS) {
mal_atomic_decrement_32(&g_malOpenSLInitCounter);
return MAL_NO_BACKEND;
}
(*g_malEngineObjectSL)->Realize(g_malEngineObjectSL, SL_BOOLEAN_FALSE);
resultSL = (*g_malEngineObjectSL)->GetInterface(g_malEngineObjectSL, SL_IID_ENGINE, &g_malEngineSL);
if (resultSL != SL_RESULT_SUCCESS) {
(*g_malEngineObjectSL)->Destroy(g_malEngineObjectSL);
mal_atomic_decrement_32(&g_malOpenSLInitCounter);
return MAL_NO_BACKEND;
}
}
pContext->isBackendAsynchronous = MAL_TRUE;
pContext->onUninit = mal_context_uninit__opensl;
pContext->onDeviceIDEqual = mal_context_is_device_id_equal__opensl;
pContext->onEnumDevices = mal_context_enumerate_devices__opensl;
pContext->onGetDeviceInfo = mal_context_get_device_info__opensl;
pContext->onDeviceInit = mal_device_init__opensl;
pContext->onDeviceUninit = mal_device_uninit__opensl;
pContext->onDeviceStart = mal_device__start_backend__opensl;
pContext->onDeviceStop = mal_device__stop_backend__opensl;
return MAL_SUCCESS;
}
#endif // OpenSL|ES
///////////////////////////////////////////////////////////////////////////////
...
...
@@ -18008,7 +18013,7 @@ mal_result mal_context_uninit(mal_context* pContext)
#ifdef MAL_HAS_OPENSL
case mal_backend_opensl:
{
mal_context_uninit__opensl
(pContext);
pContext->onUninit
(pContext);
} break;
#endif
#ifdef MAL_HAS_OPENAL
...
...
@@ -18354,7 +18359,7 @@ mal_result mal_device_init(mal_context* pContext, mal_device_type type, mal_devi
#ifdef MAL_HAS_OPENSL
case mal_backend_opensl:
{
result =
mal_device_init__opensl
(pContext, type, pDeviceID, &config, pDevice);
result =
pContext->onDeviceInit
(pContext, type, pDeviceID, &config, pDevice);
} break;
#endif
#ifdef MAL_HAS_OPENAL
...
...
@@ -18568,7 +18573,7 @@ void mal_device_uninit(mal_device* pDevice)
#endif
#ifdef MAL_HAS_OPENSL
if (pDevice->pContext->backend == mal_backend_opensl) {
mal_device_uninit__opensl
(pDevice);
pDevice->pContext->onDeviceUninit
(pDevice);
}
#endif
#ifdef MAL_HAS_OPENAL
...
...
@@ -18665,7 +18670,7 @@ mal_result mal_device_start(mal_device* pDevice)
#endif
#ifdef MAL_HAS_OPENSL
if (pDevice->pContext->backend == mal_backend_opensl) {
result =
mal_device__start_backend__opensl
(pDevice);
result =
pDevice->pContext->onDeviceStart
(pDevice);
if (result == MAL_SUCCESS) {
mal_device__set_state(pDevice, MAL_STATE_STARTED);
}
...
...
@@ -18738,7 +18743,7 @@ mal_result mal_device_stop(mal_device* pDevice)
#endif
#ifdef MAL_HAS_OPENSL
if (pDevice->pContext->backend == mal_backend_opensl) {
mal_device__stop_backend__opensl
(pDevice);
pDevice->pContext->onDeviceStop
(pDevice);
}
#endif
#ifdef MAL_HAS_SDL
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