2022-05-24 00:01:10 +00:00
|
|
|
/**
|
|
|
|
* Furnace Tracker - multi-system chiptune tracker
|
2023-01-20 00:18:40 +00:00
|
|
|
* Copyright (C) 2021-2023 tildearrow and contributors
|
2022-05-24 00:01:10 +00:00
|
|
|
*
|
|
|
|
* This program 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 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* 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, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "msm6258.h"
|
|
|
|
#include "../engine.h"
|
|
|
|
#include "../../ta-log.h"
|
|
|
|
#include "sound/oki/okim6258.h"
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
2023-07-13 09:09:20 +00:00
|
|
|
#define rWrite(a,v) if (!skipRegisterWrites) {writes.push(QueuedWrite(a,v)); if (dumpWrites) {addWrite(a,v);} }
|
2022-05-24 00:01:10 +00:00
|
|
|
|
|
|
|
const char** DivPlatformMSM6258::getRegisterSheet() {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2023-01-02 09:53:37 +00:00
|
|
|
void DivPlatformMSM6258::acquire(short** buf, size_t len) {
|
2022-06-04 22:51:59 +00:00
|
|
|
short* outs[2]={
|
|
|
|
&msmOut,
|
|
|
|
NULL
|
|
|
|
};
|
2023-01-03 06:09:46 +00:00
|
|
|
for (size_t h=0; h<len; h++) {
|
2022-06-04 22:51:59 +00:00
|
|
|
if (--msmClockCount<0) {
|
|
|
|
if (--msmDividerCount<=0) {
|
|
|
|
if (!writes.empty()) {
|
|
|
|
QueuedWrite& w=writes.front();
|
|
|
|
switch (w.addr) {
|
|
|
|
case 0:
|
|
|
|
msm->ctrl_w(w.val);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
msmPan=w.val;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
msmClock=w.val;
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
msmDivider=4-(w.val&3);
|
|
|
|
if (msmDivider<2) msmDivider=2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
writes.pop();
|
|
|
|
}
|
2022-05-24 05:24:52 +00:00
|
|
|
|
2022-06-04 22:51:59 +00:00
|
|
|
if (sample>=0 && sample<parent->song.sampleLen) {
|
|
|
|
DivSample* s=parent->getSample(sample);
|
|
|
|
unsigned char nextData=(s->dataVOX[samplePos]>>4)|(s->dataVOX[samplePos]<<4);
|
|
|
|
if (msm->data_w(nextData)) {
|
|
|
|
samplePos++;
|
|
|
|
if (samplePos>=(int)s->lengthVOX) {
|
|
|
|
sample=-1;
|
|
|
|
samplePos=0;
|
|
|
|
msm->ctrl_w(1);
|
|
|
|
}
|
|
|
|
}
|
2022-05-24 05:24:52 +00:00
|
|
|
}
|
2022-06-04 22:51:59 +00:00
|
|
|
|
|
|
|
msm->sound_stream_update(outs,1);
|
|
|
|
msmDividerCount=msmDivider;
|
2022-05-24 00:01:10 +00:00
|
|
|
}
|
2022-06-04 22:51:59 +00:00
|
|
|
msmClockCount=msmClock;
|
2022-05-24 00:01:10 +00:00
|
|
|
}
|
|
|
|
|
2022-05-24 05:24:52 +00:00
|
|
|
if (isMuted[0]) {
|
2023-01-02 09:53:37 +00:00
|
|
|
buf[0][h]=0;
|
|
|
|
buf[1][h]=0;
|
2022-06-04 22:58:19 +00:00
|
|
|
oscBuf[0]->data[oscBuf[0]->needle++]=0;
|
2022-06-04 22:51:59 +00:00
|
|
|
} else {
|
2023-01-02 09:53:37 +00:00
|
|
|
buf[0][h]=(msmPan&2)?msmOut:0;
|
|
|
|
buf[1][h]=(msmPan&1)?msmOut:0;
|
2023-06-16 22:30:11 +00:00
|
|
|
oscBuf[0]->data[oscBuf[0]->needle++]=msmPan?(msmOut>>1):0;
|
2022-05-24 05:24:52 +00:00
|
|
|
}
|
2022-05-24 00:01:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DivPlatformMSM6258::tick(bool sysTick) {
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
for (int i=0; i<1; i++) {
|
2022-09-24 00:28:30 +00:00
|
|
|
if (!parent->song.disableSampleMacro) {
|
|
|
|
chan[i].std.next();
|
|
|
|
if (chan[i].std.duty.had) {
|
|
|
|
if (rateSel!=(chan[i].std.duty.val&3)) {
|
|
|
|
rateSel=chan[i].std.duty.val&3;
|
|
|
|
rWrite(12,rateSel);
|
|
|
|
}
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
}
|
2022-09-24 00:28:30 +00:00
|
|
|
if (chan[i].std.panL.had) {
|
|
|
|
if (chan[i].pan!=(chan[i].std.panL.val&3)) {
|
|
|
|
chan[i].pan=chan[i].std.panL.val&3;
|
|
|
|
rWrite(2,chan[i].pan);
|
|
|
|
}
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
}
|
2022-09-24 00:28:30 +00:00
|
|
|
if (chan[i].std.ex1.had) {
|
|
|
|
if (clockSel!=(chan[i].std.ex1.val&1)) {
|
|
|
|
clockSel=chan[i].std.ex1.val&1;
|
|
|
|
rWrite(8,clockSel);
|
|
|
|
}
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
}
|
2022-09-24 00:28:30 +00:00
|
|
|
if (chan[i].std.phaseReset.had) {
|
|
|
|
if (chan[i].std.phaseReset.val && chan[i].active) {
|
|
|
|
chan[i].keyOn=true;
|
|
|
|
}
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (chan[i].keyOn || chan[i].keyOff) {
|
|
|
|
samplePos=0;
|
|
|
|
rWrite(0,1); // turn off
|
|
|
|
if (chan[i].active && !chan[i].keyOff) {
|
|
|
|
if (sample>=0 && sample<parent->song.sampleLen) {
|
|
|
|
rWrite(0,2);
|
|
|
|
} else {
|
|
|
|
sample=-1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
sample=-1;
|
|
|
|
}
|
|
|
|
chan[i].keyOn=false;
|
|
|
|
chan[i].keyOff=false;
|
|
|
|
}
|
|
|
|
}
|
2022-05-24 00:01:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int DivPlatformMSM6258::dispatch(DivCommand c) {
|
|
|
|
switch (c.cmd) {
|
|
|
|
case DIV_CMD_NOTE_ON: {
|
|
|
|
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_FM);
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
if (ins->type==DIV_INS_MSM6258 || ins->type==DIV_INS_AMIGA) {
|
2022-05-24 00:01:10 +00:00
|
|
|
chan[c.chan].furnacePCM=true;
|
|
|
|
} else {
|
|
|
|
chan[c.chan].furnacePCM=false;
|
|
|
|
}
|
|
|
|
if (skipRegisterWrites) break;
|
|
|
|
if (chan[c.chan].furnacePCM) {
|
|
|
|
chan[c.chan].macroInit(ins);
|
|
|
|
if (!chan[c.chan].std.vol.will) {
|
|
|
|
chan[c.chan].outVol=chan[c.chan].vol;
|
|
|
|
}
|
2022-12-29 08:12:00 +00:00
|
|
|
if (c.value!=DIV_NOTE_NULL) sample=ins->amiga.getSample(c.value);
|
2022-07-08 07:25:25 +00:00
|
|
|
samplePos=0;
|
2022-05-24 05:24:52 +00:00
|
|
|
if (sample>=0 && sample<parent->song.sampleLen) {
|
2022-05-24 00:01:10 +00:00
|
|
|
//DivSample* s=parent->getSample(chan[c.chan].sample);
|
|
|
|
if (c.value!=DIV_NOTE_NULL) {
|
|
|
|
chan[c.chan].note=c.value;
|
|
|
|
}
|
|
|
|
chan[c.chan].active=true;
|
|
|
|
chan[c.chan].keyOn=true;
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
chan[c.chan].sample=-1;
|
|
|
|
chan[c.chan].macroInit(NULL);
|
|
|
|
chan[c.chan].outVol=chan[c.chan].vol;
|
2022-10-04 05:46:16 +00:00
|
|
|
if ((12*sampleBank+c.value%12)<0 || (12*sampleBank+c.value%12)>=parent->song.sampleLen) {
|
2022-05-24 00:01:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
//DivSample* s=parent->getSample(12*sampleBank+c.value%12);
|
2022-05-24 05:24:52 +00:00
|
|
|
sample=12*sampleBank+c.value%12;
|
|
|
|
samplePos=0;
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
chan[c.chan].active=true;
|
|
|
|
chan[c.chan].keyOn=true;
|
2022-05-24 00:01:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_NOTE_OFF:
|
|
|
|
chan[c.chan].keyOff=true;
|
|
|
|
chan[c.chan].keyOn=false;
|
|
|
|
chan[c.chan].active=false;
|
|
|
|
chan[c.chan].macroInit(NULL);
|
|
|
|
break;
|
|
|
|
case DIV_CMD_NOTE_OFF_ENV:
|
|
|
|
chan[c.chan].keyOff=true;
|
|
|
|
chan[c.chan].keyOn=false;
|
|
|
|
chan[c.chan].active=false;
|
|
|
|
chan[c.chan].std.release();
|
|
|
|
break;
|
|
|
|
case DIV_CMD_ENV_RELEASE:
|
|
|
|
chan[c.chan].std.release();
|
|
|
|
break;
|
|
|
|
case DIV_CMD_VOLUME: {
|
|
|
|
chan[c.chan].vol=c.value;
|
|
|
|
if (!chan[c.chan].std.vol.has) {
|
|
|
|
chan[c.chan].outVol=c.value;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_GET_VOLUME: {
|
|
|
|
return chan[c.chan].vol;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_INSTRUMENT:
|
|
|
|
if (chan[c.chan].ins!=c.value || c.value2==1) {
|
|
|
|
chan[c.chan].insChanged=true;
|
|
|
|
}
|
|
|
|
chan[c.chan].ins=c.value;
|
|
|
|
break;
|
|
|
|
case DIV_CMD_PITCH: {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_NOTE_PORTA: {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
case DIV_CMD_SAMPLE_BANK:
|
|
|
|
sampleBank=c.value;
|
|
|
|
if (sampleBank>(parent->song.sample.size()/12)) {
|
|
|
|
sampleBank=parent->song.sample.size()/12;
|
|
|
|
}
|
|
|
|
break;
|
2022-06-04 22:51:59 +00:00
|
|
|
case DIV_CMD_SAMPLE_FREQ:
|
|
|
|
rateSel=c.value&3;
|
|
|
|
rWrite(12,rateSel);
|
|
|
|
break;
|
|
|
|
case DIV_CMD_SAMPLE_MODE:
|
|
|
|
clockSel=c.value&1;
|
|
|
|
rWrite(8,clockSel);
|
|
|
|
break;
|
2022-06-04 22:58:19 +00:00
|
|
|
case DIV_CMD_PANNING: {
|
|
|
|
if (c.value==0 && c.value2==0) {
|
|
|
|
chan[c.chan].pan=3;
|
|
|
|
} else {
|
|
|
|
chan[c.chan].pan=(c.value2>0)|((c.value>0)<<1);
|
|
|
|
}
|
|
|
|
rWrite(2,chan[c.chan].pan);
|
|
|
|
break;
|
|
|
|
}
|
2022-05-24 00:01:10 +00:00
|
|
|
case DIV_CMD_LEGATO: {
|
|
|
|
break;
|
|
|
|
}
|
2022-12-17 05:09:56 +00:00
|
|
|
case DIV_CMD_MACRO_OFF:
|
|
|
|
chan[c.chan].std.mask(c.value,true);
|
|
|
|
break;
|
|
|
|
case DIV_CMD_MACRO_ON:
|
|
|
|
chan[c.chan].std.mask(c.value,false);
|
|
|
|
break;
|
2022-05-24 00:01:10 +00:00
|
|
|
case DIV_ALWAYS_SET_VOLUME:
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case DIV_CMD_GET_VOLMAX:
|
|
|
|
return 8;
|
|
|
|
break;
|
|
|
|
case DIV_CMD_PRE_PORTA:
|
|
|
|
break;
|
|
|
|
case DIV_CMD_PRE_NOTE:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
//printf("WARNING: unimplemented command %d\n",c.cmd);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DivPlatformMSM6258::muteChannel(int ch, bool mute) {
|
|
|
|
isMuted[ch]=mute;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DivPlatformMSM6258::forceIns() {
|
|
|
|
while (!writes.empty()) writes.pop();
|
|
|
|
for (int i=0; i<1; i++) {
|
|
|
|
chan[i].insChanged=true;
|
|
|
|
}
|
2022-06-04 22:51:59 +00:00
|
|
|
rWrite(12,rateSel);
|
|
|
|
rWrite(8,clockSel);
|
2022-06-04 22:58:19 +00:00
|
|
|
rWrite(2,chan[0].pan);
|
2022-05-24 00:01:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void* DivPlatformMSM6258::getChanState(int ch) {
|
|
|
|
return &chan[ch];
|
|
|
|
}
|
|
|
|
|
2022-06-05 23:17:00 +00:00
|
|
|
DivMacroInt* DivPlatformMSM6258::getChanMacroInt(int ch) {
|
|
|
|
return &chan[ch].std;
|
|
|
|
}
|
|
|
|
|
2022-05-24 00:01:10 +00:00
|
|
|
DivDispatchOscBuffer* DivPlatformMSM6258::getOscBuffer(int ch) {
|
|
|
|
return oscBuf[ch];
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char* DivPlatformMSM6258::getRegisterPool() {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int DivPlatformMSM6258::getRegisterPoolSize() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DivPlatformMSM6258::poke(unsigned int addr, unsigned short val) {
|
|
|
|
//immWrite(addr,val);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DivPlatformMSM6258::poke(std::vector<DivRegWrite>& wlist) {
|
|
|
|
//for (DivRegWrite& i: wlist) immWrite(i.addr,i.val);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DivPlatformMSM6258::reset() {
|
|
|
|
while (!writes.empty()) writes.pop();
|
|
|
|
msm->device_reset();
|
2022-06-04 22:51:59 +00:00
|
|
|
msmClock=chipClock;
|
|
|
|
msmDivider=2;
|
|
|
|
msmDividerCount=0;
|
|
|
|
msmClock=0;
|
|
|
|
msmClockCount=0;
|
|
|
|
msmPan=3;
|
2022-06-04 22:58:19 +00:00
|
|
|
rateSel=2;
|
2022-06-04 22:51:59 +00:00
|
|
|
clockSel=0;
|
2022-05-24 00:01:10 +00:00
|
|
|
if (dumpWrites) {
|
|
|
|
addWrite(0xffffffff,0);
|
|
|
|
}
|
|
|
|
for (int i=0; i<1; i++) {
|
|
|
|
chan[i]=DivPlatformMSM6258::Channel();
|
|
|
|
chan[i].std.setEngine(parent);
|
|
|
|
}
|
|
|
|
for (int i=0; i<1; i++) {
|
|
|
|
chan[i].vol=8;
|
|
|
|
chan[i].outVol=8;
|
|
|
|
}
|
|
|
|
|
|
|
|
sampleBank=0;
|
2022-05-24 05:24:52 +00:00
|
|
|
sample=-1;
|
|
|
|
samplePos=0;
|
2022-05-24 00:01:10 +00:00
|
|
|
|
|
|
|
delay=0;
|
|
|
|
}
|
|
|
|
|
2023-01-02 00:46:08 +00:00
|
|
|
int DivPlatformMSM6258::getOutputCount() {
|
|
|
|
return 2;
|
2022-06-04 22:58:19 +00:00
|
|
|
}
|
|
|
|
|
2022-05-24 00:01:10 +00:00
|
|
|
bool DivPlatformMSM6258::keyOffAffectsArp(int ch) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DivPlatformMSM6258::notifyInsChange(int ins) {
|
|
|
|
for (int i=0; i<1; i++) {
|
|
|
|
if (chan[i].ins==ins) {
|
|
|
|
chan[i].insChanged=true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DivPlatformMSM6258::notifyInsDeletion(void* ins) {
|
2023-01-19 05:37:37 +00:00
|
|
|
for (int i=0; i<1; i++) {
|
|
|
|
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
|
|
|
}
|
2022-05-24 00:01:10 +00:00
|
|
|
}
|
|
|
|
|
2022-09-30 01:13:40 +00:00
|
|
|
void DivPlatformMSM6258::setFlags(const DivConfig& flags) {
|
|
|
|
switch (flags.getInt("clockSel",0)) {
|
2022-06-04 22:51:59 +00:00
|
|
|
case 3:
|
|
|
|
chipClock=8192000;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
chipClock=8000000;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
chipClock=4096000;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
chipClock=4000000;
|
|
|
|
break;
|
2022-05-24 00:01:10 +00:00
|
|
|
}
|
2022-12-04 07:04:42 +00:00
|
|
|
CHECK_CUSTOM_CLOCK;
|
2022-06-15 04:00:20 +00:00
|
|
|
rate=chipClock/256;
|
2022-05-24 00:01:10 +00:00
|
|
|
for (int i=0; i<1; i++) {
|
2022-06-04 22:51:59 +00:00
|
|
|
oscBuf[i]->rate=rate;
|
2022-05-24 00:01:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-30 01:13:40 +00:00
|
|
|
int DivPlatformMSM6258::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
|
2022-05-24 00:01:10 +00:00
|
|
|
parent=p;
|
|
|
|
dumpWrites=false;
|
|
|
|
skipRegisterWrites=false;
|
|
|
|
updateOsc=0;
|
|
|
|
for (int i=0; i<1; i++) {
|
|
|
|
isMuted[i]=false;
|
|
|
|
oscBuf[i]=new DivDispatchOscBuffer;
|
|
|
|
}
|
|
|
|
msm=new okim6258_device(4000000);
|
|
|
|
msm->device_start();
|
|
|
|
setFlags(flags);
|
|
|
|
reset();
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DivPlatformMSM6258::quit() {
|
|
|
|
for (int i=0; i<1; i++) {
|
|
|
|
delete oscBuf[i];
|
|
|
|
}
|
|
|
|
delete msm;
|
|
|
|
}
|
|
|
|
|
|
|
|
DivPlatformMSM6258::~DivPlatformMSM6258() {
|
|
|
|
}
|