The synchronization is not implemented yet!!
One of the shortcomings of the currently available sequencer solution is synchronization. The sequencer can be the timing master and be used to synchronize other sequencers, or it can be a timing slave and thus has to synchronize to another time source. These two types are completely different and can even be used concurrently.
The sequencer can be used as slave to synchronize to another master.
Normal master clock is the system timer (typically 10ms).
To get higher resolution, any timer within the system can be used. Most sound-cards have a timer on-board that is capable of generating interrupts. This can be used as master clock for the sequencer.
Audio playback can also act as a time source for synchronization. By using a counter of the number of samples played for syncing the master clock, it's a good starting point to get MIDI in sync with digital audio.
MIDI clock can also be used as time source for the sequencer. Or one can decide to use MTC. These two protocols can be received and used to adjust the internal clock (MTC) or tempo (MIDI clock).
Some cards have a special synchronization port (SMPTE code, FSK or something similar). This port can also play it's role in the synchronization game.
Any other (more exotic) time/clock source one can think of can be used as timing master if an appropriate driver is written. Examples are:
Frame refresh of a video card, for syncing to animations (demo writer!).
External switch, eg. connected to a bass drum pedal to sync sequencer to a band.
In cast the sequencer has to sync to another source, it will keep using it's own local timer for determining schedule time of events. This local timer (not the central hardware timer) or the tempo will be adjusted to match the time master.
Send MIDI clock, MTC to a MIDI port
Send time code using special interface (SMPTE code, FSK etc.)
Send timing events to other ALSA sequencers, possibly running on another box and connected by a network. This opens the door for building sequencer clusters.
Send timing events to (user-land) clients to keep the display in sync with playback.
The event transport mechanism is used for synchronization. Clients can send and receive synchronization events. Synchronization events can (just like normal events) be send to a specific client or broadcasted to all clients that registered for getting synchronization events.
The timer of the sequencer can be seen as an internal client. In situations where multiple timing sources exist (eg. MTC and audio) the client has to select from which source to handle the synchronization events.
A client can act as a synchronization master (transmitter) or synchronization slave (receiver), even at the same time!