2008-04-07 18:32:13 ALSA Softvol on AD1981
Cameron Barfield (UNITED STATES)
Message: 53771 Hi --
I've got a post in to the alsa mailing list, but I thought maybe someone here might have some advice for me.
I'm running the 2008 branch kernel and distro. I've got an AD1981BL running with MMAP support (DMIX working). I'd like to use the ALSA softvol plugin to create new volume controls so that my application can adjust its volumes independently of the master volume.
I've been playing around with /etc/asound.conf and so far I have:
pcm.mychan1 {
type softvol
slave.pcm "default"
control.name "mychan1"
control.card 0
}
I can play WAV files (48K) no problem using aplay -D mychan1 file.wav. If I play any wav/au files that need rate conversion, I get:
aplay: set_params:904: Sample format non available
If I don't specify a device for aplay, I can play pretty much any wav/au file I have. DMIX also still works.
Am I just grossly misunderstanding how asound.conf works?
QuoteReplyEditDelete
2008-04-08 06:29:38 Re: ALSA Softvol on AD1981
Cliff Cai (CHINA)
Message: 53836 Hi Cameron,
It seems that this problem has some thing to do with the format of the audio file.
if you try :
arecord -f S16_LE -d 5 a.wav
then it will be OK
aplay -D mychan1 a.wav
Seems only S16_LE and S32_LE are supported by this plugin.
I've tried it on my PC(ALSA1.0.13) ,and got the same result.I guess it is a bug/limitation of ALSA.
Cliff
QuoteReplyEditDelete
2008-04-08 11:44:16 Re: ALSA Softvol on AD1981
Cameron Barfield (UNITED STATES)
Message: 53851 Thanks, Cliff.
I'll see if I can bug the ALSA guys about it.
QuoteReplyEditDelete
2008-04-11 13:20:57 Re: ALSA Softvol on AD1981
Cameron Barfield (UNITED STATES)
Message: 54105 Just an update in case anyone else runs into the issue:
Softvol only supports S16, S24, and S32 (BE and LE). I checked the latest HG sources for alsa, and this is still the case. I'd always thought, though, if a slave was specified for the plug-in, the plug-in would pass the audio through to the slave (dmix, in my case) for conversion. Apparently, that line of thought is wrong.
What does work, though, is setting up two layers of plug-ins. Here's my asound.conf:
# This would be channel 1
pcm.channel1 {
type plug
slave.pcm "chan_1"
}
# Channel 2
pcm.channel2 {
type plug
slave.pcm "chan_2"
}
# Channel 3
pcm.channel3 {
type plug
slave.pcm "chan_3"
}
# Channel 4
pcm.channel4 {
type plug
slave.pcm "chan_4"
}
# Here are the slave plug-ins for the above devices
pcm.chan_1 {
type softvol
slave.pcm "dmix"
control.name "chan_1"
control.card 0
}
pcm.chan_2 {
type softvol
slave.pcm "dmix"
control.name "chan_2"
control.card 0
}
pcm.chan_3 {
type softvol
slave.pcm "dmix"
control.name "chan_3"
control.card 0
}
pcm.chan_4 {
type softvol
slave.pcm "dmix"
control.name "chan_4"
control.card 0
}
root:/etc> aplay -D channel1 440.au
Playing Sparc Audio '440.au' : Mu-Law, Rate 8000 Hz, Mono
Aborted by signal Interrupt...
So it does work. Each channel also gets its own mixer control in amixer so its volume can be adjusted independently of PCM and master.
If anyone can explain how and why setting up a second layer of plug-ins works, I'd love to hear it.