diff --git a/source/include/signalflow/node/buffer/segment-player.h b/source/include/signalflow/node/buffer/segment-player.h index 44295285..c2c98cf7 100644 --- a/source/include/signalflow/node/buffer/segment-player.h +++ b/source/include/signalflow/node/buffer/segment-player.h @@ -14,7 +14,8 @@ class SegmentPlayer : public Node SegmentPlayer(BufferRef buffer = nullptr, std::vector onsets = {}, NodeRef index = nullptr, - NodeRef rate = 1.0); + NodeRef rate = 1.0, + NodeRef clock = nullptr); virtual void process(Buffer &out, int num_frames) override; virtual void trigger(std::string name = SIGNALFLOW_DEFAULT_TRIGGER, float value = 1.0) override; @@ -32,6 +33,7 @@ class SegmentPlayer : public Node NodeRef index; NodeRef rate; float rate_scale_factor; + NodeRef clock; }; REGISTER(SegmentPlayer, "segment-player") diff --git a/source/src/node/buffer/segment-player.cpp b/source/src/node/buffer/segment-player.cpp index cfee43dc..1a662804 100644 --- a/source/src/node/buffer/segment-player.cpp +++ b/source/src/node/buffer/segment-player.cpp @@ -7,8 +7,8 @@ namespace signalflow { -SegmentPlayer::SegmentPlayer(BufferRef buffer, std::vector onsets, NodeRef index, NodeRef rate) - : buffer(buffer), index(index), rate(rate) +SegmentPlayer::SegmentPlayer(BufferRef buffer, std::vector onsets, NodeRef index, NodeRef rate, NodeRef clock) + : buffer(buffer), index(index), rate(rate), clock(clock) { this->name = "segment-player"; @@ -18,6 +18,7 @@ SegmentPlayer::SegmentPlayer(BufferRef buffer, std::vector onsets, NodeRe this->set_property("onsets", onsets); this->create_input("index", this->index); this->create_input("rate", this->rate); + this->create_input("clock", this->clock); this->rate_scale_factor = 1.0; this->phase = 0.0; @@ -66,6 +67,11 @@ void SegmentPlayer::process(Buffer &out, int num_frames) void SegmentPlayer::trigger(std::string name, float value) { + /*-------------------------------------------------------------------------------- + * TODO: How to honour `value` here, if specified? + * Perhaps the default should be a null value, that gets ignored in favour + * of `index` if not specified. + *--------------------------------------------------------------------------------*/ if (name == SIGNALFLOW_DEFAULT_TRIGGER) { PropertyRef onsetsref = this->get_property("onsets");