Functionality of pcm_notify in snd-aloop?

Pavel Hofman pavel.hofman at ivitera.com
Thu Mar 26 18:59:08 CET 2020


Dne 26. 03. 20 v 18:44 Jaroslav Kysela napsal(a):
> Dne 26. 03. 20 v 18:19 Pavel Hofman napsal(a):
>> Hi,
>>
>> Please how is the module params pcm_notify supposed to be used, to do
>> what the documentation says: Break capture when PCM format/rate/channels
>> changes?
>>
>> Breaking capture side operation when the playback side changes the
>> params is very useful, but I cannot find a way to use this param
>> properly. When the capture side is open, the playback side cannot use a
>> different parameter than the one currently used by the capture side (the
>> configuration space is limited)
> 
> Really? Then it's a bug introduced by the last changes.
> 
> If you look to sources:
> 
>       if (get_notify(dpcm))
>                 runtime->hw = loopback_pcm_hardware;
>         else
>                 runtime->hw = cable->hw;
> 
> And:
> 
>       if (!(cable->valid & ~(1 << substream->stream)) ||
>             (get_setup(dpcm)->notify &&
>              substream->stream == SNDRV_PCM_STREAM_PLAYBACK))
>                 params_change(substream);
> 
> So the functionality should be there.

I am using older kernels (4.15 and 3.16), but this is an old functionality.

modprobe snd-aloop pcm_substreams=1 pcm_notify=1,1


Playback with no capture

aplay -v --dump-hw-params -D hw:0,0 -r 48000 -c 2 -f S32_LE /dev/zero
Přehrávám syrová data '/dev/zero' : Signed 32 bit Little Endian,
Frekvence 48000 Hz, Stereo
HW Params of device "hw:0,0":
--------------------
ACCESS:  MMAP_INTERLEAVED RW_INTERLEAVED
FORMAT:  S16_LE S16_BE S32_LE S32_BE FLOAT_LE FLOAT_BE
SUBFORMAT:  STD
SAMPLE_BITS: [16 32]
FRAME_BITS: [16 1024]
CHANNELS: [1 32]
RATE: [8000 19200000]
PERIOD_TIME: (0 65536000]
PERIOD_SIZE: [1 524288]
PERIOD_BYTES: [64 1048576]
PERIODS: [1 1024]
BUFFER_TIME: (0 524288000]
BUFFER_SIZE: [1 4194304]
BUFFER_BYTES: [64 8388608]


Playback with capture running (arecord at 48000):

aplay -v --dump-hw-params -D hw:0,0 -r 96000 -c 2 -f S32_LE /dev/zero
Playing raw data '/dev/zero' : Signed 32 bit Little Endian, Rate 96000
Hz, Stereo
HW Params of device "hw:0,0":
--------------------
ACCESS:  MMAP_INTERLEAVED RW_INTERLEAVED
FORMAT:  S32_LE
SUBFORMAT:  STD
SAMPLE_BITS: 32
FRAME_BITS: 64
CHANNELS: 2
RATE: 48000
PERIOD_TIME: (166 2730667)
PERIOD_SIZE: [8 131072]
PERIOD_BYTES: [64 1048576]
PERIODS: [1 1024]
BUFFER_TIME: (166 21845334)
BUFFER_SIZE: [8 1048576]
BUFFER_BYTES: [64 8388608]
TICK_TIME: ALL
--------------------
Warning: rate is not accurate (requested = 96000Hz, got = 48000Hz)
         please, try the plug plugin


Thanks a lot.

Pavel.


More information about the Alsa-devel mailing list