<- Stacy
Implementation
Signals and types
Data structures
Evaluation model
User interface
Circuit editor
Components
Dumps

Stacy version 0.1.3 consists of a 3000-line monolithic C file plus a small library (libpolyseg) that is used to render band-limited discontinuous signals, like sawtooth and square waves.

The table of contents of the main file is:

  • Signal buffers
  • Launchpad interface
  • ALSA interface (MIDI and audio)
  • Generic components
  • Cartesian product components
  • Audio components
  • Bytebeat components
  • UI components
  • Synthesis components
  • Band-limited synthesis with libpolyseg
  • Utility functions
  • Main function

About half of this file is the definition of the 37 components. This is obviously highly modular code (one function for each component), but it's also very redundant, as a big part of the evaluation of the circuit (including the type checking) is done inside these functions.

The data structures are fairly simple, with the exception of the "signal buffer" type (sig_head) which requires some nasty pointer arithmetic.

The circuit evaluation model is very simple: the evaluation core (compute_signals) is 40 lines long.

The process is single-threaded, with a big loop inside main() that processes one cycle per turn. A cycle corresponds to the length of playback of an audio frame. In order, this loop does

  • audio output (user_process_audio),
  • circuit evaluation (compute_signals),
  • user input (get_input),
  • circuit editor implementation,
  • user visual feedback (update_output).

The circuit editor is expressed as a state machine directly inside the main loop.

© 2000-2014 Mikael Bouillot (last updated 2014-05-13)