session export starts from session start marker; add tooltips for rude solo + auditio...
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 13 Oct 2006 15:07:50 +0000 (15:07 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 13 Oct 2006 15:07:50 +0000 (15:07 +0000)
git-svn-id: svn://localhost/ardour2/trunk@985 d708f5d6-7413-0410-9779-e7cbd77b26cf

14 files changed:
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui2.cc
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/editor.cc
gtk2_ardour/editor_export_audio.cc
libs/ardour/ardour/control_protocol_manager.h
libs/ardour/control_protocol_manager.cc
libs/ardour/session.cc
libs/ardour/session_midi.cc
libs/surfaces/control_protocol/control_protocol/control_protocol.h
libs/surfaces/generic_midi/generic_midi_control_protocol.h
libs/surfaces/generic_midi/interface.cc
libs/surfaces/tranzport/interface.cc

index b2da3fdc4c85219f678fc7dc36a0381200e586a7..8f86054dddff41d4478162af5494ed4d38bdb452 100644 (file)
@@ -564,21 +564,11 @@ ARDOUR_UI::update_disk_space()
                int secs;
                nframes_t fr = session->frame_rate();
                
-               if (session->actively_recording()){
-                       
-                       rec_enabled_diskstreams = 0;
-                       session->foreach_route (this, &ARDOUR_UI::count_recenabled_diskstreams);
-                       
-                       if (rec_enabled_diskstreams) {
-                               frames /= rec_enabled_diskstreams;
-                       }
-                       
-               } else {
-                       
-                       /* hmmm. shall we divide by the route count? or the diskstream count?
-                          or what? for now, do nothing ...
-                       */
-                       
+               rec_enabled_diskstreams = 0;
+               session->foreach_route (this, &ARDOUR_UI::count_recenabled_diskstreams);
+               
+               if (rec_enabled_diskstreams) {
+                       frames /= rec_enabled_diskstreams;
                }
                
                hrs  = frames / (fr * 3600);
index 69f2cd0492d81ffd6675e751fee0ea74372c23c8..4b03352bb6518edc9fc4d78d114254deaa2b1b7a 100644 (file)
@@ -689,6 +689,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void map_meter_falloff ();
 
        void toggle_control_protocol (ARDOUR::ControlProtocolInfo*);
+       void toggle_control_protocol_feedback (ARDOUR::ControlProtocolInfo*, const char* group_name, const char* action_name);
 };
 
 #endif /* __ardour_gui_h__ */
index f1b8ddad2f81b7b6aa7823e9be7249341f0f6b29..7f724312aa8dc6b6a15eb4a81a361975ceebdce6 100644 (file)
@@ -363,6 +363,9 @@ ARDOUR_UI::setup_transport ()
        auditioning_alert_button.set_name ("TransportAuditioningAlert");
        auditioning_alert_button.signal_pressed().connect (mem_fun(*this,&ARDOUR_UI::audition_alert_toggle));
 
+       tooltips().set_tip (solo_alert_button, _("When active, something is soloed.\nClick to de-solo everything"));
+       tooltips().set_tip (auditioning_alert_button, _("When active, auditioning is taking place\nClick to stop the audition"));
+
        alert_box.pack_start (solo_alert_button, false, false);
        alert_box.pack_start (auditioning_alert_button, false, false);
 
index d7c294c6815a14499c78bbd74aac0719ab5ca838..e764779300048b5d025c8705f2f9af41aae259b1 100644 (file)
@@ -478,10 +478,36 @@ ARDOUR_UI::toggle_control_protocol (ControlProtocolInfo* cpi)
        }
 }
 
+void
+ARDOUR_UI::toggle_control_protocol_feedback (ControlProtocolInfo* cpi, const char* group, const char* action)
+{
+       if (!session) {
+               /* this happens when we build the menu bar when control protocol support
+                  has been used in the past for some given protocol - the item needs
+                  to be made active, but there is no session yet.
+               */
+               return;
+       }
+
+       if (cpi->protocol) {
+               Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (group, action);
+
+               if (act) {
+                       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+                       bool x = tact->get_active();
+
+                       if (tact && x != cpi->protocol->get_feedback()) {
+                               cpi->protocol->set_feedback (!x);
+                       }
+               }
+       }
+}
+
 void
 ARDOUR_UI::build_control_surface_menu ()
 {
        list<ControlProtocolInfo*>::iterator i;
+       bool with_feedback;
 
        /* !!! this has to match the top level entry from ardour.menus */
 
@@ -501,6 +527,8 @@ ARDOUR_UI::build_control_surface_menu ()
                                                                                          (bind (mem_fun (*this, &ARDOUR_UI::toggle_control_protocol), *i)));
                        
                        Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+
+                       with_feedback = false;
                        
                        if ((*i)->protocol || (*i)->requested) {
                                tact->set_active ();
@@ -509,6 +537,34 @@ ARDOUR_UI::build_control_surface_menu ()
                        ui += "<menuitem action='";
                        ui += action_name;
                        ui += "'/>\n";
+
+                       if ((*i)->supports_feedback) {
+
+                               string submenu_name = action_name;
+                               
+                               submenu_name += "SubMenu";
+
+                               ActionManager::register_action (editor->editor_actions, submenu_name.c_str(), _("Controls"));
+
+                               action_name += "Feedback";
+
+                               Glib::RefPtr<Action> act = ActionManager::register_toggle_action (editor->editor_actions, action_name.c_str(), _("Feedback"),
+                                                                                                 (bind (mem_fun (*this, &ARDOUR_UI::toggle_control_protocol_feedback), 
+                                                                                                        *i, 
+                                                                                                        "Editor",
+                                                                                                        action_name.c_str())));
+                               
+                               ui += "<menu action='";
+                               ui += submenu_name;
+                               ui += "'>\n<menuitem action='";
+                               ui += action_name;
+                               ui += "'/>\n</menu>\n";
+                               
+                               if ((*i)->protocol) {
+                                       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
+                                       tact->set_active ((*i)->protocol->get_feedback ());
+                               }
+                       }
                }
        }
 
index ed09a0359788737c051884ace6ecedad51fec249..67f3acccf95f9b7e5deb1f1860f84683db563b40 100644 (file)
@@ -129,11 +129,11 @@ static const gchar *snap_mode_strings[] = {
 };
 
 static const gchar *zoom_focus_strings[] = {
-       N_("Focus Left"),
-       N_("Focus Right"),
-       N_("Focus Center"),
-       N_("Focus Playhead"),
-       N_("Focus Edit Cursor"),
+       N_("Left"),
+       N_("Right"),
+       N_("Center"),
+       N_("Playhead"),
+       N_("Edit Cursor"),
        0
 };
 
@@ -2589,6 +2589,7 @@ Editor::setup_toolbar ()
        Gtkmm2ext::set_size_request_to_display_given_text (zoom_focus_selector, "Focus Center", 2+FUDGE, 0);
        set_popdown_strings (zoom_focus_selector, internationalize (zoom_focus_strings));
        zoom_focus_selector.signal_changed().connect (mem_fun(*this, &Editor::zoom_focus_selection_done));
+       ARDOUR_UI::instance()->tooltips().set_tip (zoom_focus_selector, _("Zoom focus"));
 
        zoom_box.pack_start (zoom_focus_selector, false, false);
 
index 7ea87a296933fe70973ae44656c8f9f79c207d20..fd40b9cae0f9af319b7bbcc23283c4167480b543 100644 (file)
@@ -55,7 +55,7 @@ void
 Editor::export_session()
 {
        if (session) {
-               export_range (0, session->current_end_frame());
+               export_range (session->current_start_frame(), session->current_end_frame());
        }
 }
 
index 99de5479fb0ad6eb32417e9cca3cb8538c25ef22..39e4803637416c818f9d636efff64725898494d9 100644 (file)
@@ -23,6 +23,7 @@ struct ControlProtocolInfo {
     std::string path;
     bool requested;
     bool mandatory;
+    bool supports_feedback;
     XMLNode* state;
 
     ControlProtocolInfo() : descriptor (0), protocol (0), state (0) {}
index 7170b456562746b5a86c3c9853e94aca9ccc0034..1ff6c28ef36482af33dc87d5fc2e860b289f4359 100644 (file)
@@ -189,6 +189,7 @@ ControlProtocolManager::control_protocol_discover (string path)
                        cpi->protocol = 0;
                        cpi->requested = false;
                        cpi->mandatory = descriptor->mandatory;
+                       cpi->supports_feedback = descriptor->supports_feedback;
                        cpi->state = 0;
                        
                        control_protocol_info.push_back (cpi);
index d5ff3d223c1bced847b1dd283777cac2b4d0a974..e8f6ec1023a12c3d21d6c7a71632b82df1ee8779 100644 (file)
@@ -3288,7 +3288,19 @@ Session::remove_redirect (Redirect* redirect)
 nframes_t
 Session::available_capture_duration ()
 {
-       const double scale = 4096.0 / sizeof (Sample);
+       float sample_bytes_on_disk;
+
+       switch (Config->get_native_file_data_format()) {
+       case FormatFloat:
+               sample_bytes_on_disk = 4;
+               break;
+
+       case FormatInt24:
+               sample_bytes_on_disk = 3;
+               break;
+       }
+
+       double scale = 4096.0 / sample_bytes_on_disk;
 
        if (_total_free_4k_blocks * scale > (double) max_frames) {
                return max_frames;
index 1af00ca337ed3b9cd704303cccee9f5c129ec2e7..fe08b4012721e0c9f7c699e1d0d84362ae50e10a 100644 (file)
@@ -1111,7 +1111,7 @@ Session::terminate_midi_thread ()
 void
 Session::poke_midi_thread ()
 {
-       char c;
+       static char c = 0;
 
        if (write (midi_request_pipe[1], &c, 1) != 1) {
                error << string_compose(_("cannot send signal to midi thread! (%1)"), strerror (errno)) << endmsg;
index 3635b267ceea7c994da95906d7c045145db0ad41..a689d494314d97ae606bf50f113ac389d3e74413 100644 (file)
@@ -47,7 +47,6 @@ class ControlProtocol : public sigc::trackable, public Stateful, public BasicUI
 
        virtual int set_feedback (bool yn) { return 0; }
        virtual bool get_feedback () const { return false; }
-       virtual bool supports_feedback () const { return false; }
 
        sigc::signal<void> ActiveChanged;
 
@@ -114,6 +113,7 @@ extern "C" {
            void*       ptr;       /* protocol can store a value here */
            void*       module;    /* not for public access */
            int         mandatory; /* if non-zero, always load and do not make optional */
+           bool        supports_feedback; /* if true, protocol has toggleable feedback mechanism */
            bool             (*probe)(ControlProtocolDescriptor*);
            ControlProtocol* (*initialize)(ControlProtocolDescriptor*,Session*);
            void             (*destroy)(ControlProtocolDescriptor*,ControlProtocol*);
index d0087447275aa5c6ff7017b7624a00906c4fb80f..6fba16bccd3cf337b464dc52abee8975bd24cd25 100644 (file)
@@ -34,7 +34,6 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
 
        int set_feedback (bool yn);
        bool get_feedback () const;
-       bool supports_feedback () const { return true; }
 
        XMLNode& get_state ();
        int set_state (const XMLNode&);
index 230be694f23a66185c6ffdbaee6ce2c2cdf5c170..c70b5b6b6182d872e3ab59280ae68a62383e139a 100644 (file)
@@ -42,6 +42,7 @@ static ControlProtocolDescriptor generic_midi_descriptor = {
        ptr : 0,
        module : 0,
        mandatory : 0,
+       supports_feedback : true,
        probe : probe_generic_midi_protocol,
        initialize : new_generic_midi_protocol,
        destroy : delete_generic_midi_protocol
index 29a0fde043d62f5fd7e922f962186f16d878297f..f6d0dc820665c0a2bcb462bef2df8917aa36965a 100644 (file)
@@ -35,6 +35,7 @@ static ControlProtocolDescriptor tranzport_descriptor = {
        ptr : 0,
        module : 0,
        mandatory : 0,
+       supports_feedback : false,
        probe : probe_tranzport_protocol,
        initialize : new_tranzport_protocol,
        destroy : delete_tranzport_protocol