mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-14 19:59:59 +01:00
Improved OSC sync
Accept OSC request to sync source by name or id. Changed OSC seek request to be by percent target
This commit is contained in:
@@ -680,6 +680,11 @@ bool Control::receiveSourceAttribute(Source *target, const std::string &attribut
|
|||||||
arguments >> t >> osc::EndMessage;
|
arguments >> t >> osc::EndMessage;
|
||||||
target->call( new Seek( t ), true );
|
target->call( new Seek( t ), true );
|
||||||
}
|
}
|
||||||
|
/// e.g. '/vimix/name/sync'
|
||||||
|
else if ( attribute.compare(OSC_SYNC) == 0) {
|
||||||
|
// this will require to send feedback status about source
|
||||||
|
send_feedback = true;
|
||||||
|
}
|
||||||
#ifdef CONTROL_DEBUG
|
#ifdef CONTROL_DEBUG
|
||||||
else {
|
else {
|
||||||
Log::Info(CONTROL_OSC_MSG "Ignoring attribute '%s' for target %s.", attribute.c_str(), target->name().c_str());
|
Log::Info(CONTROL_OSC_MSG "Ignoring attribute '%s' for target %s.", attribute.c_str(), target->name().c_str());
|
||||||
|
|||||||
@@ -460,7 +460,7 @@ SourceCallback *RePlay::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Seek::Seek(float time) : SourceCallback(), target_time_(time)
|
Seek::Seek(float time) : SourceCallback(), target_(time)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,8 +473,10 @@ void Seek::update(Source *s, float dt)
|
|||||||
|
|
||||||
// access media player if target source is a media source
|
// access media player if target source is a media source
|
||||||
MediaSource *ms = dynamic_cast<MediaSource *>(s);
|
MediaSource *ms = dynamic_cast<MediaSource *>(s);
|
||||||
if (ms != nullptr)
|
if (ms != nullptr) {
|
||||||
ms->mediaplayer()->seek( GST_SECOND * target_time_ );
|
GstClockTime duration = ms->mediaplayer()->timeline()->duration();
|
||||||
|
ms->mediaplayer()->seek( target_ * duration );
|
||||||
|
}
|
||||||
|
|
||||||
status_ = FINISHED;
|
status_ = FINISHED;
|
||||||
}
|
}
|
||||||
@@ -482,7 +484,7 @@ void Seek::update(Source *s, float dt)
|
|||||||
|
|
||||||
SourceCallback *Seek::clone() const
|
SourceCallback *Seek::clone() const
|
||||||
{
|
{
|
||||||
return new Seek(target_time_);
|
return new Seek(target_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seek::accept(Visitor& v)
|
void Seek::accept(Visitor& v)
|
||||||
|
|||||||
@@ -180,13 +180,13 @@ public:
|
|||||||
|
|
||||||
class Seek : public SourceCallback
|
class Seek : public SourceCallback
|
||||||
{
|
{
|
||||||
float target_time_;
|
float target_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Seek (float time = 0.f);
|
Seek (float time = 0.f);
|
||||||
|
|
||||||
float value () const { return target_time_;}
|
float value () const { return target_;}
|
||||||
void setValue (float t) { target_time_ = t; }
|
void setValue (float t) { target_ = t; }
|
||||||
|
|
||||||
void update (Source *s, float dt) override;
|
void update (Source *s, float dt) override;
|
||||||
SourceCallback *clone() const override;
|
SourceCallback *clone() const override;
|
||||||
|
|||||||
Reference in New Issue
Block a user