tabs to spaces

This commit is contained in:
tildearrow 2022-02-22 22:13:17 -05:00
parent 4122238a4a
commit a5561f1899
8 changed files with 322 additions and 321 deletions

View File

@ -225,7 +225,7 @@ class DivDispatch {
/**
* get the bit depth of the register pool of this dispatch.
* If the result is 16, it should be casted to unsigned short
* If the result is 16, it should be casted to unsigned short.
* @return the depth. Default value is 8
*/
virtual int getRegisterPoolDepth();

View File

@ -607,8 +607,9 @@ void DivEngine::renderSamples() {
for (int i=0; i<song.sampleLen; i++) {
DivSample* s=song.sample[i];
int length = s->rendLength;
if(length > 65536-16)
if (length > 65536-16) {
length = 65536-16;
}
if ((memPos&0xff0000)!=((memPos+length)&0xff0000)) {
memPos=(memPos+0xffff)&0xff0000;
}
@ -617,14 +618,12 @@ void DivEngine::renderSamples() {
break;
}
if (memPos+length>=16777216) {
for(unsigned int i=0; i<16777216-(memPos+length); i++)
{
for (unsigned int i=0; i<16777216-(memPos+length); i++) {
qsoundMem[(memPos + i) ^ 0x8000] = s->rendData[i] >> ((s->depth == 16) ? 8 : 0);
}
logW("out of QSound PCM memory for sample %d!\n",i);
} else {
for(int i=0; i<length; i++)
{
for (int i=0; i<length; i++) {
qsoundMem[(memPos + i) ^ 0x8000] = s->rendData[i] >> ((s->depth == 16) ? 8 : 0);
}
}

View File

@ -258,9 +258,10 @@ const char* DivPlatformQSound::getEffectName(unsigned char effect) {
return "11xx: Set channel echo level (00 to FF)";
break;
default:
if((effect & 0xf0) == 0x30)
if ((effect & 0xf0) == 0x30) {
return "3xxx: Set echo delay buffer length (000 to AA5)";
}
}
return NULL;
}
void DivPlatformQSound::acquire(short* bufL, short* bufR, size_t start, size_t len) {
@ -277,10 +278,9 @@ void DivPlatformQSound::tick() {
for (int i=0; i<16; i++) {
chan[i].std.next();
if (chan[i].std.hadVol) {
chan[i].outVol=((chan[i].vol%256)*MIN(255,chan[i].std.vol << 2))>>8;
chan[i].outVol=((chan[i].vol&0xff)*MIN(255,chan[i].std.vol<<2))>>8;
// Check if enabled and write volume
if(chan[i].active)
{
if (chan[i].active) {
rWrite(q1_reg_map[Q1V_VOL][i], chan[i].outVol << 5);
//logW("ch %d vol=%04x (hadVol)!\n",i,chan[i].outVol << 5);
}
@ -301,15 +301,13 @@ void DivPlatformQSound::tick() {
qsound_addr = s->rendOffQsound & 0xffff;
int length = s->length;
if(length > 65536 - 16)
if (length > 65536 - 16) {
length = 65536 - 16;
if(s->loopStart == -1 || s->loopStart >= length)
{
}
if (s->loopStart == -1 || s->loopStart >= length) {
qsound_end = s->rendOffQsound + length + 15;
qsound_loop = 15;
}
else
{
} else {
qsound_end = s->rendOffQsound + length;
qsound_loop = length - s->loopStart;
}
@ -333,7 +331,6 @@ void DivPlatformQSound::tick() {
//DivInstrument* ins=parent->getIns(chan[i].ins);
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false);
if (chan[i].freq>0xffff) chan[i].freq=0xffff;
//if (chan[i].note>0x5d) chan[i].freq=0x01; //????
if (chan[i].keyOn) {
rWrite(q1_reg_map[Q1V_BANK][i], qsound_bank);
rWrite(q1_reg_map[Q1V_END][i], qsound_end);
@ -348,11 +345,10 @@ void DivPlatformQSound::tick() {
}
}
if (chan[i].keyOff) {
// Disable volume
rWrite(q1_reg_map[Q1V_VOL][i], 0);
rWrite(q1_reg_map[Q1V_FREQ][i], 0);
// Disable volume
}
else if (chan[i].active) {
} else if (chan[i].active) {
//logW("ch %d frequency set to %04x, off=%f, note=%d, %04x!\n",i,chan[i].freq,off,chan[i].note,QS_NOTE_FREQUENCY(chan[i].note));
rWrite(q1_reg_map[Q1V_FREQ][i], chan[i].freq);
}
@ -413,8 +409,7 @@ int DivPlatformQSound::dispatch(DivCommand c) {
if (!chan[c.chan].std.hasVol) {
// Check if enabled and write volume
chan[c.chan].outVol=c.value;
if(chan[c.chan].active && c.chan < 16)
{
if (chan[c.chan].active && c.chan < 16) {
rWrite(q1_reg_map[Q1V_VOL][c.chan], chan[c.chan].outVol << 5);
//logW("ch %d vol=%04x (cmd vol)!\n",c.chan,chan[c.chan].outVol << 5);
}
@ -509,10 +504,11 @@ int DivPlatformQSound::dispatch(DivCommand c) {
}
void DivPlatformQSound::muteChannel(int ch, bool mute) {
if(mute)
chip.mute_mask |= (1 << ch);
else
chip.mute_mask &= ~(1 << ch);
if (mute) {
chip.mute_mask|=(1<<ch);
} else {
chip.mute_mask&=~(1<<ch);
}
}
void DivPlatformQSound::forceIns() {
@ -532,8 +528,9 @@ void DivPlatformQSound::reset() {
chan[i]=DivPlatformQSound::Channel();
}
qsound_reset(&chip);
while(!chip.ready_flag)
while(!chip.ready_flag) {
qsound_update(&chip);
}
immWrite(Q1_ECHO_LENGTH, 0xfff - (2725 - echoDelay));
immWrite(Q1_ECHO_FEEDBACK, echoFeedback << 6);
@ -557,6 +554,7 @@ void DivPlatformQSound::notifyInsChange(int ins) {
void DivPlatformQSound::notifyWaveChange(int wave) {
// TODO when wavetables are added
// TODO they probably won't be added unless the samples reside in RAM
}
void DivPlatformQSound::notifyInsDeletion(void* ins) {
@ -569,10 +567,12 @@ void DivPlatformQSound::setFlags(unsigned int flags) {
echoDelay = 2725 - (flags & 0xfff);
echoFeedback = (flags >> 12) & 255;
if(echoDelay < 0)
if(echoDelay < 0) {
echoDelay = 0;
if(echoDelay > 2725)
}
if(echoDelay > 2725) {
echoDelay = 2725;
}
//rate=chipClock/CHIP_DIVIDER;
}
@ -608,9 +608,9 @@ int DivPlatformQSound::init(DivEngine* p, int channels, int sugRate, unsigned in
dumpWrites=false;
skipRegisterWrites=false;
// for (int i=0; i<16; i++) {
// isMuted[i]=false;
// }
//for (int i=0; i<16; i++) {
// isMuted[i]=false;
//}
setFlags(flags);
chipClock=60000000;

View File

@ -241,7 +241,7 @@ bool DivEngine::perSystemEffect(int ch, unsigned char effect, unsigned char effe
dispatchCmd(DivCommand(DIV_CMD_QSOUND_ECHO_LEVEL,ch,effectVal));
break;
default:
if ((effect & 0xf0)==0x30) {
if ((effect&0xf0)==0x30) {
dispatchCmd(DivCommand(DIV_CMD_QSOUND_ECHO_DELAY,ch,((effect & 0x0f) << 8) | effectVal));
} else {
return false;

View File

@ -976,9 +976,10 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop) {
if (writeQSound && qsoundMemLen>0) {
// always write a whole bank
unsigned int blockSize=(qsoundMemLen + 0xffff) & ~0xffff;
if(blockSize > 0x1000000)
unsigned int blockSize=(qsoundMemLen+0xffff)&(~0xffff);
if (blockSize > 0x1000000) {
blockSize = 0x1000000;
}
w->writeC(0x67);
w->writeC(0x66);
w->writeC(0x8F);

View File

@ -2100,7 +2100,7 @@ void FurnaceGUI::drawRegView() {
int size=0;
int depth=8;
unsigned char* regPool=e->getRegisterPool(i,size,depth);
unsigned short* regPoolW=(unsigned short*) regPool;
unsigned short* regPoolW=(unsigned short*)regPool;
if (regPool==NULL) {
ImGui::Text("- no register pool available");
} else {
@ -2119,14 +2119,15 @@ void FurnaceGUI::drawRegView() {
for (int j=0; j<16; j++) {
ImGui::TableNextColumn();
if (i*16+j>=size) continue;
if(depth == 8)
if (depth == 8) {
ImGui::Text("%.2x",regPool[i*16+j]);
else if(depth == 16)
} else if (depth == 16) {
ImGui::Text("%.4x",regPoolW[i*16+j]);
else
} else {
ImGui::Text("??");
}
}
}
ImGui::EndTable();
}
ImGui::PopFont();