diff options
-rw-r--r-- | gtk2_ardour/automation_time_axis.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/main.cc | 73 | ||||
-rw-r--r-- | gtk2_ardour/new_session_dialog.cc | 73 | ||||
-rw-r--r-- | gtk2_ardour/new_session_dialog.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/opts.cc | 7 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/track.h | 2 | ||||
-rw-r--r-- | libs/ardour/io.cc | 2 | ||||
-rw-r--r-- | libs/ardour/track.cc | 20 |
9 files changed, 103 insertions, 81 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 6e2a93889f..7025a11178 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -102,7 +102,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro } } name_label.set_text (shortpname); - name_label.set_alignment (1.0, 0.5); + name_label.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); if (nomparent.length()) { @@ -118,7 +118,6 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro plugname = new Label (pname); plugname->set_name (X_("TrackPlugName")); - plugname->set_alignment (1.0, 0.5); plugname->show(); name_label.set_name (X_("TrackParameterName")); controls_table.remove (name_hbox); diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index 047bb130a4..d2550754f6 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -293,60 +293,43 @@ Please consider the possibilities, and perhaps (re)start JACK.")); static bool maybe_load_session () { + /* If no session name is given: we're not loading a session yet, nor creating a new one */ + if (!session_name.length()) { + ui->hide_splash (); + if (!Config->get_no_new_session_dialog()) { + ui->new_session (true); + } - /* load session, if given */ - string name, path; - - if (session_name.length()){ - bool isnew; - - if (Session::find_session (session_name, path, name, isnew)) { - error << string_compose(_("could not load command line session \"%1\""), session_name) << endmsg; - } else { - - if (new_session) { - - /* command line required that the session be new */ - - if (isnew) { - - /* popup the new session dialog - once everything else is OK. - */ - - Glib::signal_idle().connect (bind (mem_fun (*ui, &ARDOUR_UI::cmdline_new_session), path)); - ui->set_will_create_new_session_automatically (true); - - } else { - - /* it wasn't new, but we require a new session */ + return true; + } - error << string_compose (_("\n\nA session named \"%1\" already exists.\n\ -To avoid this message, start ardour as \"ardour %1"), path) - << endmsg; - return false; - } + /* Load session or start the new session dialog */ + string name, path; - } else { + bool isnew; - /* command line didn't require a new session */ - - if (isnew) { - error << string_compose (_("\n\nNo session named \"%1\" exists.\n\ -To create it from the command line, start ardour as \"ardour --new %1"), path) - << endmsg; - return false; - } + if (Session::find_session (session_name, path, name, isnew)) { + error << string_compose(_("could not load command line session \"%1\""), session_name) << endmsg; + return false; + } - ui->load_session (path, name); - } + if (!new_session) { + + /* Loading a session, but the session doesn't exist */ + if (isnew) { + error << string_compose (_("\n\nNo session named \"%1\" exists.\n\ +To create it from the command line, start ardour as \"ardour --new %1"), path) << endmsg; + return false; } - if (no_splash) { - ui->show(); - } + ui->load_session (path, name); } else { + /* 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); */ + + /* Show the NSD */ ui->hide_splash (); if (!Config->get_no_new_session_dialog()) { ui->new_session (true); diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc index d1059cebe0..47a2b2b6d3 100644 --- a/gtk2_ardour/new_session_dialog.cc +++ b/gtk2_ardour/new_session_dialog.cc @@ -32,12 +32,15 @@ #include <gtkmm/filefilter.h> #include <gtkmm/stock.h> +#include "opts.h" NewSessionDialog::NewSessionDialog() : ArdourDialog ("New Session Dialog") { session_name_label = Gtk::manage(new class Gtk::Label(_("New Session Name :"))); m_name = Gtk::manage(new class Gtk::Entry()); + m_name->set_text(GTK_ARDOUR::session_name); + session_location_label = Gtk::manage(new class Gtk::Label(_("Create Session Directory In :"))); m_folder = Gtk::manage(new class Gtk::FileChooserButton(Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER)); session_template_label = Gtk::manage(new class Gtk::Label(_("Use Session Template :"))); @@ -324,13 +327,21 @@ NewSessionDialog::NewSessionDialog() m_folder->set_current_folder(getenv ("HOME")); m_folder->set_title(_("select directory")); - set_default_response (Gtk::RESPONSE_OK); - set_response_sensitive (Gtk::RESPONSE_OK, false); - set_response_sensitive (Gtk::RESPONSE_NONE, false); + on_new_session_page = true; m_notebook->set_current_page(0); m_notebook->show(); m_notebook->show_all_children(); + + set_default_response (Gtk::RESPONSE_OK); + if (!GTK_ARDOUR::session_name.length()) { + set_response_sensitive (Gtk::RESPONSE_OK, false); + set_response_sensitive (Gtk::RESPONSE_NONE, false); + } else { + set_response_sensitive (Gtk::RESPONSE_OK, true); + set_response_sensitive (Gtk::RESPONSE_NONE, true); + } + ///@ connect some signals m_connect_inputs->signal_clicked().connect (mem_fun (*this, &NewSessionDialog::connect_inputs_clicked)); @@ -501,11 +512,11 @@ NewSessionDialog::reset_name() bool NewSessionDialog::entry_key_release (GdkEventKey* ev) { - if (m_name->get_text() != "") { - set_response_sensitive (Gtk::RESPONSE_OK, true); + if (m_name->get_text() != "") { + set_response_sensitive (Gtk::RESPONSE_OK, true); set_response_sensitive (Gtk::RESPONSE_NONE, true); } else { - set_response_sensitive (Gtk::RESPONSE_OK, false); + set_response_sensitive (Gtk::RESPONSE_OK, false); } return true; } @@ -513,25 +524,27 @@ NewSessionDialog::entry_key_release (GdkEventKey* ev) void NewSessionDialog::notebook_page_changed (GtkNotebookPage* np, uint pagenum) { - if (pagenum == 1) { - m_okbutton->set_label(_("Open")); - set_response_sensitive (Gtk::RESPONSE_NONE, false); - m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::OPEN, Gtk::ICON_SIZE_BUTTON))); - if (m_treeview->get_selection()->count_selected_rows() == 0) { - set_response_sensitive (Gtk::RESPONSE_OK, false); + if (pagenum == 1) { + on_new_session_page = false; + m_okbutton->set_label(_("Open")); + set_response_sensitive (Gtk::RESPONSE_NONE, false); + m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::OPEN, Gtk::ICON_SIZE_BUTTON))); + if (m_treeview->get_selection()->count_selected_rows() == 0) { + set_response_sensitive (Gtk::RESPONSE_OK, false); } else { - set_response_sensitive (Gtk::RESPONSE_OK, true); + set_response_sensitive (Gtk::RESPONSE_OK, true); } } else { - if (m_name->get_text() != "") { - set_response_sensitive (Gtk::RESPONSE_NONE, true); + on_new_session_page = true; + if (m_name->get_text() != "") { + set_response_sensitive (Gtk::RESPONSE_NONE, true); } - m_okbutton->set_label(_("New")); - m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::NEW, Gtk::ICON_SIZE_BUTTON))); + m_okbutton->set_label(_("New")); + m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::NEW, Gtk::ICON_SIZE_BUTTON))); if (m_name->get_text() == "") { - set_response_sensitive (Gtk::RESPONSE_OK, false); + set_response_sensitive (Gtk::RESPONSE_OK, false); } else { - set_response_sensitive (Gtk::RESPONSE_OK, true); + set_response_sensitive (Gtk::RESPONSE_OK, true); } } } @@ -540,35 +553,37 @@ void NewSessionDialog::treeview_selection_changed () { if (m_treeview->get_selection()->count_selected_rows() == 0) { - if (!m_open_filechooser->get_filename().empty()) { - set_response_sensitive (Gtk::RESPONSE_OK, true); + if (!m_open_filechooser->get_filename().empty()) { + set_response_sensitive (Gtk::RESPONSE_OK, true); } else { - set_response_sensitive (Gtk::RESPONSE_OK, false); + set_response_sensitive (Gtk::RESPONSE_OK, false); } } else { - set_response_sensitive (Gtk::RESPONSE_OK, true); + set_response_sensitive (Gtk::RESPONSE_OK, true); } } void NewSessionDialog::file_chosen () { - m_treeview->get_selection()->unselect_all(); + if (on_new_session_page) return; + + m_treeview->get_selection()->unselect_all(); if (!m_open_filechooser->get_filename().empty()) { - set_response_sensitive (Gtk::RESPONSE_OK, true); + set_response_sensitive (Gtk::RESPONSE_OK, true); } else { - set_response_sensitive (Gtk::RESPONSE_OK, false); + set_response_sensitive (Gtk::RESPONSE_OK, false); } } void NewSessionDialog::template_chosen () { - if (m_template->get_filename() != "" ) {; - set_response_sensitive (Gtk::RESPONSE_NONE, true); + if (m_template->get_filename() != "" ) {; + set_response_sensitive (Gtk::RESPONSE_NONE, true); } else { - set_response_sensitive (Gtk::RESPONSE_NONE, false); + set_response_sensitive (Gtk::RESPONSE_NONE, false); } } diff --git a/gtk2_ardour/new_session_dialog.h b/gtk2_ardour/new_session_dialog.h index 366805d31f..5d652fd122 100644 --- a/gtk2_ardour/new_session_dialog.h +++ b/gtk2_ardour/new_session_dialog.h @@ -182,6 +182,8 @@ protected: void master_bus_button_clicked (); void monitor_bus_button_clicked (); + bool on_new_session_page; + }; diff --git a/gtk2_ardour/opts.cc b/gtk2_ardour/opts.cc index 69b8128824..fcd62de512 100644 --- a/gtk2_ardour/opts.cc +++ b/gtk2_ardour/opts.cc @@ -143,14 +143,19 @@ GTK_ARDOUR::parse_opts (int argc, char *argv[]) break; default: - break; + return print_help(execname); } } if (optind < argc) { + if (new_session) { + cerr << "Illogical combination: you can either create a new session, or a load an existing session but not both!" << endl; + return print_help(execname); + } session_name = argv[optind++]; } + return 0; } diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 8271c1cf6a..d1db818e40 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -97,7 +97,7 @@ class Route : public IO virtual int silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, bool can_record, bool rec_monitors_input); virtual void toggle_monitor_input (); - virtual bool can_record() const { return false; } + virtual bool can_record() { return false; } virtual void set_record_enable (bool yn, void *src) {} virtual bool record_enabled() const { return false; } virtual void handle_transport_stopped (bool abort, bool did_locate, bool flush_redirects); diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index f16e9d29d9..4e2af5c80e 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -48,7 +48,7 @@ class Track : public Route void toggle_monitor_input (); - bool can_record() const { return true; } + virtual bool can_record(); Diskstream& diskstream() const { return *_diskstream; } diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 2dfd735a6b..4d2d26f801 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -170,7 +170,7 @@ IO::silence (jack_nframes_t nframes, jack_nframes_t offset) void IO::apply_declick (vector<Sample *>& bufs, uint32_t nbufs, jack_nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity) { - jack_nframes_t declick = min ((jack_nframes_t)4096, nframes); + jack_nframes_t declick = min ((jack_nframes_t)128, nframes); gain_t delta; Sample *buffer; double fractional_shift; diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 3b3b705a87..c13b7abf2c 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -31,6 +31,7 @@ #include <ardour/audioplaylist.h> #include <ardour/panner.h> #include <ardour/utils.h> +#include <ardour/connection.h> #include "i18n.h" @@ -146,6 +147,18 @@ Track::record_enabled () const { return _diskstream->record_enabled (); } + +bool +Track::can_record() +{ + bool will_record = true; + for (int i = 0; i < _inputs.size() && will_record; i++) { + if (!_inputs[i]->connected()) + will_record = false; + } + + return will_record; +} void Track::set_record_enable (bool yn, void *src) @@ -159,8 +172,13 @@ Track::set_record_enable (bool yn, void *src) return; } - /* keep track of the meter point as it was before we rec-enabled */ + // 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; } |