waveform width/height controls
This commit is contained in:
parent
02b5b05e04
commit
5637639950
5 changed files with 47 additions and 7 deletions
|
|
@ -515,6 +515,13 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
|
|||
if (ds.system[0]==DIV_SYSTEM_C64_8580 || ds.system[0]==DIV_SYSTEM_C64_6581) {
|
||||
ins->type=DIV_INS_C64;
|
||||
}
|
||||
if (ds.system[0]==DIV_SYSTEM_YM2610 || ds.system[0]==DIV_SYSTEM_YM2610_EXT) {
|
||||
ins->std.dutyMacroHeight=31;
|
||||
ins->std.waveMacroHeight=7;
|
||||
}
|
||||
if (ds.system[0]==DIV_SYSTEM_PCE) {
|
||||
ins->std.volMacroHeight=31;
|
||||
}
|
||||
|
||||
if (ins->mode) { // FM
|
||||
ins->fm.alg=reader.readC();
|
||||
|
|
@ -712,6 +719,9 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
|
|||
for (int i=0; i<ds.waveLen; i++) {
|
||||
DivWavetable* wave=new DivWavetable;
|
||||
wave->len=(unsigned char)reader.readI();
|
||||
if (ds.system[0]==DIV_SYSTEM_GB) {
|
||||
wave->max=15;
|
||||
}
|
||||
if (wave->len>32) {
|
||||
logE("invalid wave length %d. are we doing something wrong?\n",wave->len);
|
||||
lastError="file is corrupt or unreadable at wavetables";
|
||||
|
|
|
|||
|
|
@ -19,8 +19,13 @@ void DivPlatformGB::updateWave() {
|
|||
DivWavetable* wt=parent->getWave(chan[2].wave);
|
||||
rWrite(0x1a,0);
|
||||
for (int i=0; i<16; i++) {
|
||||
unsigned char next=((wt->data[i*2]&15)<<4)|(wt->data[1+i*2]&15);
|
||||
rWrite(0x30+i,next);
|
||||
if (wt->max<1 || wt->len<1) {
|
||||
rWrite(0x30+i,0);
|
||||
} else {
|
||||
unsigned char nibble1=(wt->data[(i*2)*wt->len/32]*15)/wt->max;
|
||||
unsigned char nibble2=(wt->data[(1+i*2)*wt->len/32]*15)/wt->max;
|
||||
rWrite(0x30+i,(nibble1<<4)|nibble2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,11 @@ void DivPlatformPCE::updateWave(int ch) {
|
|||
chWrite(ch,0x04,0x5f);
|
||||
chWrite(ch,0x04,0x1f);
|
||||
for (int i=0; i<32; i++) {
|
||||
chWrite(ch,0x06,wt->data[i]&31);
|
||||
if (wt->max<1 || wt->len<1) {
|
||||
chWrite(ch,0x06,0);
|
||||
} else {
|
||||
chWrite(ch,0x06,wt->data[i*wt->len/32]*31/wt->max);
|
||||
}
|
||||
}
|
||||
if (chan[ch].active) {
|
||||
chWrite(ch,0x04,0x80|chan[ch].outVol);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
struct DivWavetable {
|
||||
int len, min, max;
|
||||
int data[32];
|
||||
int data[256];
|
||||
|
||||
DivWavetable():
|
||||
len(32),
|
||||
min(0),
|
||||
max(31) {
|
||||
for (int i=0; i<32; i++) {
|
||||
for (int i=0; i<256; i++) {
|
||||
data[i]=i;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue