lots of deep but hard to spot changes to transport control, primarily relating to...
[ardour.git] / libs / ardour / ardour / session.h
index ac0c052fa19a8a30813215f35627b3b16ac03e41..61ee454e7c021abd45699e172cc0bc46a9acdd0d 100644 (file)
@@ -155,8 +155,8 @@ class Session : public PBD::StatefulDestructible
 
            Type           type;
            Action         action;
-           nframes_t action_frame;
-           nframes_t target_frame;
+           nframes_t      action_frame;
+           nframes_t      target_frame;
            float          speed;
 
            union {
@@ -241,7 +241,8 @@ class Session : public PBD::StatefulDestructible
        string export_dir () const;
 
        void set_snap_name ();
-
+       
+       bool writable() const { return _writable; }
        void set_dirty ();
        void set_clean ();
        bool dirty() const { return _state_of_the_state & Dirty; }
@@ -267,8 +268,17 @@ class Session : public PBD::StatefulDestructible
        static string suffixed_search_path (std::string suffix, bool data);
        static string control_protocol_path ();
        static string template_path ();
+       static string route_template_path ();
        static string template_dir ();
-       static void get_template_list (list<string>&);
+       static string route_template_dir ();
+       static void get_template_list (std::list<std::string>&);
+
+       struct RouteTemplateInfo {
+         std::string name;
+         std::string path;
+       };
+
+       static void get_route_templates (std::vector<RouteTemplateInfo>&);
        
        static string change_audio_path_by_name (string oldpath, string oldname, string newname, bool destructive);
        string audio_path_from_name (string, uint32_t nchans, uint32_t chan, bool destructive);
@@ -364,7 +374,7 @@ class Session : public PBD::StatefulDestructible
        void request_stop (bool abort = false);
        void request_locate (nframes_t frame, bool with_roll = false);
 
-       void request_play_loop (bool yn);
+       void request_play_loop (bool yn, bool leave_rolling = false);
        bool get_play_loop () const { return play_loop; }
 
        nframes_t  last_transport_start() const { return _last_roll_location; }
@@ -398,6 +408,10 @@ class Session : public PBD::StatefulDestructible
        double frames_per_smpte_frame() const { return _frames_per_smpte_frame; }
        nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; }
 
+       MIDI::byte get_mtc_smpte_bits() const { 
+               return mtc_smpte_bits;   /* encoding of SMTPE type for MTC */
+       }
+
        float smpte_frames_per_second() const;
        bool smpte_drop_frames() const;
 
@@ -434,7 +448,6 @@ class Session : public PBD::StatefulDestructible
        void remove_pending_capture_state ();
 
        static int rename_template (string old_name, string new_name);
-
        static int delete_template (string name);
        
        sigc::signal<void,string> StateSaved;
@@ -491,6 +504,13 @@ class Session : public PBD::StatefulDestructible
 
        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);
+       RouteList new_route_from_template (uint32_t how_many, const std::string& template_path);
+
+       /* this is a hack put in to support work on video tracks by Robin Gareus. Nobody 
+          should assume that this works yet (February 2009)
+       */
+
+       boost::shared_ptr<Route> new_video_track (string name);
 
        void   remove_route (boost::shared_ptr<Route>);
 
@@ -586,6 +606,7 @@ class Session : public PBD::StatefulDestructible
            
            /* control info */
            uint32_t total;
+           uint32_t count;
            SrcQuality quality;
            volatile bool freeze;
            std::vector<Glib::ustring> paths;
@@ -637,6 +658,12 @@ class Session : public PBD::StatefulDestructible
 
        static sigc::signal<int,nframes_t, nframes_t> AskAboutSampleRateMismatch;
 
+       class SRMismatchRejected : public std::exception {
+         public:
+               SRMismatchRejected () {}
+               const char* what() const throw() { return "Sample rate mismatch rejected"; }
+       };
+
        /* handlers should return !0 for use pending state, 0 for
           ignore it.
        */
@@ -692,8 +719,7 @@ class Session : public PBD::StatefulDestructible
 
        /* flattening stuff */
 
-       boost::shared_ptr<Region> write_one_audio_track (AudioTrack&, nframes_t start, nframes_t end, bool overwrite, vector<boost::shared_ptr<AudioSource> >&,
-                                                        InterThreadInfo& wot);
+       boost::shared_ptr<Region> write_one_audio_track (AudioTrack&, nframes_t start, nframes_t end, bool overwrite, vector<boost::shared_ptr<AudioSource> >&, InterThreadInfo& wot, bool enable_processing = true);
        int freeze (InterThreadInfo&);
 
        /* session-wide solo/mute/rec-enable */
@@ -900,7 +926,7 @@ class Session : public PBD::StatefulDestructible
        void set_audio_range (list<AudioRange>&);
        void set_music_range (list<MusicRange>&);
 
-       void request_play_range (bool yn);
+       void request_play_range (bool yn, bool leave_rolling = false);
        bool get_play_range () const { return _play_range; }
 
        /* favorite dirs */
@@ -979,6 +1005,8 @@ class Session : public PBD::StatefulDestructible
 
        nframes_t compute_initial_length ();
 
+       bool   _writable;
+
        static const char* _template_suffix;
        static const char* _statefile_suffix;
        static const char* _pending_suffix;
@@ -1047,7 +1075,11 @@ class Session : public PBD::StatefulDestructible
        void process_with_events    (nframes_t);
        void process_audition       (nframes_t);
        int  process_export         (nframes_t, ARDOUR::AudioExportSpecification*);
-       
+
+       void block_processing() { g_atomic_int_set (&processing_prohibited, 1); }
+       void unblock_processing() { g_atomic_int_set (&processing_prohibited, 0); }
+       bool processing_blocked() const { return g_atomic_int_get (&processing_prohibited); }
+
        /* slave tracking */
 
        static const int delta_accumulator_size = 25;
@@ -1067,16 +1099,16 @@ class Session : public PBD::StatefulDestructible
        nframes_t slave_wait_end;
 
        void reset_slave_state ();
-       bool follow_slave (nframes_t, nframes_t);
-       void set_slave_source (SlaveSource);
+       bool follow_slave (nframes_t);
+       void set_slave_source (SlaveSource, bool stop_transport = true);
 
        bool _exporting;
        int  prepare_to_export (ARDOUR::AudioExportSpecification&);
 
        void prepare_diskstreams ();
        void commit_diskstreams (nframes_t, bool& session_requires_butler);
-       int  process_routes (nframes_t, nframes_t);
-       int  silent_process_routes (nframes_t, nframes_t);
+       int  process_routes (nframes_t);
+       int  silent_process_routes (nframes_t);
 
        bool get_rec_monitors_input () {
                if (actively_recording()) {
@@ -1110,7 +1142,7 @@ class Session : public PBD::StatefulDestructible
                return false;
        }
 
-       bool maybe_sync_start (nframes_t&, nframes_t&);
+       bool maybe_sync_start (nframes_t&);
 
        void check_declick_out ();
 
@@ -1154,8 +1186,6 @@ class Session : public PBD::StatefulDestructible
        bool              pending_abort;
        bool              pending_auto_loop;
        
-       Sample*           butler_mixdown_buffer;
-       float*            butler_gain_buffer;
        pthread_t         butler_thread;
        Glib::Mutex       butler_request_lock;
         Glib::Cond        butler_paused;
@@ -1345,6 +1375,8 @@ class Session : public PBD::StatefulDestructible
        nframes_t  last_smpte_when;
        SMPTE::Time last_smpte;
 
+       bool _send_smpte_update; ///< Flag to send a full frame (SMPTE) MTC message this cycle
+       
        int send_full_time_code ();
        int send_midi_time_code ();
 
@@ -1357,7 +1389,8 @@ class Session : public PBD::StatefulDestructible
        
        void reset_record_status ();
        
-       int no_roll (nframes_t nframes, nframes_t offset);
+       int fail_roll (nframes_t nframes);
+       int no_roll (nframes_t nframes);
        
        bool non_realtime_work_pending() const { return static_cast<bool>(post_transport_work); }
        bool process_can_proceed() const { return !(post_transport_work & ProcessCannotProceedMask); }
@@ -1420,7 +1453,7 @@ class Session : public PBD::StatefulDestructible
        void          change_midi_ports ();
        int           use_config_midi_ports ();
 
-       void set_play_loop (bool yn);
+       void set_play_loop (bool yn, bool leave_rolling);
        void overwrite_some_buffers (Diskstream*);
        void flush_all_redirects ();
        int  micro_locate (nframes_t distance);
@@ -1694,7 +1727,7 @@ class Session : public PBD::StatefulDestructible
        Click *get_click();
        void   setup_click_sounds (int which);
        void   clear_clicks ();
-       void   click (nframes_t start, nframes_t nframes, nframes_t offset);
+       void   click (nframes_t start, nframes_t nframes);
 
        vector<Route*> master_outs;
        
@@ -1702,7 +1735,7 @@ class Session : public PBD::StatefulDestructible
 
        list<AudioRange> current_audio_range;
        bool _play_range;
-       void set_play_range (bool yn);
+       void set_play_range (bool yn, bool leave_rolling);
        void setup_auto_play ();
 
        /* main outs */
@@ -1757,6 +1790,8 @@ class Session : public PBD::StatefulDestructible
        /* used in ::audible_frame() */
 
        mutable bool have_looped;
+
+       static void get_templates_from (const std::string& path, std::list<std::string> &template_names);
 };
 
 } // namespace ARDOUR