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;
|
double dblValue;
|
||||||
if (!wxStrcmp(attr, wxT("name")) && XMLValueChecker::IsGoodString(strValue))
|
if (!wxStrcmp(attr, wxT("name")) && XMLValueChecker::IsGoodString(strValue))
|
||||||
mName = strValue;
|
mName = strValue;
|
||||||
|
else if (this->NoteTrackBase::HandleXMLAttribute(attr, value))
|
||||||
|
{}
|
||||||
else if (!wxStrcmp(attr, wxT("offset")) &&
|
else if (!wxStrcmp(attr, wxT("offset")) &&
|
||||||
XMLValueChecker::IsGoodString(strValue) &&
|
XMLValueChecker::IsGoodString(strValue) &&
|
||||||
Internat::CompatibleToDouble(strValue, &dblValue))
|
Internat::CompatibleToDouble(strValue, &dblValue))
|
||||||
@ -831,10 +833,7 @@ void NoteTrack::WriteXML(XMLWriter &xmlFile) const
|
|||||||
saveme->mSeq->write(data, true);
|
saveme->mSeq->write(data, true);
|
||||||
xmlFile.StartTag(wxT("notetrack"));
|
xmlFile.StartTag(wxT("notetrack"));
|
||||||
xmlFile.WriteAttr(wxT("name"), saveme->mName);
|
xmlFile.WriteAttr(wxT("name"), saveme->mName);
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
this->NoteTrackBase::WriteXMLAttributes(xmlFile);
|
||||||
xmlFile.WriteAttr(wxT("mute"), mMute);
|
|
||||||
xmlFile.WriteAttr(wxT("solo"), mSolo);
|
|
||||||
#endif
|
|
||||||
xmlFile.WriteAttr(wxT("offset"), saveme->GetOffset());
|
xmlFile.WriteAttr(wxT("offset"), saveme->GetOffset());
|
||||||
xmlFile.WriteAttr(wxT("visiblechannels"), saveme->mVisibleChannels);
|
xmlFile.WriteAttr(wxT("visiblechannels"), saveme->mVisibleChannels);
|
||||||
xmlFile.WriteAttr(wxT("height"), saveme->GetActualHeight());
|
xmlFile.WriteAttr(wxT("height"), saveme->GetActualHeight());
|
||||||
|
@ -341,6 +341,33 @@ void PlayableTrack::Merge( const Track &orig )
|
|||||||
AudioTrack::Merge( *pOrig );
|
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::TrackListIterator(TrackList * val)
|
TrackListIterator::TrackListIterator(TrackList * val)
|
||||||
: l(val)
|
: l(val)
|
||||||
|
13
src/Track.h
13
src/Track.h
@ -251,6 +251,13 @@ public:
|
|||||||
AudioTrack(const std::shared_ptr<DirManager> &projDirManager)
|
AudioTrack(const std::shared_ptr<DirManager> &projDirManager)
|
||||||
: Track{ projDirManager } {}
|
: Track{ projDirManager } {}
|
||||||
AudioTrack(const Track &orig) : Track{ orig } {}
|
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
|
class PlayableTrack /* not final */ : public AudioTrack
|
||||||
@ -268,6 +275,12 @@ public:
|
|||||||
void Init( const PlayableTrack &init );
|
void Init( const PlayableTrack &init );
|
||||||
void Merge( const Track &init ) override;
|
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:
|
protected:
|
||||||
bool mMute { false };
|
bool mMute { false };
|
||||||
bool mSolo { false };
|
bool mSolo { false };
|
||||||
|
@ -1685,12 +1685,8 @@ bool WaveTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||||||
// track is created.
|
// track is created.
|
||||||
mLegacyProjectFileOffset = dblValue;
|
mLegacyProjectFileOffset = dblValue;
|
||||||
}
|
}
|
||||||
else if (!wxStrcmp(attr, wxT("mute")) &&
|
else if (this->PlayableTrack::HandleXMLAttribute(attr, value))
|
||||||
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 (!wxStrcmp(attr, wxT("height")) &&
|
else if (!wxStrcmp(attr, wxT("height")) &&
|
||||||
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||||
mHeight = nValue;
|
mHeight = nValue;
|
||||||
@ -1789,8 +1785,7 @@ void WaveTrack::WriteXML(XMLWriter &xmlFile) const
|
|||||||
xmlFile.WriteAttr(wxT("name"), mName);
|
xmlFile.WriteAttr(wxT("name"), mName);
|
||||||
xmlFile.WriteAttr(wxT("channel"), mChannel);
|
xmlFile.WriteAttr(wxT("channel"), mChannel);
|
||||||
xmlFile.WriteAttr(wxT("linked"), mLinked);
|
xmlFile.WriteAttr(wxT("linked"), mLinked);
|
||||||
xmlFile.WriteAttr(wxT("mute"), mMute);
|
this->PlayableTrack::WriteXMLAttributes(xmlFile);
|
||||||
xmlFile.WriteAttr(wxT("solo"), mSolo);
|
|
||||||
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||||
int height;
|
int height;
|
||||||
if(MONO_PAN)
|
if(MONO_PAN)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user