|
@@ -1368,10 +1368,13 @@ cmMfRC_t cmMidiFileInsertMsg( cmMidiFileH_t h, unsigned uid, int dtick, cmMidiBy
|
1368
|
1368
|
|
1369
|
1369
|
}
|
1370
|
1370
|
|
1371
|
|
-cmMfRC_t cmMidiFileInsertTrackMsg( cmMidiFileH_t h, unsigned trkIdx, const cmMidiTrackMsg_t* msg )
|
|
1371
|
+cmMfRC_t cmMidiFileInsertTrackMsg( cmMidiFileH_t h, unsigned trkIdx, const cmMidiTrackMsg_t* msg, unsigned* uidRef )
|
1372
|
1372
|
{
|
1373
|
1373
|
_cmMidiFile_t* p = _cmMidiFileHandleToPtr(h);
|
1374
|
1374
|
|
|
1375
|
+ if( uidRef != NULL )
|
|
1376
|
+ *uidRef = cmInvalidId;
|
|
1377
|
+
|
1375
|
1378
|
// validate the track index
|
1376
|
1379
|
if( trkIdx >= p->trkN )
|
1377
|
1380
|
return cmErrMsg(&p->err,kInvalidTrkIndexMfRC,"The track index (%i) is invalid.",trkIdx);
|
|
@@ -1395,6 +1398,9 @@ cmMfRC_t cmMidiFileInsertTrackMsg( cmMidiFileH_t h, unsigned trkIdx, const cmMi
|
1395
|
1398
|
memcpy((void*)m->u.voidPtr,msg->u.voidPtr,msg->byteCnt);
|
1396
|
1399
|
}
|
1397
|
1400
|
|
|
1401
|
+ if( uidRef != NULL )
|
|
1402
|
+ *uidRef = m->uid;
|
|
1403
|
+
|
1398
|
1404
|
cmMidiTrackMsg_t* m0 = NULL; // msg before insertion
|
1399
|
1405
|
cmMidiTrackMsg_t* m1 = p->trkV[trkIdx].base; // msg after insertion
|
1400
|
1406
|
|
|
@@ -1448,12 +1454,14 @@ cmMfRC_t cmMidiFileInsertTrackMsg( cmMidiFileH_t h, unsigned trkIdx, const cmMi
|
1448
|
1454
|
|
1449
|
1455
|
p->trkV[trkIdx].cnt += 1;
|
1450
|
1456
|
p->msgVDirtyFl = true;
|
|
1457
|
+
|
|
1458
|
+
|
1451
|
1459
|
|
1452
|
1460
|
return kOkMfRC;
|
1453
|
1461
|
|
1454
|
1462
|
}
|
1455
|
1463
|
|
1456
|
|
-cmMfRC_t cmMidiFileInsertTrackChMsg( cmMidiFileH_t h, unsigned trkIdx, unsigned atick, cmMidiByte_t status, cmMidiByte_t d0, cmMidiByte_t d1 )
|
|
1464
|
+cmMfRC_t cmMidiFileInsertTrackChMsg( cmMidiFileH_t h, unsigned trkIdx, unsigned atick, cmMidiByte_t status, cmMidiByte_t d0, cmMidiByte_t d1, unsigned* uidRef )
|
1457
|
1465
|
{
|
1458
|
1466
|
cmMidiTrackMsg_t m;
|
1459
|
1467
|
cmMidiChMsg_t cm;
|
|
@@ -1472,10 +1480,10 @@ cmMfRC_t cmMidiFileInsertTrackChMsg( cmMidiFileH_t h, unsigned trkIdx, unsigned
|
1472
|
1480
|
|
1473
|
1481
|
assert( m.status >= kNoteOffMdId && m.status <= kPbendMdId );
|
1474
|
1482
|
|
1475
|
|
- return cmMidiFileInsertTrackMsg(h,trkIdx,&m);
|
|
1483
|
+ return cmMidiFileInsertTrackMsg(h,trkIdx,&m,uidRef);
|
1476
|
1484
|
}
|
1477
|
1485
|
|
1478
|
|
-cmMfRC_t cmMidFileInsertTrackTempoMsg( cmMidiFileH_t h, unsigned trkIdx, unsigned atick, unsigned bpm )
|
|
1486
|
+cmMfRC_t cmMidFileInsertTrackTempoMsg( cmMidiFileH_t h, unsigned trkIdx, unsigned atick, unsigned bpm, unsigned* uidRef )
|
1479
|
1487
|
{
|
1480
|
1488
|
cmMidiTrackMsg_t m;
|
1481
|
1489
|
|
|
@@ -1486,7 +1494,7 @@ cmMfRC_t cmMidFileInsertTrackTempoMsg( cmMidiFileH_t h, unsigned trkIdx, unsign
|
1486
|
1494
|
m.metaId = kTempoMdId;
|
1487
|
1495
|
m.u.iVal = 60000000/bpm; // convert BPM to microsPerQN
|
1488
|
1496
|
|
1489
|
|
- return cmMidiFileInsertTrackMsg(h,trkIdx,&m);
|
|
1497
|
+ return cmMidiFileInsertTrackMsg(h,trkIdx,&m,uidRef);
|
1490
|
1498
|
}
|
1491
|
1499
|
|
1492
|
1500
|
|