diff --git a/src/ControlManager.cpp b/src/ControlManager.cpp index d870fdb..04ed93d 100644 --- a/src/ControlManager.cpp +++ b/src/ControlManager.cpp @@ -826,8 +826,21 @@ bool Control::receiveSourceAttribute(Source *target, const std::string &attribut /// e.g. '/vimix/current/posterize f 1' else if ( attribute.compare(OSC_SOURCE_POSTERIZE) == 0) { float v = 0.f; - arguments >> v >> osc::EndMessage; - target->call( new SetPosterize( v ), true ); + float t = 0.f; + arguments >> v; + if (arguments.Eos()) + arguments >> osc::EndMessage; + else + arguments >> t >> osc::EndMessage; + target->call( new SetPosterize( v, t ), true ); + } + /// e.g. '/vimix/current/correction f 1' + else if (attribute.compare(OSC_SOURCE_CORRECTION) == 0) { + float on = 1.f; + if (!arguments.Eos()) { + arguments >> on >> osc::EndMessage; + } + target->setImageProcessingEnabled(on > 0.5f); } /// e.g. '/vimix/current/seek f 0.25' ; seek to 25% of duration /// e.g. '/vimix/current/seek iiii 0 0 25 500' ; seek to time @@ -849,9 +862,14 @@ bool Control::receiveSourceAttribute(Source *target, const std::string &attribut } /// e.g. '/vimix/current/speed f 0.25' else if (attribute.compare(OSC_SOURCE_SPEED) == 0) { + float v = 0.f; float t = 0.f; - arguments >> t >> osc::EndMessage; - target->call(new PlaySpeed(t), true); + arguments >> v; + if (arguments.Eos()) + arguments >> osc::EndMessage; + else + arguments >> t >> osc::EndMessage; + target->call(new PlaySpeed( v, t ), true); } /// e.g. '/vimix/current/contents s text' else if (attribute.compare(OSC_SOURCE_CONTENTS) == 0) { diff --git a/src/ControlManager.h b/src/ControlManager.h index a30951f..5ccd770 100644 --- a/src/ControlManager.h +++ b/src/ControlManager.h @@ -62,6 +62,7 @@ #define OSC_SOURCE_COLOR "/color" #define OSC_SOURCE_POSTERIZE "/posterize" #define OSC_SOURCE_INVERT "/invert" +#define OSC_SOURCE_CORRECTION "/correction" #define OSC_SESSION "/session" #define OSC_SESSION_VERSION "/version" diff --git a/src/SourceCallback.cpp b/src/SourceCallback.cpp index 3a8aae9..e2047cf 100644 --- a/src/SourceCallback.cpp +++ b/src/SourceCallback.cpp @@ -1009,7 +1009,7 @@ void SetInvert::writeValue(Source *s, float val) SetPosterize::SetPosterize(float v, float ms, bool r) : ValueSourceCallback(v, ms, r) { - target_ = glm::clamp(target_, 0.f, 128.f); + target_ = glm::clamp(target_, 0.f, 256.f); } float SetPosterize::readValue(Source *s) const diff --git a/src/TextSource.cpp b/src/TextSource.cpp index ecdb88c..3f88858 100644 --- a/src/TextSource.cpp +++ b/src/TextSource.cpp @@ -245,7 +245,7 @@ void TextContents::open(const std::string &text, glm::ivec2 res) void TextContents::setText(const std::string &t) { - if ( src_ == nullptr && !t.empty() && text_.compare(t) != 0) { + if ( src_ == nullptr && text_.compare(t) != 0) { // set text text_ = t; // apply if ready