#include <boost/shared_ptr.hpp>
#include "pbd/rcu.h"
+#include "pbd/ringbuffer.h"
#include "ardour/chan_count.h"
#include "ardour/midiport_manager.h"
class PortEngine;
class AudioBackend;
+class Session;
class LIBARDOUR_API PortManager
{
/* Port registration */
- boost::shared_ptr<Port> register_input_port (DataType, const std::string& portname, bool async = false);
- boost::shared_ptr<Port> register_output_port (DataType, const std::string& portname, bool async = false);
+ boost::shared_ptr<Port> register_input_port (DataType, const std::string& portname, bool async = false, PortFlags extra_flags = PortFlags (0));
+ boost::shared_ptr<Port> register_output_port (DataType, const std::string& portname, bool async = false, PortFlags extra_flags = PortFlags (0));
int unregister_port (boost::shared_ptr<Port>);
/* Port connectivity */
int connect (const std::string& source, const std::string& destination);
int disconnect (const std::string& source, const std::string& destination);
int disconnect (boost::shared_ptr<Port>);
+ int disconnect (std::string const &);
int reestablish_ports ();
int reconnect_ports ();
std::string make_port_name_non_relative (const std::string& name) const;
std::string get_pretty_name_by_name (const std::string& portname) const;
bool port_is_mine (const std::string& fullname) const;
- bool port_name_prefix_is_unique (const std::string& first_part_of_port_name) const;
+
+ static bool port_is_control_only (std::string const &);
/* other Port management */
bool port_is_physical (const std::string&) const;
- void get_physical_outputs (DataType type, std::vector<std::string>&);
- void get_physical_inputs (DataType type, std::vector<std::string>&);
+ void get_physical_outputs (DataType type, std::vector<std::string>&,
+ MidiPortFlags include = MidiPortFlags (0),
+ MidiPortFlags exclude = MidiPortFlags (0));
+ void get_physical_inputs (DataType type, std::vector<std::string>&,
+ MidiPortFlags include = MidiPortFlags (0),
+ MidiPortFlags exclude = MidiPortFlags (0));
ChanCount n_physical_outputs () const;
ChanCount n_physical_inputs () const;
int get_ports (DataType, PortList&);
void remove_all_ports ();
+ void clear_pending_port_deletions ();
+ virtual void add_pending_port_deletion (Port*) = 0;
+ PBD::RingBuffer<Port*>& port_deletions_pending () { return _port_deletions_pending; }
/* per-Port monitoring */
bool port_remove_in_progress() const { return _port_remove_in_progress; }
+ struct MidiPortInformation {
+ std::string pretty_name;
+ bool input;
+ MidiPortFlags properties;
+
+ MidiPortInformation () : input (false) , properties (MidiPortFlags (0)) {}
+ };
+
+ void fill_midi_port_info ();
+
+ MidiPortInformation midi_port_information (std::string const&);
+ void get_known_midi_ports (std::vector<std::string>&);
+ void get_midi_selection_ports (std::vector<std::string>&);
+ void add_midi_port_flags (std::string const&, MidiPortFlags);
+ void remove_midi_port_flags (std::string const&, MidiPortFlags);
+ void set_midi_port_pretty_name (std::string const&, std::string const&);
+
+ /** Emitted if the list of ports to be used for MIDI selection tracking changes */
+ PBD::Signal0<void> MidiSelectionPortsChanged;
+ /** Emitted if anything other than the selection property for a MIDI port changes */
+ PBD::Signal0<void> MidiPortInfoChanged;
+
/** Emitted if the backend notifies us of a graph order event */
PBD::Signal0<void> GraphReordered;
boost::shared_ptr<AudioBackend> _backend;
SerializedRCUManager<Ports> ports;
bool _port_remove_in_progress;
+ PBD::RingBuffer<Port*> _port_deletions_pending;
- boost::shared_ptr<Port> register_port (DataType type, const std::string& portname, bool input, bool async = false);
+ boost::shared_ptr<Port> register_port (DataType type, const std::string& portname, bool input, bool async = false, PortFlags extra_flags = PortFlags (0));
void port_registration_failure (const std::string& portname);
/** List of ports to be used between ::cycle_start() and ::cycle_end()
*/
boost::shared_ptr<Ports> _cycle_ports;
- void fade_out (gain_t, gain_t, pframes_t);
- void silence (pframes_t nframes);
+ void silence (pframes_t nframes, Session *s = 0);
void silence_outputs (pframes_t nframes);
void check_monitoring ();
/** Signal the start of an audio cycle.
* This MUST be called before any reading/writing for this cycle.
* Realtime safe.
*/
- void cycle_start (pframes_t nframes);
+ void cycle_start (pframes_t nframes, Session* s = 0);
/** Signal the end of an audio cycle.
* This signifies that the cycle began with @ref cycle_start has ended.
* This MUST be called at the end of each cycle.
* Realtime safe.
*/
- void cycle_end (pframes_t nframes);
+ void cycle_end (pframes_t nframes, Session* s = 0);
+
+ void cycle_end_fade_out (gain_t, gain_t, pframes_t, Session* s = 0);
+
+ typedef std::map<std::string,MidiPortInformation> MidiPortInfo;
+
+ mutable Glib::Threads::Mutex midi_port_info_mutex;
+ MidiPortInfo midi_port_info;
+
+ static std::string midi_port_info_file ();
+ bool midi_info_dirty;
+ void save_midi_port_info ();
+ void load_midi_port_info ();
+ void fill_midi_port_info_locked ();
+
+ void filter_midi_ports (std::vector<std::string>&, MidiPortFlags, MidiPortFlags);
};