Re: How to mix multiple pcm capture stream into one and save to wav file as if it's from one single multi channel alsa card device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27. 04. 23 7:53, semiydsemiyd@xxxxxxx wrote:
Hi

I have 8 alsa capture devices for one card.
Each capture device support 1 channel only:

root@light-a-val:~# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: LightSoundCard [Light-Sound-Card], device 0: light-tdm-dai-slot1-ES7210 ADC 0 es7210.5-0042-1 [light-tdm-dai-slot1-ES7210 ADC 0 es7210.5-0042-1]
   Subdevices: 1/8
   Subdevice #0: subdevice #0
card 0: LightSoundCard [Light-Sound-Card], device 1: light-tdm-dai-slot2-ES7210 ADC 0 es7210.5-0042-1 [light-tdm-dai-slot1-ES7210 ADC 0 es7210.5-0042-1]
   Subdevices: 2/8
   Subdevice #1: subdevice #1
...
card 0: LightSoundCard [Light-Sound-Card], device 7: light-tdm-dai-slot8-ES7210 ADC 1 es7210.5-0042-1 [light-tdm-dai-slot1-ES7210 ADC 0 es7210.5-0042-1]
   Subdevices: 8/8
   Subdevice #7: subdevice #7

the signal comes in TDM format from external codec ES7210 to my soc's TDM controller.
each capture device has 1 channel that correspond to one of the slot in TDM. i have 8 TDM slots in configuration. so i have 8 devices in total.


the reason that i have so many capture devices with 1 channel each is that, our tdm IC design decides that each tdm slot data_register would be assigned a
dedicated dma channel. this is quite uncommon. thus i have 8 dma channels for 8 tdm slots.
since i can only register one rx dma channel and one tx using devm_snd_dmaengine_pcm_register().
like:
struct dmaengine_pcm {
	struct dma_chan *chan[SNDRV_PCM_STREAM_LAST + 1];    // there can be only one tx + one rx dma for struct dmaengine_pcm
	...
};
i have to register like 8 times to create 8 devices.
the dts for the cpu dai driver for tdm slot1 would look like:
		tdm: audio_tdm@0xffcb000000 {
			#sound-dai-cells = <0>;
...
			dmas = <&dmac2 31>;
			dma-names = "rx";
...
		};

now...i want to open all the devices at the same time. and have them save to one single wav file. As if i'm opening one single alsa capture device with  8 channels.
the saved wav file should look something like this (take this 8 channel wav file for example)

You may use the multi plugin from alsa-lib, just google "alsa multi plugin" for details.

				Jaroslav

--
Jaroslav Kysela <perex@xxxxxxxx>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux