[alsa-devel] Stream format conversion in SoC driver
Hi,
We are developing a soundcard for Raspberry Pi, you may find the current driver source code here: https://github.com/raspberrypi/linux/blob/rpi-4.4.y/sound/soc/bcm/pisound.c
The card natively supports 24 and 32 bit PCM streams at 48kHz, 96kHz and 192kHz, symmetric capture and playback.
Is it possible to have ALSA do the necessary format conversions for the PCM streams in natively unsupported formats to the closest natively supported format?
What would be required to enable it?
Thank you, Giedrius.
Giedrius Trainavičius" wrote:
Is it possible to have ALSA do the necessary format conversions for the PCM streams in natively unsupported formats to the closest natively supported format?
Yes (in userspace).
What would be required to enable it?
Nothing; the "plug" plugin is automatically used by the default device.
Regards, Clemens
Unfortunately the 'volumealsa' widget used by Raspbian does not support 'plug' in .asoundrc... ( https://github.com/raspberrypi/lxpanel/blob/master/plugins/volumealsa/volume...) It hardcodes default device to type 'hw'.
I hoped I could get transcoding getting done within the kernel space, then no changes to Raspbian's 'volumealsa' would be needed...
Is there any other way possible?
Thank you, Giedrius.
On Tue, Dec 27, 2016 at 10:51 PM, Clemens Ladisch clemens@ladisch.de wrote:
Giedrius Trainavičius" wrote:
Is it possible to have ALSA do the necessary format conversions for the
PCM
streams in natively unsupported formats to the closest natively supported format?
Yes (in userspace).
What would be required to enable it?
Nothing; the "plug" plugin is automatically used by the default device.
Regards, Clemens
What we want to achieve is for user to be able to select our sound card in the 'volumealsa' widget and all the software, such as internet browsers, mplayer, etc... would by default, without any further configuration, be able to output sound as usual.
To achieve that, there seems to be 2 ways:
1. Report that S16_LE format is supported, somehow internally do the sample format conversion in kernel space. 2. Use 'plug' in .asoundrc, and make changes to volumealsa widget in RPI fork to be compatible with it.
If at all possible, the 1st option would be preferred, as it would involve less parties.
Thank you, Giedrius.
On Wed, Dec 28, 2016 at 4:22 PM, Clemens Ladisch clemens@ladisch.de wrote:
Giedrius Trainavičius wrote:
Unfortunately the 'volumealsa' widget used by Raspbian does not support 'plug' in .asoundrc...
There are no plugins for control devices because those are used only to access mixer controls.
How do you play sounds?
Regards, Clemens
Giedrius Trainavičius wrote:
What we want to achieve is for user to be able to select our sound card in the 'volumealsa' widget and all the software, such as internet browsers, mplayer, etc... would by default, without any further configuration, be able to output sound as usual.
I've looked at that widget's source, and it indeed hardcodes "hw" when switching cards.
(It's possible that sample rate conversion is seen as using too much CPU.)
The correct way to set the default card would be defaults.pcm.card, but this might not work with customized conf files.
What hardware bus does your device use? Doesn't the I2S/DMA controller support 16-bit samples?
Regards, Clemens
participants (2)
-
Clemens Ladisch
-
Giedrius Trainavičius