libcm is a C development framework with an emphasis on audio signal processing applications.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. #include "cmPrefix.h"
  2. #include "cmGlobal.h"
  3. #include "cmFloatTypes.h"
  4. #include "cmRpt.h"
  5. #include "cmErr.h"
  6. #include "cmCtx.h"
  7. #include "cmMem.h"
  8. #include "cmMallocDebug.h"
  9. #include "cmLinkedHeap.h"
  10. #include "cmJson.h"
  11. #include "cmTime.h"
  12. #include "cmMidi.h"
  13. #include "cmMidiFile.h"
  14. #include "cmAudioFile.h"
  15. #include "cmTimeLine.h"
  16. #include "cmSymTbl.h"
  17. #include "cmScore.h"
  18. #include "cmTakeSeqBldr.h"
  19. // Score track record: Map a score event to a MIDI event.
  20. typedef struct cmScTrkMidiTsb_str
  21. {
  22. unsigned mni; // MIDI note index as an offset from the take marker
  23. unsigned muid; // MIDI file msg unique id
  24. unsigned scEvtIdx; // score event index this not is assoc'd with or -1 if it did not match
  25. unsigned flags; // flags from cmScMatcherResult_t
  26. } cmScTrkMidiTsb_t;
  27. // Score Tracking info. from a single take (time-line marker)
  28. typedef struct cmScTrkTakeTsb_str
  29. {
  30. unsigned tlMarkerUid; // marker time line uid assoc'd with this take
  31. cmScTrkMidiTsb_t* midiV; // midiV[midiN] score to midi file map recd. array.
  32. unsigned midiN;
  33. unsigned minMuid; // min MIDI muid in midiV[]
  34. unsigned maxMuid; // max MIDI muid in midiV[]
  35. bool failFl;
  36. } cmScTrkTakeTsb_t;
  37. enum
  38. {
  39. kNoteTsbFl = 0x01,
  40. kPedalTsbFl = 0x02,
  41. kEnableTsbFl = 0x04
  42. };
  43. //
  44. typedef struct cmMidiTsb_str
  45. {
  46. unsigned srcId; // marker uid or -1 if this event was manually inserted
  47. unsigned scEvtIdx; // score event assocd with this midi event
  48. unsigned flags; // note | pedal | enable
  49. struct cmMidiTsb_str* ref; // previous MIDI event in time
  50. unsigned offsetSmp; // time offset from *ref
  51. unsigned durSmp; // duration of this MIDI event
  52. unsigned d0; // d0 MIDI channel msg data.
  53. unsigned d1; // d1 MIDI channel msg data
  54. struct cmMidiTsb_str* link; // pointer to next MIDI event in list
  55. } cmMidiTsb_t;
  56. // This record contains all the score events and and score synchronized MIDI events
  57. // associated with a given take. Each call to cmTakeSeqBldrLoadTake() creates
  58. // one of these records.
  59. typedef struct cmTakeTsb_str
  60. {
  61. unsigned tlMarkerUid; // time-line marker uid associated with this take
  62. cmMidiTsb_t* midi; // midi events contained by this take
  63. struct cmTakeTsb_str* link;
  64. } cmTakeTsb_t;
  65. typedef struct
  66. {
  67. cmCtx_t ctx; // application context
  68. cmErr_t err; // internal error object
  69. cmJsonH_t jsH; // JSON tree used to hold score tracker info.
  70. const cmChar_t* tlFn; // time line filename
  71. const cmChar_t* scFn; // score file name
  72. const cmChar_t* tlPrefixPath; // path to time line audio and MIDI files
  73. cmTlH_t tlH; // time-line handle
  74. cmScH_t scH; // score handle
  75. cmScTrkTakeTsb_t* scTrkTakeV; // score tracker scTrkTakeV[ scTrkTakeN ]
  76. unsigned scTrkTakeN;
  77. cmTakeTsb_t* takes; // list of loaded takes
  78. cmTakeTsb_t* manual; // list of manually inserted MIDI events
  79. cmTakeTsb_t* out; // render list
  80. } cmTsb_t;
  81. cmTakeSeqBldrH_t cmTakeSeqBldrNullHandle = cmSTATIC_NULL_HANDLE;
  82. cmTsb_t* _cmTsbHandleToPtr( cmTakeSeqBldrH_t h )
  83. {
  84. cmTsb_t* p = (cmTsb_t*)h.h;
  85. return p;
  86. }
  87. cmTsbRC_t _cmTsbScoreTrkFree( cmTsb_t* p )
  88. {
  89. cmTsbRC_t rc = kOkTsbRC;
  90. unsigned i;
  91. if( cmJsonFinalize(&p->jsH) != kOkJsRC )
  92. {
  93. rc = cmErrMsg(&p->err,kJsonFailTsbRC,"JSON object finalize failed.");
  94. goto errLabel;
  95. }
  96. if( p->scTrkTakeV != NULL )
  97. {
  98. for(i=0; i<p->scTrkTakeN; ++i)
  99. cmMemPtrFree(&p->scTrkTakeV[i].midiV);
  100. cmMemPtrFree(&p->scTrkTakeV);
  101. }
  102. if( cmTimeLineFinalize(&p->tlH) != kOkTlRC )
  103. rc = cmErrMsg(&p->err,kTimeLineFailTsbRC,"Time line object finalize failed.");
  104. if( cmScoreFinalize(&p->scH) != kOkScRC )
  105. rc = cmErrMsg(&p->err,kScoreFailTsbRC,"Score finalize failed.");
  106. errLabel:
  107. return rc;
  108. }
  109. // Free a take record. Note that the record must be unlinked
  110. // unlinked from p->takes (See _cmTakeTsbUnlink().) prior to calling this function.
  111. void _cmTsbTakeFree( cmTsb_t* p, cmTakeTsb_t* t )
  112. {
  113. cmMidiTsb_t* m = t->midi;
  114. while( m != NULL )
  115. {
  116. cmMidiTsb_t* nm = m->link;
  117. cmMemFree(m);
  118. m = nm;
  119. }
  120. cmMemFree(t);
  121. }
  122. // Unlink a 'take' record from p->takes.
  123. cmTakeTsb_t* _cmTsbTakeUnlink( cmTsb_t* p, cmTakeTsb_t* t )
  124. {
  125. cmTakeTsb_t* t0 = NULL;
  126. cmTakeTsb_t* t1 = p->takes;
  127. while( t1 != NULL )
  128. {
  129. if( t1 == t )
  130. {
  131. if( t0 == NULL )
  132. p->takes = t->link;
  133. else
  134. t0->link = t1->link;
  135. return t;
  136. }
  137. }
  138. return NULL;
  139. }
  140. cmTsbRC_t _cmTsbFree( cmTsb_t* p )
  141. {
  142. cmTsbRC_t rc = kOkTsbRC;
  143. if((rc = _cmTsbScoreTrkFree(p)) != kOkTsbRC )
  144. goto errLabel;
  145. cmTakeTsb_t* t = p->takes;
  146. while( t != NULL )
  147. {
  148. cmTakeTsb_t* nt = t->link;
  149. _cmTsbTakeFree(p,t);
  150. t = nt;
  151. }
  152. cmMemFree(p);
  153. errLabel:
  154. return rc;
  155. }
  156. cmScTrkTakeTsb_t* _cmTsbMarkerIdToScTrkTake( cmTsb_t* p, unsigned markerUid )
  157. {
  158. unsigned i;
  159. for(i=0; p->scTrkTakeN; ++i)
  160. if( p->scTrkTakeV[i].tlMarkerUid == markerUid )
  161. return p->scTrkTakeV + i;
  162. return NULL;
  163. }
  164. cmScTrkMidiTsb_t* _cmTsbMuidToScTrkMidi( cmScTrkTakeTsb_t* t, unsigned muid )
  165. {
  166. unsigned i;
  167. for(i=0; i<t->midiN; ++i)
  168. if( t->midiV[i].muid == muid )
  169. return t->midiV + i;
  170. return NULL;
  171. }
  172. cmTsbRC_t _cmTsbLoadScoreTrkFile( cmTsb_t* p, const cmChar_t* scoreTrkFn )
  173. {
  174. cmTsbRC_t rc = kOkTsbRC;
  175. cmJsonNode_t* tkArrObj = NULL;
  176. cmJsRC_t jsRC = kOkJsRC;
  177. const cmChar_t* errMsg = NULL;
  178. unsigned i;
  179. // initialize the TSB json object
  180. if(( rc = cmJsonInitializeFromFile(&p->jsH,scoreTrkFn,&p->ctx)) != kOkJsRC )
  181. {
  182. rc = cmErrMsg(&p->err,kJsonFailTsbRC,"The Take Sequence Builder JSON file object could not be initialized from '%s'.",cmStringNullGuard(scoreTrkFn));
  183. goto errLabel;
  184. }
  185. // parse the header
  186. if((jsRC = cmJsonMemberValues( cmJsonRoot(p->jsH), &errMsg,
  187. "timeLineFn", kStringTId, &p->tlFn,
  188. "scoreFn", kStringTId, &p->scFn,
  189. "tlPrefixPath", kStringTId, &p->tlPrefixPath,
  190. "takeArray", kArrayTId | kOptArgJsFl, &tkArrObj,
  191. NULL )) != kOkJsRC )
  192. {
  193. if( jsRC == kNodeNotFoundJsRC && errMsg != NULL )
  194. rc = cmErrMsg(&p->err,kParseFailTsbRC,"JSON file header parse failed missing required field:'%s'",errMsg);
  195. else
  196. rc = cmErrMsg(&p->err,kParseFailTsbRC,"JSON file header parse failed.");
  197. goto errLabel;
  198. }
  199. // count of take records
  200. p->scTrkTakeN = cmJsonChildCount(tkArrObj);
  201. // array of take records
  202. p->scTrkTakeV = cmMemAllocZ(cmScTrkTakeTsb_t,p->scTrkTakeN);
  203. // for each take record
  204. for(i=0; i<p->scTrkTakeN; ++i)
  205. {
  206. cmJsonNode_t* takeObj = NULL;
  207. cmJsonNode_t* noteArrObj = NULL;
  208. cmScTrkTakeTsb_t* t = p->scTrkTakeV + i;
  209. unsigned j;
  210. // get a pointer to the take record JSON object
  211. if((takeObj = cmJsonArrayElement(tkArrObj,i)) == NULL )
  212. {
  213. rc = cmErrMsg(&p->err,kParseFailTsbRC,"Take record header at index %i access failed.",i);
  214. goto errLabel;
  215. }
  216. // parse the take record
  217. if((jsRC = cmJsonMemberValues( takeObj, &errMsg,
  218. "markerUid",kIntTId, &t->tlMarkerUid,
  219. "failFl", kIntTId, &t->failFl,
  220. "array", kArrayTId, &noteArrObj,
  221. NULL)) != kOkJsRC )
  222. {
  223. if( jsRC == kNodeNotFoundJsRC && errMsg != NULL )
  224. rc = cmErrMsg(&p->err,kParseFailTsbRC,"JSON file take record parse failed missing required field:'%s'",errMsg);
  225. else
  226. rc = cmErrMsg(&p->err,kParseFailTsbRC,"JSON file take record parse failed.");
  227. goto errLabel;
  228. }
  229. // get the count of note records
  230. t->midiN = cmJsonChildCount(noteArrObj);
  231. // allocate a note record array for this take
  232. t->midiV = cmMemAllocZ(cmScTrkMidiTsb_t, t->midiN);
  233. t->minMuid = INT_MAX;
  234. t->maxMuid = 0;
  235. // for each note record
  236. for(j=0; j<t->midiN; ++j)
  237. {
  238. cmJsonNode_t* noteObj = NULL;
  239. // get the note record JSON object
  240. if((noteObj = cmJsonArrayElement(noteArrObj,j)) == NULL )
  241. {
  242. rc = cmErrMsg(&p->err,kParseFailTsbRC,"Access failed for note record at index %i at take index %i.",j,i);
  243. goto errLabel;
  244. }
  245. // parse the note record
  246. if((jsRC = cmJsonMemberValues( noteObj, &errMsg,
  247. "mni", kIntTId, &t->midiV[j].mni,
  248. "muid", kIntTId, &t->midiV[j].muid,
  249. "scEvtIdx", kIntTId, &t->midiV[j].scEvtIdx,
  250. "flags", kIntTId, &t->midiV[j].flags,
  251. NULL)) != kOkJsRC )
  252. {
  253. if( jsRC == kNodeNotFoundJsRC && errMsg != NULL )
  254. rc = cmErrMsg(&p->err,kParseFailTsbRC,"JSON file note record parse failed missing required field:'%s'",errMsg);
  255. else
  256. rc = cmErrMsg(&p->err,kParseFailTsbRC,"JSON file note record parse failed.");
  257. goto errLabel;
  258. }
  259. if( t->midiV[j].muid < t->minMuid )
  260. t->minMuid = t->midiV[j].muid;
  261. if( t->midiV[j].muid > t->maxMuid )
  262. t->maxMuid = t->midiV[j].muid;
  263. }
  264. }
  265. errLabel:
  266. if( rc != kOkTsbRC )
  267. rc = _cmTsbScoreTrkFree(p);
  268. return rc;
  269. }
  270. cmTsbRC_t cmTakeSeqBldrAlloc( cmCtx_t* ctx, cmTakeSeqBldrH_t* hp )
  271. {
  272. cmTsbRC_t rc;
  273. if((rc = cmTakeSeqBldrFree(hp)) != kOkTsbRC )
  274. return kOkTsbRC;
  275. cmTsb_t* p = cmMemAllocZ(cmTsb_t,1);
  276. cmErrSetup(&p->err,&ctx->rpt,"TakeSeqBldr");
  277. p->ctx = *ctx;
  278. hp->h = p;
  279. return rc;
  280. }
  281. cmTsbRC_t cmTakeSeqBldrAllocFn( cmCtx_t* ctx, cmTakeSeqBldrH_t* hp, const cmChar_t* scoreTrkFn )
  282. {
  283. cmTsbRC_t rc;
  284. if((rc = cmTakeSeqBldrAlloc(ctx,hp)) != kOkTsbRC )
  285. return rc;
  286. if((rc = cmTakeSeqBldrInitialize(*hp,scoreTrkFn)) != kOkTsbRC )
  287. return rc;
  288. return rc;
  289. }
  290. cmTsbRC_t cmTakeSeqBldrFree( cmTakeSeqBldrH_t* hp )
  291. {
  292. cmRC_t rc = kOkTsbRC;
  293. if( hp == NULL || cmTakeSeqBldrIsValid(*hp)==false )
  294. return kOkTsbRC;
  295. cmTsb_t* p = _cmTsbHandleToPtr(*hp);
  296. if((rc = _cmTsbFree(p)) != kOkTsbRC )
  297. return rc;
  298. hp->h = NULL;
  299. return rc;
  300. }
  301. bool cmTakeSeqBldrIsValid( cmTakeSeqBldrH_t h )
  302. { return h.h != NULL; }
  303. cmTsbRC_t cmTakeSeqBldrInitialize( cmTakeSeqBldrH_t h, const cmChar_t* scoreTrkFn )
  304. {
  305. cmTsbRC_t rc = kOkTsbRC;
  306. cmTsb_t* p = _cmTsbHandleToPtr(h);
  307. if(( rc = _cmTsbLoadScoreTrkFile( p, scoreTrkFn )) != kOkTsbRC )
  308. return rc;
  309. if( cmTimeLineInitializeFromFile(&p->ctx, &p->tlH, NULL, NULL, p->tlFn, p->tlPrefixPath ) != kOkTlRC )
  310. {
  311. rc = cmErrMsg(&p->err,kTimeLineFailTsbRC,"The time-line file '%s' could not be loaded.",p->tlFn);
  312. goto errLabel;
  313. }
  314. if( cmScoreInitialize(&p->ctx, &p->scH, p->scFn, 0, NULL, 0, NULL, NULL, cmSymTblNullHandle ) != kOkScRC )
  315. {
  316. rc = cmErrMsg(&p->err,kScoreFailTsbRC,"The score file '%s' could not be loaded.",p->scFn);
  317. goto errLabel;
  318. }
  319. errLabel:
  320. if( rc != kOkTsbRC )
  321. _cmTsbScoreTrkFree(p);
  322. return rc;
  323. }
  324. cmTakeTsb_t* _cmTsbMarkerUidToTake( cmTsb_t* p, unsigned tlMarkerUid )
  325. {
  326. cmTakeTsb_t* t = p->takes;
  327. for(; t != NULL; t=t->link)
  328. if( t->tlMarkerUid == tlMarkerUid )
  329. return t;
  330. return NULL;
  331. }
  332. cmTsbRC_t cmTakeSeqBldrLoadTake( cmTakeSeqBldrH_t h, unsigned tlMarkUid, bool overwriteFL )
  333. {
  334. cmTsbRC_t rc = kOkTsbRC;
  335. cmTsb_t* p = _cmTsbHandleToPtr(h);
  336. cmTlMarker_t* mark = NULL;
  337. cmTlMidiFile_t* mf = NULL;
  338. cmMidiFileH_t mfH = cmMidiFileNullHandle;
  339. cmScTrkTakeTsb_t* stt = NULL;
  340. // verify that the requested take has not already been loaded
  341. if( _cmTsbMarkerUidToTake( p, tlMarkUid ) != NULL )
  342. {
  343. rc = cmErrMsg(&p->err,kInvalidArgTsbRC,"The take indicated by marker id %i has already been loaded.",tlMarkUid );
  344. goto errLabel;
  345. }
  346. // find the score tracked take for the requested marker
  347. if((stt = _cmTsbMarkerIdToScTrkTake(p,tlMarkUid )) == NULL )
  348. {
  349. rc = cmErrMsg(&p->err,kInvalidArgTsbRC,"The score tracked take indicated by marker id %i could not be found.", tlMarkUid );
  350. goto errLabel;
  351. }
  352. // get a pointer to the time-line marker object
  353. if((mark = cmTlMarkerObjPtr( p->tlH, cmTimeLineIdToObj( p->tlH, cmInvalidId, tlMarkUid))) == NULL )
  354. {
  355. rc = cmErrMsg(&p->err,kInvalidArgTsbRC,"The time-line marker uid '%i' is not valid.",tlMarkUid);
  356. goto errLabel;
  357. }
  358. // get the name of the MIDI file which contains the marker
  359. if((mf = cmTimeLineMidiFileAtTime( p->tlH, mark->obj.seqId, mark->obj.seqSmpIdx )) == NULL )
  360. {
  361. rc = cmErrMsg(&p->err,kInvalidArgTsbRC,"The time-line marker '%i' does not intersect with a MIDI file.",tlMarkUid);
  362. goto errLabel;
  363. }
  364. // open the MIDI file
  365. if( cmMidiFileOpen( cmMidiFileName(mf->h), &mfH, &p->ctx ) != kOkMfRC )
  366. {
  367. rc = cmErrMsg(&p->err,kInvalidArgTsbRC,"The MIDI file '%s' could not be opened.", cmStringNullGuard(cmMidiFileName(mf->h)));
  368. goto errLabel;
  369. }
  370. // convert the dtick field to absolute sample indexes
  371. cmMidiFileTickToSamples( mfH, cmTimeLineSampleRate(p->tlH), true );
  372. // calculate MIDI note and pedal durations (see cmMidiChMsg_t.durTicks)
  373. cmMidiFileCalcNoteDurations( mfH );
  374. unsigned i = 0;
  375. unsigned n = cmMidiFileMsgCount(mfH);
  376. const cmMidiTrackMsg_t** a = cmMidiFileMsgArray(mfH);
  377. // allocate and link a new take render record
  378. cmTakeTsb_t* t = cmMemAllocZ(cmTakeTsb_t,1);
  379. t->tlMarkerUid = tlMarkUid;
  380. if( p->takes != NULL )
  381. p->takes->link = t;
  382. p->takes = t;
  383. cmMidiTsb_t* m0 = NULL;
  384. const cmMidiTrackMsg_t* mf0 = NULL;
  385. // for each MIDI message in the file
  386. for(i=0; i<n; ++i)
  387. {
  388. const cmMidiTrackMsg_t* mf1 = a[i];
  389. // we are only interested in rendering notes and control msgs
  390. switch( mf1->status )
  391. {
  392. case kNoteOnMdId:
  393. case kNoteOffMdId:
  394. case kCtlMdId:
  395. break;
  396. default:
  397. continue;
  398. }
  399. // if this MIDI message is inside the tracked region of the take
  400. if( stt->minMuid > mf1->uid || mf1->uid > stt->maxMuid )
  401. continue;
  402. // get a pointer to the tracking map
  403. cmScTrkMidiTsb_t* stm = _cmTsbMuidToScTrkMidi(stt, mf1->uid );
  404. // create a MIDI render event
  405. cmMidiTsb_t* m1 = cmMemAllocZ(cmMidiTsb_t,1);
  406. m1->srcId = tlMarkUid;
  407. m1->scEvtIdx = stm != NULL ? stm->scEvtIdx : cmInvalidIdx;
  408. m1->flags = stm != NULL ? stm->flags : 0;
  409. m1->ref = m0;
  410. m1->offsetSmp = mf0 == NULL ? 0 : mf1->dtick - mf0->dtick;
  411. m1->durSmp = mf1->u.chMsgPtr->durTicks;
  412. m1->d0 = mf1->u.chMsgPtr->d0;
  413. m1->d1 = mf1->u.chMsgPtr->d1;
  414. m1->link = NULL;
  415. if( m0 != NULL )
  416. m0->link = m1;
  417. if( t->midi == NULL )
  418. t->midi = m1;
  419. m0 = m1;
  420. mf0 = mf1;
  421. }
  422. errLabel:
  423. if( cmMidiFileClose(&mfH) != kOkMfRC )
  424. rc = cmErrMsg(&p->err,kMidiFileFailTsbRC,"MIDI file close failed.");
  425. return rc;
  426. }
  427. cmTsbRC_t cmTakeSeqBldrUnloadTake( cmTakeSeqBldrH_t h, unsigned tlMarkUid )
  428. {
  429. cmTsbRC_t rc = kOkTsbRC;
  430. cmTsb_t* p = _cmTsbHandleToPtr(h);
  431. cmTakeTsb_t* t;
  432. if((t = _cmTsbMarkerUidToTake(p, tlMarkUid )) == NULL )
  433. return cmErrMsg(&p->err,kInvalidArgTsbRC,"The take indicated by marker id %i could not be found.",tlMarkUid);
  434. t = _cmTsbTakeUnlink(p,t);
  435. assert( t != NULL );
  436. _cmTsbTakeFree(p,t);
  437. return rc;
  438. }
  439. cmTsbRC_t cmTakeSeqBldrInsertScoreNotes( cmTakeSeqBldrH_t h, unsigned begScEvtIdx, unsigned endScEvtId )
  440. {
  441. cmTsbRC_t rc = kOkTsbRC;
  442. return rc;
  443. }
  444. cmTsbRC_t cmTakeSeqBldrRemoveScoreNotes( cmTakeSeqBldrH_t h, unsigned begScEvtIdx, unsigned endScEvtId )
  445. {
  446. cmTsbRC_t rc = kOkTsbRC;
  447. return rc;
  448. }
  449. cmTsbRC_t cmTakeSeqBldrSelectEnable( cmTakeSeqBldrH_t h, unsigned flags, unsigned id, bool selectFl )
  450. {
  451. cmTsbRC_t rc = kOkTsbRC;
  452. return rc;
  453. }
  454. cmTsbRC_t cmTakeSeqBldrEnableNote( cmTakeSeqBldrH_t h, unsigned ssqId, bool enableFl )
  455. {
  456. cmTsbRC_t rc = kOkTsbRC;
  457. return rc;
  458. }
  459. cmTsbRC_t cmTakeSeqBldrMoveNote( cmTakeSeqBldrH_t h, unsigned ssqId, int deltaSmpIdx )
  460. {
  461. cmTsbRC_t rc = kOkTsbRC;
  462. return rc;
  463. }
  464. cmTsbRC_t cmTakeSeqBldrWriteMidiFile( cmTakeSeqBldrH_t h, const char* fn )
  465. {
  466. cmTsbRC_t rc = kOkTsbRC;
  467. return rc;
  468. }
  469. cmTsbRC_t cmTakeSeqBldrTest( cmCtx_t* ctx )
  470. {
  471. const cmChar_t* scoreTrkFn = "/home/kevin/src/cmkc/src/kc/data/assoc0.js";
  472. cmTakeSeqBldrH_t tsbH = cmTakeSeqBldrNullHandle;
  473. cmTsbRC_t tsbRC = kOkTsbRC;
  474. if((tsbRC = cmTakeSeqBldrAllocFn(ctx, &tsbH, scoreTrkFn )) != kOkTsbRC )
  475. return cmErrMsg(&ctx->err,tsbRC,"TSB Allocate and parse '%s' failed.",scoreTrkFn);
  476. if((tsbRC = cmTakeSeqBldrFree(&tsbH)) != kOkTsbRC )
  477. return cmErrMsg(&ctx->err,tsbRC,"TSB Free failed.");
  478. return tsbRC;
  479. }