When playing empty chord user gets pause with default length
This commit is contained in:
parent
c0af952fc6
commit
00b11087b4
@ -217,9 +217,13 @@ void Interpreter::leave_scope()
|
|||||||
Result<void> Interpreter::play(Chord chord)
|
Result<void> Interpreter::play(Chord chord)
|
||||||
{
|
{
|
||||||
Try(ensure_midi_connection_available(*this, Midi_Connection_Type::Output, "play"));
|
Try(ensure_midi_connection_available(*this, Midi_Connection_Type::Output, "play"));
|
||||||
|
|
||||||
auto &ctx = context_stack.back();
|
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
|
// 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); });
|
std::transform(chord.notes.begin(), chord.notes.end(), chord.notes.begin(), [&](Note note) { return ctx.fill(note); });
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user