Developer Guide - Overview of the system
gAlan is, at its heart, an event-driven program. GTK+, the GUI
toolkit, is event-based, and the flow of sound (audio-signals) and
audio-events (both detailed in section 3) is controlled by the events
received from the user.
NOTE: If you're not clear on the definition of the terms event,
audio-event, signal, audio-signal, generator, component and control,
you might want to skip ahead briefly to sections 3 and 4.
For this overview, I will assume that the currently active master
clock is that attached to an OSS Output generator/plugin. The
default master clock works similarly, except it is driven by a timer
and not by the sound card.
When an OSS Output master clock is activated, the routine
gen_clock_mainloop is registered with GDK so that whenever /dev/dsp is
ready for more input (see the use of gdk_input_add in oss_output.c),
gen_clock_mainloop is called. gen_clock_mainloop alternates between
processing audio-events (as they come due) and firing the
realtime-handler functions (registered by gen_register_realtime_fn).
One of the registered realtime-callbacks will be part of the OSS
Output generator. When oss_output.c's realtime_handler receives an
AE_REALTIME event (see generator.h), it
- allocates two buffers, of size equal to the number of samples
corresponding to the amount of time that the AE_REALTIME event
says has elapsed.
- reads its left input.
- reads its right input.
- converts both buffers to 16-bit signed samples, and plays them.
- deallocates the buffers.
This should all be giving the impression that audio-events are
pushed through the system, whereas audio-signals are
pulled.
Next Section
|