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
789bd232
Commit
789bd232
authored
Mar 18, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JACK: Implement the new device enumeration APIs.
parent
90269f6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
6 deletions
+70
-6
mini_al.h
mini_al.h
+70
-6
No files found.
mini_al.h
View file @
789bd232
...
@@ -10869,14 +10869,57 @@ typedef const char* (* mal_jack_port_name_proc) (const mal_
...
@@ -10869,14 +10869,57 @@ 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_port_get_buffer_proc
)
(
mal_jack_port_t
*
port
,
mal_jack_nframes_t
nframes
);
typedef
void
(
*
mal_jack_free_proc
)
(
void
*
ptr
);
typedef
void
(
*
mal_jack_free_proc
)
(
void
*
ptr
);
static
mal_result
mal_context_uninit__jack
(
mal_context
*
pContext
)
mal_bool32
mal_context_is_device_id_equal__jack
(
mal_context
*
pContext
,
const
mal_device_id
*
pID0
,
const
mal_device_id
*
pID1
)
{
{
mal_assert
(
pContext
!=
NULL
);
mal_assert
(
pContext
!=
NULL
);
mal_assert
(
pContext
->
backend
==
mal_backend_jack
);
mal_assert
(
pID0
!=
NULL
);
mal_assert
(
pID1
!=
NULL
);
(
void
)
pContext
;
#ifndef MAL_NO_RUNTIME_LINKING
return
pID0
->
jack
==
pID1
->
jack
;
mal_dlclose
(
pContext
->
jack
.
jackSO
);
}
#endif
mal_result
mal_context_enumerate_devices__jack
(
mal_context
*
pContext
,
mal_enum_devices_callback_proc
callback
,
void
*
pUserData
)
{
mal_assert
(
pContext
!=
NULL
);
mal_assert
(
callback
!=
NULL
);
mal_bool32
cbResult
=
MAL_TRUE
;
// Playback.
if
(
cbResult
)
{
mal_device_info
deviceInfo
;
mal_zero_object
(
&
deviceInfo
);
mal_strcpy_s
(
deviceInfo
.
name
,
sizeof
(
deviceInfo
.
name
),
MAL_DEFAULT_PLAYBACK_DEVICE_NAME
);
cbResult
=
callback
(
pContext
,
mal_device_type_playback
,
&
deviceInfo
,
pUserData
);
}
// Capture.
if
(
cbResult
)
{
mal_device_info
deviceInfo
;
mal_zero_object
(
&
deviceInfo
);
mal_strcpy_s
(
deviceInfo
.
name
,
sizeof
(
deviceInfo
.
name
),
MAL_DEFAULT_CAPTURE_DEVICE_NAME
);
cbResult
=
callback
(
pContext
,
mal_device_type_capture
,
&
deviceInfo
,
pUserData
);
}
return
MAL_SUCCESS
;
}
mal_result
mal_context_get_device_info__jack
(
mal_context
*
pContext
,
mal_device_type
deviceType
,
const
mal_device_id
*
pDeviceID
,
mal_share_mode
shareMode
,
mal_device_info
*
pDeviceInfo
)
{
mal_assert
(
pContext
!=
NULL
);
(
void
)
shareMode
;
if
(
pDeviceID
!=
NULL
&&
pDeviceID
->
jack
!=
0
)
{
return
MAL_NO_DEVICE
;
// Don't know the device.
}
// Name / Description
if
(
deviceType
==
mal_device_type_playback
)
{
mal_strcpy_s
(
pDeviceInfo
->
name
,
sizeof
(
pDeviceInfo
->
name
),
MAL_DEFAULT_PLAYBACK_DEVICE_NAME
);
}
else
{
mal_strcpy_s
(
pDeviceInfo
->
name
,
sizeof
(
pDeviceInfo
->
name
),
MAL_DEFAULT_CAPTURE_DEVICE_NAME
);
}
return
MAL_SUCCESS
;
return
MAL_SUCCESS
;
}
}
...
@@ -10961,6 +11004,22 @@ static mal_result mal_context_init__jack(mal_context* pContext)
...
@@ -10961,6 +11004,22 @@ static mal_result mal_context_init__jack(mal_context* pContext)
pContext
->
jack
.
jack_free
=
(
mal_proc
)
_jack_free
;
pContext
->
jack
.
jack_free
=
(
mal_proc
)
_jack_free
;
#endif
#endif
pContext
->
onDeviceIDEqual
=
mal_context_is_device_id_equal__jack
;
pContext
->
onEnumDevices
=
mal_context_enumerate_devices__jack
;
pContext
->
onGetDeviceInfo
=
mal_context_get_device_info__jack
;
return
MAL_SUCCESS
;
}
static
mal_result
mal_context_uninit__jack
(
mal_context
*
pContext
)
{
mal_assert
(
pContext
!=
NULL
);
mal_assert
(
pContext
->
backend
==
mal_backend_jack
);
#ifndef MAL_NO_RUNTIME_LINKING
mal_dlclose
(
pContext
->
jack
.
jackSO
);
#endif
return
MAL_SUCCESS
;
return
MAL_SUCCESS
;
}
}
...
@@ -11084,7 +11143,12 @@ mal_result mal_device_init__jack(mal_context* pContext, mal_device_type type, ma
...
@@ -11084,7 +11143,12 @@ mal_result mal_device_init__jack(mal_context* pContext, mal_device_type type, ma
mal_assert
(
pDevice
!=
NULL
);
mal_assert
(
pDevice
!=
NULL
);
(
void
)
pContext
;
(
void
)
pContext
;
(
void
)
pDeviceID
;
// Only supporting default devices with JACK.
// Only supporting default devices with JACK.
if
(
pDeviceID
!=
NULL
&&
pDeviceID
->
jack
!=
0
)
{
return
MAL_NO_DEVICE
;
}
// Open the client.
// Open the client.
size_t
maxClientNameSize
=
((
mal_jack_client_name_size_proc
)
pContext
->
jack
.
jack_client_name_size
)();
// Includes null terminator.
size_t
maxClientNameSize
=
((
mal_jack_client_name_size_proc
)
pContext
->
jack
.
jack_client_name_size
)();
// Includes null terminator.
...
...
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