Fix typecasting
This commit is contained in:
parent
3119ed8cc5
commit
a647a2599f
|
@ -287,7 +287,7 @@ void DivPlatformES5506::e_pin(bool state)
|
||||||
DivInstrument* ins=parent->getIns(chan[ch].ins);
|
DivInstrument* ins=parent->getIns(chan[ch].ins);
|
||||||
if (!ins->amiga.useNoteMap && ins->amiga.transWave.enable) {
|
if (!ins->amiga.useNoteMap && ins->amiga.transWave.enable) {
|
||||||
const int next=chan[ch].pcm.next;
|
const int next=chan[ch].pcm.next;
|
||||||
if (next>=0 && next<ins->amiga.transWaveMap.size()) {
|
if (next>=0 && next<(int)ins->amiga.transWaveMap.size()) {
|
||||||
DivInstrumentAmiga::TransWaveMap& transWaveInd=ins->amiga.transWaveMap[next];
|
DivInstrumentAmiga::TransWaveMap& transWaveInd=ins->amiga.transWaveMap[next];
|
||||||
int sample=transWaveInd.ind;
|
int sample=transWaveInd.ind;
|
||||||
if (sample>=0 && sample<parent->song.sampleLen) {
|
if (sample>=0 && sample<parent->song.sampleLen) {
|
||||||
|
@ -578,7 +578,7 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
// transwave macros
|
// transwave macros
|
||||||
if (chan[i].transWave.enable) {
|
if (chan[i].transWave.enable) {
|
||||||
if (chan[i].std.wave.had) {
|
if (chan[i].std.wave.had) {
|
||||||
if (chan[i].std.wave.val>=0 && chan[i].std.wave.val<ins->amiga.transWaveMap.size()) {
|
if (chan[i].std.wave.val>=0 && chan[i].std.wave.val<(int)ins->amiga.transWaveMap.size()) {
|
||||||
if (chan[i].pcm.next!=chan[i].std.wave.val) {
|
if (chan[i].pcm.next!=chan[i].std.wave.val) {
|
||||||
chan[i].pcm.next=chan[i].std.wave.val;
|
chan[i].pcm.next=chan[i].std.wave.val;
|
||||||
chan[i].pcmChanged.transwaveInd=1;
|
chan[i].pcmChanged.transwaveInd=1;
|
||||||
|
@ -642,7 +642,7 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
if (!chan[i].isTranswave) {
|
if (!chan[i].isTranswave) {
|
||||||
if (chan[i].pcmChanged.transwaveInd && (!ins->amiga.useNoteMap && ins->amiga.transWave.enable)) {
|
if (chan[i].pcmChanged.transwaveInd && (!ins->amiga.useNoteMap && ins->amiga.transWave.enable)) {
|
||||||
const int next=chan[i].pcm.next;
|
const int next=chan[i].pcm.next;
|
||||||
if (next>=0 && next<ins->amiga.transWaveMap.size()) {
|
if (next>=0 && next<(int)ins->amiga.transWaveMap.size()) {
|
||||||
DivInstrumentAmiga::TransWaveMap& transWaveInd=ins->amiga.transWaveMap[next];
|
DivInstrumentAmiga::TransWaveMap& transWaveInd=ins->amiga.transWaveMap[next];
|
||||||
int sample=transWaveInd.ind;
|
int sample=transWaveInd.ind;
|
||||||
if (sample>=0 && sample<parent->song.sampleLen) {
|
if (sample>=0 && sample<parent->song.sampleLen) {
|
||||||
|
@ -691,7 +691,7 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
const int next=chan[i].pcm.next;
|
const int next=chan[i].pcm.next;
|
||||||
bool sampleVaild=false;
|
bool sampleVaild=false;
|
||||||
if (((ins->amiga.useNoteMap && !ins->amiga.transWave.enable) && (next>=0 && next<120)) ||
|
if (((ins->amiga.useNoteMap && !ins->amiga.transWave.enable) && (next>=0 && next<120)) ||
|
||||||
((!ins->amiga.useNoteMap && ins->amiga.transWave.enable) && (next>=0 && next<ins->amiga.transWaveMap.size())) ||
|
((!ins->amiga.useNoteMap && ins->amiga.transWave.enable) && (next>=0 && next<(int)ins->amiga.transWaveMap.size())) ||
|
||||||
((!ins->amiga.useNoteMap && !ins->amiga.transWave.enable) && (next>=0 && next<parent->song.sampleLen))) {
|
((!ins->amiga.useNoteMap && !ins->amiga.transWave.enable) && (next>=0 && next<parent->song.sampleLen))) {
|
||||||
DivInstrumentAmiga::NoteMap& noteMapind=ins->amiga.noteMap[next];
|
DivInstrumentAmiga::NoteMap& noteMapind=ins->amiga.noteMap[next];
|
||||||
DivInstrumentAmiga::TransWaveMap& transWaveInd=ins->amiga.transWaveMap[next];
|
DivInstrumentAmiga::TransWaveMap& transWaveInd=ins->amiga.transWaveMap[next];
|
||||||
|
@ -999,7 +999,7 @@ int DivPlatformES5506::dispatch(DivCommand c) {
|
||||||
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
|
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
|
||||||
bool sampleVaild=false;
|
bool sampleVaild=false;
|
||||||
if (((ins->amiga.useNoteMap && !ins->amiga.transWave.enable) && (c.value>=0 && c.value<120)) ||
|
if (((ins->amiga.useNoteMap && !ins->amiga.transWave.enable) && (c.value>=0 && c.value<120)) ||
|
||||||
((!ins->amiga.useNoteMap && ins->amiga.transWave.enable) && (ins->amiga.transWave.ind>=0 && ins->amiga.transWave.ind<ins->amiga.transWaveMap.size())) ||
|
((!ins->amiga.useNoteMap && ins->amiga.transWave.enable) && (ins->amiga.transWave.ind>=0 && ins->amiga.transWave.ind<(int)ins->amiga.transWaveMap.size())) ||
|
||||||
((!ins->amiga.useNoteMap && !ins->amiga.transWave.enable) && (ins->amiga.initSample>=0 && ins->amiga.initSample<parent->song.sampleLen))) {
|
((!ins->amiga.useNoteMap && !ins->amiga.transWave.enable) && (ins->amiga.initSample>=0 && ins->amiga.initSample<parent->song.sampleLen))) {
|
||||||
DivInstrumentAmiga::NoteMap& noteMapind=ins->amiga.noteMap[c.value];
|
DivInstrumentAmiga::NoteMap& noteMapind=ins->amiga.noteMap[c.value];
|
||||||
DivInstrumentAmiga::TransWaveMap& transWaveInd=ins->amiga.transWaveMap[ins->amiga.transWave.ind];
|
DivInstrumentAmiga::TransWaveMap& transWaveInd=ins->amiga.transWaveMap[ins->amiga.transWave.ind];
|
||||||
|
@ -1170,7 +1170,7 @@ int DivPlatformES5506::dispatch(DivCommand c) {
|
||||||
if (chan[c.chan].active) {
|
if (chan[c.chan].active) {
|
||||||
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
|
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
|
||||||
if (((ins->amiga.useNoteMap && !ins->amiga.transWave.enable) && (c.value>=0 && c.value<120)) ||
|
if (((ins->amiga.useNoteMap && !ins->amiga.transWave.enable) && (c.value>=0 && c.value<120)) ||
|
||||||
((!ins->amiga.useNoteMap && ins->amiga.transWave.enable) && (c.value>=0 && c.value<ins->amiga.transWaveMap.size())) ||
|
((!ins->amiga.useNoteMap && ins->amiga.transWave.enable) && (c.value>=0 && c.value<(int)ins->amiga.transWaveMap.size())) ||
|
||||||
((!ins->amiga.useNoteMap && !ins->amiga.transWave.enable) && (c.value>=0 && c.value<parent->song.sampleLen))) {
|
((!ins->amiga.useNoteMap && !ins->amiga.transWave.enable) && (c.value>=0 && c.value<parent->song.sampleLen))) {
|
||||||
chan[c.chan].pcm.next=c.value;
|
chan[c.chan].pcm.next=c.value;
|
||||||
if (!ins->amiga.useNoteMap && ins->amiga.transWave.enable) {
|
if (!ins->amiga.useNoteMap && ins->amiga.transWave.enable) {
|
||||||
|
|
|
@ -267,12 +267,12 @@ int DivPlatformVERA::dispatch(DivCommand c) {
|
||||||
chan[16].pcm.pos=0;
|
chan[16].pcm.pos=0;
|
||||||
DivSample* s=parent->getSample(chan[16].pcm.sample);
|
DivSample* s=parent->getSample(chan[16].pcm.sample);
|
||||||
unsigned char ctrl=0x90|chan[16].vol; // always stereo
|
unsigned char ctrl=0x90|chan[16].vol; // always stereo
|
||||||
if (s->depth==16) {
|
if (s->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
||||||
chan[16].pcm.depth16=true;
|
chan[16].pcm.depth16=true;
|
||||||
ctrl|=0x20;
|
ctrl|=0x20;
|
||||||
} else {
|
} else {
|
||||||
chan[16].pcm.depth16=false;
|
chan[16].pcm.depth16=false;
|
||||||
if (s->depth!=8) chan[16].pcm.sample=-1;
|
if (s->depth!=DIV_SAMPLE_DEPTH_8BIT) chan[16].pcm.sample=-1;
|
||||||
}
|
}
|
||||||
rWritePCMCtrl(ctrl);
|
rWritePCMCtrl(ctrl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,9 +136,9 @@ void DivPlatformYMZ280B::tick(bool sysTick) {
|
||||||
DivSample* s=parent->getSample(chan[i].sample);
|
DivSample* s=parent->getSample(chan[i].sample);
|
||||||
unsigned char ctrl;
|
unsigned char ctrl;
|
||||||
switch (s->depth) {
|
switch (s->depth) {
|
||||||
case 3: ctrl=0x20; break;
|
case DIV_SAMPLE_DEPTH_YMZ_ADPCM: ctrl=0x20; break;
|
||||||
case 8: ctrl=0x40; break;
|
case DIV_SAMPLE_DEPTH_8BIT: ctrl=0x40; break;
|
||||||
case 16: ctrl=0x60; break;
|
case DIV_SAMPLE_DEPTH_16BIT: ctrl=0x60; break;
|
||||||
default: ctrl=0;
|
default: ctrl=0;
|
||||||
}
|
}
|
||||||
double off=(s->centerRate>=1)?((double)s->centerRate/8363.0):1.0;
|
double off=(s->centerRate>=1)?((double)s->centerRate/8363.0):1.0;
|
||||||
|
@ -146,40 +146,44 @@ void DivPlatformYMZ280B::tick(bool sysTick) {
|
||||||
if (chan[i].freq<0) chan[i].freq=0;
|
if (chan[i].freq<0) chan[i].freq=0;
|
||||||
if (chan[i].freq>511) chan[i].freq=511;
|
if (chan[i].freq>511) chan[i].freq=511;
|
||||||
// ADPCM has half the range
|
// ADPCM has half the range
|
||||||
if (s->depth==3 && chan[i].freq>255) chan[i].freq=255;
|
if (s->depth==DIV_SAMPLE_DEPTH_YMZ_ADPCM && chan[i].freq>255) chan[i].freq=255;
|
||||||
ctrl|=(chan[i].active?0x80:0)|((s->loopStart>=0)?0x10:0)|(chan[i].freq>>8);
|
ctrl|=(chan[i].active?0x80:0)|((s->isLoopable())?0x10:0)|(chan[i].freq>>8);
|
||||||
if (chan[i].keyOn) {
|
if (chan[i].keyOn) {
|
||||||
unsigned int start=s->offYMZ280B;
|
unsigned int start=s->offYMZ280B;
|
||||||
unsigned int loop=0;
|
unsigned int loopStart=0;
|
||||||
|
unsigned int loopEnd=0;
|
||||||
unsigned int end=MIN(start+s->getCurBufLen(),getSampleMemCapacity()-1);
|
unsigned int end=MIN(start+s->getCurBufLen(),getSampleMemCapacity()-1);
|
||||||
if (chan[i].audPos>0) {
|
if (chan[i].audPos>0) {
|
||||||
switch (s->depth) {
|
switch (s->depth) {
|
||||||
case 3: start+=chan[i].audPos/2; break;
|
case DIV_SAMPLE_DEPTH_YMZ_ADPCM: start+=chan[i].audPos/2; break;
|
||||||
case 8: start+=chan[i].audPos; break;
|
case DIV_SAMPLE_DEPTH_8BIT: start+=chan[i].audPos; break;
|
||||||
case 16: start+=chan[i].audPos*2; break;
|
case DIV_SAMPLE_DEPTH_16BIT: start+=chan[i].audPos*2; break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
start=MIN(start,end);
|
start=MIN(start,end);
|
||||||
}
|
}
|
||||||
if (s->loopStart>=0) {
|
if (s->isLoopable()) {
|
||||||
switch (s->depth) {
|
switch (s->depth) {
|
||||||
case 3: loop=start+s->loopStart/2; break;
|
case DIV_SAMPLE_DEPTH_YMZ_ADPCM: loopStart=start+s->loopStart/2; loopEnd=start+s->loopEnd/2; break;
|
||||||
case 8: loop=start+s->loopStart; break;
|
case DIV_SAMPLE_DEPTH_8BIT: loopStart=start+s->loopStart; loopEnd=start+s->loopEnd; break;
|
||||||
case 16: loop=start+s->loopStart*2; break;
|
case DIV_SAMPLE_DEPTH_16BIT: loopStart=start+s->loopStart*2; loopEnd=start+s->loopEnd*2; break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
loop=MIN(loop,end);
|
loopEnd=MIN(loopEnd,end);
|
||||||
|
loopStart=MIN(loopStart,loopEnd);
|
||||||
}
|
}
|
||||||
rWrite(0x01+i*4,ctrl&~0x80); // force keyoff first
|
rWrite(0x01+i*4,ctrl&~0x80); // force keyoff first
|
||||||
rWrite(0x20+i*4,(start>>16)&0xff);
|
rWrite(0x20+i*4,(start>>16)&0xff);
|
||||||
rWrite(0x21+i*4,(loop>>16)&0xff);
|
rWrite(0x21+i*4,(loopStart>>16)&0xff);
|
||||||
rWrite(0x22+i*4,(end>>16)&0xff);
|
rWrite(0x22+i*4,(loopEnd>>16)&0xff);
|
||||||
rWrite(0x23+i*4,(end>>16)&0xff);
|
rWrite(0x23+i*4,(end>>16)&0xff);
|
||||||
rWrite(0x40+i*4,(start>>8)&0xff);
|
rWrite(0x40+i*4,(start>>8)&0xff);
|
||||||
rWrite(0x41+i*4,(loop>>8)&0xff);
|
rWrite(0x41+i*4,(loopStart>>8)&0xff);
|
||||||
rWrite(0x42+i*4,(end>>8)&0xff);
|
rWrite(0x42+i*4,(loopEnd>>8)&0xff);
|
||||||
rWrite(0x43+i*4,(end>>8)&0xff);
|
rWrite(0x43+i*4,(end>>8)&0xff);
|
||||||
rWrite(0x60+i*4,start&0xff);
|
rWrite(0x60+i*4,start&0xff);
|
||||||
rWrite(0x61+i*4,loop&0xff);
|
rWrite(0x61+i*4,loopStart&0xff);
|
||||||
rWrite(0x62+i*4,end&0xff);
|
rWrite(0x62+i*4,loopEnd&0xff);
|
||||||
rWrite(0x63+i*4,end&0xff);
|
rWrite(0x63+i*4,end&0xff);
|
||||||
if (!chan[i].std.vol.had) {
|
if (!chan[i].std.vol.had) {
|
||||||
chan[i].outVol=chan[i].vol;
|
chan[i].outVol=chan[i].vol;
|
||||||
|
|
|
@ -157,7 +157,7 @@ void FurnaceGUI::drawDebug() {
|
||||||
ImGui::Text("loopEnd: %d",sample->loopEnd);
|
ImGui::Text("loopEnd: %d",sample->loopEnd);
|
||||||
ImGui::Text("loopMode: %d",(int)(sample->loopMode));
|
ImGui::Text("loopMode: %d",(int)(sample->loopMode));
|
||||||
ImGui::Text("loopOffP: %d",sample->loopOffP);
|
ImGui::Text("loopOffP: %d",sample->loopOffP);
|
||||||
ImGui::Text("depth: %d",sample->depth);
|
ImGui::Text("depth: %d",(unsigned char)sample->depth);
|
||||||
ImGui::Text("length8: %d",sample->length8);
|
ImGui::Text("length8: %d",sample->length8);
|
||||||
ImGui::Text("length16: %d",sample->length16);
|
ImGui::Text("length16: %d",sample->length16);
|
||||||
ImGui::Text("length1: %d",sample->length1);
|
ImGui::Text("length1: %d",sample->length1);
|
||||||
|
|
|
@ -840,7 +840,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
if (!sample->insert(pos,sampleClipboardLen)) {
|
if (!sample->insert(pos,sampleClipboardLen)) {
|
||||||
showError("couldn't paste! make sure your sample is 8 or 16-bit.");
|
showError("couldn't paste! make sure your sample is 8 or 16-bit.");
|
||||||
} else {
|
} else {
|
||||||
if (sample->depth==8) {
|
if (sample->depth==DIV_SAMPLE_DEPTH_8BIT) {
|
||||||
for (size_t i=0; i<sampleClipboardLen; i++) {
|
for (size_t i=0; i<sampleClipboardLen; i++) {
|
||||||
sample->data8[pos+i]=sampleClipboard[i]>>8;
|
sample->data8[pos+i]=sampleClipboard[i]>>8;
|
||||||
}
|
}
|
||||||
|
@ -866,7 +866,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
if (pos<0) pos=0;
|
if (pos<0) pos=0;
|
||||||
|
|
||||||
e->lockEngine([this,sample,pos]() {
|
e->lockEngine([this,sample,pos]() {
|
||||||
if (sample->depth==8) {
|
if (sample->depth==DIV_SAMPLE_DEPTH_8BIT) {
|
||||||
for (size_t i=0; i<sampleClipboardLen; i++) {
|
for (size_t i=0; i<sampleClipboardLen; i++) {
|
||||||
if (pos+i>=sample->samples) break;
|
if (pos+i>=sample->samples) break;
|
||||||
sample->data8[pos+i]=sampleClipboard[i]>>8;
|
sample->data8[pos+i]=sampleClipboard[i]>>8;
|
||||||
|
@ -896,7 +896,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
if (pos<0) pos=0;
|
if (pos<0) pos=0;
|
||||||
|
|
||||||
e->lockEngine([this,sample,pos]() {
|
e->lockEngine([this,sample,pos]() {
|
||||||
if (sample->depth==8) {
|
if (sample->depth==DIV_SAMPLE_DEPTH_8BIT) {
|
||||||
for (size_t i=0; i<sampleClipboardLen; i++) {
|
for (size_t i=0; i<sampleClipboardLen; i++) {
|
||||||
if (pos+i>=sample->samples) break;
|
if (pos+i>=sample->samples) break;
|
||||||
int val=sample->data8[pos+i]+(sampleClipboard[i]>>8);
|
int val=sample->data8[pos+i]+(sampleClipboard[i]>>8);
|
||||||
|
@ -950,7 +950,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
float maxVal=0.0f;
|
float maxVal=0.0f;
|
||||||
|
|
||||||
if (sample->depth==16) {
|
if (sample->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
float val=fabs((float)sample->data16[i]/32767.0f);
|
float val=fabs((float)sample->data16[i]/32767.0f);
|
||||||
if (val>maxVal) maxVal=val;
|
if (val>maxVal) maxVal=val;
|
||||||
|
@ -965,7 +965,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
sample->data16[i]=val;
|
sample->data16[i]=val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (sample->depth==8) {
|
} else if (sample->depth==DIV_SAMPLE_DEPTH_8BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
float val=fabs((float)sample->data8[i]/127.0f);
|
float val=fabs((float)sample->data8[i]/127.0f);
|
||||||
if (val>maxVal) maxVal=val;
|
if (val>maxVal) maxVal=val;
|
||||||
|
@ -996,14 +996,14 @@ void FurnaceGUI::doAction(int what) {
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
|
||||||
if (sample->depth==16) {
|
if (sample->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
float val=sample->data16[i]*float(i-start)/float(end-start);
|
float val=sample->data16[i]*float(i-start)/float(end-start);
|
||||||
if (val<-32768) val=-32768;
|
if (val<-32768) val=-32768;
|
||||||
if (val>32767) val=32767;
|
if (val>32767) val=32767;
|
||||||
sample->data16[i]=val;
|
sample->data16[i]=val;
|
||||||
}
|
}
|
||||||
} else if (sample->depth==8) {
|
} else if (sample->depth==DIV_SAMPLE_DEPTH_8BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
float val=sample->data8[i]*float(i-start)/float(end-start);
|
float val=sample->data8[i]*float(i-start)/float(end-start);
|
||||||
if (val<-128) val=-128;
|
if (val<-128) val=-128;
|
||||||
|
@ -1026,14 +1026,14 @@ void FurnaceGUI::doAction(int what) {
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
|
||||||
if (sample->depth==16) {
|
if (sample->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
float val=sample->data16[i]*float(end-i)/float(end-start);
|
float val=sample->data16[i]*float(end-i)/float(end-start);
|
||||||
if (val<-32768) val=-32768;
|
if (val<-32768) val=-32768;
|
||||||
if (val>32767) val=32767;
|
if (val>32767) val=32767;
|
||||||
sample->data16[i]=val;
|
sample->data16[i]=val;
|
||||||
}
|
}
|
||||||
} else if (sample->depth==8) {
|
} else if (sample->depth==DIV_SAMPLE_DEPTH_8BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
float val=sample->data8[i]*float(end-i)/float(end-start);
|
float val=sample->data8[i]*float(end-i)/float(end-start);
|
||||||
if (val<-128) val=-128;
|
if (val<-128) val=-128;
|
||||||
|
@ -1060,11 +1060,11 @@ void FurnaceGUI::doAction(int what) {
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
|
||||||
if (sample->depth==16) {
|
if (sample->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
sample->data16[i]=0;
|
sample->data16[i]=0;
|
||||||
}
|
}
|
||||||
} else if (sample->depth==8) {
|
} else if (sample->depth==DIV_SAMPLE_DEPTH_8BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
sample->data8[i]=0;
|
sample->data8[i]=0;
|
||||||
}
|
}
|
||||||
|
@ -1118,7 +1118,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
|
||||||
if (sample->depth==16) {
|
if (sample->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
unsigned int ri=end-i-1+start;
|
unsigned int ri=end-i-1+start;
|
||||||
if (ri<=i) break;
|
if (ri<=i) break;
|
||||||
|
@ -1126,7 +1126,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
sample->data16[ri]^=sample->data16[i];
|
sample->data16[ri]^=sample->data16[i];
|
||||||
sample->data16[i]^=sample->data16[ri];
|
sample->data16[i]^=sample->data16[ri];
|
||||||
}
|
}
|
||||||
} else if (sample->depth==8) {
|
} else if (sample->depth==DIV_SAMPLE_DEPTH_8BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
unsigned int ri=end-i-1+start;
|
unsigned int ri=end-i-1+start;
|
||||||
if (ri<=i) break;
|
if (ri<=i) break;
|
||||||
|
@ -1150,12 +1150,12 @@ void FurnaceGUI::doAction(int what) {
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
|
||||||
if (sample->depth==16) {
|
if (sample->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
sample->data16[i]=-sample->data16[i];
|
sample->data16[i]=-sample->data16[i];
|
||||||
if (sample->data16[i]==-32768) sample->data16[i]=32767;
|
if (sample->data16[i]==-32768) sample->data16[i]=32767;
|
||||||
}
|
}
|
||||||
} else if (sample->depth==8) {
|
} else if (sample->depth==DIV_SAMPLE_DEPTH_8BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
sample->data8[i]=-sample->data8[i];
|
sample->data8[i]=-sample->data8[i];
|
||||||
if (sample->data16[i]==-128) sample->data16[i]=127;
|
if (sample->data16[i]==-128) sample->data16[i]=127;
|
||||||
|
@ -1176,11 +1176,11 @@ void FurnaceGUI::doAction(int what) {
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
|
||||||
if (sample->depth==16) {
|
if (sample->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
sample->data16[i]^=0x8000;
|
sample->data16[i]^=0x8000;
|
||||||
}
|
}
|
||||||
} else if (sample->depth==8) {
|
} else if (sample->depth==DIV_SAMPLE_DEPTH_8BIT) {
|
||||||
for (unsigned int i=start; i<end; i++) {
|
for (unsigned int i=start; i<end; i++) {
|
||||||
sample->data8[i]^=0x80;
|
sample->data8[i]^=0x80;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue