diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2013-08-14 20:30:09 +1000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2013-10-04 18:51:47 +1000 |
commit | df363a4fb3057253c1530941176cac49a7ffd409 (patch) | |
tree | 76a2423b920a8c476b5df1da44b964afcb4dc0c2 /libs/ardour/ardour | |
parent | 82f0f3a9a76097402afae8be1c9a65d526ad8cf2 (diff) |
Add AudioBackendThread class to support different thread type on windows
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/audio_backend.h | 8 | ||||
-rw-r--r-- | libs/ardour/ardour/audio_backend_thread.h | 32 | ||||
-rw-r--r-- | libs/ardour/ardour/audioengine.h | 9 | ||||
-rw-r--r-- | libs/ardour/ardour/graph.h | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 10 |
5 files changed, 48 insertions, 17 deletions
diff --git a/libs/ardour/ardour/audio_backend.h b/libs/ardour/ardour/audio_backend.h index 9052acd530..3d65af481d 100644 --- a/libs/ardour/ardour/audio_backend.h +++ b/libs/ardour/ardour/audio_backend.h @@ -399,13 +399,17 @@ class AudioBackend : public PortEngine { * stacksize. The thread will begin executing @param func, and will exit * when that function returns. */ - virtual int create_process_thread (boost::function<void()> func, AudioBackendNativeThread*, size_t stacksize) = 0; + virtual int create_process_thread (boost::function<void()> func, AudioBackendThread*, size_t stacksize) = 0; /** Wait for the thread specified by @param thread to exit. * * Return zero on success, non-zero on failure. */ - virtual int wait_for_process_thread_exit (AudioBackendNativeThread thread) = 0; + virtual int join_process_thread (AudioBackendThread* thread) = 0; + + /** Return true if execution context is in a backend thread + */ + virtual bool in_process_thread () = 0; virtual void update_latencies () = 0; diff --git a/libs/ardour/ardour/audio_backend_thread.h b/libs/ardour/ardour/audio_backend_thread.h new file mode 100644 index 0000000000..90efecbc94 --- /dev/null +++ b/libs/ardour/ardour/audio_backend_thread.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2013 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +namespace ARDOUR { + +class AudioBackendThread +{ +public: + + AudioBackendThread () { } + + virtual ~AudioBackendThread () { } + +}; + +} // namespace ARDOUR diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index 201d960479..82364ca191 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -58,6 +58,7 @@ class Session; class ProcessThread; class AudioBackend; class AudioBackendInfo; +class AudioBackendThread; class AudioEngine : public SessionHandlePtr, public PortManager { @@ -100,8 +101,12 @@ public: pframes_t sample_time_at_cycle_start (); pframes_t samples_since_cycle_start (); bool get_sync_offset (pframes_t& offset) const; - int create_process_thread (boost::function<void()> func, AudioBackendNativeThread*, size_t stacksize); - int wait_for_process_thread_exit (AudioBackendNativeThread); + + int create_process_thread (boost::function<void()> func, AudioBackendThread*, size_t stacksize); + int join_process_thread (AudioBackendThread*); + + bool in_process_thread (); + bool is_realtime() const; bool connected() const; diff --git a/libs/ardour/ardour/graph.h b/libs/ardour/ardour/graph.h index 08af6fb721..ed9e22de31 100644 --- a/libs/ardour/ardour/graph.h +++ b/libs/ardour/ardour/graph.h @@ -31,8 +31,6 @@ #include <glib.h> #include <cassert> -#include <pthread.h> - #include "pbd/semutils.h" #include "ardour/types.h" @@ -49,6 +47,8 @@ class Route; class Session; class GraphEdges; +class AudioBackendThread; + typedef boost::shared_ptr<GraphNode> node_ptr_t; typedef std::list< node_ptr_t > node_list_t; @@ -93,7 +93,7 @@ protected: virtual void session_going_away (); private: - std::list<AudioBackendNativeThread> _thread_list; + std::list<AudioBackendThread*> _thread_list; volatile bool _quit_threads; void reset_thread_list (); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 526a71c58b..ee43d1f30f 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -615,16 +615,6 @@ namespace ARDOUR { uint32_t max; //< samples }; -/* PLATFORM SPECIFIC #ifdef's here */ - - /** Define the native thread type used on the platform */ - typedef pthread_t AudioBackendNativeThread; - static inline bool self_thread_equal (AudioBackendNativeThread thr) { - return pthread_equal (thr, pthread_self()); - } - -/* PLATFORM SPECIFIC #endif's here */ - } // namespace ARDOUR |