From alsa-devel-owner@alsa.jcu.cz  Sun Feb 21 05:52:06 1999
Received: from renoir.op.net (root@renoir.op.net [209.152.193.4])
	by marvin.jcu.cz (8.9.1a/8.9.1) with ESMTP id FAA11197
	for <alsa-devel@alsa.jcu.cz>; Sun, 21 Feb 1999 05:51:46 +0100
Received: from someip.ppp.op.net (d-bm3-13.ppp.op.net [209.152.194.83]) by renoir.op.net (o1/$Revision: 1.18 $) with ESMTP id XAA12819 for <alsa-devel@alsa.jcu.cz>; Sat, 20 Feb 1999 23:51:44 -0500 (EST)
Message-Id: <199902210451.XAA12819@renoir.op.net>
To: alsa-devel@alsa.jcu.cz
Subject: Re: More PCM/RT stuff (replies mostly) 
In-reply-to: Your message of "Sat, 20 Feb 1999 15:31:52 EST."
             <Pine.LNX.4.05.9902201403340.7234-100000@cyphyn.219.org> 
Date: Sat, 20 Feb 1999 23:50:47 -0500
From: Paul Barton-Davis <pbd@op.net>
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

>Just to complicate matters [:-)], what happens in the case of a system
>with multiple cards with midi ports? If you're going to sync a given
>midi port with its associated crystal oscilator and you have an app
>that wants to use several cards/hardware midi ports (such as the one
>I'm writing right now) the two midi streams will be out of sync with
>each other (won't they?), just as is the case with trying to use two
>separate cards for multi-channel audio input/output -- the crystal oscilators 
>on each card are not necessarily in sync with each other.
>
>Has any thought been given to deciding which card in a multi-card set up
>will be used to provide timing interrupts?

On the other hand, as I've already discussed with Fred, there is an
even more basic problem with multicard setups. I can see no way to get
them both to be in sync. You've got to execute at least one
instruction to trigger PCM operations on each card, and thus they will
of necessity end up being at least 1/MHz secs out of sync, where MHz
is the clock speed of the host CPU. For high sampling rates, this
might actually translate into a sample or two. Not terrible, but not
good either. However, its only going to get worse as things go on, and
each card does DMA interrupts for each new fragment. These are always
going to be serialised on any UP machine, and likely not well
synchronized even on an SMP machine, and so things will slowly drift
further and further out of sync.

It seems to me that the idea of using multiple PCM output devices to
get cheap multichannel PCM output is doomed from the start.

I've been wrong before though.

 [ RTC ]

>This sounds like a _really_ excellent source of interrupts.
>There do seem to be a few minor "gotchas" -- for example, every 11 minutes the
>kernel needs to update the RTC and so it shuts off the interrupts during the
>write. That might cause a glitch that would need to be accounted for. But thes
>e issues don't seem, at first glance [:-)], to be insurmountable.

Warning! The kernel prevents the RTC ioctls from setting an interrupt
rate much greater than HZ. You could get around this with your own
module, but presumably Linus or someone else saw a good reason to
prevent the RTC from being used in this way. I suggest you ask about
this before using the RTC for high-frequency interrupts.

--p

