diff --git a/src/ControlManager.cpp b/src/ControlManager.cpp index 5ffb176..cd410f2 100644 --- a/src/ControlManager.cpp +++ b/src/ControlManager.cpp @@ -824,6 +824,12 @@ bool Control::receiveSourceAttribute(Source *target, const std::string &attribut arguments >> t >> osc::EndMessage; target->call( new Seek( t ), true ); } + /// e.g. '/vimix/current/speed f 0.25' + else if ( attribute.compare(OSC_SOURCE_SPEED) == 0) { + float t = 0.f; + arguments >> t >> osc::EndMessage; + target->call( new PlaySpeed( t ), true ); + } /// e.g. '/vimix/name/sync' else if ( attribute.compare(OSC_SYNC) == 0) { // this will require to send feedback status about source diff --git a/src/ControlManager.h b/src/ControlManager.h index bb9ca97..f3c0efa 100644 --- a/src/ControlManager.h +++ b/src/ControlManager.h @@ -50,6 +50,7 @@ #define OSC_SOURCE_SIZE "/size" #define OSC_SOURCE_ANGLE "/angle" #define OSC_SOURCE_SEEK "/seek" +#define OSC_SOURCE_SPEED "/speed" #define OSC_SOURCE_BRIGHTNESS "/brightness" #define OSC_SOURCE_CONTRAST "/contrast" #define OSC_SOURCE_SATURATION "/saturation" diff --git a/src/UserInterfaceManager.cpp b/src/UserInterfaceManager.cpp index aa7d234..752e0ab 100644 --- a/src/UserInterfaceManager.cpp +++ b/src/UserInterfaceManager.cpp @@ -4390,7 +4390,7 @@ void SourceController::RenderMediaPlayer(MediaSource *ms) ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - buttons_height_ ); // speed slider float speed = static_cast(mediaplayer_active_->playSpeed()); - if (ImGui::DragFloat( "##Speed", &speed, 0.01f, -10.f, 10.f, UNICODE_MULTIPLY " %.1f", 2.f)) + if (ImGui::DragFloat( "##Speed", &speed, 0.01f, -10.f, 10.f, UNICODE_MULTIPLY " %.2f", 2.f)) mediaplayer_active_->setPlaySpeed( static_cast(speed) ); // store action on mouse release if (ImGui::IsItemDeactivatedAfterEdit()){ @@ -5832,7 +5832,7 @@ void InputMappingInterface::SliderParametersCallback(SourceCallback *callback, c float val = edited->value(); ImGui::SetNextItemWidth(right_align); ImGui::SameLine(0, IMGUI_SAME_LINE / 2); - if (ImGui::SliderFloat("##CALLBACK_PLAYSPEED", &val, 0.1f, 20.f, "x %.1f")) + if (ImGui::SliderFloat("##CALLBACK_PLAYSPEED", &val, -10.f, 10.f, UNICODE_MULTIPLY " %.2f")) edited->setValue(val); ImGui::SameLine(0, IMGUI_SAME_LINE / 2); diff --git a/src/snippets.cpp b/src/snippets.cpp index ad726b1..a4d8374 100644 --- a/src/snippets.cpp +++ b/src/snippets.cpp @@ -256,7 +256,7 @@ void drawMediaPlayer() ImGui::SameLine(0, spacing); ImGui::SetNextItemWidth(270); // ImGui::SetNextItemWidth(width - 90.0); - if (ImGui::SliderFloat( "Speed", &speed, -10.f, 10.f, "x %.1f", 2.f)) + if (ImGui::SliderFloat( "Speed", &speed, -10.f, 10.f, "x %.2f", 2.f)) testmedia.setPlaySpeed( static_cast(speed) ); ImGui::SameLine(0, spacing); if (ImGuiToolkit::ButtonIcon(19, 15)) {