X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsequencer.cpp;h=b4969bb30337182b35500b7ec378797bd8c1e86c;hb=4373aaeea9574ec43d3b4670a455429ed202beea;hp=0297c4397ff254bf30d26d95a44f4ec7909a1122;hpb=5296c1532980c5918ac91370e7dd670d673edb85;p=libs%2Fdemoscene.git diff --git a/source/sequencer.cpp b/source/sequencer.cpp index 0297c43..b4969bb 100644 --- a/source/sequencer.cpp +++ b/source/sequencer.cpp @@ -1,13 +1,16 @@ #include #include #include +#include #include "animate.h" #include "fadeoverlay.h" #include "sequencer.h" #include "stage.h" using namespace std; -using namespace Msp; + +namespace Msp { +namespace DemoScene { Sequencer::Sequencer(float bpm): started(false), @@ -138,13 +141,22 @@ void Sequencer::update_next_event() Sequencer::Loader::Loader(Sequencer &s, Demo &d): DataFile::ObjectLoader(s), - demo(d) + demo(d), + base_beat(0.0f) { + add("base", &Loader::base); add("define_action", &Loader::define_action); add("instant", &Loader::instant); + add("repeat", &Loader::repeat); add("segment", &Loader::segment); } +void Sequencer::Loader::base(float b) +{ + SetForScope set_base(base_beat, base_beat+b); + load_sub_with(*this); +} + void Sequencer::Loader::define_action(const string &n) { ActionDefLoader ldr(obj, demo); @@ -157,9 +169,18 @@ 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, start, end, demo); + SegmentLoader ldr(obj, base_beat+start, base_beat+end, demo); load_sub_with(ldr); } @@ -194,3 +215,6 @@ void Sequencer::SegmentLoader::apply(const string &n) { obj.add_action(*get_item(obj.named_actions, n), start_beat, end_beat); } + +} // namespace DemoScene +} // namespace Msp