mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-15 17:25:06 +00:00
Merge branch 'master' into feature/More-OPL-Patch-Support
This commit is contained in:
commit
836fb57f14
80 changed files with 130 additions and 106 deletions
|
@ -245,8 +245,9 @@ class DivDispatch {
|
|||
|
||||
/**
|
||||
* ticks this dispatch.
|
||||
* @param sysTick whether the engine has ticked (if not then this may be a sub-tick used in low-latency mode).
|
||||
*/
|
||||
virtual void tick();
|
||||
virtual void tick(bool sysTick=true);
|
||||
|
||||
/**
|
||||
* get the state of a channel.
|
||||
|
|
|
@ -2237,6 +2237,8 @@ bool DivEngine::initAudioBackend() {
|
|||
if (metroVol<0.0f) metroVol=0.0f;
|
||||
if (metroVol>2.0f) metroVol=2.0f;
|
||||
|
||||
if (lowLatency) logI("using low latency mode.");
|
||||
|
||||
switch (audioEngine) {
|
||||
case DIV_AUDIO_JACK:
|
||||
#ifndef HAVE_JACK
|
||||
|
|
|
@ -21,14 +21,19 @@
|
|||
#include "instrument.h"
|
||||
#include "engine.h"
|
||||
|
||||
void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released) {
|
||||
void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tick) {
|
||||
if (!tick) {
|
||||
had=false;
|
||||
return;
|
||||
}
|
||||
if (finished) {
|
||||
finished=false;
|
||||
}
|
||||
if (had!=has) {
|
||||
if (actualHad!=has) {
|
||||
finished=true;
|
||||
}
|
||||
had=has;
|
||||
actualHad=has;
|
||||
had=actualHad;
|
||||
if (has) {
|
||||
val=source.val[pos++];
|
||||
if (source.rel>=0 && pos>source.rel && !released) {
|
||||
|
@ -52,17 +57,18 @@ void DivMacroInt::next() {
|
|||
if (ins==NULL) return;
|
||||
// run macros
|
||||
// TODO: potentially get rid of list to avoid allocations
|
||||
if (--subTick<=0) {
|
||||
subTick--;
|
||||
for (size_t i=0; i<macroListLen; i++) {
|
||||
if (macroList[i]!=NULL && macroSource[i]!=NULL) {
|
||||
macroList[i]->doMacro(*macroSource[i],released,subTick==0);
|
||||
}
|
||||
}
|
||||
if (subTick<=0) {
|
||||
if (e==NULL) {
|
||||
subTick=1;
|
||||
} else {
|
||||
subTick=e->tickMult;
|
||||
}
|
||||
for (size_t i=0; i<macroListLen; i++) {
|
||||
if (macroList[i]!=NULL && macroSource[i]!=NULL) {
|
||||
macroList[i]->doMacro(*macroSource[i],released);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,6 +91,7 @@ void DivMacroInt::init(DivInstrument* which) {
|
|||
if (macroList[i]!=NULL) macroList[i]->init();
|
||||
}
|
||||
macroListLen=0;
|
||||
subTick=1;
|
||||
|
||||
released=false;
|
||||
|
||||
|
|
|
@ -27,17 +27,17 @@ class DivEngine;
|
|||
struct DivMacroStruct {
|
||||
int pos;
|
||||
int val;
|
||||
bool has, had, finished, will;
|
||||
bool has, had, actualHad, finished, will;
|
||||
unsigned int mode;
|
||||
void doMacro(DivInstrumentMacro& source, bool released);
|
||||
void doMacro(DivInstrumentMacro& source, bool released, bool tick);
|
||||
void init() {
|
||||
pos=mode=0;
|
||||
has=had=will=false;
|
||||
has=had=actualHad=will=false;
|
||||
// TODO: test whether this breaks anything?
|
||||
val=0;
|
||||
}
|
||||
void prepare(DivInstrumentMacro& source) {
|
||||
has=had=will=true;
|
||||
has=had=actualHad=will=true;
|
||||
mode=source.mode;
|
||||
}
|
||||
DivMacroStruct():
|
||||
|
@ -45,6 +45,7 @@ struct DivMacroStruct {
|
|||
val(0),
|
||||
has(false),
|
||||
had(false),
|
||||
actualHad(false),
|
||||
finished(false),
|
||||
will(false),
|
||||
mode(0) {}
|
||||
|
@ -128,7 +129,7 @@ class DivMacroInt {
|
|||
e(NULL),
|
||||
ins(NULL),
|
||||
macroListLen(0),
|
||||
subTick(0),
|
||||
subTick(1),
|
||||
released(false),
|
||||
vol(),
|
||||
arp(),
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
void DivDispatch::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||
}
|
||||
|
||||
void DivDispatch::tick() {
|
||||
void DivDispatch::tick(bool sysTick) {
|
||||
}
|
||||
|
||||
void* DivDispatch::getChanState(int chan) {
|
||||
|
|
|
@ -155,7 +155,7 @@ void DivPlatformAmiga::acquire(short* bufL, short* bufR, size_t start, size_t le
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformAmiga::tick() {
|
||||
void DivPlatformAmiga::tick(bool sysTick) {
|
||||
for (int i=0; i<4; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -88,7 +88,7 @@ class DivPlatformAmiga: public DivDispatch {
|
|||
void* getChanState(int chan);
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool isStereo();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
|
|
|
@ -219,7 +219,7 @@ inline int hScale(int note) {
|
|||
return ((note/12)<<4)+(noteMap[note%12]);
|
||||
}
|
||||
|
||||
void DivPlatformArcade::tick() {
|
||||
void DivPlatformArcade::tick(bool sysTick) {
|
||||
for (int i=0; i<8; i++) {
|
||||
chan[i].std.next();
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ class DivPlatformArcade: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void notifyInsChange(int ins);
|
||||
void setFlags(unsigned int flags);
|
||||
|
|
|
@ -172,7 +172,7 @@ void DivPlatformAY8910::updateOutSel(bool immediate) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformAY8910::tick() {
|
||||
void DivPlatformAY8910::tick(bool sysTick) {
|
||||
// PSG
|
||||
for (int i=0; i<3; i++) {
|
||||
chan[i].std.next();
|
||||
|
|
|
@ -90,7 +90,7 @@ class DivPlatformAY8910: public DivDispatch {
|
|||
void flushWrites();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void setFlags(unsigned int flags);
|
||||
bool isStereo();
|
||||
|
|
|
@ -187,7 +187,7 @@ const unsigned char regMode[3]={
|
|||
0x0d, 0x14, 0x15
|
||||
};
|
||||
|
||||
void DivPlatformAY8930::tick() {
|
||||
void DivPlatformAY8930::tick(bool sysTick) {
|
||||
// PSG
|
||||
for (int i=0; i<3; i++) {
|
||||
chan[i].std.next();
|
||||
|
|
|
@ -78,7 +78,7 @@ class DivPlatformAY8930: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void setFlags(unsigned int flags);
|
||||
bool isStereo();
|
||||
|
|
|
@ -81,7 +81,7 @@ void DivPlatformBubSysWSG::updateWave(int ch) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformBubSysWSG::tick() {
|
||||
void DivPlatformBubSysWSG::tick(bool sysTick) {
|
||||
for (int i=0; i<2; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -67,7 +67,7 @@ class DivPlatformBubSysWSG: public DivDispatch {
|
|||
int getRegisterPoolDepth();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool isStereo();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
|
|
|
@ -122,7 +122,7 @@ void DivPlatformC64::updateFilter() {
|
|||
rWrite(0x18,(filtControl<<4)|vol);
|
||||
}
|
||||
|
||||
void DivPlatformC64::tick() {
|
||||
void DivPlatformC64::tick(bool sysTick) {
|
||||
for (int i=0; i<3; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
@ -166,12 +166,14 @@ void DivPlatformC64::tick() {
|
|||
rWrite(i*7+2,chan[i].duty&0xff);
|
||||
rWrite(i*7+3,chan[i].duty>>8);
|
||||
}
|
||||
if (chan[i].testWhen>0) {
|
||||
if (--chan[i].testWhen<1) {
|
||||
if (!chan[i].resetMask) {
|
||||
rWrite(i*7+5,0);
|
||||
rWrite(i*7+6,0);
|
||||
rWrite(i*7+4,(chan[i].wave<<4)|8|(chan[i].ring<<2)|(chan[i].sync<<1));
|
||||
if (sysTick) {
|
||||
if (chan[i].testWhen>0) {
|
||||
if (--chan[i].testWhen<1) {
|
||||
if (!chan[i].resetMask) {
|
||||
rWrite(i*7+5,0);
|
||||
rWrite(i*7+6,0);
|
||||
rWrite(i*7+4,(chan[i].wave<<4)|8|(chan[i].ring<<2)|(chan[i].sync<<1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ class DivPlatformC64: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void setFlags(unsigned int flags);
|
||||
void notifyInsChange(int ins);
|
||||
|
|
|
@ -38,10 +38,12 @@ void DivPlatformDummy::muteChannel(int ch, bool mute) {
|
|||
isMuted[ch]=mute;
|
||||
}
|
||||
|
||||
void DivPlatformDummy::tick() {
|
||||
void DivPlatformDummy::tick(bool sysTick) {
|
||||
for (unsigned char i=0; i<chans; i++) {
|
||||
chan[i].amp-=3;
|
||||
if (chan[i].amp<16) chan[i].amp=16;
|
||||
if (sysTick) {
|
||||
chan[i].amp-=3;
|
||||
if (chan[i].amp<16) chan[i].amp=16;
|
||||
}
|
||||
|
||||
if (chan[i].freqChanged) {
|
||||
chan[i].freqChanged=false;
|
||||
|
|
|
@ -41,7 +41,7 @@ class DivPlatformDummy: public DivDispatch {
|
|||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
void reset();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||
void quit();
|
||||
~DivPlatformDummy();
|
||||
|
|
|
@ -97,7 +97,7 @@ void DivPlatformFDS::updateWave() {
|
|||
rWrite(0x4089,0);
|
||||
}
|
||||
|
||||
void DivPlatformFDS::tick() {
|
||||
void DivPlatformFDS::tick(bool sysTick) {
|
||||
for (int i=0; i<1; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -77,7 +77,7 @@ class DivPlatformFDS: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void setFlags(unsigned int flags);
|
||||
|
|
|
@ -146,7 +146,7 @@ static unsigned char noiseTable[256]={
|
|||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
void DivPlatformGB::tick() {
|
||||
void DivPlatformGB::tick(bool sysTick) {
|
||||
for (int i=0; i<4; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.arp.had) {
|
||||
|
|
|
@ -70,7 +70,7 @@ class DivPlatformGB: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool isStereo();
|
||||
void notifyInsChange(int ins);
|
||||
|
|
|
@ -220,7 +220,7 @@ void DivPlatformGenesis::acquire(short* bufL, short* bufR, size_t start, size_t
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformGenesis::tick() {
|
||||
void DivPlatformGenesis::tick(bool sysTick) {
|
||||
for (int i=0; i<6; i++) {
|
||||
if (i==2 && extMode) continue;
|
||||
chan[i].std.next();
|
||||
|
|
|
@ -109,7 +109,7 @@ class DivPlatformGenesis: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool isStereo();
|
||||
void setYMFM(bool use);
|
||||
|
|
|
@ -266,7 +266,7 @@ static int opChanOffsH[4]={
|
|||
0xad, 0xae, 0xac, 0xa6
|
||||
};
|
||||
|
||||
void DivPlatformGenesisExt::tick() {
|
||||
void DivPlatformGenesisExt::tick(bool sysTick) {
|
||||
if (extMode) {
|
||||
bool writeSomething=false;
|
||||
unsigned char writeMask=2;
|
||||
|
@ -283,7 +283,7 @@ void DivPlatformGenesisExt::tick() {
|
|||
}
|
||||
}
|
||||
|
||||
DivPlatformGenesis::tick();
|
||||
DivPlatformGenesis::tick(sysTick);
|
||||
|
||||
bool writeNoteOn=false;
|
||||
unsigned char writeMask=2;
|
||||
|
|
|
@ -41,7 +41,7 @@ class DivPlatformGenesisExt: public DivPlatformGenesis {
|
|||
void* getChanState(int chan);
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
bool keyOffAffectsPorta(int ch);
|
||||
|
|
|
@ -145,7 +145,7 @@ void DivPlatformLynx::acquire(short* bufL, short* bufR, size_t start, size_t len
|
|||
mikey->sampleAudio( bufL + start, bufR + start, len );
|
||||
}
|
||||
|
||||
void DivPlatformLynx::tick() {
|
||||
void DivPlatformLynx::tick(bool sysTick) {
|
||||
for (int i=0; i<4; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -80,7 +80,7 @@ class DivPlatformLynx: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool isStereo();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
|
|
|
@ -95,7 +95,7 @@ void DivPlatformMMC5::acquire(short* bufL, short* bufR, size_t start, size_t len
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformMMC5::tick() {
|
||||
void DivPlatformMMC5::tick(bool sysTick) {
|
||||
for (int i=0; i<2; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -71,7 +71,7 @@ class DivPlatformMMC5: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
float getPostAmp();
|
||||
|
|
|
@ -214,7 +214,7 @@ void DivPlatformN163::updateWaveCh(int ch) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformN163::tick() {
|
||||
void DivPlatformN163::tick(bool sysTick) {
|
||||
for (int i=0; i<=chanMax; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -93,7 +93,7 @@ class DivPlatformN163: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void setFlags(unsigned int flags);
|
||||
void notifyWaveChange(int wave);
|
||||
|
|
|
@ -140,7 +140,7 @@ static unsigned char noiseTable[253]={
|
|||
15
|
||||
};
|
||||
|
||||
void DivPlatformNES::tick() {
|
||||
void DivPlatformNES::tick(bool sysTick) {
|
||||
for (int i=0; i<4; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -72,7 +72,7 @@ class DivPlatformNES: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
float getPostAmp();
|
||||
|
|
|
@ -228,7 +228,7 @@ void DivPlatformOPL::acquire(short* bufL, short* bufR, size_t start, size_t len)
|
|||
//}
|
||||
}
|
||||
|
||||
void DivPlatformOPL::tick() {
|
||||
void DivPlatformOPL::tick(bool sysTick) {
|
||||
for (int i=0; i<totalChans; i++) {
|
||||
int ops=(slots[3][i]!=255 && chan[i].state.ops==4 && oplType==3)?4:2;
|
||||
chan[i].std.next();
|
||||
|
|
|
@ -104,7 +104,7 @@ class DivPlatformOPL: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool isStereo();
|
||||
void setYMFM(bool use);
|
||||
|
|
|
@ -111,7 +111,7 @@ void DivPlatformOPLL::acquire(short* bufL, short* bufR, size_t start, size_t len
|
|||
acquire_nuked(bufL,bufR,start,len);
|
||||
}
|
||||
|
||||
void DivPlatformOPLL::tick() {
|
||||
void DivPlatformOPLL::tick(bool sysTick) {
|
||||
for (int i=0; i<11; i++) {
|
||||
chan[i].std.next();
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class DivPlatformOPLL: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void setYMFM(bool use);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
|
|
|
@ -146,7 +146,7 @@ static unsigned char noiseFreq[12]={
|
|||
4,13,15,18,21,23,25,27,29,31,0,2
|
||||
};
|
||||
|
||||
void DivPlatformPCE::tick() {
|
||||
void DivPlatformPCE::tick(bool sysTick) {
|
||||
for (int i=0; i<6; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class DivPlatformPCE: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool isStereo();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
|
|
|
@ -164,7 +164,7 @@ void DivPlatformPCSpeaker::acquire(short* bufL, short* bufR, size_t start, size_
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformPCSpeaker::tick() {
|
||||
void DivPlatformPCSpeaker::tick(bool sysTick) {
|
||||
for (int i=0; i<1; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -77,7 +77,7 @@ class DivPlatformPCSpeaker: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void setFlags(unsigned int flags);
|
||||
|
|
|
@ -85,7 +85,7 @@ void DivPlatformPET::writeOutVol() {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformPET::tick() {
|
||||
void DivPlatformPET::tick(bool sysTick) {
|
||||
chan.std.next();
|
||||
if (chan.std.vol.had) {
|
||||
chan.outVol=chan.std.vol.val&chan.vol;
|
||||
|
|
|
@ -65,7 +65,7 @@ class DivPlatformPET: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void notifyInsDeletion(void* ins);
|
||||
bool isStereo();
|
||||
|
|
|
@ -274,7 +274,7 @@ void DivPlatformQSound::acquire(short* bufL, short* bufR, size_t start, size_t l
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformQSound::tick() {
|
||||
void DivPlatformQSound::tick(bool sysTick) {
|
||||
for (int i=0; i<16; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -74,7 +74,7 @@ class DivPlatformQSound: public DivDispatch {
|
|||
int getRegisterPoolDepth();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool isStereo();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
|
|
|
@ -132,7 +132,7 @@ inline unsigned char applyPan(unsigned char vol, unsigned char pan) {
|
|||
return ((vol*(pan>>4))/15)|(((vol*(pan&15))/15)<<4);
|
||||
}
|
||||
|
||||
void DivPlatformSAA1099::tick() {
|
||||
void DivPlatformSAA1099::tick(bool sysTick) {
|
||||
for (int i=0; i<6; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -90,7 +90,7 @@ class DivPlatformSAA1099: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void setCore(DivSAACores core);
|
||||
void setFlags(unsigned int flags);
|
||||
|
|
|
@ -76,7 +76,7 @@ void DivPlatformSegaPCM::acquire(short* bufL, short* bufR, size_t start, size_t
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformSegaPCM::tick() {
|
||||
void DivPlatformSegaPCM::tick(bool sysTick) {
|
||||
for (int i=0; i<16; i++) {
|
||||
chan[i].std.next();
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class DivPlatformSegaPCM: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void notifyInsChange(int ins);
|
||||
void setFlags(unsigned int flags);
|
||||
|
|
|
@ -53,7 +53,7 @@ int DivPlatformSMS::acquireOne() {
|
|||
return v;
|
||||
}
|
||||
|
||||
void DivPlatformSMS::tick() {
|
||||
void DivPlatformSMS::tick(bool sysTick) {
|
||||
for (int i=0; i<4; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -63,7 +63,7 @@ class DivPlatformSMS: public DivDispatch {
|
|||
void* getChanState(int chan);
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
bool keyOffAffectsPorta(int ch);
|
||||
|
|
|
@ -141,7 +141,7 @@ void DivPlatformSwan::writeOutVol(int ch) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformSwan::tick() {
|
||||
void DivPlatformSwan::tick(bool sysTick) {
|
||||
unsigned char sndCtrl=(pcm?0x20:0)|(sweep?0x40:0)|((noise>0)?0x80:0);
|
||||
for (int i=0; i<4; i++) {
|
||||
chan[i].std.next();
|
||||
|
|
|
@ -77,7 +77,7 @@ class DivPlatformSwan: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void notifyWaveChange(int wave);
|
||||
void notifyInsDeletion(void* ins);
|
||||
|
|
|
@ -84,7 +84,7 @@ unsigned char DivPlatformTIA::dealWithFreq(unsigned char shape, int base, int pi
|
|||
return 0;
|
||||
}
|
||||
|
||||
void DivPlatformTIA::tick() {
|
||||
void DivPlatformTIA::tick(bool sysTick) {
|
||||
for (int i=0; i<2; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -51,7 +51,7 @@ class DivPlatformTIA: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void setFlags(unsigned int flags);
|
||||
bool isStereo();
|
||||
|
|
|
@ -183,7 +183,7 @@ inline int hScale(int note) {
|
|||
return ((note/12)<<4)+(noteMap[note%12]);
|
||||
}
|
||||
|
||||
void DivPlatformTX81Z::tick() {
|
||||
void DivPlatformTX81Z::tick(bool sysTick) {
|
||||
for (int i=0; i<8; i++) {
|
||||
chan[i].std.next();
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ class DivPlatformTX81Z: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void notifyInsChange(int ins);
|
||||
void setFlags(unsigned int flags);
|
||||
|
|
|
@ -156,7 +156,7 @@ int DivPlatformVERA::calcNoteFreq(int ch, int note) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformVERA::tick() {
|
||||
void DivPlatformVERA::tick(bool sysTick) {
|
||||
for (int i=0; i<16; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -63,7 +63,7 @@ class DivPlatformVERA: public DivDispatch {
|
|||
unsigned char* getRegisterPool();
|
||||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void notifyInsDeletion(void* ins);
|
||||
float getPostAmp();
|
||||
|
|
|
@ -91,7 +91,7 @@ void DivPlatformVIC20::writeOutVol(int ch) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformVIC20::tick() {
|
||||
void DivPlatformVIC20::tick(bool sysTick) {
|
||||
for (int i=0; i<4; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -66,7 +66,7 @@ class DivPlatformVIC20: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void setFlags(unsigned int flags);
|
||||
void notifyInsDeletion(void* ins);
|
||||
|
|
|
@ -135,7 +135,7 @@ void DivPlatformVRC6::acquire(short* bufL, short* bufR, size_t start, size_t len
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformVRC6::tick() {
|
||||
void DivPlatformVRC6::tick(bool sysTick) {
|
||||
for (int i=0; i<3; i++) {
|
||||
// 16 for pulse; 14 for saw
|
||||
int CHIP_DIVIDER=(i==2)?14:16;
|
||||
|
|
|
@ -82,7 +82,7 @@ class DivPlatformVRC6: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void setFlags(unsigned int flags);
|
||||
|
|
|
@ -336,7 +336,7 @@ void DivPlatformX1_010::updateEnvelope(int ch) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformX1_010::tick() {
|
||||
void DivPlatformX1_010::tick(bool sysTick) {
|
||||
for (int i=0; i<16; i++) {
|
||||
chan[i].std.next();
|
||||
if (chan[i].std.vol.had) {
|
||||
|
|
|
@ -126,7 +126,7 @@ class DivPlatformX1_010: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool isStereo();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
|
|
|
@ -365,9 +365,9 @@ void DivPlatformYM2610::acquire(short* bufL, short* bufR, size_t start, size_t l
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformYM2610::tick() {
|
||||
void DivPlatformYM2610::tick(bool sysTick) {
|
||||
// PSG
|
||||
ay->tick();
|
||||
ay->tick(sysTick);
|
||||
ay->flushWrites();
|
||||
for (DivRegWrite& i: ay->getRegisterWrites()) {
|
||||
immWrite(i.addr&15,i.val);
|
||||
|
|
|
@ -116,7 +116,7 @@ class DivPlatformYM2610: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool isStereo();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
|
|
|
@ -429,9 +429,9 @@ void DivPlatformYM2610B::acquire(short* bufL, short* bufR, size_t start, size_t
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformYM2610B::tick() {
|
||||
void DivPlatformYM2610B::tick(bool sysTick) {
|
||||
// PSG
|
||||
ay->tick();
|
||||
ay->tick(sysTick);
|
||||
ay->flushWrites();
|
||||
for (DivRegWrite& i: ay->getRegisterWrites()) {
|
||||
immWrite(i.addr&15,i.val);
|
||||
|
|
|
@ -107,7 +107,7 @@ class DivPlatformYM2610B: public DivDispatch {
|
|||
int getRegisterPoolSize();
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool isStereo();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
|
|
|
@ -212,7 +212,7 @@ static int opChanOffsH[4]={
|
|||
0xad, 0xae, 0xac, 0xa6
|
||||
};
|
||||
|
||||
void DivPlatformYM2610BExt::tick() {
|
||||
void DivPlatformYM2610BExt::tick(bool sysTick) {
|
||||
if (extMode) {
|
||||
bool writeSomething=false;
|
||||
unsigned char writeMask=2;
|
||||
|
@ -229,7 +229,7 @@ void DivPlatformYM2610BExt::tick() {
|
|||
}
|
||||
}
|
||||
|
||||
DivPlatformYM2610B::tick();
|
||||
DivPlatformYM2610B::tick(sysTick);
|
||||
|
||||
bool writeNoteOn=false;
|
||||
unsigned char writeMask=2;
|
||||
|
|
|
@ -41,7 +41,7 @@ class DivPlatformYM2610BExt: public DivPlatformYM2610B {
|
|||
void* getChanState(int chan);
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void notifyInsChange(int ins);
|
||||
|
|
|
@ -212,7 +212,7 @@ static int opChanOffsH[4]={
|
|||
0xad, 0xae, 0xac, 0xa6
|
||||
};
|
||||
|
||||
void DivPlatformYM2610Ext::tick() {
|
||||
void DivPlatformYM2610Ext::tick(bool sysTick) {
|
||||
if (extMode) {
|
||||
bool writeSomething=false;
|
||||
unsigned char writeMask=2;
|
||||
|
@ -229,7 +229,7 @@ void DivPlatformYM2610Ext::tick() {
|
|||
}
|
||||
}
|
||||
|
||||
DivPlatformYM2610::tick();
|
||||
DivPlatformYM2610::tick(sysTick);
|
||||
|
||||
bool writeNoteOn=false;
|
||||
unsigned char writeMask=2;
|
||||
|
|
|
@ -41,7 +41,7 @@ class DivPlatformYM2610Ext: public DivPlatformYM2610 {
|
|||
void* getChanState(int chan);
|
||||
void reset();
|
||||
void forceIns();
|
||||
void tick();
|
||||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void notifyInsChange(int ins);
|
||||
|
|
|
@ -40,7 +40,7 @@ const char* notes[12]={
|
|||
};
|
||||
|
||||
// update this when adding new commands.
|
||||
const char* cmdName[DIV_CMD_MAX]={
|
||||
const char* cmdName[]={
|
||||
"NOTE_ON",
|
||||
"NOTE_OFF",
|
||||
"NOTE_OFF_ENV",
|
||||
|
@ -144,6 +144,7 @@ const char* cmdName[DIV_CMD_MAX]={
|
|||
"N163_WAVE_LOAD",
|
||||
"N163_WAVE_LOADPOS",
|
||||
"N163_WAVE_LOADLEN",
|
||||
"N163_WAVE_LOADMODE",
|
||||
"N163_CHANNEL_LIMIT",
|
||||
"N163_GLOBAL_WAVE_LOAD",
|
||||
"N163_GLOBAL_WAVE_LOADPOS",
|
||||
|
@ -153,6 +154,8 @@ const char* cmdName[DIV_CMD_MAX]={
|
|||
"ALWAYS_SET_VOLUME"
|
||||
};
|
||||
|
||||
static_assert((sizeof(cmdName)/sizeof(void*))==DIV_CMD_MAX,"update cmdName!");
|
||||
|
||||
const char* formatNote(unsigned char note, unsigned char octave) {
|
||||
static char ret[4];
|
||||
if (note==100) {
|
||||
|
@ -1638,7 +1641,7 @@ bool DivEngine::nextTick(bool noAccum) {
|
|||
firstTick=false;
|
||||
|
||||
// system tick
|
||||
for (int i=0; i<song.systemLen; i++) disCont[i].dispatch->tick();
|
||||
for (int i=0; i<song.systemLen; i++) disCont[i].dispatch->tick(subticks==tickMult);
|
||||
|
||||
if (!freelance) {
|
||||
if (stepPlay!=1) {
|
||||
|
@ -1654,7 +1657,7 @@ bool DivEngine::nextTick(bool noAccum) {
|
|||
}
|
||||
}
|
||||
|
||||
if (consoleMode) fprintf(stderr,"\x1b[2K> %d:%.2d:%.2d.%.2d %.2x/%.2x:%.3d/%.3d %4dcmd/s\x1b[G",totalSeconds/3600,(totalSeconds/60)%60,totalSeconds%60,totalTicks/10000,curOrder,song.ordersLen,curRow,song.patLen,cmdsPerSecond);
|
||||
if (consoleMode && subticks<=1) fprintf(stderr,"\x1b[2K> %d:%.2d:%.2d.%.2d %.2x/%.2x:%.3d/%.3d %4dcmd/s\x1b[G",totalSeconds/3600,(totalSeconds/60)%60,totalSeconds%60,totalTicks/10000,curOrder,song.ordersLen,curRow,song.patLen,cmdsPerSecond);
|
||||
}
|
||||
|
||||
if (haltOn==DIV_HALT_TICK) halted=true;
|
||||
|
|
|
@ -587,8 +587,8 @@ bool DivSample::resampleSinc(double r) {
|
|||
result+=s[j]*t2[7-j];
|
||||
result+=s[8+j]*t1[j];
|
||||
}
|
||||
if (result<-32768) result=-32768;
|
||||
if (result>32767) result=32767;
|
||||
if (result<-128) result=-128;
|
||||
if (result>127) result=127;
|
||||
if (i>=8) {
|
||||
data8[i-8]=result;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,11 @@ bool DivWaveSynth::activeChanged() {
|
|||
}
|
||||
|
||||
bool DivWaveSynth::tick() {
|
||||
if (--subDivCounter>0) return false;
|
||||
|
||||
bool updated=first;
|
||||
first=false;
|
||||
subDivCounter=e->tickMult;
|
||||
if (!state.enabled) return updated;
|
||||
if (width<1) return false;
|
||||
|
||||
|
@ -167,6 +170,7 @@ void DivWaveSynth::init(DivInstrument* which, int w, int h, bool insChanged) {
|
|||
pos=0;
|
||||
stage=0;
|
||||
divCounter=1+state.rateDivider;
|
||||
subDivCounter=0;
|
||||
first=true;
|
||||
|
||||
changeWave1(state.wave1);
|
||||
|
|
|
@ -28,7 +28,7 @@ class DivEngine;
|
|||
class DivWaveSynth {
|
||||
DivEngine* e;
|
||||
DivInstrumentWaveSynth state;
|
||||
int pos, stage, divCounter, width, height;
|
||||
int pos, stage, divCounter, width, height, subDivCounter;
|
||||
bool first, activeChangedB;
|
||||
unsigned char wave1[256];
|
||||
unsigned char wave2[256];
|
||||
|
@ -78,6 +78,7 @@ class DivWaveSynth {
|
|||
divCounter(0),
|
||||
width(32),
|
||||
height(31),
|
||||
subDivCounter(0),
|
||||
first(false),
|
||||
activeChangedB(false) {
|
||||
memset(wave1,0,256);
|
||||
|
|
|
@ -239,6 +239,7 @@ void initParams() {
|
|||
params.push_back(TAParam("W","warranty",false,pWarranty,"","view warranty disclaimer."));
|
||||
}
|
||||
|
||||
// TODO: CoInitializeEx on Windows?
|
||||
int main(int argc, char** argv) {
|
||||
initLog();
|
||||
#if !(defined(__APPLE__) || defined(_WIN32))
|
||||
|
|
Loading…
Reference in a new issue