dev183 - prepare for better DPCM mapping
This commit is contained in:
parent
ddf0e3f368
commit
7ede07e2a4
6 changed files with 461 additions and 278 deletions
|
|
@ -54,8 +54,8 @@ class DivWorkPool;
|
|||
|
||||
#define DIV_UNSTABLE
|
||||
|
||||
#define DIV_VERSION "dev182"
|
||||
#define DIV_ENGINE_VERSION 182
|
||||
#define DIV_VERSION "dev183"
|
||||
#define DIV_ENGINE_VERSION 183
|
||||
// for imports
|
||||
#define DIV_VERSION_MOD 0xff01
|
||||
#define DIV_VERSION_FC 0xff02
|
||||
|
|
|
|||
|
|
@ -719,6 +719,21 @@ void DivInstrument::writeFeatureX1(SafeWriter* w) {
|
|||
FEATURE_END;
|
||||
}
|
||||
|
||||
void DivInstrument::writeFeatureNE(SafeWriter* w) {
|
||||
FEATURE_BEGIN("NE");
|
||||
|
||||
w->writeC(amiga.useNoteMap?1:0);
|
||||
|
||||
if (amiga.useNoteMap) {
|
||||
for (int note=0; note<120; note++) {
|
||||
w->writeC(amiga.noteMap[note].dpcmFreq);
|
||||
w->writeC(amiga.noteMap[note].dpcmDelta);
|
||||
}
|
||||
}
|
||||
|
||||
FEATURE_END;
|
||||
}
|
||||
|
||||
void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bool insName) {
|
||||
size_t blockStartSeek=0;
|
||||
size_t blockEndSeek=0;
|
||||
|
|
@ -761,6 +776,7 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bo
|
|||
bool featureSU=false;
|
||||
bool featureES=false;
|
||||
bool featureX1=false;
|
||||
bool featureNE=false;
|
||||
|
||||
bool checkForWL=false;
|
||||
|
||||
|
|
@ -904,6 +920,8 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bo
|
|||
featureFM=true;
|
||||
break;
|
||||
case DIV_INS_NES:
|
||||
featureSM=true;
|
||||
featureNE=true;
|
||||
break;
|
||||
case DIV_INS_MSM6258:
|
||||
featureSM=true;
|
||||
|
|
@ -993,6 +1011,7 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bo
|
|||
}
|
||||
if (amiga!=defaultIns.amiga) {
|
||||
featureSM=true;
|
||||
featureNE=true;
|
||||
}
|
||||
if (snes!=defaultIns.snes) {
|
||||
featureSN=true;
|
||||
|
|
@ -1157,6 +1176,9 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bo
|
|||
if (featureX1) {
|
||||
writeFeatureX1(w);
|
||||
}
|
||||
if (featureNE) {
|
||||
writeFeatureNE(w);
|
||||
}
|
||||
|
||||
if (fui && (featureSL || featureWL)) {
|
||||
w->write("EN",2);
|
||||
|
|
@ -2541,6 +2563,21 @@ void DivInstrument::readFeatureX1(SafeReader& reader, short version) {
|
|||
READ_FEAT_END;
|
||||
}
|
||||
|
||||
void DivInstrument::readFeatureNE(SafeReader& reader, short version) {
|
||||
READ_FEAT_BEGIN;
|
||||
|
||||
amiga.useNoteMap=reader.readC();
|
||||
|
||||
if (amiga.useNoteMap) {
|
||||
for (int note=0; note<120; note++) {
|
||||
amiga.noteMap[note].dpcmFreq=reader.readC();
|
||||
amiga.noteMap[note].dpcmDelta=reader.readC();
|
||||
}
|
||||
}
|
||||
|
||||
READ_FEAT_END;
|
||||
}
|
||||
|
||||
DivDataErrors DivInstrument::readInsDataNew(SafeReader& reader, short version, bool fui, DivSong* song) {
|
||||
unsigned char featCode[2];
|
||||
|
||||
|
|
@ -2606,6 +2643,8 @@ DivDataErrors DivInstrument::readInsDataNew(SafeReader& reader, short version, b
|
|||
readFeatureES(reader,version);
|
||||
} else if (memcmp(featCode,"X1",2)==0) { // X1-010
|
||||
readFeatureX1(reader,version);
|
||||
} else if (memcmp(featCode,"NE",2)==0) { // NES (DPCM)
|
||||
readFeatureNE(reader,version);
|
||||
} else {
|
||||
if (song==NULL && (memcmp(featCode,"SL",2)==0 || (memcmp(featCode,"WL",2)==0))) {
|
||||
// nothing
|
||||
|
|
|
|||
|
|
@ -452,9 +452,13 @@ struct DivInstrumentAmiga {
|
|||
struct SampleMap {
|
||||
int freq;
|
||||
short map;
|
||||
SampleMap(int f=0, short m=-1):
|
||||
signed char dpcmFreq;
|
||||
signed char dpcmDelta;
|
||||
SampleMap(int f=0, short m=-1, signed char df=15, signed char dd=-1):
|
||||
freq(f),
|
||||
map(m) {}
|
||||
map(m),
|
||||
dpcmFreq(df),
|
||||
dpcmDelta(dd) {}
|
||||
};
|
||||
short initSample;
|
||||
bool useNoteMap;
|
||||
|
|
@ -759,6 +763,7 @@ struct DivInstrument {
|
|||
void writeFeatureSU(SafeWriter* w);
|
||||
void writeFeatureES(SafeWriter* w);
|
||||
void writeFeatureX1(SafeWriter* w);
|
||||
void writeFeatureNE(SafeWriter* w);
|
||||
|
||||
void readFeatureNA(SafeReader& reader, short version);
|
||||
void readFeatureFM(SafeReader& reader, short version);
|
||||
|
|
@ -778,6 +783,7 @@ struct DivInstrument {
|
|||
void readFeatureSU(SafeReader& reader, short version);
|
||||
void readFeatureES(SafeReader& reader, short version);
|
||||
void readFeatureX1(SafeReader& reader, short version);
|
||||
void readFeatureNE(SafeReader& reader, short version);
|
||||
|
||||
DivDataErrors readInsDataOld(SafeReader& reader, short version);
|
||||
DivDataErrors readInsDataNew(SafeReader& reader, short version, bool fui, DivSong* song);
|
||||
|
|
|
|||
|
|
@ -695,8 +695,8 @@ void DivEngine::registerSystems() {
|
|||
{"Pulse 1", "Pulse 2", "Triangle", "Noise", "DPCM"},
|
||||
{"S1", "S2", "TR", "NO", "DMC"},
|
||||
{DIV_CH_PULSE, DIV_CH_PULSE, DIV_CH_WAVE, DIV_CH_NOISE, DIV_CH_PCM},
|
||||
{DIV_INS_NES, DIV_INS_NES, DIV_INS_NES, DIV_INS_NES, DIV_INS_AMIGA},
|
||||
{},
|
||||
{DIV_INS_NES, DIV_INS_NES, DIV_INS_NES, DIV_INS_NES, DIV_INS_NES},
|
||||
{DIV_INS_NULL, DIV_INS_NULL, DIV_INS_NULL, DIV_INS_NULL, DIV_INS_AMIGA},
|
||||
{
|
||||
{0x11, {DIV_CMD_NES_DMC, "11xx: Write to delta modulation counter (0 to 7F)"}},
|
||||
{0x12, {DIV_CMD_STD_NOISE_MODE, "12xx: Set duty cycle/noise mode (pulse: 0 to 3; noise: 0 or 1)"}},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue