Synthesizer design notes

Driver design notes

These notes are under construction. And worsethey are out of date.

Overview

The code is rather different to bring it into the style of ALSA. All statically declared variables have been converted into per-card allocated structures. Patch handling is separated out into a separate module and the driver itself is split into several files.

Data structures

The driver is based around a number of dynamically allocated data structures.

emu8000_t

emu8000_voice_t

Soundfont structures

TODO.

Patch loading

As there is not yet a scheme within ALSA for patch loading I just modified the existing OSS scheme a little.

I also did not want to have to write a sfxload type utility, so I decided to use the existing one and use exactly the same scheme for loading patches. The only difference that instead of using /dev/sequencer it uses /proc/asound/0/patch0 (assuming AWE64 is card 0). The sfxload program uses some ioctls which have to be removed.

The code for loading Soundfont patches is separated out into a separate module that could be shared by any driver that uses the soundfont2 format.

Synth

Code mostly in emu8000_synth.c. This code is derived from the OSS driver after making all the data structure changes. The layer code is not included and will be done differently if it is needed.

Proc filesystem support

Code in emu8000_proc.c. There are three devices that appear in /proc/asound under the relevant card directory.

  • patch0 This is used for loading patches and also, at present for some debugging and setup procedures.
  • ram0 This is an image of the on board RAM. You can only read it at present. It is mainly for debugging, I don't expect this will be used as a way of loading patches!
  • rom0 This is an image of the on board ROM samples. Again mainly for debugging, and because you can.

Sequencer linking

I do not know the correct way that will be used for ALSA. However it was easy to link the driver into the sequencer. The way it works at present is: .AL None A kernel sequencer client is created with ID 21. None This subscribes to the mpu401 client already in the kernel. None It should also allow user land clients to attach, so that midi files can be played.

This all needs improving.

Locking

There is none. The emu8000 does not interrupt, so that is not a problem. You could have someone loading a patch while notes are playing, this is very definitely a problem. I don't know in what context the sequencer runs in, this will affect what should be done.

Acknowledgements

This driver is based on awe_wave.c by Takashi Iwai, which was an invaluable source of reference.

Jaroslav Kysela wrote the ALSA core with Frank Van de Pol contributing the sequencer. I want to say what a great system this is, because everything just fell into place and worked almost first time.