mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-06 14:52:34 +02:00
Common functions read and write mute and solo in Wave and Note
This commit is contained in:
parent
1a86819b4b
commit
7bda40f656
@ -758,6 +758,8 @@ bool NoteTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
double dblValue;
|
||||
if (!wxStrcmp(attr, wxT("name")) && XMLValueChecker::IsGoodString(strValue))
|
||||
mName = strValue;
|
||||
else if (this->NoteTrackBase::HandleXMLAttribute(attr, value))
|
||||
{}
|
||||
else if (!wxStrcmp(attr, wxT("offset")) &&
|
||||
XMLValueChecker::IsGoodString(strValue) &&
|
||||
Internat::CompatibleToDouble(strValue, &dblValue))
|
||||
@ -831,10 +833,7 @@ void NoteTrack::WriteXML(XMLWriter &xmlFile) const
|
||||
saveme->mSeq->write(data, true);
|
||||
xmlFile.StartTag(wxT("notetrack"));
|
||||
xmlFile.WriteAttr(wxT("name"), saveme->mName);
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
xmlFile.WriteAttr(wxT("mute"), mMute);
|
||||
xmlFile.WriteAttr(wxT("solo"), mSolo);
|
||||
#endif
|
||||
this->NoteTrackBase::WriteXMLAttributes(xmlFile);
|
||||
xmlFile.WriteAttr(wxT("offset"), saveme->GetOffset());
|
||||
xmlFile.WriteAttr(wxT("visiblechannels"), saveme->mVisibleChannels);
|
||||
xmlFile.WriteAttr(wxT("height"), saveme->GetActualHeight());
|
||||
|
@ -341,6 +341,33 @@ void PlayableTrack::Merge( const Track &orig )
|
||||
AudioTrack::Merge( *pOrig );
|
||||
}
|
||||
|
||||
// Serialize, not with tags of its own, but as attributes within a tag.
|
||||
void PlayableTrack::WriteXMLAttributes(XMLWriter &xmlFile) const
|
||||
{
|
||||
xmlFile.WriteAttr(wxT("mute"), mMute);
|
||||
xmlFile.WriteAttr(wxT("solo"), mSolo);
|
||||
AudioTrack::WriteXMLAttributes(xmlFile);
|
||||
}
|
||||
|
||||
// Return true iff the attribute is recognized.
|
||||
bool PlayableTrack::HandleXMLAttribute(const wxChar *attr, const wxChar *value)
|
||||
{
|
||||
const wxString strValue{ value };
|
||||
long nValue;
|
||||
if (!wxStrcmp(attr, wxT("mute")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) {
|
||||
mMute = (nValue != 0);
|
||||
return true;
|
||||
}
|
||||
else if (!wxStrcmp(attr, wxT("solo")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) {
|
||||
mSolo = (nValue != 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
return AudioTrack::HandleXMLAttribute(attr, value);
|
||||
}
|
||||
|
||||
// TrackListIterator
|
||||
TrackListIterator::TrackListIterator(TrackList * val)
|
||||
: l(val)
|
||||
|
13
src/Track.h
13
src/Track.h
@ -251,6 +251,13 @@ public:
|
||||
AudioTrack(const std::shared_ptr<DirManager> &projDirManager)
|
||||
: Track{ projDirManager } {}
|
||||
AudioTrack(const Track &orig) : Track{ orig } {}
|
||||
|
||||
// Serialize, not with tags of its own, but as attributes within a tag.
|
||||
void WriteXMLAttributes(XMLWriter &xmlFile) const {}
|
||||
|
||||
// Return true iff the attribute is recognized.
|
||||
bool HandleXMLAttribute(const wxChar * /*attr*/, const wxChar * /*value*/)
|
||||
{ return false; }
|
||||
};
|
||||
|
||||
class PlayableTrack /* not final */ : public AudioTrack
|
||||
@ -268,6 +275,12 @@ public:
|
||||
void Init( const PlayableTrack &init );
|
||||
void Merge( const Track &init ) override;
|
||||
|
||||
// Serialize, not with tags of its own, but as attributes within a tag.
|
||||
void WriteXMLAttributes(XMLWriter &xmlFile) const;
|
||||
|
||||
// Return true iff the attribute is recognized.
|
||||
bool HandleXMLAttribute(const wxChar *attr, const wxChar *value);
|
||||
|
||||
protected:
|
||||
bool mMute { false };
|
||||
bool mSolo { false };
|
||||
|
@ -1685,12 +1685,8 @@ bool WaveTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
// track is created.
|
||||
mLegacyProjectFileOffset = dblValue;
|
||||
}
|
||||
else if (!wxStrcmp(attr, wxT("mute")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
mMute = (nValue != 0);
|
||||
else if (!wxStrcmp(attr, wxT("solo")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
mSolo = (nValue != 0);
|
||||
else if (this->PlayableTrack::HandleXMLAttribute(attr, value))
|
||||
{}
|
||||
else if (!wxStrcmp(attr, wxT("height")) &&
|
||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
mHeight = nValue;
|
||||
@ -1789,8 +1785,7 @@ void WaveTrack::WriteXML(XMLWriter &xmlFile) const
|
||||
xmlFile.WriteAttr(wxT("name"), mName);
|
||||
xmlFile.WriteAttr(wxT("channel"), mChannel);
|
||||
xmlFile.WriteAttr(wxT("linked"), mLinked);
|
||||
xmlFile.WriteAttr(wxT("mute"), mMute);
|
||||
xmlFile.WriteAttr(wxT("solo"), mSolo);
|
||||
this->PlayableTrack::WriteXMLAttributes(xmlFile);
|
||||
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||
int height;
|
||||
if(MONO_PAN)
|
||||
|
Loading…
x
Reference in New Issue
Block a user