Skip to content

Commit

Permalink
Fix hanging metronomeOnly mode VMPC#104
Browse files Browse the repository at this point in the history
  • Loading branch information
izzyreal committed Jan 23, 2024
1 parent a4585d5 commit ce34dc9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/main/sequencer/FrameSeq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ FrameSeq::FrameSeq(mpc::Mpc& mpc)
{
}

void FrameSeq::start()
void FrameSeq::start(const bool metronomeOnlyToUse)
{
if (sequencerIsRunning.load())
{
Expand All @@ -68,6 +68,8 @@ void FrameSeq::start()

sequencerPlayTickCounter = sequencer->getPlayStartTick();

metronomeOnly = metronomeOnlyToUse;

sequencerIsRunning.store(true);
}

Expand All @@ -78,8 +80,7 @@ void FrameSeq::startMetronome()
return;
}

metronome = true;
start();
start(true);
}

unsigned short FrameSeq::getEventFrameOffset() const
Expand Down Expand Up @@ -390,7 +391,7 @@ void FrameSeq::processNoteRepeat()

void FrameSeq::updateTimeDisplay()
{
if (!sequencer->isCountingIn() && !metronome)
if (!sequencer->isCountingIn() && !metronomeOnly)
{
sequencer->notifyTimeDisplayRealtime();
sequencer->notifyObservers(std::string("timesignature"));
Expand Down Expand Up @@ -534,7 +535,7 @@ void FrameSeq::work(int nFrames)
triggerClickIfNeeded();
displayPunchRects();

if (metronome)
if (metronomeOnly)
{
sequencerPlayTickCounter++;
continue;
Expand Down
4 changes: 2 additions & 2 deletions src/main/sequencer/FrameSeq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace mpc::sequencer {
Clock internalClock;
std::shared_ptr<MidiClockOutput> midiClockOutput;
std::shared_ptr<Sequencer> sequencer;
bool metronome = false;
bool metronomeOnly = false;
std::shared_ptr<mpc::lcdgui::screens::SyncScreen> syncScreen;

// Offset of current tick within current buffer
Expand Down Expand Up @@ -102,7 +102,7 @@ namespace mpc::sequencer {

void setSampleRate(unsigned int sampleRate);

void start();
void start(bool metronomeOnly = false);

void startMetronome();

Expand Down

0 comments on commit ce34dc9

Please sign in to comment.