cmTakeSeqBldr.h/c : Many changes and additions.

This commit is contained in:
Kevin Larke 2015-03-30 14:38:49 -07:00
parent 055b916c81
commit 4ddbe2c1d6
2 changed files with 1105 additions and 97 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,9 @@ extern "C" {
kTimeLineFailTsbRC,
kScoreFailTsbRC,
kInvalidArgTsbRC,
kMidiFileFailTsbRC
kMidiFileFailTsbRC,
kMissingScTrkTsbRC,
kRenderSeqEmptyTsbRC,
};
typedef cmRC_t cmTsbRC_t;
@ -22,15 +24,24 @@ extern "C" {
extern cmTakeSeqBldrH_t cmTakeSeqBldrNullHandle;
// Allocate a Sequence Builder.
cmTsbRC_t cmTakeSeqBldrAlloc( cmCtx_t* ctx, cmTakeSeqBldrH_t* hp );
// Allocate and initalize a sequence builder.
cmTsbRC_t cmTakeSeqBldrAllocFn( cmCtx_t* ctx, cmTakeSeqBldrH_t* hp, const cmChar_t* scoreTrkFn );
// Free a previously allocated sequence builder.
cmTsbRC_t cmTakeSeqBldrFree( cmTakeSeqBldrH_t* hp );
// Validate a sequence builder handle.
bool cmTakeSeqBldrIsValid( cmTakeSeqBldrH_t h );
// Load a score tracking file create by app/cmScoreProc.c:_cmScoreProcGenAssocMain().
// Note that calling this function loads a time-line object and score object
// along with the information contained in the score tracking file.
cmTsbRC_t cmTakeSeqBldrInitialize( cmTakeSeqBldrH_t h, const cmChar_t* scoreTrkFn );
// Load a group of notes delinated by a time-line marker into the sequence.
// If notes overlap with existing notes according to their 'scEvtIdx' attribute:
// a. If 'overWriteFl' is set then the incoming overlapped notes are enabled
@ -45,17 +56,70 @@ extern "C" {
cmTsbRC_t cmTakeSeqBldrLoadTake( cmTakeSeqBldrH_t h, unsigned tlMarkUid, bool overwriteFL );
cmTsbRC_t cmTakeSeqBldrUnloadTake( cmTakeSeqBldrH_t h, unsigned tlMarkUid );
// Fill in missing notes from the score.
cmTsbRC_t cmTakeSeqBldrInsertScoreNotes( cmTakeSeqBldrH_t h, unsigned begScEvtIdx, unsigned endScEvtId );
cmTsbRC_t cmTakeSeqBldrRemoveScoreNotes( cmTakeSeqBldrH_t h, unsigned begScEvtIdx, unsigned endScEvtId );
//enum { kMarkTsbFl = 0x01, kTlNoteTsbFl=0x02, kScoreNoteTsbFl = 0x04, kPedalTsbFl = 0x08 };
cmTsbRC_t cmTakeSeqBldrSelectEnable( cmTakeSeqBldrH_t h, unsigned flags, unsigned id, bool selectFl );
cmTsbRC_t cmTakeSeqBldrEnableNote( cmTakeSeqBldrH_t h, unsigned ssqId, bool enableFl );
double cmTakeSeqBldrSampleRate( cmTakeSeqBldrH_t h );
cmTsbRC_t cmTakeSeqBldrMoveNote( cmTakeSeqBldrH_t h, unsigned ssqId, int deltaSmpIdx );
// Return a handle to the score used by this cmTakeSeqBldr.
cmScH_t cmTakeSeqBldrScoreHandle( cmTakeSeqBldrH_t h );
// Return the count of score-track takes.
unsigned cmTakeSeqBldrScTrkTakeCount( cmTakeSeqBldrH_t h );
typedef struct
{
unsigned minScEvtIdx; // first score event index this 'take' contains
unsigned maxScEvtIdx; // last score event index this 'take' contains
unsigned tlMarkerUid; // the marker Uid associated with this take
} cmTksbScTrkTake_t;
// Given an index [0 - cmTakeSeqBldrScTrkTakeCount()) return a cmTksbScTrkTake_t record
cmTsbRC_t cmTakeSeqBldrScTrkTake( cmTakeSeqBldrH_t h, unsigned idx, cmTksbScTrkTake_t* ref );
// Return the text associated with the specified 'take' marker.
const cmChar_t* cmTakeSeqBldrScTrkTakeText( cmTakeSeqBldrH_t h, unsigned tlMarkerUId );
// Set score location index to cmInvalidIdx to rewind the player to the beginning of the sequence.
cmTsbRC_t cmTakeSeqBldrPlaySeekLoc( cmTakeSeqBldrH_t h, unsigned scLocIdx );
typedef struct
{
unsigned smpIdx; // NOTE: changes in this structure should be
unsigned status; // might break;
unsigned d0; // void _cmDspTakeSeqRendPedalsUp( cmDspCtx_t* ctx, cmDspInst_t* inst )
unsigned d1; // because it loads a static array
} cmTksbEvent_t;
typedef void (*cmTakeSeqBldrPlayFunc_t)( void* arg, const cmTksbEvent_t* evt );
cmTsbRC_t cmTakeSeqBldrPlayExec( cmTakeSeqBldrH_t h, unsigned deltaSmp, cmTakeSeqBldrPlayFunc_t cbFunc, void* cbArg );
typedef struct
{
unsigned srcId;
unsigned scEvtIdx;
unsigned rid;
unsigned flags;
unsigned offsetSmp;
unsigned durSmp;
cmTksbEvent_t evt;
} cmTksbRend_t;
void cmTakeSeqBldrRendReset( cmTakeSeqBldrH_t h );
bool cmTakeSeqBldrRendNext(cmTakeSeqBldrH_t h, cmTksbRend_t* rendRef );
cmTsbRC_t cmTakeSeqBldrRendInfo( cmTakeSeqBldrH_t h, unsigned rid, cmTksbRend_t* r );
cmTsbRC_t cmTakeSeqBldrRendDelete( cmTakeSeqBldrH_t h, unsigned rid );
cmTsbRC_t cmTakeSeqBldrRendInsert(
cmTakeSeqBldrH_t h,
const cmTksbEvent_t* e,
unsigned durSmp,
unsigned* ridRef );
cmTsbRC_t cmTakeSeqBldrWrite( cmTakeSeqBldrH_t h, const cmChar_t* fn );
cmTsbRC_t cmTakeSeqBldrRead( cmTakeSeqBldrH_t h, const cmChar_t* fn );
cmTsbRC_t cmTakeSeqBldrWriteMidiFile( cmTakeSeqBldrH_t h, const char* fn );
cmTsbRC_t cmTakeSeqBldrTest( cmCtx_t* ctx );