#include <boost/dynamic_bitset.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/weak_ptr.hpp>
+#include <boost/utility.hpp>
#include <sndfile.h>
#include <glibmm/thread.h>
-#include <pbd/error.h>
-#include <pbd/pool.h>
-#include <pbd/rcu.h>
-#include <pbd/statefuldestructible.h>
-#include <pbd/undo.h>
+#include "pbd/error.h"
+#include "pbd/pool.h"
+#include "pbd/rcu.h"
+#include "pbd/statefuldestructible.h"
+#include "pbd/undo.h"
-#include <midi++/mmc.h>
-#include <midi++/types.h>
+#include "midi++/mmc.h"
+#include "midi++/types.h"
-#include <pbd/destructible.h>
-#include <pbd/stateful.h>
+#include "pbd/destructible.h"
+#include "pbd/stateful.h"
-#include <ardour/ardour.h>
-#include <ardour/chan_count.h>
-#include <ardour/configuration.h>
-#include <ardour/location.h>
-#include <ardour/smpte.h>
+#include "ardour/ardour.h"
+#include "ardour/chan_count.h"
+#include "ardour/configuration.h"
+#include "ardour/location.h"
+#include "ardour/smpte.h"
class XMLTree;
class XMLNode;
using std::map;
using std::set;
-class Session : public PBD::StatefulDestructible
+class Session : public PBD::StatefulDestructible, public boost::noncopyable
{
private:
typedef std::pair<boost::weak_ptr<Route>,bool> RouteBooleanState;
SetAudioRange,
SetPlayRange,
- /* only one of each of these events
- can be queued at any one time
- */
+ /* only one of each of these events can be queued at any one time */
StopOnce,
AutoLoop
Clear
};
- Type type;
- Action action;
- nframes_t action_frame;
- nframes_t target_frame;
- double speed;
+ Type type;
+ Action action;
+ nframes_t action_frame;
+ nframes_t target_frame;
+ double speed;
union {
- void* ptr;
- bool yes_or_no;
- nframes_t target2_frame;
- SlaveSource slave;
- Route* route;
+ void* ptr;
+ bool yes_or_no;
+ nframes_t target2_frame;
+ SlaveSource slave;
+ Route* route;
};
- boost::shared_ptr<Region> region;
-
- list<AudioRange> audio_range;
- list<MusicRange> music_range;
+ list<AudioRange> audio_range;
+ list<MusicRange> music_range;
+
+ boost::shared_ptr<Region> region;
Event(Type t, Action a, nframes_t when, nframes_t where, double spd, bool yn = false)
- : type (t),
- action (a),
- action_frame (when),
- target_frame (where),
- speed (spd),
- yes_or_no (yn) {}
+ : type (t)
+ , action (a)
+ , action_frame (when)
+ , target_frame (where)
+ , speed (spd)
+ , yes_or_no (yn)
+ {}
void set_ptr (void* p) {
ptr = p;
Glib::ustring peak_path (Glib::ustring) const;
- static string change_audio_path_by_name (string oldpath, string oldname, string newname, bool destructive);
- static string change_midi_path_by_name (string oldpath, string oldname, string newname, bool destructive);
+ static string change_source_path_by_name (string oldpath, string oldname, string newname, bool destructive);
string peak_path_from_audio_path (string) const;
- string audio_path_from_name (string, uint32_t nchans, uint32_t chan, bool destructive);
- string midi_path_from_name (string);
+ string new_audio_source_name (const string&, uint32_t nchans, uint32_t chan, bool destructive);
+ string new_midi_source_name (const string&);
+ string new_source_path_from_name (DataType type, const string&);
+ RouteList new_route_from_template (uint32_t how_many, const std::string& template_path);
void process (nframes_t nframes);
sigc::signal<void,nframes_t> Xrun;
sigc::signal<void> TransportLooped;
+ /** emitted when a locate has occurred */
+ sigc::signal<void> Located;
+
sigc::signal<void,RouteList&> RouteAdded;
void request_roll_at_and_return (nframes_t start, nframes_t return_to);
bool transport_locked () const;
int wipe ();
- //int wipe_diskstream (AudioDiskstream *);
int remove_region_from_region_list (boost::shared_ptr<Region>);
nframes_t get_maximum_extent () const;
nframes_t current_end_frame() const { return end_location->start(); }
nframes_t current_start_frame() const { return start_location->start(); }
- // "actual" sample rate of session, set by current audioengine rate, pullup/down etc.
+ /// "actual" sample rate of session, set by current audioengine rate, pullup/down etc.
nframes_t frame_rate() const { return _current_frame_rate; }
- // "native" sample rate of session, regardless of current audioengine rate, pullup/down etc
+ /// "native" sample rate of session, regardless of current audioengine rate, pullup/down etc
nframes_t nominal_frame_rate() const { return _nominal_frame_rate; }
nframes_t frames_per_hour() const { return _frames_per_hour; }
void remove_event (nframes_t frame, Event::Type type);
void clear_events (Event::Type type);
- nframes_t get_block_size() const { return current_block_size; }
+ nframes_t get_block_size() const { return current_block_size; }
nframes_t worst_output_latency () const { return _worst_output_latency; }
- nframes_t worst_input_latency () const { return _worst_input_latency; }
- nframes_t worst_track_latency () const { return _worst_track_latency; }
+ nframes_t worst_input_latency () const { return _worst_input_latency; }
+ nframes_t worst_track_latency () const { return _worst_track_latency; }
int save_state (std::string snapshot_name, bool pending = false);
int restore_state (std::string snapshot_name);
/// The instant xml file is written to the session directory
void add_instant_xml (XMLNode&, bool write_to_config = true);
- XMLNode * instant_xml (const std::string& str);
+ XMLNode* instant_xml (const std::string& str);
enum StateOfTheState {
Clean = 0x0,
sigc::signal<void,RouteGroup*> edit_group_added;
sigc::signal<void,RouteGroup*> mix_group_added;
- sigc::signal<void> edit_group_removed;
- sigc::signal<void> mix_group_removed;
+ sigc::signal<void> edit_group_removed;
+ sigc::signal<void> mix_group_removed;
void foreach_edit_group (sigc::slot<void,RouteGroup*> sl) {
for (list<RouteGroup *>::iterator i = edit_groups.begin(); i != edit_groups.end(); i++) {
/* fundamental operations. duh. */
- std::list<boost::shared_ptr<AudioTrack> > new_audio_track (int input_channels, int output_channels, TrackMode mode = Normal, uint32_t how_many = 1);
+ std::list<boost::shared_ptr<AudioTrack> > new_audio_track (
+ int input_channels, int output_channels, TrackMode mode = Normal, uint32_t how_many = 1);
+
RouteList new_audio_route (int input_channels, int output_channels, uint32_t how_many);
- std::list<boost::shared_ptr<MidiTrack> > new_midi_track (TrackMode mode = Normal, uint32_t how_many = 1);
- //boost::shared_ptr<Route> new_midi_route (uint32_t how_many = 1);
+ std::list<boost::shared_ptr<MidiTrack> > new_midi_track (
+ TrackMode mode = Normal, uint32_t how_many = 1);
void remove_route (boost::shared_ptr<Route>);
void resort_routes ();
void sync_time_vars();
void bbt_time (nframes_t when, BBT_Time&);
- void smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes ) const;
- void sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes ) const;
+ void smpte_to_sample(SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes) const;
+ void sample_to_smpte(nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes) const;
void smpte_time (SMPTE::Time &);
void smpte_time (nframes_t when, SMPTE::Time&);
void smpte_time_subframes (nframes_t when, SMPTE::Time&);
void smpte_duration_string (char *, nframes_t) const;
void set_smpte_offset (nframes_t);
- nframes_t smpte_offset () const { return _smpte_offset; }
+ nframes_t smpte_offset () const { return _smpte_offset; }
void set_smpte_offset_negative (bool);
bool smpte_offset_negative () const { return _smpte_offset_negative; }
/* source management */
- struct import_status : public InterThreadInfo {
+ struct ImportStatus : public InterThreadInfo {
string doing_what;
/* control info */
SourceList sources;
};
- void import_audiofiles (import_status&);
- bool sample_rate_convert (import_status&, string infile, string& outfile);
+ void import_audiofiles (ImportStatus&);
+ bool sample_rate_convert (ImportStatus&, string infile, string& outfile);
string build_tmp_convert_name (string file);
boost::shared_ptr<ExportHandler> get_export_handler ();
int remove_last_capture ();
- /* handlers should return -1 for "stop cleanup", 0 for
- "yes, delete this playlist" and 1 for "no, don't delete
- this playlist.
+ /** handlers should return -1 for "stop cleanup",
+ 0 for "yes, delete this playlist",
+ 1 for "no, don't delete this playlist".
*/
-
sigc::signal<int,boost::shared_ptr<ARDOUR::Playlist> > AskAboutPlaylistDeletion;
- /* handlers should return 0 for "ignore the rate mismatch"
- and !0 for "do not use this session"
+ /** handlers should return 0 for "ignore the rate mismatch",
+ !0 for "do not use this session"
*/
-
static sigc::signal<int,nframes_t, nframes_t> AskAboutSampleRateMismatch;
- /* handlers should return !0 for use pending state, 0 for
- ignore it.
+ /** handlers should return !0 for use pending state, 0 for ignore it.
*/
-
static sigc::signal<int> AskAboutPendingState;
boost::shared_ptr<AudioFileSource> create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive);
sigc::signal<void> NamedSelectionRemoved;
/* Curves and AutomationLists (TODO when they go away) */
- void add_curve(Evoral::Curve*);
void add_automation_list(AutomationList*);
/* fade curves */
sigc::signal<void,boost::shared_ptr<Bundle> > BundleAdded;
sigc::signal<void,boost::shared_ptr<Bundle> > BundleRemoved;
- /* MIDI */
+ /* MIDI control */
void midi_panic(void);
int set_mtc_port (string port_tag);
/* clicking */
- boost::shared_ptr<IO> click_io() { return _click_io; }
+ boost::shared_ptr<IO> click_io() { return _click_io; }
/* disk, buffer loads */
bool auto_play_legal;
nframes_t _last_slave_transport_frame;
nframes_t maximum_output_latency;
- nframes_t last_stop_frame;
volatile nframes64_t _requested_return_frame;
BufferSet* _scratch_buffers;
BufferSet* _silent_buffers;
bool follow_slave (nframes_t, nframes_t);
void calculate_moving_average_of_slave_delta(int dir, nframes_t this_delta);
void track_slave_state(
- float slave_speed,
+ float slave_speed,
nframes_t slave_transport_frame,
nframes_t this_delta,
- bool starting);
+ bool starting);
void follow_slave_silently(nframes_t nframes, nframes_t offset, float slave_speed);
void set_slave_source (SlaveSource);
}
int get_transport_declick_required () {
-
if (transport_sub_state & PendingDeclickIn) {
transport_sub_state &= ~PendingDeclickIn;
return 1;
}
bool maybe_stop (nframes_t limit) {
- if ((_transport_speed > 0.0f && _transport_frame >= limit) || (_transport_speed < 0.0f && _transport_frame == 0)) {
+ if ( (_transport_speed > 0.0f && _transport_frame >= limit)
+ || (_transport_speed < 0.0f && _transport_frame == 0) ) {
stop_transport ();
return true;
}
mutable gint butler_should_do_transport_work;
int butler_request_pipe[2];
- inline bool transport_work_requested() const { return g_atomic_int_get(&butler_should_do_transport_work); }
+ inline bool transport_work_requested() const {
+ return g_atomic_int_get(&butler_should_do_transport_work);
+ }
struct ButlerRequest {
enum Type {
uint32_t audio_dstream_buffer_size;
uint32_t midi_dstream_buffer_size;
- int load_diskstreams (const XMLNode&);
+ int load_diskstreams (const XMLNode&);
/* routes stuff */
SerializedRCUManager<RouteList> routes;
- void add_routes (RouteList&, bool save);
+ void add_routes (RouteList&, bool save);
uint32_t destructive_index;
boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&);
SourceMap get_sources() { return sources; }
private:
-
-
int load_sources (const XMLNode& node);
XMLNode& get_sources_as_xml ();
NamedSelection *XMLNamedSelectionFactory (const XMLNode&);
/* CURVES and AUTOMATION LISTS */
- std::map<PBD::ID, Evoral::Curve*> curves;
std::map<PBD::ID, AutomationList*> automation_lists;
/* DEFAULT FADE CURVES */