BugFix OSC API extended

This commit is contained in:
Bruno Herbelin
2024-01-14 18:59:42 +01:00
parent fad4be419a
commit e42afcb434
4 changed files with 25 additions and 6 deletions

View File

@@ -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) {

View File

@@ -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"

View File

@@ -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

View File

@@ -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