GUI: channel pair hints, part 1
very ugly
This commit is contained in:
parent
f2e62071d1
commit
4b008f4b41
|
@ -1418,6 +1418,11 @@ void* DivEngine::getDispatchChanState(int ch) {
|
||||||
return disCont[dispatchOfChan[ch]].dispatch->getChanState(dispatchChanOfChan[ch]);
|
return disCont[dispatchOfChan[ch]].dispatch->getChanState(dispatchChanOfChan[ch]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DivChannelPair DivEngine::getChanPaired(int ch) {
|
||||||
|
if (ch<0 || ch>=chans) return DivChannelPair();
|
||||||
|
return disCont[dispatchOfChan[ch]].dispatch->getPaired(dispatchChanOfChan[ch]);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char* DivEngine::getRegisterPool(int sys, int& size, int& depth) {
|
unsigned char* DivEngine::getRegisterPool(int sys, int& size, int& depth) {
|
||||||
if (sys<0 || sys>=song.systemLen) return NULL;
|
if (sys<0 || sys>=song.systemLen) return NULL;
|
||||||
if (disCont[sys].dispatch==NULL) return NULL;
|
if (disCont[sys].dispatch==NULL) return NULL;
|
||||||
|
@ -1912,11 +1917,13 @@ void DivEngine::recalcChans() {
|
||||||
memset(isInsTypePossible,0,DIV_INS_MAX*sizeof(bool));
|
memset(isInsTypePossible,0,DIV_INS_MAX*sizeof(bool));
|
||||||
for (int i=0; i<song.systemLen; i++) {
|
for (int i=0; i<song.systemLen; i++) {
|
||||||
int chanCount=getChannelCount(song.system[i]);
|
int chanCount=getChannelCount(song.system[i]);
|
||||||
|
int firstChan=chans;
|
||||||
chans+=chanCount;
|
chans+=chanCount;
|
||||||
for (int j=0; j<chanCount; j++) {
|
for (int j=0; j<chanCount; j++) {
|
||||||
sysOfChan[chanIndex]=song.system[i];
|
sysOfChan[chanIndex]=song.system[i];
|
||||||
dispatchOfChan[chanIndex]=i;
|
dispatchOfChan[chanIndex]=i;
|
||||||
dispatchChanOfChan[chanIndex]=j;
|
dispatchChanOfChan[chanIndex]=j;
|
||||||
|
dispatchFirstChan[chanIndex]=firstChan;
|
||||||
chanIndex++;
|
chanIndex++;
|
||||||
|
|
||||||
if (sysDefs[song.system[i]]!=NULL) {
|
if (sysDefs[song.system[i]]!=NULL) {
|
||||||
|
|
|
@ -596,6 +596,7 @@ class DivEngine {
|
||||||
DivSystem sysOfChan[DIV_MAX_CHANS];
|
DivSystem sysOfChan[DIV_MAX_CHANS];
|
||||||
int dispatchOfChan[DIV_MAX_CHANS];
|
int dispatchOfChan[DIV_MAX_CHANS];
|
||||||
int dispatchChanOfChan[DIV_MAX_CHANS];
|
int dispatchChanOfChan[DIV_MAX_CHANS];
|
||||||
|
int dispatchFirstChan[DIV_MAX_CHANS];
|
||||||
bool keyHit[DIV_MAX_CHANS];
|
bool keyHit[DIV_MAX_CHANS];
|
||||||
float* oscBuf[DIV_MAX_OUTPUTS];
|
float* oscBuf[DIV_MAX_OUTPUTS];
|
||||||
float oscSize;
|
float oscSize;
|
||||||
|
@ -1009,6 +1010,9 @@ class DivEngine {
|
||||||
// get dispatch channel state
|
// get dispatch channel state
|
||||||
void* getDispatchChanState(int chan);
|
void* getDispatchChanState(int chan);
|
||||||
|
|
||||||
|
// get channel pairs
|
||||||
|
DivChannelPair getChanPaired(int chan);
|
||||||
|
|
||||||
// get register pool
|
// get register pool
|
||||||
unsigned char* getRegisterPool(int sys, int& size, int& depth);
|
unsigned char* getRegisterPool(int sys, int& size, int& depth);
|
||||||
|
|
||||||
|
@ -1320,6 +1324,7 @@ class DivEngine {
|
||||||
mu5ROM(NULL) {
|
mu5ROM(NULL) {
|
||||||
memset(isMuted,0,DIV_MAX_CHANS*sizeof(bool));
|
memset(isMuted,0,DIV_MAX_CHANS*sizeof(bool));
|
||||||
memset(keyHit,0,DIV_MAX_CHANS*sizeof(bool));
|
memset(keyHit,0,DIV_MAX_CHANS*sizeof(bool));
|
||||||
|
memset(dispatchFirstChan,0,DIV_MAX_CHANS*sizeof(int));
|
||||||
memset(dispatchChanOfChan,0,DIV_MAX_CHANS*sizeof(int));
|
memset(dispatchChanOfChan,0,DIV_MAX_CHANS*sizeof(int));
|
||||||
memset(dispatchOfChan,0,DIV_MAX_CHANS*sizeof(int));
|
memset(dispatchOfChan,0,DIV_MAX_CHANS*sizeof(int));
|
||||||
memset(sysOfChan,0,DIV_MAX_CHANS*sizeof(int));
|
memset(sysOfChan,0,DIV_MAX_CHANS*sizeof(int));
|
||||||
|
|
|
@ -426,6 +426,7 @@ void FurnaceGUI::drawPattern() {
|
||||||
int ord=curOrder;
|
int ord=curOrder;
|
||||||
int chans=e->getTotalChannelCount();
|
int chans=e->getTotalChannelCount();
|
||||||
int displayChans=0;
|
int displayChans=0;
|
||||||
|
float chanHeadBottom=0.0f;
|
||||||
const DivPattern* patCache[DIV_MAX_CHANS];
|
const DivPattern* patCache[DIV_MAX_CHANS];
|
||||||
for (int i=0; i<chans; i++) {
|
for (int i=0; i<chans; i++) {
|
||||||
if (e->curSubSong->chanShow[i]) displayChans++;
|
if (e->curSubSong->chanShow[i]) displayChans++;
|
||||||
|
@ -998,6 +999,7 @@ void FurnaceGUI::drawPattern() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
chanHeadBottom=ImGui::GetCursorScreenPos().y;
|
||||||
}
|
}
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
lastPatternWidth=ImGui::GetCursorPosX()-lpwStart+ImGui::GetStyle().ScrollbarSize;
|
lastPatternWidth=ImGui::GetCursorPosX()-lpwStart+ImGui::GetStyle().ScrollbarSize;
|
||||||
|
@ -1135,6 +1137,105 @@ void FurnaceGUI::drawPattern() {
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (patChannelPairs && e->isRunning()) { // pair hints
|
||||||
|
ImDrawList* dl=ImGui::GetWindowDrawList();
|
||||||
|
float pos=0.0f;
|
||||||
|
float posCenter=0.0f;
|
||||||
|
float posMin=FLT_MAX;
|
||||||
|
float posMax=-FLT_MAX;
|
||||||
|
float posY=chanHeadBottom;
|
||||||
|
ImVec2 textSize;
|
||||||
|
|
||||||
|
for (int i=0; i<chans; i++) {
|
||||||
|
bool isPaired=false;
|
||||||
|
int numPairs=0;
|
||||||
|
if (!e->curSubSong->chanShow[i]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
DivChannelPair pairs=e->getChanPaired(i);
|
||||||
|
for (int j=0; j<8; j++) {
|
||||||
|
if (pairs.pairs[j]==-1) continue;
|
||||||
|
int pairCh=e->dispatchFirstChan[i]+pairs.pairs[j];
|
||||||
|
if (!e->curSubSong->chanShow[pairCh]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
isPaired=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isPaired) continue;
|
||||||
|
|
||||||
|
pos=(patChanX[i+1]+patChanX[i])*0.5;
|
||||||
|
posCenter=pos;
|
||||||
|
posMin=pos;
|
||||||
|
posMax=pos;
|
||||||
|
numPairs++;
|
||||||
|
|
||||||
|
if (pairs.label==NULL) {
|
||||||
|
textSize=ImGui::CalcTextSize("???");
|
||||||
|
} else {
|
||||||
|
textSize=ImGui::CalcTextSize(pairs.label);
|
||||||
|
}
|
||||||
|
dl->AddLine(
|
||||||
|
ImVec2(pos,posY),
|
||||||
|
ImVec2(pos,posY+textSize.y),
|
||||||
|
0xffffffff,
|
||||||
|
dpiScale
|
||||||
|
);
|
||||||
|
|
||||||
|
for (int j=0; j<8; j++) {
|
||||||
|
if (pairs.pairs[j]==-1) continue;
|
||||||
|
int pairCh=e->dispatchFirstChan[i]+pairs.pairs[j];
|
||||||
|
if (!e->curSubSong->chanShow[pairCh]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
pos=(patChanX[pairCh+1]+patChanX[pairCh])*0.5;
|
||||||
|
posCenter+=pos;
|
||||||
|
numPairs++;
|
||||||
|
if (pos<posMin) posMin=pos;
|
||||||
|
if (pos>posMax) posMax=pos;
|
||||||
|
dl->AddLine(
|
||||||
|
ImVec2(pos,posY),
|
||||||
|
ImVec2(pos,posY+textSize.y),
|
||||||
|
0xffffffff,
|
||||||
|
dpiScale
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
posCenter/=numPairs;
|
||||||
|
|
||||||
|
if (pairs.label==NULL) {
|
||||||
|
dl->AddLine(
|
||||||
|
ImVec2(posMin,posY+textSize.y),
|
||||||
|
ImVec2(posMax,posY+textSize.y),
|
||||||
|
0xffffffff,
|
||||||
|
dpiScale
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
dl->AddLine(
|
||||||
|
ImVec2(posMin,posY+textSize.y),
|
||||||
|
ImVec2(posCenter-textSize.x*0.5,posY+textSize.y),
|
||||||
|
0xffffffff,
|
||||||
|
dpiScale
|
||||||
|
);
|
||||||
|
dl->AddLine(
|
||||||
|
ImVec2(posCenter+textSize.x*0.5,posY+textSize.y),
|
||||||
|
ImVec2(posMax,posY+textSize.y),
|
||||||
|
0xffffffff,
|
||||||
|
dpiScale
|
||||||
|
);
|
||||||
|
|
||||||
|
dl->AddText(
|
||||||
|
ImVec2(posCenter-textSize.x*0.5,posY+textSize.y*0.5),
|
||||||
|
0xffffffff,
|
||||||
|
pairs.label
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (fancyPattern) { // visualizer
|
if (fancyPattern) { // visualizer
|
||||||
e->getCommandStream(cmdStream);
|
e->getCommandStream(cmdStream);
|
||||||
ImDrawList* dl=ImGui::GetWindowDrawList();
|
ImDrawList* dl=ImGui::GetWindowDrawList();
|
||||||
|
|
Loading…
Reference in a new issue