A Cue (or Preset) Resource is a binary file with a format described by the following C structures and constants:
// ---------------------------------------------------------------------------------------------------------------------
// Cue Resource (Public)
// ---------------------------------------------------------------------------------------------------------------------
// Constants
#define CUEID_MIN 0 // Minimum cueID corresponds to Cue 0.00
#define CUEID_MAX 99999999 // Maximum cueID corresponds to Cue 999,999.99
#define CUEID_MULTIPLIER 100 // CueID is 100x the natural cue number
#define PRESETID_MAX 999 // presetIDs do not use decimal numbers
#define CUE_OFFSET_STREAM_DATA 0x1000 // This is a fixed file position for the start of streaming data blocks
// Resource Identifiers
#define CUE_RESTYPE 'C' // Resource type identifier
#define CUE_RESVERS '1' // Version 1 identifier
typedef struct Cue {
// ----------------------------------------------------------
uint8_t resType; // (0x00) Resource type (Cue = 'C')
uint8_t resVers; // (0x01) Resource version (Cue = '1')
uint8_t cueType; // (0x02) Cue Type
uint8_t cueFlags; // (0x03) Cue flags
FadeTimes fadeTimes; // (0x04) Fade times (up/down/delay)
float followTime; // (0x14) Follow time (0 = none)
int32_t linkCueID; // (0x18) Link Cue ID (-1 = none)
uint32_t reserved1; // (0x1C)
// ----------------------------------------------------------
uint32_t streamDuration; // (0x20) Total time of stream (clicks [40Hz])
uint32_t streamTrimStart; // (0x24) Number of clicks into stream to start playback
uint32_t streamTrimEnd; // (0x28) Number of clicks from end of stream to end playback
uint8_t streamMode; // (0x2C) Auto-Follow/Loop/Hold/Release
uint8_t reserved2[3]; // (0x2D) -
// ----------------------------------------------------------
uint8_t reserved3[13]; // (0x30) -
uint8_t ruleCount; // (0x3D) Number of rules in rules[]
uint16_t channels; // (0x3E) Channel count (must be multiple of 8)
uint8_t mask[]; // (0x40) Bitmask (size is channels/8)
// uint8_t levels[*]; // (????) Channel values (size is channel count) [This field has a size of zero for streaming cues!]
// char name[*]; // (????) Cue Name (c-string)
// char action[*]; // (????) CueScript action (c-string) [depreciated; must include termination byte]
// char rules[*]; // (????) Rules (c-string)
// -------- NULL PADDING FOR STREAMING CUES ONLY --------
// char streamData[*]; // (0x1000) Streaming Data Starts at 0x1000 (CUE_OFFSET_STREAM_DATA)
// ----------------------------------------------------------
} Cue;
// cueType
#define CUE_TYPE_NORMAL 0x00 // This cue is a normal cue
#define CUE_TYPE_STREAMING 0x01 // This cue is a streaming cue
#define CUE_TYPE_PRESET 0x02 // This cue is a preset
// streamMode
#define STREAM_MODE_FOLLOW 0x00 // At the end of this stream, follow to the next cue
#define STREAM_MODE_LOOP 0x01 // At the end of this stream, loop back to the beginning of the stream
#define STREAM_MODE_HOLD 0x02 // At the end of this stream, hold the final channel values
#define STREAM_MODE_RELEASE 0x03 // At the end of this stream, release all channel values
// ---------------------------------------------------------------------------------------------------------------------
// Fade Times (Public)
// ---------------------------------------------------------------------------------------------------------------------
typedef struct FadeTimes { // 16 bytes
float upTime; // (0x00) Fade Up Time (in seconds)
float upDelay; // (0x04) Fade Up Delay (in seconds)
float downTime; // (0x08) Fade Down Time (in seconds)
float downDelay; // (0x0C) Fade Down Delay (in seconds)
} FadeTimes;
Additionally, if the Cue is a streaming cue, then a series of “stream blocks” will be written to the file starting at file offset 0x1000. Each stream block has the format as described by the following C structures and constants:
// ---------------------------------------------------------------------------------------------------------------------
// Streaming Cues (Public)
// ---------------------------------------------------------------------------------------------------------------------
typedef struct StreamBlockHeader0 { // (4 bytes)
uint16_t universeIndex; // Index of universe (0..127)
uint16_t reserved; // -
} StreamBlockHeader0;
typedef struct StreamBlockHeader1 { // (4 bytes)
uint32_t endToken; // 'END!'
} StreamBlockHeader1;
typedef struct StreamBlockHeader2 { // (4 bytes)
uint16_t channelIndex; // Index of first channel of changes (0..511)
uint16_t channelCount; // Channels in update (1..512)
} StreamBlockHeader2;
typedef struct StreamBlockHeader { // (16 bytes)
uint16_t identifier; // Constant = "SB"
uint8_t blockType; // 0 = One universe of data
uint8_t reserved1; // -
uint16_t reserved2; // -
uint16_t blockSize; // Size of data after header
uint32_t time; // Timestamp for block (expressed in 1/100 second units)
union {
StreamBlockHeader0 type0; // StreamBlockHeader0
StreamBlockHeader1 type1; // StreamBlockHeader1
StreamBlockHeader2 type2; // StreamBlockHeader2
} info;
} StreamBlockHeader;
// Constants
#define STREAM_BLOCK_ID 0x4253 // 'SB'
#define STREAM_END_TOKEN 0x21444E45 // 'END!'
// blockType
#define STREAM_BLOCK_UNIVERSE 0 // Single universe
#define STREAM_BLOCK_END 1 // End Block
#define STREAM_BLOCK_RANGE 2 // Range of channels

