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
9f4a9e42
Commit
9f4a9e42
authored
Nov 07, 2017
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: Bug fixes for the new device iteration system.
parent
8f932b3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
mini_al.h
mini_al.h
+10
-10
No files found.
mini_al.h
View file @
9f4a9e42
...
@@ -1365,10 +1365,6 @@ void mal_pcm_convert(void* pOut, mal_format formatOut, const void* pIn, mal_form
...
@@ -1365,10 +1365,6 @@ void mal_pcm_convert(void* pOut, mal_format formatOut, const void* pIn, mal_form
#include <dlfcn.h>
#include <dlfcn.h>
#endif
#endif
#ifdef MAL_ENABLE_ALSA
#include <stdio.h> // Needed for sprintf() which is used for "hw:%d,%d" formatting. TODO: Remove this later.
#endif
#if !defined(MAL_64BIT) && !defined(MAL_32BIT)
#if !defined(MAL_64BIT) && !defined(MAL_32BIT)
#ifdef _WIN32
#ifdef _WIN32
#ifdef _WIN64
#ifdef _WIN64
...
@@ -5470,10 +5466,10 @@ static int mal_convert_device_name_to_hw_format__alsa(mal_context* pContext, cha
...
@@ -5470,10 +5466,10 @@ static int mal_convert_device_name_to_hw_format__alsa(mal_context* pContext, cha
const
char
*
dev
=
mal_find_char
(
src
,
','
,
&
commaPos
);
const
char
*
dev
=
mal_find_char
(
src
,
','
,
&
commaPos
);
if
(
dev
==
NULL
)
{
if
(
dev
==
NULL
)
{
dev
=
"0"
;
dev
=
"0"
;
mal_strncpy_s
(
card
,
sizeof
(
card
),
src
+
5
,
(
size_t
)
-
1
);
mal_strncpy_s
(
card
,
sizeof
(
card
),
src
+
6
,
(
size_t
)
-
1
);
// +6 = ":CARD="
}
else
{
}
else
{
dev
=
dev
+
4
;
dev
=
dev
+
5
;
// +5 = ",DEV="
mal_strncpy_s
(
card
,
sizeof
(
card
),
src
+
5
,
commaPos
-
5
);
mal_strncpy_s
(
card
,
sizeof
(
card
),
src
+
6
,
commaPos
-
6
);
// +6 = ":CARD="
}
}
int
cardIndex
=
((
mal_snd_card_get_index_proc
)
pContext
->
alsa
.
snd_card_get_index
)(
card
);
int
cardIndex
=
((
mal_snd_card_get_index_proc
)
pContext
->
alsa
.
snd_card_get_index
)(
card
);
...
@@ -5481,7 +5477,7 @@ static int mal_convert_device_name_to_hw_format__alsa(mal_context* pContext, cha
...
@@ -5481,7 +5477,7 @@ static int mal_convert_device_name_to_hw_format__alsa(mal_context* pContext, cha
return
-
2
;
// Failed to retrieve the card index.
return
-
2
;
// Failed to retrieve the card index.
}
}
printf
(
"TESTING: CARD=%s,DEV=%s
\n
"
,
card
,
dev
);
//
printf("TESTING: CARD=%s,DEV=%s\n", card, dev);
// Construction.
// Construction.
...
@@ -5511,6 +5507,7 @@ static mal_result mal_enumerate_devices__alsa(mal_context* pContext, mal_device_
...
@@ -5511,6 +5507,7 @@ static mal_result mal_enumerate_devices__alsa(mal_context* pContext, mal_device_
return
MAL_NO_BACKEND
;
return
MAL_NO_BACKEND
;
}
}
char
**
ppNextDeviceHint
=
ppDeviceHints
;
char
**
ppNextDeviceHint
=
ppDeviceHints
;
while
(
*
ppNextDeviceHint
!=
NULL
)
{
while
(
*
ppNextDeviceHint
!=
NULL
)
{
char
*
NAME
=
((
mal_snd_device_name_get_hint_proc
)
pContext
->
alsa
.
snd_device_name_get_hint
)(
*
ppNextDeviceHint
,
"NAME"
);
char
*
NAME
=
((
mal_snd_device_name_get_hint_proc
)
pContext
->
alsa
.
snd_device_name_get_hint
)(
*
ppNextDeviceHint
,
"NAME"
);
...
@@ -5533,7 +5530,10 @@ static mal_result mal_enumerate_devices__alsa(mal_context* pContext, mal_device_
...
@@ -5533,7 +5530,10 @@ static mal_result mal_enumerate_devices__alsa(mal_context* pContext, mal_device_
printf("NAME: %s\n", NAME);
printf("NAME: %s\n", NAME);
printf("DESC: %s\n", DESC);
printf("DESC: %s\n", DESC);
printf("IOID: %s\n", IOID);
printf("IOID: %s\n", IOID);
printf("\n");
char hwid[256];
mal_convert_device_name_to_hw_format__alsa(pContext, hwid, sizeof(hwid), NAME);
printf("DEVICE ID: %s\n\n", hwid);
#endif
#endif
if
(
pInfo
!=
NULL
)
{
if
(
pInfo
!=
NULL
)
{
...
@@ -5605,7 +5605,7 @@ static mal_result mal_device_init__alsa(mal_context* pContext, mal_device_type t
...
@@ -5605,7 +5605,7 @@ static mal_result mal_device_init__alsa(mal_context* pContext, mal_device_type t
// When opening the device, we first try opening it based on the name provided in deviceName. If this fails, fall back to the "hw:%d,%d".
// When opening the device, we first try opening it based on the name provided in deviceName. If this fails, fall back to the "hw:%d,%d".
snd_pcm_stream_t
stream
=
(
type
==
mal_device_type_playback
)
?
SND_PCM_STREAM_PLAYBACK
:
SND_PCM_STREAM_CAPTURE
;
snd_pcm_stream_t
stream
=
(
type
==
mal_device_type_playback
)
?
SND_PCM_STREAM_PLAYBACK
:
SND_PCM_STREAM_CAPTURE
;
if
(((
mal_snd_pcm_open_proc
)
pContext
->
alsa
.
snd_pcm_open
)((
snd_pcm_t
**
)
&
pDevice
->
alsa
.
pPCM
,
deviceName
,
stream
,
0
)
<
0
)
{
if
(((
mal_snd_pcm_open_proc
)
pContext
->
alsa
.
snd_pcm_open
)((
snd_pcm_t
**
)
&
pDevice
->
alsa
.
pPCM
,
deviceName
,
stream
,
0
)
<
0
)
{
printf
(
"Failed 1
\n
"
);
//printf("Failed first attempt at opening device.
\n");
if
(
mal_strcmp
(
deviceName
,
"default"
)
==
0
||
mal_strcmp
(
deviceName
,
"pulse"
)
==
0
)
{
if
(
mal_strcmp
(
deviceName
,
"default"
)
==
0
||
mal_strcmp
(
deviceName
,
"pulse"
)
==
0
)
{
// We may have failed to open the default device. Try falling back to the "hw" or "plughw" device, depending on preferences.
// We may have failed to open the default device. Try falling back to the "hw" or "plughw" device, depending on preferences.
if
(
pConfig
->
alsa
.
preferPlugHW
)
{
if
(
pConfig
->
alsa
.
preferPlugHW
)
{
...
...
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