channel mask for user presets (#2135)

* user presets channel mask

* update tooltip, mask generator helper thing

* better tooltip

* yea this is better

* update doc

* apply to all subsongs
This commit is contained in:
Eknous 2024-09-03 00:39:35 +04:00 committed by GitHub
parent fa08bc5d8e
commit 8d81ef87b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 1 deletions

View file

@ -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.

View file

@ -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;

View file

@ -518,6 +518,7 @@ class DivEngine {
std::vector<DivCommand> cmdStream;
std::vector<DivInstrumentType> possibleInsTypes;
std::vector<DivEffectContainer> effectInst;
std::vector<int> curChanMask;
static DivSysDef* sysDefs[DIV_MAX_CHIP_DEFS];
static DivSystem sysFileMapFur[DIV_MAX_CHIP_DEFS];
static DivSystem sysFileMapDMF[DIV_MAX_CHIP_DEFS];

View file

@ -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"
));
}