[linux-audio-dev] Synchronizing two Delta 1010 with ALSA ?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] Synchronizing two Delta 1010 with ALSA ?
From: Benno Senoner (sbenno_AT_gardena.net)
Date: Fri Apr 11 2003 - 13:39:47 EEST


(Sorry for reposting to LAD, I've already sent this to alsa-user but I'm
unsure which list is more appropriate so I'm trying both)

Hello,

I have a machine with two DELTA 1010LT cards and they work very well
with ALSA (using ALSA binaries from Planet CCRMA).

I would like to write a single threaded application
 that is able to write on all out channels (analog outs 1-8 of card 1 and 2 =
16 channels) simultaneously.

The card's manual says that in order to synchronize two cards one should
select the first card as master and set the internal clock generation
(I do this via envy24control) and then connecting the SPDIF-OUT of card 1
to the SPDIF-IN of card 2 and set the card 2's clock source to SPDIF-IN.

So far so good (from the hardware point of view)

I managed to write ALSA code that writes to a single card:
it opens the PCM hw:0 device selects 10 channel interleaved S32_LE mode
and then writes out some data. This works perfectly for a single card.

Now my question:
I would like to extend this app so that it writes to both cards simultaneously
without going out of sync.

I assume that the SPDIF writing and clocksouce selection provides this
from a hardware point of view, but I am unsure how to proceed from with
the application code since the ALSA docs do not mention such a scenario.

currently for a single card setup,
I do the usual card setup and then sit in a while loop that does

while(1) {
  snd_pcm_writei(pcm_handle, audiobuf, MY_PERIOD_FRAMES);
}

Is the following way to extend the app to two cards correct ?

call the functions to setup card 1 (hw:0)
call the functions to setup card 2 (hw:1)

while(1) {
  snd_pcm_writei(pcm_handle1, audiobuf1, MY_PERIOD_FRAMES);
  snd_pcm_writei(pcm_handle2, audiobuf2, MY_PERIOD_FRAMES);

}

(where audiobuf1 is the buffer sent to card 1 while audiobuf2 is
the buffer sent to card 2)

Or is some special "sync start" procedure needed ?
I remember ALSA had/has provides some functionality in this regard
but I was unable to find documentation about it.

Thanks in advance for your help.

PS: does the DELTA cards only support the interleaved mode ?
The model seems a bit inefficient since in most apps the data
sources are non interleaved audio streams.
(eg a HDR app that outputs each audio track to a different audio channel)

cheers,
Benno

http://linuxsampler.sourceforge.net

-------------------------------------------------
This mail sent through http://www.gardena.net


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri Apr 11 2003 - 13:47:45 EEST