diff --git a/src/engine/fileOps/s3m.cpp b/src/engine/fileOps/s3m.cpp index b3f4d5673..0e83ee62d 100644 --- a/src/engine/fileOps/s3m.cpp +++ b/src/engine/fileOps/s3m.cpp @@ -167,6 +167,8 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) { reader.readC(); // UC unsigned char defaultPan=(unsigned char)reader.readC(); + mustCommitPanning=masterVol&128; + logV("defaultPan: %d",defaultPan); reader.readS(); // reserved @@ -226,7 +228,7 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) { reader.read(chanPan,16); } else { logV("default channel pan"); - memset(chanPan,0,16); + memset(chanPan,16,16); } // determine chips to use @@ -234,6 +236,7 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) { bool hasPCM=false; bool hasFM=false; + int numChans=0; for (int i=0; i<32; i++) { if (chanSettings[i]==255) continue; @@ -242,6 +245,7 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) { hasFM=true; } else { hasPCM=true; + numChans++; } if (hasFM && hasPCM) break; @@ -250,10 +254,13 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) { ds.systemName="PC"; // would use ES5506 but it has log volume if (hasPCM) { - ds.system[ds.systemLen]=DIV_SYSTEM_NDS; - ds.systemVol[ds.systemLen]=1.0f; - ds.systemPan[ds.systemLen]=0; - ds.systemLen++; + for (int i=0; i>6)/volMax; } oscBuf->data[oscBuf->needle++]=((output>>depthScale)<>1; if (outStereo) { @@ -451,7 +451,7 @@ int DivPlatformPCMDAC::dispatch(DivCommand c) { chan[0].setPos=true; break; case DIV_CMD_GET_VOLMAX: - return 255; + return volMax; break; case DIV_CMD_MACRO_OFF: chan[c.chan].std.mask(c.value,true); @@ -543,6 +543,8 @@ void DivPlatformPCMDAC::setFlags(const DivConfig& flags) { outStereo=flags.getBool("stereo",true); interp=flags.getInt("interpolation",0); oscBuf->rate=rate; + volMax=flags.getInt("volMax",255); + if (volMax<1) volMax=1; } int DivPlatformPCMDAC::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { diff --git a/src/engine/platform/pcmdac.h b/src/engine/platform/pcmdac.h index 91befa623..bfd7df0a2 100644 --- a/src/engine/platform/pcmdac.h +++ b/src/engine/platform/pcmdac.h @@ -62,6 +62,7 @@ class DivPlatformPCMDAC: public DivDispatch { // - 2: cubic spline // - 3: sinc int interp; + int volMax; bool outStereo; friend void putDispatchChip(void*,int); diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index 25ffc4940..07391568b 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -1847,6 +1847,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl int sampRate=flags.getInt("rate",44100); int bitDepth=flags.getInt("outDepth",15)+1; int interpolation=flags.getInt("interpolation",0); + int volMax=flags.getInt("volMax",255); bool stereo=flags.getBool("stereo",false); ImGui::Text(_("Output rate:")); @@ -1861,6 +1862,12 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl if (bitDepth>16) bitDepth=16; altered=true; } rightClickable + ImGui::Text(_("Maximum volume:")); + if (CWSliderInt("##VolMax",&volMax,1,255)) { + if (volMax<1) volMax=1; + if (volMax>255) volMax=255; + altered=true; + } rightClickable if (ImGui::Checkbox(_("Stereo"),&stereo)) { altered=true; } @@ -1891,6 +1898,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl flags.set("outDepth",bitDepth-1); flags.set("stereo",stereo); flags.set("interpolation",interpolation); + flags.set("volMax",volMax); }); } break;