Re: [linux-audio-dev] MCS: 64 bit timestamps?

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

Subject: Re: [linux-audio-dev] MCS: 64 bit timestamps?
From: David Olofson (audiality_AT_swipnet.se)
Date: ma loka   11 1999 - 05:33:19 EDT


On Mon, 11 Oct 1999, Paul Barton-Davis wrote:

[...code...]

> this doesn't take sample clock drift into account. the engine would
> have to deal with this by adjusting the
> cycle_counter_at_start_of_control_loop value at appropriate intervals
> to shift everyone's idea of the current time.

(I don't think fiddling with the TSC timestamps is a good thing, as it
makes the engine code a bit unclear...)

The engine's cycle time should be locked to a master time base -
usually the "master" audio card - and everything else should adapt to
that. (Slave audio cards will need sample skip/insert or something
similar in the interface thread/plug-in/<whatever>.)

That is, some other thread wanting a timestamp need only worry about
the *master* time base - the one that's determined by the current
sample count of the engine's timing master.

Change all timestamps *outside* plug-ins to absolute time (as I
suggested somewhere...), and:

        current_cycle_counter = read_tsc ();
        cycle_diff = current_cycle_counter -
- cycle_counter_at_start_of_control_loop;
+ cycle_counter_at_last_sync_point;
        now = (msc_time_t) (samples_per_cycle * (float) cycle_diff));
+ now += sample_count_at_last_sync_point;

"sample_count_at_last_sync_point" is any (preferably recent, to
minimize the effect of TSC/audio card drift) pair of sample count
(of the timing master audio card) and TSC when the sample count was
grabbed.

NOTE: As the code looks right now, it needs a lock! Pointer to struct?

//David

 ·A·U·D·I·A·L·I·T·Y· P r o f e s s i o n a l L i n u x A u d i o
- - ------------------------------------------------------------- - -
    ·Rock Solid David Olofson:
    ·Low Latency www.angelfire.com/or/audiality ·Audio Hacker
    ·Plug-Ins audiality_AT_swipnet.se ·Linux Advocate
    ·Open Source ·Singer/Composer


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

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:27:13 EST