GUI: add status bar
This commit is contained in:
parent
5523a43804
commit
6ee4e33b89
|
@ -1432,12 +1432,13 @@ void DivEngine::playSub(bool preserveDrift) {
|
|||
endOfSong=false;
|
||||
} else {
|
||||
ticks=1;
|
||||
totalTicks=0;
|
||||
}
|
||||
speedAB=false;
|
||||
playing=true;
|
||||
dispatch->setSkipRegisterWrites(true);
|
||||
while (curOrder<goal) {
|
||||
if (nextTick()) break;
|
||||
if (nextTick(preserveDrift)) break;
|
||||
}
|
||||
dispatch->setSkipRegisterWrites(false);
|
||||
dispatch->forceIns();
|
||||
|
@ -1473,6 +1474,8 @@ void DivEngine::reset() {
|
|||
}
|
||||
extValue=0;
|
||||
extValuePresent=0;
|
||||
speed1=song.speed1;
|
||||
speed2=song.speed2;
|
||||
dispatch->reset();
|
||||
}
|
||||
|
||||
|
@ -1498,6 +1501,29 @@ int DivEngine::getRow() {
|
|||
return curRow;
|
||||
}
|
||||
|
||||
unsigned char DivEngine::getSpeed1() {
|
||||
return speed1;
|
||||
}
|
||||
|
||||
unsigned char DivEngine::getSpeed2() {
|
||||
return speed2;
|
||||
}
|
||||
|
||||
int DivEngine::getHz() {
|
||||
if (song.customTempo) {
|
||||
return song.hz;
|
||||
} else if (song.pal) {
|
||||
return 60;
|
||||
} else {
|
||||
return 50;
|
||||
}
|
||||
return 60;
|
||||
}
|
||||
|
||||
int DivEngine::getTotalTicks() {
|
||||
return totalTicks;
|
||||
}
|
||||
|
||||
bool DivEngine::hasExtValue() {
|
||||
return extValuePresent;
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ class DivEngine {
|
|||
int ticks, cycles, curRow, curOrder, remainingLoops, nextSpeed, clockDrift;
|
||||
int changeOrd, changePos, totalTicks, totalCmds, lastCmds, cmdsPerSecond;
|
||||
unsigned char extValue;
|
||||
unsigned char speed1, speed2;
|
||||
DivStatusView view;
|
||||
DivChannelState chan[17];
|
||||
DivAudioEngines audioEngine;
|
||||
|
@ -108,7 +109,7 @@ class DivEngine {
|
|||
void nextOrder();
|
||||
void nextRow();
|
||||
// returns true if end of song.
|
||||
bool nextTick();
|
||||
bool nextTick(bool noAccum=false);
|
||||
bool perSystemEffect(int ch, unsigned char effect, unsigned char effectVal);
|
||||
bool perSystemPostEffect(int ch, unsigned char effect, unsigned char effectVal);
|
||||
void renderSamples();
|
||||
|
@ -208,6 +209,18 @@ class DivEngine {
|
|||
// get current row
|
||||
int getRow();
|
||||
|
||||
// get speed 1
|
||||
unsigned char getSpeed1();
|
||||
|
||||
// get speed 2
|
||||
unsigned char getSpeed2();
|
||||
|
||||
// get Hz
|
||||
int getHz();
|
||||
|
||||
// get time
|
||||
int getTotalTicks();
|
||||
|
||||
// has ext value
|
||||
bool hasExtValue();
|
||||
|
||||
|
@ -301,6 +314,8 @@ class DivEngine {
|
|||
lastCmds(0),
|
||||
cmdsPerSecond(0),
|
||||
extValue(0),
|
||||
speed1(3),
|
||||
speed2(3),
|
||||
view(DIV_STATUS_NOTHING),
|
||||
audioEngine(DIV_AUDIO_SDL),
|
||||
bbInLen(0),
|
||||
|
|
|
@ -379,10 +379,10 @@ void DivEngine::processRow(int i, bool afterDelay) {
|
|||
// per-system effect
|
||||
if (!perSystemEffect(i,effect,effectVal)) switch (effect) {
|
||||
case 0x09: // speed 1
|
||||
song.speed1=effectVal;
|
||||
speed1=effectVal;
|
||||
break;
|
||||
case 0x0f: // speed 2
|
||||
song.speed2=effectVal;
|
||||
speed2=effectVal;
|
||||
break;
|
||||
case 0x0b: // change order
|
||||
if (changeOrd==-1) {
|
||||
|
@ -623,19 +623,19 @@ void DivEngine::nextRow() {
|
|||
|
||||
if (song.system==DIV_SYSTEM_YMU759) {
|
||||
if (speedAB) {
|
||||
ticks=song.speed2;
|
||||
nextSpeed=song.speed1;
|
||||
ticks=speed2;
|
||||
nextSpeed=speed1;
|
||||
} else {
|
||||
ticks=song.speed1;
|
||||
nextSpeed=song.speed2;
|
||||
ticks=speed1;
|
||||
nextSpeed=speed2;
|
||||
}
|
||||
} else {
|
||||
if (speedAB) {
|
||||
ticks=song.speed2*(song.timeBase+1);
|
||||
nextSpeed=song.speed1;
|
||||
ticks=speed2*(song.timeBase+1);
|
||||
nextSpeed=speed1;
|
||||
} else {
|
||||
ticks=song.speed1*(song.timeBase+1);
|
||||
nextSpeed=song.speed2;
|
||||
ticks=speed1*(song.timeBase+1);
|
||||
nextSpeed=speed2;
|
||||
}
|
||||
}
|
||||
speedAB=!speedAB;
|
||||
|
@ -651,7 +651,7 @@ void DivEngine::nextRow() {
|
|||
}
|
||||
}
|
||||
|
||||
bool DivEngine::nextTick() {
|
||||
bool DivEngine::nextTick(bool noAccum) {
|
||||
bool ret=false;
|
||||
int divider=60;
|
||||
if (song.customTempo) {
|
||||
|
@ -781,7 +781,7 @@ bool DivEngine::nextTick() {
|
|||
// system tick
|
||||
dispatch->tick();
|
||||
|
||||
totalTicks++;
|
||||
if (!noAccum) totalTicks++;
|
||||
|
||||
int hz;
|
||||
if (song.customTempo) {
|
||||
|
|
|
@ -2076,6 +2076,13 @@ bool FurnaceGUI::loop() {
|
|||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (e->isPlaying()) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PLAYBACK_STAT]);
|
||||
int totalTicks=e->getTotalTicks();
|
||||
int hz=e->getHz();
|
||||
ImGui::Text("| Speed %d:%d | Order %d/%d | Row %d/%d | %d:%.2d:%.2d.%.2d",e->getSpeed1(),e->getSpeed2(),e->getOrder(),e->song.ordersLen,e->getRow(),e->song.patLen,totalTicks/(hz*3600),(totalTicks/(hz*60))%60,(totalTicks/hz)%60,(totalTicks%hz)*100/hz);
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
ImGui::EndMainMenuBar();
|
||||
|
||||
ImGui::DockSpaceOverViewport();
|
||||
|
@ -2328,6 +2335,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
uiColors[GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY]=ImVec4(0.0f,1.0f,0.5f,1.0f);
|
||||
uiColors[GUI_COLOR_PATTERN_EFFECT_MISC]=ImVec4(0.3f,0.3f,1.0f,1.0f);
|
||||
uiColors[GUI_COLOR_EE_VALUE]=ImVec4(0.0f,1.0f,1.0f,1.0f);
|
||||
uiColors[GUI_COLOR_PLAYBACK_STAT]=ImVec4(0.6f,0.6f,0.6f,1.0f);
|
||||
|
||||
for (int i=0; i<64; i++) {
|
||||
ImVec4 col1=uiColors[GUI_COLOR_PATTERN_VOLUME_MIN];
|
||||
|
|
|
@ -31,6 +31,7 @@ enum FurnaceGUIColors {
|
|||
GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY,
|
||||
GUI_COLOR_PATTERN_EFFECT_MISC,
|
||||
GUI_COLOR_EE_VALUE,
|
||||
GUI_COLOR_PLAYBACK_STAT,
|
||||
GUI_COLOR_MAX
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue