cmDspKr.h/c cmDspBuiltIn.c, cmDspPgmKr.c : Added 'NanoMap' DSP object.
This commit is contained in:
parent
341bde7a7c
commit
edad3b99cd
@ -1203,8 +1203,8 @@ cmDspRC_t _cmDspMidiOutRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
|
|||||||
|
|
||||||
for(i=0; i<kMidiChCnt; ++i)
|
for(i=0; i<kMidiChCnt; ++i)
|
||||||
{
|
{
|
||||||
cmMpDeviceSend(p->devIdx,p->portIdx,kCtlMdId,121,0); // reset all controllers
|
cmMpDeviceSend(p->devIdx,p->portIdx,kCtlMdId+i,121,0); // reset all controllers
|
||||||
cmMpDeviceSend(p->devIdx,p->portIdx,kCtlMdId,123,0); // turn all notes off
|
cmMpDeviceSend(p->devIdx,p->portIdx,kCtlMdId+i,123,0); // turn all notes off
|
||||||
cmSleepMs(15);
|
cmSleepMs(15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5411,6 +5411,7 @@ cmDspClassConsFunc_t _cmDspClassBuiltInArray[] =
|
|||||||
cmScaleRangeClassCons,
|
cmScaleRangeClassCons,
|
||||||
cmActiveMeasClassCons,
|
cmActiveMeasClassCons,
|
||||||
cmAmSyncClassCons,
|
cmAmSyncClassCons,
|
||||||
|
cmNanoMapClassCons,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
119
dsp/cmDspKr.c
119
dsp/cmDspKr.c
@ -2123,3 +2123,122 @@ struct cmDspClass_str* cmAmSyncClassCons( cmDspCtx_t* ctx )
|
|||||||
return &_cmAmSyncDC;
|
return &_cmAmSyncDC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================================================================================
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
kPgmNmId,
|
||||||
|
kStatusNmId,
|
||||||
|
kD0NmId,
|
||||||
|
kD1NmId,
|
||||||
|
kThruNmId
|
||||||
|
};
|
||||||
|
|
||||||
|
cmDspClass_t _cmNanoMapDC;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
cmDspInst_t inst;
|
||||||
|
} cmDspNanoMap_t;
|
||||||
|
|
||||||
|
cmDspRC_t _cmDspNanoMapSend( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned st, unsigned d0, unsigned d1 )
|
||||||
|
{
|
||||||
|
cmDspSetUInt(ctx,inst,kD1NmId,d1);
|
||||||
|
cmDspSetUInt(ctx,inst,kD0NmId,d0);
|
||||||
|
cmDspSetUInt(ctx,inst,kStatusNmId,st);
|
||||||
|
return kOkDspRC;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _cmDspNanoMapPgm( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned pgm )
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for(i=0; i<kMidiChCnt; ++i)
|
||||||
|
{
|
||||||
|
_cmDspNanoMapSend(ctx,inst,kCtlMdId+i,121,0); // reset all controllers
|
||||||
|
_cmDspNanoMapSend(ctx,inst,kCtlMdId+i,123,0); // turn all notes off
|
||||||
|
_cmDspNanoMapSend(ctx,inst,kCtlMdId+i,0,0); // switch to bank 0
|
||||||
|
_cmDspNanoMapSend(ctx,inst,kPgmMdId+i,pgm,0); // send pgm change
|
||||||
|
cmSleepMs(15);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
cmDspInst_t* _cmDspNanoMapAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
|
||||||
|
{
|
||||||
|
cmDspVarArg_t args[] =
|
||||||
|
{
|
||||||
|
{ "pgm", kPgmNmId, 0, 0, kInDsvFl | kUIntDsvFl | kOptArgDsvFl, "Reprogram all channels to this pgm." },
|
||||||
|
{ "status", kStatusNmId, 0, 0, kOutDsvFl | kInDsvFl | kUIntDsvFl | kOptArgDsvFl, "MIDI status" },
|
||||||
|
{ "d0", kD0NmId, 0, 0, kOutDsvFl | kInDsvFl | kUIntDsvFl | kOptArgDsvFl, "MIDI channel message d0" },
|
||||||
|
{ "d1", kD1NmId, 0, 0, kOutDsvFl | kInDsvFl | kUIntDsvFl | kOptArgDsvFl, "MIDI channel message d1" },
|
||||||
|
{ "thru", kThruNmId, 0, 0, kInDsvFl | kBoolDsvFl | kOptArgDsvFl, "Enable pass through."},
|
||||||
|
{ NULL, 0, 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
cmDspNanoMap_t* p = cmDspInstAlloc(cmDspNanoMap_t,ctx,classPtr,args,instSymId,id,storeSymId,va_cnt,vl);
|
||||||
|
|
||||||
|
cmDspSetDefaultUInt(ctx,&p->inst, kPgmNmId, 0, 0 );
|
||||||
|
|
||||||
|
return &p->inst;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmDspRC_t _cmDspNanoMapReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
|
||||||
|
{
|
||||||
|
cmDspRC_t rc = kOkDspRC;
|
||||||
|
|
||||||
|
cmDspApplyAllDefaults(ctx,inst);
|
||||||
|
|
||||||
|
_cmDspNanoMapPgm(ctx,inst,cmDspUInt(inst,kPgmNmId));
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmDspRC_t _cmDspNanoMapRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
|
||||||
|
{
|
||||||
|
//cmDspNanoMap_t* p = (cmDspNanoMap_t*)inst;
|
||||||
|
|
||||||
|
switch( evt->dstVarId )
|
||||||
|
{
|
||||||
|
case kPgmNmId:
|
||||||
|
cmDspSetEvent(ctx,inst,evt);
|
||||||
|
_cmDspNanoMapPgm(ctx,inst,cmDspUInt(inst,kPgmNmId));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kStatusNmId:
|
||||||
|
{
|
||||||
|
unsigned status = cmDsvGetUInt(evt->valuePtr);
|
||||||
|
if( (status & 0xf0) == kNoteOnMdId )
|
||||||
|
{
|
||||||
|
unsigned d0 = cmDspUInt(inst,kD0NmId);
|
||||||
|
unsigned ch = d0 % 8;
|
||||||
|
status = (status & 0xf0) + ch;
|
||||||
|
cmDspSetUInt(ctx,inst,kStatusNmId,status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
cmDspSetEvent(ctx,inst,evt);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return kOkDspRC;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct cmDspClass_str* cmNanoMapClassCons( cmDspCtx_t* ctx )
|
||||||
|
{
|
||||||
|
cmDspClassSetup(&_cmNanoMapDC,ctx,"NanoMap",
|
||||||
|
NULL,
|
||||||
|
_cmDspNanoMapAlloc,
|
||||||
|
NULL,
|
||||||
|
_cmDspNanoMapReset,
|
||||||
|
NULL,
|
||||||
|
_cmDspNanoMapRecv,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
"Nanosynth Mapper");
|
||||||
|
|
||||||
|
return &_cmNanoMapDC;
|
||||||
|
}
|
||||||
|
@ -15,6 +15,7 @@ extern "C" {
|
|||||||
struct cmDspClass_str* cmScaleRangeClassCons( cmDspCtx_t* ctx );
|
struct cmDspClass_str* cmScaleRangeClassCons( cmDspCtx_t* ctx );
|
||||||
struct cmDspClass_str* cmActiveMeasClassCons( cmDspCtx_t* ctx );
|
struct cmDspClass_str* cmActiveMeasClassCons( cmDspCtx_t* ctx );
|
||||||
struct cmDspClass_str* cmAmSyncClassCons( cmDspCtx_t* ctx );
|
struct cmDspClass_str* cmAmSyncClassCons( cmDspCtx_t* ctx );
|
||||||
|
struct cmDspClass_str* cmNanoMapClassCons( cmDspCtx_t* ctx );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,7 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
|
|||||||
cmDspInst_t* pts = cmDspSysAllocInst(h,"PortToSym", NULL, 2, "on", "off" );
|
cmDspInst_t* pts = cmDspSysAllocInst(h,"PortToSym", NULL, 2, "on", "off" );
|
||||||
cmDspInst_t* mip = cmDspSysAllocInst(h,"MidiIn", NULL, 0 );
|
cmDspInst_t* mip = cmDspSysAllocInst(h,"MidiIn", NULL, 0 );
|
||||||
cmDspInst_t* mfp = cmDspSysAllocInst(h,"MidiFilePlay",NULL, 0 );
|
cmDspInst_t* mfp = cmDspSysAllocInst(h,"MidiFilePlay",NULL, 0 );
|
||||||
|
cmDspInst_t* nmp = cmDspSysAllocInst(h,"NanoMap", NULL, 0 );
|
||||||
cmDspInst_t* mop = cmDspSysAllocInst(h,"MidiOut", NULL, 2, r.midiDevice,r.midiOutPort);
|
cmDspInst_t* mop = cmDspSysAllocInst(h,"MidiOut", NULL, 2, r.midiDevice,r.midiOutPort);
|
||||||
cmDspInst_t* sfp = cmDspSysAllocInst(h,"ScFol", NULL, 1, r.scFn );
|
cmDspInst_t* sfp = cmDspSysAllocInst(h,"ScFol", NULL, 1, r.scFn );
|
||||||
cmDspInst_t* amp = cmDspSysAllocInst(h,"ActiveMeas", NULL, 1, 100 );
|
cmDspInst_t* amp = cmDspSysAllocInst(h,"ActiveMeas", NULL, 1, 100 );
|
||||||
@ -466,15 +467,18 @@ cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
|
|||||||
|
|
||||||
cmDspSysInstallCb(h, mfp, "d1", d1Rt, "f-in", NULL );
|
cmDspSysInstallCb(h, mfp, "d1", d1Rt, "f-in", NULL );
|
||||||
cmDspSysInstallCb(h, d1Rt, "f-out-0", sfp, "d1", NULL );
|
cmDspSysInstallCb(h, d1Rt, "f-out-0", sfp, "d1", NULL );
|
||||||
cmDspSysInstallCb(h, d1Rt, "f-out-1", mop, "d1", NULL );
|
cmDspSysInstallCb(h, d1Rt, "f-out-1", nmp, "d1", NULL );
|
||||||
|
cmDspSysInstallCb(h, nmp, "d1", mop, "d1", NULL );
|
||||||
|
|
||||||
cmDspSysInstallCb(h, mfp, "d0", d0Rt, "f-in", NULL );
|
cmDspSysInstallCb(h, mfp, "d0", d0Rt, "f-in", NULL );
|
||||||
cmDspSysInstallCb(h, d0Rt, "f-out-0", sfp, "d0", NULL );
|
cmDspSysInstallCb(h, d0Rt, "f-out-0", sfp, "d0", NULL );
|
||||||
cmDspSysInstallCb(h, d0Rt, "f-out-1", mop, "d0", NULL );
|
cmDspSysInstallCb(h, d0Rt, "f-out-1", nmp, "d0", NULL );
|
||||||
|
cmDspSysInstallCb(h, nmp, "d0", mop, "d0", NULL );
|
||||||
|
|
||||||
cmDspSysInstallCb(h, mfp, "status", stRt, "f-in", NULL );
|
cmDspSysInstallCb(h, mfp, "status", stRt, "f-in", NULL );
|
||||||
cmDspSysInstallCb(h, stRt, "f-out-0", sfp, "status",NULL );
|
cmDspSysInstallCb(h, stRt, "f-out-0", sfp, "status",NULL );
|
||||||
cmDspSysInstallCb(h, stRt, "f-out-1", mop, "status",NULL );
|
cmDspSysInstallCb(h, stRt, "f-out-1", nmp, "status",NULL );
|
||||||
|
cmDspSysInstallCb(h, nmp, "status", mop, "status",NULL );
|
||||||
|
|
||||||
// MIDI input port
|
// MIDI input port
|
||||||
cmDspSysInstallCb(h, mip, "smpidx", sfp, "smpidx", NULL );
|
cmDspSysInstallCb(h, mip, "smpidx", sfp, "smpidx", NULL );
|
||||||
|
Loading…
Reference in New Issue
Block a user