Truly atomic port mixdown function setting.
authorDavid Robillard <d@drobilla.net>
Wed, 31 Oct 2007 20:05:49 +0000 (20:05 +0000)
committerDavid Robillard <d@drobilla.net>
Wed, 31 Oct 2007 20:05:49 +0000 (20:05 +0000)
git-svn-id: svn://localhost/ardour2/trunk@2581 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/audiosource.h
libs/ardour/base_audio_port.cc

index 3865019bc768961d35a769efe57a6b70357fed12..f02b28d9f594ff1f7a7e8460b5b5f874cdb4b60f 100644 (file)
@@ -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()
index 379e69c8e0b3e6e3f4940fde765d936a03c4a741..ceec4c1d3a1c0ad6d7e0b282b807b0c254702e43 100644 (file)
@@ -17,6 +17,7 @@
 */
 
 #include <cassert>
+#include <glib.h>
 #include <ardour/base_audio_port.h>
 #include <ardour/audioengine.h>
 #include <ardour/data_type.h>
@@ -75,11 +76,7 @@ BaseAudioPort::default_mixdown (const set<Port*>& ports, AudioBuffer* dest, nfra
 void 
 BaseAudioPort::set_mixdown_function (void (*func)(const set<Port*>&, 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);
 }