mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-15 00:51:21 +01:00
Hide the use of new in factory functions for BlockFiles
This commit is contained in:
@@ -53,12 +53,10 @@ LegacyAliasBlockFile::~LegacyAliasBlockFile()
|
||||
/// @param newFileName The filename to copy the summary data to.
|
||||
BlockFilePtr LegacyAliasBlockFile::Copy(wxFileNameWrapper &&newFileName)
|
||||
{
|
||||
BlockFile *newBlockFile =
|
||||
new LegacyAliasBlockFile(std::move(newFileName),
|
||||
wxFileNameWrapper{mAliasedFileName}, mAliasStart,
|
||||
mLen, mAliasChannel,
|
||||
mSummaryInfo.totalSummaryBytes,
|
||||
mSummaryInfo.fields < 3);
|
||||
auto newBlockFile = make_blockfile<LegacyAliasBlockFile>
|
||||
(std::move(newFileName), wxFileNameWrapper{ mAliasedFileName },
|
||||
mAliasStart, mLen, mAliasChannel,
|
||||
mSummaryInfo.totalSummaryBytes, mSummaryInfo.fields < 3);
|
||||
|
||||
return newBlockFile;
|
||||
}
|
||||
@@ -133,9 +131,9 @@ BlockFilePtr LegacyAliasBlockFile::BuildFromXML(const wxString &projDir, const w
|
||||
}
|
||||
}
|
||||
|
||||
return new LegacyAliasBlockFile(std::move(summaryFileName), std::move(aliasFileName),
|
||||
aliasStart, aliasLen, aliasChannel,
|
||||
summaryLen, noRMS);
|
||||
return make_blockfile<LegacyAliasBlockFile>
|
||||
(std::move(summaryFileName), std::move(aliasFileName),
|
||||
aliasStart, aliasLen, aliasChannel, summaryLen, noRMS);
|
||||
}
|
||||
|
||||
// regenerates the summary info, doesn't deal with missing alias files
|
||||
|
||||
@@ -328,7 +328,8 @@ BlockFilePtr LegacyBlockFile::BuildFromXML(const wxString &projDir, const wxChar
|
||||
}
|
||||
}
|
||||
|
||||
return new LegacyBlockFile(std::move(fileName), format, summaryLen, len, noRMS);
|
||||
return make_blockfile<LegacyBlockFile>
|
||||
(std::move(fileName), format, summaryLen, len, noRMS);
|
||||
}
|
||||
|
||||
/// Create a copy of this BlockFile, but using a different disk file.
|
||||
@@ -336,11 +337,10 @@ BlockFilePtr LegacyBlockFile::BuildFromXML(const wxString &projDir, const wxChar
|
||||
/// @param newFileName The name of the NEW file to use.
|
||||
BlockFilePtr LegacyBlockFile::Copy(wxFileNameWrapper &&newFileName)
|
||||
{
|
||||
return new LegacyBlockFile(std::move(newFileName),
|
||||
mFormat,
|
||||
mSummaryInfo.totalSummaryBytes,
|
||||
mLen,
|
||||
mSummaryInfo.fields < 3);
|
||||
return make_blockfile<LegacyBlockFile>
|
||||
(std::move(newFileName),
|
||||
mFormat, mSummaryInfo.totalSummaryBytes,
|
||||
mLen, mSummaryInfo.fields < 3);
|
||||
}
|
||||
|
||||
wxLongLong LegacyBlockFile::GetSpaceUsage() const
|
||||
|
||||
@@ -172,10 +172,10 @@ BlockFilePtr ODDecodeBlockFile::Copy(wxFileNameWrapper &&newFileName)
|
||||
else
|
||||
{
|
||||
//Summary File might exist in this case, but it probably (99.999% of the time) won't.
|
||||
newBlockFile = new ODDecodeBlockFile(std::move(newFileName),
|
||||
wxFileNameWrapper{mAudioFileName}, mAliasStart,
|
||||
mLen, mAliasChannel, mType,
|
||||
mMin, mMax, mRMS,IsSummaryAvailable());
|
||||
newBlockFile = make_blockfile<ODDecodeBlockFile>
|
||||
(std::move(newFileName), wxFileNameWrapper{mAudioFileName},
|
||||
mAliasStart, mLen, mAliasChannel, mType,
|
||||
mMin, mMax, mRMS, IsSummaryAvailable());
|
||||
//The client code will need to schedule this blockfile for OD decoding if it is going to a NEW track.
|
||||
//It can do this by checking for IsDataAvailable()==false.
|
||||
}
|
||||
@@ -274,10 +274,9 @@ BlockFilePtr ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
|
||||
}
|
||||
}
|
||||
|
||||
return new ODDecodeBlockFile(std::move(summaryFileName), std::move(audioFileName),
|
||||
aliasStart, aliasLen, aliasChannel,decodeType,
|
||||
0,0,0, false);
|
||||
|
||||
return make_blockfile<ODDecodeBlockFile>
|
||||
(std::move(summaryFileName), std::move(audioFileName),
|
||||
aliasStart, aliasLen, aliasChannel, decodeType, 0, 0, 0, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -228,19 +228,18 @@ BlockFilePtr ODPCMAliasBlockFile::Copy(wxFileNameWrapper &&newFileName)
|
||||
//PCMAliasBlockFile is to lock on exit, and this will cause orphaned blockfiles..
|
||||
if(IsSummaryAvailable() && mHasBeenSaved)
|
||||
{
|
||||
newBlockFile = new PCMAliasBlockFile(std::move(newFileName),
|
||||
wxFileNameWrapper{mAliasedFileName}, mAliasStart,
|
||||
mLen, mAliasChannel,
|
||||
mMin, mMax, mRMS);
|
||||
newBlockFile = make_blockfile<PCMAliasBlockFile>
|
||||
(std::move(newFileName), wxFileNameWrapper{mAliasedFileName},
|
||||
mAliasStart, mLen, mAliasChannel, mMin, mMax, mRMS);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//Summary File might exist in this case, but it might not.
|
||||
newBlockFile = new ODPCMAliasBlockFile(std::move(newFileName),
|
||||
wxFileNameWrapper{mAliasedFileName}, mAliasStart,
|
||||
mLen, mAliasChannel,
|
||||
mMin, mMax, mRMS,IsSummaryAvailable());
|
||||
newBlockFile = make_blockfile<ODPCMAliasBlockFile>
|
||||
(std::move(newFileName), wxFileNameWrapper{mAliasedFileName},
|
||||
mAliasStart, mLen, mAliasChannel, mMin, mMax, mRMS,
|
||||
IsSummaryAvailable());
|
||||
//The client code will need to schedule this blockfile for OD summarizing if it is going to a NEW track.
|
||||
}
|
||||
|
||||
@@ -339,9 +338,9 @@ BlockFilePtr ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **at
|
||||
}
|
||||
}
|
||||
|
||||
return new ODPCMAliasBlockFile(std::move(summaryFileName), std::move(aliasFileName),
|
||||
aliasStart, aliasLen, aliasChannel,
|
||||
0,0,0, false);
|
||||
return make_blockfile<ODPCMAliasBlockFile>
|
||||
(std::move(summaryFileName), std::move(aliasFileName),
|
||||
aliasStart, aliasLen, aliasChannel, 0, 0, 0, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -152,10 +152,9 @@ int PCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format,
|
||||
/// @param newFileName The filename to copy the summary data to.
|
||||
BlockFilePtr PCMAliasBlockFile::Copy(wxFileNameWrapper &&newFileName)
|
||||
{
|
||||
BlockFile *newBlockFile = new PCMAliasBlockFile(std::move(newFileName),
|
||||
wxFileNameWrapper{mAliasedFileName}, mAliasStart,
|
||||
mLen, mAliasChannel,
|
||||
mMin, mMax, mRMS);
|
||||
auto newBlockFile = make_blockfile<PCMAliasBlockFile>
|
||||
(std::move(newFileName), wxFileNameWrapper{mAliasedFileName},
|
||||
mAliasStart, mLen, mAliasChannel, mMin, mMax, mRMS);
|
||||
|
||||
return newBlockFile;
|
||||
}
|
||||
@@ -249,9 +248,9 @@ BlockFilePtr PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
|
||||
}
|
||||
}
|
||||
|
||||
return new PCMAliasBlockFile(std::move(summaryFileName), std::move(aliasFileName),
|
||||
aliasStart, aliasLen, aliasChannel,
|
||||
min, max, rms);
|
||||
return make_blockfile<PCMAliasBlockFile>
|
||||
(std::move(summaryFileName), std::move(aliasFileName),
|
||||
aliasStart, aliasLen, aliasChannel, min, max, rms);
|
||||
}
|
||||
|
||||
void PCMAliasBlockFile::Recover(void)
|
||||
|
||||
@@ -71,13 +71,13 @@ BlockFilePtr SilentBlockFile::BuildFromXML(DirManager & WXUNUSED(dm), const wxCh
|
||||
len = nValue;
|
||||
}
|
||||
|
||||
return new SilentBlockFile(len);
|
||||
return make_blockfile<SilentBlockFile>(len);
|
||||
}
|
||||
|
||||
/// Create a copy of this BlockFile
|
||||
BlockFilePtr SilentBlockFile::Copy(wxFileNameWrapper &&)
|
||||
{
|
||||
BlockFile *newBlockFile = new SilentBlockFile(mLen);
|
||||
auto newBlockFile = make_blockfile<SilentBlockFile>(mLen);
|
||||
|
||||
return newBlockFile;
|
||||
}
|
||||
|
||||
@@ -532,7 +532,8 @@ BlockFilePtr SimpleBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs)
|
||||
}
|
||||
}
|
||||
|
||||
return new SimpleBlockFile(std::move(fileName), len, min, max, rms);
|
||||
return make_blockfile<SimpleBlockFile>
|
||||
(std::move(fileName), len, min, max, rms);
|
||||
}
|
||||
|
||||
/// Create a copy of this BlockFile, but using a different disk file.
|
||||
@@ -540,8 +541,8 @@ BlockFilePtr SimpleBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs)
|
||||
/// @param newFileName The name of the NEW file to use.
|
||||
BlockFilePtr SimpleBlockFile::Copy(wxFileNameWrapper &&newFileName)
|
||||
{
|
||||
BlockFile *newBlockFile = new SimpleBlockFile(std::move(newFileName), mLen,
|
||||
mMin, mMax, mRMS);
|
||||
auto newBlockFile = make_blockfile<SimpleBlockFile>
|
||||
(std::move(newFileName), mLen, mMin, mMax, mRMS);
|
||||
|
||||
return newBlockFile;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user