From 00b11087b46f6cbd029678214d915a7c4b3e8a88 Mon Sep 17 00:00:00 2001 From: Robert Bendun Date: Mon, 29 Aug 2022 21:48:35 +0200 Subject: [PATCH] When playing empty chord user gets pause with default length --- src/interpreter.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/interpreter.cc b/src/interpreter.cc index b22c172..ecb63e8 100644 --- a/src/interpreter.cc +++ b/src/interpreter.cc @@ -217,9 +217,13 @@ void Interpreter::leave_scope() Result Interpreter::play(Chord chord) { Try(ensure_midi_connection_available(*this, Midi_Connection_Type::Output, "play")); - auto &ctx = context_stack.back(); + if (chord.notes.size() == 0) { + std::this_thread::sleep_for(ctx.length_to_duration(ctx.length)); + return {}; + } + // Fill all notes that don't have octave or length with defaults std::transform(chord.notes.begin(), chord.notes.end(), chord.notes.begin(), [&](Note note) { return ctx.fill(note); });