2022-02-15 03:12:20 +00:00
|
|
|
/**
|
|
|
|
* Furnace Tracker - multi-system chiptune tracker
|
|
|
|
* Copyright (C) 2021-2022 tildearrow and contributors
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2021-12-14 19:31:57 +00:00
|
|
|
#include "ym2610ext.h"
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
int DivPlatformYM2610Ext::dispatch(DivCommand c) {
|
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 (c.chan<extChanOffs) {
|
2021-12-14 19:31:57 +00:00
|
|
|
return DivPlatformYM2610::dispatch(c);
|
|
|
|
}
|
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 (c.chan>(extChanOffs+3)) {
|
2021-12-14 19:31:57 +00:00
|
|
|
c.chan-=3;
|
|
|
|
return DivPlatformYM2610::dispatch(c);
|
|
|
|
}
|
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
|
|
|
int ch=c.chan-extChanOffs;
|
2021-12-14 19:31:57 +00:00
|
|
|
int ordch=orderedOps[ch];
|
2022-06-28 06:16:46 +00:00
|
|
|
if (!extMode) {
|
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
|
|
|
c.chan=extChanOffs;
|
2022-06-28 06:16:46 +00:00
|
|
|
return DivPlatformYM2610::dispatch(c);
|
|
|
|
}
|
2021-12-14 19:31:57 +00:00
|
|
|
switch (c.cmd) {
|
|
|
|
case DIV_CMD_NOTE_ON: {
|
2022-04-21 07:24:06 +00:00
|
|
|
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
|
2022-12-21 22:55:38 +00:00
|
|
|
|
|
|
|
if (opChan[ch].insChanged) {
|
|
|
|
chan[extChanOffs].state.alg=ins->fm.alg;
|
|
|
|
chan[extChanOffs].state.fb=ins->fm.fb;
|
|
|
|
chan[extChanOffs].state.fms=ins->fm.fms;
|
|
|
|
chan[extChanOffs].state.ams=ins->fm.ams;
|
|
|
|
chan[extChanOffs].state.op[ordch]=ins->fm.op[ordch];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (noExtMacros) {
|
|
|
|
opChan[ch].macroInit(NULL);
|
|
|
|
} else {
|
|
|
|
opChan[ch].macroInit(ins);
|
|
|
|
}
|
|
|
|
if (!opChan[ch].std.vol.will) {
|
|
|
|
opChan[ch].outVol=opChan[ch].vol;
|
|
|
|
}
|
2021-12-14 19:31:57 +00:00
|
|
|
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[ordch];
|
2022-12-21 22:55:38 +00:00
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[ordch];
|
2022-02-03 21:17:30 +00:00
|
|
|
// TODO: how does this work?!
|
2021-12-18 08:25:42 +00:00
|
|
|
if (isOpMuted[ch]) {
|
|
|
|
rWrite(baseAddr+0x40,127);
|
2021-12-14 19:31:57 +00:00
|
|
|
} else {
|
|
|
|
if (opChan[ch].insChanged) {
|
2022-12-21 22:55:38 +00:00
|
|
|
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch].outVol&0x7f,127));
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (opChan[ch].insChanged) {
|
|
|
|
rWrite(baseAddr+0x30,(op.mult&15)|(dtTable[op.dt&7]<<4));
|
|
|
|
rWrite(baseAddr+0x50,(op.ar&31)|(op.rs<<6));
|
|
|
|
rWrite(baseAddr+0x60,(op.dr&31)|(op.am<<7));
|
|
|
|
rWrite(baseAddr+0x70,op.d2r&31);
|
|
|
|
rWrite(baseAddr+0x80,(op.rr&15)|(op.sl<<4));
|
|
|
|
rWrite(baseAddr+0x90,op.ssgEnv&15);
|
2022-09-12 05:51:09 +00:00
|
|
|
opChan[ch].mask=op.enable;
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
|
|
|
if (opChan[ch].insChanged) { // TODO how does this work?
|
2022-12-21 22:55:38 +00:00
|
|
|
rWrite(chanOffs[extChanOffs]+0xb0,(chan[extChanOffs].state.alg&7)|(chan[extChanOffs].state.fb<<3));
|
|
|
|
rWrite(chanOffs[extChanOffs]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
|
|
|
opChan[ch].insChanged=false;
|
|
|
|
|
2022-01-19 05:01:34 +00:00
|
|
|
if (c.value!=DIV_NOTE_NULL) {
|
2022-05-10 07:22:08 +00:00
|
|
|
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
2022-03-30 04:58:50 +00:00
|
|
|
opChan[ch].portaPause=false;
|
2022-12-21 22:55:38 +00:00
|
|
|
opChan[ch].note=c.value;
|
2022-01-19 05:01:34 +00:00
|
|
|
opChan[ch].freqChanged=true;
|
|
|
|
}
|
2021-12-14 19:31:57 +00:00
|
|
|
opChan[ch].keyOn=true;
|
|
|
|
opChan[ch].active=true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_NOTE_OFF:
|
|
|
|
opChan[ch].keyOff=true;
|
2022-02-21 02:39:14 +00:00
|
|
|
opChan[ch].keyOn=false;
|
2021-12-14 19:31:57 +00:00
|
|
|
opChan[ch].active=false;
|
|
|
|
break;
|
2022-12-21 22:55:38 +00:00
|
|
|
case DIV_CMD_NOTE_OFF_ENV:
|
|
|
|
if (noExtMacros) break;
|
|
|
|
opChan[ch].keyOff=true;
|
|
|
|
opChan[ch].keyOn=false;
|
|
|
|
opChan[ch].active=false;
|
|
|
|
opChan[ch].std.release();
|
|
|
|
break;
|
|
|
|
case DIV_CMD_ENV_RELEASE:
|
|
|
|
if (noExtMacros) break;
|
|
|
|
opChan[ch].std.release();
|
|
|
|
break;
|
2021-12-14 19:31:57 +00:00
|
|
|
case DIV_CMD_VOLUME: {
|
|
|
|
opChan[ch].vol=c.value;
|
2022-12-21 22:55:38 +00:00
|
|
|
if (!opChan[ch].std.vol.has) {
|
|
|
|
opChan[ch].outVol=c.value;
|
|
|
|
}
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[ordch];
|
2022-12-21 22:55:38 +00:00
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[ordch];
|
2021-12-18 08:25:42 +00:00
|
|
|
if (isOpMuted[ch]) {
|
|
|
|
rWrite(baseAddr+0x40,127);
|
2021-12-14 19:31:57 +00:00
|
|
|
} else {
|
2022-12-21 22:55:38 +00:00
|
|
|
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch].outVol&0x7f,127));
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_GET_VOLUME: {
|
|
|
|
return opChan[ch].vol;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_INSTRUMENT:
|
2022-01-17 23:01:40 +00:00
|
|
|
if (opChan[ch].ins!=c.value || c.value2==1) {
|
2021-12-14 19:31:57 +00:00
|
|
|
opChan[ch].insChanged=true;
|
|
|
|
}
|
|
|
|
opChan[ch].ins=c.value;
|
|
|
|
break;
|
|
|
|
case DIV_CMD_PANNING: {
|
2022-04-30 04:41:14 +00:00
|
|
|
if (c.value==0 && c.value2==0) {
|
2022-03-06 19:39:20 +00:00
|
|
|
opChan[ch].pan=3;
|
|
|
|
} else {
|
2022-04-30 04:41:14 +00:00
|
|
|
opChan[ch].pan=(c.value2>0)|((c.value>0)<<1);
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
2022-04-07 06:14:34 +00:00
|
|
|
if (parent->song.sharedExtStat) {
|
|
|
|
for (int i=0; i<4; i++) {
|
|
|
|
if (ch==i) continue;
|
|
|
|
opChan[i].pan=opChan[ch].pan;
|
|
|
|
}
|
|
|
|
}
|
2022-12-22 02:50:49 +00:00
|
|
|
rWrite(chanOffs[extChanOffs]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
|
2021-12-14 19:31:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_PITCH: {
|
|
|
|
opChan[ch].pitch=c.value;
|
|
|
|
opChan[ch].freqChanged=true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_NOTE_PORTA: {
|
2022-05-11 05:04:36 +00:00
|
|
|
if (parent->song.linearPitch==2) {
|
|
|
|
int destFreq=NOTE_FREQUENCY(c.value2);
|
|
|
|
bool return2=false;
|
|
|
|
if (destFreq>opChan[ch].baseFreq) {
|
|
|
|
opChan[ch].baseFreq+=c.value;
|
|
|
|
if (opChan[ch].baseFreq>=destFreq) {
|
|
|
|
opChan[ch].baseFreq=destFreq;
|
|
|
|
return2=true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
opChan[ch].baseFreq-=c.value;
|
|
|
|
if (opChan[ch].baseFreq<=destFreq) {
|
|
|
|
opChan[ch].baseFreq=destFreq;
|
|
|
|
return2=true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
opChan[ch].freqChanged=true;
|
|
|
|
if (return2) {
|
|
|
|
//opChan[ch].inPorta=false;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2022-05-23 04:47:41 +00:00
|
|
|
PLEASE_HELP_ME(opChan[ch]);
|
2021-12-14 19:31:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_LEGATO: {
|
2022-05-10 07:22:08 +00:00
|
|
|
opChan[ch].baseFreq=NOTE_FNUM_BLOCK(c.value,11);
|
2021-12-14 19:31:57 +00:00
|
|
|
opChan[ch].freqChanged=true;
|
|
|
|
break;
|
|
|
|
}
|
2022-06-28 06:16:46 +00:00
|
|
|
case DIV_CMD_FM_EXTCH: {
|
|
|
|
extMode=c.value;
|
|
|
|
immWrite(0x27,extMode?0x40:0);
|
|
|
|
break;
|
|
|
|
}
|
2022-03-30 05:09:53 +00:00
|
|
|
case DIV_CMD_FM_LFO: {
|
2022-12-22 02:50:49 +00:00
|
|
|
lfoValue=(c.value&7)|((c.value>>4)<<3);
|
|
|
|
rWrite(0x22,lfoValue);
|
2022-03-30 05:09:53 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-05-31 02:21:42 +00:00
|
|
|
case DIV_CMD_FM_FB: {
|
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[extChanOffs].state.fb=c.value&7;
|
|
|
|
rWrite(chanOffs[extChanOffs]+ADDR_FB_ALG,(chan[extChanOffs].state.alg&7)|(chan[extChanOffs].state.fb<<3));
|
2022-05-31 02:21:42 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-12-22 02:50:49 +00:00
|
|
|
case DIV_CMD_FM_MULT: {
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[c.value]];
|
2022-12-22 02:50:49 +00:00
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[c.value]];
|
|
|
|
op.mult=c.value2&15;
|
|
|
|
rWrite(baseAddr+0x30,(op.mult&15)|(dtTable[op.dt&7]<<4));
|
2021-12-14 19:31:57 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-12-22 02:50:49 +00:00
|
|
|
case DIV_CMD_FM_TL: {
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[c.value]];
|
2022-12-22 02:50:49 +00:00
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[c.value]];
|
|
|
|
op.tl=c.value2;
|
|
|
|
if (isOpMuted[ch]) {
|
|
|
|
rWrite(baseAddr+0x40,127);
|
|
|
|
} else if (KVS(2,c.value)) {
|
|
|
|
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch].outVol&0x7f,127));
|
2021-12-14 19:31:57 +00:00
|
|
|
} else {
|
2022-12-22 02:50:49 +00:00
|
|
|
rWrite(baseAddr+0x40,op.tl);
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_FM_AR: {
|
|
|
|
if (c.value<0) {
|
|
|
|
for (int i=0; i<4; i++) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.ar=c.value2&31;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+0x50,(op.ar&31)|(op.rs<<6));
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
|
|
|
} else {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.ar=c.value2&31;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+0x50,(op.ar&31)|(op.rs<<6));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_FM_RS: {
|
|
|
|
if (c.value<0) {
|
|
|
|
for (int i=0; i<4; i++) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.rs=c.value2&3;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_RS_AR,(op.ar&31)|(op.rs<<6));
|
|
|
|
}
|
|
|
|
} else if (c.value<4) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.rs=c.value2&3;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_RS_AR,(op.ar&31)|(op.rs<<6));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_FM_AM: {
|
|
|
|
if (c.value<0) {
|
|
|
|
for (int i=0; i<4; i++) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.am=c.value2&1;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_AM_DR,(op.dr&31)|(op.am<<7));
|
|
|
|
}
|
|
|
|
} else if (c.value<4) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.am=c.value2&1;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_AM_DR,(op.dr&31)|(op.am<<7));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_FM_DR: {
|
|
|
|
if (c.value<0) {
|
|
|
|
for (int i=0; i<4; i++) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.dr=c.value2&31;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_AM_DR,(op.dr&31)|(op.am<<7));
|
|
|
|
}
|
|
|
|
} else if (c.value<4) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.dr=c.value2&31;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_AM_DR,(op.dr&31)|(op.am<<7));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_FM_SL: {
|
|
|
|
if (c.value<0) {
|
|
|
|
for (int i=0; i<4; i++) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.sl=c.value2&15;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
|
|
|
}
|
|
|
|
} else if (c.value<4) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.sl=c.value2&15;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_FM_RR: {
|
|
|
|
if (c.value<0) {
|
|
|
|
for (int i=0; i<4; i++) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.rr=c.value2&15;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
|
|
|
}
|
|
|
|
} else if (c.value<4) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.rr=c.value2&15;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_FM_D2R: {
|
|
|
|
if (c.value<0) {
|
|
|
|
for (int i=0; i<4; i++) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.d2r=c.value2&31;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_DT2_D2R,op.d2r&31);
|
|
|
|
}
|
|
|
|
} else if (c.value<4) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.d2r=c.value2&31;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_DT2_D2R,op.d2r&31);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_FM_DT: {
|
|
|
|
if (c.value<0) {
|
|
|
|
for (int i=0; i<4; i++) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.dt=c.value&7;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|(dtTable[op.dt&7]<<4));
|
|
|
|
}
|
|
|
|
} else if (c.value<4) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.dt=c.value2&7;
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|(dtTable[op.dt&7]<<4));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_FM_SSG: {
|
|
|
|
if (c.value<0) {
|
|
|
|
for (int i=0; i<4; i++) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.ssgEnv=8^(c.value2&15);
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[i];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_SSG,op.ssgEnv&15);
|
|
|
|
}
|
|
|
|
} else if (c.value<4) {
|
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
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
op.ssgEnv=8^(c.value2&15);
|
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
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[c.value]];
|
2022-05-04 19:09:43 +00:00
|
|
|
rWrite(baseAddr+ADDR_SSG,op.ssgEnv&15);
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIV_CMD_GET_VOLMAX:
|
|
|
|
return 127;
|
|
|
|
break;
|
2022-12-17 05:09:56 +00:00
|
|
|
case DIV_CMD_MACRO_OFF:
|
|
|
|
opChan[ch].std.mask(c.value,true);
|
|
|
|
break;
|
|
|
|
case DIV_CMD_MACRO_ON:
|
|
|
|
opChan[ch].std.mask(c.value,false);
|
|
|
|
break;
|
2021-12-14 19:31:57 +00:00
|
|
|
case DIV_ALWAYS_SET_VOLUME:
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
case DIV_CMD_PRE_PORTA:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
//printf("WARNING: unimplemented command %d\n",c.cmd);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int opChanOffsL[4]={
|
|
|
|
0xa9, 0xaa, 0xa8, 0xa2
|
|
|
|
};
|
|
|
|
|
|
|
|
static int opChanOffsH[4]={
|
|
|
|
0xad, 0xae, 0xac, 0xa6
|
|
|
|
};
|
|
|
|
|
2022-04-15 20:01:11 +00:00
|
|
|
void DivPlatformYM2610Ext::tick(bool sysTick) {
|
2021-12-14 19:31:57 +00:00
|
|
|
if (extMode) {
|
|
|
|
bool writeSomething=false;
|
|
|
|
unsigned char writeMask=2;
|
|
|
|
for (int i=0; i<4; i++) {
|
2022-09-12 05:51:09 +00:00
|
|
|
writeMask|=(unsigned char)(opChan[i].mask && opChan[i].active)<<(4+i);
|
2021-12-14 19:31:57 +00:00
|
|
|
if (opChan[i].keyOn || opChan[i].keyOff) {
|
|
|
|
writeSomething=true;
|
|
|
|
writeMask&=~(1<<(4+i));
|
|
|
|
opChan[i].keyOff=false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (writeSomething) {
|
2021-12-21 06:29:07 +00:00
|
|
|
immWrite(0x28,writeMask);
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-23 19:31:00 +00:00
|
|
|
if (extMode && !noExtMacros) for (int i=0; i<4; i++) {
|
|
|
|
opChan[i].std.next();
|
|
|
|
|
|
|
|
if (opChan[i].std.vol.had) {
|
|
|
|
opChan[i].outVol=VOL_SCALE_LOG_BROKEN(opChan[i].vol,MIN(127,opChan[i].std.vol.val),127);
|
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[i]];
|
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[i]];
|
|
|
|
if (isOpMuted[i]) {
|
|
|
|
rWrite(baseAddr+ADDR_TL,127);
|
|
|
|
} else {
|
|
|
|
rWrite(baseAddr+ADDR_TL,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[i].outVol&0x7f,127));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (opChan[i].std.arp.had) {
|
|
|
|
if (!opChan[i].inPorta) {
|
|
|
|
opChan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(opChan[i].note,opChan[i].std.arp.val),11);
|
|
|
|
}
|
|
|
|
opChan[i].freqChanged=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (opChan[i].std.pitch.had) {
|
|
|
|
if (opChan[i].std.pitch.mode) {
|
|
|
|
opChan[i].pitch2+=opChan[i].std.pitch.val;
|
2022-12-28 19:47:50 +00:00
|
|
|
CLAMP_VAR(opChan[i].pitch2,-1048576,1048575);
|
2022-12-23 19:31:00 +00:00
|
|
|
} else {
|
|
|
|
opChan[i].pitch2=opChan[i].std.pitch.val;
|
|
|
|
}
|
|
|
|
opChan[i].freqChanged=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// param macros
|
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[orderedOps[i]];
|
|
|
|
DivInstrumentFM::Operator& op=chan[extChanOffs].state.op[orderedOps[i]];
|
|
|
|
DivMacroInt::IntOp& m=opChan[i].std.op[orderedOps[i]];
|
|
|
|
if (m.am.had) {
|
|
|
|
op.am=m.am.val;
|
|
|
|
rWrite(baseAddr+ADDR_AM_DR,(op.dr&31)|(op.am<<7));
|
|
|
|
}
|
|
|
|
if (m.ar.had) {
|
|
|
|
op.ar=m.ar.val;
|
|
|
|
rWrite(baseAddr+ADDR_RS_AR,(op.ar&31)|(op.rs<<6));
|
|
|
|
}
|
|
|
|
if (m.dr.had) {
|
|
|
|
op.dr=m.dr.val;
|
|
|
|
rWrite(baseAddr+ADDR_AM_DR,(op.dr&31)|(op.am<<7));
|
|
|
|
}
|
|
|
|
if (m.mult.had) {
|
|
|
|
op.mult=m.mult.val;
|
|
|
|
rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|(dtTable[op.dt&7]<<4));
|
|
|
|
}
|
|
|
|
if (m.rr.had) {
|
|
|
|
op.rr=m.rr.val;
|
|
|
|
rWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
|
|
|
}
|
|
|
|
if (m.sl.had) {
|
|
|
|
op.sl=m.sl.val;
|
|
|
|
rWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
|
|
|
}
|
|
|
|
if (m.tl.had) {
|
|
|
|
op.tl=127-m.tl.val;
|
|
|
|
if (isOpMuted[i]) {
|
|
|
|
rWrite(baseAddr+ADDR_TL,127);
|
|
|
|
} else {
|
|
|
|
rWrite(baseAddr+ADDR_TL,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[i].outVol&0x7f,127));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (m.rs.had) {
|
|
|
|
op.rs=m.rs.val;
|
|
|
|
rWrite(baseAddr+ADDR_RS_AR,(op.ar&31)|(op.rs<<6));
|
|
|
|
}
|
|
|
|
if (m.dt.had) {
|
|
|
|
op.dt=m.dt.val;
|
|
|
|
rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|(dtTable[op.dt&7]<<4));
|
|
|
|
}
|
|
|
|
if (m.d2r.had) {
|
|
|
|
op.d2r=m.d2r.val;
|
|
|
|
rWrite(baseAddr+ADDR_DT2_D2R,op.d2r&31);
|
|
|
|
}
|
|
|
|
if (m.ssg.had) {
|
|
|
|
op.ssgEnv=m.ssg.val;
|
|
|
|
rWrite(baseAddr+ADDR_SSG,op.ssgEnv&15);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-15 20:01:11 +00:00
|
|
|
DivPlatformYM2610::tick(sysTick);
|
2021-12-14 19:31:57 +00:00
|
|
|
|
|
|
|
bool writeNoteOn=false;
|
|
|
|
unsigned char writeMask=2;
|
|
|
|
if (extMode) for (int i=0; i<4; i++) {
|
|
|
|
if (opChan[i].freqChanged) {
|
2022-05-11 05:04:36 +00:00
|
|
|
if (parent->song.linearPitch==2) {
|
2022-12-17 07:43:07 +00:00
|
|
|
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2,chipClock,CHIP_FREQBASE,11);
|
2022-05-11 05:04:36 +00:00
|
|
|
} else {
|
2022-12-17 07:43:07 +00:00
|
|
|
int fNum=parent->calcFreq(opChan[i].baseFreq&0x7ff,opChan[i].pitch,opChan[i].fixedArp?opChan[i].baseNoteOverride:opChan[i].arpOff,opChan[i].fixedArp,false,4,opChan[i].pitch2);
|
2022-05-11 05:04:36 +00:00
|
|
|
int block=(opChan[i].baseFreq&0xf800)>>11;
|
|
|
|
if (fNum<0) fNum=0;
|
|
|
|
if (fNum>2047) {
|
|
|
|
while (block<7) {
|
|
|
|
fNum>>=1;
|
|
|
|
block++;
|
|
|
|
}
|
|
|
|
if (fNum>2047) fNum=2047;
|
2022-05-10 07:22:08 +00:00
|
|
|
}
|
2022-05-11 05:04:36 +00:00
|
|
|
opChan[i].freq=(block<<11)|fNum;
|
2022-05-10 07:22:08 +00:00
|
|
|
}
|
|
|
|
if (opChan[i].freq>0x3fff) opChan[i].freq=0x3fff;
|
|
|
|
immWrite(opChanOffsH[i],opChan[i].freq>>8);
|
|
|
|
immWrite(opChanOffsL[i],opChan[i].freq&0xff);
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
2022-09-12 05:51:09 +00:00
|
|
|
writeMask|=(unsigned char)(opChan[i].mask && opChan[i].active)<<(4+i);
|
2021-12-14 19:31:57 +00:00
|
|
|
if (opChan[i].keyOn) {
|
|
|
|
writeNoteOn=true;
|
2022-09-12 05:51:09 +00:00
|
|
|
if (opChan[i].mask) {
|
|
|
|
writeMask|=1<<(4+i);
|
|
|
|
}
|
2021-12-14 19:31:57 +00:00
|
|
|
opChan[i].keyOn=false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (writeNoteOn) {
|
2021-12-21 06:29:07 +00:00
|
|
|
immWrite(0x28,writeMask);
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-18 08:25:42 +00:00
|
|
|
void DivPlatformYM2610Ext::muteChannel(int ch, bool mute) {
|
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 (ch<extChanOffs) {
|
2021-12-18 08:25:42 +00:00
|
|
|
DivPlatformYM2610::muteChannel(ch,mute);
|
|
|
|
return;
|
|
|
|
}
|
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 (ch>(extChanOffs+3)) {
|
2021-12-18 08:25:42 +00:00
|
|
|
DivPlatformYM2610::muteChannel(ch-3,mute);
|
|
|
|
return;
|
|
|
|
}
|
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
|
|
|
isOpMuted[ch-extChanOffs]=mute;
|
2021-12-18 08:25:42 +00:00
|
|
|
|
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
|
|
|
int ordch=orderedOps[ch-extChanOffs];
|
|
|
|
unsigned short baseAddr=chanOffs[extChanOffs]|opOffs[ordch];
|
2022-12-23 19:31:00 +00:00
|
|
|
DivInstrumentFM::Operator op=chan[extChanOffs].state.op[ordch];
|
|
|
|
if (isOpMuted[ch-extChanOffs]) {
|
2021-12-18 08:25:42 +00:00
|
|
|
rWrite(baseAddr+0x40,127);
|
2022-12-23 19:31:00 +00:00
|
|
|
immWrite(baseAddr+0x40,127);
|
|
|
|
} else if (KVS(2,ordch)) {
|
|
|
|
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch-extChanOffs].outVol&0x7f,127));
|
|
|
|
immWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[ch-extChanOffs].outVol&0x7f,127));
|
2021-12-18 08:25:42 +00:00
|
|
|
} else {
|
|
|
|
rWrite(baseAddr+0x40,op.tl);
|
2022-12-23 19:31:00 +00:00
|
|
|
immWrite(baseAddr+0x40,op.tl);
|
2021-12-18 08:25:42 +00:00
|
|
|
}
|
2022-12-23 19:31:00 +00:00
|
|
|
|
|
|
|
rWrite(chanOffs[extChanOffs]+0xb4,(IS_EXTCH_MUTED?0:(opChan[ch-extChanOffs].pan<<6))|(chan[extChanOffs].state.fms&7)|((chan[extChanOffs].state.ams&3)<<4));
|
2021-12-18 08:25:42 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 06:29:07 +00:00
|
|
|
void DivPlatformYM2610Ext::forceIns() {
|
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<psgChanOffs; i++) {
|
2022-04-03 07:28:46 +00:00
|
|
|
for (int j=0; j<4; j++) {
|
|
|
|
unsigned short baseAddr=chanOffs[i]|opOffs[j];
|
|
|
|
DivInstrumentFM::Operator& op=chan[i].state.op[j];
|
2022-12-23 19:31:00 +00:00
|
|
|
if (i==extChanOffs && extMode) { // extended channel
|
2022-04-03 07:28:46 +00:00
|
|
|
if (isOpMuted[j]) {
|
|
|
|
rWrite(baseAddr+0x40,127);
|
2022-09-22 06:30:51 +00:00
|
|
|
} else if (KVS(i,j)) {
|
2022-12-23 19:31:00 +00:00
|
|
|
rWrite(baseAddr+0x40,127-VOL_SCALE_LOG_BROKEN(127-op.tl,opChan[j].outVol&0x7f,127));
|
2022-04-03 07:28:46 +00:00
|
|
|
} else {
|
|
|
|
rWrite(baseAddr+0x40,op.tl);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (isMuted[i]) {
|
|
|
|
rWrite(baseAddr+ADDR_TL,127);
|
|
|
|
} else {
|
2022-09-22 06:30:51 +00:00
|
|
|
if (KVS(i,j)) {
|
2022-10-28 13:36:50 +00:00
|
|
|
rWrite(baseAddr+ADDR_TL,127-VOL_SCALE_LOG_BROKEN(127-op.tl,chan[i].outVol&0x7f,127));
|
2022-04-03 07:28:46 +00:00
|
|
|
} else {
|
|
|
|
rWrite(baseAddr+ADDR_TL,op.tl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rWrite(baseAddr+ADDR_MULT_DT,(op.mult&15)|(dtTable[op.dt&7]<<4));
|
|
|
|
rWrite(baseAddr+ADDR_RS_AR,(op.ar&31)|(op.rs<<6));
|
|
|
|
rWrite(baseAddr+ADDR_AM_DR,(op.dr&31)|(op.am<<7));
|
|
|
|
rWrite(baseAddr+ADDR_DT2_D2R,op.d2r&31);
|
|
|
|
rWrite(baseAddr+ADDR_SL_RR,(op.rr&15)|(op.sl<<4));
|
|
|
|
rWrite(baseAddr+ADDR_SSG,op.ssgEnv&15);
|
|
|
|
}
|
|
|
|
rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3));
|
2022-12-23 19:31:00 +00:00
|
|
|
if (i==extChanOffs) {
|
|
|
|
rWrite(chanOffs[i]+ADDR_LRAF,(IS_EXTCH_MUTED?0:(opChan[0].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
|
|
|
} else {
|
|
|
|
rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
|
|
|
}
|
2022-04-03 07:28:46 +00:00
|
|
|
if (chan[i].active) {
|
|
|
|
chan[i].keyOn=true;
|
|
|
|
chan[i].freqChanged=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
|
|
|
for (int i=adpcmAChanOffs; i<=adpcmBChanOffs; i++) {
|
2022-04-03 07:28:46 +00:00
|
|
|
chan[i].insChanged=true;
|
|
|
|
}
|
2022-04-06 23:03:30 +00:00
|
|
|
ay->forceIns();
|
|
|
|
ay->flushWrites();
|
|
|
|
for (DivRegWrite& i: ay->getRegisterWrites()) {
|
2022-09-29 04:21:24 +00:00
|
|
|
if (i.addr>15) continue;
|
2022-04-06 23:03:30 +00:00
|
|
|
immWrite(i.addr&15,i.val);
|
|
|
|
}
|
|
|
|
ay->getRegisterWrites().clear();
|
2022-12-23 19:31:00 +00:00
|
|
|
immWrite(0x22,lfoValue);
|
2021-12-21 06:29:07 +00:00
|
|
|
for (int i=0; i<4; i++) {
|
|
|
|
opChan[i].insChanged=true;
|
2022-02-21 02:39:14 +00:00
|
|
|
if (opChan[i].active) {
|
|
|
|
opChan[i].keyOn=true;
|
|
|
|
opChan[i].freqChanged=true;
|
|
|
|
}
|
2021-12-21 06:29:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-27 05:29:16 +00:00
|
|
|
void* DivPlatformYM2610Ext::getChanState(int ch) {
|
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 (ch>=(extChanOffs+4)) return &chan[ch-3];
|
|
|
|
if (ch>=extChanOffs) return &opChan[ch-extChanOffs];
|
2022-01-27 05:29:16 +00:00
|
|
|
return &chan[ch];
|
2022-06-05 23:17:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DivMacroInt* DivPlatformYM2610Ext::getChanMacroInt(int ch) {
|
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 (ch>=(psgChanOffs+3) && ch<(adpcmAChanOffs+3)) return ay->getChanMacroInt(ch-psgChanOffs-3);
|
|
|
|
if (ch>=(extChanOffs+4)) return &chan[ch-3].std;
|
2022-12-24 00:06:10 +00:00
|
|
|
if (ch>=extChanOffs) return &opChan[ch-extChanOffs].std;
|
2022-06-05 23:17:00 +00:00
|
|
|
return &chan[ch].std;
|
2022-01-27 05:29:16 +00:00
|
|
|
}
|
|
|
|
|
2022-05-01 08:47:04 +00:00
|
|
|
DivDispatchOscBuffer* DivPlatformYM2610Ext::getOscBuffer(int ch) {
|
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 (ch>=(extChanOffs+4)) return oscBuf[ch-3];
|
|
|
|
if (ch<(extChanOffs+1)) return oscBuf[ch];
|
2022-05-01 08:47:04 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2021-12-14 19:31:57 +00:00
|
|
|
void DivPlatformYM2610Ext::reset() {
|
|
|
|
DivPlatformYM2610::reset();
|
|
|
|
|
|
|
|
for (int i=0; i<4; i++) {
|
2022-12-04 10:58:58 +00:00
|
|
|
opChan[i]=DivPlatformOPN::OPNOpChannelStereo();
|
2022-12-23 19:31:00 +00:00
|
|
|
opChan[i].std.setEngine(parent);
|
2021-12-14 19:31:57 +00:00
|
|
|
opChan[i].vol=127;
|
2022-12-23 19:31:00 +00:00
|
|
|
opChan[i].outVol=127;
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// channel 2 mode
|
2021-12-21 06:29:07 +00:00
|
|
|
immWrite(0x27,0x40);
|
2021-12-14 19:31:57 +00:00
|
|
|
extMode=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DivPlatformYM2610Ext::keyOffAffectsArp(int ch) {
|
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
|
|
|
return (ch>=(psgChanOffs+3));
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
|
|
|
|
2022-01-18 04:59:52 +00:00
|
|
|
void DivPlatformYM2610Ext::notifyInsChange(int ins) {
|
|
|
|
DivPlatformYM2610::notifyInsChange(ins);
|
|
|
|
for (int i=0; i<4; i++) {
|
|
|
|
if (opChan[i].ins==ins) {
|
|
|
|
opChan[i].insChanged=true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-30 01:13:40 +00:00
|
|
|
int DivPlatformYM2610Ext::init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) {
|
2022-01-28 17:59:53 +00:00
|
|
|
DivPlatformYM2610::init(parent,channels,sugRate,flags);
|
2021-12-18 08:25:42 +00:00
|
|
|
for (int i=0; i<4; i++) {
|
|
|
|
isOpMuted[i]=false;
|
|
|
|
}
|
2022-06-28 06:16:46 +00:00
|
|
|
extSys=true;
|
2021-12-14 19:31:57 +00:00
|
|
|
|
|
|
|
reset();
|
2022-02-10 08:35:08 +00:00
|
|
|
return 17;
|
2021-12-14 19:31:57 +00:00
|
|
|
}
|
2021-12-15 05:37:27 +00:00
|
|
|
|
|
|
|
void DivPlatformYM2610Ext::quit() {
|
|
|
|
DivPlatformYM2610::quit();
|
|
|
|
}
|
|
|
|
|
|
|
|
DivPlatformYM2610Ext::~DivPlatformYM2610Ext() {
|
2022-03-06 19:39:20 +00:00
|
|
|
}
|