diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index b1ca071e8a..4d45d6d837 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -21,7 +21,6 @@ #include #include -#include #include @@ -1538,7 +1537,7 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr ar, framecn } Points* points = get_canvas_points ("xfade edit redraw", npoints); - boost::scoped_ptr vec (new float[npoints]); + boost::scoped_array vec (new float[npoints]); ar->fade_out()->curve().get_vector (0, ar->fade_out()->back()->when, vec.get(), npoints); diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index cbdcd296af..344541d945 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -21,6 +21,7 @@ #define __ardour_audio_source_h__ #include +#include #include #include @@ -116,8 +117,8 @@ class AudioSource : virtual public Source, thread, or a lock around calls that use them. */ - static std::vector > _mixdown_buffers; - static std::vector > _gain_buffers; + static std::vector > _mixdown_buffers; + static std::vector > _gain_buffers; static Glib::Threads::Mutex _level_buffer_lock; static void ensure_buffers_for_level (uint32_t, framecnt_t); diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index b008e4ff98..6ef4ec6454 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -164,8 +164,8 @@ ARDOUR::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 diff --git a/libs/ardour/audio_playlist_source.cc b/libs/ardour/audio_playlist_source.cc index 915aee9595..f82cb7de00 100644 --- a/libs/ardour/audio_playlist_source.cc +++ b/libs/ardour/audio_playlist_source.cc @@ -127,8 +127,8 @@ AudioPlaylistSource::set_state (const XMLNode& node, int version, bool with_desc framecnt_t AudioPlaylistSource::read_unlocked (Sample* dst, framepos_t start, framecnt_t cnt) const { - boost::shared_ptr sbuf; - boost::shared_ptr gbuf; + boost::shared_array sbuf; + boost::shared_array gbuf; framecnt_t to_read; framecnt_t to_zero; diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index 4deb053cd8..5b60c577ee 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -47,8 +47,8 @@ using namespace ARDOUR; using namespace PBD; Glib::Threads::Mutex AudioSource::_level_buffer_lock; -vector > AudioSource::_mixdown_buffers; -vector > AudioSource::_gain_buffers; +vector > AudioSource::_mixdown_buffers; +vector > AudioSource::_gain_buffers; size_t AudioSource::_working_buffers_size = 0; bool AudioSource::_build_missing_peakfiles = false; @@ -984,11 +984,19 @@ AudioSource::ensure_buffers_for_level_locked (uint32_t level, framecnt_t frame_r { 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 (new Sample[nframes])); - _gain_buffers.push_back (boost::shared_ptr (new gain_t[nframes])); + for (uint32_t n = 0; n < limit; ++n) { + _mixdown_buffers.push_back (boost::shared_array (new Sample[nframes])); + _gain_buffers.push_back (boost::shared_array (new gain_t[nframes])); } }