Unitary fixes (#598)
* Eliminate unneeded back-pointer to project from non-wave Tracks... ... now that DirManager is gone * Remove unused declarations * SampleData::mProject was not used * Correct ProjectFileIO::GetLibraryError * Remove unnecessary #include directives
This commit is contained in:
parent
e7fd679ae6
commit
1fcb77ebce
|
@ -15,8 +15,6 @@
|
|||
|
||||
#include "Audacity.h"
|
||||
|
||||
class AutoSaveFile;
|
||||
|
||||
class AUDACITY_DLL_API AudioIOListener /* not final */ {
|
||||
public:
|
||||
AudioIOListener() {}
|
||||
|
|
|
@ -219,22 +219,6 @@ void AutoSaveFile::WriteSubTree(const AutoSaveFile & value)
|
|||
mBuffer.AppendByte(FT_Pop);
|
||||
}
|
||||
|
||||
bool AutoSaveFile::Write(wxFFile & file) const
|
||||
{
|
||||
return Append(file);
|
||||
}
|
||||
|
||||
bool AutoSaveFile::Append(wxFFile & file) const
|
||||
{
|
||||
bool success = file.Write(mDict.GetData(), mDict.GetDataLen()) == mDict.GetDataLen();
|
||||
if (success)
|
||||
{
|
||||
success = file.Write(mBuffer.GetData(), mBuffer.GetDataLen()) == mBuffer.GetDataLen();
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void AutoSaveFile::WriteName(const wxString & name)
|
||||
{
|
||||
wxASSERT(name.length() * sizeof(wxChar) <= SHRT_MAX);
|
||||
|
|
|
@ -55,9 +55,6 @@ public:
|
|||
// Non-override functions
|
||||
void WriteSubTree(const AutoSaveFile & value);
|
||||
|
||||
bool Write(wxFFile & file) const;
|
||||
bool Append(wxFFile & file) const;
|
||||
|
||||
const wxMemoryBuffer &GetDict() const;
|
||||
const wxMemoryBuffer &GetData() const;
|
||||
|
||||
|
|
|
@ -68,11 +68,11 @@ static ProjectFileIORegistry::Entry registerFactory{
|
|||
|
||||
LabelTrack::Holder TrackFactory::NewLabelTrack()
|
||||
{
|
||||
return std::make_shared<LabelTrack>(&mProject);
|
||||
return std::make_shared<LabelTrack>();
|
||||
}
|
||||
|
||||
LabelTrack::LabelTrack(AudacityProject *project):
|
||||
Track(project),
|
||||
LabelTrack::LabelTrack():
|
||||
Track(),
|
||||
mClipLen(0.0),
|
||||
miLastLabel(-1)
|
||||
{
|
||||
|
@ -652,7 +652,7 @@ Track::Holder LabelTrack::SplitCut(double t0, double t1)
|
|||
|
||||
Track::Holder LabelTrack::Copy(double t0, double t1, bool) const
|
||||
{
|
||||
auto tmp = std::make_shared<LabelTrack>(GetProject());
|
||||
auto tmp = std::make_shared<LabelTrack>();
|
||||
const auto lt = static_cast<LabelTrack*>(tmp.get());
|
||||
|
||||
for (auto &labelStruct: mLabels) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class AUDACITY_DLL_API LabelTrack final
|
|||
, public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
LabelTrack(AudacityProject *project);
|
||||
LabelTrack();
|
||||
LabelTrack(const LabelTrack &orig);
|
||||
|
||||
virtual ~ LabelTrack();
|
||||
|
|
|
@ -123,11 +123,11 @@ static ProjectFileIORegistry::Entry registerFactory{
|
|||
|
||||
NoteTrack::Holder TrackFactory::NewNoteTrack()
|
||||
{
|
||||
return std::make_shared<NoteTrack>(&mProject);
|
||||
return std::make_shared<NoteTrack>();
|
||||
}
|
||||
|
||||
NoteTrack::NoteTrack(AudacityProject *project)
|
||||
: NoteTrackBase(project)
|
||||
NoteTrack::NoteTrack()
|
||||
: NoteTrackBase()
|
||||
{
|
||||
SetDefaultName(_("Note Track"));
|
||||
SetName(GetDefaultName());
|
||||
|
@ -172,7 +172,7 @@ Alg_seq &NoteTrack::GetSeq() const
|
|||
|
||||
Track::Holder NoteTrack::Clone() const
|
||||
{
|
||||
auto duplicate = std::make_shared<NoteTrack>(mProject);
|
||||
auto duplicate = std::make_shared<NoteTrack>();
|
||||
duplicate->Init(*this);
|
||||
// The duplicate begins life in serialized state. Often the duplicate is
|
||||
// pushed on the Undo stack. Then we want to un-serialize it (or a further
|
||||
|
@ -463,7 +463,7 @@ Track::Holder NoteTrack::Cut(double t0, double t1)
|
|||
//( std::min( t1, GetEndTime() ) ) - ( std::max( t0, GetStartTime() ) )
|
||||
//);
|
||||
|
||||
auto newTrack = std::make_shared<NoteTrack>(mProject);
|
||||
auto newTrack = std::make_shared<NoteTrack>();
|
||||
|
||||
newTrack->Init(*this);
|
||||
|
||||
|
@ -477,7 +477,7 @@ Track::Holder NoteTrack::Cut(double t0, double t1)
|
|||
//AddToDuration( delta );
|
||||
|
||||
// What should be done with the rest of newTrack's members?
|
||||
//(mBottomNote, mProject,
|
||||
//(mBottomNote,
|
||||
// mSerializationBuffer, mSerializationLength, mVisibleChannels)
|
||||
|
||||
return newTrack;
|
||||
|
@ -490,7 +490,7 @@ Track::Holder NoteTrack::Copy(double t0, double t1, bool) const
|
|||
|
||||
double len = t1-t0;
|
||||
|
||||
auto newTrack = std::make_shared<NoteTrack>(mProject);
|
||||
auto newTrack = std::make_shared<NoteTrack>();
|
||||
|
||||
newTrack->Init(*this);
|
||||
|
||||
|
@ -500,7 +500,7 @@ Track::Holder NoteTrack::Copy(double t0, double t1, bool) const
|
|||
newTrack->SetOffset(0);
|
||||
|
||||
// What should be done with the rest of newTrack's members?
|
||||
// (mBottomNote, mProject, mSerializationBuffer,
|
||||
// (mBottomNote, mSerializationBuffer,
|
||||
// mSerializationLength, mVisibleChannels)
|
||||
|
||||
return newTrack;
|
||||
|
|
|
@ -65,7 +65,7 @@ class AUDACITY_DLL_API NoteTrack final
|
|||
: public NoteTrackBase
|
||||
{
|
||||
public:
|
||||
NoteTrack(AudacityProject *project);
|
||||
NoteTrack();
|
||||
virtual ~NoteTrack();
|
||||
|
||||
using Holder = std::shared_ptr<NoteTrack>;
|
||||
|
|
|
@ -1245,7 +1245,7 @@ const TranslatableString & ProjectFileIO::GetLastError() const
|
|||
|
||||
const TranslatableString & ProjectFileIO::GetLibraryError() const
|
||||
{
|
||||
return mLastError;
|
||||
return mLibraryError;
|
||||
}
|
||||
|
||||
void ProjectFileIO::SetError(const TranslatableString & msg)
|
||||
|
|
|
@ -80,7 +80,6 @@ private:
|
|||
void UpdatePrefs() override;
|
||||
|
||||
using ExecCB = std::function<int(wxString *result, int cols, char **vals, char **names)>;
|
||||
using ExecFunc = int (*)(void *data, int cols, char **vals, char **names);
|
||||
struct ExecParm
|
||||
{
|
||||
ExecCB func;
|
||||
|
|
|
@ -144,8 +144,7 @@ SampleBlockPtr SampleBlock::Get(AudacityProject *project,
|
|||
}
|
||||
|
||||
SampleBlock::SampleBlock(AudacityProject *project)
|
||||
: mProject(project),
|
||||
mIO(ProjectFileIO::Get(*project))
|
||||
: mIO(ProjectFileIO::Get(*project))
|
||||
{
|
||||
mValid = false;
|
||||
mSilent = false;
|
||||
|
|
|
@ -103,7 +103,6 @@ private:
|
|||
void CalcSummary();
|
||||
|
||||
private:
|
||||
AudacityProject *mProject;
|
||||
ProjectFileIO & mIO;
|
||||
bool mValid;
|
||||
bool mDirty;
|
||||
|
@ -128,7 +127,6 @@ private:
|
|||
const char *columns =
|
||||
"sampleformat, summin, summax, sumrms, summary256, summary64k, samples";
|
||||
|
||||
friend class ProjectFileIO;
|
||||
#if defined(WORDS_BIGENDIAN)
|
||||
#error All sample block data is little endian...big endian not yet supported
|
||||
#endif
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include <wx/ffile.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
#include "ProjectFileIO.h"
|
||||
#include "SampleBlock.h"
|
||||
#include "InconsistencyException.h"
|
||||
#include "widgets/AudacityMessageBox.h"
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
std::shared_ptr<TimeTrack> TrackFactory::NewTimeTrack()
|
||||
{
|
||||
return std::make_shared<TimeTrack>(&mProject, mZoomInfo);
|
||||
return std::make_shared<TimeTrack>(mZoomInfo);
|
||||
}
|
||||
|
||||
static ProjectFileIORegistry::Entry registerFactory{
|
||||
|
@ -53,8 +53,8 @@ static ProjectFileIORegistry::Entry registerFactory{
|
|||
}
|
||||
};
|
||||
|
||||
TimeTrack::TimeTrack(AudacityProject *project, const ZoomInfo *zoomInfo):
|
||||
Track(project)
|
||||
TimeTrack::TimeTrack(const ZoomInfo *zoomInfo):
|
||||
Track()
|
||||
, mZoomInfo(zoomInfo)
|
||||
{
|
||||
mEnvelope = std::make_unique<BoundedEnvelope>(true, TIMETRACK_MIN, TIMETRACK_MAX, 1.0);
|
||||
|
|
|
@ -25,7 +25,7 @@ class TimeTrack final : public Track {
|
|||
|
||||
public:
|
||||
|
||||
TimeTrack(AudacityProject *project, const ZoomInfo *zoomInfo);
|
||||
TimeTrack(const ZoomInfo *zoomInfo);
|
||||
/** @brief Copy-Constructor - create a NEW TimeTrack:: which is an independent copy of the original
|
||||
*
|
||||
* Calls TimeTrack::Init() to copy the track metadata, then does a bunch of manipulations on the
|
||||
|
|
|
@ -46,9 +46,8 @@ and TimeTrack.
|
|||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
Track::Track(AudacityProject *project)
|
||||
: vrulerSize(36,0),
|
||||
mProject(project)
|
||||
Track::Track()
|
||||
: vrulerSize(36,0)
|
||||
{
|
||||
mSelected = false;
|
||||
mLinked = false;
|
||||
|
@ -76,8 +75,6 @@ void Track::Init(const Track &orig)
|
|||
mDefaultName = orig.mDefaultName;
|
||||
mName = orig.mName;
|
||||
|
||||
mProject = orig.mProject;
|
||||
|
||||
mSelected = orig.mSelected;
|
||||
mLinked = orig.mLinked;
|
||||
mChannel = orig.mChannel;
|
||||
|
|
18
src/Track.h
18
src/Track.h
|
@ -309,11 +309,9 @@ private:
|
|||
ChannelType mChannel;
|
||||
double mOffset;
|
||||
|
||||
mutable AudacityProject *mProject;
|
||||
|
||||
public:
|
||||
|
||||
Track(AudacityProject *project);
|
||||
Track();
|
||||
Track(const Track &orig);
|
||||
|
||||
virtual ~ Track();
|
||||
|
@ -352,12 +350,6 @@ public:
|
|||
virtual void SetPan( float ){ ;}
|
||||
virtual void SetPanFromChannelType(){ ;};
|
||||
|
||||
// AS: Note that the project is mutable. This is
|
||||
// mostly to support "Duplicate" of const objects,
|
||||
// but in general, mucking with the dir manager is
|
||||
// separate from the Track.
|
||||
AudacityProject *GetProject() const { return mProject; }
|
||||
|
||||
// Create a NEW track and modify this track
|
||||
// Return non-NULL or else throw
|
||||
// May assume precondition: t0 <= t1
|
||||
|
@ -716,8 +708,8 @@ protected:
|
|||
class AUDACITY_DLL_API AudioTrack /* not final */ : public Track
|
||||
{
|
||||
public:
|
||||
AudioTrack(AudacityProject *project)
|
||||
: Track{ project } {}
|
||||
AudioTrack()
|
||||
: Track{} {}
|
||||
AudioTrack(const Track &orig) : Track{ orig } {}
|
||||
|
||||
// Serialize, not with tags of its own, but as attributes within a tag.
|
||||
|
@ -731,8 +723,8 @@ public:
|
|||
class AUDACITY_DLL_API PlayableTrack /* not final */ : public AudioTrack
|
||||
{
|
||||
public:
|
||||
PlayableTrack(AudacityProject *project)
|
||||
: AudioTrack{ project } {}
|
||||
PlayableTrack()
|
||||
: AudioTrack{} {}
|
||||
PlayableTrack(const Track &orig) : AudioTrack{ orig } {}
|
||||
|
||||
bool GetMute () const { return mMute; }
|
||||
|
|
|
@ -47,7 +47,6 @@ Track classes.
|
|||
#include "Sequence.h"
|
||||
#include "Spectrum.h"
|
||||
|
||||
#include "Project.h"
|
||||
#include "ProjectFileIORegistry.h"
|
||||
#include "ProjectSettings.h"
|
||||
|
||||
|
@ -94,8 +93,10 @@ WaveTrack::Holder TrackFactory::NewWaveTrack(sampleFormat format, double rate)
|
|||
return std::make_shared<WaveTrack> ( &mProject, format, rate );
|
||||
}
|
||||
|
||||
WaveTrack::WaveTrack(AudacityProject *project, sampleFormat format, double rate) :
|
||||
PlayableTrack(project)
|
||||
WaveTrack::WaveTrack( AudacityProject *project,
|
||||
sampleFormat format, double rate )
|
||||
: PlayableTrack()
|
||||
, mProject(project)
|
||||
{
|
||||
mLegacyProjectFileOffset = 0;
|
||||
|
||||
|
@ -142,6 +143,8 @@ WaveTrack::WaveTrack(const WaveTrack &orig):
|
|||
void WaveTrack::Init(const WaveTrack &orig)
|
||||
{
|
||||
PlayableTrack::Init(orig);
|
||||
mProject = orig.mProject;
|
||||
|
||||
mFormat = orig.mFormat;
|
||||
mWaveColorIndex = orig.mWaveColorIndex;
|
||||
mRate = orig.mRate;
|
||||
|
|
|
@ -577,6 +577,10 @@ private:
|
|||
// Private variables
|
||||
//
|
||||
|
||||
// AS: Note that the mProject is mutable. This is
|
||||
// mostly to support "Duplicate" of const objects
|
||||
mutable AudacityProject *mProject;
|
||||
|
||||
wxCriticalSection mFlushCriticalSection;
|
||||
wxCriticalSection mAppendCriticalSection;
|
||||
double mLegacyProjectFileOffset;
|
||||
|
|
Loading…
Reference in New Issue