SEQUENCER


1.1 Introduction

This document describes a flexible sequencer architecture for the ALSA project.

1.1.1 Currently available sequencer

The currently available sequencer interfaces for Linux are the /dev/sequencer and /dev/music from the Open Sound System, OSS or OSS/Lite. Though these interfaces are sufficiently useful for most sequencer applications they have a few shortcomings: Especially the 2nd issue restricts building midi oriented applications that can perform on-par with applications on Apple Macinctoshes and Atari ST's regarding real-time response. Examples:

In practice the currently available (OSS) sequencer seems to be best suited for applications that only perform playback of event like eg. MIDI and MOD file players.

1.1.2 New sequencer

To overcome these disadvantages ALSA will bring a new architecture for scheduling and dispatching MIDI and MIDI oriented events within the Linux sound driver. Note that this is still in the brainstorming phase, and has yet to be developed.

Some of the ideas presented here are inspired by the MidiShare "MIDI operating system" (http://www.grame.fr/english/MidiShare.html), which exists for Apple mac's.

This new sequencer is intended as a replacement for /dev/music and /dev/sequencer. For compatibility with older applications these old interfaces can be emulated if needed.

Highlights:

1.1.3 Concept of clients

The core sequencer only takes care of passing messages between clients and delivering messages at the right time to the right client. All processing has to be done within the clients. Because of this separation of responsibility the sequencer can be optimized for it's main task: sequencing events. All (complex) processing is left to be done by the clients.

This approach results in a modular configuration in which the clients of which a service is needed can be loaded. Other clients that are not needed do not have to be activated.

Two types of clients are supported:

It's up to the client developer where to place his or her client: in or outside the kernel. The right place depends on the needs of the specific client.

Using this client architecture we get a few advantages:

Sample applications of clients to get a feeling of the flexibility of this architecture:

1.1.4 Architecture

The architecture is build around a priority queue. An internal clock is used to determine dispatch time for the enqueued events. When an event is to dispatched it is send through an event router, which sends the event to the right client(s).

Graphic of the architecture, for only a single queue and 4 clients:

Because the sequencer architecture supports more parallel operating queues the actual diagram looks slightly more complex. A sequencer with 4 queues and a few more clients can be found in next diagram:

All events flow through the queue. Because a priority queue is used instead of a simple FIFO, it's no problem to accept unordered events from multiple clients.

Clients can either be user-land applications, accessing /dev/seq or kernel modules that can directly submit events, and are directly called when a event is dispatched to them (even from interrupt mode).



Version 0.036, April 2nd, 1999Usage:
Copyright (c) 1998 by Frank van de Pol, NetherlandsAdvanced Linux Sound Architecture