command stream player now loops

This commit is contained in:
tildearrow 2024-03-08 20:52:51 -05:00
parent 2290f3d873
commit 8ff8ee89e9
2 changed files with 8 additions and 4 deletions

View file

@ -79,6 +79,7 @@ bool DivCSPlayer::tick() {
}
unsigned char next=stream.readC();
unsigned char command=0;
bool mustTell=true;
if (next<0xb3) { // note
e->dispatchCmd(DivCommand(DIV_CMD_NOTE_ON,i,(int)next-60));
@ -143,9 +144,11 @@ bool DivCSPlayer::tick() {
break;
}
chan[i].readPos=chan[i].callStack[--chan[i].callStackPos];
mustTell=false;
break;
case 0xfa:
chan[i].readPos=stream.readI();
mustTell=false;
break;
case 0xfb:
logE("TODO: RATE");
@ -161,8 +164,9 @@ bool DivCSPlayer::tick() {
chan[i].waitTicks=1;
break;
case 0xff:
chan[i].readPos=0;
logI("%d: stop",i);
chan[i].readPos=chan[i].startPos;
mustTell=false;
logI("%d: stop go back to %x",i,chan[i].readPos);
break;
default:
logE("%d: illegal instruction $%.2x! $%.x",i,next,chan[i].readPos);
@ -337,7 +341,7 @@ bool DivCSPlayer::tick() {
}
}
chan[i].readPos=stream.tell();
if (mustTell) chan[i].readPos=stream.tell();
}
if (sendVolume || chan[i].volSpeed!=0) {

View file

@ -141,7 +141,7 @@ void FurnaceGUI::drawCSPlayer() {
ImGui::TableNextColumn();
if (pos>=(int)bufSize) continue;
if (pos==nextHighlight) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(ImGuiCol_Header));
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(ImGuiCol_HeaderActive));
highlightPos++;
if (highlightPos>=(int)highlights.size()) {
nextHighlight=-1;