Basic type definitions

jwatte's picture

There are only a few basic types used in SAPS.

Audio data is transported using floating point (32-bit) format. While 64-bit format has benefits inside specific effects (such as IIR filters), there is no audible benefit while transporting audio between plug-ins, and the additional cache pressure and memory cost (which translates to slower execution) of using buffers of 64-bit data is a cost you do not want to pay.

typedef unsigned char byte;
typedef unsigned int size32;
typedef unsigned long long size64;
typedef unsigned int ChannelMask;
typedef float Hz;
typedef float Pixels;
 
struct Address
{
  size64        Data;
};
 
struct TimePos
{
  size64        StructSize;
 
  /* streaming measurement at given sample rate */
  size64        SamplePos;
 
  /* MIDI song pos */
  size32        BeatPos;
  size32        TickPos;
 
  /* SMTPE timecode */
  byte          HourPos;
  byte          MinutePos;
  byte          SecondPos;
  byte          FramePos;
  size32        SubFramePos;
};
 
struct TimeConfig
{
  size64        StructSize;
 
  size32        BeatsPerBar;
  size32        TicksPerBeat;
 
  size32        FramesPerSecondNumerator;
  size32        FramesPerSecondDenominator;
  size32        SubFrameLength;
};
 
struct Tempo
{
  size32        BeatsPerMinuteNumerator;
  size32        BeatsPerMinuteDenominator;
  size32        TimeSignatureNumerator;     //  how many beats per bar
  size32        TimeSignatureDenominator;   //  what is a "beat" anyway? (1/4, 1/8 etc)
};