From 4373aaeea9574ec43d3b4670a455429ed202beea Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 8 Jun 2019 18:54:17 +0300 Subject: [PATCH] Add a repeat statement --- source/sequencer.cpp | 10 ++++++++++ source/sequencer.h | 1 + 2 files changed, 11 insertions(+) diff --git a/source/sequencer.cpp b/source/sequencer.cpp index 19c4041..b4969bb 100644 --- a/source/sequencer.cpp +++ b/source/sequencer.cpp @@ -147,6 +147,7 @@ Sequencer::Loader::Loader(Sequencer &s, Demo &d): add("base", &Loader::base); add("define_action", &Loader::define_action); add("instant", &Loader::instant); + add("repeat", &Loader::repeat); add("segment", &Loader::segment); } @@ -168,6 +169,15 @@ void Sequencer::Loader::instant(float beat) segment(beat, beat); } +void Sequencer::Loader::repeat(float b, float d, unsigned n) +{ + for(unsigned i=0; i set_base(base_beat, base_beat+b+i*d); + load_sub_with(*this); + } +} + void Sequencer::Loader::segment(float start, float end) { SegmentLoader ldr(obj, base_beat+start, base_beat+end, demo); diff --git a/source/sequencer.h b/source/sequencer.h index 1cd1ebc..d85b6f8 100644 --- a/source/sequencer.h +++ b/source/sequencer.h @@ -31,6 +31,7 @@ public: void base(float); void define_action(const std::string &); void instant(float); + void repeat(float, float, unsigned); void segment(float, float); }; -- 2.45.2