add two new compatibility flags
proper noise range and duty macro is wave volume
This commit is contained in:
parent
8772439d3e
commit
e06e316e10
8 changed files with 79 additions and 13 deletions
|
|
@ -2077,6 +2077,10 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
|||
ds.linearPitch=true;
|
||||
ds.loopModality=0;
|
||||
}
|
||||
if (ds.version<43) {
|
||||
ds.properNoiseLayout=false;
|
||||
ds.waveDutyIsVol=false;
|
||||
}
|
||||
|
||||
reader.readS(); // reserved
|
||||
int infoSeek=reader.readI();
|
||||
|
|
@ -2148,7 +2152,17 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
|||
ds.limitSlides=reader.readC();
|
||||
ds.linearPitch=reader.readC();
|
||||
ds.loopModality=reader.readC();
|
||||
for (int i=0; i<17; i++) reader.readC();
|
||||
if (ds.version>=43) {
|
||||
ds.properNoiseLayout=reader.readC();
|
||||
} else {
|
||||
reader.readC();
|
||||
}
|
||||
if (ds.version>=43) {
|
||||
ds.waveDutyIsVol=reader.readC();
|
||||
} else {
|
||||
reader.readC();
|
||||
}
|
||||
for (int i=0; i<15; i++) reader.readC();
|
||||
} else {
|
||||
for (int i=0; i<20; i++) reader.readC();
|
||||
}
|
||||
|
|
@ -2522,7 +2536,9 @@ SafeWriter* DivEngine::saveFur() {
|
|||
w->writeC(song.limitSlides);
|
||||
w->writeC(song.linearPitch);
|
||||
w->writeC(song.loopModality);
|
||||
for (int i=0; i<17; i++) {
|
||||
w->writeC(song.properNoiseLayout);
|
||||
w->writeC(song.waveDutyIsVol);
|
||||
for (int i=0; i<15; i++) {
|
||||
w->writeC(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
#include <map>
|
||||
#include <queue>
|
||||
|
||||
#define DIV_VERSION "0.5.4"
|
||||
#define DIV_ENGINE_VERSION 42
|
||||
#define DIV_VERSION "0.5.5pre1"
|
||||
#define DIV_ENGINE_VERSION 43
|
||||
|
||||
enum DivStatusView {
|
||||
DIV_STATUS_NOTHING=0,
|
||||
|
|
|
|||
|
|
@ -144,6 +144,10 @@ void DivPlatformGB::tick() {
|
|||
DivInstrument* ins=parent->getIns(chan[i].ins);
|
||||
if (i!=2) {
|
||||
rWrite(16+i*5+1,((chan[i].duty&3)<<6)|(63-(ins->gb.soundLen&63)));
|
||||
} else {
|
||||
if (parent->song.waveDutyIsVol) {
|
||||
rWrite(16+i*5+2,gbVolMap[(chan[i].std.duty&3)<<2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (chan[i].std.hadWave) {
|
||||
|
|
@ -164,7 +168,10 @@ void DivPlatformGB::tick() {
|
|||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||
DivInstrument* ins=parent->getIns(chan[i].ins);
|
||||
if (i==3) { // noise
|
||||
chan[i].freq=noiseTable[chan[i].baseFreq];
|
||||
int ntPos=chan[i].baseFreq;
|
||||
if (ntPos<0) ntPos=0;
|
||||
if (ntPos>255) ntPos=255;
|
||||
chan[i].freq=noiseTable[ntPos];
|
||||
} else {
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true);
|
||||
if (chan[i].freq>2047) chan[i].freq=2047;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ void DivPlatformNES::acquire(short* bufL, short* bufR, size_t start, size_t len)
|
|||
}
|
||||
}
|
||||
|
||||
static unsigned char noiseTable[256]={
|
||||
static unsigned char noiseTable[253]={
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 4,
|
||||
15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4,
|
||||
15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4,
|
||||
|
|
@ -155,7 +155,10 @@ void DivPlatformNES::tick() {
|
|||
}
|
||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||
if (i==3) { // noise
|
||||
chan[i].freq=noiseTable[chan[i].baseFreq];
|
||||
int ntPos=chan[i].baseFreq;
|
||||
if (ntPos<0) ntPos=0;
|
||||
if (ntPos>252) ntPos=252;
|
||||
chan[i].freq=(parent->song.properNoiseLayout)?(15-(chan[i].baseFreq&15)):(noiseTable[ntPos]);
|
||||
} else {
|
||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true);
|
||||
if (chan[i].freq>2047) chan[i].freq=2047;
|
||||
|
|
|
|||
|
|
@ -129,17 +129,23 @@ void DivPlatformPCE::tick() {
|
|||
if (chan[i].std.arpMode) {
|
||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp);
|
||||
// noise
|
||||
chWrite(i,0x07,chan[i].noise?(0x80|noiseFreq[(chan[i].std.arp)%12]):0);
|
||||
int noiseSeek=chan[i].std.arp;
|
||||
if (noiseSeek<0) noiseSeek=0;
|
||||
chWrite(i,0x07,chan[i].noise?(0x80|(parent->song.properNoiseLayout?(noiseSeek&31):noiseFreq[noiseSeek%12])):0);
|
||||
} else {
|
||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp);
|
||||
chWrite(i,0x07,chan[i].noise?(0x80|noiseFreq[(chan[i].note+chan[i].std.arp)%12]):0);
|
||||
int noiseSeek=chan[i].note+chan[i].std.arp;
|
||||
if (noiseSeek<0) noiseSeek=0;
|
||||
chWrite(i,0x07,chan[i].noise?(0x80|(parent->song.properNoiseLayout?(noiseSeek&31):noiseFreq[noiseSeek%12])):0);
|
||||
}
|
||||
}
|
||||
chan[i].freqChanged=true;
|
||||
} else {
|
||||
if (chan[i].std.arpMode && chan[i].std.finishedArp) {
|
||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
||||
chWrite(i,0x07,chan[i].noise?(0x80|noiseFreq[chan[i].note%12]):0);
|
||||
int noiseSeek=chan[i].note;
|
||||
if (noiseSeek<0) noiseSeek=0;
|
||||
chWrite(i,0x07,chan[i].noise?(0x80|(parent->song.properNoiseLayout?(noiseSeek&31):noiseFreq[noiseSeek%12])):0);
|
||||
chan[i].freqChanged=true;
|
||||
}
|
||||
}
|
||||
|
|
@ -248,7 +254,9 @@ int DivPlatformPCE::dispatch(DivCommand c) {
|
|||
chan[c.chan].baseFreq=NOTE_PERIODIC(c.value);
|
||||
chan[c.chan].freqChanged=true;
|
||||
chan[c.chan].note=c.value;
|
||||
chWrite(c.chan,0x07,chan[c.chan].noise?(0x80|noiseFreq[chan[c.chan].note%12]):0);
|
||||
int noiseSeek=chan[c.chan].note;
|
||||
if (noiseSeek<0) noiseSeek=0;
|
||||
chWrite(c.chan,0x07,chan[c.chan].noise?(0x80|(parent->song.properNoiseLayout?(noiseSeek&31):noiseFreq[noiseSeek%12])):0);
|
||||
}
|
||||
chan[c.chan].active=true;
|
||||
chan[c.chan].keyOn=true;
|
||||
|
|
|
|||
|
|
@ -215,6 +215,8 @@ struct DivSong {
|
|||
// 1: fake reset on loop
|
||||
// 2: don't do anything on loop
|
||||
unsigned char loopModality;
|
||||
bool properNoiseLayout;
|
||||
bool waveDutyIsVol;
|
||||
|
||||
DivOrders orders;
|
||||
std::vector<DivInstrument*> ins;
|
||||
|
|
@ -263,7 +265,9 @@ struct DivSong {
|
|||
tuning(440.0f),
|
||||
limitSlides(false),
|
||||
linearPitch(true),
|
||||
loopModality(0) {
|
||||
loopModality(0),
|
||||
properNoiseLayout(false),
|
||||
waveDutyIsVol(false) {
|
||||
for (int i=0; i<32; i++) {
|
||||
system[i]=DIV_SYSTEM_NULL;
|
||||
systemVol[i]=64;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue