MSM5232: more options
This commit is contained in:
parent
76f0cceb55
commit
7b55ba4e77
6 changed files with 290 additions and 91 deletions
|
|
@ -63,7 +63,7 @@ void DivPlatformMSM5232::acquire(short* bufL, short* bufR, size_t start, size_t
|
|||
//printf("tempL: %d tempR: %d\n",tempL,tempR);
|
||||
bufL[h]=0;
|
||||
for (int i=0; i<8; i++) {
|
||||
bufL[h]+=temp[i];
|
||||
bufL[h]+=(temp[i]*partVolume[i])>>8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -79,6 +79,9 @@ const int decayMap[16]={
|
|||
void DivPlatformMSM5232::tick(bool sysTick) {
|
||||
for (int i=0; i<8; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
chan[i].outVol=VOL_SCALE_LINEAR(chan[i].vol&127,MIN(127,chan[i].std.vol.val),127);
|
||||
}
|
||||
if (chan[i].std.arp.had) {
|
||||
if (!chan[i].inPorta) {
|
||||
chan[i].baseFreq=NOTE_LINEAR(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||
|
|
@ -86,18 +89,39 @@ void DivPlatformMSM5232::tick(bool sysTick) {
|
|||
chan[i].freqChanged=true;
|
||||
}
|
||||
if (chan[i].std.duty.had) {
|
||||
rWrite(12+(i>>2),chan[i].std.duty.val);
|
||||
groupControl[i>>2]=(chan[i].std.duty.val&0x1f)|(groupEnv[i>>2]?0x20:0);
|
||||
updateGroup[i>>2]=true;
|
||||
}
|
||||
if (chan[i].std.ex1.had) { // attack
|
||||
rWrite(8+(i>>2),attackMap[chan[i].std.ex1.val&7]);
|
||||
groupAR[i>>2]=attackMap[chan[i].std.ex1.val&7];
|
||||
updateGroupAR[i>>2]=true;
|
||||
}
|
||||
if (chan[i].std.ex2.had) { // decay
|
||||
rWrite(10+(i>>2),decayMap[chan[i].std.ex2.val&15]);
|
||||
groupDR[i>>2]=decayMap[chan[i].std.ex2.val&15];
|
||||
updateGroupDR[i>>2]=true;
|
||||
}
|
||||
if (chan[i].std.ex3.had) { // noise
|
||||
chan[i].noise=chan[i].std.ex3.val;
|
||||
chan[i].freqChanged=true;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<2; i++) {
|
||||
if (updateGroup[i]) {
|
||||
rWrite(12+i,groupControl[i]);
|
||||
updateGroup[i]=false;
|
||||
}
|
||||
if (updateGroupAR[i]) {
|
||||
rWrite(8+i,groupAR[i]);
|
||||
updateGroupAR[i]=false;
|
||||
}
|
||||
if (updateGroupDR[i]) {
|
||||
rWrite(10+i,groupDR[i]);
|
||||
updateGroupDR[i]=false;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<8; i++) {
|
||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_PCE);
|
||||
chan[i].freq=chan[i].baseFreq+chan[i].pitch+chan[i].pitch2-(12<<7);
|
||||
|
|
@ -118,6 +142,17 @@ void DivPlatformMSM5232::tick(bool sysTick) {
|
|||
chan[i].freqChanged=false;
|
||||
}
|
||||
}
|
||||
|
||||
msm->set_vol_input(
|
||||
chan[0].active?((double)chan[0].outVol/127.0):0.0,
|
||||
chan[1].active?((double)chan[1].outVol/127.0):0.0,
|
||||
chan[2].active?((double)chan[2].outVol/127.0):0.0,
|
||||
chan[3].active?((double)chan[3].outVol/127.0):0.0,
|
||||
chan[4].active?((double)chan[4].outVol/127.0):0.0,
|
||||
chan[5].active?((double)chan[5].outVol/127.0):0.0,
|
||||
chan[6].active?((double)chan[6].outVol/127.0):0.0,
|
||||
chan[7].active?((double)chan[7].outVol/127.0):0.0
|
||||
);
|
||||
}
|
||||
|
||||
int DivPlatformMSM5232::dispatch(DivCommand c) {
|
||||
|
|
@ -158,9 +193,6 @@ int DivPlatformMSM5232::dispatch(DivCommand c) {
|
|||
chan[c.chan].vol=c.value;
|
||||
if (!chan[c.chan].std.vol.has) {
|
||||
chan[c.chan].outVol=c.value;
|
||||
if (chan[c.chan].active) {
|
||||
//chWrite(c.chan,0x04,0x80|chan[c.chan].outVol);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -199,6 +231,7 @@ int DivPlatformMSM5232::dispatch(DivCommand c) {
|
|||
}
|
||||
case DIV_CMD_STD_NOISE_MODE:
|
||||
chan[c.chan].noise=c.value;
|
||||
chan[c.chan].freqChanged=true;
|
||||
break;
|
||||
case DIV_CMD_LEGATO:
|
||||
chan[c.chan].baseFreq=NOTE_LINEAR(c.value+((chan[c.chan].std.arp.will && !chan[c.chan].std.arp.mode)?(chan[c.chan].std.arp.val):(0)));
|
||||
|
|
@ -213,7 +246,7 @@ int DivPlatformMSM5232::dispatch(DivCommand c) {
|
|||
chan[c.chan].inPorta=c.value;
|
||||
break;
|
||||
case DIV_CMD_GET_VOLMAX:
|
||||
return 1;
|
||||
return 127;
|
||||
break;
|
||||
case DIV_ALWAYS_SET_VOLUME:
|
||||
return 1;
|
||||
|
|
@ -234,6 +267,11 @@ void DivPlatformMSM5232::forceIns() {
|
|||
chan[i].insChanged=true;
|
||||
chan[i].freqChanged=true;
|
||||
}
|
||||
for (int i=0; i<2; i++) {
|
||||
updateGroup[i]=true;
|
||||
updateGroupAR[i]=true;
|
||||
updateGroupDR[i]=true;
|
||||
}
|
||||
}
|
||||
|
||||
void* DivPlatformMSM5232::getChanState(int ch) {
|
||||
|
|
@ -272,15 +310,20 @@ void DivPlatformMSM5232::reset() {
|
|||
cycles=0;
|
||||
curChan=-1;
|
||||
delay=500;
|
||||
rWrite(8,0);
|
||||
rWrite(9,0);
|
||||
rWrite(10,5);
|
||||
rWrite(11,5);
|
||||
rWrite(12,0x2f);
|
||||
rWrite(13,0x2f);
|
||||
|
||||
for (int i=0; i<2; i++) {
|
||||
groupControl[i]=15|(groupEnv[i]?0x20:0);
|
||||
groupAR[i]=0;
|
||||
groupDR[i]=5;
|
||||
|
||||
updateGroup[i]=true;
|
||||
updateGroupAR[i]=true;
|
||||
updateGroupDR[i]=true;
|
||||
}
|
||||
|
||||
for (int i=0; i<8; i++) {
|
||||
rWrite(i,0);
|
||||
partVolume[i]=initPartVolume[i];
|
||||
msm->mute(i,isMuted[i]);
|
||||
}
|
||||
}
|
||||
|
|
@ -307,6 +350,37 @@ void DivPlatformMSM5232::setFlags(const DivConfig& flags) {
|
|||
for (int i=0; i<8; i++) {
|
||||
oscBuf[i]->rate=rate;
|
||||
}
|
||||
initPartVolume[0]=flags.getInt("partVolume0",255);
|
||||
initPartVolume[1]=flags.getInt("partVolume1",255);
|
||||
initPartVolume[2]=flags.getInt("partVolume2",255);
|
||||
initPartVolume[3]=flags.getInt("partVolume3",255);
|
||||
initPartVolume[4]=flags.getInt("partVolume4",255);
|
||||
initPartVolume[5]=flags.getInt("partVolume5",255);
|
||||
initPartVolume[6]=flags.getInt("partVolume6",255);
|
||||
initPartVolume[7]=flags.getInt("partVolume7",255);
|
||||
|
||||
capacitance[0]=flags.getFloat("capValue0",390.0f);
|
||||
capacitance[1]=flags.getFloat("capValue1",390.0f);
|
||||
capacitance[2]=flags.getFloat("capValue2",390.0f);
|
||||
capacitance[3]=flags.getFloat("capValue3",390.0f);
|
||||
capacitance[4]=flags.getFloat("capValue4",390.0f);
|
||||
capacitance[5]=flags.getFloat("capValue5",390.0f);
|
||||
capacitance[6]=flags.getFloat("capValue6",390.0f);
|
||||
capacitance[7]=flags.getFloat("capValue7",390.0f);
|
||||
|
||||
groupEnv[0]=flags.getBool("groupEnv0",true);
|
||||
groupEnv[1]=flags.getBool("groupEnv1",true);
|
||||
|
||||
msm->set_capacitors(
|
||||
capacitance[0]*0.000000001,
|
||||
capacitance[1]*0.000000001,
|
||||
capacitance[2]*0.000000001,
|
||||
capacitance[3]*0.000000001,
|
||||
capacitance[4]*0.000000001,
|
||||
capacitance[5]*0.000000001,
|
||||
capacitance[6]*0.000000001,
|
||||
capacitance[7]*0.000000001
|
||||
);
|
||||
}
|
||||
|
||||
void DivPlatformMSM5232::poke(unsigned int addr, unsigned short val) {
|
||||
|
|
@ -326,7 +400,6 @@ int DivPlatformMSM5232::init(DivEngine* p, int channels, int sugRate, const DivC
|
|||
oscBuf[i]=new DivDispatchOscBuffer;
|
||||
}
|
||||
msm=new msm5232_device(2119040);
|
||||
msm->set_capacitors(0.39e-6,0.39e-6,0.39e-6,0.39e-6,0.39e-6,0.39e-6,0.39e-6,0.39e-6);
|
||||
msm->device_start();
|
||||
setFlags(flags);
|
||||
reset();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue