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
7c937c49
Commit
7c937c49
authored
Nov 01, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: Add basic support for detecting default devices.
Public issue
https://github.com/mackron/miniaudio/issues/126
parent
edfc9bbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
miniaudio.h
miniaudio.h
+16
-3
No files found.
miniaudio.h
View file @
7c937c49
...
...
@@ -18242,6 +18242,15 @@ static ma_result ma_context_enumerate_devices__alsa(ma_context* pContext, ma_enu
MA_ZERO_OBJECT(&deviceInfo);
ma_strncpy_s(deviceInfo.id.alsa, sizeof(deviceInfo.id.alsa), hwid, (size_t)-1);
/*
There's no good way to determine whether or not a device is the default on Linux. We're just going to do something simple and
just use the name of "default" as the indicator.
*/
if (ma_strcmp(deviceInfo.id.alsa, "default") == 0) {
deviceInfo._private.isDefault = MA_TRUE;
}
/*
DESC is the friendly name. We treat this slightly differently depending on whether or not we are using verbose
device enumeration. In verbose mode we want to take the entire description so that the end-user can distinguish
...
...
@@ -18363,9 +18372,9 @@ static ma_result ma_context_get_device_info__alsa(ma_context* pContext, ma_devic
MA_ASSERT(pContext != NULL);
/* We just enumerate to find basic information about the device. */
data.deviceType = deviceType;
data.pDeviceID = pDeviceID;
data.shareMode = shareMode;
data.deviceType
= deviceType;
data.pDeviceID
= pDeviceID;
data.shareMode
= shareMode;
data.pDeviceInfo = pDeviceInfo;
data.foundDevice = MA_FALSE;
result = ma_context_enumerate_devices__alsa(pContext, ma_context_get_device_info_enum_callback__alsa, &data);
...
...
@@ -18377,6 +18386,10 @@ static ma_result ma_context_get_device_info__alsa(ma_context* pContext, ma_devic
return MA_NO_DEVICE;
}
if (ma_strcmp(pDeviceInfo->id.alsa, "default") == 0) {
pDeviceInfo->_private.isDefault = MA_TRUE;
}
/* For detailed info we need to open the device. */
result = ma_context_open_pcm__alsa(pContext, shareMode, deviceType, pDeviceID, 0, &pPCM);
if (result != MA_SUCCESS) {
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