From ce09edef84af9aaa859840ebcb85372459db54bf Mon Sep 17 00:00:00 2001 From: cam900 Date: Tue, 13 Dec 2022 16:22:48 +0900 Subject: [PATCH] Unify shared channel struct, De-duplicate channel debug --- src/engine/chipUtils.h | 47 ++-- src/engine/platform/amiga.h | 11 +- src/engine/platform/ay.h | 11 +- src/engine/platform/ay8930.h | 11 +- src/engine/platform/bubsyswsg.h | 11 +- src/engine/platform/c64.h | 11 +- src/engine/platform/fds.h | 12 +- src/engine/platform/fmshared_OPN.h | 10 +- src/engine/platform/fmsharedbase.h | 14 +- src/engine/platform/gb.h | 11 +- src/engine/platform/genesis.h | 2 +- src/engine/platform/lynx.h | 12 +- src/engine/platform/mmc5.h | 13 +- src/engine/platform/msm5232.h | 11 +- src/engine/platform/msm6258.h | 11 +- src/engine/platform/msm6295.h | 14 +- src/engine/platform/n163.h | 11 +- src/engine/platform/namcowsg.h | 13 +- src/engine/platform/nes.h | 13 +- src/engine/platform/opl.h | 12 +- src/engine/platform/opll.h | 12 +- src/engine/platform/pce.h | 11 +- src/engine/platform/pcmdac.h | 13 +- src/engine/platform/pcspkr.h | 11 +- src/engine/platform/pet.h | 11 +- src/engine/platform/pong.h | 11 +- src/engine/platform/qsound.h | 11 +- src/engine/platform/rf5c68.h | 11 +- src/engine/platform/saa.h | 12 +- src/engine/platform/scc.h | 11 +- src/engine/platform/segapcm.h | 12 +- src/engine/platform/sms.h | 11 +- src/engine/platform/snes.h | 11 +- src/engine/platform/su.h | 11 +- src/engine/platform/swan.h | 11 +- src/engine/platform/t6w28.h | 11 +- src/engine/platform/tia.h | 12 +- src/engine/platform/tx81z.h | 1 + src/engine/platform/vb.h | 11 +- src/engine/platform/vera.h | 13 +- src/engine/platform/vic20.h | 11 +- src/engine/platform/vrc6.h | 11 +- src/engine/platform/x1_010.h | 11 +- src/engine/platform/ym2203.h | 1 + src/engine/platform/ym2203ext.h | 5 + src/engine/platform/ym2608.h | 1 + src/engine/platform/ym2608ext.h | 5 + src/engine/platform/ym2610.h | 1 + src/engine/platform/ym2610b.h | 1 + src/engine/platform/ym2610bext.h | 5 + src/engine/platform/ym2610ext.h | 5 + src/engine/platform/ym2610shared.h | 1 + src/engine/platform/ymz280b.h | 11 +- src/engine/platform/zxbeeper.h | 11 +- src/gui/debug.cpp | 364 +++++------------------------ 55 files changed, 209 insertions(+), 714 deletions(-) diff --git a/src/engine/chipUtils.h b/src/engine/chipUtils.h index 073783ef..fb18b0d2 100644 --- a/src/engine/chipUtils.h +++ b/src/engine/chipUtils.h @@ -20,46 +20,41 @@ #ifndef _CHIP_UTILS_H #define _CHIP_UTILS_H +#include "macroInt.h" + // custom clock limits #define MIN_CUSTOM_CLOCK 100000 #define MAX_CUSTOM_CLOCK 40000000 // common shared channel struct +template 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(), + int ins, note; + bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, inPorta; + T vol, outVol; + DivMacroInt std; + void macroInit(DivInstrument* which) { + std.init(which); + pitch2=0; + } + SharedChannel(T initVol): freq(0), baseFreq(0), pitch(0), pitch2(0), + ins(-1), + note(0), + active(false), + insChanged(true), freqChanged(false), + keyOn(false), + keyOff(false), + portaPause(false), inPorta(false), - portaPause(false) {} -}; - -// common shared channel volume struct -template -struct SharedChannelVolume { - T vol, outVol; - SharedChannelVolume(T initVol): vol(initVol), - outVol(initVol) {} + outVol(initVol), + std() {} }; #endif diff --git a/src/engine/platform/amiga.h b/src/engine/platform/amiga.h index 58d26d48..f2870744 100644 --- a/src/engine/platform/amiga.h +++ b/src/engine/platform/amiga.h @@ -22,11 +22,10 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "../waveSynth.h" class DivPlatformAmiga: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned int audLoc; unsigned short audLen; unsigned int audPos; @@ -35,15 +34,9 @@ class DivPlatformAmiga: public DivDispatch { int sample, wave; int busClock; bool useWave, setPos, useV, useP; - DivMacroInt std; DivWaveSynth ws; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(64), + SharedChannel(64), audLoc(0), audLen(0), audPos(0), diff --git a/src/engine/platform/ay.h b/src/engine/platform/ay.h index ad7926b8..430d5631 100644 --- a/src/engine/platform/ay.h +++ b/src/engine/platform/ay.h @@ -20,7 +20,6 @@ #ifndef _AY_H #define _AY_H #include "../dispatch.h" -#include "../macroInt.h" #include #include "sound/ay8910.h" @@ -30,7 +29,7 @@ class DivPlatformAY8910: public DivDispatch { 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; } - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { struct PSGMode { union { struct { @@ -75,14 +74,8 @@ class DivPlatformAY8910: public DivDispatch { unsigned char autoEnvNum, autoEnvDen; signed char konCycles; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), curPSGMode(PSGMode(0)), nextPSGMode(PSGMode(1)), dac(DAC()), diff --git a/src/engine/platform/ay8930.h b/src/engine/platform/ay8930.h index d653893e..d51ebf0d 100644 --- a/src/engine/platform/ay8930.h +++ b/src/engine/platform/ay8930.h @@ -20,13 +20,12 @@ #ifndef _AY8930_H #define _AY8930_H #include "../dispatch.h" -#include "../macroInt.h" #include #include "sound/ay8910.h" class DivPlatformAY8930: public DivDispatch { protected: - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { struct Envelope { unsigned char mode; unsigned short period; @@ -83,14 +82,8 @@ class DivPlatformAY8930: public DivDispatch { unsigned char autoEnvNum, autoEnvDen, duty; signed char konCycles; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(31), + SharedChannel(31), envelope(Envelope()), curPSGMode(PSGMode(0)), nextPSGMode(PSGMode(1)), diff --git a/src/engine/platform/bubsyswsg.h b/src/engine/platform/bubsyswsg.h index f964c289..92c64d89 100644 --- a/src/engine/platform/bubsyswsg.h +++ b/src/engine/platform/bubsyswsg.h @@ -22,23 +22,16 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "../waveSynth.h" #include "vgsound_emu/src/k005289/k005289.hpp" class DivPlatformBubSysWSG: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { signed short wave; signed char waveROM[32] = {0}; // 4 bit PROM per channel on bubble system - DivMacroInt std; DivWaveSynth ws; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), wave(-1) {} }; Channel chan[2]; diff --git a/src/engine/platform/c64.h b/src/engine/platform/c64.h index 9066ab03..9bdabbe4 100644 --- a/src/engine/platform/c64.h +++ b/src/engine/platform/c64.h @@ -22,25 +22,18 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "sound/c64/sid.h" #include "sound/c64_fp/SID.h" class DivPlatformC64: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { int prevFreq, testWhen; unsigned char sweep, wave, attack, decay, sustain, release; short duty; bool sweepChanged, filter; bool resetMask, resetFilter, resetDuty, ring, sync, test; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), prevFreq(65535), testWhen(0), sweep(0), diff --git a/src/engine/platform/fds.h b/src/engine/platform/fds.h index f41d1976..0152781a 100644 --- a/src/engine/platform/fds.h +++ b/src/engine/platform/fds.h @@ -21,26 +21,18 @@ #define _FDS_H #include "../dispatch.h" -#include "../macroInt.h" #include "../waveSynth.h" - #include "sound/nes_nsfplay/nes_fds.h" class DivPlatformFDS: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { int prevFreq, modFreq; unsigned char duty, sweep, modDepth, modPos; bool sweepChanged, modOn; signed short wave; signed char modTable[32]; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(32), + SharedChannel(32), prevFreq(65535), modFreq(0), duty(0), diff --git a/src/engine/platform/fmshared_OPN.h b/src/engine/platform/fmshared_OPN.h index 0c0d0457..19eec0aa 100644 --- a/src/engine/platform/fmshared_OPN.h +++ b/src/engine/platform/fmshared_OPN.h @@ -123,19 +123,13 @@ class DivPlatformOPN: public DivPlatformFMBase { pan(3) {} }; - struct OPNOpChannel: public SharedChannelFreq, public SharedChannelVolume { - DivMacroInt std; + struct OPNOpChannel: public SharedChannel { unsigned char freqH, freqL; int portaPauseFreq; signed char konCycles; bool mask; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } OPNOpChannel(): - SharedChannelFreq(), - SharedChannelVolume(0), + SharedChannel(0), freqH(0), freqL(0), portaPauseFreq(0), diff --git a/src/engine/platform/fmsharedbase.h b/src/engine/platform/fmsharedbase.h index e5cf4c35..0c09b64a 100644 --- a/src/engine/platform/fmsharedbase.h +++ b/src/engine/platform/fmsharedbase.h @@ -22,7 +22,6 @@ #include "../dispatch.h" #include "../instrument.h" -#include "../macroInt.h" #include #define KVS(x,y) ((chan[x].state.op[y].kvs==2 && isOutput[chan[x].state.alg][y]) || chan[x].state.op[y].kvs==1) @@ -48,22 +47,16 @@ class DivPlatformFMBase: public DivDispatch { 0,2,1,3 }; - struct FMChannel: public SharedChannelFreq, public SharedChannelVolume { + struct FMChannel: public SharedChannel { 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(0), + SharedChannel(0), freqH(0), freqL(0), portaPauseFreq(0), @@ -125,8 +118,7 @@ class DivPlatformFMBase: public DivDispatch { friend void putDispatchChan(void*,int,int); - DivPlatformFMBase(): - DivDispatch(), + DivPlatformFMBase():DivDispatch(), lastBusy(0), delay(0) {} }; diff --git a/src/engine/platform/gb.h b/src/engine/platform/gb.h index 09057a41..58196299 100644 --- a/src/engine/platform/gb.h +++ b/src/engine/platform/gb.h @@ -21,13 +21,12 @@ #define _GB_H #include "../dispatch.h" -#include "../macroInt.h" #include "../waveSynth.h" #include "sound/gb/gb.h" #include class DivPlatformGB: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned char duty, sweep; bool sweepChanged, released, softEnv, killIt; bool soManyHacksToMakeItDefleCompatible; @@ -36,14 +35,8 @@ class DivPlatformGB: public DivDispatch { unsigned char envVol, envDir, envLen, soundLen; unsigned short hwSeqPos; short hwSeqDelay; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), duty(0), sweep(0), sweepChanged(false), diff --git a/src/engine/platform/genesis.h b/src/engine/platform/genesis.h index 3979b1b5..a6b08254 100644 --- a/src/engine/platform/genesis.h +++ b/src/engine/platform/genesis.h @@ -20,7 +20,7 @@ #ifndef _GENESIS_H #define _GENESIS_H #include "fmshared_OPN.h" -#include "../macroInt.h" + #include "../../../extern/Nuked-OPN2/ym3438.h" #include "sound/ymfm/ymfm_opn.h" diff --git a/src/engine/platform/lynx.h b/src/engine/platform/lynx.h index 3e7c707d..463aad3d 100644 --- a/src/engine/platform/lynx.h +++ b/src/engine/platform/lynx.h @@ -21,7 +21,6 @@ #define _LYNX_H #include "../dispatch.h" -#include "../macroInt.h" #include "sound/lynx/Mikey.hpp" class DivPlatformLynx: public DivDispatch { @@ -40,22 +39,15 @@ class DivPlatformLynx: public DivDispatch { MikeyDuty(int duty); }; - struct Channel: public SharedChannelFreq, public SharedChannelVolume { - DivMacroInt std; + struct Channel: public SharedChannel { MikeyFreqDiv fd; MikeyDuty duty; int actualNote, lfsr, sample, samplePos, sampleAccum, sampleBaseFreq, sampleFreq; unsigned char pan; bool pcm; int macroVolMul; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(127), - std(), + SharedChannel(127), fd(0), duty(0), actualNote(0), diff --git a/src/engine/platform/mmc5.h b/src/engine/platform/mmc5.h index 51991012..4d250405 100644 --- a/src/engine/platform/mmc5.h +++ b/src/engine/platform/mmc5.h @@ -21,22 +21,15 @@ #define _MMC5_H #include "../dispatch.h" -#include "../macroInt.h" class DivPlatformMMC5: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { int prevFreq; unsigned char duty, sweep; bool sweepChanged, furnaceDac; - signed char wave; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } + signed short wave; Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), prevFreq(65535), duty(0), sweep(8), diff --git a/src/engine/platform/msm5232.h b/src/engine/platform/msm5232.h index 7d1ad4a5..2d4b9705 100644 --- a/src/engine/platform/msm5232.h +++ b/src/engine/platform/msm5232.h @@ -22,20 +22,13 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "sound/oki/msm5232.h" class DivPlatformMSM5232: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { bool noise; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(127), + SharedChannel(127), noise(false) {} }; Channel chan[8]; diff --git a/src/engine/platform/msm6258.h b/src/engine/platform/msm6258.h index 2a46fb9e..28f04f92 100644 --- a/src/engine/platform/msm6258.h +++ b/src/engine/platform/msm6258.h @@ -19,24 +19,19 @@ #ifndef _MSM6258_H #define _MSM6258_H + #include "../dispatch.h" -#include "../macroInt.h" #include #include "sound/oki/okim6258.h" class DivPlatformMSM6258: public DivDispatch { protected: - struct Channel: public SharedChannel, public SharedChannelVolume { + struct Channel: public SharedChannel { bool furnacePCM; int sample; unsigned char pan; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - } Channel(): - SharedChannel(), - SharedChannelVolume(8), + SharedChannel(8), furnacePCM(false), sample(-1), pan(3) {} diff --git a/src/engine/platform/msm6295.h b/src/engine/platform/msm6295.h index d7e1f080..60505515 100644 --- a/src/engine/platform/msm6295.h +++ b/src/engine/platform/msm6295.h @@ -19,23 +19,18 @@ #ifndef _MSM6295_H #define _MSM6295_H + #include "../dispatch.h" -#include "../macroInt.h" #include #include "vgsound_emu/src/msm6295/msm6295.hpp" class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf { protected: - struct Channel: public SharedChannel, public SharedChannelVolume { + struct Channel: public SharedChannel { bool furnacePCM; int sample; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - } Channel(): - SharedChannel(), - SharedChannelVolume(8), + SharedChannel(8), furnacePCM(false), sample(-1) {} }; @@ -96,8 +91,7 @@ class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf { virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override; virtual void quit() override; - DivPlatformMSM6295(): - DivDispatch(), + DivPlatformMSM6295():DivDispatch(), vgsound_emu_mem_intf(), msm(*this) {} ~DivPlatformMSM6295(); diff --git a/src/engine/platform/n163.h b/src/engine/platform/n163.h index c1af6919..872c622b 100644 --- a/src/engine/platform/n163.h +++ b/src/engine/platform/n163.h @@ -22,12 +22,11 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "../waveSynth.h" #include "vgsound_emu/src/n163/n163.hpp" class DivPlatformN163: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { signed char resVol; short wave, wavePos, waveLen; unsigned char waveMode; @@ -35,15 +34,9 @@ class DivPlatformN163: public DivDispatch { unsigned char loadMode; bool volumeChanged; bool waveChanged, waveUpdated; - DivMacroInt std; DivWaveSynth ws; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), resVol(15), wave(-1), wavePos(0), diff --git a/src/engine/platform/namcowsg.h b/src/engine/platform/namcowsg.h index d83aa2fe..127f84aa 100644 --- a/src/engine/platform/namcowsg.h +++ b/src/engine/platform/namcowsg.h @@ -22,24 +22,17 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "../waveSynth.h" #include "sound/namco.h" class DivPlatformNamcoWSG: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned char pan; bool noise; - signed char wave; - DivMacroInt std; + signed short wave; DivWaveSynth ws; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), pan(255), noise(false), wave(-1) {} diff --git a/src/engine/platform/nes.h b/src/engine/platform/nes.h index 5d04204f..aab79584 100644 --- a/src/engine/platform/nes.h +++ b/src/engine/platform/nes.h @@ -21,24 +21,17 @@ #define _NES_H #include "../dispatch.h" -#include "../macroInt.h" #include "sound/nes_nsfplay/nes_apu.h" class DivPlatformNES: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { int prevFreq; unsigned char duty, sweep, envMode, len; bool sweepChanged, furnaceDac; - signed char wave; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } + signed short wave; Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), prevFreq(65535), duty(0), sweep(8), diff --git a/src/engine/platform/opl.h b/src/engine/platform/opl.h index db3b4a8e..f4a6788c 100644 --- a/src/engine/platform/opl.h +++ b/src/engine/platform/opl.h @@ -19,8 +19,8 @@ #ifndef _OPL_H #define _OPL_H + #include "../dispatch.h" -#include "../macroInt.h" #include #include "../../../extern/opl/opl3.h" #include "sound/ymfm/ymfm_adpcm.h" @@ -36,21 +36,15 @@ class DivOPLAInterface: public ymfm::ymfm_interface { class DivPlatformOPL: public DivDispatch { protected: - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { DivInstrumentFM state; - DivMacroInt std; unsigned char freqH, freqL; int sample, fixedFreq; bool furnacePCM, fourOp, hardReset; unsigned char pan; int macroVolMul; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(0), + SharedChannel(0), freqH(0), freqL(0), sample(-1), diff --git a/src/engine/platform/opll.h b/src/engine/platform/opll.h index c9a54224..a1eb7004 100644 --- a/src/engine/platform/opll.h +++ b/src/engine/platform/opll.h @@ -19,8 +19,8 @@ #ifndef _OPLL_H #define _OPLL_H + #include "../dispatch.h" -#include "../macroInt.h" #include extern "C" { @@ -29,20 +29,14 @@ extern "C" { class DivPlatformOPLL: public DivDispatch { protected: - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { DivInstrumentFM state; - DivMacroInt std; unsigned char freqH, freqL; int fixedFreq; bool furnaceDac; unsigned char pan; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(0), + SharedChannel(0), freqH(0), freqL(0), fixedFreq(0), diff --git a/src/engine/platform/pce.h b/src/engine/platform/pce.h index 28617faf..7a417a2a 100644 --- a/src/engine/platform/pce.h +++ b/src/engine/platform/pce.h @@ -22,12 +22,11 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "../waveSynth.h" #include "sound/pce_psg.h" class DivPlatformPCE: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { int antiClickPeriodCount, antiClickWavePos; int dacPeriod, dacRate, dacOut; unsigned int dacPos; @@ -36,15 +35,9 @@ class DivPlatformPCE: public DivDispatch { bool noise, pcm, furnaceDac, deferredWaveUpdate; signed short wave; int macroVolMul; - DivMacroInt std; DivWaveSynth ws; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(31), + SharedChannel(31), antiClickPeriodCount(0), antiClickWavePos(0), dacPeriod(0), diff --git a/src/engine/platform/pcmdac.h b/src/engine/platform/pcmdac.h index 3469c716..7a16ec54 100644 --- a/src/engine/platform/pcmdac.h +++ b/src/engine/platform/pcmdac.h @@ -22,11 +22,10 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "../waveSynth.h" class DivPlatformPCMDAC: public DivDispatch { - struct Channel: public SharedChannelFreq { + struct Channel: public SharedChannel { bool audDir; unsigned int audLoc; unsigned short audLen; @@ -35,15 +34,10 @@ class DivPlatformPCMDAC: public DivDispatch { int sample, wave; int panL, panR; bool useWave, setPos; - int vol, envVol; - DivMacroInt std; + int envVol; DivWaveSynth ws; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), + SharedChannel(255), audDir(false), audLoc(0), audLen(0), @@ -55,7 +49,6 @@ class DivPlatformPCMDAC: public DivDispatch { panR(255), useWave(false), setPos(false), - vol(255), envVol(64) {} }; Channel chan; diff --git a/src/engine/platform/pcspkr.h b/src/engine/platform/pcspkr.h index f6d3384b..b3028d78 100644 --- a/src/engine/platform/pcspkr.h +++ b/src/engine/platform/pcspkr.h @@ -21,22 +21,15 @@ #define _PCSPKR_H #include "../dispatch.h" -#include "../macroInt.h" #include #include #include #include class DivPlatformPCSpeaker: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } + struct Channel: public SharedChannel { Channel(): - SharedChannelFreq(), - SharedChannelVolume(15) {} + SharedChannel(15) {} }; Channel chan[1]; DivDispatchOscBuffer* oscBuf; diff --git a/src/engine/platform/pet.h b/src/engine/platform/pet.h index 716880ad..46c56556 100644 --- a/src/engine/platform/pet.h +++ b/src/engine/platform/pet.h @@ -21,23 +21,16 @@ #define _PET_H #include "../dispatch.h" -#include "../macroInt.h" class DivPlatformPET: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { bool enable; int wave; unsigned char sreg; int cnt; short out; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(1), + SharedChannel(1), enable(false), wave(0b00001111), sreg(0), diff --git a/src/engine/platform/pong.h b/src/engine/platform/pong.h index 11a70e9d..835809f5 100644 --- a/src/engine/platform/pong.h +++ b/src/engine/platform/pong.h @@ -21,18 +21,11 @@ #define _PONG_H #include "../dispatch.h" -#include "../macroInt.h" class DivPlatformPong: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } + struct Channel: public SharedChannel { Channel(): - SharedChannelFreq(), - SharedChannelVolume(1) {} + SharedChannel(1) {} }; Channel chan[1]; DivDispatchOscBuffer* oscBuf; diff --git a/src/engine/platform/qsound.h b/src/engine/platform/qsound.h index 6586e5df..18eb886b 100644 --- a/src/engine/platform/qsound.h +++ b/src/engine/platform/qsound.h @@ -22,24 +22,17 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "sound/qsound.h" class DivPlatformQSound: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { int resVol; int sample, wave; int panning; int echo; bool useWave, surround, isNewQSound; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(255), + SharedChannel(255), resVol(4095), sample(-1), panning(0x10), diff --git a/src/engine/platform/rf5c68.h b/src/engine/platform/rf5c68.h index e2947c09..c22688c3 100644 --- a/src/engine/platform/rf5c68.h +++ b/src/engine/platform/rf5c68.h @@ -22,24 +22,17 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "sound/rf5c68.h" class DivPlatformRF5C68: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned int audPos; int sample, wave; int panning; bool setPos; int macroVolMul; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(255), + SharedChannel(255), audPos(0), sample(-1), panning(255), diff --git a/src/engine/platform/saa.h b/src/engine/platform/saa.h index 9090891d..055a0979 100644 --- a/src/engine/platform/saa.h +++ b/src/engine/platform/saa.h @@ -19,25 +19,19 @@ #ifndef _SAA_H #define _SAA_H + #include "../dispatch.h" -#include "../macroInt.h" #include #include "../../../extern/SAASound/src/SAASound.h" class DivPlatformSAA1099: public DivDispatch { protected: - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned char freqH, freqL; unsigned char psgMode; unsigned char pan; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), freqH(0), freqL(0), psgMode(1), diff --git a/src/engine/platform/scc.h b/src/engine/platform/scc.h index 41700e35..5c4db4e2 100644 --- a/src/engine/platform/scc.h +++ b/src/engine/platform/scc.h @@ -22,24 +22,17 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "../waveSynth.h" #include "vgsound_emu/src/scc/scc.hpp" class DivPlatformSCC: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { bool freqInit; signed short wave; signed char waveROM[32] = {0}; // 8 bit signed waveform - DivMacroInt std; DivWaveSynth ws; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), freqInit(false), wave(-1) {} }; diff --git a/src/engine/platform/segapcm.h b/src/engine/platform/segapcm.h index 1a471fe4..0c99a20c 100644 --- a/src/engine/platform/segapcm.h +++ b/src/engine/platform/segapcm.h @@ -19,15 +19,14 @@ #ifndef _SEGAPCM_H #define _SEGAPCM_H + #include "../dispatch.h" #include "../instrument.h" #include -#include "../macroInt.h" class DivPlatformSegaPCM: public DivDispatch { protected: - struct Channel: public SharedChannelFreq, public SharedChannelVolume { - DivMacroInt std; + struct Channel: public SharedChannel { bool furnacePCM, isNewSegaPCM; unsigned char chVolL, chVolR; unsigned char chPanL, chPanR; @@ -40,13 +39,8 @@ class DivPlatformSegaPCM: public DivDispatch { unsigned char freq; PCMChannel(): sample(-1), pos(0), len(0), freq(0) {} } pcm; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(127), + SharedChannel(127), furnacePCM(false), isNewSegaPCM(false), chVolL(127), diff --git a/src/engine/platform/sms.h b/src/engine/platform/sms.h index 5c0f703e..7bb3b1b1 100644 --- a/src/engine/platform/sms.h +++ b/src/engine/platform/sms.h @@ -21,7 +21,6 @@ #define _SMS_H #include "../dispatch.h" -#include "../macroInt.h" #include "sound/sn76496.h" extern "C" { #include "../../../extern/Nuked-PSG/ympsg.h" @@ -29,17 +28,11 @@ extern "C" { #include class DivPlatformSMS: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { int actualNote; bool writeVol; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), actualNote(0), writeVol(false) {} }; diff --git a/src/engine/platform/snes.h b/src/engine/platform/snes.h index 71272ee2..8d5e2531 100644 --- a/src/engine/platform/snes.h +++ b/src/engine/platform/snes.h @@ -21,28 +21,21 @@ #define _SNES_H #include "../dispatch.h" -#include "../macroInt.h" #include "../waveSynth.h" #include #include "sound/snes/SPC_DSP.h" class DivPlatformSNES: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned int audPos; int sample, wave; int panL, panR; bool useWave, setPos, noise, echo, pitchMod, invertL, invertR, shallWriteVol, shallWriteEnv; int wtLen; DivInstrumentSNES state; - DivMacroInt std; DivWaveSynth ws; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(127), + SharedChannel(127), audPos(0), sample(-1), wave(-1), diff --git a/src/engine/platform/su.h b/src/engine/platform/su.h index 22d6ad29..ebaa911b 100644 --- a/src/engine/platform/su.h +++ b/src/engine/platform/su.h @@ -22,11 +22,10 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "sound/su.h" class DivPlatformSoundUnit: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { int cutoff, baseCutoff, res, control, hasOffset; signed char pan; unsigned char duty; @@ -37,14 +36,8 @@ class DivPlatformSoundUnit: public DivDispatch { unsigned char freqSweepV, volSweepV, cutSweepV; unsigned short syncTimer; signed short wave; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(127), + SharedChannel(127), cutoff(16383), baseCutoff(16380), res(0), diff --git a/src/engine/platform/swan.h b/src/engine/platform/swan.h index 47c9c8f9..b93f0859 100644 --- a/src/engine/platform/swan.h +++ b/src/engine/platform/swan.h @@ -21,24 +21,17 @@ #define _SWAN_H #include "../dispatch.h" -#include "../macroInt.h" #include "../waveSynth.h" #include "sound/swan.h" #include class DivPlatformSwan: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned char pan; int wave; - DivMacroInt std; DivWaveSynth ws; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), pan(255), wave(-1) {} }; diff --git a/src/engine/platform/t6w28.h b/src/engine/platform/t6w28.h index ef06c805..c526fd5d 100644 --- a/src/engine/platform/t6w28.h +++ b/src/engine/platform/t6w28.h @@ -22,20 +22,13 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "sound/t6w28/T6W28_Apu.h" class DivPlatformT6W28: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned char panL, panR, duty; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), panL(15), panR(15), duty(7) {} diff --git a/src/engine/platform/tia.h b/src/engine/platform/tia.h index f5eb1be1..d60d4165 100644 --- a/src/engine/platform/tia.h +++ b/src/engine/platform/tia.h @@ -19,23 +19,17 @@ #ifndef _TIA_H #define _TIA_H + #include "../dispatch.h" -#include "../macroInt.h" #include #include "sound/tia/Audio.h" class DivPlatformTIA: public DivDispatch { protected: - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned char shape; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), shape(4) {} }; Channel chan[2]; diff --git a/src/engine/platform/tx81z.h b/src/engine/platform/tx81z.h index 07338725..b180f28c 100644 --- a/src/engine/platform/tx81z.h +++ b/src/engine/platform/tx81z.h @@ -19,6 +19,7 @@ #ifndef _TX81Z_H #define _TX81Z_H + #include "fmshared_OPM.h" #include #include "sound/ymfm/ymfm_opz.h" diff --git a/src/engine/platform/vb.h b/src/engine/platform/vb.h index adfe339f..bcce42fe 100644 --- a/src/engine/platform/vb.h +++ b/src/engine/platform/vb.h @@ -22,24 +22,17 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "../waveSynth.h" #include "sound/vsu.h" class DivPlatformVB: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned char pan, envLow, envHigh; bool noise, deferredWaveUpdate; signed short wave; - DivMacroInt std; DivWaveSynth ws; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), pan(255), envLow(0), envHigh(0), diff --git a/src/engine/platform/vera.h b/src/engine/platform/vera.h index 8dbe4524..57be5dc9 100644 --- a/src/engine/platform/vera.h +++ b/src/engine/platform/vera.h @@ -19,20 +19,19 @@ #ifndef _VERA_H #define _VERA_H + #include "../dispatch.h" #include "../instrument.h" -#include "../macroInt.h" struct VERA_PSG; struct VERA_PCM; class DivPlatformVERA: public DivDispatch { protected: - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned char pan; unsigned accum; int noiseval; - DivMacroInt std; struct PCMChannel { int sample; @@ -42,14 +41,8 @@ class DivPlatformVERA: public DivDispatch { bool depth16; PCMChannel(): sample(-1), pos(0), len(0), freq(0), depth16(false) {} } pcm; - // somebody please split this into multiple lines! - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(0), + SharedChannel(0), pan(0), accum(0), noiseval(0), diff --git a/src/engine/platform/vic20.h b/src/engine/platform/vic20.h index 6d6df1a1..a2628872 100644 --- a/src/engine/platform/vic20.h +++ b/src/engine/platform/vic20.h @@ -21,21 +21,14 @@ #define _VIC20_H #include "../dispatch.h" -#include "../macroInt.h" #include "sound/vic20sound.h" #include class DivPlatformVIC20: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { int wave, waveWriteCycle; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), wave(0), waveWriteCycle(-1) {} }; diff --git a/src/engine/platform/vrc6.h b/src/engine/platform/vrc6.h index 2a586472..3cb02c41 100644 --- a/src/engine/platform/vrc6.h +++ b/src/engine/platform/vrc6.h @@ -22,25 +22,18 @@ #include #include "../dispatch.h" -#include "../macroInt.h" #include "vgsound_emu/src/vrcvi/vrcvi.hpp" class DivPlatformVRC6: public DivDispatch, public vrcvi_intf { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { int dacPeriod, dacRate, dacOut; unsigned int dacPos; int dacSample; unsigned char duty; bool pcm, furnaceDac; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), dacPeriod(0), dacRate(0), dacOut(0), diff --git a/src/engine/platform/x1_010.h b/src/engine/platform/x1_010.h index 19f75258..28b180eb 100644 --- a/src/engine/platform/x1_010.h +++ b/src/engine/platform/x1_010.h @@ -22,12 +22,11 @@ #include "../dispatch.h" #include "../engine.h" -#include "../macroInt.h" #include "../waveSynth.h" #include "vgsound_emu/src/x1_010/x1_010.hpp" class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { struct Envelope { struct EnvFlag { unsigned char envEnable : 1; @@ -77,7 +76,6 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf { unsigned char waveBank; unsigned int bankSlot; Envelope env; - DivMacroInt std; DivWaveSynth ws; void reset() { freq=baseFreq=pitch=pitch2=note=0; @@ -90,13 +88,8 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf { vol=outVol=lvol=rvol=15; waveBank=0; } - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(15), + SharedChannel(15), fixedFreq(0), wave(-1), sample(-1), diff --git a/src/engine/platform/ym2203.h b/src/engine/platform/ym2203.h index 3bb3d8e6..2a3f292f 100644 --- a/src/engine/platform/ym2203.h +++ b/src/engine/platform/ym2203.h @@ -19,6 +19,7 @@ #ifndef _YM2203_H #define _YM2203_H + #include "fmshared_OPN.h" #include "sound/ymfm/ymfm_opn.h" diff --git a/src/engine/platform/ym2203ext.h b/src/engine/platform/ym2203ext.h index 37aba220..27d02531 100644 --- a/src/engine/platform/ym2203ext.h +++ b/src/engine/platform/ym2203ext.h @@ -17,6 +17,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef _YM2203EXT_H +#define _YM2203EXT_H + #include "../dispatch.h" #include "ym2203.h" @@ -40,3 +43,5 @@ class DivPlatformYM2203Ext: public DivPlatformYM2203 { void quit(); ~DivPlatformYM2203Ext(); }; + +#endif \ No newline at end of file diff --git a/src/engine/platform/ym2608.h b/src/engine/platform/ym2608.h index 29215820..f6dfc21a 100644 --- a/src/engine/platform/ym2608.h +++ b/src/engine/platform/ym2608.h @@ -19,6 +19,7 @@ #ifndef _YM2608_H #define _YM2608_H + #include "fmshared_OPN.h" #include "sound/ymfm/ymfm_opn.h" diff --git a/src/engine/platform/ym2608ext.h b/src/engine/platform/ym2608ext.h index 30d9644d..e35c62e6 100644 --- a/src/engine/platform/ym2608ext.h +++ b/src/engine/platform/ym2608ext.h @@ -17,6 +17,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef _YM2608EXT_H +#define _YM2608EXT_H + #include "../dispatch.h" #include "ym2608.h" @@ -40,3 +43,5 @@ class DivPlatformYM2608Ext: public DivPlatformYM2608 { void quit(); ~DivPlatformYM2608Ext(); }; + +#endif \ No newline at end of file diff --git a/src/engine/platform/ym2610.h b/src/engine/platform/ym2610.h index 6139f6d5..084a150c 100644 --- a/src/engine/platform/ym2610.h +++ b/src/engine/platform/ym2610.h @@ -19,6 +19,7 @@ #ifndef _YM2610_H #define _YM2610_H + #include "ym2610shared.h" class DivPlatformYM2610: public DivPlatformYM2610Base<14> { diff --git a/src/engine/platform/ym2610b.h b/src/engine/platform/ym2610b.h index 2981b1ca..40b78927 100644 --- a/src/engine/platform/ym2610b.h +++ b/src/engine/platform/ym2610b.h @@ -19,6 +19,7 @@ #ifndef _YM2610B_H #define _YM2610B_H + #include "ym2610shared.h" class DivPlatformYM2610B: public DivPlatformYM2610Base<16> { diff --git a/src/engine/platform/ym2610bext.h b/src/engine/platform/ym2610bext.h index 609bf5e9..0493344d 100644 --- a/src/engine/platform/ym2610bext.h +++ b/src/engine/platform/ym2610bext.h @@ -17,6 +17,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef _YM2610BEXT_H +#define _YM2610BEXT_H + #include "../dispatch.h" #include "ym2610b.h" @@ -40,3 +43,5 @@ class DivPlatformYM2610BExt: public DivPlatformYM2610B { void quit(); ~DivPlatformYM2610BExt(); }; + +#endif \ No newline at end of file diff --git a/src/engine/platform/ym2610ext.h b/src/engine/platform/ym2610ext.h index 676f355f..d4a9294e 100644 --- a/src/engine/platform/ym2610ext.h +++ b/src/engine/platform/ym2610ext.h @@ -17,6 +17,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef _YM2610EXT_H +#define _YM2610EXT_H + #include "../dispatch.h" #include "ym2610.h" @@ -40,3 +43,5 @@ class DivPlatformYM2610Ext: public DivPlatformYM2610 { void quit(); ~DivPlatformYM2610Ext(); }; + +#endif \ No newline at end of file diff --git a/src/engine/platform/ym2610shared.h b/src/engine/platform/ym2610shared.h index 0008bf16..487412d5 100644 --- a/src/engine/platform/ym2610shared.h +++ b/src/engine/platform/ym2610shared.h @@ -19,6 +19,7 @@ #ifndef _YM2610SHARED_H #define _YM2610SHARED_H + #include "fmshared_OPN.h" #include "../engine.h" #include "../../ta-log.h" diff --git a/src/engine/platform/ymz280b.h b/src/engine/platform/ymz280b.h index c88cfa08..d2f2f1bb 100644 --- a/src/engine/platform/ymz280b.h +++ b/src/engine/platform/ymz280b.h @@ -22,24 +22,17 @@ #include "../dispatch.h" #include -#include "../macroInt.h" #include "sound/ymz280b.h" class DivPlatformYMZ280B: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned int audPos; int sample, wave; int panning; bool setPos, isNewYMZ; int macroVolMul; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(255), + SharedChannel(255), audPos(0), sample(-1), panning(8), diff --git a/src/engine/platform/zxbeeper.h b/src/engine/platform/zxbeeper.h index db2c0c41..19c3e6ed 100644 --- a/src/engine/platform/zxbeeper.h +++ b/src/engine/platform/zxbeeper.h @@ -22,20 +22,13 @@ #include "../dispatch.h" #include -#include "../macroInt.h" class DivPlatformZXBeeper: public DivDispatch { - struct Channel: public SharedChannelFreq, public SharedChannelVolume { + struct Channel: public SharedChannel { unsigned short sPosition; unsigned char duty; - DivMacroInt std; - void macroInit(DivInstrument* which) { - std.init(which); - pitch2=0; - } Channel(): - SharedChannelFreq(), - SharedChannelVolume(1), + SharedChannel(1), sPosition(0), duty(64) {} }; diff --git a/src/gui/debug.cpp b/src/gui/debug.cpp index 80d5e2cc..a4588f2f 100644 --- a/src/gui/debug.cpp +++ b/src/gui/debug.cpp @@ -123,14 +123,30 @@ ImGui::TextColored(sms->nuked?colorOn:colorOff,">> Nuked"); -#define GENESIS_CHAN_DEBUG \ - DivPlatformGenesis::Channel* ch=(DivPlatformGenesis::Channel*)data; \ - ImGui::Text("> YM2612"); \ - ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ +#define COMMON_CHAN_DEBUG \ ImGui::Text("* freq: %d",ch->freq); \ ImGui::Text(" - base: %d",ch->baseFreq); \ ImGui::Text(" - pitch: %d",ch->pitch); \ ImGui::Text(" - pitch2: %d",ch->pitch2); \ + ImGui::Text("- note: %d",ch->note); \ + ImGui::Text("- ins: %d",ch->ins); \ + ImGui::Text("- vol: %.2x",ch->vol); \ + ImGui::Text("- outVol: %.2x",ch->outVol); + +#define COMMON_CHAN_DEBUG_BOOL \ + ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ + ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ + ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ + ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ + ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ + ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ + ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); + +#define GENESIS_CHAN_DEBUG \ + DivPlatformGenesis::Channel* ch=(DivPlatformGenesis::Channel*)data; \ + ImGui::Text("> YM2612"); \ + ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ + COMMON_CHAN_DEBUG; \ ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ ImGui::Text("* DAC:"); \ ImGui::Text(" - period: %d",ch->dacPeriod); \ @@ -139,21 +155,11 @@ ImGui::Text(" - sample: %d",ch->dacSample); \ ImGui::Text(" - delay: %d",ch->dacDelay); \ ImGui::Text(" - output: %d",ch->dacOutput); \ - ImGui::Text("- note: %d",ch->note); \ - ImGui::Text("- ins: %d",ch->ins); \ - ImGui::Text("- vol: %.2x",ch->vol); \ - ImGui::Text("- outVol: %.2x",ch->outVol); \ ImGui::Text("- pan: %x",ch->pan); \ ImGui::Text("- opMask: %x",ch->opMask); \ ImGui::Text("- sampleBank: %d",ch->sampleBank); \ - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ - ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ + COMMON_CHAN_DEBUG_BOOL; \ ImGui::TextColored(ch->furnaceDac?colorOn:colorOff,">> FurnaceDAC"); \ - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); \ ImGui::TextColored(ch->hardReset?colorOn:colorOff,">> hardReset"); \ ImGui::TextColored(ch->opMaskChanged?colorOn:colorOff,">> opMaskChanged"); \ ImGui::TextColored(ch->dacMode?colorOn:colorOff,">> DACMode"); \ @@ -164,67 +170,31 @@ DivPlatformOPN::OPNOpChannelStereo* ch=(DivPlatformOPN::OPNOpChannelStereo*)data; \ ImGui::Text("> YM2612 (per operator)"); \ ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ - ImGui::Text("* freq: %d",ch->freq); \ - ImGui::Text(" - base: %d",ch->baseFreq); \ - ImGui::Text(" - pitch: %d",ch->pitch); \ - ImGui::Text(" - pitch2: %d",ch->pitch2); \ + COMMON_CHAN_DEBUG; \ ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ - ImGui::Text("- ins: %d",ch->ins); \ - ImGui::Text("- vol: %.2x",ch->vol); \ - ImGui::Text("- outVol: %.2x",ch->outVol); \ ImGui::Text("- pan: %x",ch->pan); \ - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ - ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); \ + COMMON_CHAN_DEBUG_BOOL; \ ImGui::TextColored(ch->mask?colorOn:colorOff,">> Mask"); #define SMS_CHAN_DEBUG \ DivPlatformSMS::Channel* ch=(DivPlatformSMS::Channel*)data; \ ImGui::Text("> SMS"); \ - ImGui::Text("* freq: %d",ch->freq); \ - ImGui::Text(" - base: %d",ch->baseFreq); \ - ImGui::Text(" - pitch: %d",ch->pitch); \ - ImGui::Text(" - pitch2: %d",ch->pitch2); \ - ImGui::Text("- note: %d",ch->note); \ - ImGui::Text("- ins: %d",ch->ins); \ - ImGui::Text("- vol: %.2x",ch->vol); \ - ImGui::Text("- outVol: %.2x",ch->outVol); \ - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); + COMMON_CHAN_DEBUG; \ + COMMON_CHAN_DEBUG_BOOL; #define OPN_CHAN_DEBUG \ DivPlatformOPN::OPNChannel* ch=(DivPlatformOPN::OPNChannel*)data; \ ImGui::Text("> YM2203"); \ ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ - ImGui::Text("* freq: %d",ch->freq); \ - ImGui::Text(" - base: %d",ch->baseFreq); \ - ImGui::Text(" - pitch: %d",ch->pitch); \ - ImGui::Text(" - pitch2: %d",ch->pitch2); \ + COMMON_CHAN_DEBUG; \ ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ ImGui::Text("* PSG:"); \ ImGui::Text(" - psgMode: %d",ch->psgMode); \ ImGui::Text(" - autoEnvNum: %d",ch->autoEnvNum); \ ImGui::Text(" - autoEnvDen: %d",ch->autoEnvDen); \ ImGui::Text("- sample: %d",ch->sample); \ - ImGui::Text("- note: %d",ch->note); \ - ImGui::Text("- ins: %d",ch->ins); \ - ImGui::Text("- vol: %.2x",ch->vol); \ - ImGui::Text("- outVol: %.2x",ch->outVol); \ ImGui::Text("- opMask: %x",ch->opMask); \ - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ - ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); \ + COMMON_CHAN_DEBUG_BOOL; \ ImGui::TextColored(ch->hardReset?colorOn:colorOff,">> hardReset"); \ ImGui::TextColored(ch->opMaskChanged?colorOn:colorOff,">> opMaskChanged"); \ ImGui::TextColored(ch->furnacePCM?colorOn:colorOff,">> FurnacePCM"); @@ -233,71 +203,34 @@ DivPlatformOPN::OPNOpChannel* ch=(DivPlatformOPN::OPNOpChannel*)data; \ ImGui::Text("> YM2203 (per operator)"); \ ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ - ImGui::Text("* freq: %d",ch->freq); \ - ImGui::Text(" - base: %d",ch->baseFreq); \ - ImGui::Text(" - pitch: %d",ch->pitch); \ - ImGui::Text(" - pitch2: %d",ch->pitch2); \ + COMMON_CHAN_DEBUG; \ ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ - ImGui::Text("- ins: %d",ch->ins); \ - ImGui::Text("- vol: %.2x",ch->vol); \ - ImGui::Text("- outVol: %.2x",ch->outVol); \ - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ - ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); \ + COMMON_CHAN_DEBUG_BOOL; \ ImGui::TextColored(ch->mask?colorOn:colorOff,">> Mask"); #define OPNB_CHAN_DEBUG \ ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ - ImGui::Text("* freq: %d",ch->freq); \ - ImGui::Text(" - base: %d",ch->baseFreq); \ - ImGui::Text(" - pitch: %d",ch->pitch); \ - ImGui::Text(" - pitch2: %d",ch->pitch2); \ + COMMON_CHAN_DEBUG; \ ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ ImGui::Text("* PSG:"); \ ImGui::Text(" - psgMode: %d",ch->psgMode); \ ImGui::Text(" - autoEnvNum: %d",ch->autoEnvNum); \ ImGui::Text(" - autoEnvDen: %d",ch->autoEnvDen); \ ImGui::Text("- sample: %d",ch->sample); \ - ImGui::Text("- note: %d",ch->note); \ - ImGui::Text("- ins: %d",ch->ins); \ - ImGui::Text("- vol: %.2x",ch->vol); \ - ImGui::Text("- outVol: %.2x",ch->outVol); \ ImGui::Text("- pan: %x",ch->pan); \ ImGui::Text("- opMask: %x",ch->opMask); \ ImGui::Text("- macroVolMul: %x",ch->macroVolMul); \ - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ - ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); \ + COMMON_CHAN_DEBUG_BOOL; \ ImGui::TextColored(ch->hardReset?colorOn:colorOff,">> hardReset"); \ ImGui::TextColored(ch->opMaskChanged?colorOn:colorOff,">> opMaskChanged"); \ ImGui::TextColored(ch->furnacePCM?colorOn:colorOff,">> FurnacePCM"); #define OPNB_OPCHAN_DEBUG \ ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); \ - ImGui::Text("* freq: %d",ch->freq); \ - ImGui::Text(" - base: %d",ch->baseFreq); \ - ImGui::Text(" - pitch: %d",ch->pitch); \ - ImGui::Text(" - pitch2: %d",ch->pitch2); \ + COMMON_CHAN_DEBUG; \ ImGui::Text("- portaPauseFreq: %d",ch->portaPauseFreq); \ - ImGui::Text("- ins: %d",ch->ins); \ - ImGui::Text("- vol: %.2x",ch->vol); \ - ImGui::Text("- outVol: %.2x",ch->outVol); \ ImGui::Text("- pan: %x",ch->pan); \ - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); \ - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); \ - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); \ - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); \ - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); \ - ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); \ - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); \ + COMMON_CHAN_DEBUG_BOOL; \ ImGui::TextColored(ch->mask?colorOn:colorOff,">> Mask"); void putDispatchChip(void* data, int type) { @@ -677,52 +610,28 @@ void putDispatchChan(void* data, int chanNum, int type) { case DIV_SYSTEM_GB: { DivPlatformGB::Channel* ch=(DivPlatformGB::Channel*)data; ImGui::Text("> GameBoy"); - ImGui::Text("* freq: %d",ch->freq); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); - ImGui::Text("- note: %d",ch->note); - ImGui::Text("- ins: %d",ch->ins); + COMMON_CHAN_DEBUG; ImGui::Text("- duty: %d",ch->duty); ImGui::Text("- sweep: %.2x",ch->sweep); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); ImGui::Text("- wave: %d",ch->wave); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->sweepChanged?colorOn:colorOff,">> SweepChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); break; } case DIV_SYSTEM_PCE: { DivPlatformPCE::Channel* ch=(DivPlatformPCE::Channel*)data; ImGui::Text("> PCEngine"); - ImGui::Text("* freq: %d",ch->freq); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); - ImGui::Text("- note: %d",ch->note); + COMMON_CHAN_DEBUG; ImGui::Text("* DAC:"); ImGui::Text(" - period: %d",ch->dacPeriod); ImGui::Text(" - rate: %d",ch->dacRate); ImGui::Text(" - pos: %d",ch->dacPos); ImGui::Text(" - out: %d",ch->dacOut); ImGui::Text(" - sample: %d",ch->dacSample); - ImGui::Text("- ins: %d",ch->ins); ImGui::Text("- pan: %.2x",ch->pan); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); ImGui::Text("- wave: %d",ch->wave); ImGui::Text("- macroVolMul: %d",ch->macroVolMul); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->noise?colorOn:colorOff,">> Noise"); ImGui::TextColored(ch->pcm?colorOn:colorOff,">> DAC"); ImGui::TextColored(ch->furnaceDac?colorOn:colorOff,">> FurnaceDAC"); @@ -731,52 +640,28 @@ void putDispatchChan(void* data, int chanNum, int type) { case DIV_SYSTEM_NES: { DivPlatformNES::Channel* ch=(DivPlatformNES::Channel*)data; ImGui::Text("> NES"); - ImGui::Text("* freq: %d",ch->freq); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); + COMMON_CHAN_DEBUG; ImGui::Text(" - prev: %d",ch->prevFreq); - ImGui::Text("- note: %d",ch->note); - ImGui::Text("- ins: %d",ch->ins); ImGui::Text("- duty: %d",ch->duty); ImGui::Text("- sweep: %.2x",ch->sweep); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); ImGui::Text("- wave: %d",ch->wave); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->sweepChanged?colorOn:colorOff,">> SweepChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); ImGui::TextColored(ch->furnaceDac?colorOn:colorOff,">> FurnaceDAC"); break; } case DIV_SYSTEM_C64_6581: case DIV_SYSTEM_C64_8580: { DivPlatformC64::Channel* ch=(DivPlatformC64::Channel*)data; ImGui::Text("> C64"); - ImGui::Text("* freq: %d",ch->freq); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); - ImGui::Text(" - prev: %d",ch->prevFreq); + COMMON_CHAN_DEBUG; + ImGui::Text("- prevFreq: %d",ch->prevFreq); ImGui::Text("- testWhen: %d",ch->testWhen); - ImGui::Text("- note: %d",ch->note); - ImGui::Text("- ins: %d",ch->ins); ImGui::Text("- duty: %d",ch->duty); ImGui::Text("- sweep: %.2x",ch->sweep); ImGui::Text("- wave: %.1x",ch->wave); ImGui::Text("- ADSR: %.1x %.1x %.1x %.1x",ch->attack,ch->decay,ch->sustain,ch->release); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->sweepChanged?colorOn:colorOff,">> SweepChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); ImGui::TextColored(ch->filter?colorOn:colorOff,">> Filter"); ImGui::TextColored(ch->resetMask?colorOn:colorOff,">> ResetMask"); ImGui::TextColored(ch->resetFilter?colorOn:colorOff,">> ResetFilter"); @@ -790,68 +675,37 @@ void putDispatchChan(void* data, int chanNum, int type) { DivPlatformArcade::Channel* ch=(DivPlatformArcade::Channel*)data; ImGui::Text("> YM2151"); ImGui::Text("- freqHL: %.2x%.2x",ch->freqH,ch->freqL); - ImGui::Text("* freq: %d",ch->freq); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); - ImGui::Text("- note: %d",ch->note); - ImGui::Text("- ins: %d",ch->ins); + COMMON_CHAN_DEBUG; ImGui::Text("- KOnCycles: %d",ch->konCycles); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); ImGui::Text("- chVolL: %.2x",ch->chVolL); ImGui::Text("- chVolR: %.2x",ch->chVolR); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); + COMMON_CHAN_DEBUG_BOOL; break; } case DIV_SYSTEM_SEGAPCM: case DIV_SYSTEM_SEGAPCM_COMPAT: { DivPlatformSegaPCM::Channel* ch=(DivPlatformSegaPCM::Channel*)data; ImGui::Text("> SegaPCM"); - ImGui::Text("* freq: %d",ch->freq); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); - ImGui::Text("- note: %d",ch->note); - ImGui::Text("- ins: %d",ch->ins); + COMMON_CHAN_DEBUG; ImGui::Text("* PCM:"); ImGui::Text(" - sample: %d",ch->pcm.sample); ImGui::Text(" - pos: %d",ch->pcm.pos); ImGui::Text(" - len: %d",ch->pcm.len); ImGui::Text(" - freq: %d",ch->pcm.freq); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); ImGui::Text("- chVolL: %.2x",ch->chVolL); ImGui::Text("- chVolR: %.2x",ch->chVolR); ImGui::Text("- chPanL: %.2x",ch->chPanL); ImGui::Text("- chPanR: %.2x",ch->chPanR); ImGui::Text("- macroVolMul: %.2x",ch->macroVolMul); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->furnacePCM?colorOn:colorOff,">> FurnacePCM"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); ImGui::TextColored(ch->isNewSegaPCM?colorOn:colorOff,">> IsNewSegaPCM"); break; } case DIV_SYSTEM_AY8910: { DivPlatformAY8910::Channel* ch=(DivPlatformAY8910::Channel*)data; ImGui::Text("> AY-3-8910"); - ImGui::Text("* freq: %d",ch->freq); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); - ImGui::Text("- note: %d",ch->note); - ImGui::Text("- ins: %d",ch->ins); + COMMON_CHAN_DEBUG; ImGui::Text("* psgMode:"); ImGui::Text(" * curr:"); ImGui::Text(" - tone: %d",ch->curPSGMode.tone); @@ -871,27 +725,14 @@ void putDispatchChan(void* data, int chanNum, int type) { ImGui::Text(" - out: %d",ch->dac.out); ImGui::Text("- autoEnvNum: %.2x",ch->autoEnvNum); ImGui::Text("- autoEnvDen: %.2x",ch->autoEnvDen); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->dac.furnaceDAC?colorOn:colorOff,">> furnaceDAC"); break; } case DIV_SYSTEM_AY8930: { DivPlatformAY8930::Channel* ch=(DivPlatformAY8930::Channel*)data; ImGui::Text("> AY8930"); - ImGui::Text("* freq: %d",ch->freq); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); - ImGui::Text("- note: %d",ch->note); - ImGui::Text("- ins: %d",ch->ins); + COMMON_CHAN_DEBUG; ImGui::Text("- duty: %d",ch->duty); ImGui::Text("* envelope:"); ImGui::Text(" - mode: %d",ch->envelope.mode); @@ -917,39 +758,19 @@ void putDispatchChan(void* data, int chanNum, int type) { ImGui::Text(" - out: %d",ch->dac.out); ImGui::Text("- autoEnvNum: %.2x",ch->autoEnvNum); ImGui::Text("- autoEnvDen: %.2x",ch->autoEnvDen); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->portaPause?colorOn:colorOff,">> PortaPause"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->dac.furnaceDAC?colorOn:colorOff,">> furnaceDAC"); break; } case DIV_SYSTEM_QSOUND: { DivPlatformQSound::Channel* ch=(DivPlatformQSound::Channel*)data; ImGui::Text("> QSound"); - ImGui::Text("* freq: %d",ch->freq); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); - ImGui::Text("- note: %d",ch->note); - ImGui::Text("- ins: %d",ch->ins); + COMMON_CHAN_DEBUG; ImGui::Text("- sample: %d",ch->sample); ImGui::Text("- echo: %d",ch->echo); ImGui::Text("- panning: %d",ch->panning); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); ImGui::Text("- resVol: %.2x",ch->resVol); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->useWave?colorOn:colorOff,">> UseWave"); ImGui::TextColored(ch->surround?colorOn:colorOff,">> Surround"); ImGui::TextColored(ch->isNewQSound?colorOn:colorOff,">> IsNewQSound"); @@ -958,14 +779,9 @@ void putDispatchChan(void* data, int chanNum, int type) { case DIV_SYSTEM_X1_010: { DivPlatformX1_010::Channel* ch=(DivPlatformX1_010::Channel*)data; ImGui::Text("> X1-010"); - ImGui::Text("* freq: %.4x",ch->freq); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); - ImGui::Text("- note: %d",ch->note); + COMMON_CHAN_DEBUG; ImGui::Text("- wave: %d",ch->wave); ImGui::Text("- sample: %d",ch->sample); - ImGui::Text("- ins: %d",ch->ins); ImGui::Text("- pan: %d",ch->pan); ImGui::Text("* envelope:"); ImGui::Text(" - shape: %d",ch->env.shape); @@ -976,17 +792,10 @@ void putDispatchChan(void* data, int chanNum, int type) { ImGui::Text(" - autoEnvDen: %.2x",ch->autoEnvDen); ImGui::Text("- WaveBank: %d",ch->waveBank); ImGui::Text("- bankSlot: %d",ch->bankSlot); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); ImGui::Text("- Lvol: %.2x",ch->lvol); ImGui::Text("- Rvol: %.2x",ch->rvol); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->envChanged?colorOn:colorOff,">> EnvChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); ImGui::TextColored(ch->furnacePCM?colorOn:colorOff,">> FurnacePCM"); ImGui::TextColored(ch->pcm?colorOn:colorOff,">> PCM"); ImGui::TextColored(ch->env.flag.envEnable?colorOn:colorOff,">> EnvEnable"); @@ -1001,11 +810,7 @@ void putDispatchChan(void* data, int chanNum, int type) { case DIV_SYSTEM_N163: { DivPlatformN163::Channel* ch=(DivPlatformN163::Channel*)data; ImGui::Text("> N163"); - ImGui::Text("* freq: %.4x",ch->freq); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); - ImGui::Text("- note: %d",ch->note); + COMMON_CHAN_DEBUG; ImGui::Text("- wave: %d",ch->wave); ImGui::Text("- wavepos: %d",ch->wavePos); ImGui::Text("- wavelen: %d",ch->waveLen); @@ -1014,45 +819,25 @@ void putDispatchChan(void* data, int chanNum, int type) { ImGui::Text("- loadpos: %d",ch->loadPos); ImGui::Text("- loadlen: %d",ch->loadLen); ImGui::Text("- loadmode: %d",ch->loadMode); - ImGui::Text("- ins: %d",ch->ins); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); ImGui::Text("- resVol: %.2x",ch->resVol); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->volumeChanged?colorOn:colorOff,">> VolumeChanged"); ImGui::TextColored(ch->waveChanged?colorOn:colorOff,">> WaveChanged"); ImGui::TextColored(ch->waveUpdated?colorOn:colorOff,">> WaveUpdated"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); break; } case DIV_SYSTEM_VRC6: { DivPlatformVRC6::Channel* ch=(DivPlatformVRC6::Channel*)data; ImGui::Text("> VRC6"); - ImGui::Text("* freq: %d",ch->freq); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); - ImGui::Text("- note: %d",ch->note); + COMMON_CHAN_DEBUG; ImGui::Text("* DAC:"); ImGui::Text(" - period: %d",ch->dacPeriod); ImGui::Text(" - rate: %d",ch->dacRate); ImGui::Text(" - out: %d",ch->dacOut); ImGui::Text(" - pos: %d",ch->dacPos); ImGui::Text(" - sample: %d",ch->dacSample); - ImGui::Text("- ins: %d",ch->ins); ImGui::Text("- duty: %d",ch->duty); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->pcm?colorOn:colorOff,">> DAC"); ImGui::TextColored(ch->furnaceDac?colorOn:colorOff,">> FurnaceDAC"); break; @@ -1060,46 +845,30 @@ void putDispatchChan(void* data, int chanNum, int type) { case DIV_SYSTEM_LYNX: { DivPlatformLynx::Channel* ch=(DivPlatformLynx::Channel*)data; ImGui::Text("> Lynx"); - ImGui::Text("* freq:"); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); + COMMON_CHAN_DEBUG; ImGui::Text("* FreqDiv:"); ImGui::Text(" - clockDivider: %d",ch->fd.clockDivider); ImGui::Text(" - backup: %d",ch->fd.backup); - ImGui::Text("* note: %d",ch->note); - ImGui::Text(" - actualNote: %d",ch->actualNote); + ImGui::Text("- actualNote: %d",ch->actualNote); ImGui::Text("* Sample:"); ImGui::Text(" - sample: %d",ch->sample); ImGui::Text(" - pos: %d",ch->samplePos); ImGui::Text(" - accum: %d",ch->sampleAccum); ImGui::Text(" * freq: %d",ch->sampleFreq); ImGui::Text(" - base: %d",ch->sampleBaseFreq); - ImGui::Text("- ins: %d",ch->ins); ImGui::Text("* duty:"); ImGui::Text(" - int_feedback7: %d",ch->duty.int_feedback7); ImGui::Text(" - feedback: %d",ch->duty.feedback); ImGui::Text("- pan: %.2x",ch->pan); - ImGui::Text("- vol: %.2x",ch->vol); - ImGui::Text("- outVol: %.2x",ch->outVol); ImGui::Text("- macroVolMul: %.2x",ch->macroVolMul); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->pcm?colorOn:colorOff,">> DAC"); break; } case DIV_SYSTEM_PCM_DAC: { DivPlatformPCMDAC::Channel* ch=(DivPlatformPCMDAC::Channel*)data; ImGui::Text("> PCM DAC"); - ImGui::Text("* freq:"); - ImGui::Text(" - base: %d",ch->baseFreq); - ImGui::Text(" - pitch: %d",ch->pitch); - ImGui::Text(" - pitch2: %d",ch->pitch2); - ImGui::Text("* note: %d",ch->note); + COMMON_CHAN_DEBUG; ImGui::Text("* Sample: %d",ch->sample); ImGui::Text(" - dir: %d",ch->audDir); ImGui::Text(" - loc: %d",ch->audLoc); @@ -1107,17 +876,10 @@ void putDispatchChan(void* data, int chanNum, int type) { ImGui::Text(" * pos: %d",ch->audPos); ImGui::Text(" - sub: %d",ch->audSub); ImGui::Text("- wave: %d",ch->wave); - ImGui::Text("- ins: %d",ch->ins); ImGui::Text("- panL: %.2x",ch->panL); ImGui::Text("- panR: %.2x",ch->panR); - ImGui::Text("- vol: %.2x",ch->vol); ImGui::Text("- envVol: %.2x",ch->envVol); - ImGui::TextColored(ch->active?colorOn:colorOff,">> Active"); - ImGui::TextColored(ch->insChanged?colorOn:colorOff,">> InsChanged"); - ImGui::TextColored(ch->freqChanged?colorOn:colorOff,">> FreqChanged"); - ImGui::TextColored(ch->keyOn?colorOn:colorOff,">> KeyOn"); - ImGui::TextColored(ch->keyOff?colorOn:colorOff,">> KeyOff"); - ImGui::TextColored(ch->inPorta?colorOn:colorOff,">> InPorta"); + COMMON_CHAN_DEBUG_BOOL; ImGui::TextColored(ch->useWave?colorOn:colorOff,">> UseWave"); ImGui::TextColored(ch->setPos?colorOn:colorOff,">> SetPos"); break;