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
f9557f13
Commit
f9557f13
authored
Jul 11, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JACK: Fail context init if JACK is unusable.
parent
3405d9d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
mini_al.h
mini_al.h
+16
-9
No files found.
mini_al.h
View file @
f9557f13
...
...
@@ -12173,14 +12173,11 @@ typedef const char* (* mal_jack_port_name_proc) (const mal_
typedef void* (* mal_jack_port_get_buffer_proc) (mal_jack_port_t* port, mal_jack_nframes_t nframes);
typedef void (* mal_jack_free_proc) (void* ptr);
mal_result mal_context_open_client__jack(mal_context* pContext, mal_
device_type type, const mal_device_id* pDeviceID, mal_
jack_client_t** ppClient)
mal_result mal_context_open_client__jack(mal_context* pContext, mal_jack_client_t** ppClient)
{
mal_assert(pContext != NULL);
mal_assert(ppClient != NULL);
(void)type;
(void)pDeviceID;
if (ppClient) {
*ppClient = NULL;
}
...
...
@@ -12193,7 +12190,7 @@ mal_result mal_context_open_client__jack(mal_context* pContext, mal_device_type
mal_jack_status_t status;
mal_jack_client_t* pClient = ((mal_jack_client_open_proc)pContext->jack.jack_client_open)(clientName, (pContext->config.jack.tryStartServer) ? 0 : mal_JackNoStartServer, &status, NULL);
if (pClient == NULL) {
return
mal_context_post_error(pContext, NULL, MAL_LOG_LEVEL_ERROR, "[JACK] Failed to open client.", MAL_FAILED_TO_OPEN_BACKEND_DEVICE)
;
return
MAL_FAILED_TO_OPEN_BACKEND_DEVICE
;
}
if (ppClient) {
...
...
@@ -12263,9 +12260,9 @@ mal_result mal_context_get_device_info__jack(mal_context* pContext, mal_device_t
// The channel count and sample rate can only be determined by opening the device.
mal_jack_client_t* pClient;
mal_result result = mal_context_open_client__jack(pContext,
deviceType, pDeviceID,
&pClient);
mal_result result = mal_context_open_client__jack(pContext, &pClient);
if (result != MAL_SUCCESS) {
return
result
;
return
mal_context_post_error(pContext, NULL, MAL_LOG_LEVEL_ERROR, "[JACK] Failed to open client.", MAL_FAILED_TO_OPEN_BACKEND_DEVICE)
;
}
pDeviceInfo->minSampleRate = ((mal_jack_get_sample_rate_proc)pContext->jack.jack_get_sample_rate)((mal_jack_client_t*)pClient);
...
...
@@ -12375,6 +12372,16 @@ mal_result mal_context_init__jack(mal_context* pContext)
pContext->onEnumDevices = mal_context_enumerate_devices__jack;
pContext->onGetDeviceInfo = mal_context_get_device_info__jack;
// Getting here means the JACK library is installed, but it doesn't necessarily mean it's usable. We need to quickly test this by connecting
// a temporary client.
mal_jack_client_t* pDummyClient;
mal_result result = mal_context_open_client__jack(pContext, &pDummyClient);
if (result != MAL_SUCCESS) {
return MAL_NO_BACKEND;
}
((mal_jack_client_close_proc)pContext->jack.jack_client_close)((mal_jack_client_t*)pDummyClient);
return MAL_SUCCESS;
}
...
...
@@ -12488,9 +12495,9 @@ mal_result mal_device_init__jack(mal_context* pContext, mal_device_type type, ma
// Open the client.
mal_result result = mal_context_open_client__jack(pContext,
type, pDeviceID,
(mal_jack_client_t**)&pDevice->jack.pClient);
mal_result result = mal_context_open_client__jack(pContext, (mal_jack_client_t**)&pDevice->jack.pClient);
if (result != MAL_SUCCESS) {
return
result
;
return
mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[JACK] Failed to open client.", MAL_FAILED_TO_OPEN_BACKEND_DEVICE)
;
}
// Callbacks.
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