'How to See PCM Values being played by accessing the device driver?

The existing code base I am working on uses android to bring up an activity that involves creating and playing a sound file which is then streamed to another device via i2s. The android activity is simply something along the lines of:

MediaPlayer mp = MediaPlayer.create(this,R.raw.sound_file);
mp.start();
mp.setLooping(true);

I know this works because I am receiving the expected audio stream on the other device. But for modular testing purposes, I want to have some way of confirming that I am actually sending the correct PCM values on the i2s line. While my audio is playing I do the following: Try to find which audio device files are active:

lsof | grep '/dev/snd'

Which resulted in:

[email protected] 3929 audioserve 8u  CHR 119,0  0t0 44   /dev/snd/controlC0
[email protected] 3929 audioserve 8u  CHR 119,0  0t0 44   /dev/snd/controlC0
[email protected] 3929 audioserve 16u CHR 119,18 0t0 6372 /dev/snd/pcmC0D1p

According to /proc/asound/pcm, pcmC0D1p is: TDM-B-dummy-alsaPORT-i2s multicodec-1

So I have a look at the status of this device:

cat /proc/asound/card0/pcm1p/sub0/status

Which lists the following:

state: Running 
owner_pid : 3076
trigger_time : 46.23342
tstamp: 26643.98897
delay: 2677
avail: 384
avail_max: 1473
-----
hw_ptr : 1276662838
appl_ptr : 1274652326

My questions are the following:

My first goal is having a definitive way of knowing that I am sending some data on the line, and want to ask if querying the status of the pcm device and checking that it is in the "Running" stat is sufficient?

I secondly want to actually have a way of knowing I am sending the correct data. Is there a way of accessing the actual pcm values in /dev/snd/pcmC0D1? If that's not possible could I somehow make use ALSA functions to achieve a similar goal?

Thirdly, I'm not sure what all the information in the device's status actually mean, so if anyone could point to a resource or perhaps explain some of those values it would be most appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source