Reduce duplicates of channel struct

Add/Fix custom clock limit defines (for YMF278B)
This commit is contained in:
cam900 2022-12-04 19:58:58 +09:00
parent fd3f381bc3
commit 2ec4237076
69 changed files with 457 additions and 1151 deletions

67
src/chip-utils.h Normal file
View File

@ -0,0 +1,67 @@
/**
* 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.
*/
#ifndef _CHIP_UTILS_H
#define _CHIP_UTILS_H
// custom clock limits
#define MIN_CUSTOM_CLOCK 100000
#define MAX_CUSTOM_CLOCK 40000000
// common shared channel struct
struct SharedChannel {
int ins;
int note;
bool active, insChanged, keyOn, keyOff;
SharedChannel():
ins(-1),
note(0),
active(false),
insChanged(true),
keyOn(false),
keyOff(false) {}
};
// common shared channel struct with frequency
struct SharedChannelFreq: public SharedChannel {
int freq, baseFreq, pitch, pitch2;
bool freqChanged, inPorta, portaPause;
SharedChannelFreq():
SharedChannel(),
freq(0),
baseFreq(0),
pitch(0),
pitch2(0),
freqChanged(false),
inPorta(false),
portaPause(false) {}
};
// common shared channel volume struct
template<typename T>
struct SharedChannelVolume {
bool volumeChanged;
T vol, outVol, resVol;
SharedChannelVolume(T initVol):
vol(initVol),
outVol(initVol),
resVol(initVol) {}
};
#endif

View File

@ -24,6 +24,7 @@
#include <string.h> #include <string.h>
#include <vector> #include <vector>
#include "config.h" #include "config.h"
#include "../chip-utils.h"
#define ONE_SEMITONE 2200 #define ONE_SEMITONE 2200
@ -453,6 +454,18 @@ class DivDispatch {
*/ */
virtual bool getWantPreNote(); virtual bool getWantPreNote();
/**
* get minimum chip clock.
* @return clock in Hz, or 0 if custom clocks are not supported.
*/
virtual unsigned int getClockRangeMin();
/**
* get maximum chip clock.
* @return clock in Hz, or 0 if custom clocks are not supported.
*/
virtual unsigned int getClockRangeMax();
/** /**
* set the chip flags. * set the chip flags.
* @param flags a DivConfig containing chip flags. * @param flags a DivConfig containing chip flags.
@ -582,9 +595,9 @@ class DivDispatch {
// custom chip clock helper define. put in setFlags, but before rate is set. // custom chip clock helper define. put in setFlags, but before rate is set.
#define CHECK_CUSTOM_CLOCK \ #define CHECK_CUSTOM_CLOCK \
if (flags.getInt("customClock",0)>0) { \ if (flags.getInt("customClock",0)>0) { \
chipClock=flags.getInt("customClock",1000000); \ chipClock=flags.getInt("customClock",getClockRangeMin()); \
if (chipClock>20000000) chipClock=20000000; \ if (chipClock>getClockRangeMax()) chipClock=getClockRangeMax(); \
if (chipClock<100000) chipClock=100000; \ if (chipClock<getClockRangeMin()) chipClock=getClockRangeMin(); \
} }
// pitch calculation: // pitch calculation:

View File

@ -97,6 +97,14 @@ bool DivDispatch::getWantPreNote() {
return false; return false;
} }
unsigned int DivDispatch::getClockRangeMin() {
return MIN_CUSTOM_CLOCK;
}
unsigned int DivDispatch::getClockRangeMax() {
return MAX_CUSTOM_CLOCK;
}
void DivDispatch::setFlags(const DivConfig& flags) { void DivDispatch::setFlags(const DivConfig& flags) {
} }

View File

@ -26,19 +26,15 @@
#include "../waveSynth.h" #include "../waveSynth.h"
class DivPlatformAmiga: public DivDispatch { class DivPlatformAmiga: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2;
unsigned int audLoc; unsigned int audLoc;
unsigned short audLen; unsigned short audLen;
unsigned int audPos; unsigned int audPos;
int audSub; int audSub;
signed char audDat; signed char audDat;
int sample, wave; int sample, wave;
int ins;
int busClock; int busClock;
int note; bool useWave, setPos, useV, useP;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, useWave, setPos, useV, useP;
signed char vol, outVol;
DivMacroInt std; DivMacroInt std;
DivWaveSynth ws; DivWaveSynth ws;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
@ -46,10 +42,8 @@ class DivPlatformAmiga: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(64),
pitch(0),
pitch2(0),
audLoc(0), audLoc(0),
audLen(0), audLen(0),
audPos(0), audPos(0),
@ -57,21 +51,11 @@ class DivPlatformAmiga: public DivDispatch {
audDat(0), audDat(0),
sample(-1), sample(-1),
wave(-1), wave(-1),
ins(-1),
busClock(0), busClock(0),
note(0),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
useWave(false), useWave(false),
setPos(false), setPos(false),
useV(false), useV(false),
useP(false), useP(false) {}
vol(64),
outVol(64) {}
}; };
Channel chan[4]; Channel chan[4];
DivDispatchOscBuffer* oscBuf[4]; DivDispatchOscBuffer* oscBuf[4];

View File

@ -20,8 +20,6 @@
#ifndef _ARCADE_H #ifndef _ARCADE_H
#define _ARCADE_H #define _ARCADE_H
#include "fmshared_OPM.h" #include "fmshared_OPM.h"
#include "../macroInt.h"
#include "../instrument.h"
#include <queue> #include <queue>
#include "../../../extern/opm/opm.h" #include "../../../extern/opm/opm.h"
#include "sound/ymfm/ymfm_opm.h" #include "sound/ymfm/ymfm_opm.h"
@ -36,44 +34,12 @@ class DivPlatformArcade: public DivPlatformOPM {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
}; };
struct Channel { struct Channel: public FMChannel {
DivInstrumentFM state; unsigned char chVolL, chVolR;
DivMacroInt std;
unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, note;
int ins;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, portaPause, furnacePCM, hardReset, opMaskChanged;
int vol, outVol;
unsigned char chVolL, chVolR, opMask;
void macroInit(DivInstrument* which) {
std.init(which);
pitch2=0;
}
Channel(): Channel():
freqH(0), FMChannel(),
freqL(0), chVolL(1),
freq(0), chVolR(1) {}
baseFreq(0),
pitch(0),
pitch2(0),
note(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
portaPause(false),
furnacePCM(false),
hardReset(false),
opMaskChanged(false),
vol(0),
outVol(0),
chVolL(127),
chVolR(127),
opMask(15) {}
}; };
Channel chan[8]; Channel chan[8];
DivDispatchOscBuffer* oscBuf[8]; DivDispatchOscBuffer* oscBuf[8];

View File

@ -30,7 +30,7 @@ class DivPlatformAY8910: public DivDispatch {
0,4,1,5,2,6,9,8,11,12,13,3,7,10,14,15 0,4,1,5,2,6,9,8,11,12,13,3,7,10,14,15
}; };
inline unsigned char regRemap(unsigned char reg) { return intellivision?AY8914RegRemap[reg&0x0f]:reg&0x0f; } inline unsigned char regRemap(unsigned char reg) { return intellivision?AY8914RegRemap[reg&0x0f]:reg&0x0f; }
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
struct PSGMode { struct PSGMode {
union { union {
struct { struct {
@ -73,38 +73,21 @@ class DivPlatformAY8910: public DivDispatch {
furnaceDAC(0) {} furnaceDAC(0) {}
} dac; } dac;
int freq, baseFreq, note, pitch, pitch2;
int ins;
unsigned char autoEnvNum, autoEnvDen; unsigned char autoEnvNum, autoEnvDen;
signed char konCycles; signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta;
int vol, outVol;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
SharedChannelFreq(),
SharedChannelVolume<int>(15),
curPSGMode(PSGMode(0)), curPSGMode(PSGMode(0)),
nextPSGMode(PSGMode(1)), nextPSGMode(PSGMode(1)),
dac(DAC()), dac(DAC()),
freq(0),
baseFreq(0),
note(0),
pitch(0),
pitch2(0),
ins(-1),
autoEnvNum(0), autoEnvNum(0),
autoEnvDen(0), autoEnvDen(0) {}
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
inPorta(false),
vol(0),
outVol(15) {}
}; };
Channel chan[3]; Channel chan[3];
bool isMuted[3]; bool isMuted[3];

View File

@ -26,7 +26,7 @@
class DivPlatformAY8930: public DivDispatch { class DivPlatformAY8930: public DivDispatch {
protected: protected:
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
struct Envelope { struct Envelope {
unsigned char mode; unsigned char mode;
unsigned short period; unsigned short period;
@ -81,40 +81,23 @@ class DivPlatformAY8930: public DivDispatch {
furnaceDAC(0) {} furnaceDAC(0) {}
} dac; } dac;
int freq, baseFreq, note, pitch, pitch2;
int ins;
unsigned char autoEnvNum, autoEnvDen, duty; unsigned char autoEnvNum, autoEnvDen, duty;
signed char konCycles; signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta;
int vol, outVol;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
SharedChannelFreq(),
SharedChannelVolume<int>(31),
envelope(Envelope()), envelope(Envelope()),
curPSGMode(PSGMode(0)), curPSGMode(PSGMode(0)),
nextPSGMode(PSGMode(1)), nextPSGMode(PSGMode(1)),
dac(DAC()), dac(DAC()),
freq(0),
baseFreq(0),
note(0),
pitch(0),
pitch2(0),
ins(-1),
autoEnvNum(0), autoEnvNum(0),
autoEnvDen(0), autoEnvDen(0),
duty(4), duty(4) {}
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
inPorta(false),
vol(0),
outVol(31) {}
}; };
Channel chan[3]; Channel chan[3];
bool isMuted[3]; bool isMuted[3];

View File

@ -27,10 +27,8 @@
#include "vgsound_emu/src/k005289/k005289.hpp" #include "vgsound_emu/src/k005289/k005289.hpp"
class DivPlatformBubSysWSG: public DivDispatch { class DivPlatformBubSysWSG: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note, ins; signed short wave;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta;
signed char vol, outVol, wave;
signed char waveROM[32] = {0}; // 4 bit PROM per channel on bubble system signed char waveROM[32] = {0}; // 4 bit PROM per channel on bubble system
DivMacroInt std; DivMacroInt std;
DivWaveSynth ws; DivWaveSynth ws;
@ -39,20 +37,8 @@ class DivPlatformBubSysWSG: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15),
pitch(0),
pitch2(0),
note(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
vol(15),
outVol(15),
wave(-1) {} wave(-1) {}
}; };
Channel chan[2]; Channel chan[2];

View File

@ -26,27 +26,22 @@
#include "sound/c64_fp/SID.h" #include "sound/c64_fp/SID.h"
class DivPlatformC64: public DivDispatch { class DivPlatformC64: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, prevFreq, testWhen, note, ins; int prevFreq, testWhen;
unsigned char sweep, wave, attack, decay, sustain, release; unsigned char sweep, wave, attack, decay, sustain, release;
short duty; short duty;
bool active, insChanged, freqChanged, sweepChanged, keyOn, keyOff, inPorta, filter; bool sweepChanged, filter;
bool resetMask, resetFilter, resetDuty, ring, sync, test; bool resetMask, resetFilter, resetDuty, ring, sync, test;
signed char vol, outVol;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15),
pitch(0),
pitch2(0),
prevFreq(65535), prevFreq(65535),
testWhen(0), testWhen(0),
note(0),
ins(-1),
sweep(0), sweep(0),
wave(0), wave(0),
attack(0), attack(0),
@ -54,21 +49,14 @@ class DivPlatformC64: public DivDispatch {
sustain(0), sustain(0),
release(0), release(0),
duty(0), duty(0),
active(false),
insChanged(true),
freqChanged(false),
sweepChanged(false), sweepChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
filter(false), filter(false),
resetMask(false), resetMask(false),
resetFilter(false), resetFilter(false),
resetDuty(false), resetDuty(false),
ring(false), ring(false),
sync(false), sync(false),
test(false), test(false) {}
vol(15) {}
}; };
Channel chan[3]; Channel chan[3];
DivDispatchOscBuffer* oscBuf[3]; DivDispatchOscBuffer* oscBuf[3];

View File

@ -27,11 +27,11 @@
#include "sound/nes_nsfplay/nes_fds.h" #include "sound/nes_nsfplay/nes_fds.h"
class DivPlatformFDS: public DivDispatch { class DivPlatformFDS: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, prevFreq, note, modFreq, ins; int prevFreq, modFreq;
unsigned char duty, sweep, modDepth, modPos; unsigned char duty, sweep, modDepth, modPos;
bool active, insChanged, freqChanged, sweepChanged, keyOn, keyOff, inPorta, modOn; bool sweepChanged, modOn;
signed char vol, outVol, wave; signed short wave;
signed char modTable[32]; signed char modTable[32];
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
@ -39,28 +39,16 @@ class DivPlatformFDS: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(32),
pitch(0),
pitch2(0),
prevFreq(65535), prevFreq(65535),
note(0),
modFreq(0), modFreq(0),
ins(-1),
duty(0), duty(0),
sweep(8), sweep(8),
modDepth(0), modDepth(0),
modPos(0), modPos(0),
active(false),
insChanged(true),
freqChanged(false),
sweepChanged(false), sweepChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
modOn(false), modOn(false),
vol(32),
outVol(32),
wave(-1) { wave(-1) {
memset(modTable,0,32); memset(modTable,0,32);
} }

View File

@ -101,6 +101,54 @@ class DivPlatformOPN: public DivPlatformFMBase {
0x00, 0x04, 0x08, 0x0c 0x00, 0x04, 0x08, 0x0c
}; };
struct OPNChannel: public FMChannel {
unsigned char psgMode, autoEnvNum, autoEnvDen;
bool furnacePCM;
int sample, macroVolMul;
OPNChannel():
FMChannel(),
psgMode(1),
autoEnvNum(0),
autoEnvDen(0),
furnacePCM(false),
sample(-1),
macroVolMul(255) {}
};
struct OPNChannelStereo: public OPNChannel {
unsigned char pan;
OPNChannelStereo():
OPNChannel(),
pan(3) {}
};
struct OPNOpChannel: public SharedChannelFreq, public SharedChannelVolume<int> {
DivMacroInt std;
unsigned char freqH, freqL;
int portaPauseFreq;
signed char konCycles;
bool mask;
void macroInit(DivInstrument* which) {
std.init(which);
pitch2=0;
}
OPNOpChannel():
SharedChannelFreq(),
SharedChannelVolume<int>(0),
freqH(0),
freqL(0),
portaPauseFreq(0),
mask(true) {}
};
struct OPNOpChannelStereo: public OPNOpChannel {
unsigned char pan;
OPNOpChannelStereo():
OPNOpChannel(),
pan(3) {}
};
double fmFreqBase; double fmFreqBase;
unsigned int fmDivBase; unsigned int fmDivBase;
unsigned int ayDiv; unsigned int ayDiv;

View File

@ -21,6 +21,8 @@
#define _FMSHARED_BASE_H #define _FMSHARED_BASE_H
#include "../dispatch.h" #include "../dispatch.h"
#include "../instrument.h"
#include "../macroInt.h"
#include <deque> #include <deque>
#define KVS(x,y) ((chan[x].state.op[y].kvs==2 && isOutput[chan[x].state.alg][y]) || chan[x].state.op[y].kvs==1) #define KVS(x,y) ((chan[x].state.op[y].kvs==2 && isOutput[chan[x].state.alg][y]) || chan[x].state.op[y].kvs==1)
@ -46,6 +48,38 @@ class DivPlatformFMBase: public DivDispatch {
0,2,1,3 0,2,1,3
}; };
struct FMChannel: public SharedChannelFreq, public SharedChannelVolume<int> {
DivInstrumentFM state;
DivMacroInt std;
unsigned char freqH, freqL;
int portaPauseFreq;
unsigned char opMask;
signed char konCycles;
bool hardReset, opMaskChanged;
void macroInit(DivInstrument* which) {
std.init(which);
pitch2=0;
}
FMChannel():
SharedChannelFreq(),
SharedChannelVolume<int>(0),
freqH(0),
freqL(0),
portaPauseFreq(0),
opMask(15),
konCycles(0),
hardReset(false),
opMaskChanged(false) {}
};
struct FMChannelStereo: public FMChannel {
unsigned char pan;
FMChannelStereo():
FMChannel(),
pan(3) {}
};
struct QueuedWrite { struct QueuedWrite {
unsigned short addr; unsigned short addr;
unsigned char val; unsigned char val;

View File

@ -27,12 +27,12 @@
#include <queue> #include <queue>
class DivPlatformGB: public DivDispatch { class DivPlatformGB: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note, ins;
unsigned char duty, sweep; unsigned char duty, sweep;
bool active, insChanged, freqChanged, sweepChanged, keyOn, keyOff, inPorta, released, softEnv, killIt; bool sweepChanged, released, softEnv, killIt;
bool soManyHacksToMakeItDefleCompatible; bool soManyHacksToMakeItDefleCompatible;
signed char vol, outVol, wave, lastKill; signed short wave;
signed char lastKill;
unsigned char envVol, envDir, envLen, soundLen; unsigned char envVol, envDir, envLen, soundLen;
unsigned short hwSeqPos; unsigned short hwSeqPos;
short hwSeqDelay; short hwSeqDelay;
@ -42,27 +42,15 @@ class DivPlatformGB: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15),
pitch(0),
pitch2(0),
note(0),
ins(-1),
duty(0), duty(0),
sweep(0), sweep(0),
active(false),
insChanged(true),
freqChanged(false),
sweepChanged(false), sweepChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
released(false), released(false),
softEnv(false), softEnv(false),
killIt(false), killIt(false),
soManyHacksToMakeItDefleCompatible(false), soManyHacksToMakeItDefleCompatible(false),
vol(15),
outVol(15),
wave(-1), wave(-1),
lastKill(0), lastKill(0),
envVol(0), envVol(0),

View File

@ -39,16 +39,8 @@ class DivPlatformGenesis: public DivPlatformOPN {
0, 1, 2, 4, 5, 6 0, 1, 2, 4, 5, 6
}; };
struct Channel { struct Channel: public FMChannelStereo {
DivInstrumentFM state; bool furnaceDac;
DivMacroInt std;
unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, portaPauseFreq, note;
int ins;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, furnaceDac, inPorta, hardReset, opMaskChanged;
int vol, outVol;
unsigned char pan, opMask;
bool dacMode; bool dacMode;
int dacPeriod; int dacPeriod;
int dacRate; int dacRate;
@ -59,34 +51,9 @@ class DivPlatformGenesis: public DivPlatformOPN {
bool dacDirection; bool dacDirection;
unsigned char sampleBank; unsigned char sampleBank;
signed char dacOutput; signed char dacOutput;
void macroInit(DivInstrument* which) {
std.init(which);
pitch2=0;
}
Channel(): Channel():
freqH(0), FMChannelStereo(),
freqL(0),
freq(0),
baseFreq(0),
pitch(0),
pitch2(0),
portaPauseFreq(0),
note(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
furnaceDac(false), furnaceDac(false),
inPorta(false),
hardReset(false),
opMaskChanged(false),
vol(0),
outVol(0),
pan(3),
opMask(15),
dacMode(false), dacMode(false),
dacPeriod(0), dacPeriod(0),
dacRate(0), dacRate(0),

View File

@ -709,7 +709,7 @@ void DivPlatformGenesisExt::reset() {
DivPlatformGenesis::reset(); DivPlatformGenesis::reset();
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
opChan[i]=DivPlatformGenesisExt::OpChannel(); opChan[i]=DivPlatformOPN::OPNOpChannelStereo();
opChan[i].std.setEngine(parent); opChan[i].std.setEngine(parent);
opChan[i].vol=127; opChan[i].vol=127;
opChan[i].outVol=127; opChan[i].outVol=127;

View File

@ -22,41 +22,7 @@
#include "genesis.h" #include "genesis.h"
class DivPlatformGenesisExt: public DivPlatformGenesis { class DivPlatformGenesisExt: public DivPlatformGenesis {
struct OpChannel { OPNOpChannelStereo opChan[4];
DivMacroInt std;
unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, portaPauseFreq, ins, note;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, mask;
int vol, outVol;
unsigned char pan;
void macroInit(DivInstrument* which) {
std.init(which);
pitch2=0;
}
OpChannel():
freqH(0),
freqL(0),
freq(0),
baseFreq(0),
pitch(0),
pitch2(0),
portaPauseFreq(0),
ins(-1),
note(0),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
inPorta(false),
mask(true),
vol(0),
outVol(0),
pan(3) {}
};
OpChannel opChan[4];
bool isOpMuted[4]; bool isOpMuted[4];
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);

View File

@ -27,58 +27,46 @@
class DivPlatformLynx: public DivDispatch { class DivPlatformLynx: public DivDispatch {
struct MikeyFreqDiv { struct MikeyFreqDiv {
uint8_t clockDivider; unsigned char clockDivider;
uint8_t backup; unsigned char backup;
MikeyFreqDiv(int frequency); MikeyFreqDiv(int frequency);
}; };
struct MikeyDuty { struct MikeyDuty {
uint8_t int_feedback7; unsigned char int_feedback7;
uint8_t feedback; unsigned char feedback;
MikeyDuty(int duty); MikeyDuty(int duty);
}; };
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
DivMacroInt std; DivMacroInt std;
MikeyFreqDiv fd; MikeyFreqDiv fd;
MikeyDuty duty; MikeyDuty duty;
int baseFreq, pitch, pitch2, note, actualNote, lfsr, ins, sample, samplePos, sampleAccum, sampleBaseFreq, sampleFreq; int actualNote, lfsr, sample, samplePos, sampleAccum, sampleBaseFreq, sampleFreq;
unsigned char pan; unsigned char pan;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, pcm; bool pcm;
signed char vol, outVol;
int macroVolMul; int macroVolMul;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
SharedChannelFreq(),
SharedChannelVolume<signed char>(127),
std(), std(),
fd(0), fd(0),
duty(0), duty(0),
baseFreq(0),
pitch(0),
pitch2(0),
note(0),
actualNote(0), actualNote(0),
lfsr(-1), lfsr(-1),
ins(-1),
sample(-1), sample(-1),
samplePos(0), samplePos(0),
sampleAccum(0), sampleAccum(0),
sampleBaseFreq(0), sampleBaseFreq(0),
sampleFreq(0), sampleFreq(0),
pan(0xff), pan(0xff),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
pcm(false), pcm(false),
vol(127),
outVol(127),
macroVolMul(127) {} macroVolMul(127) {}
}; };
Channel chan[4]; Channel chan[4];

View File

@ -24,36 +24,24 @@
#include "../macroInt.h" #include "../macroInt.h"
class DivPlatformMMC5: public DivDispatch { class DivPlatformMMC5: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, prevFreq, note, ins; int prevFreq;
unsigned char duty, sweep; unsigned char duty, sweep;
bool active, insChanged, freqChanged, sweepChanged, keyOn, keyOff, inPorta, furnaceDac; bool sweepChanged, furnaceDac;
signed char vol, outVol, wave; signed char wave;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15),
pitch(0),
pitch2(0),
prevFreq(65535), prevFreq(65535),
note(0),
ins(-1),
duty(0), duty(0),
sweep(8), sweep(8),
active(false),
insChanged(true),
freqChanged(false),
sweepChanged(false), sweepChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
furnaceDac(false), furnaceDac(false),
vol(15),
outVol(15),
wave(-1) {} wave(-1) {}
}; };
Channel chan[5]; Channel chan[5];

View File

@ -26,32 +26,17 @@
#include "sound/oki/msm5232.h" #include "sound/oki/msm5232.h"
class DivPlatformMSM5232: public DivDispatch { class DivPlatformMSM5232: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note; bool noise;
int ins;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, noise;
signed char vol, outVol;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(127),
pitch(0), noise(false) {}
pitch2(0),
note(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
noise(false),
vol(127),
outVol(127) {}
}; };
Channel chan[8]; Channel chan[8];
DivDispatchOscBuffer* oscBuf[8]; DivDispatchOscBuffer* oscBuf[8];

View File

@ -156,7 +156,6 @@ int DivPlatformMSM6258::dispatch(DivCommand c) {
//DivSample* s=parent->getSample(chan[c.chan].sample); //DivSample* s=parent->getSample(chan[c.chan].sample);
if (c.value!=DIV_NOTE_NULL) { if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].note=c.value; chan[c.chan].note=c.value;
chan[c.chan].freqChanged=true;
} }
chan[c.chan].active=true; chan[c.chan].active=true;
chan[c.chan].keyOn=true; chan[c.chan].keyOn=true;

View File

@ -26,44 +26,18 @@
class DivPlatformMSM6258: public DivDispatch { class DivPlatformMSM6258: public DivDispatch {
protected: protected:
struct Channel { struct Channel: public SharedChannel, public SharedChannelVolume<int> {
unsigned char freqH, freqL; bool furnacePCM;
int freq, baseFreq, pitch, pitch2, portaPauseFreq, note, ins;
unsigned char psgMode, autoEnvNum, autoEnvDen;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, furnacePCM, hardReset;
int vol, outVol;
int sample; int sample;
unsigned char pan; unsigned char pan;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0;
} }
Channel(): Channel():
freqH(0), SharedChannel(),
freqL(0), SharedChannelVolume<int>(8),
freq(0),
baseFreq(0),
pitch(0),
pitch2(0),
portaPauseFreq(0),
note(0),
ins(-1),
psgMode(1),
autoEnvNum(0),
autoEnvDen(0),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
inPorta(false),
furnacePCM(false), furnacePCM(false),
hardReset(false),
vol(0),
outVol(15),
sample(-1), sample(-1),
pan(3) {} pan(3) {}
}; };

View File

@ -144,7 +144,6 @@ int DivPlatformMSM6295::dispatch(DivCommand c) {
//DivSample* s=parent->getSample(chan[c.chan].sample); //DivSample* s=parent->getSample(chan[c.chan].sample);
if (c.value!=DIV_NOTE_NULL) { if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].note=c.value; chan[c.chan].note=c.value;
chan[c.chan].freqChanged=true;
} }
chan[c.chan].active=true; chan[c.chan].active=true;
chan[c.chan].keyOn=true; chan[c.chan].keyOn=true;

View File

@ -26,28 +26,17 @@
class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf { class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf {
protected: protected:
struct Channel { struct Channel: public SharedChannel, public SharedChannelVolume<int> {
int note, ins; bool furnacePCM;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, furnacePCM, hardReset;
int vol, outVol;
int sample; int sample;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
} }
Channel(): Channel():
note(0), SharedChannel(),
ins(-1), SharedChannelVolume<int>(8),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
furnacePCM(false), furnacePCM(false),
hardReset(false),
vol(8),
outVol(8),
sample(-1) {} sample(-1) {}
}; };
Channel chan[4]; Channel chan[4];

View File

@ -27,14 +27,12 @@
#include "vgsound_emu/src/n163/n163.hpp" #include "vgsound_emu/src/n163/n163.hpp"
class DivPlatformN163: public DivDispatch { class DivPlatformN163: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note; short wave, wavePos, waveLen;
short ins, wave, wavePos, waveLen;
unsigned char waveMode; unsigned char waveMode;
short loadWave, loadPos, loadLen; short loadWave, loadPos, loadLen;
unsigned char loadMode; unsigned char loadMode;
bool active, insChanged, freqChanged, volumeChanged, waveChanged, waveUpdated, keyOn, keyOff, inPorta; bool waveChanged, waveUpdated;
signed char vol, outVol, resVol;
DivMacroInt std; DivMacroInt std;
DivWaveSynth ws; DivWaveSynth ws;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
@ -42,12 +40,8 @@ class DivPlatformN163: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15),
pitch(0),
pitch2(0),
note(0),
ins(-1),
wave(-1), wave(-1),
wavePos(0), wavePos(0),
waveLen(0), waveLen(0),
@ -56,18 +50,8 @@ class DivPlatformN163: public DivDispatch {
loadPos(0), loadPos(0),
loadLen(0), loadLen(0),
loadMode(0), loadMode(0),
active(false),
insChanged(true),
freqChanged(false),
volumeChanged(false),
waveChanged(false), waveChanged(false),
waveUpdated(false), waveUpdated(false) {}
keyOn(false),
keyOff(false),
inPorta(false),
vol(15),
outVol(15),
resVol(15) {}
}; };
Channel chan[8]; Channel chan[8];
DivDispatchOscBuffer* oscBuf[8]; DivDispatchOscBuffer* oscBuf[8];

View File

@ -27,12 +27,10 @@
#include "sound/namco.h" #include "sound/namco.h"
class DivPlatformNamcoWSG: public DivDispatch { class DivPlatformNamcoWSG: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note;
int ins;
unsigned char pan; unsigned char pan;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, noise; bool noise;
signed char vol, outVol, wave; signed char wave;
DivMacroInt std; DivMacroInt std;
DivWaveSynth ws; DivWaveSynth ws;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
@ -40,22 +38,10 @@ class DivPlatformNamcoWSG: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15),
pitch(0),
pitch2(0),
note(0),
ins(-1),
pan(255), pan(255),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
noise(false), noise(false),
vol(15),
outVol(15),
wave(-1) {} wave(-1) {}
}; };
Channel chan[8]; Channel chan[8];

View File

@ -26,38 +26,26 @@
#include "sound/nes_nsfplay/nes_apu.h" #include "sound/nes_nsfplay/nes_apu.h"
class DivPlatformNES: public DivDispatch { class DivPlatformNES: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, prevFreq, note, ins; int prevFreq;
unsigned char duty, sweep, envMode, len; unsigned char duty, sweep, envMode, len;
bool active, insChanged, freqChanged, sweepChanged, keyOn, keyOff, inPorta, furnaceDac; bool sweepChanged, furnaceDac;
signed char vol, outVol, wave; signed char wave;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15),
pitch(0),
pitch2(0),
prevFreq(65535), prevFreq(65535),
note(0),
ins(-1),
duty(0), duty(0),
sweep(8), sweep(8),
envMode(3), envMode(3),
len(0x1f), len(0x1f),
active(false),
insChanged(true),
freqChanged(false),
sweepChanged(false), sweepChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
furnaceDac(false), furnaceDac(false),
vol(15),
outVol(15),
wave(-1) {} wave(-1) {}
}; };
Channel chan[5]; Channel chan[5];

View File

@ -36,13 +36,12 @@ class DivOPLAInterface: public ymfm::ymfm_interface {
class DivPlatformOPL: public DivDispatch { class DivPlatformOPL: public DivDispatch {
protected: protected:
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
DivInstrumentFM state; DivInstrumentFM state;
DivMacroInt std; DivMacroInt std;
unsigned char freqH, freqL; unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, note, ins, sample, fixedFreq; int sample, fixedFreq;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, furnacePCM, inPorta, fourOp, hardReset; bool furnacePCM, fourOp, hardReset;
int vol, outVol;
unsigned char pan; unsigned char pan;
int macroVolMul; int macroVolMul;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
@ -50,27 +49,15 @@ class DivPlatformOPL: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
SharedChannelFreq(),
SharedChannelVolume<int>(0),
freqH(0), freqH(0),
freqL(0), freqL(0),
freq(0),
baseFreq(0),
pitch(0),
pitch2(0),
note(0),
ins(-1),
sample(-1), sample(-1),
fixedFreq(0), fixedFreq(0),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
furnacePCM(false), furnacePCM(false),
inPorta(false),
fourOp(false), fourOp(false),
hardReset(false), hardReset(false),
vol(0),
pan(3), pan(3),
macroVolMul(64) { macroVolMul(64) {
state.ops=2; state.ops=2;

View File

@ -29,37 +29,24 @@ extern "C" {
class DivPlatformOPLL: public DivDispatch { class DivPlatformOPLL: public DivDispatch {
protected: protected:
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
DivInstrumentFM state; DivInstrumentFM state;
DivMacroInt std; DivMacroInt std;
unsigned char freqH, freqL; unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, note, ins, fixedFreq; int fixedFreq;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, furnaceDac, inPorta; bool furnaceDac;
int vol, outVol;
unsigned char pan; unsigned char pan;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
SharedChannelFreq(),
SharedChannelVolume<int>(0),
freqH(0), freqH(0),
freqL(0), freqL(0),
freq(0),
baseFreq(0),
pitch(0),
pitch2(0),
note(0),
ins(-1),
fixedFreq(0), fixedFreq(0),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
furnaceDac(false), furnaceDac(false),
inPorta(false),
vol(0),
pan(3) {} pan(3) {}
}; };
Channel chan[11]; Channel chan[11];

View File

@ -27,14 +27,14 @@
#include "sound/pce_psg.h" #include "sound/pce_psg.h"
class DivPlatformPCE: public DivDispatch { class DivPlatformPCE: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note, antiClickPeriodCount, antiClickWavePos; int antiClickPeriodCount, antiClickWavePos;
int dacPeriod, dacRate, dacOut; int dacPeriod, dacRate, dacOut;
unsigned int dacPos; unsigned int dacPos;
int dacSample, ins; int dacSample;
unsigned char pan; unsigned char pan;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, noise, pcm, furnaceDac, deferredWaveUpdate; bool noise, pcm, furnaceDac, deferredWaveUpdate;
signed char vol, outVol, wave; signed short wave;
int macroVolMul; int macroVolMul;
DivMacroInt std; DivMacroInt std;
DivWaveSynth ws; DivWaveSynth ws;
@ -43,11 +43,8 @@ class DivPlatformPCE: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(31),
pitch(0),
pitch2(0),
note(0),
antiClickPeriodCount(0), antiClickPeriodCount(0),
antiClickWavePos(0), antiClickWavePos(0),
dacPeriod(0), dacPeriod(0),
@ -55,20 +52,11 @@ class DivPlatformPCE: public DivDispatch {
dacOut(0), dacOut(0),
dacPos(0), dacPos(0),
dacSample(-1), dacSample(-1),
ins(-1),
pan(255), pan(255),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
noise(false), noise(false),
pcm(false), pcm(false),
furnaceDac(false), furnaceDac(false),
deferredWaveUpdate(false), deferredWaveUpdate(false),
vol(31),
outVol(31),
wave(-1), wave(-1),
macroVolMul(31) {} macroVolMul(31) {}
}; };

View File

@ -26,17 +26,15 @@
#include "../waveSynth.h" #include "../waveSynth.h"
class DivPlatformPCMDAC: public DivDispatch { class DivPlatformPCMDAC: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq {
int freq, baseFreq, pitch, pitch2;
bool audDir; bool audDir;
unsigned int audLoc; unsigned int audLoc;
unsigned short audLen; unsigned short audLen;
int audPos; int audPos;
int audSub; int audSub;
int sample, wave, ins; int sample, wave;
int note;
int panL, panR; int panL, panR;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, useWave, setPos; bool useWave, setPos;
int vol, envVol; int vol, envVol;
DivMacroInt std; DivMacroInt std;
DivWaveSynth ws; DivWaveSynth ws;
@ -45,10 +43,7 @@ class DivPlatformPCMDAC: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0),
pitch(0),
pitch2(0),
audDir(false), audDir(false),
audLoc(0), audLoc(0),
audLen(0), audLen(0),
@ -56,16 +51,8 @@ class DivPlatformPCMDAC: public DivDispatch {
audSub(0), audSub(0),
sample(-1), sample(-1),
wave(-1), wave(-1),
ins(-1),
note(0),
panL(255), panL(255),
panR(255), panR(255),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
useWave(false), useWave(false),
setPos(false), setPos(false),
vol(255), vol(255),

View File

@ -28,36 +28,15 @@
#include <condition_variable> #include <condition_variable>
class DivPlatformPCSpeaker: public DivDispatch { class DivPlatformPCSpeaker: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note, ins;
unsigned char duty, sweep;
bool active, insChanged, freqChanged, sweepChanged, keyOn, keyOff, inPorta, furnaceDac;
signed char vol, outVol, wave;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15) {}
pitch(0),
pitch2(0),
note(0),
ins(-1),
duty(0),
sweep(8),
active(false),
insChanged(true),
freqChanged(false),
sweepChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
furnaceDac(false),
vol(15),
outVol(15),
wave(-1) {}
}; };
Channel chan[1]; Channel chan[1];
DivDispatchOscBuffer* oscBuf; DivDispatchOscBuffer* oscBuf;

View File

@ -24,10 +24,9 @@
#include "../macroInt.h" #include "../macroInt.h"
class DivPlatformPET: public DivDispatch { class DivPlatformPET: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
int freq, baseFreq, pitch, pitch2, note, ins; bool enable;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, enable; int wave;
int vol, outVol, wave;
unsigned char sreg; unsigned char sreg;
int cnt; int cnt;
short out; short out;
@ -37,21 +36,9 @@ class DivPlatformPET: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<int>(1),
pitch(0),
pitch2(0),
note(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
enable(false), enable(false),
vol(1),
outVol(1),
wave(0b00001111), wave(0b00001111),
sreg(0), sreg(0),
cnt(0), cnt(0),

View File

@ -24,36 +24,15 @@
#include "../macroInt.h" #include "../macroInt.h"
class DivPlatformPong: public DivDispatch { class DivPlatformPong: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note, ins;
unsigned char duty, sweep;
bool active, insChanged, freqChanged, sweepChanged, keyOn, keyOff, inPorta, furnaceDac;
signed char vol, outVol, wave;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(1) {}
pitch(0),
pitch2(0),
note(0),
ins(-1),
duty(0),
sweep(8),
active(false),
insChanged(true),
freqChanged(false),
sweepChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
furnaceDac(false),
vol(1),
outVol(1),
wave(-1) {}
}; };
Channel chan[1]; Channel chan[1];
DivDispatchOscBuffer* oscBuf; DivDispatchOscBuffer* oscBuf;

View File

@ -26,41 +26,25 @@
#include "sound/qsound.h" #include "sound/qsound.h"
class DivPlatformQSound: public DivDispatch { class DivPlatformQSound: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
int freq, baseFreq, pitch, pitch2; int sample, wave;
int sample, wave, ins;
int note;
int panning; int panning;
int echo; int echo;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, useWave, surround, isNewQSound; bool useWave, surround, isNewQSound;
int vol, outVol, resVol;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<int>(4095),
pitch(0),
pitch2(0),
sample(-1), sample(-1),
ins(-1),
note(0),
panning(0x10), panning(0x10),
echo(0), echo(0),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
useWave(false), useWave(false),
surround(true), surround(true),
isNewQSound(false), isNewQSound(false) {}
vol(255),
outVol(255),
resVol(4096) {}
}; };
Channel chan[19]; Channel chan[19];
DivDispatchOscBuffer* oscBuf[19]; DivDispatchOscBuffer* oscBuf[19];

View File

@ -26,14 +26,11 @@
#include "sound/rf5c68.h" #include "sound/rf5c68.h"
class DivPlatformRF5C68: public DivDispatch { class DivPlatformRF5C68: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
int freq, baseFreq, pitch, pitch2;
unsigned int audPos; unsigned int audPos;
int sample, wave, ins; int sample, wave;
int note;
int panning; int panning;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, setPos; bool setPos;
int vol, outVol;
int macroVolMul; int macroVolMul;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
@ -41,24 +38,12 @@ class DivPlatformRF5C68: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<int>(255),
pitch(0),
pitch2(0),
audPos(0), audPos(0),
sample(-1), sample(-1),
ins(-1),
note(0),
panning(255), panning(255),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
setPos(false), setPos(false),
vol(255),
outVol(255),
macroVolMul(64) {} macroVolMul(64) {}
}; };
Channel chan[8]; Channel chan[8];

View File

@ -26,20 +26,22 @@
class DivPlatformSAA1099: public DivDispatch { class DivPlatformSAA1099: public DivDispatch {
protected: protected:
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
unsigned char freqH, freqL; unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, note, ins;
unsigned char psgMode; unsigned char psgMode;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta;
int vol, outVol;
unsigned char pan; unsigned char pan;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): freqH(0), freqL(0), freq(0), baseFreq(0), pitch(0), pitch2(0), note(0), ins(-1), psgMode(1), active(false), insChanged(true), freqChanged(false), keyOn(false), keyOff(false), portaPause(false), inPorta(false), vol(0), outVol(15), pan(255) {} Channel():
SharedChannelFreq(),
SharedChannelVolume<int>(15),
freqH(0),
freqL(0),
psgMode(1),
pan(255) {}
}; };
Channel chan[6]; Channel chan[6];
DivDispatchOscBuffer* oscBuf[6]; DivDispatchOscBuffer* oscBuf[6];

View File

@ -27,11 +27,10 @@
#include "vgsound_emu/src/scc/scc.hpp" #include "vgsound_emu/src/scc/scc.hpp"
class DivPlatformSCC: public DivDispatch { class DivPlatformSCC: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note, ins; bool freqInit;
bool active, insChanged, freqChanged, freqInit, inPorta; signed short wave;
signed char vol, outVol, wave; signed char waveROM[32] = {0}; // 8 bit signed waveform
signed char waveROM[32] = {0}; // 4 bit PROM per channel on bubble system
DivMacroInt std; DivMacroInt std;
DivWaveSynth ws; DivWaveSynth ws;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
@ -39,19 +38,9 @@ class DivPlatformSCC: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15),
pitch(0),
pitch2(0),
note(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
freqInit(false), freqInit(false),
inPorta(false),
vol(15),
outVol(15),
wave(-1) {} wave(-1) {}
}; };
Channel chan[5]; Channel chan[5];

View File

@ -26,11 +26,9 @@
class DivPlatformSegaPCM: public DivDispatch { class DivPlatformSegaPCM: public DivDispatch {
protected: protected:
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
DivMacroInt std; DivMacroInt std;
int freq, baseFreq, pitch, pitch2, note, ins; bool furnacePCM, isNewSegaPCM;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, portaPause, furnacePCM, isNewSegaPCM;
int vol, outVol;
unsigned char chVolL, chVolR; unsigned char chVolL, chVolR;
unsigned char chPanL, chPanR; unsigned char chPanL, chPanR;
int macroVolMul; int macroVolMul;
@ -47,23 +45,10 @@ class DivPlatformSegaPCM: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<int>(127),
pitch(0),
pitch2(0),
note(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
portaPause(false),
furnacePCM(false), furnacePCM(false),
isNewSegaPCM(false), isNewSegaPCM(false),
vol(0),
outVol(0),
chVolL(127), chVolL(127),
chVolR(127), chVolR(127),
chPanL(127), chPanL(127),

View File

@ -29,32 +29,19 @@ extern "C" {
#include <queue> #include <queue>
class DivPlatformSMS: public DivDispatch { class DivPlatformSMS: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note, actualNote, ins; int actualNote;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, writeVol; bool writeVol;
signed char vol, outVol;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15),
pitch(0),
pitch2(0),
note(0),
actualNote(0), actualNote(0),
ins(-1), writeVol(false) {}
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
writeVol(false),
vol(15),
outVol(15) {}
}; };
Channel chan[4]; Channel chan[4];
DivDispatchOscBuffer* oscBuf[4]; DivDispatchOscBuffer* oscBuf[4];

View File

@ -27,14 +27,11 @@
#include "sound/snes/SPC_DSP.h" #include "sound/snes/SPC_DSP.h"
class DivPlatformSNES: public DivDispatch { class DivPlatformSNES: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
int freq, baseFreq, pitch, pitch2;
unsigned int audPos; unsigned int audPos;
int sample, wave, ins; int sample, wave;
int note;
int panL, panR; int panL, panR;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, useWave, setPos, noise, echo, pitchMod, invertL, invertR, shallWriteVol, shallWriteEnv; bool useWave, setPos, noise, echo, pitchMod, invertL, invertR, shallWriteVol, shallWriteEnv;
int vol, outVol;
int wtLen; int wtLen;
DivInstrumentSNES state; DivInstrumentSNES state;
DivMacroInt std; DivMacroInt std;
@ -44,23 +41,13 @@ class DivPlatformSNES: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<int>(127),
pitch(0),
pitch2(0),
audPos(0), audPos(0),
sample(-1), sample(-1),
wave(-1), wave(-1),
ins(-1),
note(0),
panL(127), panL(127),
panR(127), panR(127),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
useWave(false), useWave(false),
setPos(false), setPos(false),
noise(false), noise(false),
@ -70,8 +57,6 @@ class DivPlatformSNES: public DivDispatch {
invertR(false), invertR(false),
shallWriteVol(false), shallWriteVol(false),
shallWriteEnv(false), shallWriteEnv(false),
vol(127),
outVol(127),
wtLen(16) {} wtLen(16) {}
}; };
Channel chan[8]; Channel chan[8];

View File

@ -26,30 +26,25 @@
#include "sound/su.h" #include "sound/su.h"
class DivPlatformSoundUnit: public DivDispatch { class DivPlatformSoundUnit: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note; int cutoff, baseCutoff, res, control, hasOffset;
int ins, cutoff, baseCutoff, res, control, hasOffset;
signed char pan; signed char pan;
unsigned char duty; unsigned char duty;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, noise, pcm, phaseReset, filterPhaseReset, switchRoles; bool noise, pcm, phaseReset, filterPhaseReset, switchRoles;
bool pcmLoop, timerSync, freqSweep, volSweep, cutSweep; bool pcmLoop, timerSync, freqSweep, volSweep, cutSweep;
unsigned short freqSweepP, volSweepP, cutSweepP; unsigned short freqSweepP, volSweepP, cutSweepP;
unsigned char freqSweepB, volSweepB, cutSweepB; unsigned char freqSweepB, volSweepB, cutSweepB;
unsigned char freqSweepV, volSweepV, cutSweepV; unsigned char freqSweepV, volSweepV, cutSweepV;
unsigned short syncTimer; unsigned short syncTimer;
signed char vol, outVol, wave; signed short wave;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(127),
pitch(0),
pitch2(0),
note(0),
ins(-1),
cutoff(16383), cutoff(16383),
baseCutoff(16380), baseCutoff(16380),
res(0), res(0),
@ -57,12 +52,6 @@ class DivPlatformSoundUnit: public DivDispatch {
hasOffset(0), hasOffset(0),
pan(0), pan(0),
duty(63), duty(63),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
noise(false), noise(false),
pcm(false), pcm(false),
phaseReset(false), phaseReset(false),
@ -83,8 +72,6 @@ class DivPlatformSoundUnit: public DivDispatch {
volSweepV(0), volSweepV(0),
cutSweepV(0), cutSweepV(0),
syncTimer(0), syncTimer(0),
vol(127),
outVol(127),
wave(0) {} wave(0) {}
}; };
Channel chan[8]; Channel chan[8];

View File

@ -27,11 +27,9 @@
#include <queue> #include <queue>
class DivPlatformSwan: public DivDispatch { class DivPlatformSwan: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
int freq, baseFreq, pitch, pitch2, note, ins;
unsigned char pan; unsigned char pan;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta; int wave;
int vol, outVol, wave;
DivMacroInt std; DivMacroInt std;
DivWaveSynth ws; DivWaveSynth ws;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
@ -39,21 +37,9 @@ class DivPlatformSwan: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<int>(15),
pitch(0),
pitch2(0),
note(0),
ins(-1),
pan(255), pan(255),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
vol(15),
outVol(15),
wave(-1) {} wave(-1) {}
}; };
Channel chan[4]; Channel chan[4];

View File

@ -26,35 +26,19 @@
#include "sound/t6w28/T6W28_Apu.h" #include "sound/t6w28/T6W28_Apu.h"
class DivPlatformT6W28: public DivDispatch { class DivPlatformT6W28: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note;
int ins;
unsigned char panL, panR, duty; unsigned char panL, panR, duty;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta;
signed char vol, outVol;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15),
pitch(0),
pitch2(0),
note(0),
ins(-1),
panL(15), panL(15),
panR(15), panR(15),
duty(7), duty(7) {}
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
vol(15),
outVol(15) {}
}; };
Channel chan[4]; Channel chan[4];
DivDispatchOscBuffer* oscBuf[4]; DivDispatchOscBuffer* oscBuf[4];

View File

@ -26,18 +26,17 @@
class DivPlatformTIA: public DivDispatch { class DivPlatformTIA: public DivDispatch {
protected: protected:
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
int freq, baseFreq, pitch, pitch2, note, ins;
unsigned char shape; unsigned char shape;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta;
int vol, outVol;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): freq(0), baseFreq(0), pitch(0), pitch2(0), note(0), ins(-1), shape(4), active(false), insChanged(true), freqChanged(false), keyOn(false), keyOff(false), portaPause(false), inPorta(false), vol(0), outVol(15) {} Channel():
SharedChannelFreq(),
SharedChannelVolume<int>(15),
shape(4) {}
}; };
Channel chan[2]; Channel chan[2];
DivDispatchOscBuffer* oscBuf[2]; DivDispatchOscBuffer* oscBuf[2];

View File

@ -20,8 +20,6 @@
#ifndef _TX81Z_H #ifndef _TX81Z_H
#define _TX81Z_H #define _TX81Z_H
#include "fmshared_OPM.h" #include "fmshared_OPM.h"
#include "../macroInt.h"
#include "../instrument.h"
#include <queue> #include <queue>
#include "sound/ymfm/ymfm_opz.h" #include "sound/ymfm/ymfm_opz.h"
@ -35,41 +33,12 @@ class DivPlatformTX81Z: public DivPlatformOPM {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
}; };
struct Channel { struct Channel: public FMChannel {
DivInstrumentFM state;
DivMacroInt std;
unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, note, ins;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, portaPause, furnacePCM, hardReset;
int vol, outVol;
unsigned char chVolL, chVolR; unsigned char chVolL, chVolR;
void macroInit(DivInstrument* which) {
std.init(which);
pitch2=0;
}
Channel(): Channel():
freqH(0), FMChannel(),
freqL(0), chVolL(1),
freq(0), chVolR(1) {}
baseFreq(0),
pitch(0),
pitch2(0),
note(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
portaPause(false),
furnacePCM(false),
hardReset(false),
vol(0),
outVol(0),
chVolL(127),
chVolR(127) {}
}; };
Channel chan[8]; Channel chan[8];
DivDispatchOscBuffer* oscBuf[8]; DivDispatchOscBuffer* oscBuf[8];

View File

@ -27,12 +27,10 @@
#include "sound/vsu.h" #include "sound/vsu.h"
class DivPlatformVB: public DivDispatch { class DivPlatformVB: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note;
int ins;
unsigned char pan, envLow, envHigh; unsigned char pan, envLow, envHigh;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, noise, deferredWaveUpdate; bool noise, deferredWaveUpdate;
signed char vol, outVol, wave; signed short wave;
DivMacroInt std; DivMacroInt std;
DivWaveSynth ws; DivWaveSynth ws;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
@ -40,25 +38,13 @@ class DivPlatformVB: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15),
pitch(0),
pitch2(0),
note(0),
ins(-1),
pan(255), pan(255),
envLow(0), envLow(0),
envHigh(0), envHigh(0),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
noise(false), noise(false),
deferredWaveUpdate(false), deferredWaveUpdate(false),
vol(15),
outVol(15),
wave(-1) {} wave(-1) {}
}; };
Channel chan[6]; Channel chan[6];

View File

@ -28,11 +28,8 @@ struct VERA_PCM;
class DivPlatformVERA: public DivDispatch { class DivPlatformVERA: public DivDispatch {
protected: protected:
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
int freq, baseFreq, pitch, pitch2, note, ins;
unsigned char pan; unsigned char pan;
bool active, freqChanged, inPorta;
int vol, outVol;
unsigned accum; unsigned accum;
int noiseval; int noiseval;
DivMacroInt std; DivMacroInt std;
@ -50,7 +47,13 @@ class DivPlatformVERA: public DivDispatch {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): freq(0), baseFreq(0), pitch(0), pitch2(0), note(0), ins(-1), pan(0), active(false), freqChanged(false), inPorta(false), vol(0), outVol(0), accum(0), noiseval(0) {} Channel():
SharedChannelFreq(),
SharedChannelVolume<int>(0),
pan(0),
accum(0),
noiseval(0),
pcm(PCMChannel()) {}
}; };
Channel chan[17]; Channel chan[17];
DivDispatchOscBuffer* oscBuf[17]; DivDispatchOscBuffer* oscBuf[17];

View File

@ -26,32 +26,16 @@
#include <queue> #include <queue>
class DivPlatformVIC20: public DivDispatch { class DivPlatformVIC20: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
int freq, baseFreq, pitch, pitch2, note, ins; int wave, waveWriteCycle;
unsigned char pan;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta;
int vol, outVol, wave, waveWriteCycle;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<int>(15),
pitch(0),
pitch2(0),
note(0),
ins(-1),
pan(255),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
vol(15),
outVol(15),
wave(0), wave(0),
waveWriteCycle(-1) {} waveWriteCycle(-1) {}
}; };

View File

@ -27,42 +27,28 @@
class DivPlatformVRC6: public DivDispatch, public vrcvi_intf { class DivPlatformVRC6: public DivDispatch, public vrcvi_intf {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note;
int dacPeriod, dacRate, dacOut; int dacPeriod, dacRate, dacOut;
unsigned int dacPos; unsigned int dacPos;
int dacSample, ins; int dacSample;
unsigned char duty; unsigned char duty;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, pcm, furnaceDac; bool pcm, furnaceDac;
signed char vol, outVol;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(15),
pitch(0),
pitch2(0),
note(0),
dacPeriod(0), dacPeriod(0),
dacRate(0), dacRate(0),
dacOut(0), dacOut(0),
dacPos(0), dacPos(0),
dacSample(-1), dacSample(-1),
ins(-1),
duty(0), duty(0),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
pcm(false), pcm(false),
furnaceDac(false), furnaceDac(false) {}
vol(15),
outVol(15) {}
}; };
Channel chan[3]; Channel chan[3];
DivDispatchOscBuffer* oscBuf[3]; DivDispatchOscBuffer* oscBuf[3];

View File

@ -27,7 +27,7 @@
#include "vgsound_emu/src/x1_010/x1_010.hpp" #include "vgsound_emu/src/x1_010/x1_010.hpp"
class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf { class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
struct Envelope { struct Envelope {
struct EnvFlag { struct EnvFlag {
unsigned char envEnable : 1; unsigned char envEnable : 1;
@ -68,11 +68,11 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf {
slide(0), slide(0),
slidefrac(0) {} slidefrac(0) {}
}; };
int freq, baseFreq, fixedFreq, pitch, pitch2, note; int fixedFreq;
int wave, sample, ins; int wave, sample;
unsigned char pan, autoEnvNum, autoEnvDen; unsigned char pan, autoEnvNum, autoEnvDen;
bool active, insChanged, envChanged, freqChanged, keyOn, keyOff, inPorta, furnacePCM, pcm; bool envChanged, furnacePCM, pcm;
int vol, outVol, lvol, rvol; int lvol, rvol;
int macroVolMul; int macroVolMul;
unsigned char waveBank; unsigned char waveBank;
unsigned int bankSlot; unsigned int bankSlot;
@ -80,26 +80,34 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf {
DivMacroInt std; DivMacroInt std;
DivWaveSynth ws; DivWaveSynth ws;
void reset() { void reset() {
freq = baseFreq = pitch = pitch2 = note = 0; freq=baseFreq=pitch=pitch2=note=0;
wave = sample = ins = -1; wave=sample=ins=-1;
pan = 255; pan=255;
autoEnvNum = autoEnvDen = 0; autoEnvNum=autoEnvDen=0;
active = false; active=false;
insChanged = envChanged = freqChanged = true; insChanged=envChanged=freqChanged=true;
keyOn = keyOff = inPorta = furnacePCM = pcm = false; keyOn=keyOff=inPorta=furnacePCM=pcm=false;
vol = outVol = lvol = rvol = 15; vol=outVol=lvol=rvol=15;
waveBank = 0; waveBank=0;
} }
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
std.init(which); std.init(which);
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), baseFreq(0), fixedFreq(0), pitch(0), pitch2(0), note(0), SharedChannelFreq(),
wave(-1), sample(-1), ins(-1), SharedChannelVolume<int>(15),
pan(255), autoEnvNum(0), autoEnvDen(0), fixedFreq(0),
active(false), insChanged(true), envChanged(true), freqChanged(false), keyOn(false), keyOff(false), inPorta(false), furnacePCM(false), pcm(false), wave(-1),
vol(15), outVol(15), lvol(15), rvol(15), sample(-1),
pan(255),
autoEnvNum(0),
autoEnvDen(0),
envChanged(true),
furnacePCM(false),
pcm(false),
lvol(15),
rvol(15),
macroVolMul(15), macroVolMul(15),
waveBank(0), waveBank(0),
bankSlot(0) {} bankSlot(0) {}

View File

@ -851,7 +851,7 @@ void DivPlatformYM2203::reset() {
} }
fm->reset(); fm->reset();
for (int i=0; i<6; i++) { for (int i=0; i<6; i++) {
chan[i]=DivPlatformYM2203::Channel(); chan[i]=DivPlatformOPN::OPNChannel();
chan[i].std.setEngine(parent); chan[i].std.setEngine(parent);
} }
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {

View File

@ -20,7 +20,6 @@
#ifndef _YM2203_H #ifndef _YM2203_H
#define _YM2203_H #define _YM2203_H
#include "fmshared_OPN.h" #include "fmshared_OPN.h"
#include "../macroInt.h"
#include "sound/ymfm/ymfm_opn.h" #include "sound/ymfm/ymfm_opn.h"
#include "ay.h" #include "ay.h"
@ -39,49 +38,7 @@ class DivPlatformYM2203: public DivPlatformOPN {
0, 1, 2 0, 1, 2
}; };
struct Channel { OPNChannel chan[6];
DivInstrumentFM state;
unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, portaPauseFreq, note, ins;
unsigned char psgMode, autoEnvNum, autoEnvDen, opMask;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, furnacePCM, hardReset, opMaskChanged;
int vol, outVol;
int sample;
DivMacroInt std;
void macroInit(DivInstrument* which) {
std.init(which);
pitch2=0;
}
Channel():
freqH(0),
freqL(0),
freq(0),
baseFreq(0),
pitch(0),
pitch2(0),
portaPauseFreq(0),
note(0),
ins(-1),
psgMode(1),
autoEnvNum(0),
autoEnvDen(0),
opMask(15),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
inPorta(false),
furnacePCM(false),
hardReset(false),
opMaskChanged(false),
vol(0),
outVol(15),
sample(-1) {}
};
Channel chan[6];
DivDispatchOscBuffer* oscBuf[6]; DivDispatchOscBuffer* oscBuf[6];
bool isMuted[6]; bool isMuted[6];
ymfm::ym2203* fm; ymfm::ym2203* fm;

View File

@ -483,7 +483,7 @@ void DivPlatformYM2203Ext::reset() {
DivPlatformYM2203::reset(); DivPlatformYM2203::reset();
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
opChan[i]=DivPlatformYM2203Ext::OpChannel(); opChan[i]=DivPlatformOPN::OPNOpChannel();
opChan[i].vol=127; opChan[i].vol=127;
} }

View File

@ -22,34 +22,7 @@
#include "ym2203.h" #include "ym2203.h"
class DivPlatformYM2203Ext: public DivPlatformYM2203 { class DivPlatformYM2203Ext: public DivPlatformYM2203 {
struct OpChannel { OPNOpChannel opChan[4];
DivMacroInt std;
unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, portaPauseFreq, ins;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, mask;
int vol;
// UGLY
OpChannel():
freqH(0),
freqL(0),
freq(0),
baseFreq(0),
pitch(0),
pitch2(0),
portaPauseFreq(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
inPorta(false),
mask(true),
vol(0) {}
};
OpChannel opChan[4];
bool isOpMuted[4]; bool isOpMuted[4];
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);

View File

@ -1245,7 +1245,7 @@ void DivPlatformYM2608::reset() {
} }
fm->reset(); fm->reset();
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
chan[i]=DivPlatformYM2608::Channel(); chan[i]=DivPlatformOPN::OPNChannelStereo();
chan[i].std.setEngine(parent); chan[i].std.setEngine(parent);
} }
for (int i=0; i<6; i++) { for (int i=0; i<6; i++) {

View File

@ -20,7 +20,6 @@
#ifndef _YM2608_H #ifndef _YM2608_H
#define _YM2608_H #define _YM2608_H
#include "fmshared_OPN.h" #include "fmshared_OPN.h"
#include "../macroInt.h"
#include "sound/ymfm/ymfm_opn.h" #include "sound/ymfm/ymfm_opn.h"
#include "ay.h" #include "ay.h"
@ -44,53 +43,7 @@ class DivPlatformYM2608: public DivPlatformOPN {
0, 1, 2, 4, 5, 6 0, 1, 2, 4, 5, 6
}; };
struct Channel { OPNChannelStereo chan[16];
DivInstrumentFM state;
unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, portaPauseFreq, note, ins;
unsigned char psgMode, autoEnvNum, autoEnvDen, opMask;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, furnacePCM, hardReset, opMaskChanged;
int vol, outVol;
int sample;
unsigned char pan;
int macroVolMul;
DivMacroInt std;
void macroInit(DivInstrument* which) {
std.init(which);
pitch2=0;
}
Channel():
freqH(0),
freqL(0),
freq(0),
baseFreq(0),
pitch(0),
pitch2(0),
portaPauseFreq(0),
note(0),
ins(-1),
psgMode(1),
autoEnvNum(0),
autoEnvDen(0),
opMask(15),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
inPorta(false),
furnacePCM(false),
hardReset(false),
opMaskChanged(false),
vol(0),
outVol(15),
sample(-1),
pan(3),
macroVolMul(255) {}
};
Channel chan[16];
DivDispatchOscBuffer* oscBuf[16]; DivDispatchOscBuffer* oscBuf[16];
bool isMuted[16]; bool isMuted[16];
ymfm::ym2608* fm; ymfm::ym2608* fm;

View File

@ -519,7 +519,7 @@ void DivPlatformYM2608Ext::reset() {
DivPlatformYM2608::reset(); DivPlatformYM2608::reset();
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
opChan[i]=DivPlatformYM2608Ext::OpChannel(); opChan[i]=DivPlatformOPN::OPNOpChannelStereo();
opChan[i].vol=127; opChan[i].vol=127;
} }

View File

@ -22,36 +22,7 @@
#include "ym2608.h" #include "ym2608.h"
class DivPlatformYM2608Ext: public DivPlatformYM2608 { class DivPlatformYM2608Ext: public DivPlatformYM2608 {
struct OpChannel { OPNOpChannelStereo opChan[4];
DivMacroInt std;
unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, portaPauseFreq, ins;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, mask;
int vol;
unsigned char pan;
// UGLY
OpChannel():
freqH(0),
freqL(0),
freq(0),
baseFreq(0),
pitch(0),
pitch2(0),
portaPauseFreq(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
inPorta(false),
mask(true),
vol(0),
pan(3) {}
};
OpChannel opChan[4];
bool isOpMuted[4]; bool isOpMuted[4];
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);

View File

@ -1213,7 +1213,7 @@ void DivPlatformYM2610::reset() {
} }
fm->reset(); fm->reset();
for (int i=0; i<14; i++) { for (int i=0; i<14; i++) {
chan[i]=DivPlatformYM2610::Channel(); chan[i]=DivPlatformOPN::OPNChannelStereo();
chan[i].std.setEngine(parent); chan[i].std.setEngine(parent);
} }
for (int i=0; i<psgChanOffs; i++) { for (int i=0; i<psgChanOffs; i++) {

View File

@ -1276,7 +1276,7 @@ void DivPlatformYM2610B::reset() {
} }
fm->reset(); fm->reset();
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
chan[i]=DivPlatformYM2610B::Channel(); chan[i]=DivPlatformOPN::OPNChannelStereo();
chan[i].std.setEngine(parent); chan[i].std.setEngine(parent);
} }
for (int i=0; i<psgChanOffs; i++) { for (int i=0; i<psgChanOffs; i++) {

View File

@ -510,7 +510,7 @@ void DivPlatformYM2610BExt::reset() {
DivPlatformYM2610B::reset(); DivPlatformYM2610B::reset();
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
opChan[i]=DivPlatformYM2610BExt::OpChannel(); opChan[i]=DivPlatformOPN::OPNOpChannelStereo();
opChan[i].vol=127; opChan[i].vol=127;
} }

View File

@ -22,7 +22,7 @@
#include "ym2610b.h" #include "ym2610b.h"
class DivPlatformYM2610BExt: public DivPlatformYM2610B { class DivPlatformYM2610BExt: public DivPlatformYM2610B {
DivPlatformYM2610Base::OpChannel opChan[4]; OPNOpChannelStereo opChan[4];
bool isOpMuted[4]; bool isOpMuted[4];
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);

View File

@ -510,7 +510,7 @@ void DivPlatformYM2610Ext::reset() {
DivPlatformYM2610::reset(); DivPlatformYM2610::reset();
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
opChan[i]=DivPlatformYM2610Ext::OpChannel(); opChan[i]=DivPlatformOPN::OPNOpChannelStereo();
opChan[i].vol=127; opChan[i].vol=127;
} }

View File

@ -22,7 +22,7 @@
#include "ym2610.h" #include "ym2610.h"
class DivPlatformYM2610Ext: public DivPlatformYM2610 { class DivPlatformYM2610Ext: public DivPlatformYM2610 {
DivPlatformYM2610Base::OpChannel opChan[4]; OPNOpChannelStereo opChan[4];
bool isOpMuted[4]; bool isOpMuted[4];
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);
friend void putDispatchChan(void*,int,int); friend void putDispatchChan(void*,int,int);

View File

@ -20,7 +20,6 @@
#ifndef _YM2610SHARED_H #ifndef _YM2610SHARED_H
#define _YM2610SHARED_H #define _YM2610SHARED_H
#include "fmshared_OPN.h" #include "fmshared_OPN.h"
#include "../macroInt.h"
#include "../engine.h" #include "../engine.h"
#include "../../ta-log.h" #include "../../ta-log.h"
#include "ay.h" #include "ay.h"
@ -46,83 +45,7 @@ class DivYM2610Interface: public ymfm::ymfm_interface {
template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN { template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
protected: protected:
struct Channel { OPNChannelStereo chan[ChanNum];
DivInstrumentFM state;
unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, portaPauseFreq, note, ins;
unsigned char psgMode, autoEnvNum, autoEnvDen;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, furnacePCM, hardReset, opMaskChanged;
int vol, outVol;
int sample;
unsigned char pan, opMask;
int macroVolMul;
DivMacroInt std;
void macroInit(DivInstrument* which) {
std.init(which);
pitch2=0;
}
Channel():
freqH(0),
freqL(0),
freq(0),
baseFreq(0),
pitch(0),
pitch2(0),
portaPauseFreq(0),
note(0),
ins(-1),
psgMode(1),
autoEnvNum(0),
autoEnvDen(0),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
inPorta(false),
furnacePCM(false),
hardReset(false),
opMaskChanged(false),
vol(0),
outVol(15),
sample(-1),
pan(3),
opMask(15),
macroVolMul(255) {}
};
struct OpChannel {
DivMacroInt std;
unsigned char freqH, freqL;
int freq, baseFreq, pitch, pitch2, portaPauseFreq, ins;
signed char konCycles;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta, mask;
int vol;
unsigned char pan;
// UGLY
OpChannel():
freqH(0),
freqL(0),
freq(0),
baseFreq(0),
pitch(0),
pitch2(0),
portaPauseFreq(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
inPorta(false),
mask(true),
vol(0),
pan(3) {}
};
Channel chan[ChanNum];
DivDispatchOscBuffer* oscBuf[ChanNum]; DivDispatchOscBuffer* oscBuf[ChanNum];
bool isMuted[ChanNum]; bool isMuted[ChanNum];

View File

@ -26,14 +26,11 @@
#include "sound/ymz280b.h" #include "sound/ymz280b.h"
class DivPlatformYMZ280B: public DivDispatch { class DivPlatformYMZ280B: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<int> {
int freq, baseFreq, pitch, pitch2;
unsigned int audPos; unsigned int audPos;
int sample, wave, ins; int sample, wave;
int note;
int panning; int panning;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, setPos, isNewYMZ; bool setPos, isNewYMZ;
int vol, outVol;
int macroVolMul; int macroVolMul;
DivMacroInt std; DivMacroInt std;
void macroInit(DivInstrument* which) { void macroInit(DivInstrument* which) {
@ -41,25 +38,13 @@ class DivPlatformYMZ280B: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<int>(255),
pitch(0),
pitch2(0),
audPos(0), audPos(0),
sample(-1), sample(-1),
ins(-1),
note(0),
panning(8), panning(8),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
setPos(false), setPos(false),
isNewYMZ(false), isNewYMZ(false),
vol(255),
outVol(255),
macroVolMul(64) {} macroVolMul(64) {}
}; };
Channel chan[8]; Channel chan[8];

View File

@ -25,11 +25,7 @@
#include "../macroInt.h" #include "../macroInt.h"
class DivPlatformZXBeeper: public DivDispatch { class DivPlatformZXBeeper: public DivDispatch {
struct Channel { struct Channel: public SharedChannelFreq, public SharedChannelVolume<signed char> {
int freq, baseFreq, pitch, pitch2, note;
int ins;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta;
signed char vol, outVol;
unsigned short sPosition; unsigned short sPosition;
unsigned char duty; unsigned char duty;
DivMacroInt std; DivMacroInt std;
@ -38,20 +34,8 @@ class DivPlatformZXBeeper: public DivDispatch {
pitch2=0; pitch2=0;
} }
Channel(): Channel():
freq(0), SharedChannelFreq(),
baseFreq(0), SharedChannelVolume<signed char>(1),
pitch(0),
pitch2(0),
note(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
inPorta(false),
vol(1),
outVol(1),
sPosition(0), sPosition(0),
duty(64) {} duty(64) {}
}; };

View File

@ -160,7 +160,7 @@
ImGui::TextColored(ch->dacDirection?colorOn:colorOff,">> DACDirection"); ImGui::TextColored(ch->dacDirection?colorOn:colorOff,">> DACDirection");
#define GENESIS_OPCHAN_DEBUG \ #define GENESIS_OPCHAN_DEBUG \
DivPlatformGenesisExt::OpChannel* ch=(DivPlatformGenesisExt::OpChannel*)data; \ DivPlatformOPN::OPNOpChannelStereo* ch=(DivPlatformOPN::OPNOpChannelStereo*)data; \
ImGui::Text("> YM2612 (per operator)"); \ ImGui::Text("> YM2612 (per operator)"); \
ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \
ImGui::Text("* freq: %d",ch->freq); \ ImGui::Text("* freq: %d",ch->freq); \
@ -170,6 +170,7 @@
ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \
ImGui::Text("- ins: %d",ch->ins); \ ImGui::Text("- ins: %d",ch->ins); \
ImGui::Text("- vol: %.2x",ch->vol); \ ImGui::Text("- vol: %.2x",ch->vol); \
ImGui::Text("- outVol: %.2x",ch->outVol); \
ImGui::Text("- pan: %x",ch->pan); \ ImGui::Text("- pan: %x",ch->pan); \
ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \
ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \
@ -198,7 +199,7 @@
ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff");
#define OPN_CHAN_DEBUG \ #define OPN_CHAN_DEBUG \
DivPlatformYM2203::Channel* ch=(DivPlatformYM2203::Channel*)data; \ DivPlatformOPN::OPNChannel* ch=(DivPlatformOPN::OPNChannel*)data; \
ImGui::Text("> YM2203"); \ ImGui::Text("> YM2203"); \
ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \
ImGui::Text("* freq: %d",ch->freq); \ ImGui::Text("* freq: %d",ch->freq); \
@ -228,7 +229,7 @@
ImGui::TextColored(ch->furnacePCM?colorOn:colorOff,">> FurnacePCM"); ImGui::TextColored(ch->furnacePCM?colorOn:colorOff,">> FurnacePCM");
#define OPN_OPCHAN_DEBUG \ #define OPN_OPCHAN_DEBUG \
DivPlatformYM2203Ext::OpChannel* ch=(DivPlatformYM2203Ext::OpChannel*)data; \ DivPlatformOPN::OPNOpChannel* ch=(DivPlatformOPN::OPNOpChannel*)data; \
ImGui::Text("> YM2203 (per operator)"); \ ImGui::Text("> YM2203 (per operator)"); \
ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \
ImGui::Text("* freq: %d",ch->freq); \ ImGui::Text("* freq: %d",ch->freq); \
@ -238,6 +239,7 @@
ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \
ImGui::Text("- ins: %d",ch->ins); \ ImGui::Text("- ins: %d",ch->ins); \
ImGui::Text("- vol: %.2x",ch->vol); \ ImGui::Text("- vol: %.2x",ch->vol); \
ImGui::Text("- outVol: %.2x",ch->outVol); \
ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \
ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \
ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \
@ -286,6 +288,7 @@
ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \
ImGui::Text("- ins: %d",ch->ins); \ ImGui::Text("- ins: %d",ch->ins); \
ImGui::Text("- vol: %.2x",ch->vol); \ ImGui::Text("- vol: %.2x",ch->vol); \
ImGui::Text("- outVol: %.2x",ch->outVol); \
ImGui::Text("- pan: %x",ch->pan); \ ImGui::Text("- pan: %x",ch->pan); \
ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \
ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \
@ -574,7 +577,9 @@ void putDispatchChan(void* data, int chanNum, int type) {
if (chanNum>8) { if (chanNum>8) {
SMS_CHAN_DEBUG; SMS_CHAN_DEBUG;
} else if (chanNum>=2 && chanNum<=5) { } else if (chanNum>=2 && chanNum<=5) {
GENESIS_OPCHAN_DEBUG DivPlatformOPN::OPNOpChannelStereo* ch=(DivPlatformOPN::OPNOpChannelStereo*)data;
ImGui::Text("> YM2612 (per operator)");
OPNB_OPCHAN_DEBUG;
} else { } else {
GENESIS_CHAN_DEBUG; GENESIS_CHAN_DEBUG;
} }
@ -588,7 +593,9 @@ void putDispatchChan(void* data, int chanNum, int type) {
case DIV_SYSTEM_YM2612_EXT: case DIV_SYSTEM_YM2612_EXT:
case DIV_SYSTEM_YM2612_FRAC_EXT: { case DIV_SYSTEM_YM2612_FRAC_EXT: {
if (chanNum>=2 && chanNum<=5) { if (chanNum>=2 && chanNum<=5) {
GENESIS_OPCHAN_DEBUG DivPlatformOPN::OPNOpChannelStereo* ch=(DivPlatformOPN::OPNOpChannelStereo*)data;
ImGui::Text("> YM2612 (per operator)");
OPNB_OPCHAN_DEBUG;
} else { } else {
GENESIS_CHAN_DEBUG; GENESIS_CHAN_DEBUG;
} }
@ -611,18 +618,18 @@ void putDispatchChan(void* data, int chanNum, int type) {
break; break;
} }
case DIV_SYSTEM_PC98: { case DIV_SYSTEM_PC98: {
DivPlatformYM2608::Channel* ch=(DivPlatformYM2608::Channel*)data; DivPlatformOPN::OPNChannelStereo* ch=(DivPlatformOPN::OPNChannelStereo*)data;
ImGui::Text("> YM2608"); ImGui::Text("> YM2608");
OPNB_CHAN_DEBUG; OPNB_CHAN_DEBUG;
break; break;
} }
case DIV_SYSTEM_PC98_EXT: { case DIV_SYSTEM_PC98_EXT: {
if (chanNum>=2 && chanNum<=5) { if (chanNum>=2 && chanNum<=5) {
DivPlatformYM2608Ext::OpChannel* ch=(DivPlatformYM2608Ext::OpChannel*)data; DivPlatformOPN::OPNOpChannelStereo* ch=(DivPlatformOPN::OPNOpChannelStereo*)data;
ImGui::Text("> YM2608 (per operator)"); ImGui::Text("> YM2608 (per operator)");
OPNB_OPCHAN_DEBUG; OPNB_OPCHAN_DEBUG;
} else { } else {
DivPlatformYM2608Ext::Channel* ch=(DivPlatformYM2608Ext::Channel*)data; DivPlatformOPN::OPNChannelStereo* ch=(DivPlatformOPN::OPNChannelStereo*)data;
ImGui::Text("> YM2608"); ImGui::Text("> YM2608");
OPNB_CHAN_DEBUG; OPNB_CHAN_DEBUG;
} }
@ -630,13 +637,13 @@ void putDispatchChan(void* data, int chanNum, int type) {
} }
case DIV_SYSTEM_YM2610: case DIV_SYSTEM_YM2610:
case DIV_SYSTEM_YM2610_FULL: { case DIV_SYSTEM_YM2610_FULL: {
DivPlatformYM2610::Channel* ch=(DivPlatformYM2610::Channel*)data; DivPlatformOPN::OPNChannelStereo* ch=(DivPlatformOPN::OPNChannelStereo*)data;
ImGui::Text("> YM2610"); ImGui::Text("> YM2610");
OPNB_CHAN_DEBUG; OPNB_CHAN_DEBUG;
break; break;
} }
case DIV_SYSTEM_YM2610B: { case DIV_SYSTEM_YM2610B: {
DivPlatformYM2610B::Channel* ch=(DivPlatformYM2610B::Channel*)data; DivPlatformOPN::OPNChannelStereo* ch=(DivPlatformOPN::OPNChannelStereo*)data;
ImGui::Text("> YM2610B"); ImGui::Text("> YM2610B");
OPNB_CHAN_DEBUG; OPNB_CHAN_DEBUG;
break; break;
@ -644,11 +651,11 @@ void putDispatchChan(void* data, int chanNum, int type) {
case DIV_SYSTEM_YM2610_EXT: case DIV_SYSTEM_YM2610_EXT:
case DIV_SYSTEM_YM2610_FULL_EXT: { case DIV_SYSTEM_YM2610_FULL_EXT: {
if (chanNum>=1 && chanNum<=4) { if (chanNum>=1 && chanNum<=4) {
DivPlatformYM2610Ext::OpChannel* ch=(DivPlatformYM2610Ext::OpChannel*)data; DivPlatformOPN::OPNOpChannelStereo* ch=(DivPlatformOPN::OPNOpChannelStereo*)data;
ImGui::Text("> YM2610 (per operator)"); ImGui::Text("> YM2610 (per operator)");
OPNB_OPCHAN_DEBUG; OPNB_OPCHAN_DEBUG;
} else { } else {
DivPlatformYM2610Ext::Channel* ch=(DivPlatformYM2610Ext::Channel*)data; DivPlatformOPN::OPNChannelStereo* ch=(DivPlatformOPN::OPNChannelStereo*)data;
ImGui::Text("> YM2610"); ImGui::Text("> YM2610");
OPNB_CHAN_DEBUG; OPNB_CHAN_DEBUG;
} }
@ -656,11 +663,11 @@ void putDispatchChan(void* data, int chanNum, int type) {
} }
case DIV_SYSTEM_YM2610B_EXT: { case DIV_SYSTEM_YM2610B_EXT: {
if (chanNum>=2 && chanNum<=5) { if (chanNum>=2 && chanNum<=5) {
DivPlatformYM2610BExt::OpChannel* ch=(DivPlatformYM2610BExt::OpChannel*)data; DivPlatformOPN::OPNOpChannelStereo* ch=(DivPlatformOPN::OPNOpChannelStereo*)data;
ImGui::Text("> YM2610B (per operator)"); ImGui::Text("> YM2610B (per operator)");
OPNB_OPCHAN_DEBUG; OPNB_OPCHAN_DEBUG;
} else { } else {
DivPlatformYM2610BExt::Channel* ch=(DivPlatformYM2610BExt::Channel*)data; DivPlatformOPN::OPNChannelStereo* ch=(DivPlatformOPN::OPNChannelStereo*)data;
ImGui::Text("> YM2610B"); ImGui::Text("> YM2610B");
OPNB_CHAN_DEBUG; OPNB_CHAN_DEBUG;
} }

View File

@ -17,6 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include "../chip-utils.h"
#include "gui.h" #include "gui.h"
#include "misc/cpp/imgui_stdlib.h" #include "misc/cpp/imgui_stdlib.h"
#include <imgui.h> #include <imgui.h>
@ -1575,19 +1576,19 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
if (supportsCustomRate) { if (supportsCustomRate) {
ImGui::Separator(); ImGui::Separator();
int customClock=flags.getInt("customClock",0); int customClock=flags.getInt("customClock",0);
bool usingCustomClock=customClock>=100000; bool usingCustomClock=customClock>=MIN_CUSTOM_CLOCK;
if (ImGui::Checkbox("Custom clock rate",&usingCustomClock)) { if (ImGui::Checkbox("Custom clock rate",&usingCustomClock)) {
if (usingCustomClock) { if (usingCustomClock) {
customClock=1000000; customClock=MIN_CUSTOM_CLOCK;
} else { } else {
customClock=0; customClock=0;
} }
altered=true; altered=true;
} }
if (ImGui::InputInt("Hz",&customClock)) { if (ImGui::InputInt("Hz",&customClock)) {
if (customClock<100000) customClock=0; if (customClock<MIN_CUSTOM_CLOCK) customClock=0;
if (customClock>20000000) customClock=20000000; if (customClock>MAX_CUSTOM_CLOCK) customClock=MAX_CUSTOM_CLOCK;
altered=true; altered=true;
} }