From 08d2f12dbd6f28058a0672482134ff133eddd6f8 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 1 Jan 2023 19:46:08 -0500 Subject: [PATCH 01/72] prepare new dispatch will allow for more than 2 outputs --- src/engine/defines.h | 3 ++ src/engine/dispatch.h | 12 +++--- src/engine/dispatchContainer.cpp | 63 ++++++++++++++++++------------ src/engine/engine.h | 23 ++++++----- src/engine/platform/abstract.cpp | 6 +-- src/engine/platform/amiga.cpp | 4 +- src/engine/platform/amiga.h | 2 +- src/engine/platform/arcade.cpp | 4 +- src/engine/platform/arcade.h | 2 +- src/engine/platform/ay.cpp | 4 +- src/engine/platform/ay.h | 2 +- src/engine/platform/ay8930.cpp | 4 +- src/engine/platform/ay8930.h | 2 +- src/engine/platform/bubsyswsg.cpp | 4 +- src/engine/platform/bubsyswsg.h | 2 +- src/engine/platform/ga20.cpp | 4 +- src/engine/platform/ga20.h | 2 +- src/engine/platform/gb.cpp | 4 +- src/engine/platform/gb.h | 2 +- src/engine/platform/genesis.cpp | 4 +- src/engine/platform/genesis.h | 2 +- src/engine/platform/k007232.cpp | 4 +- src/engine/platform/k007232.h | 2 +- src/engine/platform/lynx.cpp | 4 +- src/engine/platform/lynx.h | 2 +- src/engine/platform/msm5232.cpp | 4 +- src/engine/platform/msm5232.h | 2 +- src/engine/platform/msm6258.cpp | 4 +- src/engine/platform/msm6258.h | 2 +- src/engine/platform/namcowsg.cpp | 4 +- src/engine/platform/namcowsg.h | 2 +- src/engine/platform/opl.cpp | 4 +- src/engine/platform/opl.h | 2 +- src/engine/platform/pce.cpp | 4 +- src/engine/platform/pce.h | 2 +- src/engine/platform/pcmdac.cpp | 4 +- src/engine/platform/pcmdac.h | 2 +- src/engine/platform/pet.cpp | 4 +- src/engine/platform/pet.h | 2 +- src/engine/platform/qsound.cpp | 4 +- src/engine/platform/qsound.h | 2 +- src/engine/platform/rf5c68.cpp | 4 +- src/engine/platform/rf5c68.h | 2 +- src/engine/platform/saa.cpp | 4 +- src/engine/platform/saa.h | 2 +- src/engine/platform/scc.cpp | 4 +- src/engine/platform/scc.h | 2 +- src/engine/platform/segapcm.cpp | 4 +- src/engine/platform/segapcm.h | 2 +- src/engine/platform/sms.cpp | 4 +- src/engine/platform/sms.h | 2 +- src/engine/platform/snes.cpp | 4 +- src/engine/platform/snes.h | 2 +- src/engine/platform/su.cpp | 4 +- src/engine/platform/su.h | 2 +- src/engine/platform/swan.cpp | 4 +- src/engine/platform/swan.h | 2 +- src/engine/platform/t6w28.cpp | 4 +- src/engine/platform/t6w28.h | 2 +- src/engine/platform/tia.cpp | 4 +- src/engine/platform/tia.h | 2 +- src/engine/platform/tx81z.cpp | 4 +- src/engine/platform/tx81z.h | 2 +- src/engine/platform/vb.cpp | 4 +- src/engine/platform/vb.h | 2 +- src/engine/platform/vera.cpp | 4 +- src/engine/platform/vera.h | 2 +- src/engine/platform/vic20.cpp | 4 +- src/engine/platform/vic20.h | 2 +- src/engine/platform/x1_010.cpp | 4 +- src/engine/platform/x1_010.h | 2 +- src/engine/platform/ym2203.cpp | 4 +- src/engine/platform/ym2203.h | 2 +- src/engine/platform/ym2608.cpp | 4 +- src/engine/platform/ym2608.h | 2 +- src/engine/platform/ym2610.cpp | 4 +- src/engine/platform/ym2610.h | 2 +- src/engine/platform/ym2610b.cpp | 4 +- src/engine/platform/ym2610b.h | 2 +- src/engine/platform/ym2610shared.h | 4 +- src/engine/platform/ymz280b.cpp | 4 +- src/engine/platform/ymz280b.h | 2 +- 82 files changed, 178 insertions(+), 161 deletions(-) diff --git a/src/engine/defines.h b/src/engine/defines.h index 2cd4b692..3461a52d 100644 --- a/src/engine/defines.h +++ b/src/engine/defines.h @@ -33,4 +33,7 @@ // sample related #define DIV_MAX_SAMPLE_TYPE 4 +// dispatch +#define DIV_MAX_OUTPUTS 16 + #endif diff --git a/src/engine/dispatch.h b/src/engine/dispatch.h index 46a49cb4..dc2b07b7 100644 --- a/src/engine/dispatch.h +++ b/src/engine/dispatch.h @@ -322,12 +322,10 @@ class DivDispatch { /** * fill a buffer with sound data. - * @param bufL the left or mono channel buffer. - * @param bufR the right channel buffer. - * @param start the start offset. + * @param buf pointers to output buffers. * @param len the amount of samples to fill. */ - virtual void acquire(short* bufL, short* bufR, size_t start, size_t len); + virtual void acquire(short** buf, size_t len); /** * fill a write stream with data (e.g. for software-mixed PCM). @@ -413,10 +411,10 @@ class DivDispatch { virtual void muteChannel(int ch, bool mute); /** - * test whether this dispatch outputs audio in two channels. - * @return whether it does. + * get the number of outputs this dispatch provides. + * @return number of outputs (usually 1 or 2 but may be more). SHALL NOT be less than one. */ - virtual bool isStereo(); + virtual int getOutputCount(); /** * test whether sending a key off command to a channel should reset arp too. diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index 5768bde3..5b943332 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -89,7 +89,11 @@ void DivDispatchContainer::setQuality(bool lowQual) { } void DivDispatchContainer::acquire(size_t offset, size_t count) { - dispatch->acquire(bbIn[0],bbIn[1],offset,count); + int outs=dispatch->getOutputCount(); + for (int i=0; iacquire(bbInMapped,count); } void DivDispatchContainer::flush(size_t count) { @@ -166,26 +170,10 @@ void DivDispatchContainer::clear() { } void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, double gotRate, const DivConfig& flags) { + // quit if we already initialized if (dispatch!=NULL) return; - bb[0]=blip_new(32768); - if (bb[0]==NULL) { - logE("not enough memory!"); - return; - } - - bb[1]=blip_new(32768); - if (bb[1]==NULL) { - logE("not enough memory!"); - return; - } - - bbOut[0]=new short[32768]; - bbOut[1]=new short[32768]; - bbIn[0]=new short[32768]; - bbIn[1]=new short[32768]; - bbInLen=32768; - + // initialize chip switch (sys) { case DIV_SYSTEM_YMU759: dispatch=new DivPlatformOPL; @@ -461,6 +449,23 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do break; } dispatch->init(eng,chanCount,gotRate,flags); + + // initialize output buffers + int outs=dispatch->getOutputCount(); + bbInLen=32768; + + for (int i=0; i& stream, int sRate, size_t len) { @@ -69,8 +69,8 @@ int DivDispatch::dispatch(DivCommand c) { void DivDispatch::reset() { } -bool DivDispatch::isStereo() { - return false; +int DivDispatch::getOutputCount() { + return 1; } bool DivDispatch::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/amiga.cpp b/src/engine/platform/amiga.cpp index 0ecd6ba4..4e588e7d 100644 --- a/src/engine/platform/amiga.cpp +++ b/src/engine/platform/amiga.cpp @@ -401,8 +401,8 @@ void DivPlatformAmiga::reset() { filtConst=filterOn?filtConstOn:filtConstOff; } -bool DivPlatformAmiga::isStereo() { - return true; +int DivPlatformAmiga::getOutputCount() { + return 2; } bool DivPlatformAmiga::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/amiga.h b/src/engine/platform/amiga.h index f2870744..c22ca1af 100644 --- a/src/engine/platform/amiga.h +++ b/src/engine/platform/amiga.h @@ -75,7 +75,7 @@ class DivPlatformAmiga: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); DivMacroInt* getChanMacroInt(int ch); void setFlags(const DivConfig& flags); diff --git a/src/engine/platform/arcade.cpp b/src/engine/platform/arcade.cpp index e7324998..22f5c293 100644 --- a/src/engine/platform/arcade.cpp +++ b/src/engine/platform/arcade.cpp @@ -885,8 +885,8 @@ void DivPlatformArcade::setFlags(const DivConfig& flags) { } } -bool DivPlatformArcade::isStereo() { - return true; +int DivPlatformArcade::getOutputCount() { + return 2; } void DivPlatformArcade::setYMFM(bool use) { diff --git a/src/engine/platform/arcade.h b/src/engine/platform/arcade.h index f8c66aca..2eb26cb7 100644 --- a/src/engine/platform/arcade.h +++ b/src/engine/platform/arcade.h @@ -77,7 +77,7 @@ class DivPlatformArcade: public DivPlatformOPM { DivMacroInt* getChanMacroInt(int ch); void notifyInsChange(int ins); void setFlags(const DivConfig& flags); - bool isStereo(); + int getOutputCount(); void setYMFM(bool use); void poke(unsigned int addr, unsigned short val); void poke(std::vector& wlist); diff --git a/src/engine/platform/ay.cpp b/src/engine/platform/ay.cpp index bc3abc3c..b90e0f2a 100644 --- a/src/engine/platform/ay.cpp +++ b/src/engine/platform/ay.cpp @@ -751,8 +751,8 @@ void DivPlatformAY8910::reset() { portBVal=0; } -bool DivPlatformAY8910::isStereo() { - return true; +int DivPlatformAY8910::getOutputCount() { + return 2; } bool DivPlatformAY8910::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/ay.h b/src/engine/platform/ay.h index e8d7efce..a546baa8 100644 --- a/src/engine/platform/ay.h +++ b/src/engine/platform/ay.h @@ -140,7 +140,7 @@ class DivPlatformAY8910: public DivDispatch { void tick(bool sysTick=true); void muteChannel(int ch, bool mute); void setFlags(const DivConfig& flags); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); DivMacroInt* getChanMacroInt(int ch); bool getDCOffRequired(); diff --git a/src/engine/platform/ay8930.cpp b/src/engine/platform/ay8930.cpp index 5d8cbc13..032fd69e 100644 --- a/src/engine/platform/ay8930.cpp +++ b/src/engine/platform/ay8930.cpp @@ -747,8 +747,8 @@ void DivPlatformAY8930::reset() { immWrite(0x1a,0x00); // or mask } -bool DivPlatformAY8930::isStereo() { - return true; +int DivPlatformAY8930::getOutputCount() { + return 2; } bool DivPlatformAY8930::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/ay8930.h b/src/engine/platform/ay8930.h index 0bd2171a..b89ee6f5 100644 --- a/src/engine/platform/ay8930.h +++ b/src/engine/platform/ay8930.h @@ -142,7 +142,7 @@ class DivPlatformAY8930: public DivDispatch { void tick(bool sysTick=true); void muteChannel(int ch, bool mute); void setFlags(const DivConfig& flags); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); DivMacroInt* getChanMacroInt(int ch); void notifyInsDeletion(void* ins); diff --git a/src/engine/platform/bubsyswsg.cpp b/src/engine/platform/bubsyswsg.cpp index 2d3f6ed0..73fd967b 100644 --- a/src/engine/platform/bubsyswsg.cpp +++ b/src/engine/platform/bubsyswsg.cpp @@ -306,8 +306,8 @@ void DivPlatformBubSysWSG::reset() { k005289.reset(); } -bool DivPlatformBubSysWSG::isStereo() { - return false; +int DivPlatformBubSysWSG::getOutputCount() { + return 1; } bool DivPlatformBubSysWSG::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/bubsyswsg.h b/src/engine/platform/bubsyswsg.h index 92c64d89..900a391a 100644 --- a/src/engine/platform/bubsyswsg.h +++ b/src/engine/platform/bubsyswsg.h @@ -56,7 +56,7 @@ class DivPlatformBubSysWSG: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); DivMacroInt* getChanMacroInt(int ch); void setFlags(const DivConfig& flags); diff --git a/src/engine/platform/ga20.cpp b/src/engine/platform/ga20.cpp index bd3c79df..bb29154a 100644 --- a/src/engine/platform/ga20.cpp +++ b/src/engine/platform/ga20.cpp @@ -361,8 +361,8 @@ void DivPlatformGA20::reset() { } } -bool DivPlatformGA20::isStereo() { - return false; +int DivPlatformGA20::getOutputCount() { + return 1; } void DivPlatformGA20::notifyInsChange(int ins) { diff --git a/src/engine/platform/ga20.h b/src/engine/platform/ga20.h index 88b47547..5e64db77 100644 --- a/src/engine/platform/ga20.h +++ b/src/engine/platform/ga20.h @@ -85,7 +85,7 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf { virtual void forceIns() override; virtual void tick(bool sysTick=true) override; virtual void muteChannel(int ch, bool mute) override; - virtual bool isStereo() override; + virtual int getOutputCount() override; virtual void notifyInsChange(int ins) override; virtual void notifyWaveChange(int wave) override; virtual void notifyInsDeletion(void* ins) override; diff --git a/src/engine/platform/gb.cpp b/src/engine/platform/gb.cpp index e84d212b..2cb64f4a 100644 --- a/src/engine/platform/gb.cpp +++ b/src/engine/platform/gb.cpp @@ -604,8 +604,8 @@ int DivPlatformGB::getPortaFloor(int ch) { return 24; } -bool DivPlatformGB::isStereo() { - return true; +int DivPlatformGB::getOutputCount() { + return 2; } bool DivPlatformGB::getDCOffRequired() { diff --git a/src/engine/platform/gb.h b/src/engine/platform/gb.h index 58196299..ce657fd1 100644 --- a/src/engine/platform/gb.h +++ b/src/engine/platform/gb.h @@ -90,7 +90,7 @@ class DivPlatformGB: public DivDispatch { void tick(bool sysTick=true); void muteChannel(int ch, bool mute); int getPortaFloor(int ch); - bool isStereo(); + int getOutputCount(); bool getDCOffRequired(); void notifyInsChange(int ins); void notifyWaveChange(int wave); diff --git a/src/engine/platform/genesis.cpp b/src/engine/platform/genesis.cpp index 16660720..5bc33950 100644 --- a/src/engine/platform/genesis.cpp +++ b/src/engine/platform/genesis.cpp @@ -1193,8 +1193,8 @@ void DivPlatformGenesis::reset() { delay=0; } -bool DivPlatformGenesis::isStereo() { - return true; +int DivPlatformGenesis::getOutputCount() { + return 2; } bool DivPlatformGenesis::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/genesis.h b/src/engine/platform/genesis.h index d6608382..9bde5aa3 100644 --- a/src/engine/platform/genesis.h +++ b/src/engine/platform/genesis.h @@ -110,7 +110,7 @@ class DivPlatformGenesis: public DivPlatformOPN { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); void setYMFM(bool use); bool keyOffAffectsArp(int ch); bool keyOffAffectsPorta(int ch); diff --git a/src/engine/platform/k007232.cpp b/src/engine/platform/k007232.cpp index 58304553..e4007cfd 100644 --- a/src/engine/platform/k007232.cpp +++ b/src/engine/platform/k007232.cpp @@ -448,8 +448,8 @@ void DivPlatformK007232::reset() { } } -bool DivPlatformK007232::isStereo() { - return stereo; +int DivPlatformK007232::getOutputCount() { + return stereo?2:1; } void DivPlatformK007232::notifyInsChange(int ins) { diff --git a/src/engine/platform/k007232.h b/src/engine/platform/k007232.h index 04e6e73f..78d0522b 100644 --- a/src/engine/platform/k007232.h +++ b/src/engine/platform/k007232.h @@ -91,7 +91,7 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); void notifyInsChange(int ins); void notifyWaveChange(int wave); void notifyInsDeletion(void* ins); diff --git a/src/engine/platform/lynx.cpp b/src/engine/platform/lynx.cpp index 3af5dbd8..978e2600 100644 --- a/src/engine/platform/lynx.cpp +++ b/src/engine/platform/lynx.cpp @@ -393,8 +393,8 @@ void DivPlatformLynx::muteChannel(int ch, bool mute) { if (chan[ch].active) WRITE_VOLUME(ch,(isMuted[ch]?0:(chan[ch].outVol&127))); } -bool DivPlatformLynx::isStereo() { - return true; +int DivPlatformLynx::getOutputCount() { + return 2; } void DivPlatformLynx::forceIns() { diff --git a/src/engine/platform/lynx.h b/src/engine/platform/lynx.h index 463aad3d..dfd89108 100644 --- a/src/engine/platform/lynx.h +++ b/src/engine/platform/lynx.h @@ -79,7 +79,7 @@ class DivPlatformLynx: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); bool keyOffAffectsPorta(int ch); //int getPortaFloor(int ch); diff --git a/src/engine/platform/msm5232.cpp b/src/engine/platform/msm5232.cpp index 4781945f..8a4e369c 100644 --- a/src/engine/platform/msm5232.cpp +++ b/src/engine/platform/msm5232.cpp @@ -371,8 +371,8 @@ void DivPlatformMSM5232::reset() { } } -bool DivPlatformMSM5232::isStereo() { - return false; +int DivPlatformMSM5232::getOutputCount() { + return 1; } bool DivPlatformMSM5232::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/msm5232.h b/src/engine/platform/msm5232.h index 2d4b9705..e6bfb9ff 100644 --- a/src/engine/platform/msm5232.h +++ b/src/engine/platform/msm5232.h @@ -71,7 +71,7 @@ class DivPlatformMSM5232: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void setFlags(const DivConfig& flags); void notifyInsDeletion(void* ins); diff --git a/src/engine/platform/msm6258.cpp b/src/engine/platform/msm6258.cpp index 32fe24cc..c9b6b910 100644 --- a/src/engine/platform/msm6258.cpp +++ b/src/engine/platform/msm6258.cpp @@ -336,8 +336,8 @@ void DivPlatformMSM6258::reset() { delay=0; } -bool DivPlatformMSM6258::isStereo() { - return true; +int DivPlatformMSM6258::getOutputCount() { + return 2; } bool DivPlatformMSM6258::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/msm6258.h b/src/engine/platform/msm6258.h index d64d40b4..b981fd28 100644 --- a/src/engine/platform/msm6258.h +++ b/src/engine/platform/msm6258.h @@ -69,7 +69,7 @@ class DivPlatformMSM6258: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void notifyInsChange(int ins); void notifyInsDeletion(void* ins); diff --git a/src/engine/platform/namcowsg.cpp b/src/engine/platform/namcowsg.cpp index 10b2aeb2..122693d2 100644 --- a/src/engine/platform/namcowsg.cpp +++ b/src/engine/platform/namcowsg.cpp @@ -494,8 +494,8 @@ void DivPlatformNamcoWSG::reset() { namco->device_start(NULL); } -bool DivPlatformNamcoWSG::isStereo() { - return (devType==30); +int DivPlatformNamcoWSG::getOutputCount() { + return (devType==30)?2:1; } bool DivPlatformNamcoWSG::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/namcowsg.h b/src/engine/platform/namcowsg.h index 127f84aa..639b54c4 100644 --- a/src/engine/platform/namcowsg.h +++ b/src/engine/platform/namcowsg.h @@ -65,7 +65,7 @@ class DivPlatformNamcoWSG: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void setDeviceType(int type); void setFlags(const DivConfig& flags); diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index 5af5de8c..aefefcaa 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -1568,8 +1568,8 @@ void DivPlatformOPL::reset() { immWrite(0xbd,(dam<<7)|(dvb<<6)|(properDrums<<5)|drumState); } -bool DivPlatformOPL::isStereo() { - return (oplType==3 || oplType==759); +int DivPlatformOPL::getOutputCount() { + return (oplType==3 || oplType==759)?4:1; } bool DivPlatformOPL::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/opl.h b/src/engine/platform/opl.h index f4a6788c..db8bc475 100644 --- a/src/engine/platform/opl.h +++ b/src/engine/platform/opl.h @@ -119,7 +119,7 @@ class DivPlatformOPL: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); void setYMFM(bool use); void setOPLType(int type, bool drums); bool keyOffAffectsArp(int ch); diff --git a/src/engine/platform/pce.cpp b/src/engine/platform/pce.cpp index 3d9c0aee..cc6f67f3 100644 --- a/src/engine/platform/pce.cpp +++ b/src/engine/platform/pce.cpp @@ -547,8 +547,8 @@ void DivPlatformPCE::reset() { delay=500; } -bool DivPlatformPCE::isStereo() { - return true; +int DivPlatformPCE::getOutputCount() { + return 2; } bool DivPlatformPCE::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/pce.h b/src/engine/platform/pce.h index 7a417a2a..02aea9b3 100644 --- a/src/engine/platform/pce.h +++ b/src/engine/platform/pce.h @@ -87,7 +87,7 @@ class DivPlatformPCE: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void setFlags(const DivConfig& flags); void notifyWaveChange(int wave); diff --git a/src/engine/platform/pcmdac.cpp b/src/engine/platform/pcmdac.cpp index abcdd39f..8d9bb954 100644 --- a/src/engine/platform/pcmdac.cpp +++ b/src/engine/platform/pcmdac.cpp @@ -410,8 +410,8 @@ void DivPlatformPCMDAC::reset() { chan[0].ws.init(NULL,32,255); } -bool DivPlatformPCMDAC::isStereo() { - return true; +int DivPlatformPCMDAC::getOutputCount() { + return 2; } DivMacroInt* DivPlatformPCMDAC::getChanMacroInt(int ch) { diff --git a/src/engine/platform/pcmdac.h b/src/engine/platform/pcmdac.h index 95c01424..280af7a3 100644 --- a/src/engine/platform/pcmdac.h +++ b/src/engine/platform/pcmdac.h @@ -75,7 +75,7 @@ class DivPlatformPCMDAC: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); DivMacroInt* getChanMacroInt(int ch); void setFlags(const DivConfig& flags); void notifyInsChange(int ins); diff --git a/src/engine/platform/pet.cpp b/src/engine/platform/pet.cpp index b3279e8e..1e98257e 100644 --- a/src/engine/platform/pet.cpp +++ b/src/engine/platform/pet.cpp @@ -287,8 +287,8 @@ void DivPlatformPET::reset() { chan[0].std.setEngine(parent); } -bool DivPlatformPET::isStereo() { - return false; +int DivPlatformPET::getOutputCount() { + return 1; } void DivPlatformPET::notifyInsDeletion(void* ins) { diff --git a/src/engine/platform/pet.h b/src/engine/platform/pet.h index 0078e3f3..69bf9dde 100644 --- a/src/engine/platform/pet.h +++ b/src/engine/platform/pet.h @@ -57,7 +57,7 @@ class DivPlatformPET: public DivDispatch { void tick(bool sysTick=true); void muteChannel(int ch, bool mute); void notifyInsDeletion(void* ins); - bool isStereo(); + int getOutputCount(); void poke(unsigned int addr, unsigned short val); void poke(std::vector& wlist); const char** getRegisterSheet(); diff --git a/src/engine/platform/qsound.cpp b/src/engine/platform/qsound.cpp index bc9e0f2a..a307912a 100644 --- a/src/engine/platform/qsound.cpp +++ b/src/engine/platform/qsound.cpp @@ -636,8 +636,8 @@ void DivPlatformQSound::reset() { immWrite(Q1_ECHO_FEEDBACK, echoFeedback << 6); } -bool DivPlatformQSound::isStereo() { - return true; +int DivPlatformQSound::getOutputCount() { + return 2; } bool DivPlatformQSound::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/qsound.h b/src/engine/platform/qsound.h index dbdffd05..f4db4341 100644 --- a/src/engine/platform/qsound.h +++ b/src/engine/platform/qsound.h @@ -74,7 +74,7 @@ class DivPlatformQSound: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void setFlags(const DivConfig& flags); void notifyInsChange(int ins); diff --git a/src/engine/platform/rf5c68.cpp b/src/engine/platform/rf5c68.cpp index bf87ce76..da352925 100644 --- a/src/engine/platform/rf5c68.cpp +++ b/src/engine/platform/rf5c68.cpp @@ -332,8 +332,8 @@ void DivPlatformRF5C68::reset() { } } -bool DivPlatformRF5C68::isStereo() { - return true; +int DivPlatformRF5C68::getOutputCount() { + return 2; } void DivPlatformRF5C68::notifyInsChange(int ins) { diff --git a/src/engine/platform/rf5c68.h b/src/engine/platform/rf5c68.h index 2703a290..f1a19cdf 100644 --- a/src/engine/platform/rf5c68.h +++ b/src/engine/platform/rf5c68.h @@ -67,7 +67,7 @@ class DivPlatformRF5C68: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); void setChipModel(int type); void notifyInsChange(int ins); void notifyWaveChange(int wave); diff --git a/src/engine/platform/saa.cpp b/src/engine/platform/saa.cpp index 102b0021..4823055c 100644 --- a/src/engine/platform/saa.cpp +++ b/src/engine/platform/saa.cpp @@ -419,8 +419,8 @@ void DivPlatformSAA1099::reset() { rWrite(0x1c,1); } -bool DivPlatformSAA1099::isStereo() { - return true; +int DivPlatformSAA1099::getOutputCount() { + return 2; } int DivPlatformSAA1099::getPortaFloor(int ch) { diff --git a/src/engine/platform/saa.h b/src/engine/platform/saa.h index 055a0979..af2f18c1 100644 --- a/src/engine/platform/saa.h +++ b/src/engine/platform/saa.h @@ -86,7 +86,7 @@ class DivPlatformSAA1099: public DivDispatch { void tick(bool sysTick=true); void muteChannel(int ch, bool mute); void setFlags(const DivConfig& flags); - bool isStereo(); + int getOutputCount(); int getPortaFloor(int ch); bool keyOffAffectsArp(int ch); void notifyInsDeletion(void* ins); diff --git a/src/engine/platform/scc.cpp b/src/engine/platform/scc.cpp index 0f5e4585..ba446e23 100644 --- a/src/engine/platform/scc.cpp +++ b/src/engine/platform/scc.cpp @@ -335,8 +335,8 @@ void DivPlatformSCC::reset() { lastUpdated34=0; } -bool DivPlatformSCC::isStereo() { - return false; +int DivPlatformSCC::getOutputCount() { + return 1; } void DivPlatformSCC::notifyWaveChange(int wave) { diff --git a/src/engine/platform/scc.h b/src/engine/platform/scc.h index 5c4db4e2..55d82ca8 100644 --- a/src/engine/platform/scc.h +++ b/src/engine/platform/scc.h @@ -61,7 +61,7 @@ class DivPlatformSCC: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); void notifyWaveChange(int wave); void notifyInsDeletion(void* ins); void poke(unsigned int addr, unsigned short val); diff --git a/src/engine/platform/segapcm.cpp b/src/engine/platform/segapcm.cpp index a206de5c..edc05d47 100644 --- a/src/engine/platform/segapcm.cpp +++ b/src/engine/platform/segapcm.cpp @@ -502,8 +502,8 @@ void DivPlatformSegaPCM::setFlags(const DivConfig& flags) { } } -bool DivPlatformSegaPCM::isStereo() { - return true; +int DivPlatformSegaPCM::getOutputCount() { + return 2; } int DivPlatformSegaPCM::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { diff --git a/src/engine/platform/segapcm.h b/src/engine/platform/segapcm.h index 0c99a20c..8e02d4a8 100644 --- a/src/engine/platform/segapcm.h +++ b/src/engine/platform/segapcm.h @@ -91,7 +91,7 @@ class DivPlatformSegaPCM: public DivDispatch { void notifyInsChange(int ins); void renderSamples(int chipID); void setFlags(const DivConfig& flags); - bool isStereo(); + int getOutputCount(); void poke(unsigned int addr, unsigned short val); void poke(std::vector& wlist); int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); diff --git a/src/engine/platform/sms.cpp b/src/engine/platform/sms.cpp index cf03b93b..47203817 100644 --- a/src/engine/platform/sms.cpp +++ b/src/engine/platform/sms.cpp @@ -444,8 +444,8 @@ void DivPlatformSMS::reset() { } } -bool DivPlatformSMS::isStereo() { - return stereo; +int DivPlatformSMS::getOutputCount() { + return stereo?2:1; } bool DivPlatformSMS::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/sms.h b/src/engine/platform/sms.h index 7bb3b1b1..90000308 100644 --- a/src/engine/platform/sms.h +++ b/src/engine/platform/sms.h @@ -78,7 +78,7 @@ class DivPlatformSMS: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); bool keyOffAffectsPorta(int ch); int getPortaFloor(int ch); diff --git a/src/engine/platform/snes.cpp b/src/engine/platform/snes.cpp index 053ac9b7..fec8139e 100644 --- a/src/engine/platform/snes.cpp +++ b/src/engine/platform/snes.cpp @@ -768,8 +768,8 @@ void DivPlatformSNES::reset() { initEcho(); } -bool DivPlatformSNES::isStereo() { - return true; +int DivPlatformSNES::getOutputCount() { + return 2; } void DivPlatformSNES::notifyInsChange(int ins) { diff --git a/src/engine/platform/snes.h b/src/engine/platform/snes.h index 8d5e2531..094fe03a 100644 --- a/src/engine/platform/snes.h +++ b/src/engine/platform/snes.h @@ -104,7 +104,7 @@ class DivPlatformSNES: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); void notifyInsChange(int ins); void notifyWaveChange(int wave); void setFlags(const DivConfig& flags); diff --git a/src/engine/platform/su.cpp b/src/engine/platform/su.cpp index 1508c684..52fcafb0 100644 --- a/src/engine/platform/su.cpp +++ b/src/engine/platform/su.cpp @@ -499,8 +499,8 @@ void DivPlatformSoundUnit::reset() { rWrite(0xbd,fil1); } -bool DivPlatformSoundUnit::isStereo() { - return true; +int DivPlatformSoundUnit::getOutputCount() { + return 2; } bool DivPlatformSoundUnit::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/su.h b/src/engine/platform/su.h index ebaa911b..d6ca5aee 100644 --- a/src/engine/platform/su.h +++ b/src/engine/platform/su.h @@ -109,7 +109,7 @@ class DivPlatformSoundUnit: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void setFlags(const DivConfig& flags); void notifyInsDeletion(void* ins); diff --git a/src/engine/platform/swan.cpp b/src/engine/platform/swan.cpp index f10a4e4e..92dbe940 100644 --- a/src/engine/platform/swan.cpp +++ b/src/engine/platform/swan.cpp @@ -490,8 +490,8 @@ void DivPlatformSwan::reset() { rWrite(0x11,0x09); // enable speakers } -bool DivPlatformSwan::isStereo() { - return true; +int DivPlatformSwan::getOutputCount() { + return 2; } void DivPlatformSwan::notifyWaveChange(int wave) { diff --git a/src/engine/platform/swan.h b/src/engine/platform/swan.h index b93f0859..167a1180 100644 --- a/src/engine/platform/swan.h +++ b/src/engine/platform/swan.h @@ -69,7 +69,7 @@ class DivPlatformSwan: public DivDispatch { void muteChannel(int ch, bool mute); void notifyWaveChange(int wave); void notifyInsDeletion(void* ins); - bool isStereo(); + int getOutputCount(); void poke(unsigned int addr, unsigned short val); void poke(std::vector& wlist); const char** getRegisterSheet(); diff --git a/src/engine/platform/t6w28.cpp b/src/engine/platform/t6w28.cpp index b318b174..4578e79c 100644 --- a/src/engine/platform/t6w28.cpp +++ b/src/engine/platform/t6w28.cpp @@ -335,8 +335,8 @@ void DivPlatformT6W28::reset() { rWrite(1,0xe7); } -bool DivPlatformT6W28::isStereo() { - return true; +int DivPlatformT6W28::getOutputCount() { + return 2; } bool DivPlatformT6W28::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/t6w28.h b/src/engine/platform/t6w28.h index c526fd5d..e3aa2fcf 100644 --- a/src/engine/platform/t6w28.h +++ b/src/engine/platform/t6w28.h @@ -70,7 +70,7 @@ class DivPlatformT6W28: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void setFlags(const DivConfig& flags); void notifyInsDeletion(void* ins); diff --git a/src/engine/platform/tia.cpp b/src/engine/platform/tia.cpp index 9517204e..5f0467a5 100644 --- a/src/engine/platform/tia.cpp +++ b/src/engine/platform/tia.cpp @@ -342,8 +342,8 @@ float DivPlatformTIA::getPostAmp() { return 0.5f; } -bool DivPlatformTIA::isStereo() { - return (mixingType==2); +int DivPlatformTIA::getOutputCount() { + return (mixingType==2)?2:1; } bool DivPlatformTIA::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/tia.h b/src/engine/platform/tia.h index d60d4165..3317955b 100644 --- a/src/engine/platform/tia.h +++ b/src/engine/platform/tia.h @@ -58,7 +58,7 @@ class DivPlatformTIA: public DivDispatch { void muteChannel(int ch, bool mute); void setFlags(const DivConfig& flags); float getPostAmp(); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void notifyInsDeletion(void* ins); void poke(unsigned int addr, unsigned short val); diff --git a/src/engine/platform/tx81z.cpp b/src/engine/platform/tx81z.cpp index 88266114..e76f4337 100644 --- a/src/engine/platform/tx81z.cpp +++ b/src/engine/platform/tx81z.cpp @@ -947,8 +947,8 @@ void DivPlatformTX81Z::setFlags(const DivConfig& flags) { } } -bool DivPlatformTX81Z::isStereo() { - return true; +int DivPlatformTX81Z::getOutputCount() { + return 2; } int DivPlatformTX81Z::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { diff --git a/src/engine/platform/tx81z.h b/src/engine/platform/tx81z.h index b180f28c..3107f805 100644 --- a/src/engine/platform/tx81z.h +++ b/src/engine/platform/tx81z.h @@ -73,7 +73,7 @@ class DivPlatformTX81Z: public DivPlatformOPM { void muteChannel(int ch, bool mute); void notifyInsChange(int ins); void setFlags(const DivConfig& flags); - bool isStereo(); + int getOutputCount(); void poke(unsigned int addr, unsigned short val); void poke(std::vector& wlist); const char** getRegisterSheet(); diff --git a/src/engine/platform/vb.cpp b/src/engine/platform/vb.cpp index 5d79e508..c1257144 100644 --- a/src/engine/platform/vb.cpp +++ b/src/engine/platform/vb.cpp @@ -465,8 +465,8 @@ void DivPlatformVB::reset() { delay=500; } -bool DivPlatformVB::isStereo() { - return true; +int DivPlatformVB::getOutputCount() { + return 2; } bool DivPlatformVB::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/vb.h b/src/engine/platform/vb.h index bcce42fe..b09e33af 100644 --- a/src/engine/platform/vb.h +++ b/src/engine/platform/vb.h @@ -76,7 +76,7 @@ class DivPlatformVB: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); float getPostAmp(); void setFlags(const DivConfig& flags); diff --git a/src/engine/platform/vera.cpp b/src/engine/platform/vera.cpp index 5021ac85..c5de2721 100644 --- a/src/engine/platform/vera.cpp +++ b/src/engine/platform/vera.cpp @@ -406,8 +406,8 @@ float DivPlatformVERA::getPostAmp() { return 4.0f; } -bool DivPlatformVERA::isStereo() { - return true; +int DivPlatformVERA::getOutputCount() { + return 2; } void DivPlatformVERA::notifyInsDeletion(void* ins) { diff --git a/src/engine/platform/vera.h b/src/engine/platform/vera.h index 57be5dc9..f3467858 100644 --- a/src/engine/platform/vera.h +++ b/src/engine/platform/vera.h @@ -72,7 +72,7 @@ class DivPlatformVERA: public DivDispatch { void muteChannel(int ch, bool mute); void notifyInsDeletion(void* ins); float getPostAmp(); - bool isStereo(); + int getOutputCount(); void poke(unsigned int addr, unsigned short val); void poke(std::vector& wlist); const char** getRegisterSheet(); diff --git a/src/engine/platform/vic20.cpp b/src/engine/platform/vic20.cpp index 3e8046d2..be33140b 100644 --- a/src/engine/platform/vic20.cpp +++ b/src/engine/platform/vic20.cpp @@ -299,8 +299,8 @@ void DivPlatformVIC20::reset() { vic_sound_clock(vic,4); } -bool DivPlatformVIC20::isStereo() { - return false; +int DivPlatformVIC20::getOutputCount() { + return 1; } void DivPlatformVIC20::notifyInsDeletion(void* ins) { diff --git a/src/engine/platform/vic20.h b/src/engine/platform/vic20.h index a2628872..fd650b55 100644 --- a/src/engine/platform/vic20.h +++ b/src/engine/platform/vic20.h @@ -56,7 +56,7 @@ class DivPlatformVIC20: public DivDispatch { void muteChannel(int ch, bool mute); void setFlags(const DivConfig& flags); void notifyInsDeletion(void* ins); - bool isStereo(); + int getOutputCount(); void poke(unsigned int addr, unsigned short val); void poke(std::vector& wlist); const char** getRegisterSheet(); diff --git a/src/engine/platform/x1_010.cpp b/src/engine/platform/x1_010.cpp index 093b952c..0a751097 100644 --- a/src/engine/platform/x1_010.cpp +++ b/src/engine/platform/x1_010.cpp @@ -894,8 +894,8 @@ void DivPlatformX1_010::reset() { } } -bool DivPlatformX1_010::isStereo() { - return stereo; +int DivPlatformX1_010::getOutputCount() { + return stereo?2:1; } bool DivPlatformX1_010::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/x1_010.h b/src/engine/platform/x1_010.h index 28b180eb..5c106eed 100644 --- a/src/engine/platform/x1_010.h +++ b/src/engine/platform/x1_010.h @@ -138,7 +138,7 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void setFlags(const DivConfig& flags); void notifyWaveChange(int wave); diff --git a/src/engine/platform/ym2203.cpp b/src/engine/platform/ym2203.cpp index 3419a1b6..453fa905 100644 --- a/src/engine/platform/ym2203.cpp +++ b/src/engine/platform/ym2203.cpp @@ -967,8 +967,8 @@ void DivPlatformYM2203::reset() { ay->flushWrites(); } -bool DivPlatformYM2203::isStereo() { - return false; +int DivPlatformYM2203::getOutputCount() { + return 1; } bool DivPlatformYM2203::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/ym2203.h b/src/engine/platform/ym2203.h index 3d4670f7..2076aa25 100644 --- a/src/engine/platform/ym2203.h +++ b/src/engine/platform/ym2203.h @@ -70,7 +70,7 @@ class DivPlatformYM2203: public DivPlatformOPN { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void notifyInsChange(int ins); void notifyInsDeletion(void* ins); diff --git a/src/engine/platform/ym2608.cpp b/src/engine/platform/ym2608.cpp index fc0b08de..fd73fd2c 100644 --- a/src/engine/platform/ym2608.cpp +++ b/src/engine/platform/ym2608.cpp @@ -1424,8 +1424,8 @@ void DivPlatformYM2608::reset() { ay->flushWrites(); } -bool DivPlatformYM2608::isStereo() { - return true; +int DivPlatformYM2608::getOutputCount() { + return 2; } bool DivPlatformYM2608::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/ym2608.h b/src/engine/platform/ym2608.h index 4e6c59b9..9dfa2e8d 100644 --- a/src/engine/platform/ym2608.h +++ b/src/engine/platform/ym2608.h @@ -85,7 +85,7 @@ class DivPlatformYM2608: public DivPlatformOPN { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void notifyInsChange(int ins); void notifyInsDeletion(void* ins); diff --git a/src/engine/platform/ym2610.cpp b/src/engine/platform/ym2610.cpp index 9251a39f..b6f23154 100644 --- a/src/engine/platform/ym2610.cpp +++ b/src/engine/platform/ym2610.cpp @@ -1372,8 +1372,8 @@ void DivPlatformYM2610::reset() { immWrite(0x1b,0xff); // B } -bool DivPlatformYM2610::isStereo() { - return true; +int DivPlatformYM2610::getOutputCount() { + return 2; } bool DivPlatformYM2610::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/ym2610.h b/src/engine/platform/ym2610.h index f2ffb9c7..82cce7b5 100644 --- a/src/engine/platform/ym2610.h +++ b/src/engine/platform/ym2610.h @@ -53,7 +53,7 @@ class DivPlatformYM2610: public DivPlatformYM2610Base { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void notifyInsChange(int ins); void notifyInsDeletion(void* ins); diff --git a/src/engine/platform/ym2610b.cpp b/src/engine/platform/ym2610b.cpp index 593ecfa0..f78d62d7 100644 --- a/src/engine/platform/ym2610b.cpp +++ b/src/engine/platform/ym2610b.cpp @@ -1443,8 +1443,8 @@ void DivPlatformYM2610B::reset() { ay->flushWrites(); } -bool DivPlatformYM2610B::isStereo() { - return true; +int DivPlatformYM2610B::getOutputCount() { + return 2; } bool DivPlatformYM2610B::keyOffAffectsArp(int ch) { diff --git a/src/engine/platform/ym2610b.h b/src/engine/platform/ym2610b.h index 6052a535..3c1817a4 100644 --- a/src/engine/platform/ym2610b.h +++ b/src/engine/platform/ym2610b.h @@ -49,7 +49,7 @@ class DivPlatformYM2610B: public DivPlatformYM2610Base { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); - bool isStereo(); + int getOutputCount(); bool keyOffAffectsArp(int ch); void notifyInsChange(int ins); void notifyInsDeletion(void* ins); diff --git a/src/engine/platform/ym2610shared.h b/src/engine/platform/ym2610shared.h index ab1bd052..51718699 100644 --- a/src/engine/platform/ym2610shared.h +++ b/src/engine/platform/ym2610shared.h @@ -119,8 +119,8 @@ class DivPlatformYM2610Base: public DivPlatformOPN { } } - bool isStereo() { - return true; + int getOutputCount() { + return 2; } const void* getSampleMem(int index) { diff --git a/src/engine/platform/ymz280b.cpp b/src/engine/platform/ymz280b.cpp index 7c7c5686..fdab2cd6 100644 --- a/src/engine/platform/ymz280b.cpp +++ b/src/engine/platform/ymz280b.cpp @@ -372,8 +372,8 @@ void DivPlatformYMZ280B::reset() { } } -bool DivPlatformYMZ280B::isStereo() { - return true; +int DivPlatformYMZ280B::getOutputCount() { + return 2; } void DivPlatformYMZ280B::notifyInsChange(int ins) { diff --git a/src/engine/platform/ymz280b.h b/src/engine/platform/ymz280b.h index 810d5223..37e06cf3 100644 --- a/src/engine/platform/ymz280b.h +++ b/src/engine/platform/ymz280b.h @@ -68,7 +68,7 @@ class DivPlatformYMZ280B: public DivDispatch { void tick(bool sysTick=true); void muteChannel(int ch, bool mute); float getPostAmp(); - bool isStereo(); + int getOutputCount(); void setChipModel(int type); void notifyInsChange(int ins); void notifyWaveChange(int wave); From 3e0dcbb0ae7db50bd60e31950cc05fb2ef3ee392 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 2 Jan 2023 04:53:37 -0500 Subject: [PATCH 02/72] aaaaaaaa --- src/engine/platform/amiga.cpp | 8 ++++---- src/engine/platform/amiga.h | 2 +- src/engine/platform/arcade.cpp | 14 +++++++------- src/engine/platform/arcade.h | 2 +- src/engine/platform/ay.cpp | 14 +++++++------- src/engine/platform/ay.h | 2 +- src/engine/platform/ay8930.cpp | 10 +++++----- src/engine/platform/ay8930.h | 2 +- src/engine/platform/bubsyswsg.cpp | 6 +++--- src/engine/platform/bubsyswsg.h | 2 +- src/engine/platform/c64.cpp | 8 ++++---- src/engine/platform/c64.h | 2 +- src/engine/platform/dummy.cpp | 6 +++--- src/engine/platform/dummy.h | 2 +- src/engine/platform/fds.cpp | 6 +++--- src/engine/platform/fds.h | 2 +- src/engine/platform/ga20.cpp | 4 ++-- src/engine/platform/ga20.h | 2 +- src/engine/platform/gb.cpp | 6 +++--- src/engine/platform/gb.h | 2 +- src/engine/platform/genesis.cpp | 10 +++++----- src/engine/platform/genesis.h | 2 +- src/engine/platform/k007232.cpp | 8 ++++---- src/engine/platform/k007232.h | 2 +- src/engine/platform/lynx.cpp | 2 +- src/engine/platform/lynx.h | 2 +- src/engine/platform/mmc5.cpp | 4 ++-- src/engine/platform/mmc5.h | 2 +- src/engine/platform/msm5232.cpp | 6 +++--- src/engine/platform/msm5232.h | 2 +- src/engine/platform/msm6258.cpp | 10 +++++----- src/engine/platform/msm6258.h | 2 +- src/engine/platform/msm6295.cpp | 4 ++-- src/engine/platform/msm6295.h | 2 +- src/engine/platform/n163.cpp | 4 ++-- src/engine/platform/n163.h | 2 +- src/engine/platform/namcowsg.cpp | 2 +- src/engine/platform/namcowsg.h | 2 +- src/engine/platform/nes.cpp | 6 +++--- src/engine/platform/nes.h | 2 +- src/engine/platform/opl.cpp | 6 +++--- src/engine/platform/opl.h | 2 +- src/engine/platform/opll.cpp | 4 ++-- src/engine/platform/opll.h | 2 +- src/engine/platform/pce.cpp | 6 +++--- src/engine/platform/pce.h | 2 +- src/engine/platform/pcmdac.cpp | 14 +++++++------- src/engine/platform/pcmdac.h | 2 +- src/engine/platform/pcspkr.cpp | 16 ++++++++-------- src/engine/platform/pcspkr.h | 2 +- src/engine/platform/pet.cpp | 10 +++++----- src/engine/platform/pet.h | 2 +- src/engine/platform/pokemini.cpp | 6 +++--- src/engine/platform/pokemini.h | 2 +- src/engine/platform/pokey.cpp | 2 +- src/engine/platform/pokey.h | 2 +- src/engine/platform/pong.cpp | 6 +++--- src/engine/platform/pong.h | 2 +- src/engine/platform/qsound.cpp | 6 +++--- src/engine/platform/qsound.h | 2 +- src/engine/platform/rf5c68.cpp | 4 ++-- src/engine/platform/rf5c68.h | 2 +- src/engine/platform/saa.cpp | 10 +++++----- src/engine/platform/saa.h | 2 +- src/engine/platform/scc.cpp | 4 ++-- src/engine/platform/scc.h | 2 +- src/engine/platform/segapcm.cpp | 6 +++--- src/engine/platform/segapcm.h | 2 +- src/engine/platform/sms.cpp | 10 +++++----- src/engine/platform/sms.h | 2 +- src/engine/platform/snes.cpp | 6 +++--- src/engine/platform/snes.h | 2 +- src/engine/platform/su.cpp | 4 ++-- src/engine/platform/su.h | 2 +- src/engine/platform/swan.cpp | 6 +++--- src/engine/platform/swan.h | 2 +- src/engine/platform/t6w28.cpp | 6 +++--- src/engine/platform/t6w28.h | 2 +- src/engine/platform/tia.cpp | 10 +++++----- src/engine/platform/tia.h | 2 +- src/engine/platform/tx81z.cpp | 6 +++--- src/engine/platform/tx81z.h | 2 +- src/engine/platform/vb.cpp | 6 +++--- src/engine/platform/vb.h | 2 +- src/engine/platform/vera.cpp | 6 +++--- src/engine/platform/vera.h | 2 +- src/engine/platform/vic20.cpp | 6 +++--- src/engine/platform/vic20.h | 2 +- src/engine/platform/vrc6.cpp | 4 ++-- src/engine/platform/vrc6.h | 2 +- src/engine/platform/x1_010.cpp | 6 +++--- src/engine/platform/x1_010.h | 2 +- src/engine/platform/ym2203.cpp | 6 +++--- src/engine/platform/ym2203.h | 2 +- src/engine/platform/ym2608.cpp | 10 +++++----- src/engine/platform/ym2608.h | 2 +- src/engine/platform/ym2610.cpp | 10 +++++----- src/engine/platform/ym2610.h | 2 +- src/engine/platform/ym2610b.cpp | 10 +++++----- src/engine/platform/ym2610b.h | 2 +- src/engine/platform/ymz280b.cpp | 6 +++--- src/engine/platform/ymz280b.h | 2 +- src/engine/platform/zxbeeper.cpp | 6 +++--- src/engine/platform/zxbeeper.h | 2 +- 104 files changed, 233 insertions(+), 233 deletions(-) diff --git a/src/engine/platform/amiga.cpp b/src/engine/platform/amiga.cpp index 4e588e7d..6f70a310 100644 --- a/src/engine/platform/amiga.cpp +++ b/src/engine/platform/amiga.cpp @@ -75,9 +75,9 @@ const char** DivPlatformAmiga::getRegisterSheet() { if (chan[i+1].freq>12; filter[1][0]+=(filtConst*(outR-filter[1][0]))>>12; filter[1][1]+=(filtConst*(filter[1][0]-filter[1][1]))>>12; - bufL[h]=filter[0][1]; - bufR[h]=filter[1][1]; + buf[0][h]=filter[0][1]; + buf[1][h]=filter[1][1]; } } diff --git a/src/engine/platform/amiga.h b/src/engine/platform/amiga.h index c22ca1af..494b5da7 100644 --- a/src/engine/platform/amiga.h +++ b/src/engine/platform/amiga.h @@ -67,7 +67,7 @@ class DivPlatformAmiga: public DivDispatch { friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivDispatchOscBuffer* getOscBuffer(int chan); diff --git a/src/engine/platform/arcade.cpp b/src/engine/platform/arcade.cpp index 22f5c293..3912921c 100644 --- a/src/engine/platform/arcade.cpp +++ b/src/engine/platform/arcade.cpp @@ -84,8 +84,8 @@ void DivPlatformArcade::acquire_nuked(short* bufL, short* bufR, size_t start, si if (o[1]<-32768) o[1]=-32768; if (o[1]>32767) o[1]=32767; - bufL[h]=o[0]; - bufR[h]=o[1]; + buf[0][h]=o[0]; + buf[1][h]=o[1]; } } @@ -121,16 +121,16 @@ void DivPlatformArcade::acquire_ymfm(short* bufL, short* bufR, size_t start, siz if (os[1]<-32768) os[1]=-32768; if (os[1]>32767) os[1]=32767; - bufL[h]=os[0]; - bufR[h]=os[1]; + buf[0][h]=os[0]; + buf[1][h]=os[1]; } } -void DivPlatformArcade::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformArcade::acquire(short** buf, size_t len) { if (useYMFM) { - acquire_ymfm(bufL,bufR,start,len); + acquire_ymfm(buf[0],buf[1],0,len); } else { - acquire_nuked(bufL,bufR,start,len); + acquire_nuked(buf[0],buf[1],0,len); } } diff --git a/src/engine/platform/arcade.h b/src/engine/platform/arcade.h index 2eb26cb7..f2ec0faf 100644 --- a/src/engine/platform/arcade.h +++ b/src/engine/platform/arcade.h @@ -64,7 +64,7 @@ class DivPlatformArcade: public DivPlatformOPM { friend void putDispatchChan(void*,int,int); friend void putDispatchChip(void*,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivDispatchOscBuffer* getOscBuffer(int chan); diff --git a/src/engine/platform/ay.cpp b/src/engine/platform/ay.cpp index b90e0f2a..4a2a4b59 100644 --- a/src/engine/platform/ay.cpp +++ b/src/engine/platform/ay.cpp @@ -169,7 +169,7 @@ void DivPlatformAY8910::checkWrites() { } } -void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformAY8910::acquire(short** buf, size_t len) { if (ayBufLensound_stream_update(ayBuf,1); - bufL[i+start]=ayBuf[0][0]; - bufR[i+start]=bufL[i+start]; + buf[0][i]=ayBuf[0][0]; + buf[1][i]=buf[0][i]; oscBuf[0]->data[oscBuf[0]->needle++]=sunsoftVolTable[31-(ay->lastIndx&31)]>>3; oscBuf[1]->data[oscBuf[1]->needle++]=sunsoftVolTable[31-((ay->lastIndx>>5)&31)]>>3; @@ -198,11 +198,11 @@ void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t l ay->sound_stream_update(ayBuf,1); if (stereo) { - bufL[i+start]=ayBuf[0][0]+ayBuf[1][0]+((ayBuf[2][0]*stereoSep)>>8); - bufR[i+start]=((ayBuf[0][0]*stereoSep)>>8)+ayBuf[1][0]+ayBuf[2][0]; + buf[0][i]=ayBuf[0][0]+ayBuf[1][0]+((ayBuf[2][0]*stereoSep)>>8); + buf[1][i]=((ayBuf[0][0]*stereoSep)>>8)+ayBuf[1][0]+ayBuf[2][0]; } else { - bufL[i+start]=ayBuf[0][0]+ayBuf[1][0]+ayBuf[2][0]; - bufR[i+start]=bufL[i+start]; + buf[0][i]=ayBuf[0][0]+ayBuf[1][0]+ayBuf[2][0]; + buf[1][i]=buf[0][i]; } oscBuf[0]->data[oscBuf[0]->needle++]=ayBuf[0][0]<<2; diff --git a/src/engine/platform/ay.h b/src/engine/platform/ay.h index a546baa8..ad8b4625 100644 --- a/src/engine/platform/ay.h +++ b/src/engine/platform/ay.h @@ -128,7 +128,7 @@ class DivPlatformAY8910: public DivDispatch { public: void setExtClockDiv(unsigned int eclk=COLOR_NTSC, unsigned char ediv=8); - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivDispatchOscBuffer* getOscBuffer(int chan); diff --git a/src/engine/platform/ay8930.cpp b/src/engine/platform/ay8930.cpp index 032fd69e..85eca751 100644 --- a/src/engine/platform/ay8930.cpp +++ b/src/engine/platform/ay8930.cpp @@ -164,7 +164,7 @@ void DivPlatformAY8930::checkWrites() { } } -void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformAY8930::acquire(short** buf, size_t len) { if (ayBufLensound_stream_update(ayBuf,1); if (stereo) { - bufL[i+start]=ayBuf[0][0]+ayBuf[1][0]+((ayBuf[2][0]*stereoSep)>>8); - bufR[i+start]=((ayBuf[0][0]*stereoSep)>>8)+ayBuf[1][0]+ayBuf[2][0]; + buf[0][i]=ayBuf[0][0]+ayBuf[1][0]+((ayBuf[2][0]*stereoSep)>>8); + buf[1][i]=((ayBuf[0][0]*stereoSep)>>8)+ayBuf[1][0]+ayBuf[2][0]; } else { - bufL[i+start]=ayBuf[0][0]+ayBuf[1][0]+ayBuf[2][0]; - bufR[i+start]=bufL[i+start]; + buf[0][i]=ayBuf[0][0]+ayBuf[1][0]+ayBuf[2][0]; + buf[1][i]=buf[0][i]; } oscBuf[0]->data[oscBuf[0]->needle++]=ayBuf[0][0]<<2; diff --git a/src/engine/platform/ay8930.h b/src/engine/platform/ay8930.h index b89ee6f5..0e60c350 100644 --- a/src/engine/platform/ay8930.h +++ b/src/engine/platform/ay8930.h @@ -131,7 +131,7 @@ class DivPlatformAY8930: public DivDispatch { friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivDispatchOscBuffer* getOscBuffer(int chan); diff --git a/src/engine/platform/bubsyswsg.cpp b/src/engine/platform/bubsyswsg.cpp index 73fd967b..31869722 100644 --- a/src/engine/platform/bubsyswsg.cpp +++ b/src/engine/platform/bubsyswsg.cpp @@ -39,9 +39,9 @@ const char** DivPlatformBubSysWSG::getRegisterSheet() { return regCheatSheetBubSysWSG; } -void DivPlatformBubSysWSG::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformBubSysWSG::acquire(short** buf, size_t len) { int chanOut=0; - for (size_t h=start; h32767) out=32767; //printf("out: %d\n",out); - bufL[h]=bufR[h]=out; + buf[0][h]=buf[1][h]=out; } } diff --git a/src/engine/platform/bubsyswsg.h b/src/engine/platform/bubsyswsg.h index 900a391a..d544c2ec 100644 --- a/src/engine/platform/bubsyswsg.h +++ b/src/engine/platform/bubsyswsg.h @@ -45,7 +45,7 @@ class DivPlatformBubSysWSG: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivDispatchOscBuffer* getOscBuffer(int chan); diff --git a/src/engine/platform/c64.cpp b/src/engine/platform/c64.cpp index 8091e179..4d1caf9a 100644 --- a/src/engine/platform/c64.cpp +++ b/src/engine/platform/c64.cpp @@ -63,9 +63,9 @@ const char** DivPlatformC64::getRegisterSheet() { return regCheatSheetSID; } -void DivPlatformC64::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformC64::acquire(short** buf, size_t len) { int dcOff=isFP?0:sid.get_dc(0); - for (size_t i=start; i=4) { writeOscBuf=0; oscBuf[0]->data[oscBuf[0]->needle++]=(sid_fp.lastChanOut[0]-dcOff)>>5; @@ -86,7 +86,7 @@ void DivPlatformC64::acquire(short* bufL, short* bufR, size_t start, size_t len) } } else { sid.clock(); - bufL[i]=sid.output(); + buf[0][i]=sid.output(); if (++writeOscBuf>=16) { writeOscBuf=0; oscBuf[0]->data[oscBuf[0]->needle++]=(sid.last_chan_out[0]-dcOff)>>5; diff --git a/src/engine/platform/c64.h b/src/engine/platform/c64.h index 9bdabbe4..28cf5b29 100644 --- a/src/engine/platform/c64.h +++ b/src/engine/platform/c64.h @@ -79,7 +79,7 @@ class DivPlatformC64: public DivDispatch { void updateFilter(); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivDispatchOscBuffer* getOscBuffer(int chan); diff --git a/src/engine/platform/dummy.cpp b/src/engine/platform/dummy.cpp index 898809cc..28cb5d40 100644 --- a/src/engine/platform/dummy.cpp +++ b/src/engine/platform/dummy.cpp @@ -24,9 +24,9 @@ #define CHIP_FREQBASE 2048 -void DivPlatformDummy::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformDummy::acquire(short** buf, size_t len) { int chanOut; - for (size_t i=start; i32767) out=32767; - bufL[i]=out; + buf[0][i]=out; } } diff --git a/src/engine/platform/dummy.h b/src/engine/platform/dummy.h index d3a1b91e..c12d494b 100644 --- a/src/engine/platform/dummy.h +++ b/src/engine/platform/dummy.h @@ -37,7 +37,7 @@ class DivPlatformDummy: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); void muteChannel(int ch, bool mute); int dispatch(DivCommand c); void* getChanState(int chan); diff --git a/src/engine/platform/fds.cpp b/src/engine/platform/fds.cpp index e0047ace..bdae0c19 100644 --- a/src/engine/platform/fds.cpp +++ b/src/engine/platform/fds.cpp @@ -61,7 +61,7 @@ void DivPlatformFDS::acquire_puNES(short* bufL, short* bufR, size_t start, size_ int sample=isMuted[0]?0:fds->snd.main.output; if (sample>32767) sample=32767; if (sample<-32768) sample=-32768; - bufL[i]=sample; + buf[0][i]=sample; if (++writeOscBuf>=32) { writeOscBuf=0; oscBuf->data[oscBuf->needle++]=sample<<1; @@ -77,7 +77,7 @@ void DivPlatformFDS::acquire_NSFPlay(short* bufL, short* bufR, size_t start, siz int sample=isMuted[0]?0:(out[0]<<1); if (sample>32767) sample=32767; if (sample<-32768) sample=-32768; - bufL[i]=sample; + buf[0][i]=sample; if (++writeOscBuf>=32) { writeOscBuf=0; oscBuf->data[oscBuf->needle++]=sample<<1; @@ -93,7 +93,7 @@ void DivPlatformFDS::doWrite(unsigned short addr, unsigned char data) { } } -void DivPlatformFDS::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformFDS::acquire(short** buf, size_t len) { if (useNP) { acquire_NSFPlay(bufL,bufR,start,len); } else { diff --git a/src/engine/platform/fds.h b/src/engine/platform/fds.h index beabb641..a6e7862e 100644 --- a/src/engine/platform/fds.h +++ b/src/engine/platform/fds.h @@ -66,7 +66,7 @@ class DivPlatformFDS: public DivDispatch { void acquire_NSFPlay(short* bufL, short* bufR, size_t start, size_t len); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/ga20.cpp b/src/engine/platform/ga20.cpp index bb29154a..990531b3 100644 --- a/src/engine/platform/ga20.cpp +++ b/src/engine/platform/ga20.cpp @@ -51,7 +51,7 @@ inline void DivPlatformGA20::chWrite(unsigned char ch, unsigned int addr, unsign } } -void DivPlatformGA20::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformGA20::acquire(short** buf, size_t len) { if (ga20BufLen>2; + buf[0][h]=(signed int)(ga20Buf[0][h]+ga20Buf[1][h]+ga20Buf[2][h]+ga20Buf[3][h])>>2; for (int i=0; i<4; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=ga20Buf[i][h]; } diff --git a/src/engine/platform/ga20.h b/src/engine/platform/ga20.h index 5e64db77..9c67a9fd 100644 --- a/src/engine/platform/ga20.h +++ b/src/engine/platform/ga20.h @@ -74,7 +74,7 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf { void chWrite(unsigned char ch, unsigned int addr, unsigned char val); public: virtual u8 read_byte(u32 address) override; - virtual void acquire(short* bufL, short* bufR, size_t start, size_t len) override; + virtual void acquire(short** buf, size_t len) override; virtual int dispatch(DivCommand c) override; virtual void* getChanState(int chan) override; virtual DivMacroInt* getChanMacroInt(int ch) override; diff --git a/src/engine/platform/gb.cpp b/src/engine/platform/gb.cpp index 2cb64f4a..c2f301e2 100644 --- a/src/engine/platform/gb.cpp +++ b/src/engine/platform/gb.cpp @@ -61,7 +61,7 @@ const char** DivPlatformGB::getRegisterSheet() { return regCheatSheetGB; } -void DivPlatformGB::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformGB::acquire(short** buf, size_t len) { for (size_t i=start; iapu_output.final_sample.left; - bufR[i]=gb->apu_output.final_sample.right; + buf[0][i]=gb->apu_output.final_sample.left; + buf[1][i]=gb->apu_output.final_sample.right; for (int i=0; i<4; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=(gb->apu_output.current_sample[i].left+gb->apu_output.current_sample[i].right)<<6; diff --git a/src/engine/platform/gb.h b/src/engine/platform/gb.h index ce657fd1..8f70fecb 100644 --- a/src/engine/platform/gb.h +++ b/src/engine/platform/gb.h @@ -78,7 +78,7 @@ class DivPlatformGB: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/genesis.cpp b/src/engine/platform/genesis.cpp index 5bc33950..ca88598a 100644 --- a/src/engine/platform/genesis.cpp +++ b/src/engine/platform/genesis.cpp @@ -186,8 +186,8 @@ void DivPlatformGenesis::acquire_nuked(short* bufL, short* bufR, size_t start, s if (os[1]<-32768) os[1]=-32768; if (os[1]>32767) os[1]=32767; - bufL[h]=os[0]; - bufR[h]=os[1]; + buf[0][h]=os[0]; + buf[1][h]=os[1]; } } @@ -242,12 +242,12 @@ void DivPlatformGenesis::acquire_ymfm(short* bufL, short* bufR, size_t start, si if (os[1]<-32768) os[1]=-32768; if (os[1]>32767) os[1]=32767; - bufL[h]=os[0]; - bufR[h]=os[1]; + buf[0][h]=os[0]; + buf[1][h]=os[1]; } } -void DivPlatformGenesis::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformGenesis::acquire(short** buf, size_t len) { if (useYMFM) { acquire_ymfm(bufL,bufR,start,len); } else { diff --git a/src/engine/platform/genesis.h b/src/engine/platform/genesis.h index 9bde5aa3..d384111b 100644 --- a/src/engine/platform/genesis.h +++ b/src/engine/platform/genesis.h @@ -98,7 +98,7 @@ class DivPlatformGenesis: public DivPlatformOPN { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); void fillStream(std::vector& stream, int sRate, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); diff --git a/src/engine/platform/k007232.cpp b/src/engine/platform/k007232.cpp index e4007cfd..007ed796 100644 --- a/src/engine/platform/k007232.cpp +++ b/src/engine/platform/k007232.cpp @@ -54,7 +54,7 @@ inline void DivPlatformK007232::chWrite(unsigned char ch, unsigned int addr, uns } } -void DivPlatformK007232::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformK007232::acquire(short** buf, size_t len) { for (size_t h=start; h>4)&0xf)),(k007232.output(1)*((vol2>>4)&0xf))}; - bufL[h]=(lout[0]+lout[1])<<4; - bufR[h]=(rout[0]+rout[1])<<4; + buf[0][h]=(lout[0]+lout[1])<<4; + buf[1][h]=(rout[0]+rout[1])<<4; for (int i=0; i<2; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=(lout[i]+rout[i])<<4; } } else { const unsigned char vol=regPool[0xc]; const signed int out[2]={(k007232.output(0)*(vol&0xf)),(k007232.output(1)*((vol>>4)&0xf))}; - bufL[h]=bufR[h]=(out[0]+out[1])<<4; + buf[0][h]=buf[1][h]=(out[0]+out[1])<<4; for (int i=0; i<2; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=out[i]<<5; } diff --git a/src/engine/platform/k007232.h b/src/engine/platform/k007232.h index 78d0522b..8d9aeb28 100644 --- a/src/engine/platform/k007232.h +++ b/src/engine/platform/k007232.h @@ -80,7 +80,7 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf { void chWrite(unsigned char ch, unsigned int addr, unsigned char val); public: u8 read_sample(u8 ne, u32 address); - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/lynx.cpp b/src/engine/platform/lynx.cpp index 978e2600..8311739c 100644 --- a/src/engine/platform/lynx.cpp +++ b/src/engine/platform/lynx.cpp @@ -130,7 +130,7 @@ const char** DivPlatformLynx::getRegisterSheet() { return regCheatSheetLynx; } -void DivPlatformLynx::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformLynx::acquire(short** buf, size_t len) { for (size_t h=start; h=0 && chan[i].samplesong.sampleLen) { diff --git a/src/engine/platform/lynx.h b/src/engine/platform/lynx.h index dfd89108..ec2208d3 100644 --- a/src/engine/platform/lynx.h +++ b/src/engine/platform/lynx.h @@ -68,7 +68,7 @@ class DivPlatformLynx: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/mmc5.cpp b/src/engine/platform/mmc5.cpp index a00dd771..3e992068 100644 --- a/src/engine/platform/mmc5.cpp +++ b/src/engine/platform/mmc5.cpp @@ -43,7 +43,7 @@ const char** DivPlatformMMC5::getRegisterSheet() { return regCheatSheetMMC5; } -void DivPlatformMMC5::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformMMC5::acquire(short** buf, size_t len) { for (size_t i=start; i32767) sample=32767; if (sample<-32768) sample=-32768; - bufL[i]=sample; + buf[0][i]=sample; if (++writeOscBuf>=32) { writeOscBuf=0; diff --git a/src/engine/platform/mmc5.h b/src/engine/platform/mmc5.h index a3ab9053..3e83ff06 100644 --- a/src/engine/platform/mmc5.h +++ b/src/engine/platform/mmc5.h @@ -50,7 +50,7 @@ class DivPlatformMMC5: public DivDispatch { friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/msm5232.cpp b/src/engine/platform/msm5232.cpp index 8a4e369c..1ed6e5a2 100644 --- a/src/engine/platform/msm5232.cpp +++ b/src/engine/platform/msm5232.cpp @@ -45,7 +45,7 @@ const char** DivPlatformMSM5232::getRegisterSheet() { return regCheatSheetMSM5232; } -void DivPlatformMSM5232::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformMSM5232::acquire(short** buf, size_t len) { for (size_t h=start; h>8; + buf[0][h]+=(temp[i]*partVolume[i])>>8; } } } diff --git a/src/engine/platform/msm5232.h b/src/engine/platform/msm5232.h index e6bfb9ff..26d2a34b 100644 --- a/src/engine/platform/msm5232.h +++ b/src/engine/platform/msm5232.h @@ -60,7 +60,7 @@ class DivPlatformMSM5232: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/msm6258.cpp b/src/engine/platform/msm6258.cpp index c9b6b910..4824af90 100644 --- a/src/engine/platform/msm6258.cpp +++ b/src/engine/platform/msm6258.cpp @@ -30,7 +30,7 @@ const char** DivPlatformMSM6258::getRegisterSheet() { return NULL; } -void DivPlatformMSM6258::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformMSM6258::acquire(short** buf, size_t len) { short* outs[2]={ &msmOut, NULL @@ -78,12 +78,12 @@ void DivPlatformMSM6258::acquire(short* bufL, short* bufR, size_t start, size_t } if (isMuted[0]) { - bufL[h]=0; - bufR[h]=0; + buf[0][h]=0; + buf[1][h]=0; oscBuf[0]->data[oscBuf[0]->needle++]=0; } else { - bufL[h]=(msmPan&2)?msmOut:0; - bufR[h]=(msmPan&1)?msmOut:0; + buf[0][h]=(msmPan&2)?msmOut:0; + buf[1][h]=(msmPan&1)?msmOut:0; oscBuf[0]->data[oscBuf[0]->needle++]=msmPan?msmOut:0; } } diff --git a/src/engine/platform/msm6258.h b/src/engine/platform/msm6258.h index b981fd28..47d079ca 100644 --- a/src/engine/platform/msm6258.h +++ b/src/engine/platform/msm6258.h @@ -58,7 +58,7 @@ class DivPlatformMSM6258: public DivDispatch { friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/msm6295.cpp b/src/engine/platform/msm6295.cpp index 2423167f..3247d9ca 100644 --- a/src/engine/platform/msm6295.cpp +++ b/src/engine/platform/msm6295.cpp @@ -37,7 +37,7 @@ u8 DivPlatformMSM6295::read_byte(u32 address) { return adpcmMem[address&0x3ffff]; } -void DivPlatformMSM6295::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformMSM6295::acquire(short** buf, size_t len) { for (size_t h=start; h=22) { updateOsc=0; diff --git a/src/engine/platform/msm6295.h b/src/engine/platform/msm6295.h index e3339df3..77a82f58 100644 --- a/src/engine/platform/msm6295.h +++ b/src/engine/platform/msm6295.h @@ -64,7 +64,7 @@ class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf { public: virtual u8 read_byte(u32 address) override; - virtual void acquire(short* bufL, short* bufR, size_t start, size_t len) override; + virtual void acquire(short** buf, size_t len) override; virtual int dispatch(DivCommand c) override; virtual void* getChanState(int chan) override; virtual DivMacroInt* getChanMacroInt(int ch) override; diff --git a/src/engine/platform/n163.cpp b/src/engine/platform/n163.cpp index c3efd5ac..49c1569a 100644 --- a/src/engine/platform/n163.cpp +++ b/src/engine/platform/n163.cpp @@ -108,13 +108,13 @@ const char** DivPlatformN163::getRegisterSheet() { return regCheatSheetN163; } -void DivPlatformN163::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformN163::acquire(short** buf, size_t len) { for (size_t i=start; i32767) out=32767; if (out<-32768) out=-32768; - bufL[i]=bufR[i]=out; + buf[0][i]=buf[1][i]=out; if (n163.voice_cycle()==0x78) for (int i=0; i<8; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=n163.voice_out(i)<<7; diff --git a/src/engine/platform/n163.h b/src/engine/platform/n163.h index 872c622b..30eb222c 100644 --- a/src/engine/platform/n163.h +++ b/src/engine/platform/n163.h @@ -74,7 +74,7 @@ class DivPlatformN163: public DivDispatch { friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/namcowsg.cpp b/src/engine/platform/namcowsg.cpp index 122693d2..58270c0e 100644 --- a/src/engine/platform/namcowsg.cpp +++ b/src/engine/platform/namcowsg.cpp @@ -151,7 +151,7 @@ const char** DivPlatformNamcoWSG::getRegisterSheet() { return regCheatSheetNamcoWSG; } -void DivPlatformNamcoWSG::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformNamcoWSG::acquire(short** buf, size_t len) { while (!writes.empty()) { QueuedWrite w=writes.front(); switch (devType) { diff --git a/src/engine/platform/namcowsg.h b/src/engine/platform/namcowsg.h index 639b54c4..87a2517e 100644 --- a/src/engine/platform/namcowsg.h +++ b/src/engine/platform/namcowsg.h @@ -54,7 +54,7 @@ class DivPlatformNamcoWSG: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/nes.cpp b/src/engine/platform/nes.cpp index d0cae5ec..a60eeee4 100644 --- a/src/engine/platform/nes.cpp +++ b/src/engine/platform/nes.cpp @@ -112,7 +112,7 @@ void DivPlatformNES::acquire_puNES(short* bufL, short* bufR, size_t start, size_ int sample=(pulse_output(nes)+tnd_output(nes))<<6; if (sample>32767) sample=32767; if (sample<-32768) sample=-32768; - bufL[i]=sample; + buf[0][i]=sample; if (++writeOscBuf>=32) { writeOscBuf=0; oscBuf[0]->data[oscBuf[0]->needle++]=isMuted[0]?0:(nes->S1.output<<11); @@ -139,7 +139,7 @@ void DivPlatformNES::acquire_NSFPlay(short* bufL, short* bufR, size_t start, siz int sample=(out1[0]+out1[1]+out2[0]+out2[1])<<1; if (sample>32767) sample=32767; if (sample<-32768) sample=-32768; - bufL[i]=sample; + buf[0][i]=sample; if (++writeOscBuf>=32) { writeOscBuf=0; oscBuf[0]->data[oscBuf[0]->needle++]=nes1_NP->out[0]<<11; @@ -151,7 +151,7 @@ void DivPlatformNES::acquire_NSFPlay(short* bufL, short* bufR, size_t start, siz } } -void DivPlatformNES::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformNES::acquire(short** buf, size_t len) { if (useNP) { acquire_NSFPlay(bufL,bufR,start,len); } else { diff --git a/src/engine/platform/nes.h b/src/engine/platform/nes.h index d9f43e91..42758f56 100644 --- a/src/engine/platform/nes.h +++ b/src/engine/platform/nes.h @@ -72,7 +72,7 @@ class DivPlatformNES: public DivDispatch { void acquire_NSFPlay(short* bufL, short* bufR, size_t start, size_t len); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index aefefcaa..4c993d54 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -255,14 +255,14 @@ void DivPlatformOPL::acquire_nuked(short* bufL, short* bufR, size_t start, size_ if (os[1]<-32768) os[1]=-32768; if (os[1]>32767) os[1]=32767; - bufL[h]=os[0]; + buf[0][h]=os[0]; if (oplType==3 || oplType==759) { - bufR[h]=os[1]; + buf[1][h]=os[1]; } } } -void DivPlatformOPL::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformOPL::acquire(short** buf, size_t len) { //if (useYMFM) { // acquire_ymfm(bufL,bufR,start,len); //} else { diff --git a/src/engine/platform/opl.h b/src/engine/platform/opl.h index db8bc475..5a113d4d 100644 --- a/src/engine/platform/opl.h +++ b/src/engine/platform/opl.h @@ -108,7 +108,7 @@ class DivPlatformOPL: public DivDispatch { //void acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/opll.cpp b/src/engine/platform/opll.cpp index 8ffd6501..0bc99dab 100644 --- a/src/engine/platform/opll.cpp +++ b/src/engine/platform/opll.cpp @@ -83,14 +83,14 @@ void DivPlatformOPLL::acquire_nuked(short* bufL, short* bufR, size_t start, size os*=50; if (os<-32768) os=-32768; if (os>32767) os=32767; - bufL[h]=os; + buf[0][h]=os; } } void DivPlatformOPLL::acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len) { } -void DivPlatformOPLL::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformOPLL::acquire(short** buf, size_t len) { acquire_nuked(bufL,bufR,start,len); } diff --git a/src/engine/platform/opll.h b/src/engine/platform/opll.h index a1eb7004..32970e50 100644 --- a/src/engine/platform/opll.h +++ b/src/engine/platform/opll.h @@ -81,7 +81,7 @@ class DivPlatformOPLL: public DivDispatch { void acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/pce.cpp b/src/engine/platform/pce.cpp index cc6f67f3..c83594fe 100644 --- a/src/engine/platform/pce.cpp +++ b/src/engine/platform/pce.cpp @@ -53,7 +53,7 @@ const char** DivPlatformPCE::getRegisterSheet() { return regCheatSheetPCE; } -void DivPlatformPCE::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformPCE::acquire(short** buf, size_t len) { for (size_t h=start; h32767) tempR[0]=32767; //printf("tempL: %d tempR: %d\n",tempL,tempR); - bufL[h]=tempL[0]; - bufR[h]=tempR[0]; + buf[0][h]=tempL[0]; + buf[1][h]=tempR[0]; } } diff --git a/src/engine/platform/pce.h b/src/engine/platform/pce.h index 02aea9b3..6493840c 100644 --- a/src/engine/platform/pce.h +++ b/src/engine/platform/pce.h @@ -76,7 +76,7 @@ class DivPlatformPCE: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/pcmdac.cpp b/src/engine/platform/pcmdac.cpp index 8d9bb954..32ae9c5b 100644 --- a/src/engine/platform/pcmdac.cpp +++ b/src/engine/platform/pcmdac.cpp @@ -26,13 +26,13 @@ // to ease the driver, freqency register is a 8.16 counter relative to output sample rate #define CHIP_FREQBASE 65536 -void DivPlatformPCMDAC::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformPCMDAC::acquire(short** buf, size_t len) { const int depthScale=(15-outDepth); int output=0; for (size_t h=start; hdata[oscBuf->needle++]=0; continue; } @@ -157,12 +157,12 @@ void DivPlatformPCMDAC::acquire(short* bufL, short* bufR, size_t start, size_t l output=output*chan[0].vol*chan[0].envVol/16384; oscBuf->data[oscBuf->needle++]=output; if (outStereo) { - bufL[h]=((output*chan[0].panL)>>(depthScale+8))<>(depthScale+8))<>(depthScale+8))<>(depthScale+8))<>depthScale)<(freq>>1) && !isMuted[0])?32767:0; - bufL[i]=out; + buf[0][i]=out; oscBuf->data[oscBuf->needle++]=out; } else { - bufL[i]=0; + buf[0][i]=0; oscBuf->data[oscBuf->needle++]=0; } } @@ -234,10 +234,10 @@ void DivPlatformPCSpeaker::acquire_cone(short* bufL, short* bufR, size_t start, float out=(low+band)*0.75; if (out>1.0) out=1.0; if (out<-1.0) out=-1.0; - bufL[i]=out*32767; + buf[0][i]=out*32767; oscBuf->data[oscBuf->needle++]=out*32767; } else { - bufL[i]=0; + buf[0][i]=0; oscBuf->data[oscBuf->needle++]=0; } } @@ -261,10 +261,10 @@ void DivPlatformPCSpeaker::acquire_piezo(short* bufL, short* bufR, size_t start, float out=band*0.15-(next-low)*0.06; if (out>1.0) out=1.0; if (out<-1.0) out=-1.0; - bufL[i]=out*32767; + buf[0][i]=out*32767; oscBuf->data[oscBuf->needle++]=out*32767; } else { - bufL[i]=0; + buf[0][i]=0; oscBuf->data[oscBuf->needle++]=0; } } @@ -317,11 +317,11 @@ void DivPlatformPCSpeaker::acquire_real(short* bufL, short* bufR, size_t start, } else { oscBuf->data[oscBuf->needle++]=0; } - bufL[i]=0; + buf[0][i]=0; } } -void DivPlatformPCSpeaker::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformPCSpeaker::acquire(short** buf, size_t len) { switch (speakerType) { case 0: acquire_unfilt(bufL,bufR,start,len); diff --git a/src/engine/platform/pcspkr.h b/src/engine/platform/pcspkr.h index b3028d78..953a93b8 100644 --- a/src/engine/platform/pcspkr.h +++ b/src/engine/platform/pcspkr.h @@ -68,7 +68,7 @@ class DivPlatformPCSpeaker: public DivDispatch { public: void pcSpeakerThread(); - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/pet.cpp b/src/engine/platform/pet.cpp index 1e98257e..7474558e 100644 --- a/src/engine/platform/pet.cpp +++ b/src/engine/platform/pet.cpp @@ -55,7 +55,7 @@ void DivPlatformPET::rWrite(unsigned int addr, unsigned char val) { regPool[addr]=val; } -void DivPlatformPET::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformPET::acquire(short** buf, size_t len) { bool hwSROutput=((regPool[11]>>2)&7)==4; if (chan[0].enable) { int reload=regPool[8]*2+4; @@ -70,8 +70,8 @@ void DivPlatformPET::acquire(short* bufL, short* bufR, size_t start, size_t len) } else { chan[0].cnt-=SAMP_DIVIDER; } - bufL[h]=chan[0].out; - bufR[h]=chan[0].out; + buf[0][h]=chan[0].out; + buf[1][h]=chan[0].out; oscBuf->data[oscBuf->needle++]=chan[0].out; } // emulate driver writes to PCR @@ -79,8 +79,8 @@ void DivPlatformPET::acquire(short* bufL, short* bufR, size_t start, size_t len) } else { chan[0].out=0; for (size_t h=start; hdata[oscBuf->needle++]=0; } } diff --git a/src/engine/platform/pet.h b/src/engine/platform/pet.h index 69bf9dde..5942817c 100644 --- a/src/engine/platform/pet.h +++ b/src/engine/platform/pet.h @@ -45,7 +45,7 @@ class DivPlatformPET: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/pokemini.cpp b/src/engine/platform/pokemini.cpp index 7625f1ed..1099e63f 100644 --- a/src/engine/platform/pokemini.cpp +++ b/src/engine/platform/pokemini.cpp @@ -86,7 +86,7 @@ void DivPlatformPokeMini::rWrite(unsigned char addr, unsigned char val) { } } -void DivPlatformPokeMini::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformPokeMini::acquire(short** buf, size_t len) { int out=0; for (size_t i=start; i=pivot && !isMuted[0])?volTable[vol&3]:0; - bufL[i]=out; + buf[0][i]=out; oscBuf->data[oscBuf->needle++]=out; } else { - bufL[i]=0; + buf[0][i]=0; oscBuf->data[oscBuf->needle++]=0; } } diff --git a/src/engine/platform/pokemini.h b/src/engine/platform/pokemini.h index 7fc17ddf..80233eb4 100644 --- a/src/engine/platform/pokemini.h +++ b/src/engine/platform/pokemini.h @@ -46,7 +46,7 @@ class DivPlatformPokeMini: public DivDispatch { friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/pokey.cpp b/src/engine/platform/pokey.cpp index a79ec453..f740c1af 100644 --- a/src/engine/platform/pokey.cpp +++ b/src/engine/platform/pokey.cpp @@ -64,7 +64,7 @@ const char** DivPlatformPOKEY::getRegisterSheet() { return regCheatSheetPOKEY; } -void DivPlatformPOKEY::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformPOKEY::acquire(short** buf, size_t len) { if (useAltASAP) { acquireASAP(bufL, start, len); } else { diff --git a/src/engine/platform/pokey.h b/src/engine/platform/pokey.h index e68178a2..2418ade2 100644 --- a/src/engine/platform/pokey.h +++ b/src/engine/platform/pokey.h @@ -58,7 +58,7 @@ class DivPlatformPOKEY: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); void acquireMZ(short* buf, size_t start, size_t len); void acquireASAP(short* buf, size_t start, size_t len); int dispatch(DivCommand c); diff --git a/src/engine/platform/pong.cpp b/src/engine/platform/pong.cpp index 0c97391c..fe34b398 100644 --- a/src/engine/platform/pong.cpp +++ b/src/engine/platform/pong.cpp @@ -23,7 +23,7 @@ #define CHIP_DIVIDER 1024 -void DivPlatformPong::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformPong::acquire(short** buf, size_t len) { int out=0; for (size_t i=start; idata[oscBuf->needle++]=out; } else { - bufL[i]=0; + buf[0][i]=0; oscBuf->data[oscBuf->needle++]=0; flip=false; } diff --git a/src/engine/platform/pong.h b/src/engine/platform/pong.h index 835809f5..8259b14c 100644 --- a/src/engine/platform/pong.h +++ b/src/engine/platform/pong.h @@ -39,7 +39,7 @@ class DivPlatformPong: public DivDispatch { friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/qsound.cpp b/src/engine/platform/qsound.cpp index a307912a..3c9f3689 100644 --- a/src/engine/platform/qsound.cpp +++ b/src/engine/platform/qsound.cpp @@ -265,11 +265,11 @@ const char** DivPlatformQSound::getRegisterSheet() { return regCheatSheetQSound; } -void DivPlatformQSound::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformQSound::acquire(short** buf, size_t len) { for (size_t h=start; h 0) { size_t blockLen=MIN(len,256); - short* bufPtrs[2]={&bufL[pos],&bufR[pos]}; + short* bufPtrs[2]={&buf[0][pos],&buf[1][pos]}; rf5c68.sound_stream_update(bufPtrs,chBufPtrs,blockLen); for (int i=0; i<8; i++) { for (size_t j=0; jGenerateMany((unsigned char*)saaBuf[0],len,oscBuf); #ifdef TA_BIG_ENDIAN for (size_t i=0; i>8)); - bufR[i+start]=(short)((((unsigned short)saaBuf[0][i<<1])<<8)|(((unsigned short)saaBuf[0][i<<1])>>8)); + buf[0][i+start]=(short)((((unsigned short)saaBuf[0][1+(i<<1)])<<8)|(((unsigned short)saaBuf[0][1+(i<<1)])>>8)); + buf[1][i+start]=(short)((((unsigned short)saaBuf[0][i<<1])<<8)|(((unsigned short)saaBuf[0][i<<1])>>8)); } #else for (size_t i=0; itick(); } short out=(short)scc->out()<<5; - bufL[h]=bufR[h]=out; + buf[0][h]=buf[1][h]=out; for (int i=0; i<5; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=scc->voice_out(i)<<7; diff --git a/src/engine/platform/scc.h b/src/engine/platform/scc.h index 55d82ca8..1c736472 100644 --- a/src/engine/platform/scc.h +++ b/src/engine/platform/scc.h @@ -50,7 +50,7 @@ class DivPlatformSCC: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/segapcm.cpp b/src/engine/platform/segapcm.cpp index edc05d47..dd212c3f 100644 --- a/src/engine/platform/segapcm.cpp +++ b/src/engine/platform/segapcm.cpp @@ -26,7 +26,7 @@ //#define rWrite(a,v) if (!skipRegisterWrites) {pendingWrites[a]=v;} //#define immWrite(a,v) if (!skipRegisterWrites) {writes.emplace(a,v); if (dumpWrites) {addWrite(a,v);} } -void DivPlatformSegaPCM::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformSegaPCM::acquire(short** buf, size_t len) { static int os[2]; for (size_t h=start; h32767) os[1]=32767; - bufL[h]=os[0]; - bufR[h]=os[1]; + buf[0][h]=os[0]; + buf[1][h]=os[1]; } } diff --git a/src/engine/platform/segapcm.h b/src/engine/platform/segapcm.h index 8e02d4a8..3164e1b9 100644 --- a/src/engine/platform/segapcm.h +++ b/src/engine/platform/segapcm.h @@ -77,7 +77,7 @@ class DivPlatformSegaPCM: public DivDispatch { friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/sms.cpp b/src/engine/platform/sms.cpp index e4a0bedc..2a25dd8c 100644 --- a/src/engine/platform/sms.cpp +++ b/src/engine/platform/sms.cpp @@ -73,8 +73,8 @@ void DivPlatformSMS::acquire_nuked(short* bufL, short* bufR, size_t start, size_ if (oL>32767) oL=32767; if (oR<-32768) oR=-32768; if (oR>32767) oR=32767; - bufL[h]=oL; - bufR[h]=oR; + buf[0][h]=oL; + buf[1][h]=oR; for (int i=0; i<4; i++) { if (isMuted[i]) { oscBuf[i]->data[oscBuf[i]->needle++]=0; @@ -97,8 +97,8 @@ void DivPlatformSMS::acquire_mame(short* bufL, short* bufR, size_t start, size_t } for (size_t h=start; hsound_stream_update(outs,1); for (int i=0; i<4; i++) { @@ -111,7 +111,7 @@ void DivPlatformSMS::acquire_mame(short* bufL, short* bufR, size_t start, size_t } } -void DivPlatformSMS::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformSMS::acquire(short** buf, size_t len) { if (nuked) { acquire_nuked(bufL,bufR,start,len); } else { diff --git a/src/engine/platform/sms.h b/src/engine/platform/sms.h index 90000308..7358ce91 100644 --- a/src/engine/platform/sms.h +++ b/src/engine/platform/sms.h @@ -69,7 +69,7 @@ class DivPlatformSMS: public DivDispatch { void acquire_nuked(short* bufL, short* bufR, size_t start, size_t len); void acquire_mame(short* bufL, short* bufR, size_t start, size_t len); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/snes.cpp b/src/engine/platform/snes.cpp index fec8139e..38512d13 100644 --- a/src/engine/platform/snes.cpp +++ b/src/engine/platform/snes.cpp @@ -65,7 +65,7 @@ const char** DivPlatformSNES::getRegisterSheet() { return regCheatSheetSNESDSP; } -void DivPlatformSNES::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformSNES::acquire(short** buf, size_t len) { short out[2]; short chOut[16]; for (size_t h=start; h>2; if (next<-32768) next=-32768; diff --git a/src/engine/platform/snes.h b/src/engine/platform/snes.h index 094fe03a..884c7d80 100644 --- a/src/engine/platform/snes.h +++ b/src/engine/platform/snes.h @@ -93,7 +93,7 @@ class DivPlatformSNES: public DivDispatch { friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/su.cpp b/src/engine/platform/su.cpp index 52fcafb0..53937aaf 100644 --- a/src/engine/platform/su.cpp +++ b/src/engine/platform/su.cpp @@ -40,14 +40,14 @@ double DivPlatformSoundUnit::NOTE_SU(int ch, int note) { return NOTE_FREQUENCY(note); } -void DivPlatformSoundUnit::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformSoundUnit::acquire(short** buf, size_t len) { for (size_t h=start; hWrite(w.addr,w.val); writes.pop(); } - su->NextSample(&bufL[h],&bufR[h]); + su->NextSample(&buf[0][h],&buf[1][h]); for (int i=0; i<8; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=su->GetSample(i); } diff --git a/src/engine/platform/su.h b/src/engine/platform/su.h index d6ca5aee..518edafa 100644 --- a/src/engine/platform/su.h +++ b/src/engine/platform/su.h @@ -98,7 +98,7 @@ class DivPlatformSoundUnit: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/swan.cpp b/src/engine/platform/swan.cpp index 92dbe940..b5d860ae 100644 --- a/src/engine/platform/swan.cpp +++ b/src/engine/platform/swan.cpp @@ -50,7 +50,7 @@ const char** DivPlatformSwan::getRegisterSheet() { return regCheatSheetWS; } -void DivPlatformSwan::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformSwan::acquire(short** buf, size_t len) { for (size_t h=start; hSoundUpdate(16); ws->SoundFlush(samp, 1); - bufL[h]=samp[0]; - bufR[h]=samp[1]; + buf[0][h]=samp[0]; + buf[1][h]=samp[1]; for (int i=0; i<4; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=(ws->sample_cache[i][0]+ws->sample_cache[i][1])<<6; } diff --git a/src/engine/platform/swan.h b/src/engine/platform/swan.h index 167a1180..6f129e6d 100644 --- a/src/engine/platform/swan.h +++ b/src/engine/platform/swan.h @@ -56,7 +56,7 @@ class DivPlatformSwan: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/t6w28.cpp b/src/engine/platform/t6w28.cpp index 5830b428..34cdb126 100644 --- a/src/engine/platform/t6w28.cpp +++ b/src/engine/platform/t6w28.cpp @@ -35,7 +35,7 @@ const char** DivPlatformT6W28::getRegisterSheet() { return regCheatSheetT6W28; } -void DivPlatformT6W28::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformT6W28::acquire(short** buf, size_t len) { for (size_t h=start; h32767) tempR=32767; - bufL[h]=tempL; - bufR[h]=tempR; + buf[0][h]=tempL; + buf[1][h]=tempR; } } diff --git a/src/engine/platform/t6w28.h b/src/engine/platform/t6w28.h index e3aa2fcf..dd49d1b8 100644 --- a/src/engine/platform/t6w28.h +++ b/src/engine/platform/t6w28.h @@ -59,7 +59,7 @@ class DivPlatformT6W28: public DivDispatch { void writeOutVol(int ch); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/tia.cpp b/src/engine/platform/tia.cpp index 5f0467a5..a2472b21 100644 --- a/src/engine/platform/tia.cpp +++ b/src/engine/platform/tia.cpp @@ -38,16 +38,16 @@ const char** DivPlatformTIA::getRegisterSheet() { return regCheatSheetTIA; } -void DivPlatformTIA::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformTIA::acquire(short** buf, size_t len) { for (size_t h=start; h>1; + buf[0][h]=(tia.myCurrentSample[0]+tia.myCurrentSample[1])>>1; } else { - bufL[h]=tia.myCurrentSample[0]; + buf[0][h]=tia.myCurrentSample[0]; } if (++chanOscCounter>=114) { chanOscCounter=0; diff --git a/src/engine/platform/tia.h b/src/engine/platform/tia.h index 3317955b..b4b867dc 100644 --- a/src/engine/platform/tia.h +++ b/src/engine/platform/tia.h @@ -45,7 +45,7 @@ class DivPlatformTIA: public DivDispatch { unsigned char dealWithFreq(unsigned char shape, int base, int pitch); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/tx81z.cpp b/src/engine/platform/tx81z.cpp index e76f4337..5e762910 100644 --- a/src/engine/platform/tx81z.cpp +++ b/src/engine/platform/tx81z.cpp @@ -55,7 +55,7 @@ const char** DivPlatformTX81Z::getRegisterSheet() { return regCheatSheetOPZ; } -void DivPlatformTX81Z::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformTX81Z::acquire(short** buf, size_t len) { static int os[2]; ymfm::ym2414::fm_engine* fme=fm_ymfm->debug_engine(); @@ -87,8 +87,8 @@ void DivPlatformTX81Z::acquire(short* bufL, short* bufR, size_t start, size_t le if (os[1]<-32768) os[1]=-32768; if (os[1]>32767) os[1]=32767; - bufL[h]=os[0]; - bufR[h]=os[1]; + buf[0][h]=os[0]; + buf[1][h]=os[1]; } } diff --git a/src/engine/platform/tx81z.h b/src/engine/platform/tx81z.h index 3107f805..4dea61e7 100644 --- a/src/engine/platform/tx81z.h +++ b/src/engine/platform/tx81z.h @@ -60,7 +60,7 @@ class DivPlatformTX81Z: public DivPlatformOPM { friend void putDispatchChip(void*,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/vb.cpp b/src/engine/platform/vb.cpp index c1257144..ea798073 100644 --- a/src/engine/platform/vb.cpp +++ b/src/engine/platform/vb.cpp @@ -93,7 +93,7 @@ const char** DivPlatformVB::getRegisterSheet() { return regCheatSheetVB; } -void DivPlatformVB::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformVB::acquire(short** buf, size_t len) { for (size_t h=start; h32767) tempR=32767; - bufL[h]=tempL; - bufR[h]=tempR; + buf[0][h]=tempL; + buf[1][h]=tempR; } } diff --git a/src/engine/platform/vb.h b/src/engine/platform/vb.h index b09e33af..7475c745 100644 --- a/src/engine/platform/vb.h +++ b/src/engine/platform/vb.h @@ -64,7 +64,7 @@ class DivPlatformVB: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/vera.cpp b/src/engine/platform/vera.cpp index c5de2721..82b7705a 100644 --- a/src/engine/platform/vera.cpp +++ b/src/engine/platform/vera.cpp @@ -53,7 +53,7 @@ const char** DivPlatformVERA::getRegisterSheet() { return regCheatSheetVERA; } -void DivPlatformVERA::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformVERA::acquire(short** buf, size_t len) { // both PSG part and PCM part output a full 16-bit range, putting bufL/R // argument right into both could cause an overflow short buf[4][128]; @@ -102,8 +102,8 @@ void DivPlatformVERA::acquire(short* bufL, short* bufR, size_t start, size_t len pcm_render(pcm,buf[2],buf[3],curLen); for (int i=0; idata[oscBuf[i]->needle++]=vic->ch[i].out?(vic->volume<<11):0; } diff --git a/src/engine/platform/vic20.h b/src/engine/platform/vic20.h index fd650b55..3fc9fade 100644 --- a/src/engine/platform/vic20.h +++ b/src/engine/platform/vic20.h @@ -43,7 +43,7 @@ class DivPlatformVIC20: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/vrc6.cpp b/src/engine/platform/vrc6.cpp index bb1a7a42..fa5cd0d3 100644 --- a/src/engine/platform/vrc6.cpp +++ b/src/engine/platform/vrc6.cpp @@ -46,7 +46,7 @@ const char** DivPlatformVRC6::getRegisterSheet() { return regCheatSheetVRC6; } -void DivPlatformVRC6::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformVRC6::acquire(short** buf, size_t len) { for (size_t i=start; i32767) sample=32767; if (sample<-32768) sample=-32768; - bufL[i]=bufR[i]=sample; + buf[0][i]=buf[1][i]=sample; // Oscilloscope buffer part if (++writeOscBuf>=32) { diff --git a/src/engine/platform/vrc6.h b/src/engine/platform/vrc6.h index 3cb02c41..5facd13a 100644 --- a/src/engine/platform/vrc6.h +++ b/src/engine/platform/vrc6.h @@ -61,7 +61,7 @@ class DivPlatformVRC6: public DivDispatch, public vrcvi_intf { friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/x1_010.cpp b/src/engine/platform/x1_010.cpp index 0a751097..27e55e59 100644 --- a/src/engine/platform/x1_010.cpp +++ b/src/engine/platform/x1_010.cpp @@ -205,7 +205,7 @@ const char** DivPlatformX1_010::getRegisterSheet() { return regCheatSheetX1_010; } -void DivPlatformX1_010::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformX1_010::acquire(short** buf, size_t len) { for (size_t h=start; h32767) tempR=32767; //printf("tempL: %d tempR: %d\n",tempL,tempR); - bufL[h]=stereo?tempL:((tempL+tempR)>>1); - bufR[h]=stereo?tempR:bufL[h]; + buf[0][h]=stereo?tempL:((tempL+tempR)>>1); + buf[1][h]=stereo?tempR:buf[0][h]; for (int i=0; i<16; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=(x1_010.voice_out(i,0)+x1_010.voice_out(i,1))>>1; diff --git a/src/engine/platform/x1_010.h b/src/engine/platform/x1_010.h index 5c106eed..eaa4258a 100644 --- a/src/engine/platform/x1_010.h +++ b/src/engine/platform/x1_010.h @@ -127,7 +127,7 @@ class DivPlatformX1_010: public DivDispatch, public vgsound_emu_mem_intf { friend void putDispatchChan(void*,int,int); public: u8 read_byte(u32 address); - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/ym2203.cpp b/src/engine/platform/ym2203.cpp index 453fa905..66e3d098 100644 --- a/src/engine/platform/ym2203.cpp +++ b/src/engine/platform/ym2203.cpp @@ -156,7 +156,7 @@ const char** DivPlatformYM2203::getRegisterSheet() { return regCheatSheetYM2203; } -void DivPlatformYM2203::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformYM2203::acquire(short** buf, size_t len) { if (useCombo) { acquire_combo(bufL,bufR,start,len); } else { @@ -218,7 +218,7 @@ void DivPlatformYM2203::acquire_combo(short* bufL, short* bufR, size_t start, si if (os<-32768) os=-32768; if (os>32767) os=32767; - bufL[h]=os; + buf[0][h]=os; for (int i=0; i<3; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=fm_nuked.ch_out[i]; @@ -259,7 +259,7 @@ void DivPlatformYM2203::acquire_ymfm(short* bufL, short* bufR, size_t start, siz if (os<-32768) os=-32768; if (os>32767) os=32767; - bufL[h]=os; + buf[0][h]=os; for (int i=0; i<3; i++) { diff --git a/src/engine/platform/ym2203.h b/src/engine/platform/ym2203.h index 2076aa25..f7163ab6 100644 --- a/src/engine/platform/ym2203.h +++ b/src/engine/platform/ym2203.h @@ -59,7 +59,7 @@ class DivPlatformYM2203: public DivPlatformOPN { void acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/ym2608.cpp b/src/engine/platform/ym2608.cpp index fd73fd2c..b706426d 100644 --- a/src/engine/platform/ym2608.cpp +++ b/src/engine/platform/ym2608.cpp @@ -297,7 +297,7 @@ double DivPlatformYM2608::NOTE_ADPCMB(int note) { return 0; } -void DivPlatformYM2608::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformYM2608::acquire(short** buf, size_t len) { if (useCombo) { acquire_combo(bufL,bufR,start,len); } else { @@ -386,8 +386,8 @@ void DivPlatformYM2608::acquire_combo(short* bufL, short* bufR, size_t start, si if (os[1]<-32768) os[1]=-32768; if (os[1]>32767) os[1]=32767; - bufL[h]=os[0]; - bufR[h]=os[1]; + buf[0][h]=os[0]; + buf[1][h]=os[1]; for (int i=0; i32767) os[1]=32767; - bufL[h]=os[0]; - bufR[h]=os[1]; + buf[0][h]=os[0]; + buf[1][h]=os[1]; for (int i=0; i<6; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=(fmChan[i]->debug_output(0)+fmChan[i]->debug_output(1)); diff --git a/src/engine/platform/ym2608.h b/src/engine/platform/ym2608.h index 9dfa2e8d..d4b3b9ba 100644 --- a/src/engine/platform/ym2608.h +++ b/src/engine/platform/ym2608.h @@ -74,7 +74,7 @@ class DivPlatformYM2608: public DivPlatformOPN { void acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/ym2610.cpp b/src/engine/platform/ym2610.cpp index b6f23154..1f8d88c7 100644 --- a/src/engine/platform/ym2610.cpp +++ b/src/engine/platform/ym2610.cpp @@ -232,7 +232,7 @@ const char** DivPlatformYM2610::getRegisterSheet() { return regCheatSheetYM2610; } -void DivPlatformYM2610::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformYM2610::acquire(short** buf, size_t len) { if (useCombo) { acquire_combo(bufL,bufR,start,len); } else { @@ -317,8 +317,8 @@ void DivPlatformYM2610::acquire_combo(short* bufL, short* bufR, size_t start, si if (os[1]<-32768) os[1]=-32768; if (os[1]>32767) os[1]=32767; - bufL[h]=os[0]; - bufR[h]=os[1]; + buf[0][h]=os[0]; + buf[1][h]=os[1]; for (int i=0; i32767) os[1]=32767; - bufL[h]=os[0]; - bufR[h]=os[1]; + buf[0][h]=os[0]; + buf[1][h]=os[1]; for (int i=0; idata[oscBuf[i]->needle++]=(fmChan[i]->debug_output(0)+fmChan[i]->debug_output(1)); diff --git a/src/engine/platform/ym2610.h b/src/engine/platform/ym2610.h index 82cce7b5..40d013e1 100644 --- a/src/engine/platform/ym2610.h +++ b/src/engine/platform/ym2610.h @@ -42,7 +42,7 @@ class DivPlatformYM2610: public DivPlatformYM2610Base { void acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/ym2610b.cpp b/src/engine/platform/ym2610b.cpp index f78d62d7..82ebd38f 100644 --- a/src/engine/platform/ym2610b.cpp +++ b/src/engine/platform/ym2610b.cpp @@ -296,7 +296,7 @@ const char** DivPlatformYM2610B::getRegisterSheet() { return regCheatSheetYM2610B; } -void DivPlatformYM2610B::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformYM2610B::acquire(short** buf, size_t len) { if (useCombo) { acquire_combo(bufL,bufR,start,len); } else { @@ -385,8 +385,8 @@ void DivPlatformYM2610B::acquire_combo(short* bufL, short* bufR, size_t start, s if (os[1]<-32768) os[1]=-32768; if (os[1]>32767) os[1]=32767; - bufL[h]=os[0]; - bufR[h]=os[1]; + buf[0][h]=os[0]; + buf[1][h]=os[1]; for (int i=0; i32767) os[1]=32767; - bufL[h]=os[0]; - bufR[h]=os[1]; + buf[0][h]=os[0]; + buf[1][h]=os[1]; for (int i=0; idata[oscBuf[j]->needle++]=(short)(((int)buf[j*2][i]+buf[j*2+1][i])/2); } - bufL[pos]=(short)(dataL/8); - bufR[pos]=(short)(dataR/8); + buf[0][pos]=(short)(dataL/8); + buf[1][pos]=(short)(dataR/8); pos++; } len-=blockLen; diff --git a/src/engine/platform/ymz280b.h b/src/engine/platform/ymz280b.h index 37e06cf3..78ea544b 100644 --- a/src/engine/platform/ymz280b.h +++ b/src/engine/platform/ymz280b.h @@ -56,7 +56,7 @@ class DivPlatformYMZ280B: public DivDispatch { friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/zxbeeper.cpp b/src/engine/platform/zxbeeper.cpp index 90ddfe2c..cf563f27 100644 --- a/src/engine/platform/zxbeeper.cpp +++ b/src/engine/platform/zxbeeper.cpp @@ -27,7 +27,7 @@ const char** DivPlatformZXBeeper::getRegisterSheet() { return NULL; } -void DivPlatformZXBeeper::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformZXBeeper::acquire(short** buf, size_t len) { bool o=false; for (size_t h=start; hdata[oscBuf[0]->needle++]=o?16384:-16384; continue; } @@ -64,7 +64,7 @@ void DivPlatformZXBeeper::acquire(short* bufL, short* bufR, size_t start, size_t } if (++curChan>=6) curChan=0; - bufL[h]=o?16384:0; + buf[0][h]=o?16384:0; oscBuf[0]->data[oscBuf[0]->needle++]=o?16384:-16384; } } diff --git a/src/engine/platform/zxbeeper.h b/src/engine/platform/zxbeeper.h index 19c3e6ed..a9b3594c 100644 --- a/src/engine/platform/zxbeeper.h +++ b/src/engine/platform/zxbeeper.h @@ -52,7 +52,7 @@ class DivPlatformZXBeeper: public DivDispatch { friend void putDispatchChip(void*,int); friend void putDispatchChan(void*,int,int); public: - void acquire(short* bufL, short* bufR, size_t start, size_t len); + void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); From a29f36a5dfdd8b47a3cfefc628a9489c154ecb11 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 3 Jan 2023 01:09:46 -0500 Subject: [PATCH 03/72] new dispatch, part 1 --- src/engine/dispatchContainer.cpp | 86 ++++++++++++++++---------------- src/engine/engine.cpp | 37 +++++++------- src/engine/engine.h | 13 +++-- src/engine/platform/arcade.cpp | 12 ++--- src/engine/platform/arcade.h | 4 +- src/engine/platform/fds.cpp | 16 +++--- src/engine/platform/fds.h | 4 +- src/engine/platform/ga20.cpp | 2 +- src/engine/platform/gb.cpp | 2 +- src/engine/platform/genesis.cpp | 12 ++--- src/engine/platform/genesis.h | 4 +- src/engine/platform/k007232.cpp | 2 +- src/engine/platform/lynx.cpp | 4 +- src/engine/platform/mmc5.cpp | 2 +- src/engine/platform/msm5232.cpp | 2 +- src/engine/platform/msm6258.cpp | 2 +- src/engine/platform/msm6295.cpp | 2 +- src/engine/platform/n163.cpp | 2 +- src/engine/platform/namcowsg.cpp | 8 +-- src/engine/platform/nes.cpp | 12 ++--- src/engine/platform/nes.h | 4 +- src/engine/platform/opl.cpp | 8 +-- src/engine/platform/opl.h | 4 +- src/engine/platform/opll.cpp | 8 +-- src/engine/platform/opll.h | 4 +- src/engine/platform/pce.cpp | 2 +- src/engine/platform/pcmdac.cpp | 2 +- src/engine/platform/pcspkr.cpp | 28 +++++------ src/engine/platform/pcspkr.h | 8 +-- src/engine/platform/pet.cpp | 4 +- src/engine/platform/pokemini.cpp | 2 +- src/engine/platform/pokey.cpp | 12 ++--- src/engine/platform/pokey.h | 4 +- src/engine/platform/pong.cpp | 2 +- src/engine/platform/qsound.cpp | 2 +- src/engine/platform/rf5c68.cpp | 14 +++--- src/engine/platform/saa.cpp | 12 ++--- src/engine/platform/saa.h | 2 +- src/engine/platform/scc.cpp | 2 +- src/engine/platform/segapcm.cpp | 2 +- src/engine/platform/sms.cpp | 16 +++--- src/engine/platform/sms.h | 4 +- src/engine/platform/snes.cpp | 2 +- src/engine/platform/su.cpp | 2 +- src/engine/platform/swan.cpp | 2 +- src/engine/platform/t6w28.cpp | 2 +- src/engine/platform/tia.cpp | 2 +- src/engine/platform/tx81z.cpp | 2 +- src/engine/platform/vb.cpp | 2 +- src/engine/platform/vera.cpp | 16 +++--- src/engine/platform/vic20.cpp | 2 +- src/engine/platform/vrc6.cpp | 2 +- src/engine/platform/x1_010.cpp | 2 +- src/engine/platform/ym2203.cpp | 12 ++--- src/engine/platform/ym2203.h | 4 +- src/engine/platform/ym2608.cpp | 12 ++--- src/engine/platform/ym2608.h | 4 +- src/engine/platform/ym2610.cpp | 12 ++--- src/engine/platform/ym2610.h | 4 +- src/engine/platform/ym2610b.cpp | 12 ++--- src/engine/platform/ym2610b.h | 4 +- src/engine/platform/ymz280b.cpp | 14 +++--- src/engine/platform/zxbeeper.cpp | 2 +- src/engine/playback.cpp | 10 +++- 64 files changed, 258 insertions(+), 242 deletions(-) diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index 5b943332..fa72b76b 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -80,8 +80,11 @@ #include "song.h" void DivDispatchContainer::setRates(double gotRate) { - blip_set_rates(bb[0],dispatch->rate,gotRate); - blip_set_rates(bb[1],dispatch->rate,gotRate); + int outs=dispatch->getOutputCount(); + + for (int i=0; irate,gotRate); + } } void DivDispatchContainer::setQuality(bool lowQual) { @@ -90,73 +93,68 @@ void DivDispatchContainer::setQuality(bool lowQual) { void DivDispatchContainer::acquire(size_t offset, size_t count) { int outs=dispatch->getOutputCount(); - for (int i=0; i=outs) { + bbInMapped[i]=NULL; + } else { + bbInMapped[i]=&bbIn[i][offset]; + } } dispatch->acquire(bbInMapped,count); } void DivDispatchContainer::flush(size_t count) { - blip_read_samples(bb[0],bbOut[0],count,0); + int outs=dispatch->getOutputCount(); - if (dispatch->isStereo()) { - blip_read_samples(bb[1],bbOut[1],count,0); + for (int i=0; igetOutputCount(); if (dcOffCompensation && runtotal>0) { dcOffCompensation=false; - prevSample[0]=bbIn[0][0]; - if (dispatch->isStereo()) prevSample[1]=bbIn[1][0]; + for (int i=0; iisStereo()) for (size_t i=0; iisStereo()) for (size_t i=0; i0) { for (size_t i=totalRead; iisStereo()) { - blip_end_frame(bb[1],runtotal); - blip_read_samples(bb[1],bbOut[1]+offset,size,0); - } } void DivDispatchContainer::clear() { - blip_clear(bb[0]); - blip_clear(bb[1]); - temp[0]=0; - temp[1]=0; - prevSample[0]=0; - prevSample[1]=0; + for (int i=0; igetDCOffRequired()) { dcOffCompensation=true; } @@ -463,8 +461,8 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do bbIn[i]=new short[bbInLen]; bbOut[i]=new short[bbInLen]; - memset(bbIn,0,bbInLen*sizeof(short)); - memset(bbOut,0,bbInLen*sizeof(short)); + memset(bbIn[i],0,bbInLen*sizeof(short)); + memset(bbOut[i],0,bbInLen*sizeof(short)); } } diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index c75d86fa..b31aff56 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -897,11 +897,7 @@ void DivEngine::runExportThread() { for (int i=0; iisStereo()) { - si[i].channels=2; - } else { - si[i].channels=1; - } + si[i].channels=disCont[i].dispatch->getOutputCount(); si[i].format=SF_FORMAT_WAV|SF_FORMAT_PCM_16; } @@ -944,11 +940,12 @@ void DivEngine::runExportThread() { if (isFadingOut) { double mul=(1.0-((double)curFadeOutSample/(double)fadeOutSamples)); for (int i=0; iisStereo()) { - sysBuf[i][j]=(double)disCont[i].bbOut[0][j]*mul; - } else { - sysBuf[i][j<<1]=(double)disCont[i].bbOut[0][j]*mul; - sysBuf[i][1+(j<<1)]=(double)disCont[i].bbOut[1][j]*mul; + for (int k=0; k=fadeOutSamples) { @@ -957,11 +954,12 @@ void DivEngine::runExportThread() { } } else { for (int i=0; iisStereo()) { - sysBuf[i][j]=disCont[i].bbOut[0][j]; - } else { - sysBuf[i][j<<1]=disCont[i].bbOut[0][j]; - sysBuf[i][1+(j<<1)]=disCont[i].bbOut[1][j]; + for (int k=0; k-1 && j>=lastLoopPos && totalLoops>=exportLoopCount) { @@ -1904,10 +1902,11 @@ String DivEngine::getPlaybackDebugInfo() { "speed1: %d\n" "speed2: %d\n" "tempoAccum: %d\n" - "totalProcessed: %d\n", + "totalProcessed: %d\n" + "bufferPos: %d\n", curOrder,prevOrder,curRow,prevRow,ticks,subticks,totalLoops,lastLoopPos,nextSpeed,divider,cycles,clockDrift, changeOrd,changePos,totalSeconds,totalTicks,totalTicksR,totalCmds,lastCmds,cmdsPerSecond,globalPitch, - (int)extValue,(int)speed1,(int)speed2,(int)tempoAccum,(int)totalProcessed + (int)extValue,(int)speed1,(int)speed2,(int)tempoAccum,(int)totalProcessed,(int)bufferPos ); } @@ -4311,6 +4310,10 @@ bool DivEngine::init() { if (!haveAudio) { return false; } else { + if (output==NULL) { + logE("output is NULL!"); + return false; + } if (!output->setRun(true)) { logE("error while activating!"); return false; diff --git a/src/engine/engine.h b/src/engine/engine.h index 34f3d8da..652d7158 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -195,12 +195,12 @@ struct DivDispatchContainer { lastAvail(0), lowQuality(false), dcOffCompensation(false) { - memset(bb,0,DIV_MAX_OUTPUTS*sizeof(void*)); + memset(bb,0,DIV_MAX_OUTPUTS*sizeof(blip_buffer_t*)); memset(temp,0,DIV_MAX_OUTPUTS*sizeof(int)); memset(prevSample,0,DIV_MAX_OUTPUTS*sizeof(int)); - memset(bbIn,0,DIV_MAX_OUTPUTS*sizeof(void*)); - memset(bbInMapped,0,DIV_MAX_OUTPUTS*sizeof(void*)); - memset(bbOut,0,DIV_MAX_OUTPUTS*sizeof(void*)); + memset(bbIn,0,DIV_MAX_OUTPUTS*sizeof(short*)); + memset(bbInMapped,0,DIV_MAX_OUTPUTS*sizeof(short*)); + memset(bbOut,0,DIV_MAX_OUTPUTS*sizeof(short*)); } }; @@ -356,6 +356,7 @@ class DivEngine { int softLockCount; int subticks, ticks, curRow, curOrder, prevRow, prevOrder, remainingLoops, totalLoops, lastLoopPos, exportLoopCount, nextSpeed, elapsedBars, elapsedBeats; size_t curSubSongIndex; + size_t bufferPos; double divider; int cycles; double clockDrift; @@ -905,6 +906,9 @@ class DivEngine { // set metronome volume (1.0 = 100%) void setMetronomeVol(float vol); + // get buffer position + int getBufferPos(); + // halt now void halt(); @@ -1073,6 +1077,7 @@ class DivEngine { elapsedBars(0), elapsedBeats(0), curSubSongIndex(0), + bufferPos(0), divider(60), cycles(0), clockDrift(0), diff --git a/src/engine/platform/arcade.cpp b/src/engine/platform/arcade.cpp index 3912921c..f9a2e7cb 100644 --- a/src/engine/platform/arcade.cpp +++ b/src/engine/platform/arcade.cpp @@ -50,10 +50,10 @@ const char** DivPlatformArcade::getRegisterSheet() { return regCheatSheetOPM; } -void DivPlatformArcade::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformArcade::acquire_nuked(short** buf, size_t len) { static int o[2]; - for (size_t h=start; hdebug_engine(); - for (size_t h=start; hsnd.main.output; if (sample>32767) sample=32767; if (sample<-32768) sample=-32768; - buf[0][i]=sample; + buf[i]=sample; if (++writeOscBuf>=32) { writeOscBuf=0; oscBuf->data[oscBuf->needle++]=sample<<1; @@ -69,15 +69,15 @@ void DivPlatformFDS::acquire_puNES(short* bufL, short* bufR, size_t start, size_ } } -void DivPlatformFDS::acquire_NSFPlay(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformFDS::acquire_NSFPlay(short* buf, size_t len) { int out[2]; - for (size_t i=start; iTick(1); fds_NP->Render(out); int sample=isMuted[0]?0:(out[0]<<1); if (sample>32767) sample=32767; if (sample<-32768) sample=-32768; - buf[0][i]=sample; + buf[i]=sample; if (++writeOscBuf>=32) { writeOscBuf=0; oscBuf->data[oscBuf->needle++]=sample<<1; @@ -95,9 +95,9 @@ void DivPlatformFDS::doWrite(unsigned short addr, unsigned char data) { void DivPlatformFDS::acquire(short** buf, size_t len) { if (useNP) { - acquire_NSFPlay(bufL,bufR,start,len); + acquire_NSFPlay(buf[0],len); } else { - acquire_puNES(bufL,bufR,start,len); + acquire_puNES(buf[0],len); } } diff --git a/src/engine/platform/fds.h b/src/engine/platform/fds.h index a6e7862e..7872319b 100644 --- a/src/engine/platform/fds.h +++ b/src/engine/platform/fds.h @@ -62,8 +62,8 @@ class DivPlatformFDS: public DivDispatch { friend void putDispatchChan(void*,int,int); void doWrite(unsigned short addr, unsigned char data); - void acquire_puNES(short* bufL, short* bufR, size_t start, size_t len); - void acquire_NSFPlay(short* bufL, short* bufR, size_t start, size_t len); + void acquire_puNES(short* buf, size_t len); + void acquire_NSFPlay(short* buf, size_t len); public: void acquire(short** buf, size_t len); diff --git a/src/engine/platform/ga20.cpp b/src/engine/platform/ga20.cpp index 990531b3..c5cbbb61 100644 --- a/src/engine/platform/ga20.cpp +++ b/src/engine/platform/ga20.cpp @@ -60,7 +60,7 @@ void DivPlatformGA20::acquire(short** buf, size_t len) { } } - for (size_t h=start; hdebug_engine(); - for (size_t h=start; h=0 && chan[i].samplesong.sampleLen) { chan[i].sampleAccum-=chan[i].sampleFreq; @@ -156,7 +156,7 @@ void DivPlatformLynx::acquire(short** buf, size_t len) { } } - mikey->sampleAudio( bufL + h, bufR + h, 1, oscBuf ); + mikey->sampleAudio(buf[0]+h,buf[1]+h,1,oscBuf); } } diff --git a/src/engine/platform/mmc5.cpp b/src/engine/platform/mmc5.cpp index 3e992068..6e44ea1c 100644 --- a/src/engine/platform/mmc5.cpp +++ b/src/engine/platform/mmc5.cpp @@ -44,7 +44,7 @@ const char** DivPlatformMMC5::getRegisterSheet() { } void DivPlatformMMC5::acquire(short** buf, size_t len) { - for (size_t i=start; i=rate) { diff --git a/src/engine/platform/msm5232.cpp b/src/engine/platform/msm5232.cpp index 1ed6e5a2..7405f8d3 100644 --- a/src/engine/platform/msm5232.cpp +++ b/src/engine/platform/msm5232.cpp @@ -46,7 +46,7 @@ const char** DivPlatformMSM5232::getRegisterSheet() { } void DivPlatformMSM5232::acquire(short** buf, size_t len) { - for (size_t h=start; hwrite(w.addr,w.val); diff --git a/src/engine/platform/msm6258.cpp b/src/engine/platform/msm6258.cpp index 4824af90..af1472af 100644 --- a/src/engine/platform/msm6258.cpp +++ b/src/engine/platform/msm6258.cpp @@ -35,7 +35,7 @@ void DivPlatformMSM6258::acquire(short** buf, size_t len) { &msmOut, NULL }; - for (size_t h=start; h32767) out=32767; diff --git a/src/engine/platform/namcowsg.cpp b/src/engine/platform/namcowsg.cpp index 58270c0e..cb4540f5 100644 --- a/src/engine/platform/namcowsg.cpp +++ b/src/engine/platform/namcowsg.cpp @@ -171,11 +171,11 @@ void DivPlatformNamcoWSG::acquire(short** buf, size_t len) { regPool[w.addr&0x3f]=w.val; writes.pop(); } - for (size_t h=start; hsound_stream_update(buf,1); + namco->sound_stream_update(bufC,1); for (int i=0; idata[oscBuf[i]->needle++]=namco->m_channel_list[i].last_out*chans; } diff --git a/src/engine/platform/nes.cpp b/src/engine/platform/nes.cpp index a60eeee4..3af55a0d 100644 --- a/src/engine/platform/nes.cpp +++ b/src/engine/platform/nes.cpp @@ -100,8 +100,8 @@ void DivPlatformNES::doWrite(unsigned short addr, unsigned char data) { } \ } -void DivPlatformNES::acquire_puNES(short* bufL, short* bufR, size_t start, size_t len) { - for (size_t i=start; iTick(1); @@ -153,9 +153,9 @@ void DivPlatformNES::acquire_NSFPlay(short* bufL, short* bufR, size_t start, siz void DivPlatformNES::acquire(short** buf, size_t len) { if (useNP) { - acquire_NSFPlay(bufL,bufR,start,len); + acquire_NSFPlay(buf,len); } else { - acquire_puNES(bufL,bufR,start,len); + acquire_puNES(buf,len); } } diff --git a/src/engine/platform/nes.h b/src/engine/platform/nes.h index 42758f56..22ccfd91 100644 --- a/src/engine/platform/nes.h +++ b/src/engine/platform/nes.h @@ -68,8 +68,8 @@ class DivPlatformNES: public DivDispatch { void doWrite(unsigned short addr, unsigned char data); unsigned char calcDPCMRate(int inRate); - void acquire_puNES(short* bufL, short* bufR, size_t start, size_t len); - void acquire_NSFPlay(short* bufL, short* bufR, size_t start, size_t len); + void acquire_puNES(short** buf, size_t len); + void acquire_NSFPlay(short** buf, size_t len); public: void acquire(short** buf, size_t len); diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index 4c993d54..e997a20b 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -159,12 +159,12 @@ const int orderedOpsL[4]={ #define ADDR_FREQH 0xb0 #define ADDR_LR_FB_ALG 0xc0 -void DivPlatformOPL::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformOPL::acquire_nuked(short** buf, size_t len) { static short o[2]; static int os[2]; static ymfm::ymfm_output<2> aOut; - for (size_t h=start; hfreq) pos=freq; @@ -216,8 +216,8 @@ void DivPlatformPCSpeaker::acquire_unfilt(short* bufL, short* bufR, size_t start } } -void DivPlatformPCSpeaker::acquire_cone(short* bufL, short* bufR, size_t start, size_t len) { - for (size_t i=start; ifreq) pos=freq; @@ -243,8 +243,8 @@ void DivPlatformPCSpeaker::acquire_cone(short* bufL, short* bufR, size_t start, } } -void DivPlatformPCSpeaker::acquire_piezo(short* bufL, short* bufR, size_t start, size_t len) { - for (size_t i=start; ifreq) pos=freq; @@ -274,7 +274,7 @@ void DivPlatformPCSpeaker::beepFreq(int freq, int delay) { realQueueLock.lock(); #ifdef __linux__ struct timespec ts; - double addition=1000000000.0*(double)delay/(double)rate; + double addition=1000000000.0*(double)delay/parent->getAudioDescGot().rate; addition+=1500000000.0*((double)parent->getAudioDescGot().bufsize/parent->getAudioDescGot().rate); if (clock_gettime(CLOCK_MONOTONIC,&ts)<0) { ts.tv_sec=0; @@ -294,14 +294,14 @@ void DivPlatformPCSpeaker::beepFreq(int freq, int delay) { realOutCond.notify_one(); } -void DivPlatformPCSpeaker::acquire_real(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformPCSpeaker::acquire_real(short** buf, size_t len) { int out=0; if (lastOn!=on || lastFreq!=freq) { lastOn=on; lastFreq=freq; - beepFreq((on && !isMuted[0])?freq:0,start); + beepFreq((on && !isMuted[0])?freq:0,parent->getBufferPos()); } - for (size_t i=start; ifreq) pos=freq; @@ -324,16 +324,16 @@ void DivPlatformPCSpeaker::acquire_real(short* bufL, short* bufR, size_t start, void DivPlatformPCSpeaker::acquire(short** buf, size_t len) { switch (speakerType) { case 0: - acquire_unfilt(bufL,bufR,start,len); + acquire_unfilt(buf,len); break; case 1: - acquire_cone(bufL,bufR,start,len); + acquire_cone(buf,len); break; case 2: - acquire_piezo(bufL,bufR,start,len); + acquire_piezo(buf,len); break; case 3: - acquire_real(bufL,bufR,start,len); + acquire_real(buf,len); break; } } diff --git a/src/engine/platform/pcspkr.h b/src/engine/platform/pcspkr.h index 953a93b8..554c0d07 100644 --- a/src/engine/platform/pcspkr.h +++ b/src/engine/platform/pcspkr.h @@ -61,10 +61,10 @@ class DivPlatformPCSpeaker: public DivDispatch { void beepFreq(int freq, int delay=0); - void acquire_unfilt(short* bufL, short* bufR, size_t start, size_t len); - void acquire_cone(short* bufL, short* bufR, size_t start, size_t len); - void acquire_piezo(short* bufL, short* bufR, size_t start, size_t len); - void acquire_real(short* bufL, short* bufR, size_t start, size_t len); + void acquire_unfilt(short** buf, size_t len); + void acquire_cone(short** buf, size_t len); + void acquire_piezo(short** buf, size_t len); + void acquire_real(short** buf, size_t len); public: void pcSpeakerThread(); diff --git a/src/engine/platform/pet.cpp b/src/engine/platform/pet.cpp index 7474558e..7a38de81 100644 --- a/src/engine/platform/pet.cpp +++ b/src/engine/platform/pet.cpp @@ -62,7 +62,7 @@ void DivPlatformPET::acquire(short** buf, size_t len) { if (!hwSROutput) { reload+=regPool[9]*512; } - for (size_t h=start; hchan[0].cnt) { chan[0].out=(chan[0].sreg&1)*32767; chan[0].sreg=(chan[0].sreg>>1)|((chan[0].sreg&1)<<7); @@ -78,7 +78,7 @@ void DivPlatformPET::acquire(short** buf, size_t len) { if (!hwSROutput) regPool[12]=chan[0].out?0xe0:0xc0; } else { chan[0].out=0; - for (size_t h=start; hdata[oscBuf->needle++]=0; diff --git a/src/engine/platform/pokemini.cpp b/src/engine/platform/pokemini.cpp index 1099e63f..9b543153 100644 --- a/src/engine/platform/pokemini.cpp +++ b/src/engine/platform/pokemini.cpp @@ -88,7 +88,7 @@ void DivPlatformPokeMini::rWrite(unsigned char addr, unsigned char val) { void DivPlatformPokeMini::acquire(short** buf, size_t len) { int out=0; - for (size_t i=start; i=2) { oscBufDelay=0; buf[h]=altASAP.sampleAudio(oscBuf); diff --git a/src/engine/platform/pokey.h b/src/engine/platform/pokey.h index 2418ade2..79206a74 100644 --- a/src/engine/platform/pokey.h +++ b/src/engine/platform/pokey.h @@ -59,8 +59,8 @@ class DivPlatformPOKEY: public DivDispatch { friend void putDispatchChan(void*,int,int); public: void acquire(short** buf, size_t len); - void acquireMZ(short* buf, size_t start, size_t len); - void acquireASAP(short* buf, size_t start, size_t len); + void acquireMZ(short* buf, size_t len); + void acquireASAP(short* buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); diff --git a/src/engine/platform/pong.cpp b/src/engine/platform/pong.cpp index fe34b398..27fd76b3 100644 --- a/src/engine/platform/pong.cpp +++ b/src/engine/platform/pong.cpp @@ -25,7 +25,7 @@ void DivPlatformPong::acquire(short** buf, size_t len) { int out=0; - for (size_t i=start; i 0) { @@ -72,7 +74,7 @@ void DivPlatformRF5C68::acquire(short** buf, size_t len) { rf5c68.sound_stream_update(bufPtrs,chBufPtrs,blockLen); for (int i=0; i<8; i++) { for (size_t j=0; jdata[oscBuf[i]->needle++]=buf[i*2][j]+buf[i*2+1][j]; + oscBuf[i]->data[oscBuf[i]->needle++]=bufC[i*2][j]+bufC[i*2+1][j]; } } pos+=blockLen; diff --git a/src/engine/platform/saa.cpp b/src/engine/platform/saa.cpp index 0208a3eb..924bc73a 100644 --- a/src/engine/platform/saa.cpp +++ b/src/engine/platform/saa.cpp @@ -56,7 +56,7 @@ const char** DivPlatformSAA1099::getRegisterSheet() { return regCheatSheetSAA; } -void DivPlatformSAA1099::acquire_saaSound(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformSAA1099::acquire_saaSound(short** buf, size_t len) { if (saaBufLenGenerateMany((unsigned char*)saaBuf[0],len,oscBuf); #ifdef TA_BIG_ENDIAN for (size_t i=0; i>8)); - buf[1][i+start]=(short)((((unsigned short)saaBuf[0][i<<1])<<8)|(((unsigned short)saaBuf[0][i<<1])>>8)); + buf[0][i]=(short)((((unsigned short)saaBuf[0][1+(i<<1)])<<8)|(((unsigned short)saaBuf[0][1+(i<<1)])>>8)); + buf[1][i]=(short)((((unsigned short)saaBuf[0][i<<1])<<8)|(((unsigned short)saaBuf[0][i<<1])>>8)); } #else for (size_t i=0; itick(); } diff --git a/src/engine/platform/segapcm.cpp b/src/engine/platform/segapcm.cpp index dd212c3f..25af4211 100644 --- a/src/engine/platform/segapcm.cpp +++ b/src/engine/platform/segapcm.cpp @@ -29,7 +29,7 @@ void DivPlatformSegaPCM::acquire(short** buf, size_t len) { static int os[2]; - for (size_t h=start; h32767) oR=32767; buf[0][h]=oL; - buf[1][h]=oR; + if (stereo) buf[1][h]=oR; for (int i=0; i<4; i++) { if (isMuted[i]) { oscBuf[i]->data[oscBuf[i]->needle++]=0; @@ -85,7 +85,7 @@ void DivPlatformSMS::acquire_nuked(short* bufL, short* bufR, size_t start, size_ } } -void DivPlatformSMS::acquire_mame(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformSMS::acquire_mame(short** buf, size_t len) { while (!writes.empty()) { QueuedWrite w=writes.front(); if (stereo && (w.addr==1)) @@ -95,10 +95,10 @@ void DivPlatformSMS::acquire_mame(short* bufL, short* bufR, size_t start, size_t } writes.pop(); } - for (size_t h=start; hsound_stream_update(outs,1); for (int i=0; i<4; i++) { @@ -113,9 +113,9 @@ void DivPlatformSMS::acquire_mame(short* bufL, short* bufR, size_t start, size_t void DivPlatformSMS::acquire(short** buf, size_t len) { if (nuked) { - acquire_nuked(bufL,bufR,start,len); + acquire_nuked(buf,len); } else { - acquire_mame(bufL,bufR,start,len); + acquire_mame(buf,len); } } diff --git a/src/engine/platform/sms.h b/src/engine/platform/sms.h index 7358ce91..cd0a7a1f 100644 --- a/src/engine/platform/sms.h +++ b/src/engine/platform/sms.h @@ -66,8 +66,8 @@ class DivPlatformSMS: public DivDispatch { double NOTE_SN(int ch, int note); int snCalcFreq(int ch); - void acquire_nuked(short* bufL, short* bufR, size_t start, size_t len); - void acquire_mame(short* bufL, short* bufR, size_t start, size_t len); + void acquire_nuked(short** buf, size_t len); + void acquire_mame(short** buf, size_t len); public: void acquire(short** buf, size_t len); int dispatch(DivCommand c); diff --git a/src/engine/platform/snes.cpp b/src/engine/platform/snes.cpp index 38512d13..6fb942d4 100644 --- a/src/engine/platform/snes.cpp +++ b/src/engine/platform/snes.cpp @@ -68,7 +68,7 @@ const char** DivPlatformSNES::getRegisterSheet() { void DivPlatformSNES::acquire(short** buf, size_t len) { short out[2]; short chOut[16]; - for (size_t h=start; hWrite(w.addr,w.val); diff --git a/src/engine/platform/swan.cpp b/src/engine/platform/swan.cpp index b5d860ae..f5a2dfb9 100644 --- a/src/engine/platform/swan.cpp +++ b/src/engine/platform/swan.cpp @@ -51,7 +51,7 @@ const char** DivPlatformSwan::getRegisterSheet() { } void DivPlatformSwan::acquire(short** buf, size_t len) { - for (size_t h=start; hdebug_engine(); - for (size_t h=start; hgetSample(chan[16].pcm.sample); while (len>0) { if (s->samples>0) { @@ -98,18 +98,18 @@ void DivPlatformVERA::acquire(short** buf, size_t len) { chan[16].pcm.sample=-1; } int curLen=MIN(len,128); - memset(buf,0,sizeof(buf)); - pcm_render(pcm,buf[2],buf[3],curLen); + memset(whyCallItBuf,0,sizeof(whyCallItBuf)); + pcm_render(pcm,whyCallItBuf[2],whyCallItBuf[3],curLen); for (int i=0; idata[oscBuf[i]->needle++]=psg->channels[i].lastOut<<4; } - int pcmOut=buf[2][i]+buf[3][i]; + int pcmOut=whyCallItBuf[2][i]+whyCallItBuf[3][i]; if (pcmOut<-32768) pcmOut=-32768; if (pcmOut>32767) pcmOut=32767; oscBuf[16]->data[oscBuf[16]->needle++]=pcmOut; diff --git a/src/engine/platform/vic20.cpp b/src/engine/platform/vic20.cpp index d45bf99f..9564ffa2 100644 --- a/src/engine/platform/vic20.cpp +++ b/src/engine/platform/vic20.cpp @@ -45,7 +45,7 @@ void DivPlatformVIC20::acquire(short** buf, size_t len) { 0b0, 0b10, 0b100, 0b110, 0b1000, 0b1010, 0b1011, 0b1110, 0b10010, 0b10100, 0b10110, 0b11000, 0b11010, 0b100100, 0b101010, 0b101100 }; - for (size_t h=start; hdebug_fm_engine(); @@ -240,7 +240,7 @@ void DivPlatformYM2203::acquire_ymfm(short* bufL, short* bufR, size_t start, siz fmChan[i]=fme->debug_channel(i); } - for (size_t h=start; hdebug_channel(i); } - for (size_t h=start; hdebug_fm_engine(); @@ -424,7 +424,7 @@ void DivPlatformYM2608::acquire_ymfm(short* bufL, short* bufR, size_t start, siz adpcmAChan[i]=aae->debug_channel(i); } - for (size_t h=start; hdebug_channel(i); } - for (size_t h=start; hdebug_fm_engine(); @@ -357,7 +357,7 @@ void DivPlatformYM2610::acquire_ymfm(short* bufL, short* bufR, size_t start, siz adpcmAChan[i]=aae->debug_channel(i); } - for (size_t h=start; hread(0)&0x80)) { diff --git a/src/engine/platform/ym2610.h b/src/engine/platform/ym2610.h index 40d013e1..a3bf53b4 100644 --- a/src/engine/platform/ym2610.h +++ b/src/engine/platform/ym2610.h @@ -38,8 +38,8 @@ class DivPlatformYM2610: public DivPlatformYM2610Base { friend void putDispatchChip(void*,int); - void acquire_combo(short* bufL, short* bufR, size_t start, size_t len); - void acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len); + void acquire_combo(short** buf, size_t len); + void acquire_ymfm(short** buf, size_t len); public: void acquire(short** buf, size_t len); diff --git a/src/engine/platform/ym2610b.cpp b/src/engine/platform/ym2610b.cpp index 82ebd38f..c69d28bf 100644 --- a/src/engine/platform/ym2610b.cpp +++ b/src/engine/platform/ym2610b.cpp @@ -298,13 +298,13 @@ const char** DivPlatformYM2610B::getRegisterSheet() { void DivPlatformYM2610B::acquire(short** buf, size_t len) { if (useCombo) { - acquire_combo(bufL,bufR,start,len); + acquire_combo(buf,len); } else { - acquire_ymfm(bufL,bufR,start,len); + acquire_ymfm(buf,len); } } -void DivPlatformYM2610B::acquire_combo(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformYM2610B::acquire_combo(short** buf, size_t len) { static int os[2]; static short ignored[2]; @@ -319,7 +319,7 @@ void DivPlatformYM2610B::acquire_combo(short* bufL, short* bufR, size_t start, s adpcmAChan[i]=aae->debug_channel(i); } - for (size_t h=start; hdebug_fm_engine(); @@ -423,7 +423,7 @@ void DivPlatformYM2610B::acquire_ymfm(short* bufL, short* bufR, size_t start, si adpcmAChan[i]=aae->debug_channel(i); } - for (size_t h=start; hread(0)&0x80)) { diff --git a/src/engine/platform/ym2610b.h b/src/engine/platform/ym2610b.h index c47967fd..ca2cb333 100644 --- a/src/engine/platform/ym2610b.h +++ b/src/engine/platform/ym2610b.h @@ -34,8 +34,8 @@ class DivPlatformYM2610B: public DivPlatformYM2610Base { friend void putDispatchChip(void*,int); - void acquire_combo(short* bufL, short* bufR, size_t start, size_t len); - void acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len); + void acquire_combo(short** buf, size_t len); + void acquire_ymfm(short** buf, size_t len); public: void acquire(short** buf, size_t len); diff --git a/src/engine/platform/ymz280b.cpp b/src/engine/platform/ymz280b.cpp index 1ca327f5..a5fdf10b 100644 --- a/src/engine/platform/ymz280b.cpp +++ b/src/engine/platform/ymz280b.cpp @@ -61,12 +61,12 @@ const char** DivPlatformYMZ280B::getRegisterSheet() { } void DivPlatformYMZ280B::acquire(short** buf, size_t len) { - short buf[16][256]; + short why[16][256]; short *bufPtrs[16]={ - buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7], - buf[8],buf[9],buf[10],buf[11],buf[12],buf[13],buf[14],buf[15] + why[0],why[1],why[2],why[3],why[4],why[5],why[6],why[7], + why[8],why[9],why[10],why[11],why[12],why[13],why[14],why[15] }; - size_t pos=start; + size_t pos=0; while (len > 0) { size_t blockLen = MIN(len, 256); ymz280b.sound_stream_update(bufPtrs, blockLen); @@ -74,9 +74,9 @@ void DivPlatformYMZ280B::acquire(short** buf, size_t len) { int dataL=0; int dataR=0; for (int j=0; j<8; j++) { - dataL+=buf[j*2][i]; - dataR+=buf[j*2+1][i]; - oscBuf[j]->data[oscBuf[j]->needle++]=(short)(((int)buf[j*2][i]+buf[j*2+1][i])/2); + dataL+=why[j*2][i]; + dataR+=why[j*2+1][i]; + oscBuf[j]->data[oscBuf[j]->needle++]=(short)(((int)why[j*2][i]+why[j*2+1][i])/2); } buf[0][pos]=(short)(dataL/8); buf[1][pos]=(short)(dataR/8); diff --git a/src/engine/platform/zxbeeper.cpp b/src/engine/platform/zxbeeper.cpp index cf563f27..7bd992f8 100644 --- a/src/engine/platform/zxbeeper.cpp +++ b/src/engine/platform/zxbeeper.cpp @@ -29,7 +29,7 @@ const char** DivPlatformZXBeeper::getRegisterSheet() { void DivPlatformZXBeeper::acquire(short** buf, size_t len) { bool o=false; - for (size_t h=start; h=0 && curSamplesong.sampleLen) { if (--curSamplePeriod<0) { diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 335da02a..c1a52bee 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -1359,6 +1359,10 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) { return ret; } +int DivEngine::getBufferPos() { + return bufferPos>>MASTER_CLOCK_PREC; +} + void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsigned int size) { lastLoopPos=-1; @@ -1619,6 +1623,9 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi int attempts=0; int runLeftG=size<getPostAmp(); volR*=disCont[i].dispatch->getPostAmp(); - if (disCont[i].dispatch->isStereo()) { + if (disCont[i].dispatch->getOutputCount()>1) { for (size_t j=0; j Date: Tue, 3 Jan 2023 14:39:31 -0500 Subject: [PATCH 04/72] new dispatch, part 2 --- src/engine/dispatchContainer.cpp | 1 + src/engine/engine.h | 4 +++- src/engine/platform/k007232.cpp | 2 +- src/engine/platform/x1_010.cpp | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index fa72b76b..22c63d67 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -85,6 +85,7 @@ void DivDispatchContainer::setRates(double gotRate) { for (int i=0; irate,gotRate); } + rateMemory=gotRate; } void DivDispatchContainer::setQuality(bool lowQual) { diff --git a/src/engine/engine.h b/src/engine/engine.h index 652d7158..219c468b 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -177,6 +177,7 @@ struct DivDispatchContainer { short* bbIn[DIV_MAX_OUTPUTS]; short* bbOut[DIV_MAX_OUTPUTS]; bool lowQuality, dcOffCompensation; + double rateMemory; void setRates(double gotRate); void setQuality(bool lowQual); @@ -194,7 +195,8 @@ struct DivDispatchContainer { runPos(0), lastAvail(0), lowQuality(false), - dcOffCompensation(false) { + dcOffCompensation(false), + rateMemory(0.0) { memset(bb,0,DIV_MAX_OUTPUTS*sizeof(blip_buffer_t*)); memset(temp,0,DIV_MAX_OUTPUTS*sizeof(int)); memset(prevSample,0,DIV_MAX_OUTPUTS*sizeof(int)); diff --git a/src/engine/platform/k007232.cpp b/src/engine/platform/k007232.cpp index a076d120..6a333c6c 100644 --- a/src/engine/platform/k007232.cpp +++ b/src/engine/platform/k007232.cpp @@ -84,7 +84,7 @@ void DivPlatformK007232::acquire(short** buf, size_t len) { } else { const unsigned char vol=regPool[0xc]; const signed int out[2]={(k007232.output(0)*(vol&0xf)),(k007232.output(1)*((vol>>4)&0xf))}; - buf[0][h]=buf[1][h]=(out[0]+out[1])<<4; + buf[0][h]=(out[0]+out[1])<<4; for (int i=0; i<2; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=out[i]<<5; } diff --git a/src/engine/platform/x1_010.cpp b/src/engine/platform/x1_010.cpp index 17cda3b7..34973a99 100644 --- a/src/engine/platform/x1_010.cpp +++ b/src/engine/platform/x1_010.cpp @@ -219,7 +219,7 @@ void DivPlatformX1_010::acquire(short** buf, size_t len) { //printf("tempL: %d tempR: %d\n",tempL,tempR); buf[0][h]=stereo?tempL:((tempL+tempR)>>1); - buf[1][h]=stereo?tempR:buf[0][h]; + if (stereo) buf[1][h]=tempR; for (int i=0; i<16; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=(x1_010.voice_out(i,0)+x1_010.voice_out(i,1))>>1; From 9436e2ab55fe931d847cae92d806ece7bb7521dc Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 4 Jan 2023 03:11:47 -0500 Subject: [PATCH 05/72] new dispatch, part 3 --- src/engine/platform/pet.cpp | 2 -- src/engine/platform/scc.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/engine/platform/pet.cpp b/src/engine/platform/pet.cpp index 7a38de81..b4399bcb 100644 --- a/src/engine/platform/pet.cpp +++ b/src/engine/platform/pet.cpp @@ -71,7 +71,6 @@ void DivPlatformPET::acquire(short** buf, size_t len) { chan[0].cnt-=SAMP_DIVIDER; } buf[0][h]=chan[0].out; - buf[1][h]=chan[0].out; oscBuf->data[oscBuf->needle++]=chan[0].out; } // emulate driver writes to PCR @@ -80,7 +79,6 @@ void DivPlatformPET::acquire(short** buf, size_t len) { chan[0].out=0; for (size_t h=0; hdata[oscBuf->needle++]=0; } } diff --git a/src/engine/platform/scc.cpp b/src/engine/platform/scc.cpp index 79b983e4..fcb55f25 100644 --- a/src/engine/platform/scc.cpp +++ b/src/engine/platform/scc.cpp @@ -86,7 +86,7 @@ void DivPlatformSCC::acquire(short** buf, size_t len) { scc->tick(); } short out=(short)scc->out()<<5; - buf[0][h]=buf[1][h]=out; + buf[0][h]=out; for (int i=0; i<5; i++) { oscBuf[i]->data[oscBuf[i]->needle++]=scc->voice_out(i)<<7; From 6c834524aa9a22351d40704870b7dd980cd9ff05 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 4 Jan 2023 17:01:14 -0500 Subject: [PATCH 06/72] new dispatch, part 4 --- src/engine/dispatchContainer.cpp | 39 ++++++++++++++++++++++++++++++++ src/engine/engine.h | 1 + src/engine/playback.cpp | 8 ++----- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index 22c63d67..46320691 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -83,6 +83,7 @@ void DivDispatchContainer::setRates(double gotRate) { int outs=dispatch->getOutputCount(); for (int i=0; irate,gotRate); } rateMemory=gotRate; @@ -92,6 +93,16 @@ void DivDispatchContainer::setQuality(bool lowQual) { lowQuality=lowQual; } +void DivDispatchContainer::grow(size_t size) { + bbInLen=size; + for (int i=0; igetOutputCount(); for (int i=0; igetOutputCount(); for (int i=0; igetOutputCount(); + + // create missing buffers if any + bool mustClear=false; + for (int i=0; irate,rateMemory); + + if (bbIn[i]==NULL) bbIn[i]=new short[bbInLen]; + if (bbOut[i]==NULL) bbOut[i]=new short[bbInLen]; + memset(bbIn[i],0,bbInLen*sizeof(short)); + memset(bbOut[i],0,bbInLen*sizeof(short)); + } + } + if (mustClear) clear(); + if (dcOffCompensation && runtotal>0) { dcOffCompensation=false; for (int i=0; idisCont[i].bbInLen) { - logV("growing dispatch %d bbIn to %d",i,disCont[i].runtotal+256); - delete[] disCont[i].bbIn[0]; - delete[] disCont[i].bbIn[1]; - disCont[i].bbIn[0]=new short[disCont[i].runtotal+256]; - disCont[i].bbIn[1]=new short[disCont[i].runtotal+256]; - disCont[i].bbInLen=disCont[i].runtotal+256; + logD("growing dispatch %d bbIn to %d",i,disCont[i].runtotal+256); + disCont[i].grow(disCont[i].runtotal+256); } disCont[i].runLeft=disCont[i].runtotal; disCont[i].runPos=0; From fd9b1dd0f5b336b105c7b6c6762ce332a782d25e Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 4 Jan 2023 18:30:29 -0500 Subject: [PATCH 07/72] OPL: quad output now that we have this new dispatch output method --- extern/opl/opl3.c | 105 +++++++++++++++++++++++++++--------- extern/opl/opl3.h | 11 ++-- src/engine/platform/opl.cpp | 35 +++++++++--- 3 files changed, 118 insertions(+), 33 deletions(-) diff --git a/extern/opl/opl3.c b/extern/opl/opl3.c index b0a090c5..3358f033 100644 --- a/extern/opl/opl3.c +++ b/extern/opl/opl3.c @@ -946,10 +946,8 @@ static void OPL3_ChannelSetupAlg(opl3_channel *channel) } } -static void OPL3_ChannelWriteC0(opl3_channel *channel, uint8_t data) +static void OPL3_ChannelUpdateAlg(opl3_channel *channel) { - channel->fb = (data & 0x0e) >> 1; - channel->con = data & 0x01; channel->alg = channel->con; if (channel->chip->newm) { @@ -974,14 +972,25 @@ static void OPL3_ChannelWriteC0(opl3_channel *channel, uint8_t data) { OPL3_ChannelSetupAlg(channel); } +} + +static void OPL3_ChannelWriteC0(opl3_channel *channel, uint8_t data) +{ + channel->fb = (data & 0x0e) >> 1; + channel->con = data & 0x01; + OPL3_ChannelUpdateAlg(channel); if (channel->chip->newm) { channel->cha = ((data >> 4) & 0x01) ? ~0 : 0; channel->chb = ((data >> 5) & 0x01) ? ~0 : 0; + channel->chc = ((data >> 6) & 0x01) ? ~0 : 0; + channel->chd = ((data >> 7) & 0x01) ? ~0 : 0; } else { channel->cha = channel->chb = (uint16_t)~0; + // TODO: Verify on real chip if DAC2 output is disabled in compat mode + channel->chc = channel->chd = 0; } #if OPL_ENABLE_STEREOEXT if (!channel->chip->stereoext) @@ -1066,11 +1075,14 @@ static void OPL3_ChannelSet4Op(opl3_chip *chip, uint8_t data) { chip->channel[chnum].chtype = ch_4op; chip->channel[chnum + 3].chtype = ch_4op2; + OPL3_ChannelUpdateAlg(&chip->channel[chnum]); } else { chip->channel[chnum].chtype = ch_2op; chip->channel[chnum + 3].chtype = ch_2op; + OPL3_ChannelUpdateAlg(&chip->channel[chnum]); + OPL3_ChannelUpdateAlg(&chip->channel[chnum+3]); } } } @@ -1096,17 +1108,18 @@ static void OPL3_ProcessSlot(opl3_slot *slot) OPL3_SlotGenerate(slot); } -void OPL3_Generate(opl3_chip *chip, int16_t *buf) +inline void OPL3_Generate4Ch(opl3_chip *chip, int16_t *buf4) { opl3_channel *channel; opl3_writebuf *writebuf; int16_t **out; - int32_t mix; + int32_t mix[2]; uint8_t ii; int16_t accm; uint8_t shift = 0; - buf[1] = OPL3_ClipSample(chip->mixbuff[1]); + buf4[1] = OPL3_ClipSample(chip->mixbuff[1]); + buf4[3] = OPL3_ClipSample(chip->mixbuff[3]); #if OPL_QUIRK_CHANNELSAMPLEDELAY for (ii = 0; ii < 15; ii++) @@ -1117,7 +1130,7 @@ void OPL3_Generate(opl3_chip *chip, int16_t *buf) OPL3_ProcessSlot(&chip->slot[ii]); } - mix = 0; + mix[0] = mix[1] = 0; for (ii = 0; ii < 18; ii++) { channel = &chip->channel[ii]; @@ -1125,12 +1138,14 @@ void OPL3_Generate(opl3_chip *chip, int16_t *buf) out = channel->out; accm = *out[0] + *out[1] + *out[2] + *out[3]; #if OPL_ENABLE_STEREOEXT - mix += (int16_t)((accm * channel->leftpan) >> 16); + mix[0] += (int16_t)((accm * channel->leftpan) >> 16); #else - mix += (int16_t)(accm & channel->cha); -#endif + mix[0] += (int16_t)(accm & channel->cha); + #endif + mix[1] += (int16_t)(accm & channel->chc); } - chip->mixbuff[0] = mix; + chip->mixbuff[0] = mix[0]; + chip->mixbuff[2] = mix[1]; #if OPL_QUIRK_CHANNELSAMPLEDELAY for (ii = 15; ii < 18; ii++) @@ -1139,7 +1154,8 @@ void OPL3_Generate(opl3_chip *chip, int16_t *buf) } #endif - buf[0] = OPL3_ClipSample(chip->mixbuff[0]); + buf4[0] = OPL3_ClipSample(chip->mixbuff[0]); + buf4[2] = OPL3_ClipSample(chip->mixbuff[2]); #if OPL_QUIRK_CHANNELSAMPLEDELAY for (ii = 18; ii < 33; ii++) @@ -1148,7 +1164,7 @@ void OPL3_Generate(opl3_chip *chip, int16_t *buf) } #endif - mix = 0; + mix[0] = mix[1] = 0; for (ii = 0; ii < 18; ii++) { channel = &chip->channel[ii]; @@ -1156,12 +1172,14 @@ void OPL3_Generate(opl3_chip *chip, int16_t *buf) out = channel->out; accm = *out[0] + *out[1] + *out[2] + *out[3]; #if OPL_ENABLE_STEREOEXT - mix += (int16_t)((accm * channel->rightpan) >> 16); + mix[0] += (int16_t)((accm * channel->rightpan) >> 16); #else - mix += (int16_t)(accm & channel->chb); -#endif + mix[0] += (int16_t)(accm & channel->chb); + #endif + mix[1] += (int16_t)(accm & channel->chd); } - chip->mixbuff[1] = mix; + chip->mixbuff[1] = mix[0]; + chip->mixbuff[3] = mix[1]; #if OPL_QUIRK_CHANNELSAMPLEDELAY for (ii = 33; ii < 36; ii++) @@ -1236,22 +1254,44 @@ void OPL3_Generate(opl3_chip *chip, int16_t *buf) chip->writebuf_samplecnt++; } -void OPL3_GenerateResampled(opl3_chip *chip, int16_t *buf) +void OPL3_Generate(opl3_chip *chip, int16_t *buf) +{ + int16_t samples[4]; + OPL3_Generate4Ch(chip, samples); + buf[0] = samples[0]; + buf[1] = samples[1]; +} + +void OPL3_Generate4ChResampled(opl3_chip *chip, int16_t *buf4) { while (chip->samplecnt >= chip->rateratio) { chip->oldsamples[0] = chip->samples[0]; chip->oldsamples[1] = chip->samples[1]; - OPL3_Generate(chip, chip->samples); + chip->oldsamples[2] = chip->samples[2]; + chip->oldsamples[3] = chip->samples[3]; + OPL3_Generate4Ch(chip, chip->samples); chip->samplecnt -= chip->rateratio; } - buf[0] = (int16_t)((chip->oldsamples[0] * (chip->rateratio - chip->samplecnt) - + chip->samples[0] * chip->samplecnt) / chip->rateratio); - buf[1] = (int16_t)((chip->oldsamples[1] * (chip->rateratio - chip->samplecnt) - + chip->samples[1] * chip->samplecnt) / chip->rateratio); + buf4[0] = (int16_t)((chip->oldsamples[0] * (chip->rateratio - chip->samplecnt) + + chip->samples[0] * chip->samplecnt) / chip->rateratio); + buf4[1] = (int16_t)((chip->oldsamples[1] * (chip->rateratio - chip->samplecnt) + + chip->samples[1] * chip->samplecnt) / chip->rateratio); + buf4[2] = (int16_t)((chip->oldsamples[2] * (chip->rateratio - chip->samplecnt) + + chip->samples[2] * chip->samplecnt) / chip->rateratio); + buf4[3] = (int16_t)((chip->oldsamples[3] * (chip->rateratio - chip->samplecnt) + + chip->samples[3] * chip->samplecnt) / chip->rateratio); chip->samplecnt += 1 << RSM_FRAC; } +void OPL3_GenerateResampled(opl3_chip *chip, int16_t *buf) +{ + int16_t samples[4]; + OPL3_Generate4ChResampled(chip, samples); + buf[0] = samples[0]; + buf[1] = samples[1]; +} + void OPL3_Reset(opl3_chip *chip, uint32_t samplerate) { opl3_slot *slot; @@ -1464,9 +1504,26 @@ void OPL3_WriteRegBuffered(opl3_chip *chip, uint16_t reg, uint8_t v) chip->writebuf_last = (writebuf_last + 1) % OPL_WRITEBUF_SIZE; } +void OPL3_Generate4ChStream(opl3_chip *chip, int16_t *sndptr1, int16_t *sndptr2, uint32_t numsamples) +{ + uint_fast32_t i; + int16_t samples[4]; + + for(i = 0; i < numsamples; i++) + { + OPL3_Generate4ChResampled(chip, samples); + sndptr1[0] = samples[0]; + sndptr1[1] = samples[1]; + sndptr2[0] = samples[2]; + sndptr2[1] = samples[3]; + sndptr1 += 2; + sndptr2 += 2; + } +} + void OPL3_GenerateStream(opl3_chip *chip, int16_t *sndptr, uint32_t numsamples) { - uint32_t i; + uint_fast32_t i; for(i = 0; i < numsamples; i++) { diff --git a/extern/opl/opl3.h b/extern/opl/opl3.h index 6ad33f3e..8d515323 100644 --- a/extern/opl/opl3.h +++ b/extern/opl/opl3.h @@ -101,6 +101,7 @@ struct _opl3_channel { uint8_t alg; uint8_t ksv; uint16_t cha, chb; + uint16_t chc, chd; uint8_t ch_num; uint8_t muted; }; @@ -129,7 +130,7 @@ struct _opl3_chip { uint8_t tremoloshift; uint32_t noise; int16_t zeromod; - int32_t mixbuff[2]; + int32_t mixbuff[4]; uint8_t rm_hh_bit2; uint8_t rm_hh_bit3; uint8_t rm_hh_bit7; @@ -144,8 +145,8 @@ struct _opl3_chip { /* OPL3L */ int32_t rateratio; int32_t samplecnt; - int16_t oldsamples[2]; - int16_t samples[2]; + int16_t oldsamples[4]; + int16_t samples[4]; uint64_t writebuf_samplecnt; uint32_t writebuf_cur; @@ -161,6 +162,10 @@ void OPL3_WriteReg(opl3_chip *chip, uint16_t reg, uint8_t v); void OPL3_WriteRegBuffered(opl3_chip *chip, uint16_t reg, uint8_t v); void OPL3_GenerateStream(opl3_chip *chip, int16_t *sndptr, uint32_t numsamples); +void OPL3_Generate4Ch(opl3_chip *chip, int16_t *buf4); +void OPL3_Generate4ChResampled(opl3_chip *chip, int16_t *buf4); +void OPL3_Generate4ChStream(opl3_chip *chip, int16_t *sndptr1, int16_t *sndptr2, uint32_t numsamples); + #ifdef __cplusplus } #endif diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index e997a20b..fc31c013 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -160,12 +160,12 @@ const int orderedOpsL[4]={ #define ADDR_LR_FB_ALG 0xc0 void DivPlatformOPL::acquire_nuked(short** buf, size_t len) { - static short o[2]; - static int os[2]; + static short o[4]; + static int os[4]; static ymfm::ymfm_output<2> aOut; for (size_t h=0; h=0) { adpcmB->clock(); @@ -225,6 +228,12 @@ void DivPlatformOPL::acquire_nuked(short** buf, size_t len) { if (fm.channel[i].out[1]!=NULL) { oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[1]; } + if (fm.channel[i].out[2]!=NULL) { + oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[2]; + } + if (fm.channel[i].out[3]!=NULL) { + oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[3]; + } oscBuf[i]->data[oscBuf[i]->needle]<<=1; oscBuf[i]->needle++; } @@ -244,6 +253,12 @@ void DivPlatformOPL::acquire_nuked(short** buf, size_t len) { if (fm.channel[i].out[1]!=NULL) { oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[1]; } + if (fm.channel[i].out[2]!=NULL) { + oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[2]; + } + if (fm.channel[i].out[3]!=NULL) { + oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[3]; + } oscBuf[i]->data[oscBuf[i]->needle]<<=1; oscBuf[i]->needle++; } @@ -254,10 +269,18 @@ void DivPlatformOPL::acquire_nuked(short** buf, size_t len) { if (os[1]<-32768) os[1]=-32768; if (os[1]>32767) os[1]=32767; + + if (os[2]<-32768) os[2]=-32768; + if (os[2]>32767) os[2]=32767; + + if (os[3]<-32768) os[3]=-32768; + if (os[3]>32767) os[3]=32767; buf[0][h]=os[0]; if (oplType==3 || oplType==759) { buf[1][h]=os[1]; + buf[2][h]=os[2]; + buf[3][h]=os[3]; } } } From abf2461573dbcee53f11eb3323b72ab2aeed0ebf Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 4 Jan 2023 19:16:37 -0500 Subject: [PATCH 08/72] OPL: increase range of pan macro --- src/engine/platform/opl.cpp | 33 +++++++++++++++++---------------- src/gui/insEdit.cpp | 15 +++++++++------ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index fc31c013..c11537ff 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -337,7 +337,7 @@ void DivPlatformOPL::tick(bool sysTick) { } if (oplType==3 && chan[i].std.panL.had) { - chan[i].pan=((chan[i].std.panL.val&1)<<1)|((chan[i].std.panL.val&2)>>1); + chan[i].pan=((chan[i].std.panL.val&1)<<1)|((chan[i].std.panL.val&2)>>1)|((chan[i].std.panL.val&4)<<1)|((chan[i].std.panL.val&8)>>1); } if (chan[i].std.pitch.had) { @@ -370,9 +370,9 @@ void DivPlatformOPL::tick(bool sysTick) { rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1)); } } else { - rWrite(chanMap[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&1)|(chan[i].state.fb<<1)|((chan[i].pan&3)<<4)); + rWrite(chanMap[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&1)|(chan[i].state.fb<<1)|((chan[i].pan&15)<<4)); if (ops==4) { - rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1)|((chan[i].pan&3)<<4)); + rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1)|((chan[i].pan&15)<<4)); } } } @@ -682,9 +682,9 @@ void DivPlatformOPL::muteChannel(int ch, bool mute) { rWrite(chanMap[ch+1]+ADDR_LR_FB_ALG,((chan[ch].state.alg>>1)&1)|(chan[ch].state.fb<<1)); } } else { - rWrite(chanMap[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&1)|(chan[ch].state.fb<<1)|((chan[ch].pan&3)<<4)); + rWrite(chanMap[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&1)|(chan[ch].state.fb<<1)|((chan[ch].pan&15)<<4)); if (ops==4) { - rWrite(chanMap[ch+1]+ADDR_LR_FB_ALG,((chan[ch].state.alg>>1)&1)|(chan[ch].state.fb<<1)|((chan[ch].pan&3)<<4)); + rWrite(chanMap[ch+1]+ADDR_LR_FB_ALG,((chan[ch].state.alg>>1)&1)|(chan[ch].state.fb<<1)|((chan[ch].pan&15)<<4)); } } } @@ -820,7 +820,7 @@ int DivPlatformOPL::dispatch(DivCommand c) { rWrite(chanMap[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&1)|(chan[ch].state.fb<<1)); } else { oldWrites[chanMap[ch]+ADDR_LR_FB_ALG]=-1; - rWrite(chanMap[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&1)|(chan[ch].state.fb<<1)|((chan[ch].pan&3)<<4)); + rWrite(chanMap[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&1)|(chan[ch].state.fb<<1)|((chan[ch].pan&15)<<4)); } } } else { @@ -870,10 +870,10 @@ int DivPlatformOPL::dispatch(DivCommand c) { } } else { oldWrites[chanMap[c.chan]+ADDR_LR_FB_ALG]=-1; - rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4)); + rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4)); if (ops==4) { oldWrites[chanMap[c.chan+1]+ADDR_LR_FB_ALG]=-1; - rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4)); + rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4)); } } } @@ -979,10 +979,11 @@ int DivPlatformOPL::dispatch(DivCommand c) { case DIV_CMD_PANNING: { if (oplType!=3) break; if (c.chan==adpcmChan) break; + chan[c.chan].pan&=~3; if (c.value==0 && c.value2==0) { - chan[c.chan].pan=3; + chan[c.chan].pan|=3; } else { - chan[c.chan].pan=(c.value>0)|((c.value2>0)<<1); + chan[c.chan].pan|=(c.value>0)|((c.value2>0)<<1); } int ops=(slots[3][c.chan]!=255 && chan[c.chan].state.ops==4 && oplType==3)?4:2; if (isMuted[c.chan]) { @@ -991,9 +992,9 @@ int DivPlatformOPL::dispatch(DivCommand c) { rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)); } } else { - rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4)); + rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4)); if (ops==4) { - rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4)); + rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4)); } } break; @@ -1072,9 +1073,9 @@ int DivPlatformOPL::dispatch(DivCommand c) { rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)); } } else { - rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4)); + rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4)); if (ops==4) { - rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4)); + rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4)); } } break; @@ -1454,9 +1455,9 @@ void DivPlatformOPL::forceIns() { rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1)); } } else { - rWrite(chanMap[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&1)|(chan[i].state.fb<<1)|((chan[i].pan&3)<<4)); + rWrite(chanMap[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&1)|(chan[i].state.fb<<1)|((chan[i].pan&15)<<4)); if (ops==4) { - rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1)|((chan[i].pan&3)<<4)); + rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1)|((chan[i].pan&15)<<4)); } } */ diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index 66fc5eec..8771bd99 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -283,8 +283,8 @@ const char* es5506FilterModes[4]={ "HP/K2, HP/K2", "HP/K2, LP/K1", "LP/K2, LP/K2", "LP/K2, LP/K1", }; -const char* panBits[3]={ - "right", "left", NULL +const char* panBits[5]={ + "right", "left", "rear right", "rear left", NULL }; const char* oneBit[2]={ @@ -5195,15 +5195,18 @@ void FurnaceGUI::drawInsEdit() { if (ins->type==DIV_INS_STD ||//Game Gear ins->type==DIV_INS_FM || ins->type==DIV_INS_OPM || - ins->type==DIV_INS_OPL || - ins->type==DIV_INS_OPL_DRUMS || ins->type==DIV_INS_GB || ins->type==DIV_INS_OPZ || ins->type==DIV_INS_MSM6258 || ins->type==DIV_INS_VERA || ins->type==DIV_INS_ADPCMA || ins->type==DIV_INS_ADPCMB) { - panMax=1; + panMax=2; + panSingle=true; + } + if (ins->type==DIV_INS_OPL || + ins->type==DIV_INS_OPL_DRUMS) { + panMax=4; panSingle=true; } if (ins->type==DIV_INS_X1_010 || ins->type==DIV_INS_PCE || ins->type==DIV_INS_MIKEY || @@ -5268,7 +5271,7 @@ void FurnaceGUI::drawInsEdit() { } if (panMax>0) { if (panSingle) { - macroList.push_back(FurnaceGUIMacroDesc("Panning",&ins->std.panLMacro,0,2,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,panBits)); + macroList.push_back(FurnaceGUIMacroDesc("Panning",&ins->std.panLMacro,0,panMax,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,panBits)); } else if (ins->type==DIV_INS_QSOUND) { macroList.push_back(FurnaceGUIMacroDesc("Panning",&ins->std.panLMacro,panMin,panMax,CLAMP(31+panMax-panMin,32,160),uiColors[GUI_COLOR_MACRO_OTHER])); macroList.push_back(FurnaceGUIMacroDesc("Surround",&ins->std.panRMacro,0,1,32,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true)); From 48bcc6a124ea12eb1a870c30f13f0a629fbd5cf3 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 4 Jan 2023 20:04:02 -0500 Subject: [PATCH 09/72] prepare for handling more than 2 channels --- src/engine/playback.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index aae80297..8696864c 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -1367,8 +1367,9 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi lastLoopPos=-1; if (out!=NULL) { - memset(out[0],0,size*sizeof(float)); - memset(out[1],0,size*sizeof(float)); + for (int i=0; i0.0f) { - out[0][i]+=(sin(metroPos*2*M_PI))*metroAmp*metroVol; - out[1][i]+=(sin(metroPos*2*M_PI))*metroAmp*metroVol; + for (int j=0; j=1) metroPos--; } + // TODO: handle more than 2 outputs for (unsigned int i=0; i1.0) out[0][i]=1.0; - if (out[1][i]<-1.0) out[1][i]=-1.0; - if (out[1][i]>1.0) out[1][i]=1.0; + for (int j=0; j1.0) out[j][i]=1.0; + } } } isBusy.unlock(); From 8c70ac8da37e73b66879b37b1d1d5e60f0e0c936 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 4 Jan 2023 20:04:40 -0500 Subject: [PATCH 10/72] don't detach console on Windows --- src/winMain.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/winMain.cpp b/src/winMain.cpp index c904b996..853b1153 100644 --- a/src/winMain.cpp +++ b/src/winMain.cpp @@ -22,10 +22,6 @@ typedef HRESULT (*SPDA)(int); int WINAPI WinMain(HINSTANCE inst, HINSTANCE prevInst, PSTR args, int state) { - if (AttachConsole(ATTACH_PARENT_PROCESS)==0) { - if (GetLastError()==ERROR_ACCESS_DENIED) FreeConsole(); - } - int argc=0; wchar_t** argw=CommandLineToArgvW(GetCommandLineW(),&argc); char** argv=new char*[argc+1]; From 8e632577561bc705905af1ec1c31d0d5cb74c39c Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 4 Jan 2023 22:59:21 -0500 Subject: [PATCH 11/72] GUI: fix possible crash in grid mode --- src/gui/insEdit.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index 66fc5eec..d18776e6 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -1850,6 +1850,7 @@ void FurnaceGUI::drawMacros(std::vector& macros, FurnaceGUI case 2: { int columns=round(ImGui::GetContentRegionAvail().x/(400.0*dpiScale)); int curColumn=0; + if (columns<1) columns=1; if (ImGui::BeginTable("MacroGrid",columns,ImGuiTableFlags_BordersInner)) { for (FurnaceGUIMacroDesc& i: macros) { if (curColumn==0) ImGui::TableNextRow(); From e75413c0c79a85ec00c9024f41490eb02cbdac96 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 4 Jan 2023 23:38:31 -0500 Subject: [PATCH 12/72] lagrange_point_2023_opm.fur --- demos/misc/lagrange_point_2023_opm.fur | Bin 0 -> 2579 bytes demos/msx/Lagrange_Point.fur | Bin 2006 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 demos/misc/lagrange_point_2023_opm.fur delete mode 100644 demos/msx/Lagrange_Point.fur diff --git a/demos/misc/lagrange_point_2023_opm.fur b/demos/misc/lagrange_point_2023_opm.fur new file mode 100644 index 0000000000000000000000000000000000000000..31832bc93e9dfeb7befbd77e7057cdc873d83866 GIT binary patch literal 2579 zcmZuwdpy%^AEwd9$ci~6Ob0qp^T?^#Oq3o%wvd$Ruyw+U$01`3DdU+=PtvqPa;oKg zK9;4&Va}0bn?sL7n!Rnt?Dx*+{p0<-pU?Z>eSZ)4_qwk8`bIDo&%3ASdg}n4Da3W+ z7~y%4`u@1EuNwQ{j%S1S<~cx?jBakvxY>6zPb2NBAIs`iX@$2isKO!dak9t9`&cm8jrD{((7Du6=Yw6e^(^;-LH zbRN$RtHq5JSsv*6e47{cT3of4%OM72+&z~b5K6O1dFs?EHI3=Yjb+jdAk23(X6CiY zC^b1WYD=A1X>v@x$-vQ!VxuY%D7{>d#1oVvruN|joXFDsq+f;h(?>{AdJ%!3mDB1G zygiedPva&iCy*@CYEd2`$|sS@LgM2NY+1$P4y?Xf_~kg34pM&d_RA+)?`Wswhv~d+dq6GEbD{ z+j<}U+$+^XhfQ`}8Np&3!dRLghZFOzlO ze6O0bx8I%j-D`WAFET)PcOw(wy0&aO-&)x~& zw>QZFDC6T_<{VDdg@ft%D}3u0wYP;KUBiomUfDB@V9PK|#%s^Q#Az4$H?)h9a`mNQ zuBOM|dM;W{x)jY%9)6nZ>}Wf%pD!7r<8!>$v`Uvy1Nyp1o9)dSSZo)vQVzYXGLF73 z%IS-Ex9U(@7Fl|l)uwLxp_)JRaz5u*RUpFxITBNK{5r^=X?Y|N*_wq14u)CMGIQLu>Qecv8W-&45 z@9Y27*a8jnhq;QhN-``U<)GgvGiYUChkz(mnwi)IxvgkhIQ(#Hxr2`Tkgx%e*SGgu z`DFK!JqFw|=sqi?l#L@~m#oeAykO z|Gj}PtcGqs^$kVht8(ym9-tcGHgIv}eW6hg%Ds#z?eHf`BYirUVtOitj&MGi2A5&R z%fcY(NvQLqW(rLk9lmK~?s|$WJxYu{L!gM2D;Lt(%IN1^;ksdHH1MV-nZuimz7x zxY5_=j%&6(FU01QOmX;A#dNg5;E4=NTNI@EKqyTyPL@zzardfC9X^%E!|SbgzSR`iRj9LclBF3I|9IT<_9vPiL+(^XsP&aeV9Z7;sR{h*^ zU{-X-Rrl6{d6!PQ+uK9s1F34f&+H^ANSJU`LyZ#emQp$(RR~MgcKXSLW#}RHnw8(TX#XIi+_|bj8#|3iG*I{8rs)n zou$Ui2@q1M(ihzQVY#ECv#_1)1>mX~IOnR_05E#NkoOMJCYDdr1gfLdMky*`rO3rG z2J|{ptL0cRXWL?*BTDAR`3|&9W6l|kMAV@4u?JZ9((O#V($HEtgeRzMMx== zoLQSlt_IEsh(J<1vyM9n-KgEzf?=R%c{WzVlu`iX3pI=DAI<>hF=^qjsaumt+UA6g zbpBL;KWysZgW=)yM=gcjRD26*P|%1X_h#_T;DTa{!r)%g_{h#eHRi|v6wb+iim)C$ z1y)Q2g{5n%_ezYjo4uZvAb1V-za*(X; zZmExfO}Qn+fc|8;vA-bt3Og~nlg-h~ivGD&Xj6u0I|^C$;O%Co=$I3VEMzXueFrJTSMws@ zl-6S6lZ{m7D|pYac%;7ZjD~j7#|GIJ!2{r-nvN z+jEAiwVKTp%G0sE=J!ASI|++V0f#87uy<{EBmT{8ydtIR z37_PuL-^<4_r^5ngoeAY#BpwLt7ad=X$`fzH4IvmOX@zYg>-jzi!f09{M=ZI|bg%Lw@gd|*bp ZrHF)frXmKsgVPW1d$(C)kR00T{cpWvEFAy< literal 0 HcmV?d00001 diff --git a/demos/msx/Lagrange_Point.fur b/demos/msx/Lagrange_Point.fur deleted file mode 100644 index bff5248c3c6d3f54abc185a9b105a8a66dd33804..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2006 zcmV;{2Pyb?ob6p(iyTE1{`xZ0Grf~c2%Z;k@edN;l^_3TggSE4(mtGm}J`G@ixEwux%5`Lx134x8YG6}dhZ&bAR?eJXSwAxzET4U8{UUAo!*S5P5?ij1pas)_~#VRSpl}L691n89(kGAxCWd$2drNJF24%A_Zo2h zb>OSZz_)J#KfML~{x`q#^bjv z+fMUK&>oK8wrvOGds-aVZH-@Rk+xRb>vVlywh|>{3a;!Qd7J)sCwm+{{_F|*^)xo) z==z0==P#`d*DntCfQD&c{*F$|>63VEOc8Kh;vb$%N zys@Q?wX8a$Yf_h8;(DEnYG2CY8$Ee?2Ce1RH&y_Mfzy})rk6~@_WP`giXe&IuVoVB zwUkX_K3F2#5Xw|#l(h1a6`!<<=r>7AUtLa#>vb-weJP7?^yKN$B55UWlc{B)lGYuZ zTsCP@OX!T#d-I)Os?;TWt?os&FJMxu$2=ct-VV8)hYDWWxvV^uN!}L3cYpNKOzMG+*VeJk&Udq z91((l2UfdLMmBO?a!d%8BYH$?p+N>p%Eo?U|5SFygs=@E8X(WB{o0HxB1H7QzDFbr z{h$NC@bH6nCiCqrLAxzz?+MxszFPcVkn;_`EIvnw=#hy^z9EF>`12aD6%v9yGP&em zT80oA;tASaVY@3eP=lY1-;oRigP)Dh5yIgJF_|IeHK26IZ(2a+Yrad+o{A~Pree9VApCbfYL$Ho6su+;&0i`>>jsaUCA#9Eio*~2n;OiK$6%xYX z2$8L@Y0uFHKO4Vk&*@FZ=Lq3WWC&FXbq^@r@#iUEDsK1Yb?147jV)D8TIS>h-A z$d0Qn`>P75D(oK$+M8_uh!D|7%%@ReWFu=Y$ApOfnhxEOpbHaLih{W~B-LM~Je~>4 z+dsb0RfAK+pW_Qf)?d~SP4Pcnxau4~93j{v(;^e12);jK{N4z^K7THnEFc8in6rZ& z3B4vHd53jN++mYAP63=`CXne*cTJ=I$vdnH`y)Txz@6I6|S9uCTu$_pmhK>~7d8ffCLI~Y6gebF4 z;|Fh~_b#E{CddWeGPOfOlz-&lWls@~>?4pWy|S51lnKP+n(duEy0JAqFdIw=w#Pfo z9jXZfl6^Fi#dj;h*FBJbYxvrw03q0>yQ&GVOIDTPmK5RiO5)tW&PE5+0uX}j!LkWt zpQ&y_K&cAwx*ROBU*sR2K*`s!Y5m1Jx^in8QJ;<`{+|IMe2x&lA%r1BP!^UDYz4te z-NqW($hFBaA>vIHiX$C$%4tVBnqpf4Ld3uB zIBh_SOo$@*z9OPH0ZvaVKkF{19^LQ||M97`i`eT-eFtX`3X| zNC!s oUQ}<9w`xUps*Ai;(@`!!2%jT_YY1To5tKzD#1iGe|G07* Date: Thu, 5 Jan 2023 02:40:17 -0500 Subject: [PATCH 13/72] support more than 2 output channels up to 16 on JACK to-do: add more mixer settings --- src/engine/dispatchContainer.cpp | 2 ++ src/engine/engine.cpp | 23 ++++++++----- src/engine/engine.h | 4 +-- src/engine/platform/vic20.cpp | 1 - src/engine/playback.cpp | 42 +++++++++++++++-------- src/gui/about.cpp | 8 ++++- src/gui/gui.cpp | 3 +- src/gui/gui.h | 4 ++- src/gui/osc.cpp | 9 +++-- src/gui/settings.cpp | 58 ++++++++++++++++++++++++++++++-- src/gui/volMeter.cpp | 15 +++++---- 11 files changed, 127 insertions(+), 42 deletions(-) diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index 46320691..f72d665b 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -131,6 +131,7 @@ void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size) bool mustClear=false; for (int i=0; i16) want.outChans=16; + output->setCallback(process,this); if (!output->init(want,got)) { @@ -4164,6 +4167,13 @@ bool DivEngine::initAudioBackend() { return false; } + for (int i=0; iinitMidi(false)) { midiIns=output->midiIn->listDevices(); midiOuts=output->midiOut->listDevices(); @@ -4296,12 +4306,6 @@ bool DivEngine::init() { keyHit[i]=false; } - oscBuf[0]=new float[32768]; - oscBuf[1]=new float[32768]; - - memset(oscBuf[0],0,32768*sizeof(float)); - memset(oscBuf[1],0,32768*sizeof(float)); - initDispatch(); renderSamples(); reset(); @@ -4328,8 +4332,9 @@ bool DivEngine::quit() { logI("saving config."); saveConf(); active=false; - delete[] oscBuf[0]; - delete[] oscBuf[1]; + for (int i=0; idata[oscBuf[i]->needle++]=vic->ch[i].out?(vic->volume<<11):0; } diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 8696864c..54aef382 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -1579,10 +1579,11 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi if (!playing) { if (out!=NULL) { - // TODO: handle more than 2 outputs for (unsigned int i=0; i=32768) oscWritePos=0; } oscSize=size; @@ -1707,13 +1708,20 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi volR*=disCont[i].dispatch->getPostAmp(); if (disCont[i].dispatch->getOutputCount()>1) { for (size_t j=0; jgetOutputCount()); + for (int k=0; k=1) metroPos--; } - // TODO: handle more than 2 outputs for (unsigned int i=0; i=32768) oscWritePos=0; } oscSize=size; - // TODO: handle more than 2 outputs - if (forceMono) { + if (forceMono && outChans>1) { for (size_t i=0; igetAudioDescGot().outChans; j++) { + peakMix+=peak[j]; + } + peakMix/=e->getAudioDescGot().outChans; + } ImGui::ColorConvertHSVtoRGB(aboutHue,1.0,0.25+MIN(0.75f,peakMix*0.75f),r,g,b); dl->AddRectFilled(ImVec2(0,0),ImVec2(canvasW,canvasH),0xff000000); bool skip=false; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 59d23f2e..72195bb4 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -6095,8 +6095,7 @@ FurnaceGUI::FurnaceGUI(): memset(willExport,1,DIV_MAX_CHIPS*sizeof(bool)); - peak[0]=0; - peak[1]=0; + memset(peak,0,DIV_MAX_OUTPUTS*sizeof(float)); opMaskTransposeNote.note=true; opMaskTransposeNote.ins=false; diff --git a/src/gui/gui.h b/src/gui/gui.h index 88c30651..6ed7f2d3 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1172,6 +1172,7 @@ class FurnaceGUI { int mainFontSize, patFontSize, iconSize; int audioEngine; int audioQuality; + int audioChans; int arcadeCore; int ym2612Core; int snCore; @@ -1306,6 +1307,7 @@ class FurnaceGUI { iconSize(16), audioEngine(DIV_AUDIO_SDL), audioQuality(0), + audioChans(2), arcadeCore(0), ym2612Core(0), snCore(0), @@ -1458,7 +1460,7 @@ class FurnaceGUI { bool keepLoopAlive, orderScrollLocked, orderScrollTolerance, dragMobileMenu, dragMobileEditButton; FurnaceGUIWindows curWindow, nextWindow, curWindowLast; std::atomic curWindowThreadSafe; - float peak[2]; + float peak[DIV_MAX_OUTPUTS]; float patChanX[DIV_MAX_CHANS+1]; float patChanSlideY[DIV_MAX_CHANS+1]; float lastPatternWidth, longThreshold; diff --git a/src/gui/osc.cpp b/src/gui/osc.cpp index 7791e8e5..7f414221 100644 --- a/src/gui/osc.cpp +++ b/src/gui/osc.cpp @@ -49,14 +49,19 @@ void FurnaceGUI::readOsc() { int oscReadPos=(writePos-winSize)&0x7fff; for (int i=0; i<512; i++) { int pos=(oscReadPos+(i*winSize/512))&0x7fff; - oscValues[i]=(e->oscBuf[0][pos]+e->oscBuf[1][pos])*0.5f; + oscValues[i]=0; + for (int j=0; jgetAudioDescGot().outChans; j++) { + oscValues[i]+=e->oscBuf[j][pos]; + } + oscValues[i]/=e->getAudioDescGot().outChans; + if (oscValues[i]>0.001f || oscValues[i]<-0.001f) { WAKE_UP; } } float peakDecay=0.05f*60.0f*ImGui::GetIO().DeltaTime; - for (int i=0; i<2; i++) { + for (int i=0; igetAudioDescGot().outChans; i++) { peak[i]*=1.0-peakDecay; if (peak[i]<0.0001) { peak[i]=0.0; diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 2b670184..2b12c430 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -73,6 +73,22 @@ const char* audioBackends[]={ "SDL" }; +const bool isProAudio[]={ + true, + false +}; + +const char* nonProAudioOuts[]={ + "Mono", + "Stereo", + "What?", + "Quadraphonic", + "What?", + "5.1 Surround", + "What?", + "7.1 Surround" +}; + const char* audioQualities[]={ "High", "Low" @@ -192,6 +208,11 @@ const char* specificControls[18]={ settings.audioBufSize=x; \ } +#define CHANS_SELECTABLE(x) \ + if (ImGui::Selectable(nonProAudioOuts[x-1],settings.audioChans==x)) { \ + settings.audioChans=x; \ + } + #define UI_COLOR_CONFIG(what,label) \ if (ImGui::ColorEdit4(label "##CC_" #what,(float*)&uiColors[what])) { \ applyUISettings(false); \ @@ -676,9 +697,16 @@ void FurnaceGUI::drawSettings() { ImVec2 settingsViewSize=ImGui::GetContentRegionAvail(); settingsViewSize.y-=ImGui::GetFrameHeight()+ImGui::GetStyle().WindowPadding.y; if (ImGui::BeginChild("SettingsView",settingsViewSize)) { +#ifdef HAVE_JACK ImGui::Text("Backend"); ImGui::SameLine(); - ImGui::Combo("##Backend",&settings.audioEngine,audioBackends,2); + int prevAudioEngine=settings.audioEngine; + if (ImGui::Combo("##Backend",&settings.audioEngine,audioBackends,2)) { + if (settings.audioEngine!=prevAudioEngine) { + if (!isProAudio[settings.audioEngine]) settings.audioChans=2; + } + } +#endif ImGui::Text("Device"); ImGui::SameLine(); @@ -711,6 +739,27 @@ void FurnaceGUI::drawSettings() { ImGui::EndCombo(); } + if (isProAudio[settings.audioEngine]) { + ImGui::Text("Outputs"); + ImGui::SameLine(); + if (ImGui::InputInt("##AudioChansI",&settings.audioChans,1,1)) { + if (settings.audioChans<1) settings.audioChans=1; + if (settings.audioChans>16) settings.audioChans=16; + } + } else { + ImGui::Text("Channels"); + ImGui::SameLine(); + String chStr=(settings.audioChans<1 || settings.audioChans>8)?"What?":nonProAudioOuts[settings.audioChans-1]; + if (ImGui::BeginCombo("##AudioChans",chStr.c_str())) { + CHANS_SELECTABLE(1); + CHANS_SELECTABLE(2); + CHANS_SELECTABLE(4); + CHANS_SELECTABLE(6); + CHANS_SELECTABLE(8); + ImGui::EndCombo(); + } + } + ImGui::Text("Buffer size"); ImGui::SameLine(); String bs=fmt::sprintf("%d (latency: ~%.1fms)",settings.audioBufSize,2000.0*(double)settings.audioBufSize/(double)MAX(1,settings.audioRate)); @@ -757,8 +806,8 @@ void FurnaceGUI::drawSettings() { TAAudioDesc& audioWant=e->getAudioDescWant(); TAAudioDesc& audioGot=e->getAudioDescGot(); - ImGui::Text("want: %d samples @ %.0fHz",audioWant.bufsize,audioWant.rate); - ImGui::Text("got: %d samples @ %.0fHz",audioGot.bufsize,audioGot.rate); + ImGui::Text("want: %d samples @ %.0fHz (%d channels)",audioWant.bufsize,audioWant.rate,audioWant.outChans); + ImGui::Text("got: %d samples @ %.0fHz (%d channels)",audioGot.bufsize,audioGot.rate,audioWant.outChans); ImGui::Separator(); @@ -2343,6 +2392,7 @@ void FurnaceGUI::syncSettings() { settings.iconSize=e->getConfInt("iconSize",16); settings.audioEngine=(e->getConfString("audioEngine","SDL")=="SDL")?1:0; settings.audioDevice=e->getConfString("audioDevice",""); + settings.audioChans=e->getConfInt("audioChans",2); settings.midiInDevice=e->getConfString("midiInDevice",""); settings.midiOutDevice=e->getConfString("midiOutDevice",""); settings.c163Name=e->getConfString("c163Name",DIV_C163_DEFAULT_NAME); @@ -2476,6 +2526,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.audioQuality,0,1); clampSetting(settings.audioBufSize,32,4096); clampSetting(settings.audioRate,8000,384000); + clampSetting(settings.audioChans,1,16); clampSetting(settings.arcadeCore,0,1); clampSetting(settings.ym2612Core,0,1); clampSetting(settings.snCore,0,1); @@ -2643,6 +2694,7 @@ void FurnaceGUI::commitSettings() { e->setConf("audioQuality",settings.audioQuality); e->setConf("audioBufSize",settings.audioBufSize); e->setConf("audioRate",settings.audioRate); + e->setConf("audioChans",settings.audioChans); e->setConf("arcadeCore",settings.arcadeCore); e->setConf("ym2612Core",settings.ym2612Core); e->setConf("snCore",settings.snCore); diff --git a/src/gui/volMeter.cpp b/src/gui/volMeter.cpp index d058e31f..5233a69e 100644 --- a/src/gui/volMeter.cpp +++ b/src/gui/volMeter.cpp @@ -51,7 +51,8 @@ void FurnaceGUI::drawVolMeter() { ImU32 lowColor=ImGui::GetColorU32(uiColors[GUI_COLOR_VOLMETER_LOW]); if (ImGui::ItemAdd(rect,ImGui::GetID("volMeter"))) { ImGui::RenderFrame(rect.Min,rect.Max,ImGui::GetColorU32(ImGuiCol_FrameBg),true,style.FrameRounding); - for (int i=0; i<2; i++) { + int outChans=e->getAudioDescGot().outChans; + for (int i=0; iAddRectFilled(s.Min,s.Max,ImGui::GetColorU32(uiColors[GUI_COLOR_VOLMETER_PEAK])); } else { @@ -77,10 +78,10 @@ void FurnaceGUI::drawVolMeter() { } } else { s=ImRect( - ImLerp(rect.Min,rect.Max,ImVec2(float(i)*0.5,1.0-logPeak)), - ImLerp(rect.Min,rect.Max,ImVec2(float(i+1)*0.5,1.0)) + ImLerp(rect.Min,rect.Max,ImVec2(float(i)/outChans,1.0-logPeak)), + ImLerp(rect.Min,rect.Max,ImVec2(float(i+1)/outChans,1.0)) ); - if (i==0) s.Max.x-=dpiScale; + if (i==(outChans-1)) s.Max.x-=dpiScale; if (isClipping) { dl->AddRectFilled(s.Min,s.Max,ImGui::GetColorU32(uiColors[GUI_COLOR_VOLMETER_PEAK])); } else { From 707bbb54ead327a0f70aa86ef46d020f400d8b60 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 5 Jan 2023 03:08:57 -0500 Subject: [PATCH 14/72] add effects for rear panning --- src/engine/dispatch.h | 2 ++ src/engine/engine.cpp | 10 ++++++++++ src/engine/engine.h | 8 +++++--- src/engine/fileOps.cpp | 10 ++++++++++ src/engine/platform/opl.cpp | 32 +++++++++++++++++++++++++++++++- src/engine/platform/opl.h | 2 +- src/engine/playback.cpp | 20 ++++++++++++++++++++ src/gui/guiConst.cpp | 6 +++--- src/gui/sysConf.cpp | 6 ++++++ 9 files changed, 88 insertions(+), 8 deletions(-) diff --git a/src/engine/dispatch.h b/src/engine/dispatch.h index dc2b07b7..1970afed 100644 --- a/src/engine/dispatch.h +++ b/src/engine/dispatch.h @@ -213,6 +213,8 @@ enum DivDispatchCmds { DIV_CMD_MACRO_OFF, // (which) DIV_CMD_MACRO_ON, // (which) + DIV_CMD_SURROUND_PANNING, // (out, val) + DIV_ALWAYS_SET_VOLUME, // () -> alwaysSetVol DIV_CMD_MAX diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 73765d46..fb447e32 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -77,6 +77,15 @@ const char* DivEngine::getEffectDesc(unsigned char effect, int chan, bool notNul return "81xx: Set panning (left channel)"; case 0x82: return "82xx: Set panning (right channel)"; + case 0x88: + return "88xx: Set panning (rear channels; x: left; y: right)"; + break; + case 0x89: + return "89xx: Set panning (rear left channel)"; + break; + case 0x8a: + return "8Axx: Set panning (rear right channel)"; + break; case 0xc0: case 0xc1: case 0xc2: case 0xc3: return "Cxxx: Set tick rate (hz)"; case 0xe0: @@ -435,6 +444,7 @@ void writePackedCommandValues(SafeWriter* w, const DivCommand& c) { case DIV_CMD_FM_FINE: case DIV_CMD_AY_IO_WRITE: case DIV_CMD_AY_AUTO_PWM: + case DIV_CMD_SURROUND_PANNING: w->writeC(2); // length w->writeC(c.value); w->writeC(c.value2); diff --git a/src/engine/engine.h b/src/engine/engine.h index bcf47853..8bced933 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -47,8 +47,8 @@ #define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock(); #define BUSY_END isBusy.unlock(); softLocked=false; -#define DIV_VERSION "0.6pre3" -#define DIV_ENGINE_VERSION 133 +#define DIV_VERSION "dev134" +#define DIV_ENGINE_VERSION 134 // for imports #define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_FC 0xff02 @@ -97,7 +97,7 @@ struct DivChannelState { int delayOrder, delayRow, retrigSpeed, retrigTick; int vibratoDepth, vibratoRate, vibratoPos, vibratoPosGiant, vibratoDir, vibratoFine; int tremoloDepth, tremoloRate, tremoloPos; - unsigned char arp, arpStage, arpTicks, panL, panR; + unsigned char arp, arpStage, arpTicks, panL, panR, panRL, panRR; bool doNote, legato, portaStop, keyOn, keyOff, nowYouCanStop, stopOnOff; bool arpYield, delayLocked, inPorta, scheduledSlideReset, shorthandPorta, wasShorthandPorta, noteOnInhibit, resetArp; @@ -135,6 +135,8 @@ struct DivChannelState { arpTicks(1), panL(255), panR(255), + panRL(0), + panRR(0), doNote(false), legato(false), portaStop(false), diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index d5180c80..99e4e223 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -2543,6 +2543,16 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { } } + // OPL3 pan compat + if (ds.version<134) { + for (int i=0; i0)|((c.value2>0)<<1); @@ -999,6 +999,33 @@ int DivPlatformOPL::dispatch(DivCommand c) { } break; } + case DIV_CMD_SURROUND_PANNING: { + if (oplType!=3) break; + if (c.chan==adpcmChan) break; + + if (c.value==2) { + chan[c.chan].pan&=3; + if (c.value2>0) chan[c.chan].pan|=4; + } else if (c.value==3) { + if (c.value2>0) chan[c.chan].pan|=8; + } else { + break; + } + + int ops=(slots[3][c.chan]!=255 && chan[c.chan].state.ops==4 && oplType==3)?4:2; + if (isMuted[c.chan]) { + rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)); + if (ops==4) { + rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)); + } + } else { + rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4)); + if (ops==4) { + rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4)); + } + } + break; + } case DIV_CMD_PITCH: { if (c.chan==adpcmChan) { if (!chan[c.chan].furnacePCM) break; @@ -1705,6 +1732,8 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) { rate=chipClock/36; }*/ + compatPan=false; + switch (chipType) { default: case 1: case 2: case 8950: @@ -1753,6 +1782,7 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) { CHECK_CUSTOM_CLOCK; rate=chipClock/288; chipRateBase=rate; + compatPan=flags.getBool("compatPan",false); break; case 4: switch (flags.getInt("clockSel",0)) { diff --git a/src/engine/platform/opl.h b/src/engine/platform/opl.h index 90ff0bb7..5e6b5316 100644 --- a/src/engine/platform/opl.h +++ b/src/engine/platform/opl.h @@ -92,7 +92,7 @@ class DivPlatformOPL: public DivDispatch { unsigned char lfoValue; - bool useYMFM, update4OpMask, pretendYMU, downsample; + bool useYMFM, update4OpMask, pretendYMU, downsample, compatPan; short oldWrites[512]; short pendingWrites[512]; diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 54aef382..73ec8df5 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -213,6 +213,8 @@ const char* cmdName[]={ "MACRO_OFF", "MACRO_ON", + "SURROUND_PANNING", + "ALWAYS_SET_VOLUME" }; @@ -555,6 +557,7 @@ void DivEngine::processRow(int i, bool afterDelay) { short lastSlide=-1; bool calledPorta=false; bool panChanged=false; + bool surroundPanChanged=false; // effects for (int j=0; j>4)|(effectVal&0xf0); + chan[i].panRR=(effectVal&15)|((effectVal&15)<<4); + surroundPanChanged=true; + break; + case 0x89: // panning left (split 8-bit) + chan[i].panRL=effectVal; + surroundPanChanged=true; + break; + case 0x8a: // panning right (split 8-bit) + chan[i].panRR=effectVal; + surroundPanChanged=true; + break; case 0x01: // ramp up if (song.ignoreDuplicateSlides && (lastSlide==0x01 || lastSlide==0x1337)) break; lastSlide=0x01; @@ -866,6 +882,10 @@ void DivEngine::processRow(int i, bool afterDelay) { if (panChanged) { dispatchCmd(DivCommand(DIV_CMD_PANNING,i,chan[i].panL,chan[i].panR)); } + if (surroundPanChanged) { + dispatchCmd(DivCommand(DIV_CMD_SURROUND_PANNING,i,2,chan[i].panRL)); + dispatchCmd(DivCommand(DIV_CMD_SURROUND_PANNING,i,3,chan[i].panRR)); + } if (insChanged && (chan[i].inPorta || calledPorta) && song.newInsTriggersInPorta) { dispatchCmd(DivCommand(DIV_CMD_NOTE_ON,i,DIV_NOTE_NULL)); diff --git a/src/gui/guiConst.cpp b/src/gui/guiConst.cpp index 0c8a6d02..f9092179 100644 --- a/src/gui/guiConst.cpp +++ b/src/gui/guiConst.cpp @@ -319,9 +319,9 @@ const FurnaceGUIColors fxColors[256]={ GUI_COLOR_PATTERN_EFFECT_INVALID, GUI_COLOR_PATTERN_EFFECT_INVALID, GUI_COLOR_PATTERN_EFFECT_INVALID, - GUI_COLOR_PATTERN_EFFECT_INVALID, - GUI_COLOR_PATTERN_EFFECT_INVALID, - GUI_COLOR_PATTERN_EFFECT_INVALID, + GUI_COLOR_PATTERN_EFFECT_PANNING, + GUI_COLOR_PATTERN_EFFECT_PANNING, + GUI_COLOR_PATTERN_EFFECT_PANNING, GUI_COLOR_PATTERN_EFFECT_INVALID, GUI_COLOR_PATTERN_EFFECT_INVALID, GUI_COLOR_PATTERN_EFFECT_INVALID, diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index 8e41fa00..b33aff8a 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -1182,6 +1182,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo case DIV_SYSTEM_OPL3: case DIV_SYSTEM_OPL3_DRUMS: { int clockSel=flags.getInt("clockSel",0); + bool compatPan=flags.getBool("compatPan",false); ImGui::Text("Clock rate:"); if (ImGui::RadioButton("14.32MHz (NTSC)",clockSel==0)) { @@ -1205,9 +1206,14 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo altered=true; } + if (ImGui::Checkbox("Compatible panning (0800)",&compatPan)) { + altered=true; + } + if (altered) { e->lockSave([&]() { flags.set("clockSel",clockSel); + flags.set("compatPan",compatPan); }); } break; From 7f5cdd6f6b0f541b6b6232ff3d8e2573e4555fa8 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 5 Jan 2023 03:36:09 -0500 Subject: [PATCH 15/72] GUI: vol meter fix --- src/gui/volMeter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/volMeter.cpp b/src/gui/volMeter.cpp index 5233a69e..f050341d 100644 --- a/src/gui/volMeter.cpp +++ b/src/gui/volMeter.cpp @@ -81,7 +81,7 @@ void FurnaceGUI::drawVolMeter() { ImLerp(rect.Min,rect.Max,ImVec2(float(i)/outChans,1.0-logPeak)), ImLerp(rect.Min,rect.Max,ImVec2(float(i+1)/outChans,1.0)) ); - if (i==(outChans-1)) s.Max.x-=dpiScale; + if (i!=(outChans-1)) s.Max.x-=dpiScale; if (isClipping) { dl->AddRectFilled(s.Min,s.Max,ImGui::GetColorU32(uiColors[GUI_COLOR_VOLMETER_PEAK])); } else { From 6273275b4783ab9f6e073fdf40af2b650b71b233 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 6 Jan 2023 17:43:08 -0500 Subject: [PATCH 16/72] new floating-point volumes and patchbay --- papers/format.md | 32 + src/engine/engine.cpp | 54 +- src/engine/engine.h | 6 +- src/engine/fileOps.cpp | 46 +- src/engine/playback.cpp | 6 +- src/engine/song.h | 11 +- src/gui/gui.h | 4 +- src/gui/mixer.cpp | 29 +- src/gui/presets.cpp | 1552 +++++++++++++++++++-------------------- src/gui/settings.cpp | 98 ++- 10 files changed, 985 insertions(+), 853 deletions(-) diff --git a/papers/format.md b/papers/format.md index ab8cacd6..e4b01d2f 100644 --- a/papers/format.md +++ b/papers/format.md @@ -32,6 +32,8 @@ these fields are 0 in format versions prior to 100 (0.6pre1). the format versions are: +- 135: Furnace dev135 +- 134: Furnace dev134 - 133: Furnace 0.6pre3 - 132: Furnace 0.6pre2 - 131: Furnace dev131 @@ -386,8 +388,38 @@ size | description STR | song author (Japanese) STR | system name (Japanese) STR | album/category/game name (Japanese) + --- | **extra chip output settings (× chipCount)** (>=135) + 4f | chip volume + 4f | chip panning + 4f | chip front/rear balance + --- | **patchbay** (>=135) + 4 | patchbay connection count + 4?? | patchbay + | - see next section for more details. ``` +# patchbay + +Furnace dev135 adds a "patchbay" which allows for arbitrary connection of chip outputs to system outputs. +it eventually will allow connecting outputs to effects and so on. + +a connection is represented as an unsigned int in the following format: + +- bit 16-31: source port +- bit 0-15: destination port + +a port is in the following format (hexadecimal): `xxxy` + +- `xxx` (bit 4 to 15) represents an entity. +- `y` (bit 0 to 3) is the port of that entity. + +reserved input entities: +- `000`: system outputs +- `FFF`: "null" entity + +reserved output entities: +- `000` through `01F`: chip outputs + # subsong from version 95 onwards, Furnace supports storing multiple songs on a single file. diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index fb447e32..de04a189 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -1341,8 +1341,8 @@ String DivEngine::decodeSysDesc(String desc) { int val=0; int curStage=0; int sysID=0; - int sysVol=0; - int sysPan=0; + float sysVol=0; + float sysPan=0; int sysFlags=0; int curSys=0; desc+=' '; // ha @@ -1357,24 +1357,25 @@ String DivEngine::decodeSysDesc(String desc) { curStage++; break; case 1: - sysVol=val; + sysVol=(float)val/64.0f; curStage++; break; case 2: - sysPan=val; + sysPan=(float)val/127.0f; curStage++; break; case 3: sysFlags=val; if (sysID!=0) { - if (sysVol<-128) sysVol=-128; - if (sysVol>127) sysVol=127; - if (sysPan<-128) sysPan=-128; - if (sysPan>127) sysPan=127; + if (sysVol<-1.0f) sysVol=-1.0f; + if (sysVol>1.0f) sysVol=1.0f; + if (sysPan<-1.0f) sysPan=-1.0f; + if (sysPan>1.0f) sysPan=1.0f; newDesc.set(fmt::sprintf("id%d",curSys),sysID); newDesc.set(fmt::sprintf("vol%d",curSys),sysVol); newDesc.set(fmt::sprintf("pan%d",curSys),sysPan); + newDesc.set(fmt::sprintf("fr%d",curSys),0.0f); DivConfig newFlagsC; newFlagsC.clear(); convertOldFlags((unsigned int)sysFlags,newFlagsC,systemFromFileFur(sysID)); @@ -1404,7 +1405,7 @@ String DivEngine::decodeSysDesc(String desc) { return newDesc.toBase64(); } -void DivEngine::initSongWithDesc(const char* description, bool inBase64) { +void DivEngine::initSongWithDesc(const char* description, bool inBase64, bool oldVol) { int chanCount=0; DivConfig c; if (inBase64) { @@ -1423,9 +1424,16 @@ void DivEngine::initSongWithDesc(const char* description, bool inBase64) { song.system[index]=DIV_SYSTEM_NULL; break; } - song.systemVol[index]=c.getInt(fmt::sprintf("vol%d",index),DIV_SYSTEM_NULL); - song.systemPan[index]=c.getInt(fmt::sprintf("pan%d",index),DIV_SYSTEM_NULL); + song.systemVol[index]=c.getFloat(fmt::sprintf("vol%d",index),1.0f); + song.systemPan[index]=c.getFloat(fmt::sprintf("pan%d",index),0.0f); + song.systemPanFR[index]=c.getFloat(fmt::sprintf("fr%d",index),0.0f); song.systemFlags[index].clear(); + + if (oldVol) { + song.systemVol[index]/=64.0f; + song.systemPan[index]/=127.0f; + } + String flags=c.getString(fmt::sprintf("flags%d",index),""); song.systemFlags[index].loadFromBase64(flags.c_str()); } @@ -1675,8 +1683,9 @@ bool DivEngine::addSystem(DivSystem which) { BUSY_BEGIN; saveLock.lock(); song.system[song.systemLen]=which; - song.systemVol[song.systemLen]=64; + song.systemVol[song.systemLen]=1.0; song.systemPan[song.systemLen]=0; + song.systemPanFR[song.systemLen]=0; song.systemFlags[song.systemLen++].clear(); recalcChans(); saveLock.unlock(); @@ -1721,6 +1730,7 @@ bool DivEngine::removeSystem(int index, bool preserveOrder) { song.system[i]=song.system[i+1]; song.systemVol[i]=song.systemVol[i+1]; song.systemPan[i]=song.systemPan[i+1]; + song.systemPanFR[i]=song.systemPanFR[i+1]; song.systemFlags[i]=song.systemFlags[i+1]; } recalcChans(); @@ -1835,17 +1845,21 @@ bool DivEngine::swapSystem(int src, int dest, bool preserveOrder) { } DivSystem srcSystem=song.system[src]; + float srcVol=song.systemVol[src]; + float srcPan=song.systemPan[src]; + float srcPanFR=song.systemPanFR[src]; song.system[src]=song.system[dest]; song.system[dest]=srcSystem; - song.systemVol[src]^=song.systemVol[dest]; - song.systemVol[dest]^=song.systemVol[src]; - song.systemVol[src]^=song.systemVol[dest]; + song.systemVol[src]=song.systemVol[dest]; + song.systemVol[dest]=srcVol; - song.systemPan[src]^=song.systemPan[dest]; - song.systemPan[dest]^=song.systemPan[src]; - song.systemPan[src]^=song.systemPan[dest]; + song.systemPan[src]=song.systemPan[dest]; + song.systemPan[dest]=srcPan; + + song.systemPanFR[src]=song.systemPanFR[dest]; + song.systemPanFR[dest]=srcPanFR; // I am kinda scared to use std::swap DivConfig oldFlags=song.systemFlags[src]; @@ -4265,13 +4279,15 @@ bool DivEngine::init() { if (!hasLoadedSomething) { logD("setting default preset"); String preset=getConfString("initialSys2",""); + bool oldVol=getConfInt("configVersion",DIV_ENGINE_VERSION)<135; if (preset.empty()) { // try loading old preset preset=decodeSysDesc(getConfString("initialSys","")); + oldVol=false; } logD("preset size %ld",preset.size()); if (preset.size()>0 && (preset.size()&3)==0) { - initSongWithDesc(preset.c_str()); + initSongWithDesc(preset.c_str(),true,oldVol); } String sysName=getConfString("initialSysName",""); if (sysName=="") { diff --git a/src/engine/engine.h b/src/engine/engine.h index 8bced933..a06684d9 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -47,8 +47,8 @@ #define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock(); #define BUSY_END isBusy.unlock(); softLocked=false; -#define DIV_VERSION "dev134" -#define DIV_ENGINE_VERSION 134 +#define DIV_VERSION "dev135" +#define DIV_ENGINE_VERSION 135 // for imports #define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_FC 0xff02 @@ -476,7 +476,7 @@ class DivEngine { bool deinitAudioBackend(bool dueToSwitchMaster=false); void registerSystems(); - void initSongWithDesc(const char* description, bool inBase64=true); + void initSongWithDesc(const char* description, bool inBase64=true, bool oldVol=false); void exchangeIns(int one, int two); void swapChannels(int src, int dest); diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index 99e4e223..a2591f01 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -939,13 +939,13 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) { ds.systemLen=2; ds.system[0]=DIV_SYSTEM_YM2612; ds.system[1]=DIV_SYSTEM_SMS; - ds.systemVol[1]=32; + ds.systemVol[1]=0.5f; } if (ds.system[0]==DIV_SYSTEM_GENESIS_EXT) { ds.systemLen=2; ds.system[0]=DIV_SYSTEM_YM2612_EXT; ds.system[1]=DIV_SYSTEM_SMS; - ds.systemVol[1]=32; + ds.systemVol[1]=0.5f; } if (ds.system[0]==DIV_SYSTEM_ARCADE) { ds.systemLen=2; @@ -1830,14 +1830,18 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { // system volume for (int i=0; i>3)|(ds.systemVol[i]&128); + ds.systemVol[i+1]=ds.systemVol[i]*0.375f; } } if (ds.system[i]==DIV_SYSTEM_GENESIS_EXT) { ds.system[i]=DIV_SYSTEM_YM2612_EXT; if (i<31) { ds.system[i+1]=DIV_SYSTEM_SMS; - ds.systemVol[i+1]=(((ds.systemVol[i]&127)*3)>>3)|(ds.systemVol[i]&128); + ds.systemVol[i+1]=ds.systemVol[i]*0.375f; } } if (ds.system[i]==DIV_SYSTEM_ARCADE) { @@ -2200,6 +2204,21 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { ds.autoSystem=true; } + // system output config + if (ds.version>=135) { + for (int i=0; i=119) { logD("reading chip flags..."); @@ -4308,11 +4327,11 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) { } for (int i=0; iwriteC(song.systemVol[i]); + w->writeC(song.systemVol[i]*64.0f); } for (int i=0; iwriteC(song.systemPan[i]); + w->writeC(song.systemPan[i]*127.0f); } // chip flags (we'll seek here later) @@ -4456,6 +4475,17 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) { w->writeString(song.systemNameJ,false); w->writeString(song.categoryJ,false); + // system output config + for (int i=0; iwriteF(song.systemVol[i]); + w->writeF(song.systemPan[i]); + w->writeF(song.systemPanFR[i]); + } + w->writeI(song.patchbay.size()); + for (unsigned int i: song.patchbay) { + w->writeI(i); + } + blockEndSeek=w->tell(); w->seek(blockStartSeek,SEEK_SET); w->writeI(blockEndSeek-blockStartSeek-4); diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 73ec8df5..ad9a3470 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -1720,10 +1720,10 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi disCont[i].fillBuf(disCont[i].runtotal,disCont[i].lastAvail,size-disCont[i].lastAvail); } - // TODO: handle more than 2 outputs + // TODO: patchbay for (int i=0; igetPostAmp(); volR*=disCont[i].dispatch->getPostAmp(); if (disCont[i].dispatch->getOutputCount()>1) { diff --git a/src/engine/song.h b/src/engine/song.h index d7c28736..3fbe5e27 100644 --- a/src/engine/song.h +++ b/src/engine/song.h @@ -238,8 +238,9 @@ struct DivSong { // system DivSystem system[DIV_MAX_CHIPS]; unsigned char systemLen; - signed char systemVol[DIV_MAX_CHIPS]; - signed char systemPan[DIV_MAX_CHIPS]; + float systemVol[DIV_MAX_CHIPS]; + float systemPan[DIV_MAX_CHIPS]; + float systemPanFR[DIV_MAX_CHIPS]; DivConfig systemFlags[DIV_MAX_CHIPS]; // song information @@ -334,6 +335,7 @@ struct DivSong { std::vector sample; std::vector subsong; + std::vector patchbay; DivInstrument nullIns, nullInsOPLL, nullInsOPL, nullInsOPLDrums, nullInsQSound; DivWavetable nullWave; @@ -438,8 +440,9 @@ struct DivSong { oldArpStrategy(false) { for (int i=0; isong.systemLen; i++) { snprintf(id,31,"MixS%d",i); - bool doInvert=e->song.systemVol[i]&128; - signed char vol=e->song.systemVol[i]&127; + bool doInvert=e->song.systemVol[i]<0; + float vol=fabs(e->song.systemVol[i]); ImGui::PushID(id); ImGui::Text("%d. %s",i+1,getSystemName(e->song.system[i])); ImGui::SameLine(ImGui::GetWindowWidth()-(82.0f*dpiScale)); if (ImGui::Checkbox("Invert",&doInvert)) { - e->song.systemVol[i]^=128; + e->song.systemVol[i]=-e->song.systemVol[i]; MARK_MODIFIED; } - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-(50.0f*dpiScale)); - if (CWSliderScalar("Volume",ImGuiDataType_S8,&vol,&_ZERO,&_ONE_HUNDRED_TWENTY_SEVEN)) { - e->song.systemVol[i]=(e->song.systemVol[i]&128)|vol; + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (CWSliderFloat("Volume",&vol,0,2)) { + if (doInvert) { + if (vol<0.0001) vol=0.0001; + } + if (vol<0) vol=0; + if (vol>10) vol=10; + e->song.systemVol[i]=(doInvert)?-vol:vol; MARK_MODIFIED; } rightClickable - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-(50.0f*dpiScale)); - if (CWSliderScalar("Panning",ImGuiDataType_S8,&e->song.systemPan[i],&_MINUS_ONE_HUNDRED_TWENTY_SEVEN,&_ONE_HUNDRED_TWENTY_SEVEN)) { + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (CWSliderFloat("Panning",&e->song.systemPan[i],-1.0f,1.0f)) { + if (e->song.systemPan[i]<-1.0f) e->song.systemPan[i]=-1.0f; + if (e->song.systemPan[i]>1.0f) e->song.systemPan[i]=1.0f; + MARK_MODIFIED; + } rightClickable + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (CWSliderFloat("Front/Rear",&e->song.systemPanFR[i],-1.0f,1.0f)) { + if (e->song.systemPanFR[i]<-1.0f) e->song.systemPanFR[i]=-1.0f; + if (e->song.systemPanFR[i]>1.0f) e->song.systemPanFR[i]=1.0f; MARK_MODIFIED; } rightClickable diff --git a/src/gui/presets.cpp b/src/gui/presets.cpp index f0e4fe92..921fa88a 100644 --- a/src/gui/presets.cpp +++ b/src/gui/presets.cpp @@ -45,39 +45,39 @@ void FurnaceGUI::initSystemPresets() { CATEGORY_BEGIN("Game consoles","let's play some chiptune making games!"); ENTRY( "Sega Genesis", { - CH(DIV_SYSTEM_YM2612, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 32, 0, "") + CH(DIV_SYSTEM_YM2612, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 0.5f, 0, "") } ); ENTRY( "Sega Genesis (extended channel 3)", { - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 32, 0, "") + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 0.5f, 0, "") } ); ENTRY( "Sega Genesis (CSM)", { - CH(DIV_SYSTEM_YM2612_CSM, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 32, 0, "") + CH(DIV_SYSTEM_YM2612_CSM, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 0.5f, 0, "") } ); ENTRY( "Sega Genesis (DualPCM)", { - CH(DIV_SYSTEM_YM2612_DUALPCM, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 32, 0, "") + CH(DIV_SYSTEM_YM2612_DUALPCM, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 0.5f, 0, "") } ); ENTRY( "Sega Genesis (DualPCM, extended channel 3)", { - CH(DIV_SYSTEM_YM2612_DUALPCM_EXT, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 32, 0, "") + CH(DIV_SYSTEM_YM2612_DUALPCM_EXT, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 0.5f, 0, "") } ); ENTRY( "Sega Genesis (with Sega CD)", { - CH(DIV_SYSTEM_YM2612, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 32, 0, ""), - CH(DIV_SYSTEM_RF5C68, 64, 0, + CH(DIV_SYSTEM_YM2612, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 0.5f, 0, ""), + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=2\n" "chipType=1\n" ) @@ -85,9 +85,9 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Sega Genesis (extended channel 3 with Sega CD)", { - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 32, 0, ""), - CH(DIV_SYSTEM_RF5C68, 64, 0, + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 0.5f, 0, ""), + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=2\n" "chipType=1\n" ) @@ -95,9 +95,9 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Sega Genesis (CSM with Sega CD)", { - CH(DIV_SYSTEM_YM2612_CSM, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 32, 0, ""), - CH(DIV_SYSTEM_RF5C68, 64, 0, + CH(DIV_SYSTEM_YM2612_CSM, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 0.5f, 0, ""), + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=2\n" "chipType=1\n" ) @@ -105,39 +105,39 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Sega Master System", { - CH(DIV_SYSTEM_SMS, 64, 0, "") + CH(DIV_SYSTEM_SMS, 1.0f, 0, "") } ); ENTRY( "Sega Master System (with FM expansion)", { - CH(DIV_SYSTEM_SMS, 64, 0, ""), - CH(DIV_SYSTEM_OPLL, 64, 0, "") + CH(DIV_SYSTEM_SMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_OPLL, 1.0f, 0, "") } ); ENTRY( "Sega Master System (with FM expansion in drums mode)", { - CH(DIV_SYSTEM_SMS, 64, 0, ""), - CH(DIV_SYSTEM_OPLL_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_SMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_OPLL_DRUMS, 1.0f, 0, "") } ); ENTRY( "Sega Game Gear", { - CH(DIV_SYSTEM_SMS, 64, 0, "chipType=3") + CH(DIV_SYSTEM_SMS, 1.0f, 0, "chipType=3") } ); ENTRY( "Game Boy", { - CH(DIV_SYSTEM_GB, 64, 0, "") + CH(DIV_SYSTEM_GB, 1.0f, 0, "") } ); ENTRY( "Neo Geo Pocket", { - CH(DIV_SYSTEM_T6W28, 64, 0, ""), - CH(DIV_SYSTEM_PCM_DAC, 64, -127, + CH(DIV_SYSTEM_T6W28, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, -1.0f, "rate=11025\n" "outDepth=5\n" ), - CH(DIV_SYSTEM_PCM_DAC, 64, 127, + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 1.0f, "rate=11025\n" "outDepth=5\n" ) // don't know what the actual sample rate is @@ -145,106 +145,106 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "NEC PC Engine/TurboGrafx-16", { - CH(DIV_SYSTEM_PCE, 64, 0, "") + CH(DIV_SYSTEM_PCE, 1.0f, 0, "") } ); ENTRY( "NES", { - CH(DIV_SYSTEM_NES, 64, 0, "") + CH(DIV_SYSTEM_NES, 1.0f, 0, "") } ); ENTRY( "Famicom with Konami VRC6", { - CH(DIV_SYSTEM_NES, 64, 0, ""), - CH(DIV_SYSTEM_VRC6, 64, 0, "") + CH(DIV_SYSTEM_NES, 1.0f, 0, ""), + CH(DIV_SYSTEM_VRC6, 1.0f, 0, "") } ); ENTRY( "Famicom with Konami VRC7", { - CH(DIV_SYSTEM_NES, 64, 0, ""), - CH(DIV_SYSTEM_VRC7, 64, 0, "") + CH(DIV_SYSTEM_NES, 1.0f, 0, ""), + CH(DIV_SYSTEM_VRC7, 1.0f, 0, "") } ); ENTRY( "Famicom with MMC5", { - CH(DIV_SYSTEM_NES, 64, 0, ""), - CH(DIV_SYSTEM_MMC5, 64, 0, "") + CH(DIV_SYSTEM_NES, 1.0f, 0, ""), + CH(DIV_SYSTEM_MMC5, 1.0f, 0, "") } ); ENTRY( "Famicom with Sunsoft 5B", { - CH(DIV_SYSTEM_NES, 64, 0, ""), - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=2") + CH(DIV_SYSTEM_NES, 1.0f, 0, ""), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=2") } ); ENTRY( "Famicom with Namco 163", { - CH(DIV_SYSTEM_NES, 64, 0, ""), - CH(DIV_SYSTEM_N163, 64, 0, "channels=7") + CH(DIV_SYSTEM_NES, 1.0f, 0, ""), + CH(DIV_SYSTEM_N163, 1.0f, 0, "channels=7") } ); ENTRY( "Famicom Disk System", { - CH(DIV_SYSTEM_NES, 64, 0, ""), - CH(DIV_SYSTEM_FDS, 64, 0, "") + CH(DIV_SYSTEM_NES, 1.0f, 0, ""), + CH(DIV_SYSTEM_FDS, 1.0f, 0, "") } ); ENTRY( "SNES", { - CH(DIV_SYSTEM_SNES, 64, 0, "") + CH(DIV_SYSTEM_SNES, 1.0f, 0, "") } ); ENTRY( "Mattel Intellivision", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=3") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=3") } ); ENTRY( "Vectrex", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=4") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=4") } ); ENTRY( "Neo Geo AES", { - CH(DIV_SYSTEM_YM2610_FULL, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2610_FULL, 1.0f, 0, "clockSel=1") } ); ENTRY( "Neo Geo AES (extended channel 2)", { - CH(DIV_SYSTEM_YM2610_FULL_EXT, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2610_FULL_EXT, 1.0f, 0, "clockSel=1") } ); ENTRY( "Atari 2600/7800", { - CH(DIV_SYSTEM_TIA, 64, 0, "") + CH(DIV_SYSTEM_TIA, 1.0f, 0, "") } ); ENTRY( "Atari 7800 + Ballblazer/Commando", { - CH(DIV_SYSTEM_TIA, 64, 0, ""), - CH(DIV_SYSTEM_POKEY, 64, 0, "") + CH(DIV_SYSTEM_TIA, 1.0f, 0, ""), + CH(DIV_SYSTEM_POKEY, 1.0f, 0, "") } ); ENTRY( "Atari Lynx", { - CH(DIV_SYSTEM_LYNX, 64, 0, "") + CH(DIV_SYSTEM_LYNX, 1.0f, 0, "") } ); ENTRY( "WonderSwan", { - CH(DIV_SYSTEM_SWAN, 64, 0, "") + CH(DIV_SYSTEM_SWAN, 1.0f, 0, "") }, "tickRate=75.47169811320754716981" ); ENTRY( "Virtual Boy", { - CH(DIV_SYSTEM_VBOY, 64, 0, "") + CH(DIV_SYSTEM_VBOY, 1.0f, 0, "") }, "tickRate=50.2734877734878" ); ENTRY( "Gamate", { - CH(DIV_SYSTEM_AY8910, 64, 0, + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=9\n" "chipType=0\n" "stereo=true\n" @@ -253,7 +253,7 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Pokémon Mini", { - CH(DIV_SYSTEM_POKEMINI, 32, 0, "") + CH(DIV_SYSTEM_POKEMINI, 0.5f, 0, "") } ); CATEGORY_END; @@ -261,132 +261,132 @@ void FurnaceGUI::initSystemPresets() { CATEGORY_BEGIN("Computers","let's get to work on chiptune today."); ENTRY( "Commodore PET", { - CH(DIV_SYSTEM_PET, 64, 0, "") + CH(DIV_SYSTEM_PET, 1.0f, 0, "") }, "tickRate=50" ); ENTRY( "Commodore VIC-20", { - CH(DIV_SYSTEM_VIC20, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_VIC20, 1.0f, 0, "clockSel=1") } ); ENTRY( "Commodore 64 (6581 SID)", { - CH(DIV_SYSTEM_C64_6581, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_C64_6581, 1.0f, 0, "clockSel=1") }, "tickRate=50.1245421" ); ENTRY( "Commodore 64 (8580 SID)", { - CH(DIV_SYSTEM_C64_8580, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_C64_8580, 1.0f, 0, "clockSel=1") }, "tickRate=50.1245421" ); ENTRY( "Commodore 64 (6581 SID + Sound Expander)", { - CH(DIV_SYSTEM_C64_6581, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_OPL, 64, 0, "") + CH(DIV_SYSTEM_C64_6581, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_OPL, 1.0f, 0, "") }, "tickRate=50.1245421" ); ENTRY( "Commodore 64 (6581 SID + Sound Expander in drums mode)", { - CH(DIV_SYSTEM_C64_6581, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_C64_6581, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "") }, "tickRate=50.1245421" ); ENTRY( "Commodore 64 (8580 SID + Sound Expander)", { - CH(DIV_SYSTEM_C64_8580, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_OPL, 64, 0, "") + CH(DIV_SYSTEM_C64_8580, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_OPL, 1.0f, 0, "") }, "tickRate=50.1245421" ); ENTRY( "Commodore 64 (8580 SID + Sound Expander in drums mode)", { - CH(DIV_SYSTEM_C64_8580, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_C64_8580, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "") }, "tickRate=50.1245421" ); ENTRY( "Commodore 64 (6581 SID + FM-YAM)", { - CH(DIV_SYSTEM_C64_6581, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_OPL2, 64, 0, "") + CH(DIV_SYSTEM_C64_6581, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "") }, "tickRate=50.1245421" ); ENTRY( "Commodore 64 (6581 SID + FM-YAM in drums mode)", { - CH(DIV_SYSTEM_C64_6581, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_C64_6581, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "") }, "tickRate=50.1245421" ); ENTRY( "Commodore 64 (8580 SID + FM-YAM)", { - CH(DIV_SYSTEM_C64_8580, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_OPL2, 64, 0, "") + CH(DIV_SYSTEM_C64_8580, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "") }, "tickRate=50.1245421" ); ENTRY( "Commodore 64 (8580 SID + FM-YAM in drums mode)", { - CH(DIV_SYSTEM_C64_8580, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_C64_8580, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "") }, "tickRate=50.1245421" ); ENTRY( "Amiga", { - CH(DIV_SYSTEM_AMIGA, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_AMIGA, 1.0f, 0, "clockSel=1") }, "tickRate=50" ); ENTRY( "MSX", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=0\nchipType=1") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=0\nchipType=1") } ); ENTRY( "MSX + SFG-01", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_YM2151, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_YM2151, 1.0f, 0, "") } ); ENTRY( "MSX + MSX-AUDIO", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_Y8950, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_Y8950, 1.0f, 0, "") } ); ENTRY( "MSX + MSX-AUDIO (drums mode)", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_Y8950_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, 0, "") } ); ENTRY( "MSX + MSX-MUSIC", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_OPLL, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_OPLL, 1.0f, 0, "") } ); ENTRY( "MSX + MSX-MUSIC (drums mode)", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_OPLL_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_OPLL_DRUMS, 1.0f, 0, "") } ); ENTRY( "MSX + Darky", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_AY8930, 64, 0, + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_AY8930, 1.0f, 0, "clockSel=11\n" "halfClock=true\n" ), // 3.58MHz - CH(DIV_SYSTEM_AY8930, 64, 0, + CH(DIV_SYSTEM_AY8930, 1.0f, 0, "clockSel=11\n" "halfClock=true\n" ) // 3.58MHz or 3.6MHz selectable via register @@ -395,52 +395,52 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "MSX + Playsoniq", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_SMS, 64, 0, ""), // Sega VDP - CH(DIV_SYSTEM_C64_8580, 64, 0, ""), - CH(DIV_SYSTEM_SCC_PLUS, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_SMS, 1.0f, 0, ""), // Sega VDP + CH(DIV_SYSTEM_C64_8580, 1.0f, 0, ""), + CH(DIV_SYSTEM_SCC_PLUS, 1.0f, 0, "") } ); ENTRY( "MSX + SCC", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_SCC, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_SCC, 1.0f, 0, "") } ); ENTRY( "MSX + SCC+", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_SCC_PLUS, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_SCC_PLUS, 1.0f, 0, "") } ); ENTRY( "MSX + Neotron", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_YM2610_FULL, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_YM2610_FULL, 1.0f, 0, "") } ); ENTRY( "MSX + Neotron (extended channel 2)", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_YM2610_FULL_EXT, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_YM2610_FULL_EXT, 1.0f, 0, "") } ); ENTRY( "MSX + Neotron (with YM2610B)", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_YM2610B, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_YM2610B, 1.0f, 0, "") } ); ENTRY( "MSX + Neotron (with YM2610B; extended channel 3)", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_YM2610B_EXT, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_YM2610B_EXT, 1.0f, 0, "") } ); ENTRY( "MSX + SIMPL", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=55930\n" "outDepth=7\n" ) // variable rate, Mono DAC @@ -448,435 +448,435 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "NEC PC-88 (with PC-8801-10)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=15"), // external - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=15") // "" + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=15"), // external + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=15") // "" } ); ENTRY( "NEC PC-88 (with PC-8801-11)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4") // external } ); ENTRY( "NEC PC-88 (with PC-8801-11; extended channel 3)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4") // external } ); ENTRY( "NEC PC-88 (with PC-8801-23)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=1") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=1") // external } ); ENTRY( "NEC PC-88 (with PC-8801-23; extended channel 3)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=1") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=1") // external } ); ENTRY( "NEC PC-88 (with HMB-20 HIBIKI-8800)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2151, 64, 0, "clockSel=2") // external; 4.0000MHz + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2151, 1.0f, 0, "clockSel=2") // external; 4.0000MHz } ); ENTRY( "NEC PC-8801mk2SR (with PC-8801-10)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=15"), // external - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=15") // "" + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=15"), // external + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=15") // "" } ); ENTRY( "NEC PC-8801mk2SR (with PC-8801-10; extended channel 3)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=15"), // external - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=15") // "" + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=15"), // external + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=15") // "" } ); ENTRY( "NEC PC-8801mk2SR (with PC-8801-11)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4") // external } ); ENTRY( "NEC PC-8801mk2SR (with PC-8801-11; extended channel 3 on internal OPN)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4") // external } ); ENTRY( "NEC PC-8801mk2SR (with PC-8801-11; extended channel 3 on external OPN)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4") // external } ); ENTRY( "NEC PC-8801mk2SR (with PC-8801-11; extended channel 3 on both OPNs)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4") // external } ); ENTRY( "NEC PC-8801mk2SR (with PC-8801-23)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=1") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=1") // external } ); ENTRY( "NEC PC-8801mk2SR (with PC-8801-23; extended channel 3 on internal OPN)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=1") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=1") // external } ); ENTRY( "NEC PC-8801mk2SR (with PC-8801-23; extended channel 3 on external OPN)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=1") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=1") // external } ); ENTRY( "NEC PC-8801mk2SR (with PC-8801-23; extended channel 3 on both OPNs)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=1") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=1") // external } ); ENTRY( "NEC PC-8801mk2SR (with HMB-20 HIBIKI-8800)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_YM2151, 64, 0, "clockSel=2") // external; 4.0000MHz + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_YM2151, 1.0f, 0, "clockSel=2") // external; 4.0000MHz } ); ENTRY( "NEC PC-8801mk2SR (with HMB-20 HIBIKI-8800; extended channel 3)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_YM2151, 64, 0, "clockSel=2") // external; 4.0000MHz + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_YM2151, 1.0f, 0, "clockSel=2") // external; 4.0000MHz } ); ENTRY( "NEC PC-8801FA (with PC-8801-10)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=15"), // external - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=15") // "" + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=15"), // external + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=15") // "" } ); ENTRY( "NEC PC-8801FA (with PC-8801-10; extended channel 3)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=4"), // internal - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=15"), // external - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=15") // "" + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=4"), // internal + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=15"), // external + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=15") // "" } ); ENTRY( "NEC PC-8801FA (with PC-8801-11)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=1"), // internal - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=1"), // internal + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4") // external } ); ENTRY( "NEC PC-8801FA (with PC-8801-11; extended channel 3 on internal OPN)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=1"), // internal - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=1"), // internal + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4") // external } ); ENTRY( "NEC PC-8801FA (with PC-8801-11; extended channel 3 on external OPN)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=1"), // internal - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=1"), // internal + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4") // external } ); ENTRY( "NEC PC-8801FA (with PC-8801-11; extended channel 3 on both OPNs)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=1"), // internal - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=1"), // internal + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4") // external } ); ENTRY( "NEC PC-8801FA (with PC-8801-23)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=1"), // internal - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=1") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=1"), // internal + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=1") // external } ); ENTRY( "NEC PC-8801FA (with PC-8801-23; extended channel 3 on internal OPN)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=1"), // internal - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=1") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=1"), // internal + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=1") // external } ); ENTRY( "NEC PC-8801FA (with PC-8801-23; extended channel 3 on external OPN)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=1"), // internal - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=1") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=1"), // internal + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=1") // external } ); ENTRY( "NEC PC-8801FA (with PC-8801-23; extended channel 3 on both OPNs)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=1"), // internal - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=1") // external + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=1"), // internal + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=1") // external } ); ENTRY( "NEC PC-8801FA (with HMB-20 HIBIKI-8800)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=1"), // internal - CH(DIV_SYSTEM_YM2151, 64, 0, "clockSel=2") // external; 4.0000MHz + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=1"), // internal + CH(DIV_SYSTEM_YM2151, 1.0f, 0, "clockSel=2") // external; 4.0000MHz } ); ENTRY( "NEC PC-8801FA (with HMB-20 HIBIKI-8800; extended channel 3)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=1"), // internal - CH(DIV_SYSTEM_YM2151, 64, 0, "clockSel=2") // external; 4.0000MHz + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=1"), // internal + CH(DIV_SYSTEM_YM2151, 1.0f, 0, "clockSel=2") // external; 4.0000MHz } ); ENTRY( "NEC PC-98 (with PC-9801-26/K)", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4"), // 3.9936MHz but some compatible card has 4MHz - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4"), // 3.9936MHz but some compatible card has 4MHz + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with PC-9801-26/K; extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4"), // 3.9936MHz but some compatible card has 4MHz - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4"), // 3.9936MHz but some compatible card has 4MHz + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with Sound Orchestra)", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_OPL2, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with Sound Orchestra; extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_OPL2, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with Sound Orchestra in drums mode)", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with Sound Orchestra in drums mode; extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with Sound Orchestra V)", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_Y8950, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_Y8950, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with Sound Orchestra V; extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_Y8950, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_Y8950, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with Sound Orchestra V in drums mode)", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_Y8950_DRUMS, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with Sound Orchestra V in drums mode; extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_Y8950_DRUMS, 64, 0, "clockSel=4"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, 0, "clockSel=4"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with PC-9801-86)", { // -73 also has OPNA - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, // 2x 16-bit Burr Brown DAC + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, // 2x 16-bit Burr Brown DAC "rate=44100\n" "outDepth=15\n" ), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=44100\n" "outDepth=15\n" ), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with PC-9801-86; extended channel 3)", { // -73 also has OPNA - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=44100\n" "outDepth=15\n" ), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=44100\n" "outDepth=15\n" ), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with PC-9801-73)", { - CH(DIV_SYSTEM_YM2608, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with PC-9801-73; extended channel 3)", { - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with Sound Blaster 16 for PC-9800 w/PC-9801-26/K compatible)", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=44100\n" "outDepth=15\n" "stereo=true\n" ), - CH(DIV_SYSTEM_OPL3, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_OPL3, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with Sound Blaster 16 for PC-9800 w/PC-9801-26/K compatible; extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=44100\n" "outDepth=15\n" "stereo=true\n" ), - CH(DIV_SYSTEM_OPL3, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_OPL3, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with Sound Blaster 16 for PC-9800 w/PC-9801-26/K compatible in drums mode)", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=44100\n" "outDepth=15\n" "stereo=true\n" ), - CH(DIV_SYSTEM_OPL3_DRUMS, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_OPL3_DRUMS, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "NEC PC-98 (with Sound Blaster 16 for PC-9800 w/PC-9801-26/K compatible in drums mode; extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=44100\n" "outDepth=15\n" "stereo=true\n" ), - CH(DIV_SYSTEM_OPL3_DRUMS, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_OPL3_DRUMS, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "clockSel=1") } ); ENTRY( "ZX Spectrum (48K)", { - CH(DIV_SYSTEM_SFX_BEEPER, 64, 0, "") + CH(DIV_SYSTEM_SFX_BEEPER, 1.0f, 0, "") } ); ENTRY( "ZX Spectrum (128K)", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=1") //beeper was also included + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=1") //beeper was also included } ); ENTRY( "ZX Spectrum (128K) with TurboSound FM", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=1") } ); ENTRY( "ZX Spectrum (128K) with TurboSound FM (extended channel 3 on first OPN)", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=1") } ); ENTRY( "ZX Spectrum (128K) with TurboSound FM (extended channel 3 on second OPN)", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=1") } ); ENTRY( "ZX Spectrum (128K) with TurboSound FM (extended channel 3 on both OPNs)", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=1") } ); ENTRY( "ZX Spectrum (128K) with TurboSound", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=1"), // or YM2149 - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=1") // or YM2149 + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=1"), // or YM2149 + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=1") // or YM2149 } ); ENTRY( "Amstrad CPC", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=5") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=5") } ); ENTRY( "Atari 800", { - CH(DIV_SYSTEM_POKEY, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_POKEY, 1.0f, 0, "clockSel=1") }, "tickRate=50" ); ENTRY( "Atari 800 (stereo)", { - CH(DIV_SYSTEM_POKEY, 64, -127, "clockSel=1"), - CH(DIV_SYSTEM_POKEY, 64, 127, "clockSel=1"), + CH(DIV_SYSTEM_POKEY, 1.0f, -1.0f, "clockSel=1"), + CH(DIV_SYSTEM_POKEY, 1.0f, 1.0f, "clockSel=1"), }, "tickRate=50" ); ENTRY( "Atari ST", { - CH(DIV_SYSTEM_AY8910, 64, 0, + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3\n" "chipType=1\n" ) @@ -884,15 +884,15 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Atari STE", { - CH(DIV_SYSTEM_AY8910, 64, 0, + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3\n" "chipType=1\n" ), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=50668\n" "outDepth=7\n" ), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=50668\n" "outDepth=7\n" ) @@ -900,12 +900,12 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "SAM Coupé", { - CH(DIV_SYSTEM_SAA1099, 64, 0, "") + CH(DIV_SYSTEM_SAA1099, 1.0f, 0, "") } ); ENTRY( "BBC Micro", { - CH(DIV_SYSTEM_SMS, 64, 0, + CH(DIV_SYSTEM_SMS, 1.0f, 0, "clockSel=2\n" "chipType=4\n" // SN76489A 4MHz ) @@ -913,57 +913,57 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "PC (barebones)", { - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "IBM PCjr", { // it can be enable sound output at once - CH(DIV_SYSTEM_SMS, 64, 0, "chipType=5") // SN76496 + CH(DIV_SYSTEM_SMS, 1.0f, 0, "chipType=5") // SN76496 } ); ENTRY( "Tandy 1000", { - CH(DIV_SYSTEM_SMS, 64, 0, "chipType=5"), // NCR 8496 or SN76496 or Tandy PSSJ(with 8 bit DAC) - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_SMS, 1.0f, 0, "chipType=5"), // NCR 8496 or SN76496 or Tandy PSSJ(with 8 bit DAC) + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + Covox Sound Master", { - CH(DIV_SYSTEM_AY8930, 64, 0, "clockSel=3"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_AY8930, 1.0f, 0, "clockSel=3"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + SSI 2001", { - CH(DIV_SYSTEM_C64_6581, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_C64_6581, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + Game Blaster", { - CH(DIV_SYSTEM_SAA1099, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_SAA1099, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_SAA1099, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_SAA1099, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + AdLib", { - CH(DIV_SYSTEM_OPL2, 64, 0, ""), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_OPL2, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + AdLib (drums mode)", { - CH(DIV_SYSTEM_OPL2, 64, 0, ""), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_OPL2, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + Sound Blaster", { - CH(DIV_SYSTEM_OPL2, 64, 0, ""), - CH(DIV_SYSTEM_PCSPKR, 64, 0, ""), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_OPL2, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=22050\n" "outDepth=7\n" ) @@ -971,9 +971,9 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "PC + AdLib/Sound Blaster (drums mode)", { - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, ""), - CH(DIV_SYSTEM_PCSPKR, 64, 0, ""), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=22050\n" "outDepth=7\n" ) @@ -981,132 +981,132 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "PC + Sound Blaster w/Game Blaster Compatible", { - CH(DIV_SYSTEM_OPL2, 64, 0, ""), - CH(DIV_SYSTEM_SAA1099, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_SAA1099, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_OPL2, 1.0f, 0, ""), + CH(DIV_SYSTEM_SAA1099, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_SAA1099, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=22050\n" "outDepth=7\n" ), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + Sound Blaster w/Game Blaster Compatible (drums mode)", { - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, ""), - CH(DIV_SYSTEM_SAA1099, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_SAA1099, 64, 0, "clockSel=1"), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_SAA1099, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_SAA1099, 1.0f, 0, "clockSel=1"), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=22050\n" "outDepth=7\n" ), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + Sound Blaster Pro", { - CH(DIV_SYSTEM_OPL2, 64, -127, ""), - CH(DIV_SYSTEM_OPL2, 64, 127, ""), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_OPL2, 1.0f, -1.0f, ""), + CH(DIV_SYSTEM_OPL2, 1.0f, 1.0f, ""), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=22050\n" "outDepth=7\n" "stereo=true\n" ), //alternatively 44.1 khz mono - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + Sound Blaster Pro (drums mode)", { - CH(DIV_SYSTEM_OPL2_DRUMS, 64, -127, ""), - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 127, ""), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, -1.0f, ""), + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 1.0f, ""), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=22050\n" "outDepth=7\n" "stereo=true\n" ), //alternatively 44.1 khz mono - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + Sound Blaster Pro 2", { - CH(DIV_SYSTEM_OPL3, 64, 0, ""), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_OPL3, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=44100\n" "outDepth=15\n" "stereo=true\n" ), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + Sound Blaster Pro 2 (drums mode)", { - CH(DIV_SYSTEM_OPL3_DRUMS, 64, 0, ""), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_OPL3_DRUMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=44100\n" "outDepth=15\n" "stereo=true\n" ), - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + PC-FXGA", { - CH(DIV_SYSTEM_PCE, 64, 0, ""), // HuC6230 (WSG from HuC6280 but with built in 2 OKI ADPCM playback engines) - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_PCE, 1.0f, 0, ""), // HuC6230 (WSG from HuC6280 but with built in 2 OKI ADPCM playback engines) + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "PC + SAAYM", { - CH(DIV_SYSTEM_YM2151, 64, 0, ""), // 3.58MHz or 4MHz selectable via jumper - CH(DIV_SYSTEM_SAA1099, 64, 0, "clockSel=1"), // 7.16MHz or 8MHz selectable via jumper - CH(DIV_SYSTEM_SAA1099, 64, 0, "clockSel=1"), // "" - CH(DIV_SYSTEM_PCSPKR, 64, 0, "") + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), // 3.58MHz or 4MHz selectable via jumper + CH(DIV_SYSTEM_SAA1099, 1.0f, 0, "clockSel=1"), // 7.16MHz or 8MHz selectable via jumper + CH(DIV_SYSTEM_SAA1099, 1.0f, 0, "clockSel=1"), // "" + CH(DIV_SYSTEM_PCSPKR, 1.0f, 0, "") } ); ENTRY( "Sharp X1", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=3") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3") } ); ENTRY( "Sharp X1 + FM Addon", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=3"), - CH(DIV_SYSTEM_YM2151, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3"), + CH(DIV_SYSTEM_YM2151, 1.0f, 0, "clockSel=2") } ); ENTRY( "Sharp X68000", { - CH(DIV_SYSTEM_YM2151, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_MSM6258, 64, 0, "") + CH(DIV_SYSTEM_YM2151, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_MSM6258, 1.0f, 0, "") } ); ENTRY( "FM Towns", { - CH(DIV_SYSTEM_YM2612, 64, 0, "clockSel=2"), // YM3438 - CH(DIV_SYSTEM_RF5C68, 64, 0, "") + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=2"), // YM3438 + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "") } ); ENTRY( "FM Towns (extended channel 3)", { - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "clockSel=2"), // YM3438 - CH(DIV_SYSTEM_RF5C68, 64, 0, "") + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=2"), // YM3438 + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "") } ); ENTRY( "FM Towns (CSM)", { - CH(DIV_SYSTEM_YM2612_CSM, 64, 0, "clockSel=2"), // YM3438 - CH(DIV_SYSTEM_RF5C68, 64, 0, "") + CH(DIV_SYSTEM_YM2612_CSM, 1.0f, 0, "clockSel=2"), // YM3438 + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "") } ); ENTRY( "Commander X16", { - CH(DIV_SYSTEM_VERA, 64, 0, ""), - CH(DIV_SYSTEM_YM2151, 32, 0, "") + CH(DIV_SYSTEM_VERA, 1.0f, 0, ""), + CH(DIV_SYSTEM_YM2151, 0.5f, 0, "") } ); ENTRY( "TI-99/4A", { - CH(DIV_SYSTEM_SMS, 64, 0, + CH(DIV_SYSTEM_SMS, 1.0f, 0, "clockSel=6\n" "chipType=8\n" // SN94624 447KHz ) @@ -1117,143 +1117,143 @@ void FurnaceGUI::initSystemPresets() { CATEGORY_BEGIN("Arcade systems","INSERT COIN"); ENTRY( "Pong", { - CH(DIV_SYSTEM_PONG, 64, 0, "") + CH(DIV_SYSTEM_PONG, 1.0f, 0, "") } ); ENTRY( "Bally Midway MCR", { // SSIO sound board - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=3"), // 2MHz - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=3") // 2MHz + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3"), // 2MHz + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3") // 2MHz // additional sound boards, mostly software controlled DAC } ); ENTRY( "Williams/Midway Y/T unit w/ADPCM sound board", { // ADPCM sound board - CH(DIV_SYSTEM_YM2151, 64, 0, ""), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=15625\n" "outDepth=7\n" ), // variable via OPM timer? - CH(DIV_SYSTEM_MSM6295, 64, 0, "") + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") } ); ENTRY( "Konami Gyruss", { - CH(DIV_SYSTEM_AY8910, 64, 0, ""), - CH(DIV_SYSTEM_AY8910, 64, 0, ""), - CH(DIV_SYSTEM_AY8910, 64, 0, ""), - CH(DIV_SYSTEM_AY8910, 64, 0, ""), - CH(DIV_SYSTEM_AY8910, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, ""), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, ""), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, ""), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, ""), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "") // additional discrete sound logics } ); ENTRY( "Konami Bubble System", { - CH(DIV_SYSTEM_AY8910, 64, 0, ""), - CH(DIV_SYSTEM_AY8910, 64, 0, ""), - CH(DIV_SYSTEM_BUBSYS_WSG, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, ""), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, ""), + CH(DIV_SYSTEM_BUBSYS_WSG, 1.0f, 0, "") // VLM5030 exists but not used for music at all } ); ENTRY( "Konami MX5000", { - CH(DIV_SYSTEM_YM2151, 64, 0, ""), // 3.58MHz - CH(DIV_SYSTEM_K007232, 64, 0, "") // "" + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), // 3.58MHz + CH(DIV_SYSTEM_K007232, 1.0f, 0, "") // "" } ); ENTRY( "Konami Battlantis", { - CH(DIV_SYSTEM_OPL2, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_OPL2, 64, 0, "clockSel=3") // "" + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "clockSel=3") // "" } ); ENTRY( "Konami Battlantis (drums mode on first OPL2)", { - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_OPL2, 64, 0, "clockSel=3") // "" + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "clockSel=3") // "" } ); ENTRY( "Konami Battlantis (drums mode on second OPL2)", { - CH(DIV_SYSTEM_OPL2, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "clockSel=3") // "" + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "clockSel=3") // "" } ); ENTRY( "Konami Battlantis (drums mode on both OPL2s)", { - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "clockSel=3") // "" + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "clockSel=3") // "" } ); ENTRY( "Konami Fast Lane", { - CH(DIV_SYSTEM_K007232, 64, 0, ""), // 3.58MHz - CH(DIV_SYSTEM_K007232, 64, 0, "") // "" + CH(DIV_SYSTEM_K007232, 1.0f, 0, ""), // 3.58MHz + CH(DIV_SYSTEM_K007232, 1.0f, 0, "") // "" } ); ENTRY( "Konami Chequered Flag", { - CH(DIV_SYSTEM_YM2151, 64, 0, ""), // 3.58MHz - CH(DIV_SYSTEM_K007232, 64, 0, "stereo=true"), // "" - CH(DIV_SYSTEM_K007232, 64, 0, "") // "" + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), // 3.58MHz + CH(DIV_SYSTEM_K007232, 1.0f, 0, "stereo=true"), // "" + CH(DIV_SYSTEM_K007232, 1.0f, 0, "") // "" } ); ENTRY( "Konami Haunted Castle", { - CH(DIV_SYSTEM_OPL2, 64, 0, ""), // 3.58MHz - CH(DIV_SYSTEM_SCC, 64, 0, ""), // "" - CH(DIV_SYSTEM_K007232, 64, 0, "") // "" + CH(DIV_SYSTEM_OPL2, 1.0f, 0, ""), // 3.58MHz + CH(DIV_SYSTEM_SCC, 1.0f, 0, ""), // "" + CH(DIV_SYSTEM_K007232, 1.0f, 0, "") // "" } ); ENTRY( "Konami Haunted Castle (drums mode)", { - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, ""), // 3.58MHz - CH(DIV_SYSTEM_SCC, 64, 0, ""), // "" - CH(DIV_SYSTEM_K007232, 64, 0, "") // "" + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, ""), // 3.58MHz + CH(DIV_SYSTEM_SCC, 1.0f, 0, ""), // "" + CH(DIV_SYSTEM_K007232, 1.0f, 0, "") // "" } ); ENTRY( "Konami Hot Chase", { - CH(DIV_SYSTEM_K007232, 64, 0, "stereo=true"), // 3.58MHz - CH(DIV_SYSTEM_K007232, 64, 0, "stereo=true"), // "" - CH(DIV_SYSTEM_K007232, 64, 0, "stereo=true") // "" + CH(DIV_SYSTEM_K007232, 1.0f, 0, "stereo=true"), // 3.58MHz + CH(DIV_SYSTEM_K007232, 1.0f, 0, "stereo=true"), // "" + CH(DIV_SYSTEM_K007232, 1.0f, 0, "stereo=true") // "" } ); ENTRY( "Konami S.P.Y.", { - CH(DIV_SYSTEM_OPL2, 64, 0, ""), // 3.58MHz - CH(DIV_SYSTEM_K007232, 64, 0, ""), // "" - CH(DIV_SYSTEM_K007232, 64, 0, "") // "" + CH(DIV_SYSTEM_OPL2, 1.0f, 0, ""), // 3.58MHz + CH(DIV_SYSTEM_K007232, 1.0f, 0, ""), // "" + CH(DIV_SYSTEM_K007232, 1.0f, 0, "") // "" } ); ENTRY( "Konami S.P.Y. (drums mode)", { - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, ""), // 3.58MHz - CH(DIV_SYSTEM_K007232, 64, 0, ""), // "" - CH(DIV_SYSTEM_K007232, 64, 0, "") // "" + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, ""), // 3.58MHz + CH(DIV_SYSTEM_K007232, 1.0f, 0, ""), // "" + CH(DIV_SYSTEM_K007232, 1.0f, 0, "") // "" } ); ENTRY( "Konami Hexion", { - CH(DIV_SYSTEM_SCC, 64, 0, "clockSel=2"), // 1.5MHz (3MHz input) - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_SCC, 1.0f, 0, "clockSel=2"), // 1.5MHz (3MHz input) + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=1") } ); ENTRY( "Sega Kyugo", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=14"), - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=14") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=14"), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=14") } ); ENTRY( "Sega System 1", { - CH(DIV_SYSTEM_SMS, 64, 0, + CH(DIV_SYSTEM_SMS, 1.0f, 0, "clockSel=2\n" "chipType=4\n" ), // SN76489A 4MHz - CH(DIV_SYSTEM_SMS, 64, 0, + CH(DIV_SYSTEM_SMS, 1.0f, 0, "clockSel=5\n" "chipType=4\n" ) // SN76489A 2MHz @@ -1261,46 +1261,46 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Sega System E", { - CH(DIV_SYSTEM_SMS, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 64, 0, "") + CH(DIV_SYSTEM_SMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 1.0f, 0, "") } ); ENTRY( "Sega System E (with FM expansion)", { - CH(DIV_SYSTEM_SMS, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 64, 0, ""), - CH(DIV_SYSTEM_OPLL, 64, 0, "") + CH(DIV_SYSTEM_SMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_OPLL, 1.0f, 0, "") } ); ENTRY( "Sega System E (with FM expansion in drums mode)", { - CH(DIV_SYSTEM_SMS, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 64, 0, ""), - CH(DIV_SYSTEM_OPLL_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_SMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_OPLL_DRUMS, 1.0f, 0, "") } ); ENTRY( "Sega Hang-On", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_SEGAPCM, 64, 0, "") // discrete logics, 62.5KHz output rate + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_SEGAPCM, 1.0f, 0, "") // discrete logics, 62.5KHz output rate } ); ENTRY( "Sega Hang-On (extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_SEGAPCM, 64, 0, "") // discrete logics, 62.5KHz output rate + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_SEGAPCM, 1.0f, 0, "") // discrete logics, 62.5KHz output rate } ); ENTRY( "Sega OutRun/X Board", { - CH(DIV_SYSTEM_YM2151, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_SEGAPCM, 64, 0, "") // ASIC, 31.25KHz output rate + CH(DIV_SYSTEM_YM2151, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_SEGAPCM, 1.0f, 0, "") // ASIC, 31.25KHz output rate } ); ENTRY( "Sega System 24", { - CH(DIV_SYSTEM_YM2151, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2151, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=61500\n" "outDepth=7\n" ) // software controlled, variable rate via configurable timers @@ -1308,68 +1308,68 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Sega System 18", { - CH(DIV_SYSTEM_YM2612, 64, 0, "clockSel=2"), // discrete 8MHz YM3438 - CH(DIV_SYSTEM_YM2612, 64, 0, "clockSel=2"), // ^^ - CH(DIV_SYSTEM_RF5C68, 64, 0, "clockSel=1") // 10MHz + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=2"), // discrete 8MHz YM3438 + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=2"), // ^^ + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=1") // 10MHz } ); ENTRY( "Sega System 18 (extended channel 3 on first OPN2C)", { - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "clockSel=2"), // discrete 8MHz YM3438 - CH(DIV_SYSTEM_YM2612, 64, 0, "clockSel=2"), // ^^ - CH(DIV_SYSTEM_RF5C68, 64, 0, "clockSel=1") // 10MHz + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=2"), // discrete 8MHz YM3438 + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=2"), // ^^ + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=1") // 10MHz } ); ENTRY( "Sega System 18 (extended channel 3 on second OPN2C)", { - CH(DIV_SYSTEM_YM2612, 64, 0, "clockSel=2"), // discrete 8MHz YM3438 - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "clockSel=2"), // ^^ - CH(DIV_SYSTEM_RF5C68, 64, 0, "clockSel=1") // 10MHz + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=2"), // discrete 8MHz YM3438 + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=2"), // ^^ + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=1") // 10MHz } ); ENTRY( "Sega System 18 (extended channel 3 on both OPN2Cs)", { - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "clockSel=2"), // discrete 8MHz YM3438 - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "clockSel=2"), // ^^ - CH(DIV_SYSTEM_RF5C68, 64, 0, "clockSel=1") // 10MHz + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=2"), // discrete 8MHz YM3438 + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=2"), // ^^ + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=1") // 10MHz } ); ENTRY( "Sega System 32", { - CH(DIV_SYSTEM_YM2612, 64, 0, "clockSel=4"), // discrete 8.05MHz YM3438 - CH(DIV_SYSTEM_YM2612, 64, 0, "clockSel=4"), // ^^ - CH(DIV_SYSTEM_RF5C68, 64, 0, "clockSel=2") // 12.5MHz + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=4"), // discrete 8.05MHz YM3438 + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=4"), // ^^ + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=2") // 12.5MHz } ); ENTRY( "Sega System 32 (extended channel 3 on first OPN2C)", { - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "clockSel=4"), // discrete 8.05MHz YM3438 - CH(DIV_SYSTEM_YM2612, 64, 0, "clockSel=4"), // ^^ - CH(DIV_SYSTEM_RF5C68, 64, 0, "clockSel=2") // 12.5MHz + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=4"), // discrete 8.05MHz YM3438 + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=4"), // ^^ + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=2") // 12.5MHz } ); ENTRY( "Sega System 32 (extended channel 3 on second OPN2C)", { - CH(DIV_SYSTEM_YM2612, 64, 0, "clockSel=4"), // discrete 8.05MHz YM3438 - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "clockSel=4"), // ^^ - CH(DIV_SYSTEM_RF5C68, 64, 0, "clockSel=2") // 12.5MHz + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=4"), // discrete 8.05MHz YM3438 + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=4"), // ^^ + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=2") // 12.5MHz } ); ENTRY( "Sega System 32 (extended channel 3 on both OPN2Cs)", { - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "clockSel=4"), // discrete 8.05MHz YM3438 - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "clockSel=4"), // ^^ - CH(DIV_SYSTEM_RF5C68, 64, 0, "clockSel=2") // 12.5MHz + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=4"), // discrete 8.05MHz YM3438 + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=4"), // ^^ + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "clockSel=2") // 12.5MHz } ); ENTRY( "Capcom Exed Eyes", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=4"), // 1.5MHz - CH(DIV_SYSTEM_SMS, 64, 0, + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=4"), // 1.5MHz + CH(DIV_SYSTEM_SMS, 1.0f, 0, "clockSel=4\n" "chipType=1\n" ), // SN76489 3MHz - CH(DIV_SYSTEM_SMS, 64, 0, + CH(DIV_SYSTEM_SMS, 1.0f, 0, "clockSel=4\n" "chipType=1\n" ) // SN76489 3MHz @@ -1377,66 +1377,66 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Capcom Arcade", { // 1943, Side arms, etc - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=5"), // 4 or 1.5MHz; various per games - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=5") + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=5"), // 4 or 1.5MHz; various per games + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=5") } ); ENTRY( "Capcom Arcade (extended channel 3 on first OPN)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=5"), - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=5") + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=5"), + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=5") } ); ENTRY( "Capcom Arcade (extended channel 3 on second OPN)", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=5"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=5") + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=5"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=5") } ); ENTRY( "Capcom Arcade (extended channel 3 on both OPNs)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=5"), - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=5") + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=5"), + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=5") } ); ENTRY( "Capcom CPS-1", { - CH(DIV_SYSTEM_YM2151, 64, 0, ""), // 3.58MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "") + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), // 3.58MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") } ); ENTRY( "Capcom CPS-2 (QSound)", { - CH(DIV_SYSTEM_QSOUND, 64, 0, "") + CH(DIV_SYSTEM_QSOUND, 1.0f, 0, "") } ); ENTRY( "Jaleco Ginga NinkyouDen", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), // 1.79MHz - CH(DIV_SYSTEM_Y8950, 64, 0, "") // 3.58MHz + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), // 1.79MHz + CH(DIV_SYSTEM_Y8950, 1.0f, 0, "") // 3.58MHz } ); ENTRY( "Jaleco Ginga NinkyouDen (drums mode)", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1"), // 1.79MHz - CH(DIV_SYSTEM_Y8950_DRUMS, 64, 0, "") // 3.58MHz + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1"), // 1.79MHz + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, 0, "") // 3.58MHz } ); ENTRY( "Jaleco Mega System 1", { - CH(DIV_SYSTEM_YM2151, 64, 0, "clockSel=1"), // 3.5MHz (7MHz / 2) - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=2") // 4MHz + CH(DIV_SYSTEM_YM2151, 1.0f, 0, "clockSel=1"), // 3.5MHz (7MHz / 2) + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=2") // 4MHz } ); ENTRY( "NMK 16-bit Arcade", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=5"), // 1.5MHz; optional - CH(DIV_SYSTEM_MSM6295, 64, 0, + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=5"), // 1.5MHz; optional + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=2\n" "rateSel=true\n" ), // 4MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=2\n" "rateSel=true\n" ) // ^^ @@ -1444,12 +1444,12 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "NMK 16-bit Arcade (extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=5"), // 1.5MHz; optional - CH(DIV_SYSTEM_MSM6295, 64, 0, + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=5"), // 1.5MHz; optional + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=2\n" "rateSel=true\n" ), // 4MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=2\n" "rateSel=true\n" ) // ^^ @@ -1457,22 +1457,22 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Kaneko DJ Boy", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_MSM6295, 64, -127, "clockSel=12"), // 1.5MHz, Left output - CH(DIV_SYSTEM_MSM6295, 64, 127, "clockSel=12"), // 1.5MHz, Right output + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, -1.0f, "clockSel=12"), // 1.5MHz, Left output + CH(DIV_SYSTEM_MSM6295, 1.0f, 1.0f, "clockSel=12"), // 1.5MHz, Right output } ); ENTRY( "Kaneko DJ Boy (extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_MSM6295, 64, -127, "clockSel=12"), // 1.5MHz, Left output - CH(DIV_SYSTEM_MSM6295, 64, 127, "clockSel=12") // 1.5MHz, Right output + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, -1.0f, "clockSel=12"), // 1.5MHz, Left output + CH(DIV_SYSTEM_MSM6295, 1.0f, 1.0f, "clockSel=12") // 1.5MHz, Right output } ); ENTRY( "Kaneko Air Buster", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=13\n" "rateSel=true\n" ) // 3MHz @@ -1480,8 +1480,8 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Kaneko Air Buster (extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=13\n" "rateSel=true\n" ) // 3MHz @@ -1489,349 +1489,349 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Kaneko Toybox System", { - CH(DIV_SYSTEM_AY8910, 64, 0, + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3\n" "chipType=1\n" ), // YM2149 2MHz - CH(DIV_SYSTEM_AY8910, 64, 0, + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3\n" "chipType=1\n" ), // ^^ - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=8") // 2MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=8") // 2MHz } ); ENTRY( "Kaneko Jackie Chan", { - CH(DIV_SYSTEM_YMZ280B, 64, 0, "clockSel=3") // 16MHz + CH(DIV_SYSTEM_YMZ280B, 1.0f, 0, "clockSel=3") // 16MHz } ); ENTRY( "Super Kaneko Nova System", { - CH(DIV_SYSTEM_YMZ280B, 64, 0, "clockSel=4") // 16.67MHz (33.33MHz / 2) + CH(DIV_SYSTEM_YMZ280B, 1.0f, 0, "clockSel=4") // 16.67MHz (33.33MHz / 2) } ); ENTRY( "Tecmo Ninja Gaiden", { // Ninja Gaiden, Raiga, etc - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "") // 1MHz + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") // 1MHz } ); ENTRY( "Tecmo Ninja Gaiden (extended channel 3 on first OPN)", { // Ninja Gaiden, Raiga, etc - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "") // 1MHz + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") // 1MHz } ); ENTRY( "Tecmo Ninja Gaiden (extended channel 3 on second OPN)", { // Ninja Gaiden, Raiga, etc - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "") // 1MHz + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") // 1MHz } ); ENTRY( "Tecmo Ninja Gaiden (extended channel 3 on both OPNs)", { // Ninja Gaiden, Raiga, etc - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=2"), // 4MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "") // 1MHz + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=2"), // 4MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") // 1MHz } ); ENTRY( "Tecmo System", { - CH(DIV_SYSTEM_OPL3, 64, 0, ""), - CH(DIV_SYSTEM_YMZ280B, 64, 0, ""), - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=8") // 2MHz + CH(DIV_SYSTEM_OPL3, 1.0f, 0, ""), + CH(DIV_SYSTEM_YMZ280B, 1.0f, 0, ""), + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=8") // 2MHz } ); ENTRY( "Tecmo System (drums mode)", { - CH(DIV_SYSTEM_OPL3_DRUMS, 64, 0, ""), - CH(DIV_SYSTEM_YMZ280B, 64, 0, ""), - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=8") // 2MHz + CH(DIV_SYSTEM_OPL3_DRUMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_YMZ280B, 1.0f, 0, ""), + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=8") // 2MHz } ); ENTRY( "Seibu Kaihatsu Raiden", { // Raiden, Seibu cup soccer, Zero team, etc - CH(DIV_SYSTEM_OPL2, 64, 0, ""), // YM3812 3.58MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "") // 1 or 1.023MHz (28.636363MHz / 28); various per games + CH(DIV_SYSTEM_OPL2, 1.0f, 0, ""), // YM3812 3.58MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") // 1 or 1.023MHz (28.636363MHz / 28); various per games } ); ENTRY( "Seibu Kaihatsu Raiden (drums mode)", { // Raiden, Seibu cup soccer, Zero team, etc - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, ""), // YM3812 3.58MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "") // 1 or 1.023MHz (28.636363MHz / 28); various per games + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, ""), // YM3812 3.58MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") // 1 or 1.023MHz (28.636363MHz / 28); various per games } ); ENTRY( "Sunsoft Shanghai 3", { - CH(DIV_SYSTEM_AY8910, 64, 0, + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=4\n" "chipType=1\n" ), // YM2149 1.5MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=1") // 1.056MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=1") // 1.056MHz } ); ENTRY( "Sunsoft Arcade", { - CH(DIV_SYSTEM_YM2612, 64, 0, "clockSel=2"), // discrete YM3438 8MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=1") // 1.056MHz + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=2"), // discrete YM3438 8MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=1") // 1.056MHz } ); ENTRY( "Sunsoft Arcade (extended channel 3)", { - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "clockSel=2"), // discrete YM3438 8MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=1") // 1.056MHz + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=2"), // discrete YM3438 8MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=1") // 1.056MHz } ); ENTRY( "Atari Klax", { - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=7") // 0.895MHz (3.579545MHz / 4) + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=7") // 0.895MHz (3.579545MHz / 4) } ); ENTRY( "Atari Rampart", { - CH(DIV_SYSTEM_OPLL, 64, 0, ""), // 3.579545MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=14") // 1.193MHz (3.579545MHz / 3) + CH(DIV_SYSTEM_OPLL, 1.0f, 0, ""), // 3.579545MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=14") // 1.193MHz (3.579545MHz / 3) } ); ENTRY( "Atari Rampart (drums mode)", { - CH(DIV_SYSTEM_OPLL_DRUMS, 64, 0, ""), // 3.579545MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=14") // 1.193MHz (3.579545MHz / 3) + CH(DIV_SYSTEM_OPLL_DRUMS, 1.0f, 0, ""), // 3.579545MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=14") // 1.193MHz (3.579545MHz / 3) } ); ENTRY( "Atari JSA IIIs", { - CH(DIV_SYSTEM_YM2151, 64, 0, ""), // 3.579545MHz - CH(DIV_SYSTEM_MSM6295, 64, -127, "clockSel=14"), // 1.193MHz (3.579545MHz / 3), Left output - CH(DIV_SYSTEM_MSM6295, 64, 127, "clockSel=14") // 1.193MHz (3.579545MHz / 3), Right output + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), // 3.579545MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, -1.0f, "clockSel=14"), // 1.193MHz (3.579545MHz / 3), Left output + CH(DIV_SYSTEM_MSM6295, 1.0f, 1.0f, "clockSel=14") // 1.193MHz (3.579545MHz / 3), Right output } ); ENTRY( "Atari Marble Madness", { - CH(DIV_SYSTEM_YM2151, 64, 0, ""), - CH(DIV_SYSTEM_POKEY, 64, 0, "") + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), + CH(DIV_SYSTEM_POKEY, 1.0f, 0, "") } ); ENTRY( "Atari Championship Sprint", { - CH(DIV_SYSTEM_YM2151, 64, 0, ""), - CH(DIV_SYSTEM_POKEY, 64, 0, ""), - CH(DIV_SYSTEM_POKEY, 64, 0, "") + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), + CH(DIV_SYSTEM_POKEY, 1.0f, 0, ""), + CH(DIV_SYSTEM_POKEY, 1.0f, 0, "") } ); ENTRY( "Atari Tetris", { - CH(DIV_SYSTEM_POKEY, 64, 0, ""), - CH(DIV_SYSTEM_POKEY, 64, 0, "") + CH(DIV_SYSTEM_POKEY, 1.0f, 0, ""), + CH(DIV_SYSTEM_POKEY, 1.0f, 0, "") } ); ENTRY( "Atari I, Robot", { - CH(DIV_SYSTEM_POKEY, 64, 0, "customClock=1512000"), - CH(DIV_SYSTEM_POKEY, 64, 0, "customClock=1512000"), - CH(DIV_SYSTEM_POKEY, 64, 0, "customClock=1512000"), - CH(DIV_SYSTEM_POKEY, 64, 0, "customClock=1512000") + CH(DIV_SYSTEM_POKEY, 1.0f, 0, "customClock=1512000"), + CH(DIV_SYSTEM_POKEY, 1.0f, 0, "customClock=1512000"), + CH(DIV_SYSTEM_POKEY, 1.0f, 0, "customClock=1512000"), + CH(DIV_SYSTEM_POKEY, 1.0f, 0, "customClock=1512000") } ); ENTRY( "Data East Karnov", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=5"), // 1.5MHz - CH(DIV_SYSTEM_OPL, 64, 0, "clockSel=3") // 3MHz + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=5"), // 1.5MHz + CH(DIV_SYSTEM_OPL, 1.0f, 0, "clockSel=3") // 3MHz } ); ENTRY( "Data East Karnov (extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=5"), // 1.5MHz - CH(DIV_SYSTEM_OPL, 64, 0, "clockSel=3") // 3MHz + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=5"), // 1.5MHz + CH(DIV_SYSTEM_OPL, 1.0f, 0, "clockSel=3") // 3MHz } ); ENTRY( "Data East Karnov (drums mode)", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=5"), // 1.5MHz - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "clockSel=3") // 3MHz + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=5"), // 1.5MHz + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "clockSel=3") // 3MHz } ); ENTRY( "Data East Karnov (extended channel 3; drums mode)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=5"), // 1.5MHz - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "clockSel=3") // 3MHz + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=5"), // 1.5MHz + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "clockSel=3") // 3MHz } ); ENTRY( "Data East Arcade", { // Bad dudes, Robocop, etc - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=5"), // 1.5MHz - CH(DIV_SYSTEM_OPL2, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "") // 1 to 1.056MHz; various per games or optional + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=5"), // 1.5MHz + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") // 1 to 1.056MHz; various per games or optional } ); ENTRY( "Data East Arcade (extended channel 3)", { // Bad dudes, Robocop, etc - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=5"), // 1.5MHz - CH(DIV_SYSTEM_OPL2, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "") // 1 to 1.056MHz; various per games or optional + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=5"), // 1.5MHz + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") // 1 to 1.056MHz; various per games or optional } ); ENTRY( "Data East Arcade (drums mode)", { // Bad dudes, Robocop, etc - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=5"), // 1.5MHz - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "") // 1 to 1.056MHz; various per games or optional + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=5"), // 1.5MHz + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") // 1 to 1.056MHz; various per games or optional } ); ENTRY( "Data East Arcade (extended channel 3; drums mode)", { // Bad dudes, Robocop, etc - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=5"), // 1.5MHz - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_MSM6295, 64, 0, "") // 1 to 1.056MHz; various per games or optional + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=5"), // 1.5MHz + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") // 1 to 1.056MHz; various per games or optional } ); ENTRY( "Data East PCX", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=5"), // 1.5MHz - CH(DIV_SYSTEM_PCE, 64, 0, "") + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=5"), // 1.5MHz + CH(DIV_SYSTEM_PCE, 1.0f, 0, "") // software controlled MSM5205 } ); ENTRY( "Data East PCX (extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=5"), // 1.5MHz - CH(DIV_SYSTEM_PCE, 64, 0, "") + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=5"), // 1.5MHz + CH(DIV_SYSTEM_PCE, 1.0f, 0, "") // software controlled MSM5205 } ); ENTRY( "Data East Dark Seal", { // Dark Seal, Crude Buster, Vapor Trail, etc - CH(DIV_SYSTEM_YM2151, 64, 0, ""), // 3.580MHz (32.22MHz / 9) - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=2"), // 4.0275MHz (32.22MHz / 8); optional - CH(DIV_SYSTEM_MSM6295, 64, 0, ""), // 1.007MHz (32.22MHz / 32) - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=8") // 2.014MHz (32.22MHz / 16); optional + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), // 3.580MHz (32.22MHz / 9) + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=2"), // 4.0275MHz (32.22MHz / 8); optional + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, ""), // 1.007MHz (32.22MHz / 32) + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=8") // 2.014MHz (32.22MHz / 16); optional // HuC6280 is for control them, internal sound isn't used } ); ENTRY( "Data East Dark Seal (extended channel 3)", { // Dark Seal, Crude Buster, Vapor Trail, etc - CH(DIV_SYSTEM_YM2151, 64, 0, ""), // 3.580MHz (32.22MHz / 9) - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=2"), // 4.0275MHz (32.22MHz / 8); optional - CH(DIV_SYSTEM_MSM6295, 64, 0, ""), // 1.007MHz (32.22MHz / 32) - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=8") // 2.014MHz (32.22MHz / 16); optional + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), // 3.580MHz (32.22MHz / 9) + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=2"), // 4.0275MHz (32.22MHz / 8); optional + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, ""), // 1.007MHz (32.22MHz / 32) + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=8") // 2.014MHz (32.22MHz / 16); optional // HuC6280 is for control them, internal sound isn't used } ); ENTRY( "Data East Deco 156", { - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=0"), // 1 or 1.007MHz (32.22MHz / 32); various per games - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=8") // 1 or 2 or 2.014MHz (32.22MHz / 16); various per games + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=0"), // 1 or 1.007MHz (32.22MHz / 32); various per games + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=8") // 1 or 2 or 2.014MHz (32.22MHz / 16); various per games } ); ENTRY( "Data East MLC", { - CH(DIV_SYSTEM_YMZ280B, 64, 0, "clockSel=5") // 14MHz + CH(DIV_SYSTEM_YMZ280B, 1.0f, 0, "clockSel=5") // 14MHz } ); ENTRY( "SNK Ikari Warriors", { - CH(DIV_SYSTEM_OPL, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_OPL, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_OPL, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_OPL, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Ikari Warriors (drums mode on first OPL)", { - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_OPL, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_OPL, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Ikari Warriors (drums mode on second OPL)", { - CH(DIV_SYSTEM_OPL, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_OPL, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Ikari Warriors (drums mode on both OPLs)", { - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Triple Z80", { - CH(DIV_SYSTEM_Y8950, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_OPL, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_Y8950, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_OPL, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Triple Z80 (drums mode on Y8950)", { - CH(DIV_SYSTEM_Y8950_DRUMS, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_OPL, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_OPL, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Triple Z80 (drums mode on OPL)", { - CH(DIV_SYSTEM_Y8950, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_Y8950, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Triple Z80 (drums mode on Y8950 and OPL)", { - CH(DIV_SYSTEM_Y8950_DRUMS, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Chopper I", { - CH(DIV_SYSTEM_Y8950, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_OPL2, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_Y8950, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Chopper I (drums mode on Y8950)", { - CH(DIV_SYSTEM_Y8950_DRUMS, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_OPL2, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Chopper I (drums mode on OPL2)", { - CH(DIV_SYSTEM_Y8950, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_Y8950, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Chopper I (drums mode on Y8950 and OPL2)", { - CH(DIV_SYSTEM_Y8950_DRUMS, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Touchdown Fever", { - CH(DIV_SYSTEM_OPL, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_Y8950, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_OPL, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_Y8950, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Touchdown Fever (drums mode on OPL)", { - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_Y8950, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_Y8950, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Touchdown Fever (drums mode on Y8950)", { - CH(DIV_SYSTEM_OPL, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_Y8950_DRUMS, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_OPL, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, 0, "clockSel=2") } ); ENTRY( "SNK Touchdown Fever (drums mode on OPL and Y8950)", { - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "clockSel=2"), - CH(DIV_SYSTEM_Y8950_DRUMS, 64, 0, "clockSel=2") + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "clockSel=2"), + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, 0, "clockSel=2") } ); ENTRY( "Alpha denshi Alpha-68K", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_OPLL, 64, 0, "clockSel=0"), // 3.58MHz - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_OPLL, 1.0f, 0, "clockSel=0"), // 3.58MHz + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=7614\n" "outDepth=7\n" ) // software controlled 8 bit DAC @@ -1839,9 +1839,9 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Alpha denshi Alpha-68K (extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_OPLL, 64, 0, "clockSel=0"), // 3.58MHz - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_OPLL, 1.0f, 0, "clockSel=0"), // 3.58MHz + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=7614\n" "outDepth=7\n" ) // software controlled 8 bit DAC @@ -1849,9 +1849,9 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Alpha denshi Alpha-68K (drums mode)", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_OPLL_DRUMS, 64, 0, "clockSel=0"), // 3.58MHz - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_OPLL_DRUMS, 1.0f, 0, "clockSel=0"), // 3.58MHz + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=7614\n" "outDepth=7\n" ) // software controlled 8 bit DAC @@ -1859,9 +1859,9 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Alpha denshi Alpha-68K (extended channel 3; drums mode)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=3"), // 3MHz - CH(DIV_SYSTEM_OPLL_DRUMS, 64, 0, "clockSel=0"), // 3.58MHz - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=3"), // 3MHz + CH(DIV_SYSTEM_OPLL_DRUMS, 1.0f, 0, "clockSel=0"), // 3.58MHz + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=7614\n" "outDepth=7\n" ) // software controlled 8 bit DAC @@ -1869,13 +1869,13 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Alpha denshi Equites", { - CH(DIV_SYSTEM_MSM5232, 64, 0, "customClock=6144000"), - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=14"), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_MSM5232, 1.0f, 0, "customClock=6144000"), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=14"), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=11025\n" "outDepth=5\n" ), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=11025\n" "outDepth=5\n" ) // don't know what the actual sample rate is @@ -1883,47 +1883,47 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Neo Geo MVS", { - CH(DIV_SYSTEM_YM2610_FULL, 64, 0, "") + CH(DIV_SYSTEM_YM2610_FULL, 1.0f, 0, "") } ); ENTRY( "Neo Geo MVS (extended channel 2)", { - CH(DIV_SYSTEM_YM2610_FULL_EXT, 64, 0, "") + CH(DIV_SYSTEM_YM2610_FULL_EXT, 1.0f, 0, "") } ); ENTRY( "Nichibutsu Mag Max", { - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=13"), - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=13"), - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=13") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=13"), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=13"), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=13") } ); ENTRY( "Namco (3-channel WSG)", { // Pac-Man, Galaga, Xevious, etc - CH(DIV_SYSTEM_NAMCO, 64, 0, "") + CH(DIV_SYSTEM_NAMCO, 1.0f, 0, "") } ); ENTRY( "Namco Mappy", { // Mappy, Super Pac-Man, Libble Rabble, etc - CH(DIV_SYSTEM_NAMCO_15XX, 64, 0, "") + CH(DIV_SYSTEM_NAMCO_15XX, 1.0f, 0, "") } ); ENTRY( "Namco Pac-Land", { // Pac-Land, Baraduke, Sky kid, etc - CH(DIV_SYSTEM_NAMCO_CUS30, 64, 0, "") + CH(DIV_SYSTEM_NAMCO_CUS30, 1.0f, 0, "") } ); ENTRY( "Namco System 86", { // without expansion board case; Hopping Mappy, etc - CH(DIV_SYSTEM_YM2151, 64, 0, ""), - CH(DIV_SYSTEM_NAMCO_CUS30, 64, 0, "") + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), + CH(DIV_SYSTEM_NAMCO_CUS30, 1.0f, 0, "") } ); ENTRY( "Namco Thunder Ceptor", { - CH(DIV_SYSTEM_YM2151, 64, 0, ""), - CH(DIV_SYSTEM_NAMCO_CUS30, 64, 0, ""), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), + CH(DIV_SYSTEM_NAMCO_CUS30, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=8000\n" "outDepth=7\n" ) // M65C02 software driven, correct sample rate? @@ -1931,13 +1931,13 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Namco System 1", { - CH(DIV_SYSTEM_YM2151, 64, 0, ""), - CH(DIV_SYSTEM_NAMCO_CUS30, 64, 0, ""), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), + CH(DIV_SYSTEM_NAMCO_CUS30, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=6000\n" "outDepth=7\n" ), // sample rate verified from https://github.com/mamedev/mame/blob/master/src/devices/sound/n63701x.cpp - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=6000\n" "outDepth=7\n" ) // "" @@ -1945,29 +1945,29 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Taito Arcade", { - CH(DIV_SYSTEM_YM2610B, 64, 0, "") + CH(DIV_SYSTEM_YM2610B, 1.0f, 0, "") } ); ENTRY( "Taito Arcade (extended channel 3)", { - CH(DIV_SYSTEM_YM2610B_EXT, 64, 0, "") + CH(DIV_SYSTEM_YM2610B_EXT, 1.0f, 0, "") } ); ENTRY( "Taito Metal Soldier Isaac II", { - CH(DIV_SYSTEM_MSM5232, 64, 0, ""), - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=3"), - CH(DIV_SYSTEM_AY8910, 64, 0, "clockSel=3") + CH(DIV_SYSTEM_MSM5232, 1.0f, 0, ""), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3"), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3") } ); ENTRY( "Taito The Fairyland Story", { - CH(DIV_SYSTEM_MSM5232, 64, 0, ""), - CH(DIV_SYSTEM_AY8910, 64, 0, + CH(DIV_SYSTEM_MSM5232, 1.0f, 0, ""), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3\n" "chipType=1\n" ), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=11025\n" "outDepth=7\n" ) // don't know what the actual sample rate is @@ -1975,16 +1975,16 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Taito Wyvern F-0", { - CH(DIV_SYSTEM_MSM5232, 64, 0, ""), - CH(DIV_SYSTEM_AY8910, 64, 0, + CH(DIV_SYSTEM_MSM5232, 1.0f, 0, ""), + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3\n" "chipType=1\n" ), - CH(DIV_SYSTEM_AY8910, 64, 0, + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "clockSel=3\n" "chipType=1\n" ), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=11025\n" "outDepth=7\n" ) // don't know what the actual sample rate is @@ -1992,97 +1992,97 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Seta 1", { - CH(DIV_SYSTEM_X1_010, 64, 0, "") + CH(DIV_SYSTEM_X1_010, 1.0f, 0, "") } ); ENTRY( "Seta 1 + FM addon", { - CH(DIV_SYSTEM_X1_010, 64, 0, ""), - CH(DIV_SYSTEM_YM2612, 64, 0, "clockSel=2") // Discrete YM3438 + CH(DIV_SYSTEM_X1_010, 1.0f, 0, ""), + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "clockSel=2") // Discrete YM3438 } ); ENTRY( "Seta 1 + FM addon (extended channel 3)", { - CH(DIV_SYSTEM_X1_010, 64, 0, ""), - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "clockSel=2") // Discrete YM3438 + CH(DIV_SYSTEM_X1_010, 1.0f, 0, ""), + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "clockSel=2") // Discrete YM3438 } ); ENTRY( "Seta 2", { - CH(DIV_SYSTEM_X1_010, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_X1_010, 1.0f, 0, "clockSel=1") } ); ENTRY( "Cave 68000", { - CH(DIV_SYSTEM_YMZ280B, 64, 0, "") + CH(DIV_SYSTEM_YMZ280B, 1.0f, 0, "") } ); ENTRY( "Coreland Cyber Tank", { - CH(DIV_SYSTEM_Y8950, 64, -127, ""), // 3.58MHz, Left output - CH(DIV_SYSTEM_Y8950, 64, 127, "") // 3.58MHz, Right output + CH(DIV_SYSTEM_Y8950, 1.0f, -1.0f, ""), // 3.58MHz, Left output + CH(DIV_SYSTEM_Y8950, 1.0f, 1.0f, "") // 3.58MHz, Right output } ); ENTRY( "Coreland Cyber Tank (drums mode)", { - CH(DIV_SYSTEM_Y8950_DRUMS, 64, -127, ""), // 3.58MHz, Left output - CH(DIV_SYSTEM_Y8950_DRUMS, 64, 127, "") // 3.58MHz, Right output + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, -1.0f, ""), // 3.58MHz, Left output + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, 1.0f, "") // 3.58MHz, Right output } ); ENTRY( "ICE Skimaxx", { - CH(DIV_SYSTEM_MSM6295, 64, -127, + CH(DIV_SYSTEM_MSM6295, 1.0f, -1.0f, "clockSel=2\n" "rateSel=true\n" ), // 4MHz, Left output - CH(DIV_SYSTEM_MSM6295, 64, 127, + CH(DIV_SYSTEM_MSM6295, 1.0f, 1.0f, "clockSel=2\n" "rateSel=true\n" ), // 4MHz, Right output - CH(DIV_SYSTEM_MSM6295, 64, -127, "clockSel=8"), // 2MHz, Left output - CH(DIV_SYSTEM_MSM6295, 64, 127, "clockSel=8") // 2MHz, Right output + CH(DIV_SYSTEM_MSM6295, 1.0f, -1.0f, "clockSel=8"), // 2MHz, Left output + CH(DIV_SYSTEM_MSM6295, 1.0f, 1.0f, "clockSel=8") // 2MHz, Right output } ); ENTRY( "Toaplan 1", { - CH(DIV_SYSTEM_OPL2, 64, 0, "clockSel=5") // 3.5MHz + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "clockSel=5") // 3.5MHz } ); ENTRY( "Toaplan 1 (drums mode)", { - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "clockSel=5") // 3.5MHz + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "clockSel=5") // 3.5MHz } ); ENTRY( "Dynax/Nakanihon 3rd generation hardware", { - CH(DIV_SYSTEM_AY8910, 64, 0, ""), // AY or YM, optional - 1.79MHz or 3.58MHz; various per game - CH(DIV_SYSTEM_OPLL, 64, 0, ""), - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=6") // 1.023MHz mostly + CH(DIV_SYSTEM_AY8910, 1.0f, 0, ""), // AY or YM, optional - 1.79MHz or 3.58MHz; various per game + CH(DIV_SYSTEM_OPLL, 1.0f, 0, ""), + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=6") // 1.023MHz mostly } ); ENTRY( "Dynax/Nakanihon 3rd generation hardware (drums mode)", { - CH(DIV_SYSTEM_AY8910, 64, 0, ""), // AY or YM, optional - 1.79MHz or 3.58MHz; various per game - CH(DIV_SYSTEM_OPLL_DRUMS, 64, 0, ""), - CH(DIV_SYSTEM_MSM6295, 64, 0, "clockSel=6") // 1.023MHz mostly + CH(DIV_SYSTEM_AY8910, 1.0f, 0, ""), // AY or YM, optional - 1.79MHz or 3.58MHz; various per game + CH(DIV_SYSTEM_OPLL_DRUMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "clockSel=6") // 1.023MHz mostly } ); ENTRY( "Dynax/Nakanihon Real Break", { - CH(DIV_SYSTEM_OPLL, 64, 0, ""), - CH(DIV_SYSTEM_YMZ280B, 64, 0, "") + CH(DIV_SYSTEM_OPLL, 1.0f, 0, ""), + CH(DIV_SYSTEM_YMZ280B, 1.0f, 0, "") } ); ENTRY( "Dynax/Nakanihon Real Break (drums mode)", { - CH(DIV_SYSTEM_OPLL_DRUMS, 64, 0, ""), - CH(DIV_SYSTEM_YMZ280B, 64, 0, "") + CH(DIV_SYSTEM_OPLL_DRUMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_YMZ280B, 1.0f, 0, "") } ); ENTRY( "Irem M72", { - CH(DIV_SYSTEM_YM2151, 64, 0, ""), - CH(DIV_SYSTEM_PCM_DAC, 64, 0, + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "rate=7812\n" "outDepth=7\n" ) @@ -2090,8 +2090,8 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Irem M92/M107", { - CH(DIV_SYSTEM_YM2151, 64, 0, ""), - CH(DIV_SYSTEM_GA20, 64, 0, "") + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), + CH(DIV_SYSTEM_GA20, 1.0f, 0, "") } ); CATEGORY_END; @@ -2100,158 +2100,158 @@ void FurnaceGUI::initSystemPresets() { CATEGORY_BEGIN("FM","chips which use frequency modulation (FM) to generate sound.\nsome of these also pack more (like square and sample channels)."); ENTRY( "Yamaha YM2151 (OPM)", { - CH(DIV_SYSTEM_YM2151, 64, 0, "") + CH(DIV_SYSTEM_YM2151, 1.0f, 0, "") } ); ENTRY( "Yamaha YM2203 (OPN)", { - CH(DIV_SYSTEM_YM2203, 64, 0, "clockSel=3") + CH(DIV_SYSTEM_YM2203, 1.0f, 0, "clockSel=3") } ); ENTRY( "Yamaha YM2203 (extended channel 3)", { - CH(DIV_SYSTEM_YM2203_EXT, 64, 0, "clockSel=3") + CH(DIV_SYSTEM_YM2203_EXT, 1.0f, 0, "clockSel=3") } ); ENTRY( "Yamaha YM2608 (OPNA)", { - CH(DIV_SYSTEM_YM2608, 64, 0, "") + CH(DIV_SYSTEM_YM2608, 1.0f, 0, "") } ); ENTRY( "Yamaha YM2608 (extended channel 3)", { - CH(DIV_SYSTEM_YM2608_EXT, 64, 0, "") + CH(DIV_SYSTEM_YM2608_EXT, 1.0f, 0, "") } ); ENTRY( "Yamaha YM2610 (OPNB)", { - CH(DIV_SYSTEM_YM2610_FULL, 64, 0, "") + CH(DIV_SYSTEM_YM2610_FULL, 1.0f, 0, "") } ); ENTRY( "Yamaha YM2610 (extended channel 2)", { - CH(DIV_SYSTEM_YM2610_FULL_EXT, 64, 0, "") + CH(DIV_SYSTEM_YM2610_FULL_EXT, 1.0f, 0, "") } ); ENTRY( "Yamaha YM2610B (OPNB2)", { - CH(DIV_SYSTEM_YM2610B, 64, 0, "") + CH(DIV_SYSTEM_YM2610B, 1.0f, 0, "") } ); ENTRY( "Yamaha YM2610B (extended channel 3)", { - CH(DIV_SYSTEM_YM2610B_EXT, 64, 0, "") + CH(DIV_SYSTEM_YM2610B_EXT, 1.0f, 0, "") } ); ENTRY( "Yamaha YM2612 (OPN2)", { - CH(DIV_SYSTEM_YM2612, 64, 0, "ladderEffect=true") + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "ladderEffect=true") } ); ENTRY( "Yamaha YM2612 (extended channel 3)", { - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "ladderEffect=true") + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "ladderEffect=true") } ); ENTRY( "Yamaha YM2612 (OPN2) CSM", { - CH(DIV_SYSTEM_YM2612_CSM, 64, 0, "ladderEffect=true") + CH(DIV_SYSTEM_YM2612_CSM, 1.0f, 0, "ladderEffect=true") } ); ENTRY( "Yamaha YM2612 (OPN2) with DualPCM", { - CH(DIV_SYSTEM_YM2612_DUALPCM, 64, 0, "ladderEffect=true") + CH(DIV_SYSTEM_YM2612_DUALPCM, 1.0f, 0, "ladderEffect=true") } ); ENTRY( "Yamaha YM2612 (extended channel 3) with DualPCM", { - CH(DIV_SYSTEM_YM2612_DUALPCM_EXT, 64, 0, "ladderEffect=true") + CH(DIV_SYSTEM_YM2612_DUALPCM_EXT, 1.0f, 0, "ladderEffect=true") } ); ENTRY( "Yamaha YM2413 (OPLL)", { - CH(DIV_SYSTEM_OPLL, 64, 0, "") + CH(DIV_SYSTEM_OPLL, 1.0f, 0, "") } ); ENTRY( "Yamaha YM2413 (drums mode)", { - CH(DIV_SYSTEM_OPLL_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_OPLL_DRUMS, 1.0f, 0, "") } ); ENTRY( "Yamaha YM2414 (OPZ)", { - CH(DIV_SYSTEM_OPZ, 64, 0, "") + CH(DIV_SYSTEM_OPZ, 1.0f, 0, "") } ); ENTRY( "Yamaha YM3438 (OPN2C)", { - CH(DIV_SYSTEM_YM2612, 64, 0, "") + CH(DIV_SYSTEM_YM2612, 1.0f, 0, "") } ); ENTRY( "Yamaha YM3438 (extended channel 3)", { - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, "") + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, "") } ); ENTRY( "Yamaha YM3438 (OPN2C) CSM", { - CH(DIV_SYSTEM_YM2612_CSM, 64, 0, "") + CH(DIV_SYSTEM_YM2612_CSM, 1.0f, 0, "") } ); ENTRY( "Yamaha YM3438 (OPN2C) with DualPCM", { - CH(DIV_SYSTEM_YM2612_DUALPCM, 64, 0, "") + CH(DIV_SYSTEM_YM2612_DUALPCM, 1.0f, 0, "") } ); ENTRY( "Yamaha YM3438 (extended channel 3) with DualPCM", { - CH(DIV_SYSTEM_YM2612_DUALPCM_EXT, 64, 0, "") + CH(DIV_SYSTEM_YM2612_DUALPCM_EXT, 1.0f, 0, "") } ); ENTRY( "Yamaha YM3526 (OPL)", { - CH(DIV_SYSTEM_OPL, 64, 0, "") + CH(DIV_SYSTEM_OPL, 1.0f, 0, "") } ); ENTRY( "Yamaha YM3526 (drums mode)", { - CH(DIV_SYSTEM_OPL_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_OPL_DRUMS, 1.0f, 0, "") } ); ENTRY( "Yamaha Y8950", { - CH(DIV_SYSTEM_Y8950, 64, 0, "") + CH(DIV_SYSTEM_Y8950, 1.0f, 0, "") } ); ENTRY( "Yamaha Y8950 (drums mode)", { - CH(DIV_SYSTEM_Y8950_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_Y8950_DRUMS, 1.0f, 0, "") } ); ENTRY( "Yamaha YM3812 (OPL2)", { - CH(DIV_SYSTEM_OPL2, 64, 0, "") + CH(DIV_SYSTEM_OPL2, 1.0f, 0, "") } ); ENTRY( "Yamaha YM3812 (drums mode)", { - CH(DIV_SYSTEM_OPL2_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_OPL2_DRUMS, 1.0f, 0, "") } ); ENTRY( "Yamaha YMF262 (OPL3)", { - CH(DIV_SYSTEM_OPL3, 64, 0, "") + CH(DIV_SYSTEM_OPL3, 1.0f, 0, "") } ); ENTRY( "Yamaha YMF262 (drums mode)", { - CH(DIV_SYSTEM_OPL3_DRUMS, 64, 0, "") + CH(DIV_SYSTEM_OPL3_DRUMS, 1.0f, 0, "") } ); if (settings.hiddenSystems) { ENTRY( "Yamaha YMU759 (MA-2)", { - CH(DIV_SYSTEM_YMU759, 64, 0, "") + CH(DIV_SYSTEM_YMU759, 1.0f, 0, "") } ); } @@ -2260,43 +2260,43 @@ void FurnaceGUI::initSystemPresets() { CATEGORY_BEGIN("Square","these chips generate square/pulse tones only (but may include noise)."); ENTRY( "TI SN76489", { - CH(DIV_SYSTEM_SMS, 64, 0, "chipType=1") + CH(DIV_SYSTEM_SMS, 1.0f, 0, "chipType=1") } ); ENTRY( "TI SN76489A", { - CH(DIV_SYSTEM_SMS, 64, 0, "chipType=4") + CH(DIV_SYSTEM_SMS, 1.0f, 0, "chipType=4") } ); ENTRY( "TI SN76496", { - CH(DIV_SYSTEM_SMS, 64, 0, "chipType=5") + CH(DIV_SYSTEM_SMS, 1.0f, 0, "chipType=5") } ); ENTRY( "NCR 8496", { - CH(DIV_SYSTEM_SMS, 64, 0, "chipType=6") + CH(DIV_SYSTEM_SMS, 1.0f, 0, "chipType=6") } ); ENTRY( "Tandy PSSJ 3-voice sound", { - CH(DIV_SYSTEM_SMS, 64, 0, "chipType=7") + CH(DIV_SYSTEM_SMS, 1.0f, 0, "chipType=7") // 8 bit DAC } ); ENTRY( "Sega PSG (SN76489-like)", { - CH(DIV_SYSTEM_SMS, 64, 0, ""), + CH(DIV_SYSTEM_SMS, 1.0f, 0, ""), } ); ENTRY( "Sega PSG (SN76489-like, Stereo)", { - CH(DIV_SYSTEM_SMS, 64, 0, "chipType=3") + CH(DIV_SYSTEM_SMS, 1.0f, 0, "chipType=3") } ); ENTRY( "TI SN94624", { - CH(DIV_SYSTEM_SMS, 64, 0, + CH(DIV_SYSTEM_SMS, 1.0f, 0, "clockSel=6\n" "chipType=8\n" ) @@ -2304,7 +2304,7 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "TI SN76494", { - CH(DIV_SYSTEM_SMS, 64, 0, + CH(DIV_SYSTEM_SMS, 1.0f, 0, "clockSel=6\n" "chipType=9\n" ) @@ -2312,52 +2312,52 @@ void FurnaceGUI::initSystemPresets() { ); ENTRY( "Toshiba T6W28", { - CH(DIV_SYSTEM_T6W28, 64, 0, "") + CH(DIV_SYSTEM_T6W28, 1.0f, 0, "") } ); ENTRY( "AY-3-8910", { - CH(DIV_SYSTEM_AY8910, 64, 0, "") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "") } ); ENTRY( "AY-3-8914", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=3") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=3") } ); ENTRY( "Yamaha YM2149(F)", { - CH(DIV_SYSTEM_AY8910, 64, 0, "chipType=1") + CH(DIV_SYSTEM_AY8910, 1.0f, 0, "chipType=1") } ); ENTRY( "Philips SAA1099", { - CH(DIV_SYSTEM_SAA1099, 64, 0, "") + CH(DIV_SYSTEM_SAA1099, 1.0f, 0, "") } ); ENTRY( "PC Speaker", { - CH(DIV_SYSTEM_PCSPKR, 32, 0, "") + CH(DIV_SYSTEM_PCSPKR, 0.5f, 0, "") } ); ENTRY( "Pokémon Mini", { - CH(DIV_SYSTEM_POKEMINI, 32, 0, "") + CH(DIV_SYSTEM_POKEMINI, 0.5f, 0, "") } ); ENTRY( "Commodore VIC", { - CH(DIV_SYSTEM_VIC20, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_VIC20, 1.0f, 0, "clockSel=1") } ); ENTRY( "OKI MSM5232", { - CH(DIV_SYSTEM_MSM5232, 64, 0, "") + CH(DIV_SYSTEM_MSM5232, 1.0f, 0, "") } ); ENTRY( "Pong", { - CH(DIV_SYSTEM_PONG, 64, 0, "") + CH(DIV_SYSTEM_PONG, 1.0f, 0, "") } ); CATEGORY_END; @@ -2365,63 +2365,63 @@ void FurnaceGUI::initSystemPresets() { CATEGORY_BEGIN("Sample","chips/systems which use PCM or ADPCM samples for sound synthesis."); ENTRY( "Amiga", { - CH(DIV_SYSTEM_AMIGA, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_AMIGA, 1.0f, 0, "clockSel=1") }, "tickRate=50" ); ENTRY( "SegaPCM", { - CH(DIV_SYSTEM_SEGAPCM, 64, 0, "") + CH(DIV_SYSTEM_SEGAPCM, 1.0f, 0, "") } ); ENTRY( "Capcom QSound", { - CH(DIV_SYSTEM_QSOUND, 64, 0, "") + CH(DIV_SYSTEM_QSOUND, 1.0f, 0, "") } ); ENTRY( "Seta/Allumer X1-010", { - CH(DIV_SYSTEM_X1_010, 64, 0, "") + CH(DIV_SYSTEM_X1_010, 1.0f, 0, "") } ); ENTRY( "Yamaha YMZ280B (PCMD8)", { - CH(DIV_SYSTEM_YMZ280B, 64, 0, "") + CH(DIV_SYSTEM_YMZ280B, 1.0f, 0, "") } ); ENTRY( "Ricoh RF5C68", { - CH(DIV_SYSTEM_RF5C68, 64, 0, "") + CH(DIV_SYSTEM_RF5C68, 1.0f, 0, "") } ); ENTRY( "OKI MSM6258", { - CH(DIV_SYSTEM_MSM6258, 64, 0, "") + CH(DIV_SYSTEM_MSM6258, 1.0f, 0, "") } ); ENTRY( "OKI MSM6295", { - CH(DIV_SYSTEM_MSM6295, 64, 0, "") + CH(DIV_SYSTEM_MSM6295, 1.0f, 0, "") } ); ENTRY( "SNES", { - CH(DIV_SYSTEM_SNES, 64, 0, "") + CH(DIV_SYSTEM_SNES, 1.0f, 0, "") } ); ENTRY( "Konami K007232", { - CH(DIV_SYSTEM_K007232, 64, 0, "") + CH(DIV_SYSTEM_K007232, 1.0f, 0, "") } ); ENTRY( "Irem GA20", { - CH(DIV_SYSTEM_GA20, 64, 0, "") + CH(DIV_SYSTEM_GA20, 1.0f, 0, "") } ); ENTRY( "Generic PCM DAC", { - CH(DIV_SYSTEM_PCM_DAC, 64, 0, "") + CH(DIV_SYSTEM_PCM_DAC, 1.0f, 0, "") } ); CATEGORY_END; @@ -2429,70 +2429,70 @@ void FurnaceGUI::initSystemPresets() { CATEGORY_BEGIN("Wavetable","chips which use user-specified waveforms to generate sound."); ENTRY( "PC Engine", { - CH(DIV_SYSTEM_PCE, 64, 0, "") + CH(DIV_SYSTEM_PCE, 1.0f, 0, "") } ); ENTRY( "Commodore PET (pseudo-wavetable)", { - CH(DIV_SYSTEM_PET, 64, 0, "") + CH(DIV_SYSTEM_PET, 1.0f, 0, "") }, "tickRate=50" ); ENTRY( "Konami Bubble System WSG", { - CH(DIV_SYSTEM_BUBSYS_WSG, 64, 0, "") + CH(DIV_SYSTEM_BUBSYS_WSG, 1.0f, 0, "") } ); ENTRY( "Konami SCC", { - CH(DIV_SYSTEM_SCC, 64, 0, "") + CH(DIV_SYSTEM_SCC, 1.0f, 0, "") } ); ENTRY( "Konami SCC+", { - CH(DIV_SYSTEM_SCC_PLUS, 64, 0, "") + CH(DIV_SYSTEM_SCC_PLUS, 1.0f, 0, "") } ); ENTRY( "Namco WSG", { - CH(DIV_SYSTEM_NAMCO, 64, 0, "") + CH(DIV_SYSTEM_NAMCO, 1.0f, 0, "") } ); ENTRY( "Namco C15 (8-channel mono)", { - CH(DIV_SYSTEM_NAMCO_15XX, 64, 0, "") + CH(DIV_SYSTEM_NAMCO_15XX, 1.0f, 0, "") } ); ENTRY( "Namco C30 (8-channel stereo)", { - CH(DIV_SYSTEM_NAMCO_CUS30, 64, 0, "") + CH(DIV_SYSTEM_NAMCO_CUS30, 1.0f, 0, "") } ); ENTRY( "Namco 163", { - CH(DIV_SYSTEM_N163, 64, 0, "") + CH(DIV_SYSTEM_N163, 1.0f, 0, "") } ); ENTRY( "Famicom Disk System (chip)", { - CH(DIV_SYSTEM_FDS, 64, 0, "") + CH(DIV_SYSTEM_FDS, 1.0f, 0, "") } ); ENTRY( "WonderSwan", { - CH(DIV_SYSTEM_SWAN, 64, 0, "") + CH(DIV_SYSTEM_SWAN, 1.0f, 0, "") }, "tickRate=75.47169811320754716981" ); ENTRY( "Virtual Boy", { - CH(DIV_SYSTEM_VBOY, 64, 0, "") + CH(DIV_SYSTEM_VBOY, 1.0f, 0, "") }, "tickRate=50.2734877734878" ); ENTRY( "Seta/Allumer X1-010", { - CH(DIV_SYSTEM_X1_010, 64, 0, "") + CH(DIV_SYSTEM_X1_010, 1.0f, 0, "") } ); CATEGORY_END; @@ -2500,67 +2500,67 @@ void FurnaceGUI::initSystemPresets() { CATEGORY_BEGIN("Specialized","chips/systems with unique sound synthesis methods."); ENTRY( "MOS Technology SID (6581)", { - CH(DIV_SYSTEM_C64_6581, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_C64_6581, 1.0f, 0, "clockSel=1") }, "tickRate=50.1245421" ); ENTRY( "MOS Technology SID (8580)", { - CH(DIV_SYSTEM_C64_8580, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_C64_8580, 1.0f, 0, "clockSel=1") }, "tickRate=50.1245421" ); ENTRY( "Microchip AY8930", { - CH(DIV_SYSTEM_AY8930, 64, 0, "") + CH(DIV_SYSTEM_AY8930, 1.0f, 0, "") } ); ENTRY( "Game Boy", { - CH(DIV_SYSTEM_GB, 64, 0, "") + CH(DIV_SYSTEM_GB, 1.0f, 0, "") } ); ENTRY( "Atari Lynx", { - CH(DIV_SYSTEM_LYNX, 64, 0, "") + CH(DIV_SYSTEM_LYNX, 1.0f, 0, "") } ); ENTRY( "POKEY", { - CH(DIV_SYSTEM_POKEY, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_POKEY, 1.0f, 0, "clockSel=1") }, "tickRate=50" ); ENTRY( "Atari TIA", { - CH(DIV_SYSTEM_TIA, 64, 0, "") + CH(DIV_SYSTEM_TIA, 1.0f, 0, "") } ); ENTRY( "NES (Ricoh 2A03)", { - CH(DIV_SYSTEM_NES, 64, 0, "") + CH(DIV_SYSTEM_NES, 1.0f, 0, "") } ); ENTRY( "Commander X16 (VERA only)", { - CH(DIV_SYSTEM_VERA, 64, 0, "") + CH(DIV_SYSTEM_VERA, 1.0f, 0, "") } ); ENTRY( "ZX Spectrum (beeper only)", { - CH(DIV_SYSTEM_SFX_BEEPER, 64, 0, "") + CH(DIV_SYSTEM_SFX_BEEPER, 1.0f, 0, "") } ); if (settings.hiddenSystems) { ENTRY( "Dummy System", { - CH(DIV_SYSTEM_DUMMY, 64, 0, "") + CH(DIV_SYSTEM_DUMMY, 1.0f, 0, "") } ); } ENTRY( "tildearrow Sound Unit", { - CH(DIV_SYSTEM_SOUND_UNIT, 64, 0, "") + CH(DIV_SYSTEM_SOUND_UNIT, 1.0f, 0, "") } ); CATEGORY_END; @@ -2568,80 +2568,80 @@ void FurnaceGUI::initSystemPresets() { CATEGORY_BEGIN("DefleMask-compatible","these configurations are compatible with DefleMask.\nselect this if you need to save as .dmf or work with that program."); ENTRY( "Sega Genesis", { - CH(DIV_SYSTEM_YM2612, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 32, 0, "") + CH(DIV_SYSTEM_YM2612, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 0.5f, 0, "") } ); ENTRY( "Sega Genesis (extended channel 3)", { - CH(DIV_SYSTEM_YM2612_EXT, 64, 0, ""), - CH(DIV_SYSTEM_SMS, 32, 0, "") + CH(DIV_SYSTEM_YM2612_EXT, 1.0f, 0, ""), + CH(DIV_SYSTEM_SMS, 0.5f, 0, "") } ); ENTRY( "Sega Master System", { - CH(DIV_SYSTEM_SMS, 64, 0, "") + CH(DIV_SYSTEM_SMS, 1.0f, 0, "") } ); ENTRY( "Sega Master System (with FM expansion)", { - CH(DIV_SYSTEM_SMS, 64, 0, ""), - CH(DIV_SYSTEM_OPLL, 64, 0, "") + CH(DIV_SYSTEM_SMS, 1.0f, 0, ""), + CH(DIV_SYSTEM_OPLL, 1.0f, 0, "") } ); ENTRY( "Game Boy", { - CH(DIV_SYSTEM_GB, 64, 0, "") + CH(DIV_SYSTEM_GB, 1.0f, 0, "") } ); ENTRY( "NEC PC Engine/TurboGrafx-16", { - CH(DIV_SYSTEM_PCE, 64, 0, "") + CH(DIV_SYSTEM_PCE, 1.0f, 0, "") } ); ENTRY( "NES", { - CH(DIV_SYSTEM_NES, 64, 0, "") + CH(DIV_SYSTEM_NES, 1.0f, 0, "") } ); ENTRY( "Famicom with Konami VRC7", { - CH(DIV_SYSTEM_NES, 64, 0, ""), - CH(DIV_SYSTEM_VRC7, 64, 0, "") + CH(DIV_SYSTEM_NES, 1.0f, 0, ""), + CH(DIV_SYSTEM_VRC7, 1.0f, 0, "") } ); ENTRY( "Famicom Disk System", { - CH(DIV_SYSTEM_NES, 64, 0, ""), - CH(DIV_SYSTEM_FDS, 64, 0, "") + CH(DIV_SYSTEM_NES, 1.0f, 0, ""), + CH(DIV_SYSTEM_FDS, 1.0f, 0, "") } ); ENTRY( "Commodore 64 (6581 SID)", { - CH(DIV_SYSTEM_C64_6581, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_C64_6581, 1.0f, 0, "clockSel=1") }, "tickRate=50.1245421" ); ENTRY( "Commodore 64 (8580 SID)", { - CH(DIV_SYSTEM_C64_8580, 64, 0, "clockSel=1") + CH(DIV_SYSTEM_C64_8580, 1.0f, 0, "clockSel=1") }, "tickRate=50.1245421" ); ENTRY( "Arcade (YM2151 and SegaPCM)", { - CH(DIV_SYSTEM_YM2151, 64, 0, ""), - CH(DIV_SYSTEM_SEGAPCM_COMPAT, 64, 0, "") + CH(DIV_SYSTEM_YM2151, 1.0f, 0, ""), + CH(DIV_SYSTEM_SEGAPCM_COMPAT, 1.0f, 0, "") } ); ENTRY( "Neo Geo CD", { - CH(DIV_SYSTEM_YM2610, 64, 0, "") + CH(DIV_SYSTEM_YM2610, 1.0f, 0, "") } ); ENTRY( "Neo Geo CD (extended channel 2)", { - CH(DIV_SYSTEM_YM2610_EXT, 64, 0, "") + CH(DIV_SYSTEM_YM2610_EXT, 1.0f, 0, "") } ); CATEGORY_END; @@ -2654,7 +2654,7 @@ FurnaceGUISysDef::FurnaceGUISysDef(const char* n, std::initializer_listsong.systemLen; i++) { settings.initialSys.set(fmt::sprintf("id%d",i),e->systemToFileFur(e->song.system[i])); - settings.initialSys.set(fmt::sprintf("vol%d",i),(int)e->song.systemVol[i]); - settings.initialSys.set(fmt::sprintf("pan%d",i),(int)e->song.systemPan[i]); + settings.initialSys.set(fmt::sprintf("vol%d",i),(float)e->song.systemVol[i]); + settings.initialSys.set(fmt::sprintf("pan%d",i),(float)e->song.systemPan[i]); + settings.initialSys.set(fmt::sprintf("fr%d",i),(float)e->song.systemPanFR[i]); settings.initialSys.set(fmt::sprintf("flags%d",i),e->song.systemFlags[i].toBase64()); } settings.initialSysName=e->song.systemName; @@ -324,14 +325,16 @@ void FurnaceGUI::drawSettings() { if (totalAvailSys>0) { for (int i=0; isystemToFileFur((DivSystem)availableSystems[rand()%totalAvailSys])); - settings.initialSys.set(fmt::sprintf("vol%d",i),64); - settings.initialSys.set(fmt::sprintf("pan%d",i),0); + settings.initialSys.set(fmt::sprintf("vol%d",i),1.0f); + settings.initialSys.set(fmt::sprintf("pan%d",i),0.0f); + settings.initialSys.set(fmt::sprintf("fr%d",i),0.0f); settings.initialSys.set(fmt::sprintf("flags%d",i),""); } } else { settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_DUMMY)); - settings.initialSys.set("vol0",64); - settings.initialSys.set("pan0",0); + settings.initialSys.set("vol0",1.0f); + settings.initialSys.set("pan0",0.0f); + settings.initialSys.set("fr0",0.0f); settings.initialSys.set("flags0",""); howMany=1; } @@ -366,12 +369,14 @@ void FurnaceGUI::drawSettings() { if (ImGui::Button("Reset to defaults")) { settings.initialSys.clear(); settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_YM2612)); - settings.initialSys.set("vol0",64); - settings.initialSys.set("pan0",0); + settings.initialSys.set("vol0",1.0f); + settings.initialSys.set("pan0",0.0f); + settings.initialSys.set("fr0",0.0f); settings.initialSys.set("flags0",""); settings.initialSys.set("id1",e->systemToFileFur(DIV_SYSTEM_SMS)); - settings.initialSys.set("vol1",32); - settings.initialSys.set("pan1",0); + settings.initialSys.set("vol1",0.5f); + settings.initialSys.set("pan1",0.0f); + settings.initialSys.set("fr1",0.0f); settings.initialSys.set("flags1",""); settings.initialSysName="Sega Genesis/Mega Drive"; } @@ -385,14 +390,15 @@ void FurnaceGUI::drawSettings() { int doRemove=-1; for (size_t i=0; settings.initialSys.getInt(fmt::sprintf("id%d",i),0); i++) { DivSystem sysID=e->systemFromFileFur(settings.initialSys.getInt(fmt::sprintf("id%d",i),0)); - signed char sysVol=settings.initialSys.getInt(fmt::sprintf("vol%d",i),0); - signed char sysPan=settings.initialSys.getInt(fmt::sprintf("pan%d",i),0); + float sysVol=settings.initialSys.getFloat(fmt::sprintf("vol%d",i),0); + float sysPan=settings.initialSys.getFloat(fmt::sprintf("pan%d",i),0); + float sysPanFR=settings.initialSys.getFloat(fmt::sprintf("fr%d",i),0); sysCount=i+1; //bool doRemove=false; - bool doInvert=sysVol&128; - signed char vol=sysVol&127; + bool doInvert=(sysVol<0); + float vol=fabs(sysVol); ImGui::PushID(i); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::CalcTextSize("Invert").x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x); @@ -409,8 +415,8 @@ void FurnaceGUI::drawSettings() { ImGui::SameLine(); if (ImGui::Checkbox("Invert",&doInvert)) { - sysVol^=128; - settings.initialSys.set(fmt::sprintf("vol%d",i),(int)sysVol); + sysVol=-sysVol; + settings.initialSys.set(fmt::sprintf("vol%d",i),sysVol); } ImGui::SameLine(); //ImGui::BeginDisabled(settings.initialSys.size()<=4); @@ -418,14 +424,27 @@ void FurnaceGUI::drawSettings() { doRemove=i; } //ImGui::EndDisabled(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-(50.0f*dpiScale)); - if (CWSliderScalar("Volume",ImGuiDataType_S8,&vol,&_ZERO,&_ONE_HUNDRED_TWENTY_SEVEN)) { - sysVol=(sysVol&128)|vol; - settings.initialSys.set(fmt::sprintf("vol%d",i),(int)sysVol); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (CWSliderFloat("Volume",&vol,0.0f,3.0f)) { + if (doInvert) { + if (vol<0.0001) vol=0.0001; + } + if (vol<0) vol=0; + if (vol>10) vol=10; + sysVol=doInvert?-vol:vol; + settings.initialSys.set(fmt::sprintf("vol%d",i),(float)sysVol); } rightClickable - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-(50.0f*dpiScale)); - if (CWSliderScalar("Panning",ImGuiDataType_S8,&sysPan,&_MINUS_ONE_HUNDRED_TWENTY_SEVEN,&_ONE_HUNDRED_TWENTY_SEVEN)) { - settings.initialSys.set(fmt::sprintf("pan%d",i),(int)sysPan); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (CWSliderFloat("Panning",&sysPan,-1.0f,1.0f)) { + if (sysPan<-1.0f) sysPan=-1.0f; + if (sysPan>1.0f) sysPan=1.0f; + settings.initialSys.set(fmt::sprintf("pan%d",i),(float)sysPan); + } rightClickable + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (CWSliderFloat("Front/Rear",&sysPanFR,-1.0f,1.0f)) { + if (sysPanFR<-1.0f) sysPanFR=-1.0f; + if (sysPanFR>1.0f) sysPanFR=1.0f; + settings.initialSys.set(fmt::sprintf("fr%d",i),(float)sysPanFR); } rightClickable // oh please MSVC don't cry @@ -445,25 +464,29 @@ void FurnaceGUI::drawSettings() { if (doRemove>=0 && sysCount>1) { for (int i=doRemove; isystemToFileFur(DIV_SYSTEM_YM2612)); - settings.initialSys.set(fmt::sprintf("vol%d",sysCount),64); - settings.initialSys.set(fmt::sprintf("pan%d",sysCount),0); + settings.initialSys.set(fmt::sprintf("vol%d",sysCount),1.0f); + settings.initialSys.set(fmt::sprintf("pan%d",sysCount),0.0f); + settings.initialSys.set(fmt::sprintf("fr%d",sysCount),0.0f); settings.initialSys.set(fmt::sprintf("flags%d",sysCount),""); } @@ -2633,21 +2656,36 @@ void FurnaceGUI::syncSettings() { if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0; String initialSys2=e->getConfString("initialSys2",""); + bool oldVol=e->getConfInt("configVersion",DIV_ENGINE_VERSION)<135; if (initialSys2.empty()) { initialSys2=e->decodeSysDesc(e->getConfString("initialSys","")); + oldVol=false; } settings.initialSys.clear(); settings.initialSys.loadFromBase64(initialSys2.c_str()); if (settings.initialSys.getInt("id0",0)==0) { settings.initialSys.clear(); settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_YM2612)); - settings.initialSys.set("vol0",64); - settings.initialSys.set("pan0",0); + settings.initialSys.set("vol0",1.0f); + settings.initialSys.set("pan0",0.0f); + settings.initialSys.set("fr0",0.0f); settings.initialSys.set("flags0",""); settings.initialSys.set("id1",e->systemToFileFur(DIV_SYSTEM_SMS)); - settings.initialSys.set("vol1",64); + settings.initialSys.set("vol1",0.5f); settings.initialSys.set("pan1",0); + settings.initialSys.set("fr1",0); settings.initialSys.set("flags1",""); + } else { + if (oldVol) { + for (int i=0; settings.initialSys.getInt(fmt::sprintf("id%d",i),0); i++) { + float newVol=settings.initialSys.getInt(fmt::sprintf("vol%d",i),64); + float newPan=settings.initialSys.getInt(fmt::sprintf("pan%d",i),0); + newVol/=64.0f; + newPan/=127.0f; + settings.initialSys.set(fmt::sprintf("vol%d",i),newVol); + settings.initialSys.set(fmt::sprintf("pan%d",i),newPan); + } + } } // keybinds From 1154a2bda6a76bc63c56ab79f9b68de926503f98 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 6 Jan 2023 18:44:20 -0500 Subject: [PATCH 17/72] implement patchbay-based output --- papers/format.md | 10 +++---- src/engine/engine.cpp | 22 ++++++++++++++ src/engine/engine.h | 3 ++ src/engine/fileOps.cpp | 6 +++- src/engine/playback.cpp | 65 ++++++++++++++++++++++++++++------------- 5 files changed, 79 insertions(+), 27 deletions(-) diff --git a/papers/format.md b/papers/format.md index e4b01d2f..076729ec 100644 --- a/papers/format.md +++ b/papers/format.md @@ -410,14 +410,14 @@ a connection is represented as an unsigned int in the following format: a port is in the following format (hexadecimal): `xxxy` -- `xxx` (bit 4 to 15) represents an entity. -- `y` (bit 0 to 3) is the port of that entity. +- `xxx` (bit 4 to 15) represents a portset. +- `y` (bit 0 to 3) is the port in that portset. -reserved input entities: +reserved input portsets: - `000`: system outputs -- `FFF`: "null" entity +- `FFF`: "null" portset -reserved output entities: +reserved output portsets: - `000` through `01F`: chip outputs # subsong diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index de04a189..a99e443f 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -1466,6 +1466,7 @@ void DivEngine::createNew(const char* description, String sysName, bool inBase64 BUSY_END; initDispatch(); BUSY_BEGIN; + autoPatchbay(); renderSamples(); reset(); BUSY_END; @@ -3773,6 +3774,26 @@ bool DivEngine::moveSampleDown(int which) { return true; } +void DivEngine::autoPatchbay() { + song.patchbay.clear(); + for (unsigned int i=0; igetOutputCount(); + if (outs>16) outs=16; + if (outs<2) { + for (unsigned int j=0; j=chans) return; BUSY_BEGIN; @@ -4333,6 +4354,7 @@ bool DivEngine::init() { } initDispatch(); + if (!hasLoadedSomething || song.version<135) autoPatchbay(); renderSamples(); reset(); active=true; diff --git a/src/engine/engine.h b/src/engine/engine.h index a06684d9..0e5147a0 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -835,6 +835,9 @@ class DivEngine { bool moveWaveDown(int which); bool moveSampleDown(int which); + // automatic patchbay + void autoPatchbay(); + // play note void noteOn(int chan, int ins, int note, int vol=-1); diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index a2591f01..0503d03f 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -987,6 +987,7 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) { if (active) { initDispatch(); BUSY_BEGIN; + autoPatchbay(); renderSamples(); reset(); BUSY_END; @@ -2584,6 +2585,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { if (active) { initDispatch(); BUSY_BEGIN; + if (song.version<135) autoPatchbay(); renderSamples(); reset(); BUSY_END; @@ -3006,6 +3008,7 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) { if (active) { initDispatch(); BUSY_BEGIN; + autoPatchbay(); renderSamples(); reset(); BUSY_END; @@ -3176,7 +3179,7 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) { ds.systemLen=1; ds.system[0]=DIV_SYSTEM_AMIGA; - ds.systemVol[0]=64; + ds.systemVol[0]=1.0f; ds.systemPan[0]=0; ds.systemFlags[0].set("clockSel",1); // PAL ds.systemFlags[0].set("stereoSep",80); @@ -3689,6 +3692,7 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) { if (active) { initDispatch(); BUSY_BEGIN; + autoPatchbay(); renderSamples(); reset(); BUSY_END; diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index ad9a3470..f2c9098c 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -1720,30 +1720,53 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi disCont[i].fillBuf(disCont[i].runtotal,disCont[i].lastAvail,size-disCont[i].lastAvail); } - // TODO: patchbay - for (int i=0; igetPostAmp(); - volR*=disCont[i].dispatch->getPostAmp(); - if (disCont[i].dispatch->getOutputCount()>1) { - for (size_t j=0; jgetOutputCount()); - for (int k=0; k>16; + const unsigned short destPort=i&0xffff; + + const unsigned short srcPortSet=srcPort>>4; + const unsigned short destPortSet=destPort>>4; + const unsigned char srcSubPort=srcPort&15; + const unsigned char destSubPort=destPort&15; + + // null portset + if (destPortSet==0xfff) continue; + + // system outputs + if (destPortSet==0x000) { + if (destSubPort>=outChans) continue; + + // chip outputs + if (srcPortSetgetOutputCount()) { + float vol=song.systemVol[srcPortSet]*disCont[srcPortSet].dispatch->getPostAmp()*song.masterVol; + + switch (destSubPort&3) { + case 0: + vol*=MIN(1.0f,1.0f-song.systemPan[srcPortSet])*MIN(1.0f,1.0f-song.systemPanFR[srcPortSet]); + break; + case 1: + vol*=MIN(1.0f,1.0f+song.systemPan[srcPortSet])*MIN(1.0f,1.0f-song.systemPanFR[srcPortSet]); + break; + case 2: + vol*=MIN(1.0f,1.0f-song.systemPan[srcPortSet])*MIN(1.0f,1.0f+song.systemPanFR[srcPortSet]); + break; + case 3: + vol*=MIN(1.0f,1.0f+song.systemPan[srcPortSet])*MIN(1.0f,1.0f+song.systemPanFR[srcPortSet]); + break; + } + + for (size_t j=0; j Date: Sat, 7 Jan 2023 04:09:01 -0500 Subject: [PATCH 18/72] fix ear rape --- src/gui/settings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 289874ba..c375bdd7 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -2685,6 +2685,7 @@ void FurnaceGUI::syncSettings() { settings.initialSys.set(fmt::sprintf("vol%d",i),newVol); settings.initialSys.set(fmt::sprintf("pan%d",i),newPan); } + e->setConf("initialSys2",settings.initialSys.toBase64()); } } From 8e009509dbde543d2efdff6a30706b658eb2f02a Mon Sep 17 00:00:00 2001 From: Waldemar Pawlaszek Date: Sat, 7 Jan 2023 18:51:55 +0100 Subject: [PATCH 19/72] POKEY: audc is set for wrong channel when channels 3 & 4 are paired --- src/engine/platform/pokey.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/platform/pokey.cpp b/src/engine/platform/pokey.cpp index a79ec453..33e34842 100644 --- a/src/engine/platform/pokey.cpp +++ b/src/engine/platform/pokey.cpp @@ -241,7 +241,7 @@ void DivPlatformPOKEY::tick(bool sysTick) { chan[i].ctlChanged=false; if ((i==1 && audctl&16) || (i==3 && audctl&8)) { // ignore - channel is paired - } else if ((i==0 && audctl&16) || (i==0 && audctl&8)) { + } else if ((i==0 && audctl&16) || (i==2 && audctl&8)) { rWrite(1+(i<<1),0); rWrite(3+(i<<1),val); } else { From 4b85ec433baf31113ccae63027dd9e7ceb5298ce Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 7 Jan 2023 16:26:36 -0500 Subject: [PATCH 20/72] GUI: add mobile mixer --- src/gui/editControls.cpp | 7 +++++++ src/gui/gui.cpp | 5 +++++ src/gui/gui.h | 1 + src/gui/mixer.cpp | 9 ++++++++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/gui/editControls.cpp b/src/gui/editControls.cpp index 912665f6..173b64de 100644 --- a/src/gui/editControls.cpp +++ b/src/gui/editControls.cpp @@ -449,6 +449,10 @@ void FurnaceGUI::drawMobileControls() { mobScene=GUI_SCENE_CHIPS; } ImGui::TableNextColumn(); + if (ImGui::Button("Mixer",buttonSize)) { + mobScene=GUI_SCENE_MIXER; + } + ImGui::TableNextColumn(); if (ImGui::Button("Other",buttonSize)) { mobScene=GUI_SCENE_OTHER; } @@ -521,6 +525,9 @@ void FurnaceGUI::drawMobileControls() { case GUI_SCENE_CHIPS: ImGui::Text("Chips here..."); break; + case GUI_SCENE_MIXER: + ImGui::Text("What the hell..."); + break; case GUI_SCENE_OTHER: { if (ImGui::Button("Osc")) { oscOpen=!oscOpen; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 72195bb4..0b122a53 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -3863,6 +3863,11 @@ bool FurnaceGUI::loop() { curWindow=GUI_WINDOW_SYS_MANAGER; drawSysManager(); break; + case GUI_SCENE_MIXER: + mixerOpen=true; + curWindow=GUI_WINDOW_MIXER; + drawMixer(); + break; default: patternOpen=true; curWindow=GUI_WINDOW_PATTERN; diff --git a/src/gui/gui.h b/src/gui/gui.h index c4a78da7..dddaf923 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -325,6 +325,7 @@ enum FurnaceGUIMobileScenes { GUI_SCENE_SONG, GUI_SCENE_CHANNELS, GUI_SCENE_CHIPS, + GUI_SCENE_MIXER, GUI_SCENE_OTHER, }; diff --git a/src/gui/mixer.cpp b/src/gui/mixer.cpp index 9da9c644..d234e820 100644 --- a/src/gui/mixer.cpp +++ b/src/gui/mixer.cpp @@ -27,7 +27,14 @@ void FurnaceGUI::drawMixer() { nextWindow=GUI_WINDOW_NOTHING; } if (!mixerOpen) return; - ImGui::SetNextWindowSizeConstraints(ImVec2(400.0f*dpiScale,200.0f*dpiScale),ImVec2(canvasW,canvasH)); + if (mobileUI) { + patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*canvasH)):ImVec2((0.16*canvasH)+0.5*canvasW*mobileMenuPos,0.0f)); + patWindowSize=(portrait?ImVec2(canvasW,canvasH-(0.16*canvasW)):ImVec2(canvasW-(0.16*canvasH),canvasH)); + ImGui::SetNextWindowPos(patWindowPos); + ImGui::SetNextWindowSize(patWindowSize); + } else { + ImGui::SetNextWindowSizeConstraints(ImVec2(400.0f*dpiScale,200.0f*dpiScale),ImVec2(canvasW,canvasH)); + } if (ImGui::Begin("Mixer",&mixerOpen,globalWinFlags|(settings.allowEditDocking?0:ImGuiWindowFlags_NoDocking))) { char id[32]; if (ImGui::SliderFloat("Master Volume",&e->song.masterVol,0,3,"%.2fx")) { From e0785d9f0049d0afbf29ac9f971097668e938497 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 7 Jan 2023 16:39:01 -0500 Subject: [PATCH 21/72] fix front/rear being inverted --- src/engine/playback.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index f2c9098c..4d9a4e24 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -1744,17 +1744,17 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi switch (destSubPort&3) { case 0: - vol*=MIN(1.0f,1.0f-song.systemPan[srcPortSet])*MIN(1.0f,1.0f-song.systemPanFR[srcPortSet]); - break; - case 1: - vol*=MIN(1.0f,1.0f+song.systemPan[srcPortSet])*MIN(1.0f,1.0f-song.systemPanFR[srcPortSet]); - break; - case 2: vol*=MIN(1.0f,1.0f-song.systemPan[srcPortSet])*MIN(1.0f,1.0f+song.systemPanFR[srcPortSet]); break; - case 3: + case 1: vol*=MIN(1.0f,1.0f+song.systemPan[srcPortSet])*MIN(1.0f,1.0f+song.systemPanFR[srcPortSet]); break; + case 2: + vol*=MIN(1.0f,1.0f-song.systemPan[srcPortSet])*MIN(1.0f,1.0f-song.systemPanFR[srcPortSet]); + break; + case 3: + vol*=MIN(1.0f,1.0f+song.systemPan[srcPortSet])*MIN(1.0f,1.0f-song.systemPanFR[srcPortSet]); + break; } for (size_t j=0; j Date: Sat, 7 Jan 2023 19:46:57 -0500 Subject: [PATCH 22/72] GUI: prepare patchbay view --- src/gui/gui.cpp | 2 + src/gui/gui.h | 11 +++ src/gui/guiConst.cpp | 3 + src/gui/mixer.cpp | 182 ++++++++++++++++++++++++++++++++++--------- 4 files changed, 163 insertions(+), 35 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 0b122a53..715450e2 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -5729,6 +5729,8 @@ FurnaceGUI::FurnaceGUI(): zsmExportTickRate(60), macroPointSize(16), waveEditStyle(0), + selectedPortSet(0x1fff), + selectedSubPort(-1), displayInsTypeListMakeInsSample(-1), mobileEditPage(0), mobileMenuPos(0.0f), diff --git a/src/gui/gui.h b/src/gui/gui.h index dddaf923..86e02a27 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -270,6 +270,9 @@ enum FurnaceGUIColors { GUI_COLOR_CLOCK_BEAT_LOW, GUI_COLOR_CLOCK_BEAT_HIGH, + GUI_COLOR_PATCHBAY_PORTSET, + GUI_COLOR_PATCHBAY_PORT, + GUI_COLOR_LOGLEVEL_ERROR, GUI_COLOR_LOGLEVEL_WARNING, GUI_COLOR_LOGLEVEL_INFO, @@ -1109,6 +1112,11 @@ class FurnaceGUI { int zsmExportTickRate; int macroPointSize; int waveEditStyle; + // 0xxx: output + // 1xxx: input + unsigned int selectedPortSet; + // any value not between 0 and 15 are "none" + int selectedSubPort; int displayInsTypeListMakeInsSample; int mobileEditPage; float mobileMenuPos, autoButtonSize, mobileEditAnim; @@ -1760,6 +1768,9 @@ class FurnaceGUI { // inverted checkbox bool InvCheckbox(const char* label, bool* value); + // mixer stuff + bool portSet(String label, unsigned int portSetID, int ins, int outs); + void updateWindowTitle(); void autoDetectSystem(); void prepareLayout(); diff --git a/src/gui/guiConst.cpp b/src/gui/guiConst.cpp index f9092179..5ddd7342 100644 --- a/src/gui/guiConst.cpp +++ b/src/gui/guiConst.cpp @@ -896,6 +896,9 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={ D(GUI_COLOR_CLOCK_BEAT_LOW,"",ImVec4(0.1f,0.13f,0.25f,1.0f)), D(GUI_COLOR_CLOCK_BEAT_HIGH,"",ImVec4(0.5f,0.8f,1.0f,1.0f)), + D(GUI_COLOR_PATCHBAY_PORTSET,"",ImVec4(0.25f,0.25f,0.25f,1.0f)), + D(GUI_COLOR_PATCHBAY_PORT,"",ImVec4(0.5f,0.6f,0.6f,1.0f)), + D(GUI_COLOR_LOGLEVEL_ERROR,"",ImVec4(1.0f,0.2f,0.2f,1.0f)), D(GUI_COLOR_LOGLEVEL_WARNING,"",ImVec4(1.0f,1.0f,0.2f,1.0f)), D(GUI_COLOR_LOGLEVEL_INFO,"",ImVec4(0.4f,1.0f,0.4f,1.0f)), diff --git a/src/gui/mixer.cpp b/src/gui/mixer.cpp index d234e820..b7fb7d19 100644 --- a/src/gui/mixer.cpp +++ b/src/gui/mixer.cpp @@ -19,6 +19,87 @@ #include "gui.h" #include "intConst.h" +#include +#include "imgui_internal.h" + +bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs) { + String portID=fmt::sprintf("portSet%.4x",portSetID); + + ImDrawList* dl=ImGui::GetWindowDrawList(); + ImGuiWindow* window=ImGui::GetCurrentWindow(); + ImGuiStyle& style=ImGui::GetStyle(); + + ImVec2 labelSize=ImGui::CalcTextSize(label.c_str()); + + ImVec2 size=labelSize; + + // pad + size.x+=style.FramePadding.x*2.0f; + size.y+=style.FramePadding.y*2.0f; + + // space for ports + size.y+=MAX(ins,outs)*labelSize.y+style.FramePadding.y*2.0f+style.ItemSpacing.y; + + ImVec4 portSetBorderColor=uiColors[GUI_COLOR_PATCHBAY_PORTSET]; + ImVec4 portSetColor=ImVec4( + portSetBorderColor.x*0.75f, + portSetBorderColor.y*0.75f, + portSetBorderColor.z*0.75f, + portSetBorderColor.w + ); + + ImVec4 portBorderColor=uiColors[GUI_COLOR_PATCHBAY_PORT]; + ImVec4 portColor=ImVec4( + portBorderColor.x*0.75f, + portBorderColor.y*0.75f, + portBorderColor.z*0.75f, + portBorderColor.w + ); + + ImVec2 minArea=window->DC.CursorPos; + ImVec2 maxArea=ImVec2( + minArea.x+size.x, + minArea.y+size.y + ); + ImRect rect=ImRect(minArea,maxArea); + + ImVec2 textPos=ImVec2( + minArea.x+style.FramePadding.x, + minArea.y+style.FramePadding.y + ); + + ImGui::ItemSize(size,style.FramePadding.y); + if (ImGui::ItemAdd(rect,ImGui::GetID(portID.c_str()))) { + // label + dl->AddRectFilled(minArea,maxArea,ImGui::GetColorU32(portSetColor),0.0f); + dl->AddRect(minArea,maxArea,ImGui::GetColorU32(portSetBorderColor),0.0f,dpiScale); + dl->AddText(textPos,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),label.c_str()); + + // ports + for (int i=0; iAddRectFilled(portMin,portMax,ImGui::GetColorU32(portColor),0.0f); + dl->AddRect(portMin,portMax,ImGui::GetColorU32(portBorderColor),0.0f,dpiScale); + dl->AddText(portLabelPos,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),portLabel.c_str()); + } + } + + return false; +} void FurnaceGUI::drawMixer() { if (nextWindow==GUI_WINDOW_MIXER) { @@ -36,48 +117,79 @@ void FurnaceGUI::drawMixer() { ImGui::SetNextWindowSizeConstraints(ImVec2(400.0f*dpiScale,200.0f*dpiScale),ImVec2(canvasW,canvasH)); } if (ImGui::Begin("Mixer",&mixerOpen,globalWinFlags|(settings.allowEditDocking?0:ImGuiWindowFlags_NoDocking))) { - char id[32]; if (ImGui::SliderFloat("Master Volume",&e->song.masterVol,0,3,"%.2fx")) { if (e->song.masterVol<0) e->song.masterVol=0; if (e->song.masterVol>3) e->song.masterVol=3; MARK_MODIFIED; } rightClickable - for (int i=0; isong.systemLen; i++) { - snprintf(id,31,"MixS%d",i); - bool doInvert=e->song.systemVol[i]<0; - float vol=fabs(e->song.systemVol[i]); - ImGui::PushID(id); - ImGui::Text("%d. %s",i+1,getSystemName(e->song.system[i])); - ImGui::SameLine(ImGui::GetWindowWidth()-(82.0f*dpiScale)); - if (ImGui::Checkbox("Invert",&doInvert)) { - e->song.systemVol[i]=-e->song.systemVol[i]; - MARK_MODIFIED; - } - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (CWSliderFloat("Volume",&vol,0,2)) { - if (doInvert) { - if (vol<0.0001) vol=0.0001; - } - if (vol<0) vol=0; - if (vol>10) vol=10; - e->song.systemVol[i]=(doInvert)?-vol:vol; - MARK_MODIFIED; - } rightClickable - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (CWSliderFloat("Panning",&e->song.systemPan[i],-1.0f,1.0f)) { - if (e->song.systemPan[i]<-1.0f) e->song.systemPan[i]=-1.0f; - if (e->song.systemPan[i]>1.0f) e->song.systemPan[i]=1.0f; - MARK_MODIFIED; - } rightClickable - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (CWSliderFloat("Front/Rear",&e->song.systemPanFR[i],-1.0f,1.0f)) { - if (e->song.systemPanFR[i]<-1.0f) e->song.systemPanFR[i]=-1.0f; - if (e->song.systemPanFR[i]>1.0f) e->song.systemPanFR[i]=1.0f; - MARK_MODIFIED; - } rightClickable + if (selectedPortSetsong.systemLen) { + if (ImGui::BeginTable("CurPortSet",2)) { + ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch); + ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed); - ImGui::PopID(); + bool doInvert=e->song.systemVol[selectedPortSet]<0; + float vol=fabs(e->song.systemVol[selectedPortSet]); + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::Text("%d. %s",selectedPortSet+1,getSystemName(e->song.system[selectedPortSet])); + ImGui::TableNextColumn(); + if (ImGui::Checkbox("Invert",&doInvert)) { + e->song.systemVol[selectedPortSet]=-e->song.systemVol[selectedPortSet]; + MARK_MODIFIED; + } + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (CWSliderFloat("##Volume",&vol,0,2)) { + if (doInvert) { + if (vol<0.0001) vol=0.0001; + } + if (vol<0) vol=0; + if (vol>10) vol=10; + e->song.systemVol[selectedPortSet]=(doInvert)?-vol:vol; + MARK_MODIFIED; + } rightClickable + ImGui::TableNextColumn(); + ImGui::Text("Volume"); + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (CWSliderFloat("##Panning",&e->song.systemPan[selectedPortSet],-1.0f,1.0f)) { + if (e->song.systemPan[selectedPortSet]<-1.0f) e->song.systemPan[selectedPortSet]=-1.0f; + if (e->song.systemPan[selectedPortSet]>1.0f) e->song.systemPan[selectedPortSet]=1.0f; + MARK_MODIFIED; + } rightClickable + ImGui::TableNextColumn(); + ImGui::Text("Panning"); + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (CWSliderFloat("##FrontRear",&e->song.systemPanFR[selectedPortSet],-1.0f,1.0f)) { + if (e->song.systemPanFR[selectedPortSet]<-1.0f) e->song.systemPanFR[selectedPortSet]=-1.0f; + if (e->song.systemPanFR[selectedPortSet]>1.0f) e->song.systemPanFR[selectedPortSet]=1.0f; + MARK_MODIFIED; + } rightClickable + ImGui::TableNextColumn(); + ImGui::Text("Front/Rear"); + + ImGui::EndTable(); + } } + if (ImGui::BeginChild("Patchbay",ImVec2(0,0),true)) { + ImGui::Text("The patchbay goes here..."); + for (int i=0; isong.systemLen; i++) { + DivDispatch* dispatch=e->getDispatch(i); + if (dispatch==NULL) continue; + if (portSet(fmt::sprintf("%d. %s",i+1,getSystemName(e->song.system[i])),i,0,dispatch->getOutputCount())) { + selectedPortSet=i; + } + } + } + ImGui::EndChild(); } if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_MIXER; ImGui::End(); From 9b79bc0e7b50b8406dce9e5faa26392f966ae7eb Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 8 Jan 2023 19:23:17 -0500 Subject: [PATCH 23/72] GUI: it doesn't work! --- src/engine/engine.cpp | 28 ++++++++ src/engine/engine.h | 8 +++ src/gui/gui.h | 3 +- src/gui/guiConst.cpp | 3 +- src/gui/mixer.cpp | 151 +++++++++++++++++++++++++++++++++++++----- 5 files changed, 176 insertions(+), 17 deletions(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index a99e443f..14fa8eec 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -3794,6 +3794,34 @@ void DivEngine::autoPatchbay() { } } +bool DivEngine::patchConnect(unsigned int src, unsigned int dest) { + unsigned int armed=(src<<16)|(dest&0xffff); + for (unsigned int i: song.patchbay) { + if (i==armed) return false; + } + BUSY_BEGIN; + saveLock.lock(); + song.patchbay.push_back(armed); + saveLock.unlock(); + BUSY_END; + return true; +} + +bool DivEngine::patchDisconnect(unsigned int src, unsigned int dest) { + unsigned int armed=(src<<16)|(dest&0xffff); + for (auto i=song.patchbay.begin(); i!=song.patchbay.end(); i++) { + if (*i==armed) { + BUSY_BEGIN; + saveLock.lock(); + song.patchbay.erase(i); + saveLock.unlock(); + BUSY_END; + return true; + } + } + return false; +} + void DivEngine::noteOn(int chan, int ins, int note, int vol) { if (chan<0 || chan>=chans) return; BUSY_BEGIN; diff --git a/src/engine/engine.h b/src/engine/engine.h index 0e5147a0..88029651 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -838,6 +838,14 @@ class DivEngine { // automatic patchbay void autoPatchbay(); + // connect in patchbay + // returns false if connection already made + bool patchConnect(unsigned int src, unsigned int dest); + + // disconnect in patchbay + // returns false if connection doesn't exist + bool patchDisconnect(unsigned int src, unsigned int dest); + // play note void noteOn(int chan, int ins, int note, int vol=-1); diff --git a/src/gui/gui.h b/src/gui/gui.h index 86e02a27..00a29c15 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -272,6 +272,7 @@ enum FurnaceGUIColors { GUI_COLOR_PATCHBAY_PORTSET, GUI_COLOR_PATCHBAY_PORT, + GUI_COLOR_PATCHBAY_CONNECTION, GUI_COLOR_LOGLEVEL_ERROR, GUI_COLOR_LOGLEVEL_WARNING, @@ -1769,7 +1770,7 @@ class FurnaceGUI { bool InvCheckbox(const char* label, bool* value); // mixer stuff - bool portSet(String label, unsigned int portSetID, int ins, int outs); + bool portSet(String label, unsigned int portSetID, int ins, int outs, int activeIns, int activeOuts, int& clickedPort, std::map& portPos); void updateWindowTitle(); void autoDetectSystem(); diff --git a/src/gui/guiConst.cpp b/src/gui/guiConst.cpp index 5ddd7342..ca13a0cf 100644 --- a/src/gui/guiConst.cpp +++ b/src/gui/guiConst.cpp @@ -897,7 +897,8 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={ D(GUI_COLOR_CLOCK_BEAT_HIGH,"",ImVec4(0.5f,0.8f,1.0f,1.0f)), D(GUI_COLOR_PATCHBAY_PORTSET,"",ImVec4(0.25f,0.25f,0.25f,1.0f)), - D(GUI_COLOR_PATCHBAY_PORT,"",ImVec4(0.5f,0.6f,0.6f,1.0f)), + D(GUI_COLOR_PATCHBAY_PORT,"",ImVec4(0.3f,0.6f,0.6f,1.0f)), + D(GUI_COLOR_PATCHBAY_CONNECTION,"",ImVec4(0.2f,0.5f,0.6f,1.0f)), D(GUI_COLOR_LOGLEVEL_ERROR,"",ImVec4(1.0f,0.2f,0.2f,1.0f)), D(GUI_COLOR_LOGLEVEL_WARNING,"",ImVec4(1.0f,1.0f,0.2f,1.0f)), diff --git a/src/gui/mixer.cpp b/src/gui/mixer.cpp index b7fb7d19..8c7b0856 100644 --- a/src/gui/mixer.cpp +++ b/src/gui/mixer.cpp @@ -20,9 +20,15 @@ #include "gui.h" #include "intConst.h" #include +#include "../ta-log.h" #include "imgui_internal.h" -bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs) { +const char* portNamesStereo[2]={ + "left", + "right" +}; + +bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs, int activeIns, int activeOuts, int& clickedPort, std::map& portPos) { String portID=fmt::sprintf("portSet%.4x",portSetID); ImDrawList* dl=ImGui::GetWindowDrawList(); @@ -38,7 +44,7 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs size.y+=style.FramePadding.y*2.0f; // space for ports - size.y+=MAX(ins,outs)*labelSize.y+style.FramePadding.y*2.0f+style.ItemSpacing.y; + size.y+=MAX(ins,outs)*(labelSize.y+style.FramePadding.y+style.ItemSpacing.y); ImVec4 portSetBorderColor=uiColors[GUI_COLOR_PATCHBAY_PORTSET]; ImVec4 portSetColor=ImVec4( @@ -70,32 +76,129 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs ImGui::ItemSize(size,style.FramePadding.y); if (ImGui::ItemAdd(rect,ImGui::GetID(portID.c_str()))) { + bool hovered=ImGui::ItemHoverable(rect,ImGui::GetID(portID.c_str())); + bool active=(hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Left)); + + + if (active) clickedPort=-1; + // label dl->AddRectFilled(minArea,maxArea,ImGui::GetColorU32(portSetColor),0.0f); dl->AddRect(minArea,maxArea,ImGui::GetColorU32(portSetBorderColor),0.0f,dpiScale); dl->AddText(textPos,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),label.c_str()); - // ports - for (int i=0; i2) { + portLabel=fmt::sprintf("%d",i+1); + } ImVec2 portLabelSize=ImGui::CalcTextSize(portLabel.c_str()); ImVec2 portMin=ImVec2( - maxArea.x-portLabelSize.x-style.FramePadding.x*2, - minArea.y+style.FramePadding.y+labelSize.y+(style.ItemSpacing.y+portLabelSize.y+style.FramePadding.y*2)*i + minArea.x, + minArea.y+style.FramePadding.y+labelSize.y+style.ItemSpacing.y+(style.ItemSpacing.y+portLabelSize.y+style.FramePadding.y)*i + ); + ImVec2 portMax=ImVec2( + minArea.x+portLabelSize.x+style.FramePadding.x, + portMin.y+style.FramePadding.y+portLabelSize.y + ); + ImRect portRect=ImRect(portMin,portMax); + ImVec2 portLabelPos=portMin; + portLabelPos.x+=style.FramePadding.x*0.5; + portLabelPos.y+=style.FramePadding.y*0.5; + + portPos[(portSetID<<4)|i]=ImLerp(portMin,portMax,ImVec2(0.0f,0.5f)); + + if (ImGui::ItemAdd(portRect,ImGui::GetID(subPortID.c_str()))) { + ImGui::KeepAliveID(ImGui::GetID(subPortID.c_str())); + dl->AddRectFilled(portMin,portMax,ImGui::GetColorU32(portColor),0.0f); + dl->AddRect(portMin,portMax,ImGui::GetColorU32(portBorderColor),0.0f,dpiScale); + dl->AddText(portLabelPos,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),portLabel.c_str()); + + ImGui::ItemHoverable(portRect,ImGui::GetID(subPortID.c_str())); + + // connection + if (ImGui::BeginDragDropSource()) { + // set up + ImGui::SetDragDropPayload("FUR_PBIN",NULL,0,ImGuiCond_Once); + logV("bdds"); + ImGui::EndDragDropSource(); + } + if (ImGui::BeginDragDropTarget()) { + const ImGuiPayload* dragItem=ImGui::AcceptDragDropPayload("FUR_PBIN"); + if (dragItem!=NULL) { + if (dragItem->IsDataType("FUR_PBIN")) { + } + } + ImGui::EndDragDropTarget(); + } + } + + if (active) { + if (ImGui::IsMouseHoveringRect(portMin,portMax)) clickedPort=i; + } + } + + // output ports + for (int i=0; i2) { + portLabel=fmt::sprintf("%d",i+1); + } + ImVec2 portLabelSize=ImGui::CalcTextSize(portLabel.c_str()); + + ImVec2 portMin=ImVec2( + maxArea.x-portLabelSize.x-style.FramePadding.x, + minArea.y+style.FramePadding.y+labelSize.y+style.ItemSpacing.y+(style.ItemSpacing.y+portLabelSize.y+style.FramePadding.y)*i ); ImVec2 portMax=ImVec2( maxArea.x, - minArea.y+style.FramePadding.y+labelSize.y+portLabelSize.y+style.FramePadding.y*2+(style.ItemSpacing.y+portLabelSize.y+style.FramePadding.y*2)*i + portMin.y+style.FramePadding.y+portLabelSize.y ); + ImRect portRect=ImRect(portMin,portMax); ImVec2 portLabelPos=portMin; - portLabelPos.x+=style.FramePadding.x; - portLabelPos.y+=style.FramePadding.y; + portLabelPos.x+=style.FramePadding.x*0.5; + portLabelPos.y+=style.FramePadding.y*0.5; - dl->AddRectFilled(portMin,portMax,ImGui::GetColorU32(portColor),0.0f); - dl->AddRect(portMin,portMax,ImGui::GetColorU32(portBorderColor),0.0f,dpiScale); - dl->AddText(portLabelPos,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),portLabel.c_str()); + portPos[(portSetID<<4)|i]=ImLerp(portMin,portMax,ImVec2(1.0f,0.5f)); + + if (ImGui::ItemAdd(portRect,ImGui::GetID(subPortID.c_str()))) { + dl->AddRectFilled(portMin,portMax,ImGui::GetColorU32(portColor),0.0f); + dl->AddRect(portMin,portMax,ImGui::GetColorU32(portBorderColor),0.0f,dpiScale); + dl->AddText(portLabelPos,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),portLabel.c_str()); + + ImGui::ItemHoverable(portRect,ImGui::GetID(subPortID.c_str())); + + // connection + if (ImGui::BeginDragDropSource()) { + // set up + ImGui::SetDragDropPayload("FUR_PBIN",NULL,0,ImGuiCond_Once); + logV("bdds"); + ImGui::EndDragDropSource(); + } + if (ImGui::BeginDragDropTarget()) { + const ImGuiPayload* dragItem=ImGui::AcceptDragDropPayload("FUR_PBIN"); + if (dragItem!=NULL) { + if (dragItem->IsDataType("FUR_PBIN")) { + } + } + ImGui::EndDragDropTarget(); + } + } + + if (active) { + if (ImGui::IsMouseHoveringRect(portMin,portMax)) clickedPort=i; + } } + + if (hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Left)) return true; } return false; @@ -117,6 +220,7 @@ void FurnaceGUI::drawMixer() { ImGui::SetNextWindowSizeConstraints(ImVec2(400.0f*dpiScale,200.0f*dpiScale),ImVec2(canvasW,canvasH)); } if (ImGui::Begin("Mixer",&mixerOpen,globalWinFlags|(settings.allowEditDocking?0:ImGuiWindowFlags_NoDocking))) { + std::map portPos; if (ImGui::SliderFloat("Master Volume",&e->song.masterVol,0,3,"%.2fx")) { if (e->song.masterVol<0) e->song.masterVol=0; if (e->song.masterVol>3) e->song.masterVol=3; @@ -180,14 +284,31 @@ void FurnaceGUI::drawMixer() { } } if (ImGui::BeginChild("Patchbay",ImVec2(0,0),true)) { - ImGui::Text("The patchbay goes here..."); + ImVec2 topPos=ImGui::GetCursorPos(); + topPos.x+=ImGui::GetContentRegionAvail().x-60.0*dpiScale; for (int i=0; isong.systemLen; i++) { DivDispatch* dispatch=e->getDispatch(i); if (dispatch==NULL) continue; - if (portSet(fmt::sprintf("%d. %s",i+1,getSystemName(e->song.system[i])),i,0,dispatch->getOutputCount())) { + int outputs=dispatch->getOutputCount(); + if (portSet(fmt::sprintf("%d. %s",i+1,getSystemName(e->song.system[i])),i,0,outputs,0,outputs,selectedSubPort,portPos)) { selectedPortSet=i; } } + ImGui::SetCursorPos(topPos); + if (portSet("System",0x1000,e->getAudioDescGot().outChans,0,e->getAudioDescGot().outChans,0,selectedSubPort,portPos)) { + selectedPortSet=0x1000; + } + + // draw connections + ImDrawList* dl=ImGui::GetWindowDrawList(); + for (unsigned int i: e->song.patchbay) { + try { + ImVec2 portSrc=portPos.at(i>>16); + ImVec2 portDest=portPos.at(0x10000|(i&0xffff)); + dl->AddLine(portSrc,portDest,ImGui::GetColorU32(uiColors[GUI_COLOR_PATCHBAY_CONNECTION]),2.0f*dpiScale); + } catch (std::out_of_range& e) { + } + } } ImGui::EndChild(); } From 4bc2418dd6b02c2b7d749f7385bd8bcdfc7912d1 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 10 Jan 2023 14:17:06 -0500 Subject: [PATCH 24/72] GUI: patchbay connection some improvements left to do --- src/gui/gui.cpp | 8 +++- src/gui/gui.h | 16 +++++--- src/gui/mixer.cpp | 98 +++++++++++++++++++++++++++-------------------- 3 files changed, 73 insertions(+), 49 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 715450e2..44a38245 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -5729,8 +5729,6 @@ FurnaceGUI::FurnaceGUI(): zsmExportTickRate(60), macroPointSize(16), waveEditStyle(0), - selectedPortSet(0x1fff), - selectedSubPort(-1), displayInsTypeListMakeInsSample(-1), mobileEditPage(0), mobileMenuPos(0.0f), @@ -6023,6 +6021,12 @@ FurnaceGUI::FurnaceGUI(): openSampleAmplifyOpt(false), openSampleSilenceOpt(false), openSampleFilterOpt(false), + selectedPortSet(0x1fff), + selectedSubPort(-1), + hoveredPortSet(0x1fff), + hoveredSubPort(-1), + portDragActive(false), + subPortPos(0.0f,0.0f), oscTotal(0), oscZoom(0.5f), oscWindowSize(20.0f), diff --git a/src/gui/gui.h b/src/gui/gui.h index 00a29c15..6100efc0 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1113,11 +1113,6 @@ class FurnaceGUI { int zsmExportTickRate; int macroPointSize; int waveEditStyle; - // 0xxx: output - // 1xxx: input - unsigned int selectedPortSet; - // any value not between 0 and 15 are "none" - int selectedSubPort; int displayInsTypeListMakeInsSample; int mobileEditPage; float mobileMenuPos, autoButtonSize, mobileEditAnim; @@ -1661,6 +1656,17 @@ class FurnaceGUI { size_t sampleClipboardLen; bool openSampleResizeOpt, openSampleResampleOpt, openSampleAmplifyOpt, openSampleSilenceOpt, openSampleFilterOpt; + // mixer + // 0xxx: output + // 1xxx: input + unsigned int selectedPortSet; + // any value not between 0 and 15 are "none" + int selectedSubPort; + unsigned int hoveredPortSet; + int hoveredSubPort; + bool portDragActive; + ImVec2 subPortPos; + // oscilloscope int oscTotal; float oscValues[512]; diff --git a/src/gui/mixer.cpp b/src/gui/mixer.cpp index 8c7b0856..2ba6fbef 100644 --- a/src/gui/mixer.cpp +++ b/src/gui/mixer.cpp @@ -80,6 +80,7 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs bool active=(hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Left)); + if (hovered) hoveredPortSet=portSetID; if (active) clickedPort=-1; // label @@ -114,32 +115,14 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs portPos[(portSetID<<4)|i]=ImLerp(portMin,portMax,ImVec2(0.0f,0.5f)); if (ImGui::ItemAdd(portRect,ImGui::GetID(subPortID.c_str()))) { - ImGui::KeepAliveID(ImGui::GetID(subPortID.c_str())); dl->AddRectFilled(portMin,portMax,ImGui::GetColorU32(portColor),0.0f); dl->AddRect(portMin,portMax,ImGui::GetColorU32(portBorderColor),0.0f,dpiScale); dl->AddText(portLabelPos,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),portLabel.c_str()); - - ImGui::ItemHoverable(portRect,ImGui::GetID(subPortID.c_str())); - - // connection - if (ImGui::BeginDragDropSource()) { - // set up - ImGui::SetDragDropPayload("FUR_PBIN",NULL,0,ImGuiCond_Once); - logV("bdds"); - ImGui::EndDragDropSource(); - } - if (ImGui::BeginDragDropTarget()) { - const ImGuiPayload* dragItem=ImGui::AcceptDragDropPayload("FUR_PBIN"); - if (dragItem!=NULL) { - if (dragItem->IsDataType("FUR_PBIN")) { - } - } - ImGui::EndDragDropTarget(); - } } - if (active) { - if (ImGui::IsMouseHoveringRect(portMin,portMax)) clickedPort=i; + if (ImGui::IsMouseHoveringRect(portMin,portMax)) { + hoveredSubPort=i; + if (active) clickedPort=i; } } @@ -173,28 +156,11 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs dl->AddRectFilled(portMin,portMax,ImGui::GetColorU32(portColor),0.0f); dl->AddRect(portMin,portMax,ImGui::GetColorU32(portBorderColor),0.0f,dpiScale); dl->AddText(portLabelPos,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),portLabel.c_str()); - - ImGui::ItemHoverable(portRect,ImGui::GetID(subPortID.c_str())); - - // connection - if (ImGui::BeginDragDropSource()) { - // set up - ImGui::SetDragDropPayload("FUR_PBIN",NULL,0,ImGuiCond_Once); - logV("bdds"); - ImGui::EndDragDropSource(); - } - if (ImGui::BeginDragDropTarget()) { - const ImGuiPayload* dragItem=ImGui::AcceptDragDropPayload("FUR_PBIN"); - if (dragItem!=NULL) { - if (dragItem->IsDataType("FUR_PBIN")) { - } - } - ImGui::EndDragDropTarget(); - } } - if (active) { - if (ImGui::IsMouseHoveringRect(portMin,portMax)) clickedPort=i; + if (ImGui::IsMouseHoveringRect(portMin,portMax)) { + if (active) clickedPort=i; + hoveredSubPort=i; } } @@ -283,24 +249,72 @@ void FurnaceGUI::drawMixer() { ImGui::EndTable(); } } + + hoveredPortSet=0x1fff; + hoveredSubPort=-1; + if (ImGui::BeginChild("Patchbay",ImVec2(0,0),true)) { + ImDrawList* dl=ImGui::GetWindowDrawList(); ImVec2 topPos=ImGui::GetCursorPos(); topPos.x+=ImGui::GetContentRegionAvail().x-60.0*dpiScale; + + if (portDragActive) { + dl->AddLine(subPortPos,ImGui::GetMousePos(),ImGui::GetColorU32(uiColors[GUI_COLOR_PATCHBAY_CONNECTION]),2.0f*dpiScale); + } + for (int i=0; isong.systemLen; i++) { DivDispatch* dispatch=e->getDispatch(i); if (dispatch==NULL) continue; int outputs=dispatch->getOutputCount(); if (portSet(fmt::sprintf("%d. %s",i+1,getSystemName(e->song.system[i])),i,0,outputs,0,outputs,selectedSubPort,portPos)) { selectedPortSet=i; + if (selectedSubPort>=0) { + portDragActive=true; + try { + subPortPos=portPos.at((selectedPortSet<<4)|selectedSubPort); + } catch (std::out_of_range& e) { + portDragActive=false; + } + } } } ImGui::SetCursorPos(topPos); if (portSet("System",0x1000,e->getAudioDescGot().outChans,0,e->getAudioDescGot().outChans,0,selectedSubPort,portPos)) { selectedPortSet=0x1000; + if (selectedSubPort>=0) { + portDragActive=true; + try { + subPortPos=portPos.at((selectedPortSet<<4)|selectedSubPort); + } catch (std::out_of_range& e) { + portDragActive=false; + } + } + } + + if (portDragActive) { + if (ImGui::IsMouseReleased(ImGuiMouseButton_Left)) { + portDragActive=false; + if (hoveredPortSet!=0x1fff && hoveredSubPort>=0) { + unsigned int src=(selectedPortSet<<4)|selectedSubPort; + unsigned int dest=(hoveredPortSet<<4)|hoveredSubPort; + + if (src&0x10000) { + src^=dest; + dest^=src; + src^=dest; + } + + src&=0xffff; + dest&=0xffff; + + if (!e->patchConnect(src,dest)) { + e->patchDisconnect(src,dest); + } + } + } } // draw connections - ImDrawList* dl=ImGui::GetWindowDrawList(); for (unsigned int i: e->song.patchbay) { try { ImVec2 portSrc=portPos.at(i>>16); From 02838e0a07499a3ce3ada85e289be5cdfc2965bd Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 10 Jan 2023 14:25:25 -0500 Subject: [PATCH 25/72] GUI: prevent patchbay from moving up and down --- src/gui/mixer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/mixer.cpp b/src/gui/mixer.cpp index 2ba6fbef..9cbe1674 100644 --- a/src/gui/mixer.cpp +++ b/src/gui/mixer.cpp @@ -248,6 +248,8 @@ void FurnaceGUI::drawMixer() { ImGui::EndTable(); } + } else { + ImGui::Dummy(ImVec2(1.0f,ImGui::GetFrameHeightWithSpacing()*4.0f)); } hoveredPortSet=0x1fff; From 2fbec000d785257f49ae1f0b9e5cef4da6d994d0 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 10 Jan 2023 15:58:15 -0500 Subject: [PATCH 26/72] dev136 - add auto patchbay toggle --- papers/format.md | 2 ++ src/engine/engine.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++ src/engine/engine.h | 5 ++-- src/engine/fileOps.cpp | 3 +++ src/engine/song.h | 4 ++- src/gui/gui.cpp | 1 + src/gui/gui.h | 2 +- src/gui/mixer.cpp | 11 +++++++-- 8 files changed, 78 insertions(+), 6 deletions(-) diff --git a/papers/format.md b/papers/format.md index 076729ec..d8ec4bbf 100644 --- a/papers/format.md +++ b/papers/format.md @@ -32,6 +32,7 @@ these fields are 0 in format versions prior to 100 (0.6pre1). the format versions are: +- 136: Furnace dev136 - 135: Furnace dev135 - 134: Furnace dev134 - 133: Furnace 0.6pre3 @@ -396,6 +397,7 @@ size | description 4 | patchbay connection count 4?? | patchbay | - see next section for more details. + 1 | automatic patchbay (>=136) ``` # patchbay diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 14fa8eec..8b8849aa 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -1693,6 +1693,27 @@ bool DivEngine::addSystem(DivSystem which) { BUSY_END; initDispatch(); BUSY_BEGIN; + saveLock.lock(); + if (song.patchbayAuto) { + autoPatchbay(); + } else { + int i=song.systemLen-1; + if (disCont[i].dispatch!=NULL) { + unsigned int outs=disCont[i].dispatch->getOutputCount(); + if (outs>16) outs=16; + if (outs<2) { + for (unsigned int j=0; j>20)&0xfff)==index) { + song.patchbay.erase(song.patchbay.begin()+i); + i--; + } + } + song.system[index]=DIV_SYSTEM_NULL; song.systemLen--; for (int i=index; i>20)&0xfff)==src) { + i=(i&(~0xfff00000))|((unsigned int)dest<<20); + } else if (((i>>20)&0xfff)==dest) { + i=(i&(~0xfff00000))|((unsigned int)src<<20); + } + } + recalcChans(); saveLock.unlock(); BUSY_END; @@ -3794,6 +3832,14 @@ void DivEngine::autoPatchbay() { } } +void DivEngine::autoPatchbayP() { + BUSY_BEGIN; + saveLock.lock(); + autoPatchbay(); + saveLock.unlock(); + BUSY_END; +} + bool DivEngine::patchConnect(unsigned int src, unsigned int dest) { unsigned int armed=(src<<16)|(dest&0xffff); for (unsigned int i: song.patchbay) { @@ -3802,6 +3848,7 @@ bool DivEngine::patchConnect(unsigned int src, unsigned int dest) { BUSY_BEGIN; saveLock.lock(); song.patchbay.push_back(armed); + song.patchbayAuto=false; saveLock.unlock(); BUSY_END; return true; @@ -3814,6 +3861,7 @@ bool DivEngine::patchDisconnect(unsigned int src, unsigned int dest) { BUSY_BEGIN; saveLock.lock(); song.patchbay.erase(i); + song.patchbayAuto=false; saveLock.unlock(); BUSY_END; return true; @@ -3961,6 +4009,14 @@ void DivEngine::updateSysFlags(int system, bool restart) { BUSY_BEGIN_SOFT; disCont[system].dispatch->setFlags(song.systemFlags[system]); disCont[system].setRates(got.rate); + + // patchbay + if (song.patchbayAuto) { + saveLock.lock(); + autoPatchbay(); + saveLock.unlock(); + } + if (restart && isPlaying()) { playSub(false); } diff --git a/src/engine/engine.h b/src/engine/engine.h index 88029651..bffff781 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -47,8 +47,8 @@ #define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock(); #define BUSY_END isBusy.unlock(); softLocked=false; -#define DIV_VERSION "dev135" -#define DIV_ENGINE_VERSION 135 +#define DIV_VERSION "dev136" +#define DIV_ENGINE_VERSION 136 // for imports #define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_FC 0xff02 @@ -837,6 +837,7 @@ class DivEngine { // automatic patchbay void autoPatchbay(); + void autoPatchbayP(); // connect in patchbay // returns false if connection already made diff --git a/src/engine/fileOps.cpp b/src/engine/fileOps.cpp index 0503d03f..349e8379 100644 --- a/src/engine/fileOps.cpp +++ b/src/engine/fileOps.cpp @@ -2220,6 +2220,8 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) { } } + if (ds.version>=136) song.patchbayAuto=reader.readC(); + // read system flags if (ds.version>=119) { logD("reading chip flags..."); @@ -4489,6 +4491,7 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) { for (unsigned int i: song.patchbay) { w->writeI(i); } + w->writeC(song.patchbayAuto); blockEndSeek=w->tell(); w->seek(blockStartSeek,SEEK_SET); diff --git a/src/engine/song.h b/src/engine/song.h index 3fbe5e27..dfe579bb 100644 --- a/src/engine/song.h +++ b/src/engine/song.h @@ -329,6 +329,7 @@ struct DivSong { bool disableSampleMacro; bool autoSystem; bool oldArpStrategy; + bool patchbayAuto; std::vector ins; std::vector wave; @@ -437,7 +438,8 @@ struct DivSong { snNoLowPeriods(false), disableSampleMacro(false), autoSystem(true), - oldArpStrategy(false) { + oldArpStrategy(false), + patchbayAuto(true) { for (int i=0; isong.patchbayAuto)) { + if (e->song.patchbayAuto) e->autoPatchbayP(); + MARK_MODIFIED; + } + ImGui::Checkbox("Display hidden ports",&displayHiddenPorts); + ImGui::Dummy(ImVec2(1.0f,ImGui::GetFrameHeightWithSpacing()*2.0f)); } hoveredPortSet=0x1fff; @@ -260,6 +265,8 @@ void FurnaceGUI::drawMixer() { ImVec2 topPos=ImGui::GetCursorPos(); topPos.x+=ImGui::GetContentRegionAvail().x-60.0*dpiScale; + if (ImGui::IsWindowHovered() && ImGui::IsMouseClicked(ImGuiMouseButton_Left)) selectedPortSet=0x1fff; + if (portDragActive) { dl->AddLine(subPortPos,ImGui::GetMousePos(),ImGui::GetColorU32(uiColors[GUI_COLOR_PATCHBAY_CONNECTION]),2.0f*dpiScale); } @@ -281,7 +288,7 @@ void FurnaceGUI::drawMixer() { } } ImGui::SetCursorPos(topPos); - if (portSet("System",0x1000,e->getAudioDescGot().outChans,0,e->getAudioDescGot().outChans,0,selectedSubPort,portPos)) { + if (portSet("System",0x1000,displayHiddenPorts?DIV_MAX_OUTPUTS:e->getAudioDescGot().outChans,0,e->getAudioDescGot().outChans,0,selectedSubPort,portPos)) { selectedPortSet=0x1000; if (selectedSubPort>=0) { portDragActive=true; From a36322ff82feeaaed71225ab810c2a67b9a1ad2c Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 10 Jan 2023 16:15:37 -0500 Subject: [PATCH 27/72] fix possible crash when switching stereo on X1-010 --- src/engine/dispatchContainer.cpp | 56 ++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index f72d665b..4e4e5d96 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -103,13 +103,42 @@ void DivDispatchContainer::grow(size_t size) { } } +#define CHECK_MISSING_BUFS \ + int outs=dispatch->getOutputCount(); \ + \ + /* create missing buffers if any */ \ + bool mustClear=false; \ + for (int i=0; irate,rateMemory); \ + \ + if (bbIn[i]==NULL) bbIn[i]=new short[bbInLen]; \ + if (bbOut[i]==NULL) bbOut[i]=new short[bbInLen]; \ + memset(bbIn[i],0,bbInLen*sizeof(short)); \ + memset(bbOut[i],0,bbInLen*sizeof(short)); \ + mustClear=true; \ + } \ + } \ + if (mustClear) clear(); \ + void DivDispatchContainer::acquire(size_t offset, size_t count) { - int outs=dispatch->getOutputCount(); + CHECK_MISSING_BUFS; + for (int i=0; i=outs) { bbInMapped[i]=NULL; } else { - bbInMapped[i]=&bbIn[i][offset]; + if (bbIn[i]==NULL) { + bbInMapped[i]=NULL; + } else { + bbInMapped[i]=&bbIn[i][offset]; + } } } dispatch->acquire(bbInMapped,count); @@ -125,28 +154,7 @@ void DivDispatchContainer::flush(size_t count) { } void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size) { - int outs=dispatch->getOutputCount(); - - // create missing buffers if any - bool mustClear=false; - for (int i=0; irate,rateMemory); - - if (bbIn[i]==NULL) bbIn[i]=new short[bbInLen]; - if (bbOut[i]==NULL) bbOut[i]=new short[bbInLen]; - memset(bbIn[i],0,bbInLen*sizeof(short)); - memset(bbOut[i],0,bbInLen*sizeof(short)); - mustClear=true; - } - } - if (mustClear) clear(); + CHECK_MISSING_BUFS; if (dcOffCompensation && runtotal>0) { dcOffCompensation=false; From 51802720a6db15f936756314963346cfc170592b Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 10 Jan 2023 19:09:26 -0500 Subject: [PATCH 28/72] GUI: more patchbay work --- android/app/build.gradle | 4 +-- papers/format.md | 3 ++ src/engine/engine.cpp | 17 ++++++++-- src/engine/fileOps.cpp | 4 --- src/gui/gui.cpp | 1 + src/gui/gui.h | 3 +- src/gui/mixer.cpp | 69 ++++++++++++++++++++++++++++++++++------ 7 files changed, 83 insertions(+), 18 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 92a79e4d..9f0cb259 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -15,8 +15,8 @@ android { } minSdkVersion 21 targetSdkVersion 26 - versionCode 113 - versionName "dev113" + versionCode 136 + versionName "dev136" externalNativeBuild { cmake { arguments "-DANDROID_APP_PLATFORM=android-21", "-DANDROID_STL=c++_static" diff --git a/papers/format.md b/papers/format.md index d8ec4bbf..6522760e 100644 --- a/papers/format.md +++ b/papers/format.md @@ -421,6 +421,9 @@ reserved input portsets: reserved output portsets: - `000` through `01F`: chip outputs +- `FFD`: wave/sample preview +- `FFE`: metronome +- `FFF`: "null" portset # subsong diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 8b8849aa..4791bd2d 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -1466,7 +1466,6 @@ void DivEngine::createNew(const char* description, String sysName, bool inBase64 BUSY_END; initDispatch(); BUSY_BEGIN; - autoPatchbay(); renderSamples(); reset(); BUSY_END; @@ -3830,6 +3829,16 @@ void DivEngine::autoPatchbay() { } } } + + // wave/sample preview + for (unsigned int j=0; j& portPos); void updateWindowTitle(); diff --git a/src/gui/mixer.cpp b/src/gui/mixer.cpp index 6c6085a5..5ff0093e 100644 --- a/src/gui/mixer.cpp +++ b/src/gui/mixer.cpp @@ -28,14 +28,10 @@ const char* portNamesStereo[2]={ "right" }; -bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs, int activeIns, int activeOuts, int& clickedPort, std::map& portPos) { - String portID=fmt::sprintf("portSet%.4x",portSetID); - - ImDrawList* dl=ImGui::GetWindowDrawList(); - ImGuiWindow* window=ImGui::GetCurrentWindow(); +ImVec2 FurnaceGUI::calcPortSetSize(String label, int ins, int outs) { ImGuiStyle& style=ImGui::GetStyle(); - ImVec2 labelSize=ImGui::CalcTextSize(label.c_str()); + ImVec2 labelSize=ImGui::CalcTextSize(label.c_str(),NULL,false,ImGui::GetWindowSize().x*0.6f); ImVec2 size=labelSize; @@ -46,6 +42,27 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs // space for ports size.y+=MAX(ins,outs)*(labelSize.y+style.FramePadding.y+style.ItemSpacing.y); + return size; +} + +bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs, int activeIns, int activeOuts, int& clickedPort, std::map& portPos) { + String portID=fmt::sprintf("portSet%.4x",portSetID); + + ImDrawList* dl=ImGui::GetWindowDrawList(); + ImGuiWindow* window=ImGui::GetCurrentWindow(); + ImGuiStyle& style=ImGui::GetStyle(); + + ImVec2 labelSize=ImGui::CalcTextSize(label.c_str(),NULL,false,ImGui::GetWindowSize().x*0.6f); + + ImVec2 size=labelSize; + + // pad + size.x+=style.FramePadding.x*2.0f; + size.y+=style.FramePadding.y*2.0f; + + // space for ports + size.y+=MAX(ins,outs)*(ImGui::GetFontSize()+style.FramePadding.y+style.ItemSpacing.y); + ImVec4 portSetBorderColor=uiColors[GUI_COLOR_PATCHBAY_PORTSET]; ImVec4 portSetColor=ImVec4( portSetBorderColor.x*0.75f, @@ -86,7 +103,7 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs // label dl->AddRectFilled(minArea,maxArea,ImGui::GetColorU32(portSetColor),0.0f); dl->AddRect(minArea,maxArea,ImGui::GetColorU32(portSetBorderColor),0.0f,dpiScale); - dl->AddText(textPos,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),label.c_str()); + dl->AddText(ImGui::GetFont(),ImGui::GetFontSize(),textPos,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),label.c_str(),NULL,ImGui::GetWindowSize().x*0.6f); // input ports for (int i=0; i