From alsa-devel-owner@alsa.jcu.cz  Sun May 10 23:53:08 1998
Received: from entry.jcu.cz (perex@entry.jcu.cz [160.217.1.111])
	by marvin.jcu.cz (8.8.8/8.8.8) with SMTP id XAA13408;
	Sun, 10 May 1998 23:53:06 +0200
Date: Sun, 10 May 1998 23:53:05 +0200 (MET DST)
From: Jaroslav Kysela <perex@jcu.cz>
To: Alan Robinson <ar@vt.edu>
cc: alsa-devel@alsa.jcu.cz
Subject: Re: New Sequencer core
In-Reply-To: <3.0.3.32.19980510085807.007f9040@mail.vt.edu>
Message-ID: <Pine.LNX.3.96.980510232232.31248A-100000@entry.jcu.cz>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

On Sun, 10 May 1998, Alan Robinson wrote:

> >In fact, you are right that there are not many difference between using
> >one or other unit (and we all be probably using ticks finally), but as I
> >said in another posting, ms. is a more general time unit that can be used
> >to synchronize many things that don't have a 'tempo' (like animations, or
> >audio output). Anyway we can always convert one unit to another, but
> >why using a conversion when we can always use the same unit ?
> 
> I think tics are better, for the reasons already explained on this list by
> others.  I would like to point out that as long as the length of time of a
> tic is some rational multiplier of a ms. (ie, 1/6), we can very easily
> convert between the two, with no error.  So perhaps the library routines
> should offer an interface for ms and tics, while the driver works with tics
> exclusively.

Ticks shouldn't be used in all situations. Example application:

1. song is in event queue with tick timestamps
2. sound effect is posted to queue at some tick

Problem occurs if application want for some reason change tempo of song,
but it doesn't want change sound effect position.

Possible problem solving:

1. application should create two independed event queues
   - driver should contains some time synchronization feature for
     sequencer queues
2. implement two queues to sequencer
   - song queue - tick timestamps
   - realtime queue - us timestamps


Next idea: Note effect

Application want play notes with pretty echo effect. This effect should do
this: Start note + delay + start same note again with different volume...

Delay should be:

1. in ticks
2. in us

Above mechanism should be used in driver for internal effect timing, too.
Note: Effects for InterWave chips uses us timings...

======

What about to create this sequencer:

1. one event queue
2. timestamp should be in us or tick
   - selectable, but can't be used simultaneously
3. timer should be shared with many queues (master/slave)

Possible problems:

1. security - how identify applications which want share same timer?
   - maybe only within one application can be timer shared

======

Other synchro issues:

All things in ALSA driver should be synchronized with master (system)
clock - gettimeofday.

- native digital audio code already contains this synchronization
- synchronization for sequencer should be done with:
  - shared timer
  - echo event which should return current gettimeofday time to application


					Jaroslav

-----
Jaroslav Kysela <perex@jcu.cz>
Academic Computer Centre, University of South Bohemia
Branisovska 31, C. Budejovice, CZ-370 05 Czech Republic



