diff --git a/doc/8-advanced/user-systems.md b/doc/8-advanced/user-systems.md index d60772654..5d63e8565 100644 --- a/doc/8-advanced/user-systems.md +++ b/doc/8-advanced/user-systems.md @@ -12,6 +12,7 @@ chip configuration is exactly as in the [chip manager](chip-manager.md) window. the **Advanced** field stores additional settings that are set when a new song is started. these are listed in "option=value" format, one per line. - `tickRate`: sets tick rate. +- `chanMask`: sets which channels to hide. written as a comma-separated list of integers **Save and Close**: as it says. diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index b2788b3fa..ea9ead3cd 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -520,6 +520,15 @@ void DivEngine::initSongWithDesc(const char* description, bool inBase64, bool ol if (song.subsong[0]->hz<1.0) song.subsong[0]->hz=1.0; if (song.subsong[0]->hz>999.0) song.subsong[0]->hz=999.0; + curChanMask=c.getIntList("chanMask",{}); + for (unsigned char i:curChanMask) { + int j=i-1; + if (j<0) j=0; + if (j>DIV_MAX_CHANS) j=DIV_MAX_CHANS-1; + curSubSong->chanShow[j]=false; + curSubSong->chanShowChanOsc[j]=false; + } + song.author=getConfString("defaultAuthorName",""); } @@ -754,6 +763,13 @@ int DivEngine::addSubSong() { BUSY_BEGIN; saveLock.lock(); song.subsong.push_back(new DivSubSong); + for (unsigned char i:curChanMask) { + int j=i-1; + if (j<0) j=0; + if (j>DIV_MAX_CHANS) j=DIV_MAX_CHANS-1; + song.subsong.back()->chanShow[j]=false; + song.subsong.back()->chanShowChanOsc[j]=false; + } saveLock.unlock(); BUSY_END; return song.subsong.size()-1; diff --git a/src/engine/engine.h b/src/engine/engine.h index e5c91fb33..3dacd0730 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -518,6 +518,7 @@ class DivEngine { std::vector cmdStream; std::vector possibleInsTypes; std::vector effectInst; + std::vector curChanMask; static DivSysDef* sysDefs[DIV_MAX_CHIP_DEFS]; static DivSystem sysFileMapFur[DIV_MAX_CHIP_DEFS]; static DivSystem sysFileMapDMF[DIV_MAX_CHIP_DEFS]; diff --git a/src/gui/userPresets.cpp b/src/gui/userPresets.cpp index d2999c6cc..1dadbca26 100644 --- a/src/gui/userPresets.cpp +++ b/src/gui/userPresets.cpp @@ -475,7 +475,8 @@ void FurnaceGUI::drawUserPresets() { ImGui::SetTooltip(_( "insert additional settings in `option=value` format.\n" "available options:\n" - "- tickRate" + "- tickRate \n" + "- chanMask \n" )); }