On Mon, Jul 03, 2023 at 05:18:13PM -0400, Ricky Cintron wrote:
> While troubleshooting some audio issues, I noticed that the values of
> play.bytes and record.bytes in audioctl's output were identical, even
> when only playing audio.
>
> 1) Is this expected behavior?
yes, by default the device always does DMA in both directions
(synchronously), so record.bytes increases like play.bytes
> 2) What is the source of this data (record.bytes)?
>
The source is the audio hardware interrupts. The audio(4) driver
handles them and increments its couter. The counter is readable by
userland with the AUDIO_GETPOS ioctl.
> I found it interesting that the values were the same, so I took a look
> at mixerctl, and noticed that 'line' (which is an output) and 'mix'
> (which has line as its only source) were the sources for both
> record.adc variables. At that point I figured that simply removing
> all sources from those two variables would eliminate all audio data
> from those recording channels, but record.bytes continued to match
> play.bytes. I even attempted to mute both ADCs and to disable recording
> in mixerctl (without rebooting), but nothing changed.
>
> I'm probably going to remove 'line' and 'mix' as sources for the ADCs
> because they don't make sense there, but I'm still hoping to understand
> what's going on.
>
The mixer is a completely different thing and is completely
independent from DMA. It is supposed to control the analog
knobs/selectors, jack sensors, and alike.
Setting the record level to 0 (or removing all sources) would make the
ADC sample silence and produce zeros without affecting how it
works. That's why record.bytes still increases.
> # mixerctl -v
> inputs.dac-2:3=126,126
> inputs.dac-0:1=126,126
> record.adc-0:1_mute=off [ off on ]
> record.adc-0:1=124,124
> record.adc-2:3_mute=off [ off on ]
> record.adc-2:3=124,124
> inputs.mix_source=line { line }
> inputs.mix_line=120,120
> inputs.mix2_source=dac-2:3 { dac-2:3 mix }
> inputs.mix3_source=dac-0:1 { dac-0:1 mix }
> outputs.spkr_source=mix2 [ mix2 ]
> outputs.spkr_mute=on [ off on ]
> outputs.spkr_eapd=on [ off on ]
> outputs.line_source=mix3 [ mix2 mix3 ]
> outputs.line_mute=off [ off on ]
> inputs.line=85,85
> outputs.line_dir=output [ none output input input-vr0 input-vr50 input-vr80
> input-vr100 ]
> outputs.line_boost=off [ off on ]
> outputs.line_eapd=on [ off on ]
> outputs.hp_source=mix2 [ mix2 mix3 ]
> outputs.hp_mute=off [ off on ]
> outputs.hp_boost=off [ off on ]
> outputs.hp_eapd=on [ off on ]
> record.adc-2:3_source=line,mix { line mix }
> record.adc-0:1_source=line,mix { line mix }
> outputs.line_sense=plugged [ unplugged plugged ]
> outputs.hp_sense=unplugged [ unplugged plugged ]
> outputs.spkr_muters=line,hp { line hp }
> outputs.master=126,126
> outputs.master.mute=off [ off on ]
> outputs.master.slaves=dac-2:3,dac-0:1,spkr,line,hp { dac-2:3 dac-0:1 spkr
> line hp }
> record.volume=124,124
> record.volume.mute=off [ off on ]
> record.volume.slaves=adc-0:1,adc-2:3 { adc-0:1 adc-2:3 line }
> record.enable=sysctl [ off on sysctl ]
>
>