dev236 - fix OPM E5xx range
when loading older files or DefleMask modules, E5xx effects will be converted to the new range (previously it was 40-C0).
This commit is contained in:
parent
03794b58f2
commit
6569477706
4 changed files with 40 additions and 8 deletions
|
|
@ -54,8 +54,8 @@ class DivWorkPool;
|
|||
|
||||
#define DIV_UNSTABLE
|
||||
|
||||
#define DIV_VERSION "dev235"
|
||||
#define DIV_ENGINE_VERSION 235
|
||||
#define DIV_VERSION "dev236"
|
||||
#define DIV_ENGINE_VERSION 236
|
||||
// for imports
|
||||
#define DIV_VERSION_MOD 0xff01
|
||||
#define DIV_VERSION_FC 0xff02
|
||||
|
|
|
|||
|
|
@ -840,6 +840,13 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
|
|||
pat->newData[k][DIV_PAT_FXVAL(l)]=128+((pat->newData[k][DIV_PAT_FXVAL(l)]-128)/4);
|
||||
}
|
||||
}
|
||||
// YM2151: pitch effect range is different
|
||||
if (ds.system[0]==DIV_SYSTEM_ARCADE && pat->newData[k][DIV_PAT_FX(l)]==0xe5 && pat->newData[k][DIV_PAT_FXVAL(l)]!=-1) {
|
||||
int newVal=(2*((pat->newData[k][DIV_PAT_FXVAL(l)]&0xff)-0x80))+0x80;
|
||||
if (newVal<0) newVal=0;
|
||||
if (newVal>0xff) newVal=0xff;
|
||||
pat->newData[k][DIV_PAT_FXVAL(l)]=newVal;
|
||||
}
|
||||
}
|
||||
// instrument
|
||||
pat->newData[k][DIV_PAT_INS]=reader.readS();
|
||||
|
|
|
|||
|
|
@ -2143,6 +2143,37 @@ bool DivEngine::loadFur(unsigned char* file, size_t len, int variantID) {
|
|||
}
|
||||
}
|
||||
|
||||
// YM2151 E5xx range was different
|
||||
if (ds.version<236) {
|
||||
int ch=0;
|
||||
// so much nesting
|
||||
for (int i=0; i<ds.systemLen; i++) {
|
||||
if (ds.system[i]==DIV_SYSTEM_YM2151) {
|
||||
// find all E5xx effects and adapt to normal range
|
||||
for (int j=ch; j<ch+8; j++) {
|
||||
for (size_t k=0; k<ds.subsong.size(); k++) {
|
||||
for (int l=0; l<DIV_MAX_PATTERNS; l++) {
|
||||
DivPattern* p=ds.subsong[k]->pat[j].data[l];
|
||||
if (p==NULL) continue;
|
||||
|
||||
for (int m=0; m<DIV_MAX_ROWS; m++) {
|
||||
for (int n=0; n<ds.subsong[k]->pat[j].effectCols; n++) {
|
||||
if (p->newData[m][DIV_PAT_FX(n)]==0xe5 && p->newData[m][DIV_PAT_FXVAL(n)]!=-1) {
|
||||
int newVal=(2*((p->newData[m][DIV_PAT_FXVAL(n)]&0xff)-0x80))+0x80;
|
||||
if (newVal<0) newVal=0;
|
||||
if (newVal>0xff) newVal=0xff;
|
||||
p->newData[m][DIV_PAT_FXVAL(n)]=newVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ch+=getChannelCount(ds.system[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (active) quitDispatch();
|
||||
BUSY_BEGIN_SOFT;
|
||||
saveLock.lock();
|
||||
|
|
|
|||
|
|
@ -1380,12 +1380,6 @@ void DivEngine::processRow(int i, bool afterDelay) {
|
|||
break;
|
||||
case 0xe5: // pitch
|
||||
chan[i].pitch=effectVal-0x80;
|
||||
// why isn't this removed yet? we shouldn't give this chip special treatment!
|
||||
if (sysOfChan[i]==DIV_SYSTEM_YM2151) { // YM2151 pitch oddity
|
||||
chan[i].pitch*=2;
|
||||
if (chan[i].pitch<-128) chan[i].pitch=-128;
|
||||
if (chan[i].pitch>127) chan[i].pitch=127;
|
||||
}
|
||||
// send pitch now
|
||||
dispatchCmd(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
|
||||
dispatchCmd(DivCommand(DIV_CMD_HINT_PITCH,i,chan[i].pitch));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue