prepare for supporting channel count in user syste
ms
This commit is contained in:
parent
4e2477e8ba
commit
eca315b99a
3 changed files with 15 additions and 6 deletions
|
|
@ -516,9 +516,11 @@ void DivEngine::initSongWithDesc(const char* description, bool inBase64, bool ol
|
|||
if (song.system[index]==DIV_SYSTEM_NULL) {
|
||||
break;
|
||||
}
|
||||
chanCount+=getChannelCount(song.system[index]);
|
||||
if (chanCount>=DIV_MAX_CHANS) {
|
||||
song.systemChans[index]=c.getInt(fmt::sprintf("chans%d",index),getChannelCount(song.system[index]));
|
||||
chanCount+=song.systemChans[index];
|
||||
if (chanCount>DIV_MAX_CHANS) {
|
||||
song.system[index]=DIV_SYSTEM_NULL;
|
||||
song.systemChans[index]=1;
|
||||
break;
|
||||
}
|
||||
song.systemVol[index]=c.getFloat(fmt::sprintf("vol%d",index),1.0f);
|
||||
|
|
@ -535,7 +537,6 @@ void DivEngine::initSongWithDesc(const char* description, bool inBase64, bool ol
|
|||
song.systemFlags[index].loadFromBase64(flags.c_str());
|
||||
}
|
||||
song.systemLen=index;
|
||||
song.initDefaultSystemChans();
|
||||
|
||||
// extra attributes
|
||||
song.subsong[0]->hz=c.getDouble("tickRate",60.0);
|
||||
|
|
@ -543,7 +544,7 @@ void DivEngine::initSongWithDesc(const char* description, bool inBase64, bool ol
|
|||
if (song.subsong[0]->hz>999.0) song.subsong[0]->hz=999.0;
|
||||
|
||||
curChanMask=c.getIntList("chanMask",{});
|
||||
for (unsigned char i:curChanMask) {
|
||||
for (unsigned char i: curChanMask) {
|
||||
int j=i-1;
|
||||
if (j<0) j=0;
|
||||
if (j>DIV_MAX_CHANS) j=DIV_MAX_CHANS-1;
|
||||
|
|
|
|||
|
|
@ -1376,12 +1376,14 @@ struct Gradient2D {
|
|||
struct FurnaceGUISysDefChip {
|
||||
DivSystem sys;
|
||||
float vol, pan, panFR;
|
||||
int chans;
|
||||
String flags;
|
||||
FurnaceGUISysDefChip(DivSystem s, float v, float p, const char* f, float pf=0.0):
|
||||
FurnaceGUISysDefChip(DivSystem s, float v, float p, const char* f, float pf=0.0, int ch=0):
|
||||
sys(s),
|
||||
vol(v),
|
||||
pan(p),
|
||||
panFR(pf),
|
||||
chans(ch),
|
||||
flags(f) {}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4025,6 +4025,9 @@ void FurnaceGUISysDef::bake() {
|
|||
index,
|
||||
taEncodeBase64(i.flags)
|
||||
);
|
||||
if (i.chans>0) {
|
||||
definition+=fmt::sprintf("chans%d=%d\n",index,i.chans);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if (!extra.empty()) {
|
||||
|
|
@ -4063,8 +4066,11 @@ FurnaceGUISysDef::FurnaceGUISysDef(const char* n, const char* def, DivEngine* e)
|
|||
nextStr=fmt::sprintf("flags%d",i);
|
||||
String flags=taDecodeBase64(conf.getString(nextStr.c_str(),"").c_str());
|
||||
conf.remove(nextStr.c_str());
|
||||
nextStr=fmt::sprintf("chans%d",i);
|
||||
int chans=conf.getInt(nextStr.c_str(),0);
|
||||
conf.remove(nextStr.c_str());
|
||||
|
||||
orig.push_back(FurnaceGUISysDefChip(e->systemFromFileFur(id),vol,pan,flags.c_str(),panFR));
|
||||
orig.push_back(FurnaceGUISysDefChip(e->systemFromFileFur(id),vol,pan,flags.c_str(),panFR,chans));
|
||||
}
|
||||
// extract extra
|
||||
extra=conf.toString();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue