#include <algorithm>
#include <boost/scoped_array.hpp>
-#include <boost/scoped_ptr.hpp>
#include <gtkmm.h>
}
Points* points = get_canvas_points ("xfade edit redraw", npoints);
- boost::scoped_ptr<float> vec (new float[npoints]);
+ boost::scoped_array<float> vec (new float[npoints]);
ar->fade_out()->curve().get_vector (0, ar->fade_out()->back()->when, vec.get(), npoints);
#define __ardour_audio_source_h__
#include <boost/shared_ptr.hpp>
+#include <boost/shared_array.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <time.h>
thread, or a lock around calls that use them.
*/
- static std::vector<boost::shared_ptr<Sample> > _mixdown_buffers;
- static std::vector<boost::shared_ptr<gain_t> > _gain_buffers;
+ static std::vector<boost::shared_array<Sample> > _mixdown_buffers;
+ static std::vector<boost::shared_array<gain_t> > _gain_buffers;
static Glib::Threads::Mutex _level_buffer_lock;
static void ensure_buffers_for_level (uint32_t, framecnt_t);
AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, framepos_t start,
framecnt_t cnt, unsigned chan_n)
{
- DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("Playlist %1 read @ %2 for %3, channel %4, regions %5\n",
- name(), start, cnt, chan_n, regions.size()));
+ DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("Playlist %1 read @ %2 for %3, channel %4, regions %5 mixdown @ %6 gain @ %7\n",
+ name(), start, cnt, chan_n, regions.size(), mixdown_buffer, gain_buffer));
/* optimizing this memset() away involves a lot of conditionals
that may well cause more of a hit due to cache misses
framecnt_t
AudioPlaylistSource::read_unlocked (Sample* dst, framepos_t start, framecnt_t cnt) const
{
- boost::shared_ptr<Sample> sbuf;
- boost::shared_ptr<gain_t> gbuf;
+ boost::shared_array<Sample> sbuf;
+ boost::shared_array<gain_t> gbuf;
framecnt_t to_read;
framecnt_t to_zero;
using namespace PBD;
Glib::Threads::Mutex AudioSource::_level_buffer_lock;
-vector<boost::shared_ptr<Sample> > AudioSource::_mixdown_buffers;
-vector<boost::shared_ptr<gain_t> > AudioSource::_gain_buffers;
+vector<boost::shared_array<Sample> > AudioSource::_mixdown_buffers;
+vector<boost::shared_array<gain_t> > AudioSource::_gain_buffers;
size_t AudioSource::_working_buffers_size = 0;
bool AudioSource::_build_missing_peakfiles = false;
{
framecnt_t nframes = (framecnt_t) floor (Config->get_audio_playback_buffer_seconds() * frame_rate);
+ /* this may be called because either "level" or "frame_rate" have
+ * changed. and it may be called with "level" smaller than the current
+ * number of buffers, because a new compound region has been created at
+ * a more shallow level than the deepest one we currently have.
+ */
+
+ uint32_t limit = max ((size_t) level, _mixdown_buffers.size());
+
_mixdown_buffers.clear ();
_gain_buffers.clear ();
- while (_mixdown_buffers.size() < level) {
- _mixdown_buffers.push_back (boost::shared_ptr<Sample> (new Sample[nframes]));
- _gain_buffers.push_back (boost::shared_ptr<gain_t> (new gain_t[nframes]));
+ for (uint32_t n = 0; n < limit; ++n) {
+ _mixdown_buffers.push_back (boost::shared_array<Sample> (new Sample[nframes]));
+ _gain_buffers.push_back (boost::shared_array<gain_t> (new gain_t[nframes]));
}
}