From 66bfac5a0ae1068908639dd0190433f5ab430473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Gl=C3=B6ckner?= Date: Fri, 27 May 2016 09:25:32 +0200 Subject: Instrument holds AudioFile via unique_ptr --- src/instrumentparser.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/instrumentparser.cc') diff --git a/src/instrumentparser.cc b/src/instrumentparser.cc index 1e42cc3..b42accd 100644 --- a/src/instrumentparser.cc +++ b/src/instrumentparser.cc @@ -31,6 +31,7 @@ #include +#include "cpp11fix.h" #include "path.h" #include "nolocale.h" @@ -141,18 +142,17 @@ void InstrumentParser::startTag(const std::string& name, const attr_t& attr) filechannel = filechannel - 1; // 1-based in file but zero-based internally. - AudioFile *audio_file = - new AudioFile(path + "/" + attr.at("file"), filechannel); + auto audio_file = std::make_unique(path + "/" + attr.at("file"), filechannel); // TODO: This is not deleted anywhere... InstrumentChannel *instrument_channel = new InstrumentChannel(attr.at("channel")); channellist.push_back(instrument_channel); - sample->addAudioFile(instrument_channel, audio_file); + sample->addAudioFile(instrument_channel, audio_file.get()); // Transfer audio_file ownership to the instrument. - instrument.audiofiles.push_back(audio_file); + instrument.audiofiles.push_back(std::move(audio_file)); } if(name == "velocities") -- cgit v1.2.3