mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-14 19:59:59 +01:00
BugFix: session creator restore play status of all types of sources
moved 'play' attribute to source instead of mediaplayer and use source callback to set play state after initialization.
This commit is contained in:
@@ -851,12 +851,15 @@ void SessionLoader::visit(MediaPlayer &n)
|
|||||||
mediaplayerNode->QueryIntAttribute("sync_to_metronome", &sync_to_metronome);
|
mediaplayerNode->QueryIntAttribute("sync_to_metronome", &sync_to_metronome);
|
||||||
n.setSyncToMetronome( (Metronome::Synchronicity) sync_to_metronome);
|
n.setSyncToMetronome( (Metronome::Synchronicity) sync_to_metronome);
|
||||||
|
|
||||||
|
// only read media player play attribute if the source has no play attribute (backward compatibility)
|
||||||
|
if ( !xmlCurrent_->Attribute( "play" ) ) {
|
||||||
bool play = true;
|
bool play = true;
|
||||||
mediaplayerNode->QueryBoolAttribute("play", &play);
|
mediaplayerNode->QueryBoolAttribute("play", &play);
|
||||||
n.play(play);
|
n.play(play);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SessionLoader::visit(Shader &n)
|
void SessionLoader::visit(Shader &n)
|
||||||
{
|
{
|
||||||
@@ -933,9 +936,14 @@ void SessionLoader::visit (Source& s)
|
|||||||
XMLElement* sourceNode = xmlCurrent_;
|
XMLElement* sourceNode = xmlCurrent_;
|
||||||
const char *pName = sourceNode->Attribute("name");
|
const char *pName = sourceNode->Attribute("name");
|
||||||
s.setName(pName);
|
s.setName(pName);
|
||||||
|
|
||||||
|
// schedule lock and play of the source (callbacks called after init)
|
||||||
bool l = false;
|
bool l = false;
|
||||||
sourceNode->QueryBoolAttribute("locked", &l);
|
sourceNode->QueryBoolAttribute("locked", &l);
|
||||||
s.setLocked(l);
|
s.call( new Lock(l) );
|
||||||
|
bool p = true;
|
||||||
|
sourceNode->QueryBoolAttribute("play", &p);
|
||||||
|
s.call( new Play(p) );
|
||||||
|
|
||||||
xmlCurrent_ = sourceNode->FirstChildElement("Mixing");
|
xmlCurrent_ = sourceNode->FirstChildElement("Mixing");
|
||||||
if (xmlCurrent_) s.groupNode(View::MIXING)->accept(*this);
|
if (xmlCurrent_) s.groupNode(View::MIXING)->accept(*this);
|
||||||
@@ -990,6 +998,7 @@ void SessionLoader::visit (Source& s)
|
|||||||
|
|
||||||
// restore current
|
// restore current
|
||||||
xmlCurrent_ = sourceNode;
|
xmlCurrent_ = sourceNode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionLoader::visit (MediaSource& s)
|
void SessionLoader::visit (MediaSource& s)
|
||||||
|
|||||||
@@ -574,6 +574,7 @@ void SessionVisitor::visit (Source& s)
|
|||||||
sourceNode->SetAttribute("id", s.id());
|
sourceNode->SetAttribute("id", s.id());
|
||||||
sourceNode->SetAttribute("name", s.name().c_str() );
|
sourceNode->SetAttribute("name", s.name().c_str() );
|
||||||
sourceNode->SetAttribute("locked", s.locked() );
|
sourceNode->SetAttribute("locked", s.locked() );
|
||||||
|
sourceNode->SetAttribute("play", s.playing() );
|
||||||
|
|
||||||
// insert into hierarchy
|
// insert into hierarchy
|
||||||
xmlCurrent_->InsertFirstChild(sourceNode);
|
xmlCurrent_->InsertFirstChild(sourceNode);
|
||||||
|
|||||||
Reference in New Issue
Block a user