** requires svn jack ** Hardware monitoring should work, some canvas scrolling speed...
authorNick Mainsbridge <beatroute@iprimus.com.au>
Wed, 30 Aug 2006 20:48:16 +0000 (20:48 +0000)
committerNick Mainsbridge <beatroute@iprimus.com.au>
Wed, 30 Aug 2006 20:48:16 +0000 (20:48 +0000)
git-svn-id: svn://localhost/ardour2/trunk@873 d708f5d6-7413-0410-9779-e7cbd77b26cf

26 files changed:
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/audio_clock.h
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_hscroller.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/editor_tempodisplay.cc
gtk2_ardour/gain_meter.cc
gtk2_ardour/main.cc
gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h
gtk2_ardour/new_session_dialog.cc
gtk2_ardour/new_session_dialog.h
libs/ardour/ardour/port.h
libs/ardour/ardour/tempo.h
libs/ardour/audio_diskstream.cc
libs/ardour/audioregion.cc
libs/ardour/route.cc
libs/ardour/session_state.cc
libs/ardour/tempo.cc
libs/ardour/track.cc
libs/gtkmm2ext/auto_spin.cc
libs/gtkmm2ext/popup.cc
libs/gtkmm2ext/selector.cc

index f2ab470c3d9636a671e5ef5bf0dafff7ab168464..c65346881a9711ab31159abc9912b46872506de9 100644 (file)
@@ -136,8 +136,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
                theArdourUI = this;
        }
 
-       ActionManager::init ();
-
        /* load colors */
 
        color_manager = new ColorManager();
@@ -146,7 +144,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
        
        color_manager->load (color_file);
 
-       m_new_session_dialog = new NewSessionDialog();
        editor = 0;
        mixer = 0;
        session = 0;
@@ -205,6 +202,9 @@ ARDOUR_UI::set_engine (AudioEngine& e)
        engine->Halted.connect (mem_fun(*this, &ARDOUR_UI::engine_halted));
        engine->SampleRateChanged.connect (mem_fun(*this, &ARDOUR_UI::update_sample_rate));
 
+               ActionManager::init ();
+       new_session_dialog = new NewSessionDialog();
+
        _tooltips.enable();
 
        keyboard = new Keyboard;
@@ -1375,7 +1375,7 @@ ARDOUR_UI::start_blinking ()
 
        if (blink_timeout_tag < 0) {
                blink_on = false;       
-               blink_timeout_tag = gtk_timeout_add (240, _blink, this);
+               blink_timeout_tag = g_timeout_add (240, _blink, this);
        }
 }
 
@@ -1383,7 +1383,7 @@ void
 ARDOUR_UI::stop_blinking ()
 {
        if (blink_timeout_tag >= 0) {
-               gtk_timeout_remove (blink_timeout_tag);
+               g_source_remove (blink_timeout_tag);
                blink_timeout_tag = -1;
        }
 }
@@ -1616,100 +1616,105 @@ ARDOUR_UI::save_template ()
 void
 ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
 {
-       m_new_session_dialog->show();
-       m_new_session_dialog->set_modal(true);
-       m_new_session_dialog->set_name(predetermined_path);
-       m_new_session_dialog->reset_recent();
+       int response = Gtk::RESPONSE_NONE;
 
-       int response = Gtk::RESPONSE_CANCEL;
+       new_session_dialog->set_modal(true);
+       new_session_dialog->set_name(predetermined_path);
+       new_session_dialog->reset_recent();
+       new_session_dialog->show();
+
+       //Glib::RefPtr<Gdk::Window> nsd_window = new_session_dialog->get_window();
 
        do {
-               response = m_new_session_dialog->run ();
+               response = new_session_dialog->run ();
+               //nsd_window ->set_cursor(Gdk::Cursor(Gdk::WATCH));
                if(response == Gtk::RESPONSE_CANCEL || response == Gtk::RESPONSE_DELETE_EVENT) {
-                 quit();
-                 return;
+                       quit();
+                       return;
 
                } else if (response == Gtk::RESPONSE_NONE) {
-                 /* Clear was pressed */
-                 m_new_session_dialog->reset();
+                       /* Clear was pressed */
+                       new_session_dialog->reset();
 
                } else if (response == Gtk::RESPONSE_YES) {
-                 /* YES  == OPEN, but there's no enum for that */
-                 std::string session_name = m_new_session_dialog->session_name();
-                 std::string session_path = m_new_session_dialog->session_folder();
-                 load_session (session_path, session_name);
+                       /* YES  == OPEN, but there's no enum for that */
 
-
-               } else if (response == Gtk::RESPONSE_OK) {
-                 if (m_new_session_dialog->get_current_page() == 1) {
-
-                   /* XXX this is a bit of a hack.. 
-                      i really want the new sesion dialog to return RESPONSE_YES
-                      if we're on page 1 (the load page)
-                      Unfortunately i can't see how atm.. 
-                   */
-                       std::string session_name = m_new_session_dialog->session_name();
-                       std::string session_path = m_new_session_dialog->session_folder();
+                       std::string session_name = new_session_dialog->session_name();
+                       std::string session_path = new_session_dialog->session_folder();
                        load_session (session_path, session_name);
 
-                 } else {
+                       
+               } else if (response == Gtk::RESPONSE_OK) {
+                       if (new_session_dialog->get_current_page() == 1) {
+                 
+                               /* XXX this is a bit of a hack.. 
+                                  i really want the new sesion dialog to return RESPONSE_YES
+                                  if we're on page 1 (the load page)
+                                  Unfortunately i can't see how atm.. 
+                               */
+                        
+                               std::string session_name = new_session_dialog->session_name();
+                               std::string session_path = new_session_dialog->session_folder();
+                               load_session (session_path, session_name);
+                              
+                       } else {
 
-                       _session_is_new = true;
+                               _session_is_new = true;
+                             
+                               std::string session_name = new_session_dialog->session_name();
+                               std::string session_path = new_session_dialog->session_folder();
                        
-                       std::string session_name = m_new_session_dialog->session_name();
-                       std::string session_path = m_new_session_dialog->session_folder();
                        
-
-                         //XXX This is needed because session constructor wants a 
-                         //non-existant path. hopefully this will be fixed at some point.
+                               //XXX This is needed because session constructor wants a 
+                               //non-existant path. hopefully this will be fixed at some point.
                        
-                       session_path = Glib::build_filename(session_path, session_name);
+                               session_path = Glib::build_filename(session_path, session_name);
                        
-                       std::string template_name = m_new_session_dialog->session_template_name();
+                               std::string template_name = new_session_dialog->session_template_name();
                        
-                       if (m_new_session_dialog->use_session_template()) {
-                               
-                               load_session (session_path, session_name, &template_name);
-                               
-                       } else {
-                               
-                               uint32_t cchns;
-                               uint32_t mchns;
-                               Session::AutoConnectOption iconnect;
-                               Session::AutoConnectOption oconnect;
-                               
-                               if (m_new_session_dialog->create_control_bus()) {
-                                       cchns = (uint32_t) m_new_session_dialog->control_channel_count();
+                               if (new_session_dialog->use_session_template()) {
+                         
+                                       load_session (session_path, session_name, &template_name);
+                         
                                } else {
-                                       cchns = 0;
-                               }
                                
-                               if (m_new_session_dialog->create_master_bus()) {
-                                       mchns = (uint32_t) m_new_session_dialog->master_channel_count();
-                               } else {
-                                       mchns = 0;
-                               }
+                                       uint32_t cchns;
+                                       uint32_t mchns;
+                                       Session::AutoConnectOption iconnect;
+                                       Session::AutoConnectOption oconnect;
                                
-                               if (m_new_session_dialog->connect_inputs()) {
-                                       iconnect = Session::AutoConnectPhysical;
-                               } else {
-                                       iconnect = Session::AutoConnectOption (0);
-                               }
+                                       if (new_session_dialog->create_control_bus()) {
+                                               cchns = (uint32_t) new_session_dialog->control_channel_count();
+                                       } else {
+                                               cchns = 0;
+                                       }
                                
-                               /// @todo some minor tweaks.
-
-                               if (m_new_session_dialog->connect_outs_to_master()) {
-                                       oconnect = Session::AutoConnectMaster;
-                               } else if (m_new_session_dialog->connect_outs_to_physical()) {
-                                       oconnect = Session::AutoConnectPhysical;
-                               } else {
-                                       oconnect = Session::AutoConnectOption (0);
-                               } 
+                                       if (new_session_dialog->create_master_bus()) {
+                                               mchns = (uint32_t) new_session_dialog->master_channel_count();
+                                       } else {
+                                               mchns = 0;
+                                       }
+                                     
+                                       if (new_session_dialog->connect_inputs()) {
+                                               iconnect = Session::AutoConnectPhysical;
+                                       } else {
+                                               iconnect = Session::AutoConnectOption (0);
+                                       }
+                                     
+                                       /// @todo some minor tweaks.
                                
-                               uint32_t nphysin = (uint32_t) m_new_session_dialog->input_limit_count();
-                               uint32_t nphysout = (uint32_t) m_new_session_dialog->output_limit_count();
+                                       if (new_session_dialog->connect_outs_to_master()) {
+                                               oconnect = Session::AutoConnectMaster;
+                                       } else if (new_session_dialog->connect_outs_to_physical()) {
+                                               oconnect = Session::AutoConnectPhysical;
+                                       } else {
+                                               oconnect = Session::AutoConnectOption (0);
+                                       } 
                                
-                               build_session (session_path,
+                                       uint32_t nphysin = (uint32_t) new_session_dialog->input_limit_count();
+                                       uint32_t nphysout = (uint32_t) new_session_dialog->output_limit_count();
+                               
+                                       build_session (session_path,
                                               session_name,
                                               cchns,
                                               mchns,
@@ -1718,14 +1723,15 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
                                               nphysin,
                                               nphysout, 
                                               engine->frame_rate() * 60 * 5);
-                       }
-                 }     
+                               }
+                       }       
                }
                
        } while (response == Gtk::RESPONSE_NONE);
-       m_new_session_dialog->hide();
        show();
-
+       new_session_dialog->get_window()->set_cursor();
+       
+       new_session_dialog->hide();
 }
 
 void
@@ -1771,9 +1777,6 @@ This prevents the session from being loaded."));
 
        connect_to_session (new_session);
 
-       //if (engine->running()) {
-       //mixer->show_window();
-       //}
        session_loaded = true;
        return 0;
 }
@@ -1826,9 +1829,6 @@ ARDOUR_UI::build_session (const string & path, const string & snap_name,
 
        connect_to_session (new_session);
 
-       //if (engine->running()) {
-       //mixer->show_window();
-       //}
        session_loaded = true;
        return 0;
 }
@@ -1840,10 +1840,6 @@ ARDOUR_UI::show ()
                editor->show_window ();
                shown_flag = true;
        }
-
-       if (session && mixer) {
-               // mixer->show_window ();
-       }
        
        if (about) {
                about->present ();
@@ -1863,7 +1859,8 @@ void
 ARDOUR_UI::hide_splash ()
 {
        if (about) {
-               // about->hide();
+               about->get_window()->set_cursor ();
+               about->hide();
        }
 }
 
index 5a9b7c4ae4d046fcf444a1ce4718023baa5d7f81..b3783140b75736634a250a469d1a3bbb34ac99aa 100644 (file)
@@ -524,7 +524,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
 
        bool _will_create_new_session_automatically;
 
-       NewSessionDialog* m_new_session_dialog;
+       NewSessionDialog* new_session_dialog;
        
        void open_session ();
        void open_recent_session ();
index 9ff5f45ddfca2bb9e7907143220beaa405f98306..4bcf13e1de9b0030e54f675fec1a4dd939b5ad90 100644 (file)
@@ -133,10 +133,10 @@ class AudioClock : public Gtk::HBox
 
        jack_nframes_t last_when;
 
-       long last_hrs;
-       long last_mins;
-       long last_secs;
-       long last_frames;
+       uint32_t last_hrs;
+       uint32_t last_mins;
+       uint32_t last_secs;
+       uint32_t last_frames;
        bool last_negative;
 
        long  ms_last_hrs;
index ce8145fa471e2697e3b02505d97c6845f02b560d..f86b83504e12f6f8491c783ec2d89ac09845ed3a 100644 (file)
@@ -271,7 +271,6 @@ Editor::Editor (AudioEngine& eng)
        first_action_message = 0;
        export_dialog = 0;
        show_gain_after_trim = false;
-       no_zoom_repos_update = false;
        ignore_route_list_reorder = false;
        no_route_list_redisplay = false;
        verbose_cursor_on = true;
@@ -284,7 +283,6 @@ Editor::Editor (AudioEngine& eng)
        _xfade_visibility = true;
        editor_ruler_menu = 0;
        no_ruler_shown_update = false;
-       edit_hscroll_dragging = false;
        edit_group_list_menu = 0;
        route_list_menu = 0;
        region_list_menu = 0;
@@ -832,16 +830,6 @@ Editor::set_frames_per_unit (double fpu)
                zoom_range_clock.set (frames);
        }
 
-       /* only update these if we not about to call reposition_x_origin,
-          which will do the same updates.
-       */
-       
-       if (!no_zoom_repos_update) {
-               horizontal_adjustment.set_value (leftmost_frame/frames_per_unit);
-               update_fixed_rulers ();
-               tempo_map_changed (Change (0));
-       }
-
        if (mouse_mode == MouseRange && selection->time.start () != selection->time.end_frame ()) {
                if (!selection->tracks.empty()) {
                        for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
@@ -909,7 +897,7 @@ Editor::edit_cursor_clock_changed()
 void
 Editor::zoom_adjustment_changed ()
 {
-       if (session == 0 || no_zoom_repos_update) {
+       if (session == 0) {
                return;
        }
 
@@ -976,40 +964,39 @@ Editor::deferred_control_scroll (jack_nframes_t target)
 void 
 Editor::canvas_horizontally_scrolled ()
 {
+
+        Glib::signal_idle().connect (mem_fun(*this, &Editor::lazy_canvas_horizontally_scrolled));
+
+}
+
+bool
+Editor::lazy_canvas_horizontally_scrolled ()
+{
+
        leftmost_frame = (jack_nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
 
        update_fixed_rulers ();
-       
-       if (!edit_hscroll_dragging) {
-               tempo_map_changed (Change (0));
-       } else {
-               update_tempo_based_rulers();
-       }
+       tempo_map_changed (Change (0));
+
+       return false; 
 }
 
 void
 Editor::reposition_and_zoom (jack_nframes_t frame, double nfpu)
 {
        if (!repos_zoom_queued) {
-               Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::deferred_reposition_and_zoom), frame, nfpu));
                repos_zoom_queued = true;
+               Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::deferred_reposition_and_zoom), frame, nfpu));
        }
 }
 
 gint
 Editor::deferred_reposition_and_zoom (jack_nframes_t frame, double nfpu)
 {
-       /* if we need to force an update to the hscroller stuff,
-          don't set no_zoom_repos_update.
-       */
 
-       no_zoom_repos_update = (frame != leftmost_frame);
-       
        set_frames_per_unit (nfpu);
-       if (no_zoom_repos_update) {
-               reposition_x_origin  (frame);
-       }
-       no_zoom_repos_update = false;
+       reposition_x_origin  (frame);
+
        repos_zoom_queued = false;
        
        return FALSE;
@@ -1062,7 +1049,6 @@ void
 Editor::stop_scrolling ()
 {
        scroll_connection.disconnect ();
-       slower_update_connection.disconnect ();
 }
 
 void
@@ -1307,6 +1293,7 @@ Editor::connect_to_session (Session *t)
 
        restore_ruler_visibility ();
        tempo_map_changed (Change (0));
+       session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
 
        edit_cursor->set_position (0);
        playhead_cursor->set_position (0);
@@ -2244,6 +2231,7 @@ Editor::set_state (const XMLNode& node)
                }
        }
 
+
        return 0;
 }
 
index 15e0efde11025ff4d9186a28f11fe8162e1821c9..689e7e8ab817f48039744f065d91679e7e70f618 100644 (file)
@@ -651,7 +651,6 @@ class Editor : public PublicEditor
        void controls_layout_size_request (Gtk::Requisition*);
 
        Gtk::HScrollbar     edit_hscrollbar;
-       bool                edit_hscroll_dragging;
 
        void reset_hscrollbar_stepping ();
        
@@ -684,12 +683,11 @@ class Editor : public PublicEditor
 
        void tie_vertical_scrolling ();
        void canvas_horizontally_scrolled ();
+       bool lazy_canvas_horizontally_scrolled ();
        void reposition_and_zoom (jack_nframes_t sample, double fpu);
        gint deferred_reposition_and_zoom (jack_nframes_t sample, double fpu);
        void end_location_changed (ARDOUR::Location*);
        bool repos_zoom_queued;
-       bool no_zoom_repos_update;
-       bool no_tempo_map_update;
 
        struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
            RegionListDisplayModelColumns() {
@@ -808,8 +806,6 @@ class Editor : public PublicEditor
        void center_screen_internal (jack_nframes_t, float);
        
        void update_current_screen ();
-       sigc::connection slower_update_connection;
-       void update_slower ();
        
        gint show_track_context_menu (GdkEventButton *);
        void hide_track_context_menu ();
index 632dadd60a1b7cf00c9dded0e9b9461707d45e60..51138a5a673a167465f8ec7124f176e25e4a1ef3 100644 (file)
@@ -92,6 +92,7 @@ Editor::initialize_canvas ()
        /* don't try to center the canvas */
 
        track_canvas.set_center_scroll_region (false);
+       track_canvas.set_dither         (Gdk::RGB_DITHER_NONE);
 
        track_canvas.signal_event().connect (bind (mem_fun (*this, &Editor::track_canvas_event), (ArdourCanvas::Item*) 0));
        track_canvas.set_name ("EditorMainCanvas");
@@ -133,6 +134,7 @@ Editor::initialize_canvas ()
        time_canvas.add_events (Gdk::POINTER_MOTION_HINT_MASK);
        time_canvas.set_flags (CAN_FOCUS);
        time_canvas.set_center_scroll_region (false);
+       time_canvas.set_dither          (Gdk::RGB_DITHER_NONE);
        
        meter_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, 0.0);
        tempo_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, timebar_height);
@@ -594,7 +596,7 @@ Editor::autoscroll_canvas ()
 
                /* connect the timeout so that we get called repeatedly */
 
-               autoscroll_timeout_tag = gtk_timeout_add (20, _autoscroll_canvas, this);
+               autoscroll_timeout_tag = g_timeout_add (20, _autoscroll_canvas, this);
                keep_calling = false;
 
        } else if (autoscroll_cnt == 50) { /* 0.5 seconds */
@@ -640,7 +642,7 @@ void
 Editor::stop_canvas_autoscroll ()
 {
        if (autoscroll_timeout_tag >= 0) {
-               gtk_timeout_remove (autoscroll_timeout_tag);
+               g_source_remove (autoscroll_timeout_tag);
                autoscroll_timeout_tag = -1;
        }
 }
index 8504667daa7efb6183ca058dc890f0968b61419d..c95d9230928381b64790030af129e0df7e788761 100644 (file)
@@ -34,7 +34,6 @@ Editor::hscrollbar_allocate (Gtk::Allocation &alloc)
 bool
 Editor::hscrollbar_button_press (GdkEventButton *ev)
 {
-       edit_hscroll_dragging = true;
        return true;
 }
 
@@ -42,11 +41,7 @@ bool
 Editor::hscrollbar_button_release (GdkEventButton *ev)
 {
        if (session) {
-               if (edit_hscroll_dragging) {
-                       // lets do a tempo redisplay only on button release, because it is dog slow
-                       tempo_map_changed (Change (0));
-                       edit_hscroll_dragging = false;
-               }
+
        }
 
        return true;
index db878bab4112e3ec916d24cf3eaf654b4ab2adcd..1cfd09d167b210692f7ad5c182b459119b44463f 100644 (file)
@@ -140,27 +140,27 @@ Editor::set_meter_falloff (int intval)
                 Config->set_meter_falloff_off(true);
                 break;
                case 1:
-                val = 0.266f;
+                val = 0.125f;
                 Config->set_meter_falloff_slowest(true);
                 break;
                case 2:
-                val = 0.342f;
+                val = 0.250f;
                 Config->set_meter_falloff_slow(true);
                 break;
                case 3:
-                val = 0.7f;
+                val = 0.375f;
                 Config->set_meter_falloff_medium(true);
                 break;
                case 4:
-                val = 1.1f;
+                val = 0.500f;
                 Config->set_meter_falloff_fast(true);
                 break;
                case 5:
-                val = 1.5f;
+                val = 0.750f;
                 Config->set_meter_falloff_faster(true);
                 break;
                case 6:
-                val = 2.5f;
+                val = 0.875f;
                 Config->set_meter_falloff_fastest(true);
                 break;
        }
index 5e906cb6172b3146c39b3bc4850c43cf180fac00..7dfeb7f2ae8b8fd56b422e8036b98c821a530dc5 100644 (file)
@@ -69,10 +69,14 @@ Editor::remove_metric_marks ()
 void
 Editor::draw_metric_marks (const Metrics& metrics)
 {
+
+        const MeterSection *ms;
+       const TempoSection *ts;
+       char buf[64];
+       
+       remove_metric_marks ();
+       
        for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
-               const MeterSection *ms;
-               const TempoSection *ts;
-               char buf[64];
                
                if ((ms = dynamic_cast<const MeterSection*>(*i)) != 0) {
                        snprintf (buf, sizeof(buf), "%g/%g", ms->beats_per_bar(), ms->note_divisor ());
@@ -85,12 +89,13 @@ Editor::draw_metric_marks (const Metrics& metrics)
                }
                
        }
+
 }
 
 void
 Editor::tempo_map_changed (Change ignored)
 {
-       ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::tempo_map_changed), ignored));
+        ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::tempo_map_changed), ignored));
        
        if (current_bbt_points) {
                delete current_bbt_points;
@@ -108,17 +113,13 @@ Editor::tempo_map_changed (Change ignored)
 
 void
 Editor::redisplay_tempo ()
-{
-       update_tempo_based_rulers ();
-
-       remove_metric_marks (); 
+{      
        hide_measures ();
 
        if (session && current_bbt_points) {
-               session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
                draw_measures ();
+               update_tempo_based_rulers ();
        }
-       
 }
 
 void
@@ -155,8 +156,8 @@ Editor::draw_measures ()
                return;
        }
 
-       TempoMap::BBTPointList::iterator i;
-       TempoMap::BBTPointList *all_bbt_points;
+       TempoMap::BBTPointList::iterator i = current_bbt_points->begin();
+       TempoMap::BBTPoint& p = (*i);
        ArdourCanvas::SimpleLine *line;
        gdouble xpos, last_xpos;
        uint32_t cnt;
@@ -166,8 +167,6 @@ Editor::draw_measures ()
                return;
        }
 
-       all_bbt_points = session->tempo_map().get_points (leftmost_frame, leftmost_frame + current_page_frames());
-
        cnt = 0;
        last_xpos = 0;
 
@@ -176,7 +175,7 @@ Editor::draw_measures ()
        gdouble last_beat = DBL_MAX;
        gdouble beat_spacing = 0;
 
-       for (i = all_bbt_points->begin(); i != all_bbt_points->end() && beat_spacing == 0; ++i) {
+       for (i = current_bbt_points->begin(); i != current_bbt_points->end() && beat_spacing == 0; ++i) {
                TempoMap::BBTPoint& p = (*i);
 
                switch (p.type) {
@@ -194,11 +193,11 @@ Editor::draw_measures ()
 
        double x1, x2, y1, y2;
        track_canvas.get_scroll_region (x1, y1, x2, y2);
-       y2 = 1000000000.0f;
+       //y2 = 1000000000.0f;
 
-       for (i = all_bbt_points->begin(); i != all_bbt_points->end(); ++i) {
+       for (i = current_bbt_points->begin(); i != current_bbt_points->end(); ++i) {
 
-               TempoMap::BBTPoint& p = (*i);
+               p = (*i);
 
                switch (p.type) {
                case TempoMap::Bar:
@@ -236,8 +235,6 @@ Editor::draw_measures ()
                }
        }
 
-       delete all_bbt_points;
-
        /* the cursors are always on top of everything */
 
        cursor_group->raise_to_top();
@@ -282,6 +279,8 @@ Editor::mouse_add_new_tempo_event (jack_nframes_t frame)
        commit_reversible_command ();
        
        map.dump (cerr);
+
+       session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
 }
 
 void
@@ -322,6 +321,8 @@ Editor::mouse_add_new_meter_event (jack_nframes_t frame)
        commit_reversible_command ();
        
        map.dump (cerr);
+
+       session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
 }
 
 void
@@ -372,6 +373,8 @@ Editor::edit_meter_section (MeterSection* section)
         XMLNode &after = session->tempo_map().get_state();
        session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
        commit_reversible_command ();
+
+       session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
 }
 
 void
@@ -402,6 +405,8 @@ Editor::edit_tempo_section (TempoSection* section)
         XMLNode &after = session->tempo_map().get_state();
        session->add_command (new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
        commit_reversible_command ();
+
+       session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
 }
 
 void
@@ -452,6 +457,8 @@ Editor::real_remove_tempo_marker (TempoSection *section)
        session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
        commit_reversible_command ();
 
+       session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
+
        return FALSE;
 }
 
@@ -485,5 +492,8 @@ Editor::real_remove_meter_marker (MeterSection *section)
        XMLNode &after = session->tempo_map().get_state();
        session->add_command(new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
        commit_reversible_command ();
+
+       session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
+
        return FALSE;
 }
index 5fa8c462bc3f08ccdd68cfe99413f97022858745..d2e829581a4c50b3957b346d755c1ba254468776 100644 (file)
@@ -465,7 +465,7 @@ GainMeter::reset_peak_display ()
 {
        max_peak = minus_infinity();
        peak_display_label.set_text (_("-Inf"));
-       peak_display.set_name ("Mixerstrippeakdisplay");
+       peak_display.set_name ("MixerStripPeakDisplay");
 }
 
 void
index d2550754f69e9ac650611b49d091baf3cab7a131..7d716e1bb894881a8fa3bf6e93f936e3ecde3822 100644 (file)
@@ -267,7 +267,7 @@ show_ui_callback (void *arg)
 void
 gui_jack_error ()
 {
-  MessageDialog win (_("Ardour could not connect to JACK."),
+       MessageDialog win (_("Ardour could not connect to JACK."),
                     false,
                     Gtk::MESSAGE_INFO,
                     (Gtk::ButtonsType)(Gtk::BUTTONS_NONE));
@@ -285,7 +285,11 @@ Please consider the possibilities, and perhaps (re)start JACK."));
        win.show_all ();
        win.set_position (Gtk::WIN_POS_CENTER);
 
-       /* we just don't care about the result */
+       if (!no_splash) {
+         ui->hide_splash ();
+       }
+
+       /* we just don't care about the result, but we want to block */
 
        win.run ();
 }
@@ -325,7 +329,7 @@ To create it from the command line, start ardour as \"ardour --new %1"), path) <
                ui->load_session (path, name);
 
        } else {
-       /*  TODO: This bit of code doesn't work properly yet
+         /*  TODO: This bit of code doesn't work properly yet
                Glib::signal_idle().connect (bind (mem_fun (*ui, &ARDOUR_UI::cmdline_new_session), path));
                ui->set_will_create_new_session_automatically (true); */
 
@@ -354,9 +358,6 @@ int main (int argc, char *argv[])
        ARDOUR::AudioEngine *engine;
        vector<Glib::ustring> null_file_list;
 
-        // needs a better home.
-        Glib::thread_init();
-        
        gtk_set_locale ();
 
        (void)   bindtextdomain (PACKAGE, LOCALEDIR);
@@ -410,11 +411,12 @@ int main (int argc, char *argv[])
                     << endl;
        }
 
-       try { 
-               ui = new ARDOUR_UI (&argc, &argv, which_ui_rcfile());
-       } 
+       // needs a better home.
+        Glib::thread_init();
 
-       catch (failed_constructor& err) {
+        try { 
+               ui = new ARDOUR_UI (&argc, &argv, which_ui_rcfile());
+       } catch (failed_constructor& err) {
                error << _("could not create ARDOUR GUI") << endmsg;
                exit (1);
        }
@@ -423,23 +425,29 @@ int main (int argc, char *argv[])
        if (!no_splash) {
                ui->show_splash ();
                if (session_name.length()) {  
-                       gtk_timeout_add (4000, show_ui_callback, ui);
+                       g_timeout_add (4000, show_ui_callback, ui);
                }
        }
-       
-       try { 
+
+
+       try { 
                engine = new ARDOUR::AudioEngine (jack_client_name);
-               ARDOUR::init (use_vst, try_hw_optimization);
-               ui->set_engine (*engine);
        } catch (AudioEngine::NoBackendAvailable& err) {
                gui_jack_error ();
                error << string_compose (_("Could not connect to JACK server as  \"%1\""), jack_client_name) <<  endmsg;
                return -1;
+       }
+
+       try {
+               ARDOUR::init (use_vst, try_hw_optimization);
+               ui->set_engine (*engine);
        } catch (failed_constructor& err) {
                error << _("could not initialize Ardour.") << endmsg;
                return -1;
        } 
 
+
        if (maybe_load_session ()) {
                ui->run (text_receiver);
                ui = 0;
index 9bc5f3d1a0d9163f78aeee8999dcf20bef24a8e9..1ba1be445e094d2a77416edefdd88b167f188bb1 100644 (file)
@@ -67,9 +67,7 @@ Mixer_UI::Mixer_UI (AudioEngine& eng)
        mix_group_context_menu = 0;
        no_track_list_redisplay = false;
        in_group_row_change = false;
-
-       XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
-       set_state (*node);
+       _visible = false;
 
        scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
        scroller_base.set_name ("MixerWindow");
@@ -213,7 +211,7 @@ Mixer_UI::Mixer_UI (AudioEngine& eng)
 
        add_accel_group (ActionManager::ui_manager->get_accel_group());
 
-       signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), static_cast<Gtk::Window *>(this)));
+       signal_delete_event().connect (mem_fun (*this, &Mixer_UI::hide_window));
        add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
 
        _plugin_selector = new PluginSelector (PluginManager::the_manager());
@@ -248,8 +246,17 @@ Mixer_UI::show_window ()
                ms = (*ri)[track_columns.strip];
                ms->set_width (ms->get_width());
        }
+       _visible = true;
+}
+
+bool
+Mixer_UI::hide_window (GdkEventAny *ev)
+{
+       _visible = false;
+       return just_hide_it(ev, static_cast<Gtk::Window *>(this));
 }
 
+
 void
 Mixer_UI::add_strip (Session::RouteList& routes)
 {
@@ -345,8 +352,12 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
 void
 Mixer_UI::connect_to_session (Session* sess)
 {
+
        session = sess;
 
+       XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
+       set_state (*node);
+
        string wintitle = _("ardour: mixer: ");
        wintitle += session->name();
        set_title (wintitle);
@@ -362,6 +373,10 @@ Mixer_UI::connect_to_session (Session* sess)
        
        _plugin_selector->set_session (session);
 
+       if (_visible) {
+              show_window();
+       }
+
        start_updating ();
 }
 
@@ -1048,6 +1063,12 @@ Mixer_UI::set_state (const XMLNode& node)
                }
        }
 
+       if ((prop = node.property ("show-mixer"))) {
+               if (prop->value() == "yes") {
+                      _visible = true;
+               }
+       }
+
        return 0;
 }
 
@@ -1089,6 +1110,8 @@ Mixer_UI::get_state (void)
 
        node->add_property ("narrow-strips", _strip_width == Narrow ? "yes" : "no");
 
+       node->add_property ("show-mixer", _visible ? "yes" : "no");
+
        return *node;
 }
 
index 77021dc8feb5b9795df0205a3f4df637ae6bcbfb..2a5b416ae0b995e8428cd72b5f60d117c31e2f19 100644 (file)
@@ -73,6 +73,7 @@ class Mixer_UI : public Gtk::Window
        int set_state (const XMLNode& );
 
        void show_window ();
+       bool hide_window (GdkEventAny *ev);
        void show_strip (MixerStrip *);
        void hide_strip (MixerStrip *);
 
@@ -83,6 +84,8 @@ class Mixer_UI : public Gtk::Window
   private:
        ARDOUR::AudioEngine&     engine;
        ARDOUR::Session         *session;
+
+       bool _visible;
        
        Gtk::HBox                global_hpacker;
        Gtk::VBox                global_vpacker;
index 993db62d59bd2940da001a668f3991d90d850d6d..462fb57711c4d037882a898909a98b33b47594bb 100644 (file)
@@ -31,6 +31,7 @@
 #include <gtkmm/radiobutton.h>
 #include <gtkmm/filefilter.h>
 #include <gtkmm/stock.h>
+#include <gdkmm/cursor.h>
 
 #include "opts.h"
 
@@ -63,7 +64,7 @@ NewSessionDialog::NewSessionDialog()
        input_port_limit_hbox = Gtk::manage(new class Gtk::HBox(false, 0));
        input_port_vbox = Gtk::manage(new class Gtk::VBox(false, 0));
        input_table = Gtk::manage(new class Gtk::Table(2, 2, false));
-       input_port_alignment = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1));
+
        input_label = Gtk::manage(new class Gtk::Label(_("<b>Track/Bus Inputs</b>")));
        input_frame = Gtk::manage(new class Gtk::Frame());
        m_connect_outputs = Gtk::manage(new class Gtk::CheckButton(_("Automatically Connect Outputs")));
@@ -79,7 +80,7 @@ NewSessionDialog::NewSessionDialog()
        m_connect_outputs_to_physical = Gtk::manage(new class Gtk::RadioButton(_RadioBGroup_m_connect_outputs_to_master, _("Connect to Physical Outputs")));
        output_conn_vbox = Gtk::manage(new class Gtk::VBox(false, 0));
        output_vbox = Gtk::manage(new class Gtk::VBox(false, 0));
-       output_port_alignment = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1));
+
        output_label = Gtk::manage(new class Gtk::Label(_("<b>Track/Bus Outputs</b>")));
        output_frame = Gtk::manage(new class Gtk::Frame());
        advanced_vbox = Gtk::manage(new class Gtk::VBox(false, 0));
@@ -90,7 +91,7 @@ NewSessionDialog::NewSessionDialog()
        open_session_hbox = Gtk::manage(new class Gtk::HBox(false, 0));
        m_treeview = Gtk::manage(new class Gtk::TreeView());
        recent_scrolledwindow = Gtk::manage(new class Gtk::ScrolledWindow());
-       recent_alignment = Gtk::manage(new class Gtk::Alignment(0.5, 0.5, 1, 1));
+
        recent_sesion_label = Gtk::manage(new class Gtk::Label(_("Open Recent Session")));
        recent_frame = Gtk::manage(new class Gtk::Frame());
        open_session_vbox = Gtk::manage(new class Gtk::VBox(false, 0));
@@ -167,7 +168,7 @@ NewSessionDialog::NewSessionDialog()
        input_table->set_row_spacings(0);
        input_table->set_col_spacings(0);
        input_table->attach(*input_port_vbox, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 6, 6);
-       input_port_alignment->add(*input_table);
+
        input_label->set_alignment(0, 0.5);
        input_label->set_padding(0,0);
        input_label->set_line_wrap(false);
@@ -175,7 +176,7 @@ NewSessionDialog::NewSessionDialog()
        input_label->set_use_markup(true);
        input_frame->set_shadow_type(Gtk::SHADOW_NONE);
        input_frame->set_label_align(0,0.5);
-       input_frame->add(*input_port_alignment);
+       input_frame->add(*input_table);
        input_frame->set_label_widget(*input_label);
        m_connect_outputs->set_flags(Gtk::CAN_FOCUS);
        m_connect_outputs->set_relief(Gtk::RELIEF_NORMAL);
@@ -212,7 +213,7 @@ NewSessionDialog::NewSessionDialog()
        output_vbox->set_border_width(6);
        output_vbox->pack_start(*output_port_vbox);
        output_vbox->pack_start(*output_conn_vbox);
-       output_port_alignment->add(*output_vbox);
+
        output_label->set_alignment(0, 0.5);
        output_label->set_padding(0,0);
        output_label->set_line_wrap(false);
@@ -220,7 +221,7 @@ NewSessionDialog::NewSessionDialog()
        output_label->set_use_markup(true);
        output_frame->set_shadow_type(Gtk::SHADOW_NONE);
        output_frame->set_label_align(0,0.5);
-       output_frame->add(*output_port_alignment);
+       output_frame->add(*output_vbox);
        output_frame->set_label_widget(*output_label);
        advanced_vbox->pack_start(*advanced_table, Gtk::PACK_SHRINK, 0);
        advanced_vbox->pack_start(*input_frame, Gtk::PACK_SHRINK, 12);
@@ -265,13 +266,13 @@ NewSessionDialog::NewSessionDialog()
        recent_scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
        recent_scrolledwindow->property_window_placement().set_value(Gtk::CORNER_TOP_LEFT);
        recent_scrolledwindow->add(*m_treeview);
-       recent_alignment->add(*recent_scrolledwindow);
+
        recent_sesion_label->set_padding(0,0);
        recent_sesion_label->set_line_wrap(false);
        recent_sesion_label->set_selectable(false);
        recent_frame->set_border_width(12);
        recent_frame->set_shadow_type(Gtk::SHADOW_IN);
-       recent_frame->add(*recent_alignment);
+       recent_frame->add(*recent_scrolledwindow);
        recent_frame->set_label_widget(*recent_sesion_label);
        open_session_vbox->pack_start(*open_session_hbox, Gtk::PACK_SHRINK, 12);
        open_session_vbox->pack_start(*recent_frame, Gtk::PACK_EXPAND_WIDGET, 0);
@@ -573,10 +574,13 @@ NewSessionDialog::file_chosen ()
 
        m_treeview->get_selection()->unselect_all();
 
+       get_window()->set_cursor(Gdk::Cursor(Gdk::WATCH));
+
        if (!m_open_filechooser->get_filename().empty()) {
-               set_response_sensitive (Gtk::RESPONSE_OK, true);
+               set_response_sensitive (Gtk::RESPONSE_OK, true);
+               response (Gtk::RESPONSE_OK);
        } else {
-               set_response_sensitive (Gtk::RESPONSE_OK, false);
+               set_response_sensitive (Gtk::RESPONSE_OK, false);
        }
 }
 
@@ -659,7 +663,7 @@ NewSessionDialog::reset_recent()
        RecentSessionsSorter cmp;
        
        recent_model->clear ();
-       
+
        ARDOUR::RecentSessions rs;
        ARDOUR::read_recent_sessions (rs);
        
index 5d652fd1222e20c3f1e8e84d67a84186c1f963b0..b175c1b79d151c1a74cfca50e6cb53af1e9d67a2 100644 (file)
@@ -101,14 +101,14 @@ protected:
        Gtk::HBox * input_port_limit_hbox;
        Gtk::VBox * input_port_vbox;
        Gtk::Table * input_table;
-       Gtk::Alignment * input_port_alignment;
+
        Gtk::Label * input_label;
        Gtk::Frame * input_frame;
        Gtk::HBox * output_port_limit_hbox;
        Gtk::VBox * output_port_vbox;
        Gtk::VBox * output_conn_vbox;
        Gtk::VBox * output_vbox;
-       Gtk::Alignment * output_port_alignment;
+
        Gtk::Label * output_label;
        Gtk::Frame * output_frame;
        Gtk::VBox * advanced_vbox;
@@ -117,7 +117,7 @@ protected:
        Gtk::Table * new_session_table;
        Gtk::HBox * open_session_hbox;
        Gtk::ScrolledWindow * recent_scrolledwindow;
-       Gtk::Alignment * recent_alignment;
+
        Gtk::Label * recent_sesion_label;
        Gtk::Frame * recent_frame;
        Gtk::VBox * open_session_vbox;
index 86c99cb7e3e24533f326a1d1b2d2c5691c70a2f7..1093450840ca007822134c28715b492a4078cfbd 100644 (file)
@@ -136,9 +136,10 @@ class Port : public sigc::trackable {
        }
        
        void ensure_monitor_input (bool yn) {
-               jack_port_request_monitor (_port, yn);
+               jack_port_ensure_monitor (_port, yn);
        }
-       
+
+       /*XXX completely bloody useless imho*/
        void request_monitor_input (bool yn) {
                jack_port_request_monitor (_port, yn);
        }
index a365717417c834dd24ffae08b5676f5356c358e9..9111aeba681428d88477deac06ef6fa85f6d57a8 100644 (file)
@@ -201,7 +201,7 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible
        typedef vector<BBTPoint> BBTPointList;
        
        template<class T> void apply_with_metrics (T& obj, void (T::*method)(const Metrics&)) {
-               Glib::Mutex::Lock lm (lock);
+               Glib::RWLock::ReaderLock lm (lock);
                (obj.*method)(*metrics);
        }
 
@@ -289,7 +289,7 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible
        jack_nframes_t      last_bbt_when;
        bool                last_bbt_valid;
        BBT_Time            last_bbt;
-       mutable Glib::Mutex   lock;
+       mutable Glib::RWLock    lock;
        
        void timestamp_metrics ();
 
index 57271068dcef0b0f28d7b10ebab8b1f83c15b0e0..c39f6ebf20bf6453538975c1056a1ad8de047365 100644 (file)
@@ -1713,7 +1713,7 @@ AudioDiskstream::engage_record_enable ()
        if (Config->get_use_hardware_monitoring())  {
                for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
                        if ((*chan).source) {
-                               (*chan).source->request_monitor_input (!(_session.get_auto_input() && rolling));
+                               (*chan).source->ensure_monitor_input (!(_session.get_auto_input() && rolling));
                        }
                        capturing_sources.push_back ((*chan).write_source);
                }
@@ -1733,7 +1733,7 @@ AudioDiskstream::disengage_record_enable ()
        if (Config->get_use_hardware_monitoring()) {
                for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
                        if ((*chan).source) {
-                               (*chan).source->request_monitor_input (false);
+                               (*chan).source->ensure_monitor_input (false);
                        }
                }
        }
@@ -2066,7 +2066,7 @@ AudioDiskstream::monitor_input (bool yn)
        for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
                
                if ((*chan).source) {
-                       (*chan).source->request_monitor_input (yn);
+                       (*chan).source->ensure_monitor_input (yn);
                }
        }
 }
index 5c45fa51b2defd9e441c6b0b15febe58cbe6e10d..659d638ad617c69f2217df38ce76dfd3d22c32a8 100644 (file)
@@ -334,7 +334,7 @@ AudioRegion::restore_state (StateManager::State& sstate)
        if (_fade_in_disabled != state->_fade_in_disabled) {
                if (_fade_in_disabled == 0 && state->_fade_in_disabled) {
                        set_fade_in_active (false);
-               } if (_fade_in_disabled && state->_fade_in_disabled == 0) {
+               } else if (_fade_in_disabled && state->_fade_in_disabled == 0) {
                        set_fade_in_active (true);
                }
                _fade_in_disabled = state->_fade_in_disabled;
@@ -343,7 +343,7 @@ AudioRegion::restore_state (StateManager::State& sstate)
        if (_fade_out_disabled != state->_fade_out_disabled) {
                if (_fade_out_disabled == 0 && state->_fade_out_disabled) {
                        set_fade_out_active (false);
-               } if (_fade_out_disabled && state->_fade_out_disabled == 0) {
+               } else if (_fade_out_disabled && state->_fade_out_disabled == 0) {
                        set_fade_out_active (true);
                }
                _fade_out_disabled = state->_fade_out_disabled;
index 107fae25851ff05fe2db6dbf6d992fcf75308d61..45040750b410dbc5e1c0d2e01c3f87395e95f863 100644 (file)
@@ -2110,7 +2110,7 @@ void
 Route::toggle_monitor_input ()
 {
        for (vector<Port*>::iterator i = _inputs.begin(); i != _inputs.end(); ++i) {
-               (*i)->request_monitor_input(!(*i)->monitoring_input());
+               (*i)->ensure_monitor_input(!(*i)->monitoring_input());
        }
 }
 
index 48f6796165a77ee6537a1b082c2b87cc6b1bbf79..6cddfb026ae8d22e713ee9b8419caf6160d76f07 100644 (file)
@@ -243,7 +243,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        shuttle_speed_threshold = 5;
        rf_speed = 2.0;
        _meter_hold = 100; // XXX unknown units: number of calls to meter::set()
-       _meter_falloff = 1.5f; // XXX unknown units: refresh_rate
+       _meter_falloff = 0.375f; // XXX unknown units: refresh_rate
        max_level = 0;
        min_level = 0;
 
index c0e52279e1bd7280633b38eddd6371ddb23471c7..02884f062bbc9c180bc2a40442c673ed3c2dac07 100644 (file)
@@ -241,7 +241,7 @@ TempoMap::move_metric_section (MetricSection& section, const BBT_Time& when)
                return 1;
        }
 
-       Glib::Mutex::Lock lm (lock);
+       Glib::RWLock::WriterLock  lm (lock);
        MetricSectionSorter cmp;
        BBT_Time corrected (when);
        
@@ -284,7 +284,7 @@ TempoMap::remove_tempo (const TempoSection& tempo)
        bool removed = false;
 
        {
-               Glib::Mutex::Lock lm (lock);
+               Glib::RWLock::WriterLock lm (lock);
                Metrics::iterator i;
 
                for (i = metrics->begin(); i != metrics->end(); ++i) {
@@ -311,7 +311,7 @@ TempoMap::remove_meter (const MeterSection& tempo)
        bool removed = false;
 
        {
-               Glib::Mutex::Lock lm (lock);
+               Glib::RWLock::WriterLock lm (lock);
                Metrics::iterator i;
 
                for (i = metrics->begin(); i != metrics->end(); ++i) {
@@ -362,7 +362,7 @@ void
 TempoMap::add_tempo (const Tempo& tempo, BBT_Time where)
 {
        {
-               Glib::Mutex::Lock lm (lock);
+               Glib::RWLock::WriterLock lm (lock);
 
                /* new tempos always start on a beat */
        
@@ -382,7 +382,7 @@ TempoMap::replace_tempo (TempoSection& existing, const Tempo& replacement)
        bool replaced = false;
 
        { 
-               Glib::Mutex::Lock lm (lock);
+               Glib::RWLock::WriterLock lm (lock);
                Metrics::iterator i;
                
                for (i = metrics->begin(); i != metrics->end(); ++i) {
@@ -412,7 +412,7 @@ void
 TempoMap::add_meter (const Meter& meter, BBT_Time where)
 {
        {
-               Glib::Mutex::Lock lm (lock);
+               Glib::RWLock::WriterLock lm (lock);
 
                /* a new meter always starts a new bar on the first beat. so
                   round the start time appropriately. remember that
@@ -444,7 +444,7 @@ TempoMap::replace_meter (MeterSection& existing, const Meter& replacement)
        bool replaced = false;
 
        { 
-               Glib::Mutex::Lock lm (lock);
+               Glib::RWLock::WriterLock lm (lock);
                Metrics::iterator i;
                
                for (i = metrics->begin(); i != metrics->end(); ++i) {
@@ -612,8 +612,10 @@ TempoMap::metric_at (BBT_Time bbt) const
 void
 TempoMap::bbt_time (jack_nframes_t frame, BBT_Time& bbt) const
 {
-       Glib::Mutex::Lock lm (lock);
-       bbt_time_unlocked (frame, bbt);
+        {
+               Glib::RWLock::ReaderLock lm (lock);
+               bbt_time_unlocked (frame, bbt);
+       }
 }
 
 void
@@ -760,7 +762,7 @@ TempoMap::bbt_duration_at (jack_nframes_t pos, const BBT_Time& bbt, int dir) con
        bbt_time(pos,when);
 
        {
-               Glib::Mutex::Lock lm (lock);
+               Glib::RWLock::ReaderLock lm (lock);
                frames = bbt_duration_at_unlocked (when, bbt,dir);
        }
 
@@ -897,23 +899,26 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i
 jack_nframes_t
 TempoMap::round_to_bar (jack_nframes_t fr, int dir)
 {
-       Glib::Mutex::Lock lm (lock);
-       return round_to_type (fr, dir, Bar);
+        {
+               Glib::RWLock::ReaderLock lm (lock);
+               return round_to_type (fr, dir, Bar);
+       }
 }
 
 
 jack_nframes_t
 TempoMap::round_to_beat (jack_nframes_t fr, int dir)
 {
-       Glib::Mutex::Lock lm (lock);
-       return round_to_type (fr, dir, Beat);
+        {
+               Glib::RWLock::ReaderLock lm (lock);
+               return round_to_type (fr, dir, Beat);
+       }
 }
 
 jack_nframes_t
 
 TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num)
 {
-        Glib::Mutex::Lock lm (lock);
         TempoMap::BBTPointList::iterator i;
         TempoMap::BBTPointList *more_zoomed_bbt_points;
         jack_nframes_t frame_one_beats_worth;
@@ -926,9 +931,11 @@ TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num)
         int n;
 
        frame_one_beats_worth = (jack_nframes_t) ::floor ((double)  _frame_rate *  60 / 20 ); //one beat @ 20 bpm
-       more_zoomed_bbt_points = get_points((fr >= frame_one_beats_worth) ? 
+        {
+         Glib::RWLock::ReaderLock lm (lock);
+         more_zoomed_bbt_points = get_points((fr >= frame_one_beats_worth) ? 
                                            fr - frame_one_beats_worth : 0, fr+frame_one_beats_worth );
-
+       }
        if (more_zoomed_bbt_points == 0 || more_zoomed_bbt_points->empty()) {
                return fr;
        }
@@ -1030,6 +1037,11 @@ TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const
        const TempoSection* t;
        uint32_t bar;
        uint32_t beat;
+       double beats_per_bar;
+       double beat_frame;
+       double beat_frames;
+       double frames_per_bar;
+       jack_nframes_t limit;
 
        meter = &first_meter ();
        tempo = &first_tempo ();
@@ -1069,17 +1081,12 @@ TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const
        }
 
        points = new BBTPointList;
+               
+       beats_per_bar = meter->beats_per_bar ();
+       frames_per_bar = meter->frames_per_bar (*tempo, _frame_rate);
+       beat_frames = tempo->frames_per_beat (_frame_rate);
 
        do {
-               double beats_per_bar;
-               double beat_frame;
-               double beat_frames;
-               double frames_per_bar;
-               jack_nframes_t limit;
-               
-               beats_per_bar = meter->beats_per_bar ();
-               frames_per_bar = meter->frames_per_bar (*tempo, _frame_rate);
-               beat_frames = tempo->frames_per_beat (_frame_rate);
 
                if (i == metrics->end()) {
                        limit = upper;
@@ -1186,12 +1193,14 @@ TempoMap::meter_at (jack_nframes_t frame)
 XMLNode&
 TempoMap::get_state ()
 {
-       Glib::Mutex::Lock lm (lock);
        Metrics::const_iterator i;
        XMLNode *root = new XMLNode ("TempoMap");
 
-       for (i = metrics->begin(); i != metrics->end(); ++i) {
-               root->add_child_nocopy ((*i)->get_state());
+       {
+                Glib::RWLock::ReaderLock lm (lock);
+               for (i = metrics->begin(); i != metrics->end(); ++i) {
+                       root->add_child_nocopy ((*i)->get_state());
+               }
        }
 
        return *root;
@@ -1201,7 +1210,7 @@ int
 TempoMap::set_state (const XMLNode& node)
 {
        {
-               Glib::Mutex::Lock lm (lock);
+               Glib::RWLock::WriterLock lm (lock);
 
                XMLNodeList nlist;
                XMLNodeConstIterator niter;
@@ -1293,7 +1302,7 @@ TempoMap::get_memento () const
 Change
 TempoMap::restore_state (StateManager::State& state)
 {
-       Glib::Mutex::Lock lm (lock);
+       Glib::RWLock::ReaderLock lm (lock);
 
        TempoMapState* tmstate = dynamic_cast<TempoMapState*> (&state);
 
index c8633d9e524c30437587c80e303fcb3aa190c8d5..17db545cf78894acb4525659e7bb794c3d08523a 100644 (file)
@@ -84,7 +84,7 @@ void
 Track::toggle_monitor_input ()
 {
        for (vector<Port*>::iterator i = _inputs.begin(); i != _inputs.end(); ++i) {
-               (*i)->request_monitor_input(!(*i)->monitoring_input());
+               (*i)->ensure_monitor_input(!(*i)->monitoring_input());
        }
 }
 
@@ -167,12 +167,6 @@ Track::set_record_enable (bool yn, void *src)
                return;
        }
 
-       // Do not set rec enabled if the track can't record.
-       if (yn && !can_record()) {
-               error << string_compose( _("Can not arm track '%1'. Check the input connections"), name() ) << endmsg;
-               return;
-       }
-
        /* keep track of the meter point as it was before we rec-enabled */
        if (!_diskstream->record_enabled()) {
                _saved_meter_point = _meter_point;
index ba2a3cf76e71e3c7309b2fc090a1b945b38f8f33..2e051b5be80089b9a54a2f5da7260c7690e3e17f 100644 (file)
@@ -51,7 +51,7 @@ void
 AutoSpin::stop_timer ()
 {
        if (have_timer) {
-               gtk_timeout_remove (timeout_tag);
+               g_source_remove (timeout_tag);
                have_timer = false;     
        }
 }
@@ -151,7 +151,7 @@ AutoSpin::start_spinning (bool decrement, bool page)
        
        have_timer = true;
        timer_calls = 0;
-       timeout_tag = gtk_timeout_add (initial_timer_interval,
+       timeout_tag = g_timeout_add (initial_timer_interval,
                                       AutoSpin::_timer,
                                       this);
 }
@@ -216,7 +216,7 @@ AutoSpin::timer ()
                   request a much more frequent update.
                */
                
-               timeout_tag = gtk_timeout_add (timer_interval,
+               timeout_tag = g_timeout_add (timer_interval,
                                               _timer,
                                               this);
                have_timer = true;
index a8ffc4af669526baaca8ec481899d5dc36e6a842..0b150eefe119b1dbd6a264cfb39ea26377ae4059 100644 (file)
@@ -74,7 +74,7 @@ PopUp::remove ()
        hide ();
 
        if (popdown_time != 0 && timeout != -1) {
-               gtk_timeout_remove (timeout);
+               g_source_remove (timeout);
        }
 
        if (delete_on_hide) {
@@ -94,7 +94,7 @@ PopUp::touch ()
                show_all ();
                
                if (popdown_time != 0) {
-                       timeout = gtk_timeout_add (popdown_time, 
+                       timeout = g_timeout_add (popdown_time, 
                                                   remove_prompt_timeout, 
                                                   this);
                }
@@ -127,12 +127,12 @@ PopUp::on_delete_event (GdkEventAny* ev)
        hide();
 
        if (popdown_time != 0 && timeout != -1) {
-               gtk_timeout_remove (timeout);
+               g_source_remove (timeout);
        }       
 
        if (delete_on_hide) {
                std::cerr << "deleting prompter\n" << endl;
-               gtk_idle_add (idle_delete, this);
+               g_idle_add (idle_delete, this);
        }
 
        return true;
index 7302de66e72f82bb9817de8872ecd79773c8243f..ee9a5578bad7aa1fb842847fe6bf389f10b74092 100644 (file)
@@ -220,13 +220,13 @@ TreeView_Selector::on_button_press_event(GdkEventButton* ev)
 
        if (ev && (ev->type == GDK_BUTTON_RELEASE || ev->type == GDK_2BUTTON_PRESS)) {
                if (ev->state & Gdk::CONTROL_MASK) {
-                       gtk_idle_add (Selector::_control_clicked, this);
+                       g_idle_add (Selector::_control_clicked, this);
                } else if (ev->state & Gdk::SHIFT_MASK) {
-                       gtk_idle_add (Selector::_shift_clicked, this);
+                       g_idle_add (Selector::_shift_clicked, this);
                } else if (ev->type == GDK_2BUTTON_PRESS) {
-                       gtk_idle_add (Selector::_accept, this);
+                       g_idle_add (Selector::_accept, this);
                } else {
-                       gtk_idle_add (Selector::_chosen, this);
+                       g_idle_add (Selector::_chosen, this);
                }
        }