#include <glibmm/threads.h>
+#include "ltc/ltc.h"
+
#include "pbd/error.h"
#include "pbd/event_loop.h"
#include "pbd/rcu.h"
#include "midi++/types.h"
#include "timecode/time.h"
-#include "ltc/ltc.h"
#include "ardour/ardour.h"
#include "ardour/chan_count.h"
class ImportStatus;
class MidiClockTicker;
class MidiControlUI;
+class MidiPortManager;
+class MidiPort;
class MidiRegion;
class MidiSource;
class MidiTrack;
extern void setup_enum_writer ();
-class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager
+class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager
{
public:
enum RecordState {
virtual ~Session ();
+ static int get_info_from_path (const std::string& xmlpath, float& sample_rate, SampleFormat& data_format);
+
std::string path() const { return _path; }
std::string name() const { return _name; }
std::string snap_name() const { return _current_snapshot_name; }
return _bundles.reader ();
}
- struct RoutePublicOrderSorter {
+ struct LIBARDOUR_API RoutePublicOrderSorter {
bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b);
};
+ void set_order_hint (uint32_t order_hint) {_order_hint = order_hint;};
void notify_remote_id_change ();
- void sync_order_keys (RouteSortOrderKey);
+ void sync_order_keys ();
template<class T> void foreach_route (T *obj, void (T::*func)(Route&));
template<class T> void foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>));
void timecode_time_subframes (framepos_t when, Timecode::Time&);
void timecode_duration (framecnt_t, Timecode::Time&) const;
- void timecode_duration_string (char *, framecnt_t) const;
+ void timecode_duration_string (char *, size_t len, framecnt_t) const;
framecnt_t convert_to_frames (AnyTime const & position);
framecnt_t any_duration_to_frames (framepos_t position, AnyTime const & duration);
static PBD::Signal1<void, framepos_t> EndTimeChanged;
void request_sync_source (Slave*);
- bool synced_to_jack() const { return config.get_external_sync() && Config->get_sync_source() == JACK; }
+ bool synced_to_engine() const { return config.get_external_sync() && Config->get_sync_source() == Engine; }
double transport_speed() const { return _transport_speed; }
bool transport_stopped() const { return _transport_speed == 0.0f; }
int remove_last_capture ();
+ /** handlers should return 0 for "everything OK", and any other value for
+ * "cannot setup audioengine".
+ */
+ static PBD::Signal1<int,uint32_t> AudioEngineSetupRequired;
+
/** handlers should return -1 for "stop cleanup",
0 for "yes, delete this playlist",
1 for "no, don't delete this playlist".
void request_resume_timecode_transmission ();
bool timecode_transmission_suspended () const;
- std::string source_search_path(DataType) const;
+ std::vector<std::string> source_search_path(DataType) const;
void ensure_search_path_includes (const std::string& path, DataType type);
std::list<std::string> unknown_processors () const;
boost::shared_ptr<IO> ltc_input_io() { return _ltc_input; }
boost::shared_ptr<IO> ltc_output_io() { return _ltc_output; }
- /* Callbacks specifically related to JACK, and called directly
- * from the JACK audio backend.
- */
+ MIDI::Port* midi_input_port () const;
+ MIDI::Port* midi_output_port () const;
+ MIDI::Port* mmc_output_port () const;
+ MIDI::Port* mmc_input_port () const;
-#ifdef HAVE_JACK_SESSION
- void jack_session_event (jack_session_event_t* event);
-#endif
- void jack_timebase_callback (jack_transport_state_t, pframes_t, jack_position_t*, int);
+ boost::shared_ptr<MidiPort> midi_clock_output_port () const;
+ boost::shared_ptr<MidiPort> midi_clock_input_port () const;
+ boost::shared_ptr<MidiPort> mtc_output_port () const;
+ boost::shared_ptr<MidiPort> mtc_input_port () const;
+
+ MIDI::MachineControl& mmc() { return *_mmc; }
protected:
friend class AudioEngine;
boost::scoped_ptr<SessionDirectory> _session_dir;
void hookup_io ();
- void when_engine_running ();
void graph_reordered ();
/** current snapshot name, without the .ardour suffix */
void auto_loop_changed (Location *);
void auto_loop_declick_range (Location *, framepos_t &, framepos_t &);
- void first_stage_init (std::string path, std::string snapshot_name);
- int second_stage_init ();
+ int ensure_engine (uint32_t desired_sample_rate);
+ void pre_engine_init (std::string path);
+ int post_engine_init ();
+ int immediately_post_engine ();
void remove_empty_sounds ();
void setup_midi_control ();
float opt
);
- /* number of hardware ports we're using,
- based on max (requested,available)
- */
-
- ChanCount n_physical_outputs;
- ChanCount n_physical_inputs;
-
int find_all_sources (std::string path, std::set<std::string>& result);
int find_all_sources_across_snapshots (std::set<std::string>& result, bool exclude_this_snapshot);
GraphEdges _current_route_graph;
uint32_t next_control_id () const;
+ uint32_t _order_hint;
bool ignore_route_processor_changes;
MidiClockTicker* midi_clock;
void reconnect_ltc_input ();
void reconnect_ltc_output ();
+
+ /* persistent, non-track related MIDI ports */
+ MidiPortManager* _midi_ports;
+ MIDI::MachineControl* _mmc;
+
+ void setup_ltc ();
+ void setup_click ();
+ void setup_click_state (const XMLNode*);
+ void setup_bundles ();
+
+ static int get_session_info_from_path (XMLTree& state_tree, const std::string& xmlpath);
};
} // namespace ARDOUR