When playing empty chord user gets pause with default length

This commit is contained in:
Robert Bendun 2022-08-29 21:48:35 +02:00
parent c0af952fc6
commit 00b11087b4

View File

@ -217,9 +217,13 @@ void Interpreter::leave_scope()
Result<void> 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); });