Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
254b8f85
Commit
254b8f85
authored
Mar 05, 2011
by
Andy Norris
Committed by
Alexandre Julliard
Mar 08, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winealsa: Add support for alsa cards without a PCM mixer (only Line).
parent
fcfbb46d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
73 deletions
+90
-73
alsa.c
dlls/winealsa.drv/alsa.c
+81
-72
mixer.c
dlls/winealsa.drv/mixer.c
+9
-1
No files found.
dlls/winealsa.drv/alsa.c
View file @
254b8f85
...
...
@@ -421,6 +421,8 @@ int ALSA_CheckSetVolume(snd_hctl_t *hctl, int *out_left, int *out_right,
snd_ctl_elem_info_t
*
eleminfop
=
NULL
;
snd_ctl_elem_value_t
*
elemvaluep
=
NULL
;
snd_ctl_elem_id_t
*
elemidp
=
NULL
;
const
char
*
names
[]
=
{
"PCM Playback Volume"
,
"Line Playback Volume"
,
NULL
};
const
char
**
name
;
#define EXIT_ON_ERROR(f,txt,exitcode) do \
...
...
@@ -447,81 +449,88 @@ int ALSA_CheckSetVolume(snd_hctl_t *hctl, int *out_left, int *out_right,
/* Setup and find an element id that exactly matches the characteristic we want
** FIXME: It is probably short sighted to hard code and fixate on PCM Playback Volume */
snd_ctl_elem_id_set_name
(
elemidp
,
"PCM Playback Volume"
);
snd_ctl_elem_id_set_interface
(
elemidp
,
SND_CTL_ELEM_IFACE_MIXER
);
elem
=
snd_hctl_find_elem
(
hctl
,
elemidp
);
if
(
elem
)
{
/* Read and return volume information */
EXIT_ON_ERROR
(
snd_hctl_elem_info
(
elem
,
eleminfop
),
"snd_hctl_elem_info"
,
MMSYSERR_NOTSUPPORTED
);
value_count
=
snd_ctl_elem_info_get_count
(
eleminfop
);
if
(
out_min
||
out_max
||
out_step
)
{
if
(
!
snd_ctl_elem_info_is_readable
(
eleminfop
))
{
ERR
(
"snd_ctl_elem_info_is_readable returned false; cannot return info
\n
"
);
rc
=
MMSYSERR_NOTSUPPORTED
;
goto
out
;
}
if
(
out_min
)
*
out_min
=
snd_ctl_elem_info_get_min
(
eleminfop
);
if
(
out_max
)
*
out_max
=
snd_ctl_elem_info_get_max
(
eleminfop
);
if
(
out_step
)
*
out_step
=
snd_ctl_elem_info_get_step
(
eleminfop
);
}
if
(
out_left
||
out_right
)
{
EXIT_ON_ERROR
(
snd_hctl_elem_read
(
elem
,
elemvaluep
),
"snd_hctl_elem_read"
,
MMSYSERR_NOTSUPPORTED
);
if
(
out_left
)
*
out_left
=
snd_ctl_elem_value_get_integer
(
elemvaluep
,
0
);
if
(
out_right
)
{
if
(
value_count
==
1
)
*
out_right
=
snd_ctl_elem_value_get_integer
(
elemvaluep
,
0
);
else
if
(
value_count
==
2
)
*
out_right
=
snd_ctl_elem_value_get_integer
(
elemvaluep
,
1
);
else
{
ERR
(
"Unexpected value count %d from snd_ctl_elem_info_get_count while getting volume info
\n
"
,
value_count
);
rc
=
-
1
;
goto
out
;
}
}
}
/* Set the volume */
if
(
new_left
||
new_right
)
{
EXIT_ON_ERROR
(
snd_hctl_elem_read
(
elem
,
elemvaluep
),
"snd_hctl_elem_read"
,
MMSYSERR_NOTSUPPORTED
);
if
(
new_left
)
snd_ctl_elem_value_set_integer
(
elemvaluep
,
0
,
*
new_left
);
if
(
new_right
)
{
if
(
value_count
==
1
)
snd_ctl_elem_value_set_integer
(
elemvaluep
,
0
,
*
new_right
);
else
if
(
value_count
==
2
)
snd_ctl_elem_value_set_integer
(
elemvaluep
,
1
,
*
new_right
);
else
{
ERR
(
"Unexpected value count %d from snd_ctl_elem_info_get_count while setting volume info
\n
"
,
value_count
);
rc
=
-
1
;
goto
out
;
}
}
EXIT_ON_ERROR
(
snd_hctl_elem_write
(
elem
,
elemvaluep
),
"snd_hctl_elem_write"
,
MMSYSERR_NOTSUPPORTED
);
}
for
(
name
=
names
;
*
name
;
name
++
)
{
snd_ctl_elem_id_set_name
(
elemidp
,
*
name
);
snd_ctl_elem_id_set_interface
(
elemidp
,
SND_CTL_ELEM_IFACE_MIXER
);
elem
=
snd_hctl_find_elem
(
hctl
,
elemidp
);
if
(
elem
)
{
/* Read and return volume information */
EXIT_ON_ERROR
(
snd_hctl_elem_info
(
elem
,
eleminfop
),
"snd_hctl_elem_info"
,
MMSYSERR_NOTSUPPORTED
);
value_count
=
snd_ctl_elem_info_get_count
(
eleminfop
);
if
(
out_min
||
out_max
||
out_step
)
{
if
(
!
snd_ctl_elem_info_is_readable
(
eleminfop
))
{
ERR
(
"snd_ctl_elem_info_is_readable returned false; cannot return info
\n
"
);
rc
=
MMSYSERR_NOTSUPPORTED
;
goto
out
;
}
if
(
out_min
)
*
out_min
=
snd_ctl_elem_info_get_min
(
eleminfop
);
if
(
out_max
)
*
out_max
=
snd_ctl_elem_info_get_max
(
eleminfop
);
if
(
out_step
)
*
out_step
=
snd_ctl_elem_info_get_step
(
eleminfop
);
}
if
(
out_left
||
out_right
)
{
EXIT_ON_ERROR
(
snd_hctl_elem_read
(
elem
,
elemvaluep
),
"snd_hctl_elem_read"
,
MMSYSERR_NOTSUPPORTED
);
if
(
out_left
)
*
out_left
=
snd_ctl_elem_value_get_integer
(
elemvaluep
,
0
);
if
(
out_right
)
{
if
(
value_count
==
1
)
*
out_right
=
snd_ctl_elem_value_get_integer
(
elemvaluep
,
0
);
else
if
(
value_count
==
2
)
*
out_right
=
snd_ctl_elem_value_get_integer
(
elemvaluep
,
1
);
else
{
ERR
(
"Unexpected value count %d from snd_ctl_elem_info_get_count while getting volume info
\n
"
,
value_count
);
rc
=
-
1
;
goto
out
;
}
}
}
/* Set the volume */
if
(
new_left
||
new_right
)
{
EXIT_ON_ERROR
(
snd_hctl_elem_read
(
elem
,
elemvaluep
),
"snd_hctl_elem_read"
,
MMSYSERR_NOTSUPPORTED
);
if
(
new_left
)
snd_ctl_elem_value_set_integer
(
elemvaluep
,
0
,
*
new_left
);
if
(
new_right
)
{
if
(
value_count
==
1
)
snd_ctl_elem_value_set_integer
(
elemvaluep
,
0
,
*
new_right
);
else
if
(
value_count
==
2
)
snd_ctl_elem_value_set_integer
(
elemvaluep
,
1
,
*
new_right
);
else
{
ERR
(
"Unexpected value count %d from snd_ctl_elem_info_get_count while setting volume info
\n
"
,
value_count
);
rc
=
-
1
;
goto
out
;
}
}
EXIT_ON_ERROR
(
snd_hctl_elem_write
(
elem
,
elemvaluep
),
"snd_hctl_elem_write"
,
MMSYSERR_NOTSUPPORTED
);
}
break
;
}
}
else
if
(
!*
name
)
{
ERR
(
"Could not find '
PCM
Playback Volume' element
\n
"
);
ERR
(
"Could not find '
{PCM,Line}
Playback Volume' element
\n
"
);
rc
=
MMSYSERR_NOTSUPPORTED
;
}
...
...
dlls/winealsa.drv/mixer.c
View file @
254b8f85
...
...
@@ -435,7 +435,7 @@ static void ALSA_MixerInit(void)
char
cardind
[
6
],
cardname
[
10
];
snd_ctl_t
*
ctl
;
snd_mixer_elem_t
*
elem
,
*
mastelem
=
NULL
,
*
headelem
=
NULL
,
*
captelem
=
NULL
,
*
pcmelem
=
NULL
,
*
micelem
=
NULL
;
snd_mixer_elem_t
*
elem
,
*
mastelem
=
NULL
,
*
headelem
=
NULL
,
*
captelem
=
NULL
,
*
pcmelem
=
NULL
,
*
lineelem
=
NULL
,
*
micelem
=
NULL
;
memset
(
info
,
0
,
snd_ctl_card_info_sizeof
());
memset
(
&
mixdev
[
mixnum
],
0
,
sizeof
(
*
mixdev
));
...
...
@@ -520,6 +520,8 @@ static void ALSA_MixerInit(void)
headelem
=
elem
;
else
if
(
!
strcasecmp
(
snd_mixer_selem_get_name
(
elem
),
"PCM"
)
&&
!
pcmelem
)
pcmelem
=
elem
;
else
if
(
!
strcasecmp
(
snd_mixer_selem_get_name
(
elem
),
"Line"
)
&&
!
lineelem
)
lineelem
=
elem
;
++
(
mixdev
[
mixnum
].
chans
);
}
}
...
...
@@ -548,6 +550,12 @@ static void ALSA_MixerInit(void)
mastelem
=
pcmelem
;
capcontrols
-=
!!
snd_mixer_selem_has_capture_switch
(
mastelem
);
}
else
if
(
lineelem
&&
!
mastelem
)
{
/* Use 'Line' as master device */
mastelem
=
lineelem
;
capcontrols
-=
!!
snd_mixer_selem_has_capture_switch
(
mastelem
);
}
else
if
(
!
mastelem
&&
!
captelem
&&
!
micelem
)
{
/* If there is nothing sensible that can act as 'Master' control, something is wrong */
...
...
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