warn user if we cannot play

This commit is contained in:
tildearrow 2023-09-09 17:12:49 -05:00
parent c6c05582bd
commit a7ded3325a
3 changed files with 16 additions and 8 deletions

View file

@ -1701,7 +1701,7 @@ unsigned int DivEngine::convertPanLinearToSplit(int val, unsigned char bits, int
return (panL<<bits)|panR;
}
void DivEngine::play() {
bool DivEngine::play() {
BUSY_BEGIN_SOFT;
curOrder=prevOrder;
sPreview.sample=-1;
@ -1788,10 +1788,12 @@ void DivEngine::play() {
}
output->midiOut->send(TAMidiMessage(TA_MIDI_MACHINE_PLAY,0,0));
}
bool didItPlay=playing;
BUSY_END;
return didItPlay;
}
void DivEngine::playToRow(int row) {
bool DivEngine::playToRow(int row) {
BUSY_BEGIN_SOFT;
sPreview.sample=-1;
sPreview.wave=-1;
@ -1802,7 +1804,9 @@ void DivEngine::playToRow(int row) {
for (int i=0; i<DIV_MAX_CHANS; i++) {
keyHit[i]=false;
}
bool didItPlay=playing;
BUSY_END;
return didItPlay;
}
void DivEngine::stepOne(int row) {

View file

@ -708,11 +708,11 @@ class DivEngine {
// find song loop position
void walkSong(int& loopOrder, int& loopRow, int& loopEnd);
// play
void play();
// play (returns whether successful)
bool play();
// play to row
void playToRow(int row);
// play to row (returns whether successful)
bool playToRow(int row);
// play by one row
void stepOne(int row);

View file

@ -1105,9 +1105,13 @@ void FurnaceGUI::play(int row) {
memset(lastIns,-1,sizeof(int)*DIV_MAX_CHANS);
if (!followPattern) e->setOrder(curOrder);
if (row>0) {
e->playToRow(row);
if (!e->playToRow(row)) {
showError("the song is over!");
}
} else {
e->play();
if (!e->play()) {
showError("the song is over!");
}
}
curNibble=false;
orderNibble=false;