Replace boost::scoped_array<T>
This commit is contained in:
parent
2c503eab09
commit
30dc9ccc86
@ -30,7 +30,6 @@
|
||||
|
||||
#include <glibmm/threads.h>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#include "ardour/source.h"
|
||||
#include "ardour/ardour.h"
|
||||
@ -156,7 +155,7 @@ class LIBARDOUR_API AudioSource : virtual public Source, public ARDOUR::AudioRea
|
||||
mutable double _last_scale;
|
||||
mutable off_t _last_map_off;
|
||||
mutable size_t _last_raw_map_length;
|
||||
mutable boost::scoped_array<PeakData> peak_cache;
|
||||
mutable std::unique_ptr<PeakData[]> peak_cache;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -26,8 +26,6 @@
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#include "pbd/ringbuffer.h"
|
||||
#include "pbd/signals.h"
|
||||
|
||||
@ -103,7 +101,7 @@ public:
|
||||
private:
|
||||
PortSet ports;
|
||||
samplecnt_t _buffer_size;
|
||||
boost::scoped_array<Sample> _buffer;
|
||||
std::unique_ptr<Sample[]> _buffer;
|
||||
mutable AudioBuffer _buf;
|
||||
std::list<std::shared_ptr<PBD::RingBuffer<Sample>>> _delaylines;
|
||||
};
|
||||
@ -182,8 +180,8 @@ private:
|
||||
samplepos_t region_start;
|
||||
samplepos_t position;
|
||||
|
||||
boost::scoped_array<Sample> mixdown_buffer;
|
||||
boost::scoped_array<Sample> gain_buffer;
|
||||
std::unique_ptr<Sample[]> mixdown_buffer;
|
||||
std::unique_ptr<Sample[]> gain_buffer;
|
||||
|
||||
PBD::ScopedConnection export_connection;
|
||||
};
|
||||
|
@ -138,8 +138,8 @@ AudioPlaylistSource::read_unlocked (Sample* dst, samplepos_t start, samplecnt_t
|
||||
to_zero = 0;
|
||||
}
|
||||
|
||||
boost::scoped_array<float> sbuf(new float[to_read]);
|
||||
boost::scoped_array<gain_t> gbuf(new gain_t[to_read]);
|
||||
std::unique_ptr<float[]> sbuf(new float[to_read]);
|
||||
std::unique_ptr<gain_t[]> gbuf(new gain_t[to_read]);
|
||||
|
||||
std::dynamic_pointer_cast<AudioPlaylist>(_playlist)->read (dst, sbuf.get(), gbuf.get(), timepos_t (start)+_playlist_offset, timecnt_t (to_read), _playlist_channel);
|
||||
|
||||
|
@ -23,8 +23,6 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#include "pbd/enumwriter.h"
|
||||
#include "pbd/error.h"
|
||||
|
||||
@ -209,8 +207,8 @@ AudioTrack::export_stuff (BufferSet& buffers, samplepos_t start, samplecnt_t nfr
|
||||
std::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze,
|
||||
MidiNoteTracker& /* ignored, this is audio */)
|
||||
{
|
||||
boost::scoped_array<gain_t> gain_buffer (new gain_t[nframes]);
|
||||
boost::scoped_array<Sample> mix_buffer (new Sample[nframes]);
|
||||
std::unique_ptr<gain_t[]> gain_buffer (new gain_t[nframes]);
|
||||
std::unique_ptr<Sample[]> mix_buffer (new Sample[nframes]);
|
||||
|
||||
Glib::Threads::RWLock::ReaderLock rlock (_processor_lock);
|
||||
|
||||
|
@ -29,8 +29,6 @@
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#include <glibmm/fileutils.h>
|
||||
#include <glibmm/threads.h>
|
||||
|
||||
@ -731,8 +729,8 @@ AudioRegion::read_at (Sample* buf,
|
||||
_cache_tail = 0;
|
||||
}
|
||||
|
||||
boost::scoped_array<gain_t> gain_array;
|
||||
boost::scoped_array<Sample> mixdown_array;
|
||||
std::unique_ptr<gain_t[]> gain_array;
|
||||
std::unique_ptr<Sample[]> mixdown_array;
|
||||
|
||||
bool nofx = false; // apply region fades at the end
|
||||
|
||||
@ -2258,9 +2256,9 @@ AudioRegion::get_transients (AnalysisFeatureList& results)
|
||||
AudioIntervalResult
|
||||
AudioRegion::find_silence (Sample threshold, samplecnt_t min_length, samplecnt_t fade_length, InterThreadInfo& itt) const
|
||||
{
|
||||
samplecnt_t const block_size = 64 * 1024;
|
||||
boost::scoped_array<Sample> loudest (new Sample[block_size]);
|
||||
boost::scoped_array<Sample> buf (new Sample[block_size]);
|
||||
constexpr samplecnt_t block_size = 64 * 1024;
|
||||
std::unique_ptr<Sample[]> loudest (new Sample[block_size]);
|
||||
std::unique_ptr<Sample[]> buf (new Sample[block_size]);
|
||||
|
||||
assert (fade_length >= 0);
|
||||
assert (min_length > 0);
|
||||
|
@ -359,7 +359,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos
|
||||
samplecnt_t peak = 0;
|
||||
|
||||
#if 1 // direct read
|
||||
boost::scoped_array<Sample> buf(new Sample[scm]);
|
||||
std::unique_ptr<Sample[]> buf(new Sample[scm]);
|
||||
while (peak < npeaks && cnt > 0) {
|
||||
samplecnt_t samples_read = read_unlocked (buf.get(), start, scm);
|
||||
if (samples_read == 0) {
|
||||
@ -478,7 +478,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos
|
||||
both max and min peak values.
|
||||
*/
|
||||
|
||||
boost::scoped_array<Sample> raw_staging(new Sample[cnt]);
|
||||
std::unique_ptr<Sample[]> raw_staging(new Sample[cnt]);
|
||||
|
||||
if (read_unlocked (raw_staging.get(), start, cnt) != cnt) {
|
||||
error << _("cannot read sample data for unscaled peak computation") << endmsg;
|
||||
@ -606,7 +606,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos
|
||||
samplecnt_t start_offset = next_visual_peak_sample - start;
|
||||
|
||||
peak_cache.reset (new PeakData[npeaks]);
|
||||
boost::scoped_array<PeakData> staging (new PeakData[chunksize]);
|
||||
std::unique_ptr<PeakData[]> staging (new PeakData[chunksize]);
|
||||
|
||||
char* addr;
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
@ -669,7 +669,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos
|
||||
|
||||
/* add data between start and sample corresponding to map_off */
|
||||
if (start_offset > 0) {
|
||||
boost::scoped_array<Sample> buf(new Sample[start_offset]);
|
||||
std::unique_ptr<Sample[]> buf (new Sample[start_offset]);
|
||||
samplecnt_t samples_read = read_unlocked (buf.get(), start, start_offset);
|
||||
find_peaks (buf.get(), samples_read, &peak_cache[0].min, &peak_cache[0].max);
|
||||
}
|
||||
@ -678,7 +678,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos
|
||||
samplecnt_t last_sample_from_peakfile = current_stored_peak * samples_per_file_peak;
|
||||
if (last_sample_from_peakfile < start + cnt && nvisual_peaks > 0) {
|
||||
samplecnt_t to_read = start + cnt - last_sample_from_peakfile;
|
||||
boost::scoped_array<Sample> buf(new Sample[to_read]);
|
||||
std::unique_ptr<Sample[]> buf (new Sample[to_read]);
|
||||
samplecnt_t samples_read = read_unlocked (buf.get(), last_sample_from_peakfile, to_read);
|
||||
find_peaks (buf.get(), samples_read, &peak_cache[nvisual_peaks - 1].min, &peak_cache[nvisual_peaks - 1].max);
|
||||
}
|
||||
@ -715,7 +715,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos
|
||||
samplecnt_t i = 0;
|
||||
samplecnt_t nvisual_peaks = 0;
|
||||
samplecnt_t chunksize = (samplecnt_t) min (cnt, (samplecnt_t) 4096);
|
||||
boost::scoped_array<Sample> raw_staging(new Sample[chunksize]);
|
||||
std::unique_ptr<Sample[]> raw_staging(new Sample[chunksize]);
|
||||
|
||||
double pixel_pos = start / samples_per_visual_peak;
|
||||
double next_pixel_pos = 1.0 + floor (pixel_pos);
|
||||
@ -787,7 +787,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos
|
||||
int
|
||||
AudioSource::build_peaks_from_scratch ()
|
||||
{
|
||||
const samplecnt_t bufsize = 65536; // 256kB per disk read for mono data is about ideal
|
||||
constexpr samplecnt_t bufsize = 65536; // 256kB per disk read for mono data is about ideal
|
||||
|
||||
DEBUG_TRACE (DEBUG::Peaks, "Building peaks from scratch\n");
|
||||
|
||||
@ -806,14 +806,14 @@ AudioSource::build_peaks_from_scratch ()
|
||||
samplecnt_t cnt = _length.samples();
|
||||
|
||||
_peaks_built = false;
|
||||
boost::scoped_array<Sample> buf(new Sample[bufsize]);
|
||||
std::array<Sample, bufsize> buf;
|
||||
|
||||
while (cnt) {
|
||||
|
||||
samplecnt_t samples_to_read = min (bufsize, cnt);
|
||||
samplecnt_t samples_read;
|
||||
|
||||
if ((samples_read = read_unlocked (buf.get(), current_sample, samples_to_read)) != samples_to_read) {
|
||||
if ((samples_read = read_unlocked (buf.data(), current_sample, samples_to_read)) != samples_to_read) {
|
||||
error << string_compose(_("%1: could not write read raw data for peak computation (%2)"), _name, strerror (errno)) << endmsg;
|
||||
done_with_peakfile_writes (false);
|
||||
goto out;
|
||||
@ -828,7 +828,7 @@ AudioSource::build_peaks_from_scratch ()
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (compute_and_write_peaks (buf.get(), current_sample, samples_read, true, false, _FPP)) {
|
||||
if (compute_and_write_peaks (buf.data(), current_sample, samples_read, true, false, _FPP)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -934,7 +934,6 @@ AudioSource::compute_and_write_peaks (Sample const * buf, samplecnt_t first_samp
|
||||
samplecnt_t samples_done;
|
||||
const size_t blocksize = (128 * 1024);
|
||||
off_t first_peak_byte;
|
||||
boost::scoped_array<Sample> buf2;
|
||||
|
||||
if (-1 == _peakfile_fd) {
|
||||
if (prepare_for_peakfile_writes ()) {
|
||||
@ -994,7 +993,7 @@ AudioSource::compute_and_write_peaks (Sample const * buf, samplecnt_t first_samp
|
||||
/* make a new contiguous buffer containing leftovers and the new stuff */
|
||||
|
||||
to_do = cnt + peak_leftover_cnt;
|
||||
buf2.reset(new Sample[to_do]);
|
||||
std::unique_ptr<Sample[]> buf2(new Sample[to_do]);
|
||||
|
||||
/* the remnants */
|
||||
memcpy (buf2.get(), peak_leftovers, peak_leftover_cnt * sizeof (Sample));
|
||||
@ -1018,7 +1017,7 @@ AudioSource::compute_and_write_peaks (Sample const * buf, samplecnt_t first_samp
|
||||
to_do = cnt;
|
||||
}
|
||||
|
||||
boost::scoped_array<PeakData> peakbuf(new PeakData[(to_do/fpp)+1]);
|
||||
std::unique_ptr<PeakData[]> peakbuf(new PeakData[(to_do/fpp)+1]);
|
||||
peaks_computed = 0;
|
||||
current_sample = first_sample;
|
||||
samples_done = 0;
|
||||
|
@ -17,8 +17,6 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <boost/smart_ptr/scoped_array.hpp>
|
||||
|
||||
#include "pbd/enumwriter.h"
|
||||
#include "pbd/memento_command.h"
|
||||
#include "pbd/playback_buffer.h"
|
||||
@ -723,9 +721,9 @@ DiskReader::overwrite_existing_audio ()
|
||||
chunk2_cnt = to_overwrite - chunk1_cnt;
|
||||
}
|
||||
|
||||
boost::scoped_array<Sample> sum_buffer (new Sample[to_overwrite]);
|
||||
boost::scoped_array<Sample> mixdown_buffer (new Sample[to_overwrite]);
|
||||
boost::scoped_array<float> gain_buffer (new float[to_overwrite]);
|
||||
std::unique_ptr<Sample[]> sum_buffer (new Sample[to_overwrite]);
|
||||
std::unique_ptr<Sample[]> mixdown_buffer (new Sample[to_overwrite]);
|
||||
std::unique_ptr<float[]> gain_buffer (new float[to_overwrite]);
|
||||
uint32_t n = 0;
|
||||
bool ret = true;
|
||||
samplepos_t start = overwrite_sample;
|
||||
@ -1136,11 +1134,14 @@ DiskReader::do_refill_with_alloc (bool partial_fill, bool reversed)
|
||||
* samples would be 1M samples. But we might use 16 or 14 bit samples,
|
||||
* in which case 4MB is more samples than that. Therefore size this for
|
||||
* the smallest sample value .. 4MB = 2M samples (16 bit).
|
||||
*
|
||||
* Note, we cannot use std::array<> here since stack-size is limited.
|
||||
*/
|
||||
|
||||
boost::scoped_array<Sample> sum_buf (new Sample[2 * 1048576]);
|
||||
boost::scoped_array<Sample> mix_buf (new Sample[2 * 1048576]);
|
||||
boost::scoped_array<float> gain_buf (new float[2 * 1048576]);
|
||||
constexpr size_t chunksize = 2 * 1048576;
|
||||
std::unique_ptr<Sample[]> sum_buf (new Sample[chunksize]);
|
||||
std::unique_ptr<Sample[]> mix_buf (new Sample[chunksize]);
|
||||
std::unique_ptr<float[]> gain_buf (new float[chunksize]);
|
||||
|
||||
return refill_audio (sum_buf.get (), mix_buf.get (), gain_buf.get (), (partial_fill ? _chunk_samples : 0), reversed);
|
||||
}
|
||||
@ -1993,8 +1994,8 @@ DiskReader::setup_preloop_buffer ()
|
||||
}
|
||||
|
||||
Location* loc = _loop_location;
|
||||
boost::scoped_array<Sample> mix_buf (new Sample[loop_fade_length]);
|
||||
boost::scoped_array<Sample> gain_buf (new Sample[loop_fade_length]);
|
||||
std::unique_ptr<Sample[]> mix_buf (new Sample[loop_fade_length]);
|
||||
std::unique_ptr<Sample[]> gain_buf (new Sample[loop_fade_length]);
|
||||
const timepos_t read_start = timepos_t (loc->start_sample () - loop_declick_out.fade_length);
|
||||
const timecnt_t read_cnt = timecnt_t (loop_declick_out.fade_length);
|
||||
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "pbd/gstdio_compat.h"
|
||||
#include <glibmm.h>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/shared_array.hpp>
|
||||
|
||||
@ -267,7 +266,7 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
|
||||
return;
|
||||
}
|
||||
|
||||
boost::scoped_array<float> data(new float[nframes * channels]);
|
||||
std::unique_ptr<float[]> data(new float[nframes * channels]);
|
||||
vector<boost::shared_array<Sample> > channel_data;
|
||||
|
||||
for (uint32_t n = 0; n < channels; ++n) {
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <pbd/ringbuffer.h>
|
||||
@ -97,7 +96,7 @@ private: // data
|
||||
|
||||
// can't use unique_ptr yet
|
||||
boost::scoped_ptr<PBD::RingBuffer<uint8_t> > m_midi_buffer;
|
||||
boost::scoped_array<uint8_t> m_sysex_buffer;
|
||||
std::unique_ptr<uint8_t[]> m_sysex_buffer;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -20,8 +20,6 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#include <cairomm/cairomm.h>
|
||||
|
||||
#include <glibmm/threads.h>
|
||||
@ -475,7 +473,7 @@ WaveView::draw_image (Cairo::RefPtr<Cairo::ImageSurface>& image, PeakData* peaks
|
||||
clip_context->set_antialias (Cairo::ANTIALIAS_NONE);
|
||||
zero_context->set_antialias (Cairo::ANTIALIAS_NONE);
|
||||
|
||||
boost::scoped_array<LineTips> tips (new LineTips[n_peaks]);
|
||||
std::unique_ptr<LineTips[]> tips (new LineTips[n_peaks]);
|
||||
|
||||
/* Clip level nominally set to -0.9dBFS to account for inter-sample
|
||||
interpolation possibly clipping (value may be too low).
|
||||
@ -898,7 +896,7 @@ WaveView::process_draw_request (std::shared_ptr<WaveViewDrawRequest> req)
|
||||
|
||||
assert (n_peaks > 0 && n_peaks < 32767);
|
||||
|
||||
boost::scoped_array<ARDOUR::PeakData> peaks (new PeakData[n_peaks]);
|
||||
std::unique_ptr<ARDOUR::PeakData[]> peaks (new PeakData[n_peaks]);
|
||||
|
||||
/* Note that Region::read_peaks() takes a start position based on an
|
||||
offset into the Region's **SOURCE**, rather than an offset into
|
||||
|
Loading…
Reference in New Issue
Block a user