diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-04-29 22:39:21 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-04-29 22:39:21 +0000 |
commit | a22f25559f6160f7889fd3249c9e1b6bcab47475 (patch) | |
tree | 64873b6d5f1da05b1b171dabbc9b48b13dd317f1 | |
parent | 87726495c30f90554b5204b5385d17274a8fe93e (diff) |
merged -r1752:HEAD from trunk
git-svn-id: svn://localhost/ardour2/branches/2.1-staging@1763 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour.colors | 4 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 43 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/automation_time_axis.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_mixer.cc | 16 | ||||
-rw-r--r-- | gtk2_ardour/enums.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 37 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.h | 6 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 9 | ||||
-rw-r--r-- | libs/ardour/audioengine.cc | 1 | ||||
-rw-r--r-- | libs/ardour/insert.cc | 2 | ||||
-rw-r--r-- | libs/ardour/io.cc | 12 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 2 | ||||
-rw-r--r-- | tools/osx_packaging/ardour2_mac_ui.rc | 1 |
16 files changed, 103 insertions, 49 deletions
diff --git a/gtk2_ardour/ardour.colors b/gtk2_ardour/ardour.colors index fa89646e09..5d6dddbe79 100644 --- a/gtk2_ardour/ardour.colors +++ b/gtk2_ardour/ardour.colors @@ -14,9 +14,9 @@ cTransportMarkerBar 0.60 0.60 0.64 1.0 cTimeStretchFill 0.89 0.71 0.71 0.59 cTimeStretchOutline 0.39 0.39 0.39 0.59 cAutomationLine 0.27 0.74 0.35 1.0 -cLeftPanAutomationLine 0.77 0.24 0.01 1.0 +cLeftPanAutomationLine 0.87 0.44 0.11 1.0 cRightPanAutomationLine 0.03 0.26 0.73 1.0 -cRedirectAutomationLine 0.28 0.34 0.74 1.0 +cRedirectAutomationLine 0.48 0.64 0.98 1.0 cControlPointFill 0 0 0 1.0 cControlPointOutline 0 0 0 1.0 cEnteredControlPointOutline 1.0 0.21 0.21 1.0 diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 74234bb12a..ca0506878e 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -947,9 +947,30 @@ ARDOUR_UI::filter_ardour_session_dirs (const FileFilter::Info& info) return S_ISREG (statbuf.st_mode); } +bool +ARDOUR_UI::check_audioengine () +{ + if (engine) { + if (!engine->connected()) { + MessageDialog msg (_("Ardour is not connected to JACK\n" + "You cannot open or close sessions in this condition")); + msg.run (); + return false; + } + return true; + } else { + return false; + } +} + void ARDOUR_UI::open_session () { + if (!check_audioengine()) { + return; + + } + /* popup selector window */ if (open_session_selector == 0) { @@ -1751,9 +1772,7 @@ ARDOUR_UI::new_session (std::string predetermined_path) string session_name; string session_path; - if (!engine->connected()) { - MessageDialog msg (_("Ardour is not connected to JACK at this time. Creating new sessions is not possible.")); - msg.run (); + if (!check_audioengine()) { return false; } @@ -1768,10 +1787,8 @@ ARDOUR_UI::new_session (std::string predetermined_path) do { response = new_session_dialog->run (); - if (!engine->connected()) { + if (!check_audioengine()) { new_session_dialog->hide (); - MessageDialog msg (_("Ardour is not connected to JACK at this time. Creating new sessions is not possible.")); - msg.run (); return false; } @@ -1964,6 +1981,10 @@ ARDOUR_UI::new_session (std::string predetermined_path) void ARDOUR_UI::close_session() { + if (!check_audioengine()) { + return; + } + unload_session(); new_session (); } @@ -1975,6 +1996,10 @@ ARDOUR_UI::load_session (const string & path, const string & snap_name, string* int x; session_loaded = false; + if (!check_audioengine()) { + return -1; + } + x = unload_session (); if (x < 0) { @@ -2031,8 +2056,14 @@ ARDOUR_UI::build_session (const string & path, const string & snap_name, Session *new_session; int x; + if (!check_audioengine()) { + return -1; + } + session_loaded = false; + x = unload_session (); + if (x < 0) { return -1; } else if (x > 0) { diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 1ebb7407af..b99c422dca 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -257,6 +257,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI ARDOUR::AudioEngine *engine; ARDOUR::Session *session; + bool check_audioengine(); + Gtk::Tooltips _tooltips; void goto_editor_window (); diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index e9657e1f4f..12998ee7d6 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -73,7 +73,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro base_rect = new SimpleRect(*canvas_display); base_rect->property_x1() = 0.0; base_rect->property_y1() = 0.0; - base_rect->property_x2() = max_frames; + base_rect->property_x2() = editor.frame_to_pixel (max_frames); base_rect->property_outline_color_rgba() = color_map[cAutomationTrackOutline]; /* outline ends and bottom */ base_rect->property_outline_what() = (guint32) (0x1|0x2|0x8); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index a9a9a39511..d79bd5b2c7 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -27,7 +27,7 @@ #include <pbd/convert.h> #include <pbd/error.h> -#include <pbd/stacktrace.h> +#include <pbd/enumwriter.h> #include <pbd/memento_command.h> #include <glibmm/miscutils.h> @@ -2041,6 +2041,10 @@ Editor::set_state (const XMLNode& node) edit_cursor->set_position (0); } + if ((prop = node.property ("mixer-width"))) { + editor_mixer_strip_width = Width (string_2_enum (prop->value(), editor_mixer_strip_width)); + } + if ((prop = node.property ("zoom-focus"))) { set_zoom_focus ((ZoomFocus) atoi (prop->value())); } @@ -2181,6 +2185,8 @@ Editor::get_state () node->add_child_nocopy (*geometry); } + maybe_add_mixer_strip_width (*node); + snprintf (buf, sizeof(buf), "%d", (int) zoom_focus); node->add_property ("zoom-focus", buf); snprintf (buf, sizeof(buf), "%f", frames_per_unit); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index ae7201dbbd..bbdc107652 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -264,6 +264,7 @@ class Editor : public PublicEditor TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0); Width editor_mixer_strip_width; + void maybe_add_mixer_strip_width (XMLNode&); void show_editor_mixer (bool yn); void set_selected_mixer_strip (TimeAxisView&); void hide_track_in_display (TimeAxisView& tv); diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index e37c7c7fe3..95f59d46d5 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -20,6 +20,9 @@ #include <glibmm/miscutils.h> #include <gtkmm2ext/utils.h> #include <gtkmm2ext/window_title.h> + +#include <pbd/enumwriter.h> + #include <ardour/audioengine.h> #include "editor.h" @@ -32,6 +35,7 @@ #include "i18n.h" using namespace Gtkmm2ext; +using namespace PBD; void Editor::editor_mixer_button_toggled () @@ -107,8 +111,8 @@ Editor::show_editor_mixer (bool yn) current_mixer_strip->set_embedded (true); current_mixer_strip->Hiding.connect (mem_fun(*this, &Editor::current_mixer_strip_hidden)); current_mixer_strip->GoingAway.connect (mem_fun(*this, &Editor::current_mixer_strip_removed)); - current_mixer_strip->set_width (editor_mixer_strip_width); - + current_mixer_strip->set_width (editor_mixer_strip_width, (void*) this); + global_hpacker.pack_start (*current_mixer_strip, Gtk::PACK_SHRINK ); global_hpacker.reorder_child (*current_mixer_strip, 0); @@ -355,3 +359,11 @@ Editor::session_going_away () session = 0; } + +void +Editor::maybe_add_mixer_strip_width (XMLNode& node) +{ + if (current_mixer_strip) { + node.add_property ("mixer-width", enum_2_string (current_mixer_strip->get_width())); + } +} diff --git a/gtk2_ardour/enums.cc b/gtk2_ardour/enums.cc index 9943d52258..e6c81598fb 100644 --- a/gtk2_ardour/enums.cc +++ b/gtk2_ardour/enums.cc @@ -20,6 +20,7 @@ #include <pbd/enumwriter.h> #include "audio_clock.h" +#include "enums.h" using namespace std; using namespace PBD; @@ -33,6 +34,7 @@ setup_gtk_ardour_enums () vector<string> s; AudioClock::Mode clock_mode; + Width width; #define REGISTER(e) enum_writer.register_distinct (typeid(e).name(), i, s); i.clear(); s.clear() #define REGISTER_BITS(e) enum_writer.register_bits (typeid(e).name(), i, s); i.clear(); s.clear() @@ -45,4 +47,8 @@ setup_gtk_ardour_enums () REGISTER_CLASS_ENUM (AudioClock, Frames); REGISTER_CLASS_ENUM (AudioClock, Off); REGISTER (clock_mode); + + REGISTER_ENUM (Wide); + REGISTER_ENUM (Narrow); + REGISTER (width); } diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 8ac941e4e5..6be59ed044 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -23,6 +23,7 @@ #include <sigc++/bind.h> #include <pbd/convert.h> +#include <pbd/enumwriter.h> #include <gtkmm2ext/gtk_ui.h> #include <gtkmm2ext/utils.h> @@ -112,6 +113,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt ignore_speed_adjustment = false; comment_window = 0; comment_area = 0; + _width_owner = 0; width_button.add (*(manage (new Gtk::Image (::get_icon("strip_width"))))); hide_button.add (*(manage (new Gtk::Image (::get_icon("hide"))))); @@ -370,19 +372,10 @@ MixerStrip::set_stuff_from_route () ensure_xml_node (); + /* if width is not set, it will be set by the MixerUI or editor */ + if ((prop = xml_node->property ("strip_width")) != 0) { - if (prop->value() == "wide") { - set_width (Wide); - } else if (prop->value() == "narrow") { - set_width (Narrow); - } - else { - error << string_compose(_("unknown strip width \"%1\" in XML GUI information"), prop->value()) << endmsg; - set_width (Wide); - } - } - else { - set_width (Wide); + set_width (Width (string_2_enum (prop->value(), _width)), this); } if ((prop = xml_node->property ("shown_mixer")) != 0) { @@ -398,14 +391,17 @@ MixerStrip::set_stuff_from_route () } void -MixerStrip::set_width (Width w) +MixerStrip::set_width (Width w, void* owner) { /* always set the gpm width again, things may be hidden */ + gpm.set_width (w); panners.set_width (w); pre_redirect_box.set_width (w); post_redirect_box.set_width (w); - + + _width_owner = owner; + if (_width == w) { return; } @@ -413,11 +409,14 @@ MixerStrip::set_width (Width w) ensure_xml_node (); _width = w; - + + if (_width_owner == this) { + xml_node->add_property ("strip_width", enum_2_string (_width)); + } + switch (w) { case Wide: set_size_request (-1, -1); - xml_node->add_property ("strip_width", "wide"); if (rec_enable_button) { ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("record")); @@ -441,8 +440,6 @@ MixerStrip::set_width (Width w) break; case Narrow: - xml_node->add_property ("strip_width", "narrow"); - if (rec_enable_button) { ((Gtk::Label*)rec_enable_button->get_child())->set_text (_("Rec")); } @@ -1095,10 +1092,10 @@ MixerStrip::width_clicked () { switch (_width) { case Wide: - set_width (Narrow); + set_width (Narrow, this); break; case Narrow: - set_width (Wide); + set_width (Wide, this); break; } } diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index ea2569b644..7e92f83579 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -85,12 +85,13 @@ class MixerStrip : public RouteUI, public Gtk::EventBox MixerStrip (Mixer_UI&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, bool in_mixer = true); ~MixerStrip (); - void set_width (Width); + void set_width (Width, void* owner); Width get_width() const { return _width; } + void* width_owner() const { return _width_owner; } void fast_update (); void set_embedded (bool); - + ARDOUR::RouteGroup* mix_group() const; protected: @@ -107,6 +108,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox bool _embedded; bool _packed; Width _width; + void* _width_owner; Gtk::Button hide_button; Gtk::Button width_button; diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index cbd9cfe083..766db2938f 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -244,7 +244,7 @@ Mixer_UI::show_window () for (ri = rows.begin(); ri != rows.end(); ++ri) { ms = (*ri)[track_columns.strip]; - ms->set_width (ms->get_width()); + ms->set_width (ms->get_width(), ms->width_owner()); } _visible = true; } @@ -274,7 +274,10 @@ Mixer_UI::add_strip (Session::RouteList& routes) strip = new MixerStrip (*this, *session, route); strips.push_back (strip); - strip->set_width (_strip_width); + if (strip->width_owner() != strip) { + strip->set_width (_strip_width, this); + } + show_strip (strip); no_track_list_redisplay = true; @@ -1040,7 +1043,7 @@ Mixer_UI::set_strip_width (Width w) _strip_width = w; for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) { - (*i)->set_width (w); + (*i)->set_width (w, this); } } diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index bb91625583..3654e647a3 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -762,6 +762,7 @@ AudioEngine::halted (void *arg) ae->_running = false; ae->_buffer_size = 0; ae->_frame_rate = 0; + ae->_jack = 0; ae->Halted(); /* EMIT SIGNAL */ } diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc index 11d41cfab4..ccc73946b5 100644 --- a/libs/ardour/insert.cc +++ b/libs/ardour/insert.cc @@ -415,7 +415,7 @@ PluginInsert::automation_run (vector<Sample *>& bufs, uint32_t nbufs, nframes_t while (nframes) { - nframes_t cnt = min (((nframes_t) floor (next_event.when) - now), nframes); + nframes_t cnt = min (((nframes_t) ceil (next_event.when) - now), nframes); connect_and_run (bufs, nbufs, cnt, offset, true, now); diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index f899b71d1e..0bda946d11 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -343,11 +343,7 @@ IO::pan (vector<Sample*>& bufs, uint32_t nbufs, nframes_t nframes, nframes_t off memcpy (dst, bufs[0], sizeof (Sample) * nframes); for (n = 1; n < nbufs; ++n) { - src = bufs[n]; - - for (nframes_t n = 0; n < nframes; ++n) { - dst[n] += src[n]; - } + Session::mix_buffers_no_gain(dst,bufs[n],nframes); } output(0)->mark_silence (false); @@ -365,11 +361,7 @@ IO::pan (vector<Sample*>& bufs, uint32_t nbufs, nframes_t nframes, nframes_t off } for (n = 1; n < nbufs; ++n) { - src = bufs[n]; - - for (nframes_t n = 0; n < nframes; ++n) { - dst[n] += src[n] * gain_coeff; - } + Session::mix_buffers_with_gain(dst,bufs[n],nframes,gain_coeff); } output(0)->mark_silence (false); diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index efd2d180f2..b499866395 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -689,7 +689,7 @@ Session::save_state (string snapshot_name, bool pending) tmp_path += snapshot_name; tmp_path += ".tmp"; - cerr << "actually writing state to " << xml_path << endl; + // cerr << "actually writing state to " << xml_path << endl; if (!tree.write (tmp_path)) { error << string_compose (_("state could not be saved to %1"), tmp_path) << endmsg; diff --git a/tools/osx_packaging/ardour2_mac_ui.rc b/tools/osx_packaging/ardour2_mac_ui.rc index 6528257e74..977bc649e5 100644 --- a/tools/osx_packaging/ardour2_mac_ui.rc +++ b/tools/osx_packaging/ardour2_mac_ui.rc @@ -448,6 +448,7 @@ style "editor_hscrollbar" = "ardour_adjusters" # make it bigger. # GtkRange::slider_width = 27 + GtkScrollbar::slider_width = 27 } style "ardour_progressbars" = "default_buttons_menus" |