>>From the RME documentation it appears that it is possible to detect when a
>source is connected to the RME 9652 card, and whether the source has the
>sampling rate expected. But when I try to read from the card using ALSA, I
>get data whether or not the card has any input. Is there a way to detect
>this with ALSA? If not, can you give me some pointers on how such
>functionality might be implemented?

you can just read the PCM control "IEC958 Sample Rate" which will
provide the S/PDIF sample rate. I just checked the source, and it
seems to be an error of omission that there is no equivalent PCM
control for the ADAT rate. I will add a patch for this. This is the
value you get if you use the hw_params code from alsa_lib once you've
opened a PCM stream, but there's no way to get it now without doing
that. 

however, notice that in order to do this kind of stuff, you're working
with more than one variable. here's part of the content of
/proc/asound/foo/rme9652, where `foo' is the name you give the card:

Clock mode: autosync
Pref. sync source: ADAT1

ADAT1 Input source: ADAT1 optical

IEC958 input: Coaxial
IEC958 output: Coaxial only
IEC958 quality: Consumer
IEC958 emphasis: off
IEC958 Dolby: off
IEC958 sample rate: error flag set

ADAT Sample rate: 48000Hz
ADAT1: No Lock
ADAT2: No Lock
ADAT3: No Lock

so, notice that we've got:

    clock mode
    preferred sync source
    adat1 input source
    iec958 input

all these 4 will affect the answer to the question "what is the rate
of the connected input signal". for example, if the clock mode is
"Master", then the rate you'll discover via any method is the one set
in the 9652's h/w. if its autosync, it will vary according to the
preferred sync source, which in turn is modifiable via the choice of
iec958 input. if its word clock, the rate will be a function of the
word clock source, and has nothing to do with any inputs at all.

finally, notice that the s/pdif rate can be different from the the
adat rate.

to check for s/pdif input check 'IEC958 Sample Rate' - if it gives a
negative number there is no s/pdif input. for adat input, check the
controls 'ADAT<N> Sync Check' where <N> is 1, 2 or 2. If it says
"Lock" or "Lock Sync", then there is a signal (the latter means that
the signal's sample clock component is synced with the hammerfall.

--p

_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to