From 0d57521f6c25f2fd7a4a0b27287c36df30555c69 Mon Sep 17 00:00:00 2001 From: codeworkx Date: Sat, 18 Jun 2011 16:08:23 +0200 Subject: [PATCH] libaudio: wip --- asound.conf | 219 ++++++++++++++++++++++++++++++++++++++++- libaudio/ALSAMixer.cpp | 16 +-- 2 files changed, 223 insertions(+), 12 deletions(-) diff --git a/asound.conf b/asound.conf index cdb2cd7..a3c6f70 100644 --- a/asound.conf +++ b/asound.conf @@ -6,12 +6,12 @@ ## Mixer Devices ## -ctl.AndroidPlayback { +hwdep.mc1n2 { type hw card 0 } -ctl.AndroidCapture { +ctl.mc1n2 { type hw card 0 } @@ -27,6 +27,9 @@ pcm.AndroidPlayback { type hw card 0 device 0 + format S16_LE + channels 2 + rate 44100 } hooks.0 { type ctl_elems @@ -204,6 +207,9 @@ pcm.AndroidPlayback_Speaker { type hw card 0 device 0 + format S16_LE + channels 2 + rate 44100 } hooks.0 { type ctl_elems @@ -378,6 +384,9 @@ pcm.AndroidPlayback_Headset { type hw card 0 device 0 + format S16_LE + channels 2 + rate 44100 } hooks.0 { type ctl_elems @@ -552,6 +561,9 @@ pcm.AndroidPlayback_Headphone { type hw card 0 device 0 + format S16_LE + channels 2 + rate 44100 } hooks.0 { type ctl_elems @@ -726,8 +738,192 @@ pcm.AndroidPlayback_Headphone { #pcm.AndroidPlayback_Earpiece_normal { #} -#pcm.AndroidPlayback_Speaker_normal { -#} +pcm.AndroidPlayback_Speaker_normal { + type hooks + slave.pcm { + type hw + card 0 + device 0 + format S16_LE + channels 2 + rate 44100 + } + hooks.0 { + type ctl_elems + hook_args [ + { + name "AENG6 Switch" + value.0 on + value.1 on + } + { + name "AENG6 Volume" + value.0 93 + value.1 93 + } + { + name "Master Playback Switch" + value.0 on + value.1 on + } + { + name "Master Playback Volume" + value.0 93 + value.1 93 + } + { + name "Headphone Playback Switch" + value.0 off + value.1 off + } + { + name "Headphone Playback Volume" + value.0 0 + value.1 0 + } + { + name "Speaker Playback Switch" + value.0 on + value.1 on + } + { + name "Speaker Playback Volume" + value.0 31 + value.1 31 + } + { + name "Voice Playback Switch" + value.0 off + value.1 off + } + { + name "Voice Playback Volume" + value.0 0 + value.1 0 + } + { + name "AD Analog Switch" + value.0 on + value.1 on + } + { + name "AD Analog Volume" + value.0 31 + value.1 31 + } + { + name "AD Digital Switch" + value.0 on + value.1 on + } + { + name "AD Digital Volume" + value.0 93 + value.1 93 + } + { + name "DAC Playback Switch" + value.0 on + value.1 on + } + { + name "DAC Playback Volume" + value.0 93 + value.1 93 + } + { + name "DIR#0 ATT Switch" + value.0 on + value.1 on + } + { + name "DIR#0 ATT Volume" + value.0 93 + value.1 93 + } + { + name "DIR#0 Switch" + value.0 on + value.1 on + } + { + name "DIR#0 Volume" + value.0 93 + value.1 93 + } + { + name "DIR#1 ATT Switch" + value.0 on + value.1 on + } + { + name "DIR#1 ATT Volume" + value.0 93 + value.1 93 + } + { + name "DIR#1 Switch" + value.0 on + value.1 on + } + { + name "DIR#1 Volume" + value.0 93 + value.1 93 + } + { + name "DIR#2 ATT Switch" + value.0 on + value.1 on + } + { + name "DIR#2 ATT Volume" + value.0 93 + value.1 93 + } + { + name "DIR#2 Switch" + value.0 on + value.1 on + } + { + name "DIR#2 Volume" + value.0 93 + value.1 93 + } + { + name "DIT#0 Capture Switch" + value.0 on + value.1 on + } + { + name "DIT#0 Capture Volume" + value.0 93 + value.1 93 + } + { + name "DIT#1 Capture Switch" + value.0 on + value.1 on + } + { + name "DIT#1 Capture Volume" + value.0 93 + value.1 93 + } + { + name "DIT#2 Capture Switch" + value.0 on + value.1 on + } + { + name "DIT#2 Capture Volume" + value.0 93 + value.1 93 + } + ] + } +} #pcm.AndroidPlayback_Headset_normal { #} @@ -744,6 +940,9 @@ pcm.AndroidPlayback_Speaker_Headset_normal { type hw card 0 device 0 + format S16_LE + channels 2 + rate 44100 } hooks.0 { type ctl_elems @@ -918,6 +1117,9 @@ pcm.AndroidPlayback_Speaker_Headphone_normal { type hw card 0 device 0 + format S16_LE + channels 2 + rate 44100 } hooks.0 { type ctl_elems @@ -1104,6 +1306,9 @@ pcm.AndroidPlayback_Speaker_ringtone { type hw card 0 device 0 + format S16_LE + channels 2 + rate 44100 } hooks.0 { type ctl_elems @@ -1287,6 +1492,9 @@ pcm.AndroidPlayback_Speaker_Headset_ringtone { type hw card 0 device 0 + format S16_LE + channels 2 + rate 44100 } hooks.0 { type ctl_elems @@ -1461,6 +1669,9 @@ pcm.AndroidPlayback_Speaker_Headphone_ringtone { type hw card 0 device 0 + format S16_LE + channels 2 + rate 44100 } hooks.0 { type ctl_elems diff --git a/libaudio/ALSAMixer.cpp b/libaudio/ALSAMixer.cpp index a7943c9..c6db33b 100644 --- a/libaudio/ALSAMixer.cpp +++ b/libaudio/ALSAMixer.cpp @@ -66,15 +66,15 @@ struct alsa_properties_t static alsa_properties_t mixerMasterProp[SND_PCM_STREAM_LAST+1] = - ALSA_PROP(AudioSystem::DEVICE_OUT_ALL, "master", "PCM", "Capture"); + ALSA_PROP(AudioSystem::DEVICE_OUT_ALL, "master", "Master", NULL); static alsa_properties_t mixerProp[][SND_PCM_STREAM_LAST+1] = { - ALSA_PROP(AudioSystem::DEVICE_OUT_EARPIECE, "earpiece", "Earpiece", "Capture"), - ALSA_PROP(AudioSystem::DEVICE_OUT_SPEAKER, "speaker", "Speaker", ""), - ALSA_PROP(AudioSystem::DEVICE_OUT_WIRED_HEADSET, "headset", "Headphone", "Capture"), - ALSA_PROP(AudioSystem::DEVICE_OUT_BLUETOOTH_SCO, "bluetooth.sco", "Bluetooth", "Bluetooth Capture"), - ALSA_PROP(AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP, "bluetooth.a2dp", "Bluetooth A2DP", "Bluetooth A2DP Capture"), + ALSA_PROP(AudioSystem::DEVICE_OUT_EARPIECE, "earpiece", "Voice", NULL), + ALSA_PROP(AudioSystem::DEVICE_OUT_SPEAKER, "speaker", "Speaker", NULL), + ALSA_PROP(AudioSystem::DEVICE_OUT_WIRED_HEADSET, "headset", "Headphone", NULL), + ALSA_PROP(AudioSystem::DEVICE_OUT_BLUETOOTH_SCO, "bluetooth.sco", "Bluetooth", NULL), + ALSA_PROP(AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP, "bluetooth.a2dp", "Bluetooth A2DP", NULL), ALSA_PROP(static_cast(0), "", NULL, NULL) }; @@ -162,8 +162,8 @@ ALSAMixer::ALSAMixer() { int err; - initMixer (&mMixer[SND_PCM_STREAM_PLAYBACK], "AndroidOut"); - initMixer (&mMixer[SND_PCM_STREAM_CAPTURE], "AndroidIn"); + initMixer (&mMixer[SND_PCM_STREAM_PLAYBACK], "mc1n2"); + initMixer (&mMixer[SND_PCM_STREAM_CAPTURE], "mc1n2"); snd_mixer_selem_id_t *sid; snd_mixer_selem_id_alloca(&sid);