prepare to add channel pair and mode hints

This commit is contained in:
tildearrow 2023-10-05 04:47:14 -05:00
parent 1283f70646
commit 839dc3cd91
5 changed files with 70 additions and 1 deletions

View file

@ -339,6 +339,40 @@ struct DivDispatchOscBuffer {
}
};
struct DivChannelPair {
const char* label;
// -1: none
signed char pairs[8];
DivChannelPair(const char* l, signed char p0, signed char p1, signed char p2, signed char p3, signed char p4, signed char p5, signed char p6, signed char p7):
label(l),
pairs{p0,p1,p2,p3,p4,p5,p6,p7} {}
DivChannelPair(const char* l, signed char p):
label(l),
pairs{p,-1,-1,-1,-1,-1,-1,-1} {}
DivChannelPair():
label(NULL),
pairs{-1,-1,-1,-1,-1,-1,-1,-1} {}
};
struct DivChannelModeHints {
const char* hint[4];
// valid types:
// - 0: disabled
// - 1: volume
// - 2: pitch
// - 3: panning
// - 4: ???
unsigned char type[4];
// up to 4
unsigned char count;
DivChannelModeHints():
hint{NULL,NULL,NULL,NULL},
type{0,0,0,0},
count(0) {}
};
class DivEngine;
class DivMacroInt;
@ -418,6 +452,21 @@ class DivDispatch {
*/
virtual unsigned short getPan(int chan);
/**
* get "paired" channels.
* @param chan the channel to query.
* @return a DivChannelPair.
*/
virtual DivChannelPair getPaired(int chan);
/**
* get channel mode hints.
* @param chan the channel to query.
* @return a DivChannelModeHints.
*/
virtual DivChannelModeHints getModeHints(int chan);
/**
* get currently playing sample (and its position).
* @param chan the channel.

View file

@ -37,6 +37,14 @@ unsigned short DivDispatch::getPan(int chan) {
return 0;
}
DivChannelPair DivDispatch::getPaired(int chan) {
return DivChannelPair();
}
DivChannelModeHints DivDispatch::getModeHints(int chan) {
return DivChannelModeHints();
}
DivMacroInt* DivDispatch::getChanMacroInt(int chan) {
return NULL;
}

View file

@ -1582,6 +1582,15 @@ unsigned short DivPlatformOPL::getPan(int ch) {
return ((chan[ch].pan&1)<<8)|((chan[ch].pan&2)>>1);
}
DivChannelPair DivPlatformOPL::getPaired(int ch) {
if (oplType==3 && ch<12 && !(ch&1)) {
if (chan[ch].fourOp) {
return DivChannelPair("4OP",ch+1);
}
}
return DivChannelPair();
}
DivDispatchOscBuffer* DivPlatformOPL::getOscBuffer(int ch) {
if (oplType==759 || chipType==8950) {
if (ch>=totalChans+1) return NULL;

View file

@ -115,6 +115,7 @@ class DivPlatformOPL: public DivDispatch {
void* getChanState(int chan);
DivMacroInt* getChanMacroInt(int ch);
unsigned short getPan(int chan);
DivChannelPair getPaired(int chan);
DivDispatchOscBuffer* getOscBuffer(int chan);
unsigned char* getRegisterPool();
int getRegisterPoolSize();

View file

@ -6353,6 +6353,7 @@ bool FurnaceGUI::init() {
} else {
patChannelNames=e->getConfBool("patChannelNames",false);
}
patChannelPairs=e->getConfBool("patChannelPairs",true);
patChannelHints=e->getConfInt("patChannelHints",0);
lockLayout=e->getConfBool("lockLayout",false);
#ifdef IS_MOBILE
@ -6893,6 +6894,7 @@ void FurnaceGUI::commitState() {
e->setConf("waveEditStyle",waveEditStyle);
e->setConf("patExtraButtons",patExtraButtons);
e->setConf("patChannelNames",patChannelNames);
e->setConf("patChannelPairs",patChannelPairs);
e->setConf("patChannelHints",(int)patChannelHints);
e->setConf("lockLayout",lockLayout);
e->setConf("fullScreen",fullScreen);
@ -7145,7 +7147,7 @@ FurnaceGUI::FurnaceGUI():
exportFadeOut(5.0),
patExtraButtons(false),
patChannelNames(false),
patChannelPairs(false),
patChannelPairs(true),
patChannelHints(0),
newSongFirstFrame(false),
oldRowChanged(false),