cmDspBuiltIn.c : Addded 'reset' input to cmDspMidiOut to implement all-notes-off.

This commit is contained in:
kevin 2013-10-17 16:54:05 -07:00
parent 11b11347a0
commit f1123a8475

View File

@ -1092,7 +1092,8 @@ enum
kPortMoId,
kStatusMoId,
kD0MoId,
kD1MoId
kD1MoId,
kResetMoId
};
cmDspClass_t _cmMidiOutDC;
@ -1142,6 +1143,7 @@ cmDspInst_t* _cmDspMidiOutAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsign
{ "status", kStatusMoId, 0, 0, kInDsvFl | kUIntDsvFl, "MIDI status" },
{ "d0", kD0MoId, 0, 0, kInDsvFl | kUIntDsvFl, "MIDI channel message d0" },
{ "d1", kD1MoId, 0, 0, kInDsvFl | kUIntDsvFl, "MIDI channel message d1" },
{ "reset", kResetMoId, 0, 0, kInDsvFl | kTypeDsvMask,"All notes off" },
{ NULL, 0, 0, 0, 0 }
};
@ -1195,6 +1197,19 @@ cmDspRC_t _cmDspMidiOutRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
}
break;
case kResetMoId:
{
unsigned i;
for(i=0; i<kMidiChCnt; ++i)
{
cmMpDeviceSend(p->devIdx,p->portIdx,kCtlMdId,121,0); // reset all controllers
cmMpDeviceSend(p->devIdx,p->portIdx,kCtlMdId,123,0); // turn all notes off
cmSleepMs(15);
}
}
break;
default:
cmDspSetEvent(ctx,inst,evt);
break;