mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-10 09:49:59 +01:00
BugFix Sync Play to Session ready when loading
Add test of session state on Play callback; the play action is then called after all sources are ready, thus starting in sync.
This commit is contained in:
@@ -1047,7 +1047,7 @@ void SessionLoader::visit (Source& s)
|
||||
s.call( new Lock(l) );
|
||||
bool p = true;
|
||||
sourceNode->QueryBoolAttribute("play", &p);
|
||||
s.call( new Play(p) );
|
||||
s.call( new Play(p, session_) );
|
||||
|
||||
xmlCurrent_ = sourceNode->FirstChildElement("Mixing");
|
||||
if (xmlCurrent_) s.groupNode(View::MIXING)->accept(*this);
|
||||
|
||||
@@ -494,7 +494,8 @@ void SetDepth::accept(Visitor& v)
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
Play::Play(bool on, bool revert) : SourceCallback(), play_(on), bidirectional_(revert)
|
||||
Play::Play(bool on, Session *parentsession, bool revert) : SourceCallback(),
|
||||
session_(parentsession), play_(on), bidirectional_(revert)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -503,7 +504,8 @@ void Play::update(Source *s, float dt)
|
||||
SourceCallback::update(s, dt);
|
||||
|
||||
// toggle play status when ready
|
||||
if ( status_ == READY && s->ready() ){
|
||||
if ( status_ == READY && s->ready() &&
|
||||
(session_ ? session_->ready() : true) ){
|
||||
|
||||
if (s->playing() != play_)
|
||||
// call play function
|
||||
@@ -516,7 +518,7 @@ void Play::update(Source *s, float dt)
|
||||
|
||||
SourceCallback *Play::clone() const
|
||||
{
|
||||
return new Play(play_, bidirectional_);
|
||||
return new Play(play_, session_, bidirectional_);
|
||||
}
|
||||
|
||||
SourceCallback *Play::reverse(Source *s) const
|
||||
|
||||
@@ -212,11 +212,12 @@ public:
|
||||
|
||||
class Play : public SourceCallback
|
||||
{
|
||||
class Session *session_;
|
||||
bool play_;
|
||||
bool bidirectional_;
|
||||
|
||||
public:
|
||||
Play (bool on = true, bool revert = false);
|
||||
Play (bool on = true, Session *parentsession = nullptr, bool revert = false);
|
||||
|
||||
bool value () const { return play_;}
|
||||
void setValue (bool on) { play_ = on; }
|
||||
|
||||
Reference in New Issue
Block a user