BugFix Implementation of Audio in Source

Generalized audio support into Source class, instead of MediaPlayer.
This commit is contained in:
Bruno Herbelin
2024-04-21 23:20:44 +02:00
parent 3e45ec7353
commit 7b5bc6d236
13 changed files with 248 additions and 156 deletions

View File

@@ -428,12 +428,6 @@ void SessionVisitor::visit(MediaPlayer &n)
XMLElement *newelement = xmlDoc_->NewElement("MediaPlayer");
newelement->SetAttribute("id", n.id());
if (n.audioAvailable()) {
newelement->SetAttribute("audio", n.audioEnabled());
newelement->SetAttribute("audio_volume", n.audioVolume());
newelement->SetAttribute("audio_mix", (int) n.audioVolumeMix());
}
if (!n.singleFrame()) {
newelement->SetAttribute("loop", (int) n.loop());
newelement->SetAttribute("speed", n.playSpeed());
@@ -661,6 +655,12 @@ void SessionVisitor::visit (Source& s)
s.mixingGroup()->accept(*this);
}
xmlCurrent_ = xmlDoc_->NewElement( "Audio" );
xmlCurrent_->SetAttribute("enabled", (bool) (s.audioFlags() & Source::Audio_enabled) );
xmlCurrent_->SetAttribute("volume", s.audioVolumeFactor(Source::VOLUME_BASE) );
xmlCurrent_->SetAttribute("volume_mix", (int) s.audioVolumeMix() );
sourceNode->InsertEndChild(xmlCurrent_);
xmlCurrent_ = sourceNode; // parent for next visits (other subtypes of Source)
}