mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-24 05:25:12 +00:00
PET: Use wave bits macro instead
This commit is contained in:
parent
47c5c34e1c
commit
c32ea59285
3 changed files with 10 additions and 33 deletions
|
@ -74,24 +74,11 @@ void DivPlatformPET::acquire(short* bufL, short* bufR, size_t start, size_t len)
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformPET::updateWave() {
|
||||
DivWavetable* wt=parent->getWave(chan.wave);
|
||||
if (wt->max<1 || wt->len<1) {
|
||||
rWrite(10,0);
|
||||
} else {
|
||||
unsigned char sr=0;
|
||||
for (int i=0; i<8; i++) {
|
||||
sr=(sr<<1)|((wt->data[i*wt->len/8]*2)/(wt->max+1));
|
||||
}
|
||||
rWrite(10,sr);
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformPET::writeOutVol() {
|
||||
if (chan.active && !isMuted && chan.outVol>0) {
|
||||
if (regPool[11]!=16) {
|
||||
rWrite(11,16);
|
||||
rWrite(10,regPool[10]);
|
||||
rWrite(10,chan.wave);
|
||||
}
|
||||
} else {
|
||||
rWrite(11,0);
|
||||
|
@ -122,7 +109,7 @@ void DivPlatformPET::tick() {
|
|||
if (chan.std.hadWave) {
|
||||
if (chan.wave!=chan.std.wave) {
|
||||
chan.wave=chan.std.wave;
|
||||
updateWave();
|
||||
rWrite(10,chan.wave);
|
||||
}
|
||||
}
|
||||
if (chan.freqChanged || chan.keyOn || chan.keyOff) {
|
||||
|
@ -135,10 +122,6 @@ void DivPlatformPET::tick() {
|
|||
chan.outVol=chan.vol;
|
||||
writeOutVol();
|
||||
}
|
||||
if (chan.wave<0) {
|
||||
chan.wave=0;
|
||||
updateWave();
|
||||
}
|
||||
chan.keyOn=false;
|
||||
}
|
||||
if (chan.keyOff) {
|
||||
|
@ -195,8 +178,7 @@ int DivPlatformPET::dispatch(DivCommand c) {
|
|||
break;
|
||||
case DIV_CMD_WAVE:
|
||||
chan.wave=c.value;
|
||||
updateWave();
|
||||
chan.keyOn=true;
|
||||
rWrite(10,chan.wave);
|
||||
break;
|
||||
case DIV_CMD_NOTE_PORTA: {
|
||||
int destFreq=NOTE_PERIODIC(c.value2);
|
||||
|
@ -252,7 +234,6 @@ void DivPlatformPET::muteChannel(int ch, bool mute) {
|
|||
void DivPlatformPET::forceIns() {
|
||||
chan.insChanged=true;
|
||||
chan.freqChanged=true;
|
||||
updateWave();
|
||||
writeOutVol();
|
||||
}
|
||||
|
||||
|
@ -271,19 +252,12 @@ int DivPlatformPET::getRegisterPoolSize() {
|
|||
void DivPlatformPET::reset() {
|
||||
memset(regPool,0,16);
|
||||
chan=Channel();
|
||||
chan.vol=1;
|
||||
}
|
||||
|
||||
bool DivPlatformPET::isStereo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void DivPlatformPET::notifyWaveChange(int wave) {
|
||||
if (chan.wave==wave) {
|
||||
updateWave();
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformPET::notifyInsDeletion(void* ins) {
|
||||
chan.std.notifyInsDeletion((DivInstrument*)ins);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class DivPlatformPET: public DivDispatch {
|
|||
inPorta(false),
|
||||
vol(1),
|
||||
outVol(1),
|
||||
wave(-1),
|
||||
wave(0b00001111),
|
||||
sreg(0),
|
||||
cnt(0),
|
||||
out(0) {}
|
||||
|
@ -56,7 +56,6 @@ class DivPlatformPET: public DivDispatch {
|
|||
bool isMuted;
|
||||
|
||||
unsigned char regPool[16];
|
||||
void updateWave();
|
||||
friend void putDispatchChan(void*,int,int);
|
||||
public:
|
||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
||||
|
@ -68,7 +67,6 @@ class DivPlatformPET: public DivDispatch {
|
|||
void forceIns();
|
||||
void tick();
|
||||
void muteChannel(int ch, bool mute);
|
||||
void notifyWaveChange(int wave);
|
||||
void notifyInsDeletion(void* ins);
|
||||
bool isStereo();
|
||||
void poke(unsigned int addr, unsigned short val);
|
||||
|
|
|
@ -1612,8 +1612,13 @@ void FurnaceGUI::drawInsEdit() {
|
|||
if (ins->type==DIV_INS_SAA1099) waveMax=2;
|
||||
if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPLL || ins->type==DIV_INS_OPL || ins->type==DIV_INS_OPZ) waveMax=0;
|
||||
if (ins->type==DIV_INS_MIKEY) waveMax=0;
|
||||
if (ins->type==DIV_INS_PET) {
|
||||
waveMax=8;
|
||||
bitMode=true;
|
||||
}
|
||||
|
||||
const char** waveNames=ayShapeBits;
|
||||
const char** waveNames=NULL;
|
||||
if (ins->type==DIV_INS_AY || ins->type==DIV_INS_AY8930 || ins->type==DIV_INS_SAA1099) waveNames=ayShapeBits;
|
||||
if (ins->type==DIV_INS_C64) waveNames=c64ShapeBits;
|
||||
|
||||
int ex1Max=(ins->type==DIV_INS_AY8930)?8:0;
|
||||
|
|
Loading…
Reference in a new issue