From 0051f92a4cc12e942c4330be63b262a085dd814b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 31 Oct 2007 20:05:49 +0000 Subject: [PATCH] Truly atomic port mixdown function setting. git-svn-id: svn://localhost/ardour2/trunk@2581 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/audiosource.h | 11 ++--------- libs/ardour/base_audio_port.cc | 7 ++----- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index 3865019bc7..f02b28d9f5 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -52,13 +52,6 @@ const nframes_t frames_per_peak = 256; AudioSource (Session&, const XMLNode&); virtual ~AudioSource (); - /* one could argue that this should belong to Source, but other data types - generally do not come with a model of "offset along an audio timeline" - so its here in AudioSource for now. - */ - - virtual nframes_t natural_position() const { return 0; } - /* returns the number of items in this `audio_source' */ virtual nframes_t available_peaks (double zoom) const; @@ -116,8 +109,8 @@ const nframes_t frames_per_peak = 256; bool _peaks_built; mutable Glib::Mutex _lock; mutable Glib::Mutex _peaks_ready_lock; - Glib::ustring peakpath; - Glib::ustring _captured_for; + Glib::ustring peakpath; + Glib::ustring _captured_for; mutable uint32_t _read_data_count; // modified in read() mutable uint32_t _write_data_count; // modified in write() diff --git a/libs/ardour/base_audio_port.cc b/libs/ardour/base_audio_port.cc index 379e69c8e0..ceec4c1d3a 100644 --- a/libs/ardour/base_audio_port.cc +++ b/libs/ardour/base_audio_port.cc @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -75,11 +76,7 @@ BaseAudioPort::default_mixdown (const set& ports, AudioBuffer* dest, nfra void BaseAudioPort::set_mixdown_function (void (*func)(const set&, AudioBuffer*, nframes_t, nframes_t, bool)) { - /* caller should (but not must) hold process lock since this is an atomic operation on most platforms - and even if its not, it doesn't really matter. - */ - - _mixdown = func; + g_atomic_pointer_set(&_mixdown, func); } -- 2.30.2