NES:codestyle

This commit is contained in:
tildearrow 2024-08-24 16:43:15 -05:00
parent efb89f7f94
commit c06759b235
3 changed files with 27 additions and 29 deletions

View file

@ -109,8 +109,7 @@ void DivPlatformNES::acquire_puNES(short** buf, size_t len) {
for (size_t i=0; i<len; i++) {
doPCM;
if (!writes.empty())
{
if (!writes.empty()) {
QueuedWrite w=writes.front();
doWrite(w.addr,w.val);
regPool[w.addr&0x1f]=w.val;
@ -143,8 +142,7 @@ void DivPlatformNES::acquire_NSFPlay(short** buf, size_t len) {
for (size_t i=0; i<len; i++) {
doPCM;
if (!writes.empty())
{
if (!writes.empty()) {
QueuedWrite w=writes.front();
doWrite(w.addr,w.val);
regPool[w.addr&0x1f]=w.val;
@ -416,8 +414,8 @@ void DivPlatformNES::tick(bool sysTick) {
logV("switching bank to %d",dpcmBank);
if (dumpWrites) addWrite(0xffff0004,dpcmBank);
}
//sample custom loop point...
// sample custom loop point...
DivSample* lsamp=parent->getSample(dacSample);
// how it works:
@ -437,13 +435,12 @@ void DivPlatformNES::tick(bool sysTick) {
// https://www.nesdev.org/wiki/APU_DMC
// https://www.youtube.com/watch?v=vB4P8x2Am6Y
if(lsamp->loopEnd > lsamp->loopStart && goingToLoop)
{
int loop_start_addr = (sampleOffDPCM[dacSample] + lsamp->loopStart) / 8;
int loop_len = (lsamp->loopEnd - lsamp->loopStart) / 8;
if (lsamp->loopEnd>lsamp->loopStart && goingToLoop) {
int loopStartAddr=(sampleOffDPCM[dacSample]+lsamp->loopStart)>>3;
int loopLen=(lsamp->loopEnd-lsamp->loopStart)>>3;
rWrite(0x4012,(loop_start_addr >> 6)&0xff);
rWrite(0x4013,(loop_len >> 4)&0xff);
rWrite(0x4012,(loopStartAddr>>6)&0xff);
rWrite(0x4013,(loopLen>>4)&0xff);
}
}
} else {

View file

@ -302,6 +302,7 @@ const char* aboutLine[]={
_N("NDS sound emulator by cam900"),
"",
_N("greetings to:"),
"floxy!",
"NEOART Costa Rica",
"Xenium Demoparty",
"@party",

View file

@ -253,8 +253,7 @@ void FurnaceGUI::drawSampleEdit() {
SAMPLE_WARN(warnLength,"QSound: maximum sample length is 65535");
}
break;
case DIV_SYSTEM_NES:
{
case DIV_SYSTEM_NES: {
if (sample->loop) {
if (sample->loopStart&511) {
int tryWith=(sample->loopStart)&(~511);
@ -263,7 +262,8 @@ void FurnaceGUI::drawSampleEdit() {
SAMPLE_WARN(warnLoopStart,alignHint);
}
if ((sample->loopEnd)&127) {
int tryWith=(sample->loopEnd + 1)&(~127); //+1 bc of how sample length is treated: https://www.nesdev.org/wiki/APU_DMC
// +1 bc of how sample length is treated: https://www.nesdev.org/wiki/APU_DMC
int tryWith=(sample->loopEnd + 1)&(~127);
if (tryWith>(int)sample->samples) tryWith-=128;
String alignHint=fmt::sprintf(_("NES: loop end must be a multiple of 128 (try with %d)"),tryWith);
SAMPLE_WARN(warnLoopEnd,alignHint);