1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-24 16:01:16 +02:00

make_movable -> std::make_unique

This commit is contained in:
Paul Licameli 2018-04-16 13:31:17 -04:00
parent 7a0475e39f
commit b8a8712ba0
35 changed files with 97 additions and 97 deletions

View File

@ -1437,7 +1437,7 @@ void MixerBoard::LoadMusicalInstruments()
auto bmp = std::make_unique<wxBitmap>(data.bitmap);
dc.SelectObject(*bmp);
AColor::Bevel(dc, false, bev);
mMusicalInstruments.push_back(make_movable<MusicalInstrument>(
mMusicalInstruments.push_back(std::make_unique<MusicalInstrument>(
std::move(bmp), data.name
));
};

View File

@ -287,7 +287,7 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
ModulePrefs::SetModuleStatus( files[i], kModuleFailed );
#endif
auto umodule = make_movable<Module>(files[i]);
auto umodule = std::make_unique<Module>(files[i]);
if (umodule->Load()) // it will get rejected if there are version problems
{
auto module = umodule.get();
@ -421,7 +421,7 @@ void ModuleManager::InitializeBuiltins()
ModuleInterface *ModuleManager::LoadModule(const wxString & path)
{
auto lib = make_movable<wxDynamicLibrary>();
auto lib = std::make_unique<wxDynamicLibrary>();
if (lib->Load(path, wxDL_NOW))
{

View File

@ -96,7 +96,7 @@ TaskProfile* Profiler::GetOrCreateTaskProfile(const char* fileName, int lineNum)
return mTasks[i].get();
}
auto tp = make_movable<TaskProfile>();
auto tp = std::make_unique<TaskProfile>();
mTasks.push_back(std::move(tp));
return mTasks.back().get();
}

View File

@ -3425,13 +3425,13 @@ void AudacityProject::EnqueueODTasks()
movable_ptr<ODTask> newTask;
#ifdef EXPERIMENTAL_OD_FLAC
if(!(createdODTasks&ODTask::eODFLAC) && (odFlags & ODTask::eODFLAC)) {
newTask = make_movable<ODDecodeFlacTask>();
newTask = std::make_unique<ODDecodeFlacTask>();
createdODTasks = createdODTasks | ODTask::eODFLAC;
}
else
#endif
if(!(createdODTasks&ODTask::eODPCMSummary) && (odFlags & ODTask::eODPCMSummary)) {
newTask = make_movable<ODComputeSummaryTask>();
newTask = std::make_unique<ODComputeSummaryTask>();
createdODTasks= createdODTasks | ODTask::eODPCMSummary;
}
else {
@ -4047,7 +4047,7 @@ bool AudacityProject::DoSave
while (t) {
if (t->GetKind() == Track::Wave)
lockers.push_back(
make_movable<WaveTrack::Locker>(
std::make_unique<WaveTrack::Locker>(
static_cast<const WaveTrack*>(t)));
t = iter.Next();
}
@ -4686,7 +4686,7 @@ void AudacityProject::PopState(const UndoState &state)
{
if(!odUsed)
{
computeTask = make_movable<ODComputeSummaryTask>();
computeTask = std::make_unique<ODComputeSummaryTask>();
odUsed=true;
}
// PRL: Is it correct to add all tracks to one task, even if they

View File

@ -288,7 +288,7 @@ void UndoManager::PushState(const TrackList * l,
// Assume tags was duplicted before any changes.
// Just save a NEW shared_ptr to it.
stack.push_back(
make_movable<UndoStackElem>
std::make_unique<UndoStackElem>
(std::move(tracksCopy),
longDescription, shortDescription, selectedRegion, tags)
);

View File

@ -333,7 +333,7 @@ WaveClip::WaveClip(const WaveClip& orig,
if ( copyCutlines )
for (const auto &clip: orig.mCutLines)
mCutLines.push_back
( make_movable<WaveClip>( *clip, projDirManager, true ) );
( std::make_unique<WaveClip>( *clip, projDirManager, true ) );
mIsPlaceholder = orig.GetIsPlaceholder();
}
@ -377,7 +377,7 @@ WaveClip::WaveClip(const WaveClip& orig,
if (cutlinePosition >= t0 && cutlinePosition <= t1)
{
auto newCutLine =
make_movable< WaveClip >( *clip, projDirManager, true );
std::make_unique< WaveClip >( *clip, projDirManager, true );
newCutLine->SetOffset( cutlinePosition - t0 );
mCutLines.push_back(std::move(newCutLine));
}
@ -1552,7 +1552,7 @@ XMLTagHandler *WaveClip::HandleXMLChild(const wxChar *tag)
{
// Nested wave clips are cut lines
mCutLines.push_back(
make_movable<WaveClip>(mSequence->GetDirManager(),
std::make_unique<WaveClip>(mSequence->GetDirManager(),
mSequence->GetSampleFormat(), mRate, 0 /*colourindex*/));
return mCutLines.back().get();
}
@ -1608,7 +1608,7 @@ void WaveClip::Paste(double t0, const WaveClip* other)
for (const auto &cutline: pastedClip->mCutLines)
{
newCutlines.push_back(
make_movable<WaveClip>
std::make_unique<WaveClip>
( *cutline, mSequence->GetDirManager(),
// Recursively copy cutlines of cutlines. They don't need
// their offsets adjusted.
@ -1745,7 +1745,7 @@ void WaveClip::ClearAndAddCutLine(double t0, double t1)
const double clip_t0 = std::max( t0, GetStartTime() );
const double clip_t1 = std::min( t1, GetEndTime() );
auto newClip = make_movable< WaveClip >
auto newClip = std::make_unique< WaveClip >
(*this, mSequence->GetDirManager(), true, clip_t0, clip_t1);
newClip->SetOffset( clip_t0 - mOffset );

View File

@ -141,7 +141,7 @@ WaveTrack::WaveTrack(const WaveTrack &orig):
for (const auto &clip : orig.mClips)
mClips.push_back
( make_movable<WaveClip>( *clip, mDirManager, true ) );
( std::make_unique<WaveClip>( *clip, mDirManager, true ) );
}
// Copy the track metadata but not the contents.
@ -625,7 +625,7 @@ Track::Holder WaveTrack::Copy(double t0, double t1, bool forClipboard) const
//wxPrintf("copy: clip %i is in copy region\n", (int)clip);
newTrack->mClips.push_back
(make_movable<WaveClip>(*clip, mDirManager, ! forClipboard));
(std::make_unique<WaveClip>(*clip, mDirManager, ! forClipboard));
WaveClip *const newClip = newTrack->mClips.back().get();
newClip->Offset(-t0);
}
@ -637,7 +637,7 @@ Track::Holder WaveTrack::Copy(double t0, double t1, bool forClipboard) const
const double clip_t0 = std::max(t0, clip->GetStartTime());
const double clip_t1 = std::min(t1, clip->GetEndTime());
auto newClip = make_movable<WaveClip>
auto newClip = std::make_unique<WaveClip>
(*clip, mDirManager, ! forClipboard, clip_t0, clip_t1);
//wxPrintf("copy: clip_t0=%f, clip_t1=%f\n", clip_t0, clip_t1);
@ -657,7 +657,7 @@ Track::Holder WaveTrack::Copy(double t0, double t1, bool forClipboard) const
if (forClipboard &&
newTrack->GetEndTime() + 1.0 / newTrack->GetRate() < t1 - t0)
{
auto placeholder = make_movable<WaveClip>(mDirManager,
auto placeholder = std::make_unique<WaveClip>(mDirManager,
newTrack->GetSampleFormat(),
static_cast<int>(newTrack->GetRate()),
0 /*colourindex*/);
@ -1049,7 +1049,7 @@ void WaveTrack::HandleClear(double t0, double t1,
// Don't modify this clip in place, because we want a strong
// guarantee, and might modify another clip
clipsToDelete.push_back( clip.get() );
auto newClip = make_movable<WaveClip>( *clip, mDirManager, true );
auto newClip = std::make_unique<WaveClip>( *clip, mDirManager, true );
newClip->ClearAndAddCutLine( t0, t1 );
clipsToAdd.push_back( std::move( newClip ) );
}
@ -1064,7 +1064,7 @@ void WaveTrack::HandleClear(double t0, double t1,
// Don't modify this clip in place, because we want a strong
// guarantee, and might modify another clip
clipsToDelete.push_back( clip.get() );
auto newClip = make_movable<WaveClip>( *clip, mDirManager, true );
auto newClip = std::make_unique<WaveClip>( *clip, mDirManager, true );
newClip->Clear(clip->GetStartTime(), t1);
newClip->Offset(t1-clip->GetStartTime());
@ -1076,7 +1076,7 @@ void WaveTrack::HandleClear(double t0, double t1,
// Don't modify this clip in place, because we want a strong
// guarantee, and might modify another clip
clipsToDelete.push_back( clip.get() );
auto newClip = make_movable<WaveClip>( *clip, mDirManager, true );
auto newClip = std::make_unique<WaveClip>( *clip, mDirManager, true );
newClip->Clear(t0, clip->GetEndTime());
clipsToAdd.push_back( std::move( newClip ) );
@ -1087,12 +1087,12 @@ void WaveTrack::HandleClear(double t0, double t1,
// left
clipsToAdd.push_back
( make_movable<WaveClip>( *clip, mDirManager, true ) );
( std::make_unique<WaveClip>( *clip, mDirManager, true ) );
clipsToAdd.back()->Clear(t0, clip->GetEndTime());
// right
clipsToAdd.push_back
( make_movable<WaveClip>( *clip, mDirManager, true ) );
( std::make_unique<WaveClip>( *clip, mDirManager, true ) );
WaveClip *const right = clipsToAdd.back().get();
right->Clear(clip->GetStartTime(), t1);
right->Offset(t1 - clip->GetStartTime());
@ -1106,7 +1106,7 @@ void WaveTrack::HandleClear(double t0, double t1,
// Don't modify this clip in place, because we want a strong
// guarantee, and might modify another clip
clipsToDelete.push_back( clip.get() );
auto newClip = make_movable<WaveClip>( *clip, mDirManager, true );
auto newClip = std::make_unique<WaveClip>( *clip, mDirManager, true );
// clip->Clear keeps points < t0 and >= t1 via Envelope::CollapseRegion
newClip->Clear(t0,t1);
@ -1339,7 +1339,7 @@ void WaveTrack::Paste(double t0, const Track *src)
if (!clip->GetIsPlaceholder())
{
auto newClip =
make_movable<WaveClip>( *clip, mDirManager, true );
std::make_unique<WaveClip>( *clip, mDirManager, true );
newClip->Resample(mRate);
newClip->Offset(t0);
newClip->MarkChanged();
@ -1395,7 +1395,7 @@ void WaveTrack::InsertSilence(double t, double len)
if (mClips.empty())
{
// Special case if there is no clip yet
auto clip = make_movable<WaveClip>(mDirManager, mFormat, mRate, this->GetWaveColorIndex());
auto clip = std::make_unique<WaveClip>(mDirManager, mFormat, mRate, this->GetWaveColorIndex());
clip->InsertSilence(0, len);
// use NOFAIL-GUARANTEE
mClips.push_back( std::move( clip ) );
@ -2228,7 +2228,7 @@ Sequence* WaveTrack::GetSequenceAtX(int xcoord)
WaveClip* WaveTrack::CreateClip()
{
mClips.push_back(make_movable<WaveClip>(mDirManager, mFormat, mRate, GetWaveColorIndex()));
mClips.push_back(std::make_unique<WaveClip>(mDirManager, mFormat, mRate, GetWaveColorIndex()));
return mClips.back().get();
}
@ -2388,7 +2388,7 @@ void WaveTrack::SplitAt(double t)
if (c->WithinClip(t))
{
t = LongSamplesToTime(TimeToLongSamples(t)); // put t on a sample
auto newClip = make_movable<WaveClip>( *c, mDirManager, true );
auto newClip = std::make_unique<WaveClip>( *c, mDirManager, true );
c->Clear(t, c->GetEndTime());
newClip->Clear(c->GetStartTime(), t);

View File

@ -24,11 +24,11 @@ IdentInterfaceSymbol BatchEvalCommandType::BuildName()
void BatchEvalCommandType::BuildSignature(CommandSignature &signature)
{
auto commandNameValidator = make_movable<DefaultValidator>();
auto commandNameValidator = std::make_unique<DefaultValidator>();
signature.AddParameter(wxT("CommandName"), wxT(""), std::move(commandNameValidator));
auto paramValidator = make_movable<DefaultValidator>();
auto paramValidator = std::make_unique<DefaultValidator>();
signature.AddParameter(wxT("ParamString"), wxT(""), std::move(paramValidator));
auto macroValidator = make_movable<DefaultValidator>();
auto macroValidator = std::make_unique<DefaultValidator>();
signature.AddParameter(wxT("MacroName"), wxT(""), std::move(macroValidator));
}

View File

@ -28,38 +28,38 @@ CommandDirectory::CommandDirectory()
{
// Create the command map.
// First we have commands which return information
//AddCommand(make_movable<MessageCommandType>());
AddCommand(make_movable<BatchEvalCommandType>());
//AddCommand(std::make_unique<MessageCommandType>());
AddCommand(std::make_unique<BatchEvalCommandType>());
// Legacy adapter commands that previously was needed to
// access menu items.
//AddCommand(make_movable<ExecMenuCommandType>());
//AddCommand(std::make_unique<ExecMenuCommandType>());
// Not needed. Sets selected/solo/mute on multiple tracks.
//AddCommand(make_movable<SetProjectInfoCommandType>());
//AddCommand(std::make_unique<SetProjectInfoCommandType>());
// Moved to AudacityCommand
// AddCommand(make_movable<OpenProjectCommandType>());
// AddCommand(make_movable<SaveProjectCommandType>());
// AddCommand(make_movable<ImportCommandType>());
// AddCommand(make_movable<ExportCommandType>());
// AddCommand(make_movable<HelpCommandType>());
// AddCommand(make_movable<GetInfoCommandType>("GetAll"));
// AddCommand(make_movable<GetInfoCommandType>("GetCommands"));
// AddCommand(make_movable<GetInfoCommandType>("GetMenus"));
// AddCommand(make_movable<GetInfoCommandType>("GetMenusPlus"));
// AddCommand(make_movable<GetInfoCommandType>("GetBoxes"));
// AddCommand(make_movable<GetInfoCommandType>("GetClips"));
// AddCommand(std::make_unique<OpenProjectCommandType>());
// AddCommand(std::make_unique<SaveProjectCommandType>());
// AddCommand(std::make_unique<ImportCommandType>());
// AddCommand(std::make_unique<ExportCommandType>());
// AddCommand(std::make_unique<HelpCommandType>());
// AddCommand(std::make_unique<GetInfoCommandType>("GetAll"));
// AddCommand(std::make_unique<GetInfoCommandType>("GetCommands"));
// AddCommand(std::make_unique<GetInfoCommandType>("GetMenus"));
// AddCommand(std::make_unique<GetInfoCommandType>("GetMenusPlus"));
// AddCommand(std::make_unique<GetInfoCommandType>("GetBoxes"));
// AddCommand(std::make_unique<GetInfoCommandType>("GetClips"));
// AddCommand(make_movable<GetTrackInfoCommandType>());
// AddCommand(make_movable<GetProjectInfoCommandType>());
// AddCommand(make_movable<CompareAudioCommandType>());
// AddCommand(make_movable<GetPreferenceCommandType>());
// AddCommand(make_movable<SetPreferenceCommandType>());
// AddCommand(make_movable<ScreenshotCommandType>());
// AddCommand(make_movable<SelectCommandType>());
// AddCommand(make_movable<SetTrackInfoCommandType>());
// AddCommand(std::make_unique<GetTrackInfoCommandType>());
// AddCommand(std::make_unique<GetProjectInfoCommandType>());
// AddCommand(std::make_unique<CompareAudioCommandType>());
// AddCommand(std::make_unique<GetPreferenceCommandType>());
// AddCommand(std::make_unique<SetPreferenceCommandType>());
// AddCommand(std::make_unique<ScreenshotCommandType>());
// AddCommand(std::make_unique<SelectCommandType>());
// AddCommand(std::make_unique<SetTrackInfoCommandType>());
}

View File

@ -631,7 +631,7 @@ void CommandManager::EndMenu()
wxMenu* CommandManager::BeginSubMenu(const wxString & tName)
{
mSubMenuList.push_back
(make_movable< SubMenuListEntry > ( tName, std::make_unique<wxMenu>() ));
(std::make_unique< SubMenuListEntry > ( tName, std::make_unique<wxMenu>() ));
mbSeparatorAllowed = false;
return mSubMenuList.back()->menu.get();
}
@ -1014,7 +1014,7 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & nameIn,
{
// Make a unique_ptr or shared_ptr as appropriate:
auto entry = make_movable<CommandListEntry>();
auto entry = std::make_unique<CommandListEntry>();
wxString labelPrefix;
if (!mSubMenuList.empty()) {

View File

@ -36,7 +36,7 @@ threshold of difference in two selected tracks
#include "CommandContext.h"
extern void RegisterCompareAudio( Registrar & R){
R.AddCommand( make_movable<CompareAudioCommand>() );
R.AddCommand( std::make_unique<CompareAudioCommand>() );
// std::unique_ptr<CommandOutputTargets> &&target
// return std::make_shared<CompareAudioCommand>(*this, std::move(target));

View File

@ -801,7 +801,7 @@ EffectNoiseReduction::Worker::Worker
mQueue.resize(mHistoryLen);
for (unsigned ii = 0; ii < mHistoryLen; ++ii)
mQueue[ii] = make_movable<Record>(mSpectrumSize);
mQueue[ii] = std::make_unique<Record>(mSpectrumSize);
// Create windows

View File

@ -1455,7 +1455,7 @@ bool VSTEffect::RealtimeInitialize()
bool VSTEffect::RealtimeAddProcessor(unsigned numChannels, float sampleRate)
{
mSlaves.push_back(make_movable<VSTEffect>(mPath, this));
mSlaves.push_back(std::make_unique<VSTEffect>(mPath, this));
VSTEffect *const slave = mSlaves.back().get();
slave->SetBlockSize(mBlockSize);

View File

@ -1346,7 +1346,7 @@ bool AudioUnitEffect::RealtimeInitialize()
bool AudioUnitEffect::RealtimeAddProcessor(unsigned numChannels, float sampleRate)
{
auto slave = make_movable<AudioUnitEffect>(mPath, mName, mComponent, this);
auto slave = std::make_unique<AudioUnitEffect>(mPath, mName, mComponent, this);
if (!slave->SetHost(NULL))
return false;

View File

@ -547,6 +547,6 @@ wxWindow *ExportCL::OptionsCreate(wxWindow *parent, int format)
movable_ptr<ExportPlugin> New_ExportCL()
{
return make_movable<ExportCL>();
return std::make_unique<ExportCL>();
}

View File

@ -1097,7 +1097,7 @@ wxWindow *ExportFFmpeg::OptionsCreate(wxWindow *parent, int format)
movable_ptr<ExportPlugin> New_ExportFFmpeg()
{
return make_movable<ExportFFmpeg>();
return std::make_unique<ExportFFmpeg>();
}
#endif

View File

@ -452,7 +452,7 @@ bool ExportFLAC::GetMetadata(AudacityProject *project, const Tags *tags)
movable_ptr<ExportPlugin> New_ExportFLAC()
{
return make_movable<ExportFLAC>();
return std::make_unique<ExportFLAC>();
}
#endif // USE_LIBFLAC

View File

@ -466,7 +466,7 @@ void ExportMP2::AddFrame(struct id3_tag *tp, const wxString & n, const wxString
movable_ptr<ExportPlugin> New_ExportMP2()
{
return make_movable<ExportMP2>();
return std::make_unique<ExportMP2>();
}
#endif // #ifdef USE_LIBTWOLAME

View File

@ -2160,7 +2160,7 @@ void ExportMP3::AddFrame(struct id3_tag *tp, const wxString & n, const wxString
movable_ptr<ExportPlugin> New_ExportMP3()
{
return make_movable<ExportMP3>();
return std::make_unique<ExportMP3>();
}
//----------------------------------------------------------------------------

View File

@ -402,7 +402,7 @@ bool ExportOGG::FillComment(AudacityProject *project, vorbis_comment *comment, c
movable_ptr<ExportPlugin> New_ExportOGG()
{
return make_movable<ExportOGG>();
return std::make_unique<ExportOGG>();
}
#endif // USE_LIBVORBIS

View File

@ -911,5 +911,5 @@ bool ExportPCM::CheckFileName(wxFileName &filename, int format)
movable_ptr<ExportPlugin> New_ExportPCM()
{
return make_movable<ExportPCM>();
return std::make_unique<ExportPCM>();
}

View File

@ -162,7 +162,7 @@ void Importer::ReadImportItems()
if (toker.CountTokens() != 2)
break;
auto new_item = make_movable<ExtImportItem>();
auto new_item = std::make_unique<ExtImportItem>();
/* First token is the filtering condition, second - the filter list */
condition = toker.GetNextToken();
@ -309,7 +309,7 @@ void Importer::WriteImportItems()
movable_ptr<ExtImportItem> Importer::CreateDefaultImportItem()
{
auto new_item = make_movable<ExtImportItem>();
auto new_item = std::make_unique<ExtImportItem>();
new_item->extensions.Add(wxT("*"));
new_item->mime_types.Add(wxT("*"));

View File

@ -285,7 +285,7 @@ private:
void GetFFmpegImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList &WXUNUSED(unusableImportPluginList))
{
importPluginList.push_back( make_movable<FFmpegImportPlugin>() );
importPluginList.push_back( std::make_unique<FFmpegImportPlugin>() );
}
@ -590,7 +590,7 @@ ProgressResult FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
for (const auto &stream : mChannels) {
++s;
auto odTask =
make_movable<ODDecodeFFmpegTask>(mScs, ODDecodeFFmpegTask::FromList(mChannels), mContext, s);
std::make_unique<ODDecodeFFmpegTask>(mScs, ODDecodeFFmpegTask::FromList(mChannels), mContext, s);
odTask->CreateFileDecoder(mFilename);
//each stream has different duration. We need to know it if seeking is to be allowed.

View File

@ -62,7 +62,7 @@ void GetFLACImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList &unusableImportPluginList)
{
unusableImportPluginList.push_back(
make_movable<UnusableImportPlugin>
std::make_unique<UnusableImportPlugin>
(DESC, wxArrayString(WXSIZEOF(exts), exts))
);
}
@ -293,7 +293,7 @@ FLAC__StreamDecoderWriteStatus MyFLACFile::write_callback(const FLAC__Frame *fra
void GetFLACImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList &WXUNUSED(unusableImportPluginList))
{
importPluginList.push_back( make_movable<FLACImportPlugin>() );
importPluginList.push_back( std::make_unique<FLACImportPlugin>() );
}
@ -358,7 +358,7 @@ FLACImportFileHandle::FLACImportFileHandle(const wxString & name)
bool FLACImportFileHandle::Init()
{
#ifdef EXPERIMENTAL_OD_FLAC
mDecoderTask = make_movable<ODDecodeFlacTask>();
mDecoderTask = std::make_unique<ODDecodeFlacTask>();
ODFlacDecoder* odDecoder = (ODFlacDecoder*)mDecoderTask->CreateFileDecoder(mFilename);
if(!odDecoder || !odDecoder->ReadHeader())
@ -522,7 +522,7 @@ ProgressResult FLACImportFileHandle::Import(TrackFactory *trackFactory,
{
//if we have 3 more channels, they get imported on seperate tracks, so we add individual tasks for each.
ODManager::Instance()->AddNewTask(std::move(mDecoderTask));
mDecoderTask = make_movable<ODDecodeFlacTask>(); //TODO: see if we need to use clone to keep the metadata.
mDecoderTask = std::make_unique<ODDecodeFlacTask>(); //TODO: see if we need to use clone to keep the metadata.
}
}
//if we have mono or a linked track (stereo), we add ONE task for the one linked wave track

View File

@ -299,7 +299,7 @@ GetGStreamerImportPlugin(ImportPluginList &importPluginList,
nano);
// Instantiate plugin
auto plug = make_movable<GStreamerImportPlugin>();
auto plug = std::make_unique<GStreamerImportPlugin>();
// No supported extensions...no gstreamer plugins installed
if (plug->GetSupportedExtensions().GetCount() == 0)
@ -569,7 +569,7 @@ GStreamerImportFileHandle::OnPadAdded(GstPad *pad)
{
// Allocate a NEW stream context
auto uc = make_movable<GStreamContext>();
auto uc = std::make_unique<GStreamContext>();
c = uc.get();
if (!c)
{

View File

@ -171,7 +171,7 @@ LOFImportFileHandle::LOFImportFileHandle
void GetLOFImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
{
importPluginList.push_back( make_movable<LOFImportPlugin>() );
importPluginList.push_back( std::make_unique<LOFImportPlugin>() );
}
wxString LOFImportPlugin::GetPluginFormatDescription()

View File

@ -62,7 +62,7 @@ void GetMP3ImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList &unusableImportPluginList)
{
unusableImportPluginList.push_back(
make_movable<UnusableImportPlugin>
std::make_unique<UnusableImportPlugin>
(DESC, wxArrayString(WXSIZEOF(exts), exts))
);
}
@ -159,7 +159,7 @@ private:
void GetMP3ImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
{
importPluginList.push_back( make_movable<MP3ImportPlugin>() );
importPluginList.push_back( std::make_unique<MP3ImportPlugin>() );
}
/* The MAD callbacks */

View File

@ -60,7 +60,7 @@ void GetOGGImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList &unusableImportPluginList)
{
unusableImportPluginList.push_back(
make_movable<UnusableImportPlugin>
std::make_unique<UnusableImportPlugin>
(DESC, wxArrayString(WXSIZEOF(exts), exts))
);
}
@ -163,7 +163,7 @@ private:
void GetOGGImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
{
importPluginList.push_back( make_movable<OggImportPlugin>() );
importPluginList.push_back( std::make_unique<OggImportPlugin>() );
}
wxString OggImportPlugin::GetPluginFormatDescription()

View File

@ -117,7 +117,7 @@ private:
void GetPCMImportPlugin(ImportPluginList & importPluginList,
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
{
importPluginList.push_back( make_movable<PCMImportPlugin>() );
importPluginList.push_back( std::make_unique<PCMImportPlugin>() );
}
wxString PCMImportPlugin::GetPluginFormatDescription()
@ -436,7 +436,7 @@ ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory,
if(useOD)
{
auto computeTask = make_movable<ODComputeSummaryTask>();
auto computeTask = std::make_unique<ODComputeSummaryTask>();
bool moreThanStereo = mInfo.channels>2;
for (const auto &channel : channels)
{
@ -445,7 +445,7 @@ ProgressResult PCMImportFileHandle::Import(TrackFactory *trackFactory,
{
//if we have 3 more channels, they get imported on seperate tracks, so we add individual tasks for each.
ODManager::Instance()->AddNewTask(std::move(computeTask));
computeTask = make_movable<ODComputeSummaryTask>();
computeTask = std::make_unique<ODComputeSummaryTask>();
}
}
//if we have a linked track, we add ONE task.

View File

@ -41,7 +41,7 @@ void GetQTImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList &unusableImportPluginList)
{
unusableImportPluginList.push_back(
make_movable<UnusableImportPlugin>
std::make_unique<UnusableImportPlugin>
(DESC, wxArrayString(WXSIZEOF(exts), exts))
);
}
@ -173,7 +173,7 @@ class QTImportFileHandle final : public ImportFileHandle
void GetQTImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList &unusableImportPluginList)
{
importPluginList.push_back( make_movable<QTImportPlugin>() );
importPluginList.push_back( std::make_unique<QTImportPlugin>() );
}
wxString QTImportPlugin::GetPluginFormatDescription()

View File

@ -37,7 +37,7 @@ ODComputeSummaryTask::ODComputeSummaryTask()
movable_ptr<ODTask> ODComputeSummaryTask::Clone() const
{
auto clone = make_movable<ODComputeSummaryTask>();
auto clone = std::make_unique<ODComputeSummaryTask>();
clone->mDemandSample = GetDemandSample();
// This std::move is needed to "upcast" the pointer type
return std::move(clone);

View File

@ -142,7 +142,7 @@ ODDecodeFFmpegTask::~ODDecodeFFmpegTask()
movable_ptr<ODTask> ODDecodeFFmpegTask::Clone() const
{
auto clone = make_movable<ODDecodeFFmpegTask>(mScs, Streams{ mChannels }, mContext, mStreamIndex);
auto clone = std::make_unique<ODDecodeFFmpegTask>(mScs, Streams{ mChannels }, mContext, mStreamIndex);
clone->mDemandSample=GetDemandSample();
//the decoders and blockfiles should not be copied. They are created as the task runs.
@ -157,7 +157,7 @@ ODFileDecoder* ODDecodeFFmpegTask::CreateFileDecoder(const wxString & fileName)
{
// Open the file for import
auto decoder =
make_movable<ODFFmpegDecoder>(fileName, mScs, ODDecodeFFmpegTask::Streams{ mChannels },
std::make_unique<ODFFmpegDecoder>(fileName, mScs, ODDecodeFFmpegTask::Streams{ mChannels },
mContext, mStreamIndex);
mDecoders.push_back(std::move(decoder));
@ -394,7 +394,7 @@ int ODFFmpegDecoder::Decode(SampleBuffer & data, sampleFormat & format, sampleCo
// Is there a proof size_t will not overflow size_t?
// Result is surely nonnegative.
auto amt = (actualDecodeStart - start).as_size_t();
auto cache = make_movable<FFMpegDecodeCache>();
auto cache = std::make_unique<FFMpegDecodeCache>();
//wxPrintf("skipping/zeroing %i samples. - now:%llu (%f), last:%llu, lastlen:%lu, start %llu, len %lu\n",amt,actualDecodeStart, actualDecodeStartdouble, mCurrentPos, mCurrentLen, start, len);
@ -607,7 +607,7 @@ int ODFFmpegDecoder::DecodeFrame(streamContext *sc, bool flushing)
//TODO- consider growing/unioning a few cache buffers like WaveCache does.
//however we can't use wavecache as it isn't going to handle our stereo interleaved part, and isn't for samples
//However if other ODDecode tasks need this, we should do a NEW class for caching.
auto cache = make_movable<FFMpegDecodeCache>();
auto cache = std::make_unique<FFMpegDecodeCache>();
//len is number of samples per channel
// wxASSERT(sc->m_stream->codec->channels > 0);
cache->numChannels = std::max<unsigned>(0, sc->m_stream->codec->channels);

View File

@ -35,7 +35,7 @@ ODDecodeFlacTask::~ODDecodeFlacTask()
movable_ptr<ODTask> ODDecodeFlacTask::Clone() const
{
auto clone = make_movable<ODDecodeFlacTask>();
auto clone = std::make_unique<ODDecodeFlacTask>();
clone->mDemandSample = GetDemandSample();
//the decoders and blockfiles should not be copied. They are created as the task runs.
@ -304,7 +304,7 @@ ODFileDecoder* ODDecodeFlacTask::CreateFileDecoder(const wxString & fileName)
}
// Open the file for import
auto decoder = std::make_movable<ODFlacDecoder>(fileName);
auto decoder = std::std::make_unique<ODFlacDecoder>(fileName);
*/
/*
bool success = decoder->Init();
@ -313,7 +313,7 @@ ODFileDecoder* ODDecodeFlacTask::CreateFileDecoder(const wxString & fileName)
}
*/
// Open the file for import
auto decoder = make_movable<ODFlacDecoder>(fileName);
auto decoder = std::make_unique<ODFlacDecoder>(fileName);
mDecoders.push_back(std::move(decoder));
return mDecoders.back().get();

View File

@ -168,7 +168,7 @@ void ODManager::AddNewTask(movable_ptr<ODTask> &&mtask, bool lockMutex)
{
//Make a NEW one, add it to the local track queue, and to the immediate running task list,
//since this task is definitely at the head
auto newqueue = make_movable<ODWaveTrackTaskQueue>();
auto newqueue = std::make_unique<ODWaveTrackTaskQueue>();
newqueue->AddTask(std::move(mtask));
mQueues.push_back(std::move(newqueue));
if(lockMutex)

View File

@ -312,7 +312,7 @@ protected:
void ExpandingToolBar::RecursivelyPushEventHandlers(wxWindow *win)
{
if (!mWindowHash[win]) {
mHandlers.push_back(make_movable<ExpandingToolBarEvtHandler>
mHandlers.push_back(std::make_unique<ExpandingToolBarEvtHandler>
(this, win, win->GetEventHandler()));
mWindowHash[win] = 1;
}