aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Bachmann <manuel.bachmann@iot.bzh>2015-12-21 14:11:16 +0100
committerManuel Bachmann <manuel.bachmann@iot.bzh>2015-12-21 14:11:16 +0100
commit5bad34ac9278831eb65499c8aa887116aafa33b2 (patch)
tree44ded6778436d1ea91622b339080a4661e9d4298
parente853da4bd1cb44b6a992aff96a4066ae5bd54720 (diff)
Fix Audio API on Renesas Porter/Koelsch boards
Porter/Koelsch do not expose a standard "Master" playback mixer on their default interface, as it is common with desktop audio cards. Add a bit of discovery logic for this. Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
-rw-r--r--plugins/audio/audio-alsa.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/audio/audio-alsa.c b/plugins/audio/audio-alsa.c
index 4ee48045..8e56e52d 100644
--- a/plugins/audio/audio-alsa.c
+++ b/plugins/audio/audio-alsa.c
@@ -58,6 +58,19 @@ PUBLIC unsigned char _alsa_init (const char *name, audioCtxHandleT *ctx) {
snd_mixer_selem_id_set_name (mixer_sid, "Master");
mixer_elm = snd_mixer_find_selem (mixer, mixer_sid);
+ if (!mixer_elm) {
+ /* no "Master" mixer ; we are probably on a board... search ! */
+ for (mixer_elm = snd_mixer_first_elem (mixer); mixer_elm != NULL;
+ mixer_elm = snd_mixer_elem_next (mixer_elm)) {
+ if (snd_mixer_elem_info (mixer_elm) < 0)
+ continue;
+ snd_mixer_selem_get_id (mixer_elm, mixer_sid);
+ if (strstr (snd_mixer_selem_id_get_name (mixer_sid), "Master") ||
+ strstr (snd_mixer_selem_id_get_name (mixer_sid), "Playback"))
+ break;
+ }
+ }
+
if (mixer_elm) {
snd_mixer_selem_get_playback_volume_range (mixer_elm, &vol_min, &vol_max);
snd_mixer_selem_get_playback_volume (mixer_elm, SND_MIXER_SCHN_FRONT_LEFT, &vol);