mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-05 07:01:21 +00:00
fix more possible crashes when deleting ins
and added a fatal error if implementation is missing
This commit is contained in:
parent
bb4dc21603
commit
c1e26ee749
34 changed files with 111 additions and 10 deletions
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../../ta-log.h"
|
||||
|
||||
void DivDispatch::acquire(short** buf, size_t len) {
|
||||
}
|
||||
|
@ -121,7 +122,8 @@ void DivDispatch::notifyWaveChange(int ins) {
|
|||
}
|
||||
|
||||
void DivDispatch::notifyInsDeletion(void* ins) {
|
||||
|
||||
logE("notifyInsDeletion NOT implemented!");
|
||||
abort();
|
||||
}
|
||||
|
||||
void DivDispatch::notifyPlaybackStop() {
|
||||
|
|
|
@ -800,6 +800,12 @@ void DivPlatformArcade::notifyInsChange(int ins) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformArcade::notifyInsDeletion(void* ins) {
|
||||
for (int i=0; i<8; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
void* DivPlatformArcade::getChanState(int ch) {
|
||||
return &chan[ch];
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ class DivPlatformArcade: public DivPlatformOPM {
|
|||
void muteChannel(int ch, bool mute);
|
||||
DivMacroInt* getChanMacroInt(int ch);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
void setFlags(const DivConfig& flags);
|
||||
int getOutputCount();
|
||||
void setYMFM(bool use);
|
||||
|
|
|
@ -131,6 +131,10 @@ int DivPlatformDummy::dispatch(DivCommand c) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
void DivPlatformDummy::notifyInsDeletion(void* ins) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
void DivPlatformDummy::reset() {
|
||||
for (int i=0; i<chans; i++) {
|
||||
chan[i]=DivPlatformDummy::Channel();
|
||||
|
|
|
@ -40,6 +40,7 @@ class DivPlatformDummy: public DivDispatch {
|
|||
void acquire(short** buf, size_t len);
|
||||
void muteChannel(int ch, bool mute);
|
||||
int dispatch(DivCommand c);
|
||||
void notifyInsDeletion(void* ins);
|
||||
void* getChanState(int chan);
|
||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||
void reset();
|
||||
|
|
|
@ -118,7 +118,7 @@ class DivPlatformGenesis: public DivPlatformOPN {
|
|||
void toggleRegisterDump(bool enable);
|
||||
void setFlags(const DivConfig& flags);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
virtual void notifyInsDeletion(void* ins);
|
||||
void setSoftPCM(bool value);
|
||||
int getPortaFloor(int ch);
|
||||
void poke(unsigned int addr, unsigned short val);
|
||||
|
|
|
@ -746,6 +746,13 @@ void DivPlatformGenesisExt::notifyInsChange(int ins) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformGenesisExt::notifyInsDeletion(void* ins) {
|
||||
DivPlatformGenesis::notifyInsDeletion(ins);
|
||||
for (int i=0; i<4; i++) {
|
||||
opChan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
int DivPlatformGenesisExt::getPortaFloor(int ch) {
|
||||
return (ch>8)?12:0;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ class DivPlatformGenesisExt: public DivPlatformGenesis {
|
|||
bool keyOffAffectsArp(int ch);
|
||||
bool keyOffAffectsPorta(int ch);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
int getPortaFloor(int ch);
|
||||
void setCSMChannel(unsigned char ch);
|
||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||
|
|
|
@ -353,6 +353,9 @@ void DivPlatformMSM6258::notifyInsChange(int ins) {
|
|||
}
|
||||
|
||||
void DivPlatformMSM6258::notifyInsDeletion(void* ins) {
|
||||
for (int i=0; i<1; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformMSM6258::setFlags(const DivConfig& flags) {
|
||||
|
|
|
@ -326,6 +326,9 @@ void DivPlatformMSM6295::notifyInsChange(int ins) {
|
|||
}
|
||||
|
||||
void DivPlatformMSM6295::notifyInsDeletion(void* ins) {
|
||||
for (int i=0; i<4; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
const void* DivPlatformMSM6295::getSampleMem(int index) {
|
||||
|
|
|
@ -1640,6 +1640,9 @@ void DivPlatformOPL::notifyInsChange(int ins) {
|
|||
}
|
||||
|
||||
void DivPlatformOPL::notifyInsDeletion(void* ins) {
|
||||
for (int i=0; i<totalChans; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformOPL::poke(unsigned int addr, unsigned short val) {
|
||||
|
|
|
@ -940,6 +940,9 @@ void DivPlatformOPLL::notifyInsChange(int ins) {
|
|||
}
|
||||
|
||||
void DivPlatformOPLL::notifyInsDeletion(void* ins) {
|
||||
for (int i=0; i<11; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformOPLL::poke(unsigned int addr, unsigned short val) {
|
||||
|
|
|
@ -606,7 +606,7 @@ void DivPlatformQSound::forceIns() {
|
|||
for (int i=0; i<19; i++) {
|
||||
chan[i].insChanged=true;
|
||||
chan[i].freqChanged=true;
|
||||
chan[i].sample=-1;
|
||||
//chan[i].sample=-1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -645,7 +645,7 @@ bool DivPlatformQSound::keyOffAffectsArp(int ch) {
|
|||
}
|
||||
|
||||
void DivPlatformQSound::notifyInsChange(int ins) {
|
||||
for (int i=0; i<4; i++) {
|
||||
for (int i=0; i<19; i++) {
|
||||
if (chan[i].ins==ins) {
|
||||
chan[i].insChanged=true;
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ void DivPlatformQSound::notifyWaveChange(int wave) {
|
|||
}
|
||||
|
||||
void DivPlatformQSound::notifyInsDeletion(void* ins) {
|
||||
for (int i=0; i<4; i++) {
|
||||
for (int i=0; i<19; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -406,6 +406,12 @@ void DivPlatformSegaPCM::notifyInsChange(int ins) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformSegaPCM::notifyInsDeletion(void* ins) {
|
||||
for (int i=0; i<16; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
void* DivPlatformSegaPCM::getChanState(int ch) {
|
||||
return &chan[ch];
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ class DivPlatformSegaPCM: public DivDispatch {
|
|||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
void renderSamples(int chipID);
|
||||
void setFlags(const DivConfig& flags);
|
||||
int getOutputCount();
|
||||
|
|
|
@ -873,6 +873,12 @@ void DivPlatformTX81Z::notifyInsChange(int ins) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformTX81Z::notifyInsDeletion(void* ins) {
|
||||
for (int i=0; i<8; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
void* DivPlatformTX81Z::getChanState(int ch) {
|
||||
return &chan[ch];
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ class DivPlatformTX81Z: public DivPlatformOPM {
|
|||
void tick(bool sysTick=true);
|
||||
void muteChannel(int ch, bool mute);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
void setFlags(const DivConfig& flags);
|
||||
int getOutputCount();
|
||||
void poke(unsigned int addr, unsigned short val);
|
||||
|
|
|
@ -411,7 +411,7 @@ int DivPlatformVERA::getOutputCount() {
|
|||
}
|
||||
|
||||
void DivPlatformVERA::notifyInsDeletion(void* ins) {
|
||||
for (int i=0; i<2; i++) {
|
||||
for (int i=0; i<17; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -986,6 +986,9 @@ void DivPlatformYM2203::notifyInsChange(int ins) {
|
|||
|
||||
void DivPlatformYM2203::notifyInsDeletion(void* ins) {
|
||||
ay->notifyInsDeletion(ins);
|
||||
for (int i=0; i<3; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformYM2203::setSkipRegisterWrites(bool value) {
|
||||
|
|
|
@ -73,7 +73,7 @@ class DivPlatformYM2203: public DivPlatformOPN {
|
|||
int getOutputCount();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
virtual void notifyInsDeletion(void* ins);
|
||||
void setSkipRegisterWrites(bool val);
|
||||
void poke(unsigned int addr, unsigned short val);
|
||||
void poke(std::vector<DivRegWrite>& wlist);
|
||||
|
|
|
@ -641,6 +641,13 @@ void DivPlatformYM2203Ext::notifyInsChange(int ins) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformYM2203Ext::notifyInsDeletion(void* ins) {
|
||||
DivPlatformYM2203::notifyInsDeletion(ins);
|
||||
for (int i=0; i<4; i++) {
|
||||
opChan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
int DivPlatformYM2203Ext::init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) {
|
||||
DivPlatformYM2203::init(parent,channels,sugRate,flags);
|
||||
for (int i=0; i<4; i++) {
|
||||
|
|
|
@ -39,6 +39,7 @@ class DivPlatformYM2203Ext: public DivPlatformYM2203 {
|
|||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||
void quit();
|
||||
~DivPlatformYM2203Ext();
|
||||
|
|
|
@ -1458,6 +1458,12 @@ void DivPlatformYM2608::notifyInsChange(int ins) {
|
|||
|
||||
void DivPlatformYM2608::notifyInsDeletion(void* ins) {
|
||||
ay->notifyInsDeletion(ins);
|
||||
for (int i=0; i<psgChanOffs; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
for (int i=adpcmAChanOffs; i<chanNum; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformYM2608::setSkipRegisterWrites(bool value) {
|
||||
|
|
|
@ -88,7 +88,7 @@ class DivPlatformYM2608: public DivPlatformOPN {
|
|||
int getOutputCount();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
virtual void notifyInsDeletion(void* ins);
|
||||
void setSkipRegisterWrites(bool val);
|
||||
void poke(unsigned int addr, unsigned short val);
|
||||
void poke(std::vector<DivRegWrite>& wlist);
|
||||
|
|
|
@ -679,6 +679,13 @@ void DivPlatformYM2608Ext::notifyInsChange(int ins) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformYM2608Ext::notifyInsDeletion(void* ins) {
|
||||
DivPlatformYM2608::notifyInsDeletion(ins);
|
||||
for (int i=0; i<4; i++) {
|
||||
opChan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
int DivPlatformYM2608Ext::init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) {
|
||||
DivPlatformYM2608::init(parent,channels,sugRate,flags);
|
||||
for (int i=0; i<4; i++) {
|
||||
|
|
|
@ -39,6 +39,7 @@ class DivPlatformYM2608Ext: public DivPlatformYM2608 {
|
|||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||
void quit();
|
||||
~DivPlatformYM2608Ext();
|
||||
|
|
|
@ -1406,6 +1406,12 @@ void DivPlatformYM2610::notifyInsChange(int ins) {
|
|||
|
||||
void DivPlatformYM2610::notifyInsDeletion(void* ins) {
|
||||
ay->notifyInsDeletion(ins);
|
||||
for (int i=0; i<psgChanOffs; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
for (int i=adpcmAChanOffs; i<chanNum; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformYM2610::setSkipRegisterWrites(bool value) {
|
||||
|
|
|
@ -56,7 +56,7 @@ class DivPlatformYM2610: public DivPlatformYM2610Base {
|
|||
int getOutputCount();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
virtual void notifyInsDeletion(void* ins);
|
||||
void setSkipRegisterWrites(bool val);
|
||||
void poke(unsigned int addr, unsigned short val);
|
||||
void poke(std::vector<DivRegWrite>& wlist);
|
||||
|
|
|
@ -1477,6 +1477,12 @@ void DivPlatformYM2610B::notifyInsChange(int ins) {
|
|||
|
||||
void DivPlatformYM2610B::notifyInsDeletion(void* ins) {
|
||||
ay->notifyInsDeletion(ins);
|
||||
for (int i=0; i<psgChanOffs; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
for (int i=adpcmAChanOffs; i<chanNum; i++) {
|
||||
chan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformYM2610B::setSkipRegisterWrites(bool value) {
|
||||
|
|
|
@ -52,7 +52,7 @@ class DivPlatformYM2610B: public DivPlatformYM2610Base {
|
|||
int getOutputCount();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
virtual void notifyInsDeletion(void* ins);
|
||||
void setSkipRegisterWrites(bool val);
|
||||
void poke(unsigned int addr, unsigned short val);
|
||||
void poke(std::vector<DivRegWrite>& wlist);
|
||||
|
|
|
@ -670,6 +670,13 @@ void DivPlatformYM2610BExt::notifyInsChange(int ins) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformYM2610BExt::notifyInsDeletion(void* ins) {
|
||||
DivPlatformYM2610B::notifyInsDeletion(ins);
|
||||
for (int i=0; i<4; i++) {
|
||||
opChan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
int DivPlatformYM2610BExt::init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) {
|
||||
DivPlatformYM2610B::init(parent,channels,sugRate,flags);
|
||||
for (int i=0; i<4; i++) {
|
||||
|
|
|
@ -39,6 +39,7 @@ class DivPlatformYM2610BExt: public DivPlatformYM2610B {
|
|||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||
void quit();
|
||||
~DivPlatformYM2610BExt();
|
||||
|
|
|
@ -670,6 +670,13 @@ void DivPlatformYM2610Ext::notifyInsChange(int ins) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformYM2610Ext::notifyInsDeletion(void* ins) {
|
||||
DivPlatformYM2610::notifyInsDeletion(ins);
|
||||
for (int i=0; i<4; i++) {
|
||||
opChan[i].std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
}
|
||||
|
||||
int DivPlatformYM2610Ext::init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) {
|
||||
DivPlatformYM2610::init(parent,channels,sugRate,flags);
|
||||
for (int i=0; i<4; i++) {
|
||||
|
|
|
@ -39,6 +39,7 @@ class DivPlatformYM2610Ext: public DivPlatformYM2610 {
|
|||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
void notifyInsChange(int ins);
|
||||
void notifyInsDeletion(void* ins);
|
||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||
void quit();
|
||||
~DivPlatformYM2610Ext();
|
||||
|
|
Loading…
Reference in a new issue