Compare commits

...

7 Commits

7 changed files with 192 additions and 242 deletions

View File

@ -1,7 +1,7 @@
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
the Free Software Foundation, either version 3 of the License, or
any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
@ -9,4 +9,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this library. If not, see <https://www.gnu.org/licenses/>.

View File

@ -569,41 +569,41 @@ cmXsRC_t _cmXScoreParseColor( cmXScore_t* p, const cmXmlNode_t* nnp, cmXsNote_t
map_t mapV[] =
{
{ kEvenXsFl, "#0000FF" }, // blue (even)
{ kEvenXsFl | kEvenEndXsFl, "#0000FE" }, // blue (even end)
{ kEvenXsFl | kEvenEndXsFl, "#0000FD" }, // blue (even end)
{ kTempoXsFl, "#00FF00" }, // green (tempo)
{ kTempoXsFl | kTempoEndXsFl, "#00FE00" }, // green (tempo end)
{ kDynXsFl, "#FF0000" }, // red (dynamics)
{ kDynXsFl | kDynEndXsFl, "#FE0000" }, // red (dynamics end)
{ kDynXsFl | kDynEndXsFl, "#FD0000" }, // red (dynamics end)
{ kTempoXsFl | kEvenXsFl, "#00FFFF" }, // green + blue (turquoise)
{ kTempoXsFl | kEvenXsFl | kEvenEndXsFl, "#00FFFE" }, // green + blue (turquoise) (end)
{ kDynXsFl | kEvenXsFl, "#FF00FF" }, // red + blue
{ kDynXsFl | kEvenXsFl | kEvenEndXsFl, "#FF00FE" }, // red + blue (end)
{ kDynXsFl | kEvenXsFl | kEvenEndXsFl, "#FF00FD" }, // red + blue (end)
{ kDynXsFl | kEvenXsFl, "#FF0CF7" }, // magenta (even+dyn)
{ kDynXsFl | kTempoXsFl, "#FF7F00" }, // red + green (brown)
{ kDynXsFl | kTempoXsFl, "#FE7F00" }, // red + green (brown) (end)
{ kDynXsFl | kTempoXsFl, "#FD7F00" }, // red + green (brown) (end)
{ kDynXsFl | kTempoXsFl | kTempoEndXsFl, "#FF7E00" }, //
{ kDynXsFl | kDynEndXsFl | kEvenXsFl | kEvenEndXsFl, "#FE00FE" }, //
{ kDynXsFl | kDynEndXsFl | kEvenXsFl, "#FE00FF" },
{ kTempoXsFl | kEvenXsFl | kDynXsFl, "#996633" }, // (purple)
{ kTempoXsFl | kEvenXsFl | kDynXsFl | kDynEndXsFl, "#996632" }, // (purple)
{ kDynXsFl, "#FF6A03" }, // 176 orange (dynamics)
{ kEvenXsFl, "#2F00E8" }, // 1001 blue (even)
{ kTempoXsFl, "#01CD1F" }, // 1196 green (tempo)
{ kEvenXsFl, "#3600E8" }, // 1627 blue (even)
{ kDynXsFl | kTempoXsFl, "#9E8F15" }, // 8827 brown (dyn + tempo)
{ kEvenXsFl, "#2E00E6" }, // 5393 blue (even)
{ kEvenXsFl, "#2C00DD" }, // 5895 blue (even)
{ kDynXsFl, "#FF5B03" }, // 6498 orange (dyn)
{ kDynXsFl, "#FF6104" }, // 6896 orange
{ kEvenXsFl, "#2A00E6" }, // 7781 blue
{ kEvenXsFl, "#2300DD" }, // 8300 blue (even)
{ kTempoXsFl, "#03CD22" }, // 10820 green (tempo)
{ kEvenXsFl, "#3400DB" }, // 11627 blue (dyn)
{ kEvenXsFl, "#FF0000FF" }, // blue (even)
{ kEvenXsFl | kEvenEndXsFl, "#FF0000FE" }, // blue (even end)
{ kEvenXsFl | kEvenEndXsFl, "#FF0000FD" }, // blue (even end)
{ kTempoXsFl, "#FF00FF00" }, // green (tempo)
{ kTempoXsFl | kTempoEndXsFl, "#FF00FE00" }, // green (tempo end)
{ kDynXsFl, "#FFFF0000" }, // red (dynamics)
{ kDynXsFl | kDynEndXsFl, "#FFFE0000" }, // red (dynamics end)
{ kDynXsFl | kDynEndXsFl, "#FFFD0000" }, // red (dynamics end)
{ kTempoXsFl | kEvenXsFl, "#FF00FFFF" }, // green + blue (turquoise)
{ kTempoXsFl | kEvenXsFl | kEvenEndXsFl, "#FF00FFFE" }, // green + blue (turquoise) (end)
{ kDynXsFl | kEvenXsFl, "#FFFF00FF" }, // red + blue
{ kDynXsFl | kEvenXsFl | kEvenEndXsFl, "#FFFF00FE" }, // red + blue (end)
{ kDynXsFl | kEvenXsFl | kEvenEndXsFl, "#FFFF00FD" }, // red + blue (end)
{ kDynXsFl | kEvenXsFl, "#FFFF0CF7" }, // magenta (even+dyn)
{ kDynXsFl | kTempoXsFl, "#FFFF7F00" }, // red + green (brown)
{ kDynXsFl | kTempoXsFl, "#FFFE7F00" }, // red + green (brown) (end)
{ kDynXsFl | kTempoXsFl, "#FFFD7F00" }, // red + green (brown) (end)
{ kDynXsFl | kTempoXsFl | kTempoEndXsFl, "#FFFF7E00" }, //
{ kDynXsFl | kDynEndXsFl | kEvenXsFl | kEvenEndXsFl, "#FFFE00FE" }, //
{ kDynXsFl | kDynEndXsFl | kEvenXsFl, "#FFFE00FF" },
{ kTempoXsFl | kEvenXsFl | kDynXsFl, "#FF996633" }, // (purple)
{ kTempoXsFl | kEvenXsFl | kDynXsFl | kDynEndXsFl, "#FF996632" }, // (purple)
{ kDynXsFl, "#FFFF6A03" }, // 176 orange (dynamics)
{ kEvenXsFl, "#FF2F00E8" }, // 1001 blue (even)
{ kTempoXsFl, "#FF01CD1F" }, // 1196 green (tempo)
{ kEvenXsFl, "#FF3600E8" }, // 1627 blue (even)
{ kDynXsFl | kTempoXsFl, "#FF9E8F15" }, // 8827 brown (dyn + tempo)
{ kEvenXsFl, "#FF2E00E6" }, // 5393 blue (even)
{ kEvenXsFl, "#FF2C00DD" }, // 5895 blue (even)
{ kDynXsFl, "#FFFF5B03" }, // 6498 orange (dyn)
{ kDynXsFl, "#FFFF6104" }, // 6896 orange
{ kEvenXsFl, "#FF2A00E6" }, // 7781 blue
{ kEvenXsFl, "#FF2300DD" }, // 8300 blue (even)
{ kTempoXsFl, "#FF03CD22" }, // 10820 green (tempo)
{ kEvenXsFl, "#FF3400DB" }, // 11627 blue (dyn)
{ -1, "" }
};
@ -792,12 +792,14 @@ cmXsRC_t _cmXScoreParseDirection(cmXScore_t* p, cmXsMeas_t* meas, const cmXmlNo
{
if( cmXmlNodeUInt(np,&duration,"per-minute",NULL) != kOkXmlRC )
return cmErrMsg(&p->err,kSyntaxErrorXsRC,"The 'per-minute' metronome value is missing on line %i.",np->line);
cmErrWarnMsg(&p->err,kSyntaxErrorXsRC,"The 'per-minute' metronome value is missing on line %i.",np->line);
else
{
if((rc = _cmXScoreParseNoteRValue(p,np,"beat-unit",&rvalue)) != kOkXsRC )
return rc;
if((rc = _cmXScoreParseNoteRValue(p,np,"beat-unit",&rvalue)) != kOkXsRC )
return rc;
flags = kMetronomeXsFl;
flags = kMetronomeXsFl;
}
}
else
@ -1803,17 +1805,77 @@ void _cmXScoreGraceInsertSoonAfterFirst( cmXScore_t* p, unsigned graceGroupId, c
_cmXScoreGraceInsertTimeBase( p, graceGroupId,aV,aN, aV[0]->tick + aV[1]->duration );
}
cmXsRC_t _cmXScorAssignGraceGroupId( cmXScore_t* p, unsigned* nextGraceGroupIdRef )
{
enum { kBeforeGroupState, kInGroupState };
cmXsRC_t rc = kOkXsRC;
unsigned curGroupId = 1;
unsigned state = kBeforeGroupState;
cmXsPart_t* pp = p->partL;
for(; pp!=NULL; pp=pp->link)
{
cmXsMeas_t* mp = pp->measL;
for(; mp!=NULL; mp=mp->link)
{
cmXsNote_t* np = mp->noteL;
for(; np!=NULL; np=np->slink )
{
switch( state )
{
case kBeforeGroupState:
if( cmIsFlag(np->flags,kBegGraceXsFl) )
{
state = kInGroupState;
np->graceGroupId = curGroupId;
printf("b: %i %i %i %s\n",curGroupId,np->meas->number,np->locIdx,cmMidiToSciPitch(np->pitch,NULL,0));
}
break;
case kInGroupState:
if( np->graceGroupId > 0 )
{
np->graceGroupId = curGroupId;
printf("%s: %i %i %i %s\n",cmIsFlag(np->flags,kEndGraceXsFl ) ? "e":"g",curGroupId,np->meas->number,np->locIdx,cmMidiToSciPitch(np->pitch,NULL,0));
if( cmIsFlag(np->flags,kEndGraceXsFl ) )
{
curGroupId+=1;
state = kBeforeGroupState;
}
}
}
}
}
}
if( state != kBeforeGroupState )
rc = cmErrMsg(&p->err,kSyntaxErrorXsRC,"There is a missing grace note group begin or end indicator." );
else
*nextGraceGroupIdRef = curGroupId;
return rc;
}
// Adjust the locations of grace notes. Note that this must be done
// after reordering so that we can be sure that the order in time of
// the notes in each group has been set prior to building the
// grace note groups - which must be in reverse time order.
cmXsRC_t _cmXScoreProcessGraceNotes( cmXScore_t* p, unsigned nextGraceGroupId )
cmXsRC_t _cmXScoreProcessGraceNotes( cmXScore_t* p )
{
cmXsRC_t rc = kOkXsRC;
unsigned graceGroupId = 1;
double graceDurSec = 1.0/15.0; // duration of all grace notes in seconds
unsigned nextGraceGroupId = 1;
// Reassign the grace note group id's
if((rc = _cmXScorAssignGraceGroupId(p,&nextGraceGroupId)) != kOkXsRC )
return rc;
for(; graceGroupId<nextGraceGroupId; ++graceGroupId)
{
cmXsNote_t* gn0p = NULL; // first note in the grace group
@ -1873,7 +1935,7 @@ cmXsRC_t _cmXScoreProcessGraceNotes( cmXScore_t* p, unsigned nextGraceGroupId )
// grace note groups must have at least 3 members
if( gN < 3 )
{
rc = cmErrMsg(&p->err,kSyntaxErrorXsRC,"The grace note group (groupid=%i) ending in meas %i has fewer than 3 (%i) members.", gn1p->graceGroupId, gn1p->meas->number, gN );
rc = cmErrMsg(&p->err,kSyntaxErrorXsRC,"The grace note group (groupid=%i) ending in meas %i loc:%i has fewer than 3 (%i) members.", gn1p->graceGroupId, gn1p->meas->number, gn1p->locIdx, gN );
break;
}
@ -2040,12 +2102,41 @@ cmXsRC_t _cmXScoreProcessDynamicFork( cmXScore_t* p, cmXsNote_t* bnp )
return kOkXsRC;
}
cmXsRC_t _cmXScoreValidateDynamicForks( cmXScore_t* p )
{
cmXsRC_t rc = kOkXsRC;
cmXsPart_t* pp = p->partL;
for(; pp!=NULL; pp=pp->link)
{
cmXsMeas_t* mp = pp->measL;
for(; mp!=NULL; mp=mp->link)
{
cmXsNote_t* np = mp->noteL;
for(; np!=NULL; np=np->slink )
{
if( cmIsFlag(np->flags,kDynBegForkXsFl) )
printf("Beg: %5i loc:%i\n",np->meas->number,np->locIdx);
if( cmIsFlag(np->flags,kDynEndForkXsFl) )
printf(" %5i loc::%i\n",np->meas->number,np->locIdx);
}
}
}
return rc;
}
cmXsRC_t _cmXScoreProcessDynamicForks( cmXScore_t* p )
{
cmXsRC_t rc = kOkXsRC;
cmXsPart_t* pp = p->partL;
_cmXScoreValidateDynamicForks(p);
for(; pp!=NULL; pp=pp->link)
{
cmXsMeas_t* mp = pp->measL;
@ -2704,7 +2795,7 @@ cmXsRC_t _cmXScoreReorderParseTick(cmXScore_t* p, const cmChar_t* b, unsigned l
return rc;
}
cmXsRC_t _cmXScoreReorderParseGrace(cmXScore_t* p, const cmChar_t* b, unsigned line, char** s0, cmXsReorder_t* r, unsigned* graceGroupIdRef )
cmXsRC_t _cmXScoreReorderParseGrace(cmXScore_t* p, const cmChar_t* b, unsigned line, char** s0, cmXsReorder_t* r )
{
cmXsRC_t rc = kOkXsRC;
cmChar_t* s;
@ -2717,7 +2808,7 @@ cmXsRC_t _cmXScoreReorderParseGrace(cmXScore_t* p, const cmChar_t* b, unsigned
++s;
r->graceGroupId = *graceGroupIdRef;
r->graceGroupId = 1; // mark this as belong to a grace note group
while(1)
{
@ -2730,14 +2821,14 @@ cmXsRC_t _cmXScoreReorderParseGrace(cmXScore_t* p, const cmChar_t* b, unsigned
case 'n': r->graceFlags |= kNFirstGraceXsFl| kEndGraceXsFl; break;
case 'g': break;
case '1':
r->graceGroupId += 1;
case '1': // TODO: what is this doing?
r->graceGroupId += 1;
++s;
continue;
case '%':
*graceGroupIdRef += 1;
//*graceGroupIdRef += 1;
++s;
continue;
@ -2803,7 +2894,7 @@ cmXsRC_t _cmXScoreReorderParsePitch(cmXScore_t* p, const cmChar_t* b, unsigned
return rc;
}
cmXsRC_t _cmXsReadEditFile( cmXScore_t* p, const cmChar_t* fn, unsigned* graceGroupIdPtr, cmXsReorderFile_t* rfp )
cmXsRC_t _cmXsReadEditFile( cmXScore_t* p, const cmChar_t* fn, cmXsReorderFile_t* rfp )
{
typedef enum { kFindMeasStId, kFindEventStId, kReadEventStId } stateId_t;
@ -2815,8 +2906,6 @@ cmXsRC_t _cmXsReadEditFile( cmXScore_t* p, const cmChar_t* fn, unsigned* graceGr
stateId_t stateId = kFindMeasStId;
cmXsReorderMeas_t* curMeas = NULL;
*graceGroupIdPtr = 1;
if( cmFileOpen(&fH,fn,kReadFileFl,p->err.rpt) != kOkFileRC )
{
rc = cmErrMsg(&p->err,kFileFailXsRC,"The reordering file '%s' could not be opened.",cmStringNullGuard(fn));
@ -2887,7 +2976,7 @@ cmXsRC_t _cmXsReadEditFile( cmXScore_t* p, const cmChar_t* fn, unsigned* graceGr
goto errLabel;
// parse the %grace note marker
if((rc = _cmXScoreReorderParseGrace(p, b, ln+1, &s0, r, graceGroupIdPtr)) != kOkXsRC )
if((rc = _cmXScoreReorderParseGrace(p, b, ln+1, &s0, r)) != kOkXsRC )
goto errLabel;
// parse the $pitch marker
@ -2931,12 +3020,11 @@ cmXsRC_t _cmXsReadEditFile( cmXScore_t* p, const cmChar_t* fn, unsigned* graceGr
cmXsRC_t _cmXsApplyEditFile( cmXScore_t* p, const cmChar_t* fn )
{
cmXsRC_t rc = kOkXsRC;
unsigned graceGroupId = 1;
cmXsReorderFile_t rf;
cmXsReorderMeas_t* m;
memset(&rf,0,sizeof(rf));
if((rc = _cmXsReadEditFile( p, fn, &graceGroupId, &rf )) != kOkXsRC )
if((rc = _cmXsReadEditFile( p, fn, &rf )) != kOkXsRC )
return rc;
// reorder each measure
@ -2954,7 +3042,7 @@ cmXsRC_t _cmXsApplyEditFile( cmXScore_t* p, const cmChar_t* fn )
_cmXScoreSort(p);
// process the grace notes.
_cmXScoreProcessGraceNotes( p, graceGroupId );
_cmXScoreProcessGraceNotes( p );
// inserting grace notes may have left the score unsorted
_cmXScoreSort(p);
@ -2973,12 +3061,11 @@ cmXsRC_t _cmXsApplyEditFile( cmXScore_t* p, const cmChar_t* fn )
cmXsRC_t _cmXsMergeEditFiles( cmXScore_t* p, unsigned measNumb0, const cmChar_t* keyEditFn, unsigned keyMeasNumb, const cmChar_t* outFn )
{
cmXsRC_t rc = kOkXsRC;
unsigned graceGroup1Id = 1;
unsigned measNumb1 = keyMeasNumb;
cmXsReorderFile_t rf1;
memset(&rf1,0,sizeof(rf1));
if((rc = _cmXsReadEditFile( p, keyEditFn, &graceGroup1Id, &rf1 )) != kOkXsRC )
if((rc = _cmXsReadEditFile( p, keyEditFn, &rf1 )) != kOkXsRC )
return rc;
while(1)
@ -3028,168 +3115,6 @@ cmXsRC_t _cmXsMergeEditFiles( cmXScore_t* p, unsigned measNumb0, const cmChar_t*
cmXsRC_t _cmXsApplyEditFile0( cmXScore_t* p, const cmChar_t* fn )
{
typedef enum { kFindMeasStId, kFindEventStId, kReadEventStId } stateId_t;
cmXsRC_t rc = kOkXsRC;
cmFileH_t fH = cmFileNullHandle;
cmChar_t* b = NULL;
unsigned bN = 0;
unsigned ln = 0;
stateId_t stateId = kFindMeasStId;
unsigned rN = 1024;
unsigned ri = 0;
unsigned measNumb = 0;
unsigned graceGroupId = 1;
cmXsReorder_t rV[ rN ];
if( cmFileOpen(&fH,fn,kReadFileFl,p->err.rpt) != kOkFileRC )
{
rc = cmErrMsg(&p->err,kFileFailXsRC,"The reordering file '%s' could not be opened.",cmStringNullGuard(fn));
return rc;
}
for(; cmFileGetLineAuto(fH,&b,&bN)==kOkFileRC; ++ln)
{
switch( stateId )
{
case kFindEventStId: // scanning past labels to an event line
{
unsigned voice,loc;
if( sscanf(b,"%i %i",&voice,&loc) != 2 )
continue;
stateId = kReadEventStId;
}
// fall through
case kReadEventStId:
{
cmXsReorder_t r;
char pitchStr[4];
char* s0 = NULL;
memset(&r,0,sizeof(r));
// parse an event line
if( sscanf(b,"%i %i %i %i %i %f",&r.idx,&r.voice,&r.locIdx,&r.tick,&r.durtn,&r.rval) == 6 )
{
assert( strlen(b)>=52);
int PC = 39; // text file column where first pitch char occurs
if( b[PC] == ' ')
r.midi = kInvalidMidiPitch;
else
{
pitchStr[0] = b[PC+0];
pitchStr[1] = b[PC+1];
pitchStr[2] = b[PC+2];
pitchStr[3] = 0;
if( !isdigit(pitchStr[2]) )
r.midi = kInvalidMidiPitch;
else
{
if( pitchStr[1] == ' ')
{
pitchStr[1] = pitchStr[2];
pitchStr[2] = 0;
}
r.midi = cmSciPitchToMidi(pitchStr);
}
}
// parse the flag edits following a '~'
if((rc = _cmXScoreReorderParseFlags(p,b,ln+1, &s0, &r.newFlags)) != kOkXsRC )
goto errLabel;
// parse the dynamic marking following a '!'
if((rc = _cmXScoreReorderParseDyn(p,b,ln+1,&s0, &r.dynIdx, &r.newFlags, measNumb)) != kOkXsRC )
goto errLabel;
// parse the @newtick marker
if((rc = _cmXScoreReorderParseTick(p, b, ln+1, &s0, &r.newTick)) != kOkXsRC )
goto errLabel;
// parse the %grace note marker
if((rc = _cmXScoreReorderParseGrace(p, b, ln+1, &s0, &r, &graceGroupId)) != kOkXsRC )
goto errLabel;
// parse the $pitch marker
if((rc = _cmXScoreReorderParsePitch(p, b, ln+1, &s0, &r.pitch )) != kOkXsRC )
goto errLabel;
// store the record
assert( ri < rN );
rV[ri++] = r;
continue;
}
// the end of the measure was encountered -
// reorder the measure based on the cmXsReorder_t in rV[ri]
if((rc = _cmXScoreReorderMeas0(p, measNumb, rV, ri )) != kOkXsRC )
goto errLabel;
ri = 0;
stateId = kFindMeasStId;
// fall through
}
case kFindMeasStId: // scanning for a bar-line
{
char colon;
if( sscanf(b,"%i %c",&measNumb,&colon) == 2 && colon == ':' )
{
//printf("meas: %i \n",measNumb);
stateId = kFindEventStId;
}
}
break;
}
}
// If reorder records remain to be processed
if( ri > 0 )
if((rc = _cmXScoreReorderMeas0(p, measNumb, rV, ri )) != kOkXsRC )
goto errLabel;
// the ticks may have changed so the 'secs' and 'dsecs' must be updated
_cmXScoreSetAbsoluteTime( p );
// the bar lines should be the first event in the measure
_cmXScoreFixBarLines(p);
// resort to force the links to be correct
_cmXScoreSort(p);
// process the grace notes.
_cmXScoreProcessGraceNotes( p, graceGroupId );
// inserting grace notes may have left the score unsorted
_cmXScoreSort(p);
// process the dynamic forks
_cmXScoreProcessDynamicForks(p);
//_cmXScoreReport(p, NULL, true );
errLabel:
cmFileClose(&fH);
cmMemFree(b);
return rc;
}
cmXsRC_t cmXScoreAlloc( cmCtx_t* ctx, cmXsH_t* hp )
{

View File

@ -332,14 +332,17 @@ cmXmlRC_t _cmXmlParseAttr( cmXml_t* p, cmChar_t endChar, cmXmlNode_t* np )
if((v0 = _cmXmlAdvanceToNextNonWhite(p)) == NULL )
return _cmXmlSyntaxError(p);
char begChar = *p->c;
// the first character in the value must be a single quote
if( *p->c == '\'' )
if( begChar == '\'' || begChar == '"' )
{
if((v0 = _cmXmlAdvanceOne(p)) == NULL )
return _cmXmlSyntaxError(p);
char endStr[] = { begChar, 0 };
// advance to the next single quote
v1 = _cmXmlAdvanceToNext(p,"'");
v1 = _cmXmlAdvanceToNext(p,endStr);
}
else
{
@ -350,7 +353,7 @@ cmXmlRC_t _cmXmlParseAttr( cmXml_t* p, cmChar_t endChar, cmXmlNode_t* np )
return _cmXmlSyntaxError(p);
// advance past the ending single quote
// advance past the ending quote
if( *p->c != endChar )
if( _cmXmlAdvanceOne(p) == NULL )
return _cmXmlSyntaxError(p);
@ -359,7 +362,7 @@ cmXmlRC_t _cmXmlParseAttr( cmXml_t* p, cmChar_t endChar, cmXmlNode_t* np )
_cmXmlAttrAlloc(p, np, l0, l1-l0, v0, v1-v0 );
// p->c now points just past the ending single quote
// p->c now points just past the ending quote
return rc;
}

View File

@ -911,7 +911,10 @@ cmDspRC_t _cmDspMidiOutRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
{
cmMpDeviceSend(p->devIdx,p->portIdx,kCtlMdId+i,121,0); // reset all controllers
cmMpDeviceSend(p->devIdx,p->portIdx,kCtlMdId+i,123,0); // turn all notes off
cmSleepMs(15);
//cmSleepMs(15); this delay was causing audio to glitch badly
// if a delay is necessary make it shorter and only send it on channels where
// previous note-ons were issued.
}
}
break;

View File

@ -386,8 +386,8 @@ cmDspRC_t _cmDspSysPgm_Stereo_Through( cmDspSysH_t h, void** userPtrPtr )
cmDspInst_t* ai1p = cmDspSysAllocInst(h,"AudioIn", NULL, 1, 3 );
// MOTU Traveler: Use channels 2&3 (out plugs:3&4) because 0&1 do not show up on plugs 1&2.
cmDspInst_t* ao0p = cmDspSysAllocInst(h,"AudioOut",NULL, 1, 2 );
cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut",NULL, 1, 3 );
cmDspInst_t* ao0p = cmDspSysAllocInst(h,"AudioOut",NULL, 1, 0 );
cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut",NULL, 1, 1 );
cmDspInst_t* im0p = cmDspSysAllocInst(h,"AMeter","In 0", 0);
cmDspInst_t* im1p = cmDspSysAllocInst(h,"AMeter","In 1", 0);

View File

@ -75,11 +75,15 @@ cmDspRC_t _cmDspSysPgm_TimeLineLite(cmDspSysH_t h, void** userPtrPtr )
cmDspInst_t* mfp = cmDspSysAllocInst(h,"MidiFilePlay",NULL, 0 );
cmDspInst_t* nmp = cmDspSysAllocInst(h,"NanoMap", NULL, 0 );
cmDspInst_t* pic = cmDspSysAllocInst(h,"Picadae", NULL, 0 );
//cmDspInst_t* mop = cmDspSysAllocInst(h,"MidiOut", NULL, 2, "Scarlett 18i20 USB","Scarlett 18i20 USB MIDI 1");
cmDspInst_t* mdly_st = cmDspSysAllocInst(h,"MsgDelay", NULL, 2, 1024, 500.0 );
cmDspInst_t* mdly_d0 = cmDspSysAllocInst(h,"MsgDelay", NULL, 2, 1024, 500.0 );
cmDspInst_t* mdly_d1 = cmDspSysAllocInst(h,"MsgDelay", NULL, 2, 1024, 500.0 );
//cmDspInst_t* pic = cmDspSysAllocInst(h,"Picadae", NULL, 0 );
cmDspInst_t* mop = cmDspSysAllocInst(h,"MidiOut", NULL, 2, "Fastlane","Fastlane MIDI A" );
//cmDspInst_t* mo2p = cmDspSysAllocInst(h,"MidiOut", NULL, 2, "picadae","picadae MIDI 1");
cmDspInst_t* mo2p = cmDspSysAllocInst(h,"MidiOut", NULL, 2, "Fastlane","Fastlane MIDI B");
cmDspInst_t* mo2p = cmDspSysAllocInst(h,"MidiOut", NULL, 2, "Scarlett 18i20 USB","Scarlett 18i20 USB MIDI 1");
//cmDspInst_t* mo2p = cmDspSysAllocInst(h,"MidiOut", NULL, 2, "Fastlane","Fastlane MIDI A");
cmDspInst_t* sfp = cmDspSysAllocInst(h,"ScFol", NULL, 5, r.scFn, sfBufCnt, sfMaxWndCnt, sfMinVel, sfEnaMeasFl );
cmDspInst_t* amp = cmDspSysAllocInst(h,"ActiveMeas", NULL, 1, 100 );
cmDspInst_t* modp = cmDspSysAllocInst(h,"ScMod", NULL, 2, r.modFn, "m1" );
@ -102,7 +106,7 @@ cmDspRC_t _cmDspSysPgm_TimeLineLite(cmDspSysH_t h, void** userPtrPtr )
cmDspInst_t* ao3 = cmDspSysAllocInst(h,"AudioOut", NULL, 1, baseAudioOutCh+1 ); // 3 2
cmDspSysNewPage(h,"Main");
cmDspInst_t* notesOffb= cmDspSysAllocInst(h,"Button", "notesOff", 2, kButtonDuiId, 1.0 );
//cmDspInst_t* notesOffb= cmDspSysAllocInst(h,"Button", "notesOff", 2, kButtonDuiId, 1.0 );
cmDspInst_t* onb = cmDspSysAllocInst(h,"Button", "start", 2, kButtonDuiId, 1.0 );
cmDspInst_t* offb = cmDspSysAllocInst(h,"Button", "stop", 2, kButtonDuiId, 1.0 );
cmDspInst_t* mod_sel = cmDspSysAllocMsgList(h, NULL, "mod_sel", 1 );
@ -135,6 +139,11 @@ cmDspRC_t _cmDspSysPgm_TimeLineLite(cmDspSysH_t h, void** userPtrPtr )
cmDspInst_t* mi0p = cmDspSysAllocInst(h,"AMeter","In 0", 0);
cmDspInst_t* mi1p = cmDspSysAllocInst(h,"AMeter","In 1", 0);
cmDspInst_t* msgDly = cmDspSysAllocInst(h,"Scalar", "Delay", 5, kNumberDuiId, 1.0, 1000.0,1.0, 500.0 );
cmDspSysInstallCb( h, msgDly, "val", mdly_st, "delay", NULL);
cmDspSysInstallCb( h, msgDly, "val", mdly_d0, "delay", NULL);
cmDspSysInstallCb( h, msgDly, "val", mdly_d1, "delay", NULL);
cmDspInst_t* meas = cmDspSysAllocInst(h,"Scalar", "Meas", 5, kNumberDuiId, 1.0, 59.0,1.0, 1.0 );
cmDspSysInstallCb( h, meas, "val", scp, "meas", NULL);
cmDspSysInstallCb( h, meas, "val", tlp, "meas", NULL);
@ -241,7 +250,7 @@ cmDspRC_t _cmDspSysPgm_TimeLineLite(cmDspSysH_t h, void** userPtrPtr )
cmDspSysInstallCb(h, prePath, "out", tlp, "path", NULL );
cmDspSysInstallCb(h, notesOffb, "sym", pic, "alloff", NULL );
//cmDspSysInstallCb(h, notesOffb, "sym", pic, "alloff", NULL );
// start connections
cmDspSysInstallCb(h, onb, "sym", tlRt, "s-in", NULL );
@ -265,6 +274,9 @@ cmDspRC_t _cmDspSysPgm_TimeLineLite(cmDspSysH_t h, void** userPtrPtr )
cmDspSysInstallCb(h, pts, "off", modp,"cmd", NULL );
cmDspSysInstallCb(h, offb, "sym", mop, "reset", NULL );
cmDspSysInstallCb(h, offb, "sym", mo2p,"reset", NULL );
cmDspSysInstallCb(h, offb, "sym", mdly_st,"clear", NULL );
cmDspSysInstallCb(h, offb, "sym", mdly_d0,"clear", NULL );
cmDspSysInstallCb(h, offb, "sym", mdly_d1,"clear", NULL );
// time-line to MIDI file player selection
@ -286,20 +298,27 @@ cmDspRC_t _cmDspSysPgm_TimeLineLite(cmDspSysH_t h, void** userPtrPtr )
cmDspSysInstallCb(h, msrc, "d1", sfp, "d1", NULL );
cmDspSysInstallCb(h, msrc, "d1", nmp, "d1", NULL );
cmDspSysInstallCb(h, nmp, "d1", mop, "d1", NULL );
cmDspSysInstallCb(h, nmp, "d1", pic, "d1", NULL );
cmDspSysInstallCb(h, pic, "d1", mo2p, "d1", NULL );
//cmDspSysInstallCb(h, nmp, "d1", mdly_d1, "in", NULL );
//cmDspSysInstallCb(h, mdly_d1, "out", mo2p, "d1", NULL );
//cmDspSysInstallCb(h, pic, "d1", mo2p, "d1", NULL );
cmDspSysInstallCb(h, nmp, "d1", mo2p, "d1", NULL );
cmDspSysInstallCb(h, msrc, "d0", sfp, "d0", NULL );
cmDspSysInstallCb(h, msrc, "d0", nmp, "d0", NULL );
cmDspSysInstallCb(h, nmp, "d0", mop, "d0", NULL );
cmDspSysInstallCb(h, nmp, "d0", pic, "d0", NULL );
cmDspSysInstallCb(h, pic, "d0", mo2p, "d0", NULL );
//cmDspSysInstallCb(h, nmp, "d0", mdly_d0, "in", NULL );
//cmDspSysInstallCb(h, mdly_d0, "out", mo2p, "d0", NULL );
//cmDspSysInstallCb(h, pic, "d0", mo2p, "d0", NULL );
cmDspSysInstallCb(h, nmp, "d0", mo2p, "d0", NULL );
cmDspSysInstallCb(h, msrc, "status", sfp, "status",NULL );
cmDspSysInstallCb(h, msrc, "status", nmp, "status",NULL );
cmDspSysInstallCb(h, nmp, "status", mop, "status",NULL );
cmDspSysInstallCb(h, nmp, "status", pic, "status",NULL );
cmDspSysInstallCb(h, pic, "status", mo2p, "status", NULL );
//cmDspSysInstallCb(h, nmp, "status", mdly_st, "in", NULL );
//cmDspSysInstallCb(h, mdly_st, "out", mo2p, "status", NULL );
cmDspSysInstallCb(h, nmp, "status", mo2p, "status", NULL );
//cmDspSysInstallCb(h, pic, "status", mo2p, "status", NULL );
// score follower to recd_play,modulator and printers

View File

@ -414,7 +414,7 @@ void VECT_OP_FUNC(GaussCovariance)(VECT_OP_TYPE* yM, unsigned D, const VECT_OP_
void VECT_OP_FUNC(GaussCovariance2)(VECT_OP_TYPE* yM, unsigned D, const VECT_OP_TYPE* (*srcFunc)(void* userPtr, unsigned idx), unsigned xN, void* userPtr, const VECT_OP_TYPE* uV, const unsigned* selIdxV, unsigned selKey )
{
unsigned i,j,k = 0,n;
unsigned i,j,k = 0,n=0;
VECT_OP_TYPE tV[ D ];
const VECT_OP_TYPE* sp;