- sigc::signal<void> Running;
- sigc::signal<void> Stopped;
-
- std::string make_port_name_relative (std::string);
- std::string make_port_name_non_relative (std::string);
-
- private:
- ARDOUR::Session *session;
- jack_client_t *_jack;
- std::string jack_client_name;
- Glib::Mutex port_lock;
- Glib::Mutex _process_lock;
- Glib::Mutex session_remove_lock;
- Glib::Cond session_removed;
- bool session_remove_pending;
- bool _running;
- bool _has_run;
- jack_nframes_t _buffer_size;
- jack_nframes_t _frame_rate;
- jack_nframes_t monitor_check_interval;
- jack_nframes_t last_monitor_check;
- jack_nframes_t _processed_frames;
- bool _freewheeling;
- bool _freewheel_thread_registered;
- sigc::slot<int,jack_nframes_t> freewheel_action;
- bool reconnect_on_halt;
- int _usecs_per_cycle;
-
- typedef std::set<Port*> Ports;
- Ports ports;
-
- int process_callback (jack_nframes_t nframes);
+ PBD::Signal0<void> Running;
+ PBD::Signal0<void> Stopped;
+
+ /** Emitted if a JACK port is registered or unregistered */
+ PBD::Signal0<void> PortRegisteredOrUnregistered;
+
+ /** Emitted if a JACK port is connected or disconnected.
+ * The Port parameters are the ports being connected / disconnected, or 0 if they are not known to Ardour.
+ * The std::string parameters are the (long) port names.
+ * The bool parameter is true if ports were connected, or false for disconnected.
+ */
+ PBD::Signal5<void, boost::weak_ptr<Port>, std::string, boost::weak_ptr<Port>, std::string, bool> PortConnectedOrDisconnected;
+
+ std::string make_port_name_relative (std::string) const;
+ std::string make_port_name_non_relative (std::string) const;
+ bool port_is_mine (const std::string&) const;
+
+ static AudioEngine* instance() { return _instance; }
+ static void destroy();
+ void died ();
+
+ int create_process_thread (boost::function<void()>, pthread_t*, size_t stacksize);
+
+private:
+ static AudioEngine* _instance;
+
+ jack_client_t* volatile _jack; /* could be reset to null by SIGPIPE or another thread */
+ std::string jack_client_name;
+ Glib::Mutex _process_lock;
+ Glib::Cond session_removed;
+ bool session_remove_pending;
+ bool _running;
+ bool _has_run;
+ mutable framecnt_t _buffer_size;
+ std::map<DataType,size_t> _raw_buffer_sizes;
+ mutable framecnt_t _frame_rate;
+ /// number of frames between each check for changes in monitor input
+ framecnt_t monitor_check_interval;
+ /// time of the last monitor check in frames
+ framecnt_t last_monitor_check;
+ /// the number of frames processed since start() was called
+ framecnt_t _processed_frames;
+ bool _freewheeling;
+ int _usecs_per_cycle;
+ bool port_remove_in_progress;
+
+ SerializedRCUManager<Ports> ports;
+
+ boost::shared_ptr<Port> register_port (DataType type, const std::string& portname, bool input);
+
+ int process_callback (pframes_t nframes);
+ void* process_thread ();