lots of changes
- GUI: ability to load files - GUI: arrow key navigation - fix sample volumes
This commit is contained in:
parent
29d7be032a
commit
52087edceb
30 changed files with 377 additions and 37 deletions
|
|
@ -117,5 +117,12 @@ class DivDispatch {
|
|||
* @return the number of channels allocated.
|
||||
*/
|
||||
virtual int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||
|
||||
/**
|
||||
* quit the DivDispatch.
|
||||
*/
|
||||
virtual void quit();
|
||||
|
||||
virtual ~DivDispatch();
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1023,7 +1023,7 @@ void DivEngine::renderSamples() {
|
|||
|
||||
// step 1: render to PCM
|
||||
unsigned int k=0;
|
||||
float mult=(float)(s->vol+100)/150.0f;
|
||||
float mult=(float)(s->vol)/50.0f;
|
||||
for (double j=0; j<s->length; j+=samplePitches[s->pitch]) {
|
||||
if (k>=s->rendLength) {
|
||||
break;
|
||||
|
|
@ -1257,6 +1257,27 @@ void DivEngine::initDispatch() {
|
|||
|
||||
void DivEngine::quitDispatch() {
|
||||
if (dispatch==NULL) return;
|
||||
isBusy.lock();
|
||||
dispatch->quit();
|
||||
delete dispatch;
|
||||
dispatch=NULL;
|
||||
chans=0;
|
||||
playing=false;
|
||||
speedAB=false;
|
||||
endOfSong=false;
|
||||
ticks=0;
|
||||
cycles=0;
|
||||
curRow=0;
|
||||
curOrder=0;
|
||||
nextSpeed=3;
|
||||
clockDrift=0;
|
||||
changeOrd=-1;
|
||||
changePos=0;
|
||||
totalTicks=0;
|
||||
totalCmds=0;
|
||||
lastCmds=0;
|
||||
cmdsPerSecond=0;
|
||||
isBusy.unlock();
|
||||
}
|
||||
|
||||
bool DivEngine::init(String outName) {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@ class DivEngine {
|
|||
void processRow(int i, bool afterDelay);
|
||||
void nextOrder();
|
||||
void nextRow();
|
||||
void reset();
|
||||
// returns true if end of song.
|
||||
bool nextTick();
|
||||
bool perSystemEffect(int ch, unsigned char effect, unsigned char effectVal);
|
||||
|
|
@ -113,6 +112,9 @@ class DivEngine {
|
|||
// stop
|
||||
void stop();
|
||||
|
||||
// reset playback state
|
||||
void reset();
|
||||
|
||||
// get sys channel count
|
||||
int getChannelCount(DivSystem sys);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,3 +24,9 @@ bool DivDispatch::keyOffAffectsArp(int ch) {
|
|||
int DivDispatch::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DivDispatch::quit() {
|
||||
}
|
||||
|
||||
DivDispatch::~DivDispatch() {
|
||||
}
|
||||
|
|
@ -377,3 +377,9 @@ int DivPlatformArcade::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
|||
|
||||
return 13;
|
||||
}
|
||||
|
||||
void DivPlatformArcade::quit() {
|
||||
}
|
||||
|
||||
DivPlatformArcade::~DivPlatformArcade() {
|
||||
}
|
||||
|
|
@ -53,5 +53,7 @@ class DivPlatformArcade: public DivDispatch {
|
|||
void tick();
|
||||
bool isStereo();
|
||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||
void quit();
|
||||
~DivPlatformArcade();
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -314,3 +314,9 @@ int DivPlatformC64::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
|||
|
||||
return 3;
|
||||
}
|
||||
|
||||
void DivPlatformC64::quit() {
|
||||
}
|
||||
|
||||
DivPlatformC64::~DivPlatformC64() {
|
||||
}
|
||||
|
|
@ -59,6 +59,8 @@ class DivPlatformC64: public DivDispatch {
|
|||
void tick();
|
||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||
void setChipModel(bool is6581);
|
||||
void quit();
|
||||
~DivPlatformC64();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -75,3 +75,9 @@ int DivPlatformDummy::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
|||
reset();
|
||||
return channels;
|
||||
}
|
||||
|
||||
void DivPlatformDummy::quit() {
|
||||
}
|
||||
|
||||
DivPlatformDummy::~DivPlatformDummy() {
|
||||
}
|
||||
|
|
@ -20,4 +20,6 @@ class DivPlatformDummy: public DivDispatch {
|
|||
void reset();
|
||||
void tick();
|
||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||
void quit();
|
||||
~DivPlatformDummy();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -295,3 +295,10 @@ int DivPlatformGB::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
|||
reset();
|
||||
return 4;
|
||||
}
|
||||
|
||||
void DivPlatformGB::quit() {
|
||||
delete gb;
|
||||
}
|
||||
|
||||
DivPlatformGB::~DivPlatformGB() {
|
||||
}
|
||||
|
|
@ -42,6 +42,8 @@ class DivPlatformGB: public DivDispatch {
|
|||
void tick();
|
||||
bool isStereo();
|
||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||
void quit();
|
||||
~DivPlatformGB();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -413,3 +413,10 @@ int DivPlatformGenesis::init(DivEngine* p, int channels, int sugRate, bool pal)
|
|||
reset();
|
||||
return 10;
|
||||
}
|
||||
|
||||
void DivPlatformGenesis::quit() {
|
||||
psg.quit();
|
||||
}
|
||||
|
||||
DivPlatformGenesis::~DivPlatformGenesis() {
|
||||
}
|
||||
|
|
@ -56,5 +56,7 @@ class DivPlatformGenesis: public DivDispatch {
|
|||
bool isStereo();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||
void quit();
|
||||
~DivPlatformGenesis();
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -277,3 +277,10 @@ int DivPlatformGenesisExt::init(DivEngine* parent, int channels, int sugRate, bo
|
|||
reset();
|
||||
return 13;
|
||||
}
|
||||
|
||||
void DivPlatformGenesisExt::quit() {
|
||||
DivPlatformGenesis::quit();
|
||||
}
|
||||
|
||||
DivPlatformGenesisExt::~DivPlatformGenesisExt() {
|
||||
}
|
||||
|
|
@ -20,4 +20,6 @@ class DivPlatformGenesisExt: public DivPlatformGenesis {
|
|||
void tick();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||
void quit();
|
||||
~DivPlatformGenesisExt();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -310,3 +310,9 @@ int DivPlatformNES::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
|||
reset();
|
||||
return 5;
|
||||
}
|
||||
|
||||
void DivPlatformNES::quit() {
|
||||
}
|
||||
|
||||
DivPlatformNES::~DivPlatformNES() {
|
||||
}
|
||||
|
|
@ -48,6 +48,8 @@ class DivPlatformNES: public DivDispatch {
|
|||
void tick();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||
void quit();
|
||||
~DivPlatformNES();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -304,3 +304,10 @@ int DivPlatformPCE::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
|||
reset();
|
||||
return 6;
|
||||
}
|
||||
|
||||
void DivPlatformPCE::quit() {
|
||||
delete pce;
|
||||
}
|
||||
|
||||
DivPlatformPCE::~DivPlatformPCE() {
|
||||
}
|
||||
|
|
@ -60,6 +60,8 @@ class DivPlatformPCE: public DivDispatch {
|
|||
bool isStereo();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||
void quit();
|
||||
~DivPlatformPCE();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -183,3 +183,10 @@ int DivPlatformSMS::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
|||
reset();
|
||||
return 4;
|
||||
}
|
||||
|
||||
void DivPlatformSMS::quit() {
|
||||
delete sn;
|
||||
}
|
||||
|
||||
DivPlatformSMS::~DivPlatformSMS() {
|
||||
}
|
||||
|
|
@ -38,6 +38,8 @@ class DivPlatformSMS: public DivDispatch {
|
|||
void tick();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||
void quit();
|
||||
~DivPlatformSMS();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -529,3 +529,10 @@ int DivPlatformYM2610::init(DivEngine* p, int channels, int sugRate, bool pal) {
|
|||
reset();
|
||||
return 10;
|
||||
}
|
||||
|
||||
void DivPlatformYM2610::quit() {
|
||||
delete fm;
|
||||
}
|
||||
|
||||
DivPlatformYM2610::~DivPlatformYM2610() {
|
||||
}
|
||||
|
|
@ -66,5 +66,7 @@ class DivPlatformYM2610: public DivDispatch {
|
|||
bool isStereo();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||
void quit();
|
||||
~DivPlatformYM2610();
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -256,3 +256,10 @@ int DivPlatformYM2610Ext::init(DivEngine* parent, int channels, int sugRate, boo
|
|||
reset();
|
||||
return 16;
|
||||
}
|
||||
|
||||
void DivPlatformYM2610Ext::quit() {
|
||||
DivPlatformYM2610::quit();
|
||||
}
|
||||
|
||||
DivPlatformYM2610Ext::~DivPlatformYM2610Ext() {
|
||||
}
|
||||
|
|
@ -20,4 +20,6 @@ class DivPlatformYM2610Ext: public DivPlatformYM2610 {
|
|||
void tick();
|
||||
bool keyOffAffectsArp(int ch);
|
||||
int init(DivEngine* parent, int channels, int sugRate, bool pal);
|
||||
void quit();
|
||||
~DivPlatformYM2610Ext();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -778,7 +778,7 @@ bool DivEngine::nextTick() {
|
|||
}
|
||||
|
||||
void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsigned int size) {
|
||||
if (!playing) {
|
||||
if (!playing || dispatch==NULL) {
|
||||
memset(out[0],0,size*sizeof(float));
|
||||
memset(out[1],0,size*sizeof(float));
|
||||
return;
|
||||
|
|
@ -821,7 +821,6 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
}
|
||||
}
|
||||
}
|
||||
isBusy.unlock();
|
||||
totalProcessed=(1+runPos)*got.rate/dispatch->rate;
|
||||
|
||||
for (size_t i=0; i<runtotal; i++) {
|
||||
|
|
@ -844,7 +843,10 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
blip_read_samples(bb[1],bbOut[1],size,0);
|
||||
}
|
||||
|
||||
if (out==NULL) return;
|
||||
if (out==NULL) {
|
||||
isBusy.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
if (dispatch->isStereo()) {
|
||||
for (size_t i=0; i<size; i++) {
|
||||
|
|
@ -857,4 +859,5 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
out[1][i]=(float)bbOut[0][i]/16384.0;
|
||||
}
|
||||
}
|
||||
isBusy.unlock();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue