/* * sequence.h * Author: Hannah C. Tang (hctang@cs) * Revised By: Robin Battey (zanfur@cs) and Lindsey Irwin (lindsey@cs) * * Specification of public functions for the sequence struct * (wrapper for basic Sequence operations) * */ #ifndef SEQUENCE_H #define SEQUENCE_H struct Sequence { unsigned int length : 8; /* 8 bits ==> [0, 255] */ unsigned int period : 4; /* 4 bits ==> [0, 15] */ unsigned int mode : 4; /* 4 bits ==> [0, 15] */ }; typedef struct Sequence sequence_t; #define MAX_LENGTH 0xFF #define MAX_PERIOD 0x0F #define MAX_MODE 0x0F /* This is D190. 1D190 is Unicode for the "mezzo" charecter - 'm' */ #define MODE_BEGIN ((sequence_t) { 209, 9, 0 }) #define IS_MODE_BEGIN(x) (((x).length == MODE_BEGIN.length) && \ ((x).period == MODE_BEGIN.period) && \ ((x).mode == MODE_BEGIN.mode)) /* This is D18F. 1D18F is Unicode for the "piano" charecter - 'p' */ #define PROGRAM_BEGIN ((sequence_t) { 209, 8, 15 }) #define IS_PROGRAM_BEGIN(x) (((x).length == PROGRAM_BEGIN.length) && \ ((x).period == PROGRAM_BEGIN.period) && \ ((x).mode == PROGRAM_BEGIN.mode)) /* This is D10B. 1D10B is Unicode for the "repeat" sign */ #define INF_LOOP_BEGIN ((sequence_t) { 209, 0, 11 }) #define IS_INF_LOOP_BEGIN(x) (((x).length == INF_LOOP_BEGIN.length) && \ ((x).period == INF_LOOP_BEGIN.period) && \ ((x).mode == INF_LOOP_BEGIN.mode)) /* This is D109. 1D109 is Unicode for the "dal signa" charecter */ #define GOTO_LOOP ((sequence_t) { 209, 0, 9 }) #define IS_GOTO_LOOP(x) (((x).length == GOTO_LOOP.length) && \ ((x).period == GOTO_LOOP.period) && \ ((x).mode == GOTO_LOOP.mode)) #endif /* SEQUENCE_H */