Browse Source

cmTakeSeqBldr.h/c : Many changes and additions.

master
Kevin Larke 9 years ago
parent
commit
4ddbe2c1d6
2 changed files with 1094 additions and 86 deletions
  1. 1021
    77
      app/cmTakeSeqBldr.c
  2. 73
    9
      app/cmTakeSeqBldr.h

+ 1021
- 77
app/cmTakeSeqBldr.c
File diff suppressed because it is too large
View File


+ 73
- 9
app/cmTakeSeqBldr.h View File

@@ -14,7 +14,9 @@ extern "C" {
14 14
     kTimeLineFailTsbRC,
15 15
     kScoreFailTsbRC,
16 16
     kInvalidArgTsbRC,
17
-    kMidiFileFailTsbRC
17
+    kMidiFileFailTsbRC,
18
+    kMissingScTrkTsbRC,
19
+    kRenderSeqEmptyTsbRC,
18 20
   };
19 21
 
20 22
   typedef cmRC_t     cmTsbRC_t;
@@ -22,15 +24,24 @@ extern "C" {
22 24
 
23 25
   extern cmTakeSeqBldrH_t cmTakeSeqBldrNullHandle;
24 26
 
27
+  // Allocate a Sequence Builder.
25 28
   cmTsbRC_t cmTakeSeqBldrAlloc(   cmCtx_t* ctx, cmTakeSeqBldrH_t* hp );
29
+
30
+  // Allocate and initalize a sequence builder.
26 31
   cmTsbRC_t cmTakeSeqBldrAllocFn( cmCtx_t* ctx, cmTakeSeqBldrH_t* hp, const cmChar_t* scoreTrkFn );
27 32
 
33
+  // Free a previously allocated sequence builder.
28 34
   cmTsbRC_t cmTakeSeqBldrFree( cmTakeSeqBldrH_t* hp );
29 35
 
36
+  // Validate a sequence builder handle.
30 37
   bool      cmTakeSeqBldrIsValid( cmTakeSeqBldrH_t h );
31 38
 
39
+  // Load a score tracking file create by app/cmScoreProc.c:_cmScoreProcGenAssocMain().
40
+  // Note that calling this function loads a time-line object and score object
41
+  // along with the information contained in the score tracking file.
32 42
   cmTsbRC_t cmTakeSeqBldrInitialize( cmTakeSeqBldrH_t h, const cmChar_t* scoreTrkFn );
33 43
 
44
+
34 45
   // Load a group of notes delinated by a time-line marker into the sequence.
35 46
   // If notes overlap with existing notes according to their 'scEvtIdx' attribute:
36 47
   //   a. If 'overWriteFl' is set then the incoming overlapped notes are enabled 
@@ -45,17 +56,70 @@ extern "C" {
45 56
   cmTsbRC_t cmTakeSeqBldrLoadTake(   cmTakeSeqBldrH_t h, unsigned tlMarkUid, bool overwriteFL );
46 57
   cmTsbRC_t cmTakeSeqBldrUnloadTake( cmTakeSeqBldrH_t h, unsigned tlMarkUid );
47 58
   
48
-  // Fill in missing notes from the score. 
49
-  cmTsbRC_t cmTakeSeqBldrInsertScoreNotes( cmTakeSeqBldrH_t h, unsigned begScEvtIdx, unsigned endScEvtId );
50
-  cmTsbRC_t cmTakeSeqBldrRemoveScoreNotes( cmTakeSeqBldrH_t h, unsigned begScEvtIdx, unsigned endScEvtId );
51 59
 
52
-  //enum { kMarkTsbFl = 0x01, kTlNoteTsbFl=0x02, kScoreNoteTsbFl = 0x04, kPedalTsbFl = 0x08 };
53
-  cmTsbRC_t cmTakeSeqBldrSelectEnable( cmTakeSeqBldrH_t h, unsigned flags, unsigned id, bool selectFl );
54
-  cmTsbRC_t cmTakeSeqBldrEnableNote( cmTakeSeqBldrH_t h, unsigned ssqId, bool enableFl );
60
+  double    cmTakeSeqBldrSampleRate( cmTakeSeqBldrH_t h );
61
+
62
+  // Return a handle to the score used by this cmTakeSeqBldr.
63
+  cmScH_t   cmTakeSeqBldrScoreHandle( cmTakeSeqBldrH_t h );
64
+
65
+  // Return the count of score-track takes.
66
+  unsigned cmTakeSeqBldrScTrkTakeCount( cmTakeSeqBldrH_t h );
67
+
68
+  typedef struct
69
+  {
70
+    unsigned minScEvtIdx;  // first score event index this 'take' contains
71
+    unsigned maxScEvtIdx;  // last score event index this 'take' contains
72
+    unsigned tlMarkerUid;  // the marker Uid associated with this take
73
+  } cmTksbScTrkTake_t;
74
+
75
+  // Given an index [0 - cmTakeSeqBldrScTrkTakeCount()) return a cmTksbScTrkTake_t record
76
+  cmTsbRC_t       cmTakeSeqBldrScTrkTake( cmTakeSeqBldrH_t h, unsigned idx, cmTksbScTrkTake_t* ref );
77
+
78
+  // Return the text associated with the specified 'take' marker.
79
+  const cmChar_t* cmTakeSeqBldrScTrkTakeText( cmTakeSeqBldrH_t h, unsigned tlMarkerUId );
80
+
81
+
82
+  // Set score location index to cmInvalidIdx to rewind the player to the beginning of the sequence.
83
+  cmTsbRC_t cmTakeSeqBldrPlaySeekLoc( cmTakeSeqBldrH_t h, unsigned scLocIdx );
84
+
85
+  typedef struct
86
+  { 
87
+    unsigned smpIdx;    // NOTE: changes in this structure should be 
88
+    unsigned status;    // might break;
89
+    unsigned d0;        // void _cmDspTakeSeqRendPedalsUp( cmDspCtx_t* ctx, cmDspInst_t* inst )
90
+    unsigned d1;        // because it loads a static array
91
+  } cmTksbEvent_t;
92
+
93
+  typedef void (*cmTakeSeqBldrPlayFunc_t)( void* arg, const cmTksbEvent_t* evt );
94
+  
95
+  cmTsbRC_t cmTakeSeqBldrPlayExec( cmTakeSeqBldrH_t h, unsigned deltaSmp, cmTakeSeqBldrPlayFunc_t cbFunc, void* cbArg );
96
+  
97
+
98
+  typedef struct
99
+  {
100
+    unsigned      srcId;
101
+    unsigned      scEvtIdx;
102
+    unsigned      rid;
103
+    unsigned      flags;
104
+    unsigned      offsetSmp;
105
+    unsigned      durSmp;
106
+    cmTksbEvent_t evt;
107
+  } cmTksbRend_t;
108
+
109
+  void cmTakeSeqBldrRendReset( cmTakeSeqBldrH_t h );
110
+  bool cmTakeSeqBldrRendNext(cmTakeSeqBldrH_t h, cmTksbRend_t* rendRef );
111
+  
112
+  cmTsbRC_t cmTakeSeqBldrRendInfo( cmTakeSeqBldrH_t h, unsigned rid, cmTksbRend_t* r ); 
113
+  cmTsbRC_t cmTakeSeqBldrRendDelete( cmTakeSeqBldrH_t h, unsigned rid );
114
+  cmTsbRC_t cmTakeSeqBldrRendInsert( 
115
+    cmTakeSeqBldrH_t     h, 
116
+    const cmTksbEvent_t* e,
117
+    unsigned             durSmp,
118
+    unsigned*            ridRef );
55 119
 
56
-  cmTsbRC_t cmTakeSeqBldrMoveNote(   cmTakeSeqBldrH_t h, unsigned ssqId, int deltaSmpIdx );
120
+  cmTsbRC_t cmTakeSeqBldrWrite( cmTakeSeqBldrH_t h, const cmChar_t* fn );
121
+  cmTsbRC_t cmTakeSeqBldrRead(  cmTakeSeqBldrH_t h, const cmChar_t* fn );
57 122
 
58
-  cmTsbRC_t cmTakeSeqBldrWriteMidiFile( cmTakeSeqBldrH_t h, const char* fn );
59 123
 
60 124
   cmTsbRC_t cmTakeSeqBldrTest( cmCtx_t* ctx );
61 125
 

Loading…
Cancel
Save