diff options
author | David Robillard <d@drobilla.net> | 2009-10-14 16:10:01 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-10-14 16:10:01 +0000 |
commit | bb9cc45cd22af67ac275a5e73accbe14fee664d8 (patch) | |
tree | e52977d3eae6ff07b856088041a080a2fa3e5b79 | |
parent | 8c4ce1e2ce35571aed5a686671431fdfffae7f8c (diff) |
Strip trailing whitespace and fix other whitespace errors (e.g. space/tab mixing). Whitespace changes only.
Vimmers, try let c_space_errors = 1 in your .vimrc to highlight this kind of stuff in red. I don't know the emacs equivalent...
git-svn-id: svn://localhost/ardour2/branches/3.0@5773 d708f5d6-7413-0410-9779-e7cbd77b26cf
730 files changed, 14949 insertions, 14951 deletions
diff --git a/gtk2_ardour/about.cc b/gtk2_ardour/about.cc index 0954bad44a..d8b0323491 100644 --- a/gtk2_ardour/about.cc +++ b/gtk2_ardour/about.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -220,13 +220,13 @@ About::About () set_website (X_("http://ardour.org/")); set_website_label (_("visit http://www.ardour.org/")); set_version ((string_compose(_("%1\n(built from revision %2)"), - VERSIONSTRING, + VERSIONSTRING, svn_revision))); - + #ifdef WITH_PAYMENT_OPTIONS paypal_button.add (paypal_pixmap); - + HBox *payment_box = manage (new HBox); payment_box->pack_start (paypal_button, true, false); @@ -247,15 +247,15 @@ About::goto_paypal () char *argv[4]; char *docfile = "foo"; int grandchild; - + if (fork() == 0) { /* child */ if ((grandchild = fork()) == 0) { - + /* grandchild */ - + argv[0] = "mozilla"; argv[1] = "-remote"; snprintf (buf, sizeof(buf), "openurl(%s)", docfile); @@ -270,6 +270,6 @@ About::goto_paypal () waitpid (grandchild, &status, 0); } - } + } } #endif diff --git a/gtk2_ardour/about.h b/gtk2_ardour/about.h index 2eb02dd223..33b5a9ed89 100644 --- a/gtk2_ardour/about.h +++ b/gtk2_ardour/about.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,6 +35,6 @@ class About : public Gtk::AboutDialog Gtk::Button paypal_button; void goto_paypal (); #endif -}; +}; #endif /* __ardour_gtk_about_h__ */ diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index 19a33ef177..b446ee8569 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2005 Paul Davis + Copyright (C) 2005 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -79,7 +79,7 @@ ActionManager::init () find_file_in_search_path (spath, "ardour.menus", ui_file); bool loaded = false; - + try { ui_manager->add_ui_from_file (ui_file.to_string()); loaded = true; @@ -142,12 +142,12 @@ ActionManager::register_toggle_action (RefPtr<ActionGroup> group, const char * n return act; } -bool +bool ActionManager::lookup_entry (const ustring accel_path, Gtk::AccelKey& key) { GtkAccelKey gkey; bool known = gtk_accel_map_lookup_entry (accel_path.c_str(), &gkey); - + if (known) { key = AccelKey (gkey.accel_key, Gdk::ModifierType (gkey.accel_mods)); } else { @@ -177,11 +177,11 @@ ActionManager::get_all_actions (vector<string>& groups, vector<string>& names, v GList* acts; for (node = list; node; node = g_list_next (node)) { - + GtkActionGroup* group = (GtkActionGroup*) node->data; - + /* first pass: collect them all */ - + typedef std::list<Glib::RefPtr<Gtk::Action> > action_list; action_list the_acts; @@ -189,9 +189,9 @@ ActionManager::get_all_actions (vector<string>& groups, vector<string>& names, v GtkAction* action = (GtkAction*) acts->data; the_acts.push_back (Glib::wrap (action, true)); } - + /* now sort by label */ - + SortActionsByLabel cmp; the_acts.sort (cmp); @@ -201,7 +201,7 @@ ActionManager::get_all_actions (vector<string>& groups, vector<string>& names, v groups.push_back (gtk_action_group_get_name(group)); names.push_back (accel_path.substr (accel_path.find_last_of ('/') + 1)); - + AccelKey key; lookup_entry (accel_path, key); bindings.push_back (AccelKey (key.get_key(), Gdk::ModifierType (key.get_mod()))); @@ -221,11 +221,11 @@ ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, ve GList* acts; for (node = list; node; node = g_list_next (node)) { - + GtkActionGroup* group = (GtkActionGroup*) node->data; - + /* first pass: collect them all */ - + typedef std::list<Glib::RefPtr<Gtk::Action> > action_list; action_list the_acts; @@ -233,9 +233,9 @@ ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, ve GtkAction* action = (GtkAction*) acts->data; the_acts.push_back (Glib::wrap (action, true)); } - + /* now sort by label */ - + SortActionsByLabel cmp; the_acts.sort (cmp); @@ -246,16 +246,16 @@ ActionManager::get_all_actions (vector<string>& names, vector<string>& paths, ve names.push_back (label); paths.push_back (accel_path); - + AccelKey key; bool known = lookup_entry (accel_path, key); - + if (known) { keys.push_back (ui_manager->get_accel_group()->name (key.get_key(), Gdk::ModifierType (key.get_mod()))); } else { keys.push_back (unbound_string); } - + bindings.push_back (AccelKey (key.get_key(), Gdk::ModifierType (key.get_mod()))); } } @@ -300,11 +300,11 @@ ActionManager::get_action (const char* group_name, const char* action_name) for (node = list; node; node = g_list_next (node)) { GtkActionGroup* _ag = (GtkActionGroup*) node->data; - + if (strcmp (group_name, gtk_action_group_get_name (_ag)) == 0) { - + GtkAction* _act; - + if ((_act = gtk_action_group_get_action (_ag, action_name)) != 0) { act = Glib::wrap (_act, true); break; @@ -315,7 +315,7 @@ ActionManager::get_action (const char* group_name, const char* action_name) return act; } -void +void ActionManager::set_sensitive (vector<RefPtr<Action> >& actions, bool state) { for (vector<RefPtr<Action> >::iterator i = actions.begin(); i != actions.end(); ++i) { @@ -368,10 +368,10 @@ ActionManager::toggle_config_state (const char* group, const char* action, bool if (act) { Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); - + if (tact) { bool x = (Config->*get)(); - + if (x != tact->get_active()) { (Config->*set) (!x); } @@ -411,7 +411,7 @@ ActionManager::map_some_state (const char* group, const char* action, bool (RCCo Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); if (tact) { - + bool x = (Config->*get)(); if (tact->get_active() != x) { @@ -433,7 +433,7 @@ ActionManager::map_some_state (const char* group, const char* action, sigc::slot Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); if (tact) { - + bool const x = get (); if (tact->get_active() != x) { diff --git a/gtk2_ardour/actions.h b/gtk2_ardour/actions.h index 35331fdac2..187168e4b4 100644 --- a/gtk2_ardour/actions.h +++ b/gtk2_ardour/actions.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -76,35 +76,35 @@ class ActionManager static void add_action_group (Glib::RefPtr<Gtk::ActionGroup>); - static Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group, + static Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group, const char * name, const char * label); - static Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group, - const char * name, const char * label, sigc::slot<void> sl, + static Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group, + const char * name, const char * label, sigc::slot<void> sl, guint key, Gdk::ModifierType mods); - static Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group, + static Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group, const char * name, const char * label, sigc::slot<void> sl); - - static Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&, - const char * name, const char * label, sigc::slot<void> sl, + + static Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&, + const char * name, const char * label, sigc::slot<void> sl, guint key, Gdk::ModifierType mods); - static Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&, + static Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&, const char * name, const char * label, sigc::slot<void> sl); - - static Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group, - const char * name, const char * label, sigc::slot<void> sl, + + static Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group, + const char * name, const char * label, sigc::slot<void> sl, guint key, Gdk::ModifierType mods); - static Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group, + static Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group, const char * name, const char * label, sigc::slot<void> sl); static bool lookup_entry (const Glib::ustring accel_path, Gtk::AccelKey& key); - static void get_all_actions (std::vector<std::string>& names, - std::vector<std::string>& paths, - std::vector<std::string>& keys, + static void get_all_actions (std::vector<std::string>& names, + std::vector<std::string>& paths, + std::vector<std::string>& keys, std::vector<Gtk::AccelKey>& bindings); - static void get_all_actions (std::vector<std::string>& groups, - std::vector<std::string>& paths, + static void get_all_actions (std::vector<std::string>& groups, + std::vector<std::string>& paths, std::vector<Gtk::AccelKey>& bindings); static void uncheck_toggleaction (const char * actionname); diff --git a/gtk2_ardour/add_midi_cc_track_dialog.cc b/gtk2_ardour/add_midi_cc_track_dialog.cc index fed1218c57..455a9f7715 100644 --- a/gtk2_ardour/add_midi_cc_track_dialog.cc +++ b/gtk2_ardour/add_midi_cc_track_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ AddMidiCCTrackDialog::AddMidiCCTrackDialog () _chan_spinner.set_name ("AddMidiCCTrackDialogSpinner"); _cc_num_spinner.set_name ("AddMidiCCTrackDialogSpinner"); - + HBox *chan_box = manage (new HBox()); Label *chan_label = manage(new Label("Channel: ")); chan_box->pack_start(*chan_label, true, true, 4); @@ -65,7 +65,7 @@ AddMidiCCTrackDialog::AddMidiCCTrackDialog () add_button (Stock::CANCEL, RESPONSE_CANCEL); add_button (Stock::ADD, RESPONSE_ACCEPT); - + _chan_spinner.show(); chan_box->show(); chan_label->show(); diff --git a/gtk2_ardour/add_midi_cc_track_dialog.h b/gtk2_ardour/add_midi_cc_track_dialog.h index ecdc9588c8..08811df513 100644 --- a/gtk2_ardour/add_midi_cc_track_dialog.h +++ b/gtk2_ardour/add_midi_cc_track_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index f165d191c6..9d65931ec1 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -71,7 +71,7 @@ AddRouteDialog::AddRouteDialog (Session & s) } } } - + set_name ("AddRouteDialog"); set_position (Gtk::WIN_POS_MOUSE); set_modal (true); @@ -108,13 +108,13 @@ AddRouteDialog::AddRouteDialog (Session & s) HBox *type_hbox = manage (new HBox); type_hbox->set_spacing (6); - + /* track/bus choice */ type_hbox->pack_start (*manage (new Label (_("Add:")))); type_hbox->pack_start (routes_spinner); type_hbox->pack_start (track_bus_combo); - + vbox->pack_start (*type_hbox, false, true); VBox* options_box = manage (new VBox); @@ -153,7 +153,7 @@ AddRouteDialog::AddRouteDialog (Session & s) l = manage (new Label (_("Group:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false)); table2->attach (*l, 1, 2, 2, 3, Gtk::FILL, Gtk::EXPAND, 0, 0); table2->attach (route_group_combo, 2, 3, 2, 3, Gtk::FILL, Gtk::EXPAND & Gtk::FILL, 0, 0); - + options_box->pack_start (*table2, false, true); vbox->pack_start (*options_box, false, true); @@ -197,7 +197,7 @@ ARDOUR::DataType AddRouteDialog::type () { // FIXME: ew - + const string str = channel_combo.get_active_text(); if (str == _("MIDI")) { return ARDOUR::DataType::MIDI; @@ -245,7 +245,7 @@ int AddRouteDialog::channels () { string str = channel_combo.get_active_text(); - + for (ChannelSetups::iterator i = channel_setups.begin(); i != channel_setups.end(); ++i) { if (str == (*i).name) { return (*i).channels; @@ -274,7 +274,7 @@ AddRouteDialog::on_show () { refill_channel_setups (); refill_route_groups (); - + Dialog::on_show (); } @@ -282,7 +282,7 @@ void AddRouteDialog::refill_channel_setups () { ChannelSetup chn; - + route_templates.clear (); channel_combo_strings.clear (); channel_setups.clear (); @@ -316,10 +316,10 @@ AddRouteDialog::refill_channel_setups () chn.template_path = x->path; channel_setups.push_back (chn); } - } + } /* clear template path for the rest */ - + chn.template_path = ""; chn.name = _("3 Channel"); @@ -386,7 +386,7 @@ AddRouteDialog::refill_route_groups () route_group_combo.append_text (_("No group")); _session.foreach_route_group (mem_fun (*this, &AddRouteDialog::add_route_group)); - + route_group_combo.set_active (2); } @@ -395,7 +395,7 @@ AddRouteDialog::group_changed () { if (route_group_combo.get_active_text () == _("New group...")) { RouteGroup* g = new RouteGroup (_session, "", RouteGroup::Active); - + RouteGroupDialog d (g, Gtk::Stock::NEW); int const r = d.do_run (); diff --git a/gtk2_ardour/add_route_dialog.h b/gtk2_ardour/add_route_dialog.h index 78dd51035c..d8c0b07762 100644 --- a/gtk2_ardour/add_route_dialog.h +++ b/gtk2_ardour/add_route_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,7 +69,7 @@ class AddRouteDialog : public ArdourDialog Gtk::ComboBoxText route_group_combo; std::vector<ARDOUR::TemplateInfo> route_templates; - + void track_type_chosen (); void refill_channel_setups (); void refill_route_groups (); @@ -79,7 +79,7 @@ class AddRouteDialog : public ArdourDialog bool route_separator (const Glib::RefPtr<Gtk::TreeModel> &m, const Gtk::TreeModel::iterator &i); void reset_template_option_visibility (); - + void on_show (); struct ChannelSetup { diff --git a/gtk2_ardour/analysis_window.cc b/gtk2_ardour/analysis_window.cc index 9b34ae4a4f..ea75875566 100644 --- a/gtk2_ardour/analysis_window.cc +++ b/gtk2_ardour/analysis_window.cc @@ -46,11 +46,11 @@ AnalysisWindow::AnalysisWindow() : source_selection_label (_("Signal source")), source_selection_ranges_rb (_("Selected ranges")), source_selection_regions_rb (_("Selected regions")), - + display_model_label (_("Display model")), display_model_composite_separate_rb (_("Composite graphs for each track")), display_model_composite_all_tracks_rb (_("Composite graph of all tracks")), - + show_minmax_button (_("Show frequency power range")), show_normalized_button (_("Normalize values")), @@ -60,7 +60,7 @@ AnalysisWindow::AnalysisWindow() : set_title(_("FFT analysis window")); track_list_ready = false; - + // Left side: track list + controls tlmodel = Gtk::ListStore::create(tlcols); track_list.set_model (tlmodel); @@ -73,16 +73,16 @@ AnalysisWindow::AnalysisWindow() : Gtk::TreeViewColumn* track_col = track_list.get_column(0); Gtk::CellRendererText* renderer = dynamic_cast<Gtk::CellRendererText*>(track_list.get_column_cell_renderer (0)); - + track_col->add_attribute(renderer->property_foreground_gdk(), tlcols.color); track_col->set_expand(true); tlmodel->signal_row_changed().connect ( mem_fun(*this, &AnalysisWindow::track_list_row_changed) ); - + fft_graph.set_analysis_window(this); - + vbox.pack_start(track_list); @@ -94,10 +94,10 @@ AnalysisWindow::AnalysisWindow() : source_selection_regions_rb.set_group(group); source_selection_ranges_rb.set_active(); - + vbox.pack_start (source_selection_ranges_rb, false, false); vbox.pack_start (source_selection_regions_rb, false, false); - + // "Selected ranges" radio source_selection_ranges_rb.signal_toggled().connect ( bind ( mem_fun(*this, &AnalysisWindow::source_selection_changed), &source_selection_ranges_rb)); @@ -106,24 +106,24 @@ AnalysisWindow::AnalysisWindow() : source_selection_regions_rb.signal_toggled().connect ( bind ( mem_fun(*this, &AnalysisWindow::source_selection_changed), &source_selection_regions_rb)); } - + vbox.pack_start(hseparator1, false, false); - + // "Display model" vbox.pack_start(display_model_label, false, false); { Gtk::RadioButtonGroup group = display_model_composite_separate_rb.get_group(); display_model_composite_all_tracks_rb.set_group (group); - + display_model_composite_separate_rb.set_active(); - + vbox.pack_start (display_model_composite_separate_rb, false, false); vbox.pack_start (display_model_composite_all_tracks_rb, false, false); // "Composite graphs for all tracks" display_model_composite_separate_rb.signal_toggled().connect ( bind ( mem_fun(*this, &AnalysisWindow::display_model_changed), &display_model_composite_separate_rb)); - + // "Composite graph of all tracks" display_model_composite_all_tracks_rb.signal_toggled().connect ( bind ( mem_fun(*this, &AnalysisWindow::display_model_changed), &display_model_composite_all_tracks_rb)); @@ -134,7 +134,7 @@ AnalysisWindow::AnalysisWindow() : refresh_button.set_name("EditorGTKButton"); refresh_button.set_label(_("Re-analyze data")); - refresh_button.signal_clicked().connect ( bind ( mem_fun(*this, &AnalysisWindow::analyze_data), &refresh_button)); + refresh_button.signal_clicked().connect ( bind ( mem_fun(*this, &AnalysisWindow::analyze_data), &refresh_button)); vbox.pack_start(refresh_button, false, false, 10); @@ -149,18 +149,18 @@ AnalysisWindow::AnalysisWindow() : show_normalized_button.signal_toggled().connect( mem_fun(*this, &AnalysisWindow::show_normalized_changed)); vbox.pack_start(show_normalized_button, false, false); - - - + + + hbox.pack_start(vbox, Gtk::PACK_SHRINK); - + // Analysis window on the right fft_graph.ensure_style(); hbox.add(fft_graph); - - + + // And last we pack the hbox add(hbox); @@ -197,7 +197,7 @@ AnalysisWindow::set_regionmode() source_selection_regions_rb.set_active(true); } -void +void AnalysisWindow::track_list_row_changed(const Gtk::TreeModel::Path& /*path*/, const Gtk::TreeModel::iterator& /*iter*/) { if (track_list_ready) { @@ -211,7 +211,7 @@ AnalysisWindow::clear_tracklist() { // Empty track list & free old graphs Gtk::TreeNodeChildren children = track_list.get_model()->children(); - + for (Gtk::TreeIter i = children.begin(); i != children.end(); i++) { Gtk::TreeModel::Row row = *i; @@ -221,10 +221,10 @@ AnalysisWindow::clear_tracklist() // Make sure it's not drawn row[tlcols.graph] = 0; - + delete delete_me; } - + tlmodel->clear(); } @@ -243,17 +243,17 @@ AnalysisWindow::analyze_data (Gtk::Button */*button*/) // Empty track list & free old graphs clear_tracklist(); - + // first we gather the FFTResults of all tracks - + Sample *buf = (Sample *) malloc(sizeof(Sample) * fft_graph.windowSize()); Sample *mixbuf = (Sample *) malloc(sizeof(Sample) * fft_graph.windowSize()); float *gain = (float *) malloc(sizeof(float) * fft_graph.windowSize()); - + Selection s = PublicEditor::instance().get_selection(); TimeSelection ts = s.time; RegionSelection ars = s.regions; - + for (TrackSelection::iterator i = s.tracks.begin(); i != s.tracks.end(); ++i) { boost::shared_ptr<AudioPlaylist> pl = boost::dynamic_pointer_cast<AudioPlaylist>((*i)->playlist()); @@ -269,11 +269,11 @@ AnalysisWindow::analyze_data (Gtk::Button */*button*/) continue; FFTResult *res = fft_graph.prepareResult(rui->color(), rui->route()->name()); - + // if timeSelection if (source_selection_ranges_rb.get_active()) { // cerr << "Analyzing ranges on track " << *&rui->route().name() << endl; - + for (std::list<AudioRange>::iterator j = ts.begin(); j != ts.end(); ++j) { int n; @@ -305,15 +305,15 @@ AnalysisWindow::analyze_data (Gtk::Button */*button*/) } } else if (source_selection_regions_rb.get_active()) { // cerr << "Analyzing selected regions on track " << *&rui->route().name() << endl; - + TimeAxisView *current_axis = (*i); - + for (RegionSelection::iterator j = ars.begin(); j != ars.end(); ++j) { // Check that the region is actually audio (so we can analyze it) AudioRegionView* arv = dynamic_cast<AudioRegionView*>(*j); if (!arv) continue; - + // Check that the region really is selected on _this_ track/solo if ( &arv->get_time_axis_view() != current_axis) continue; @@ -357,21 +357,21 @@ AnalysisWindow::analyze_data (Gtk::Button */*button*/) } res->finalize(); - + Gtk::TreeModel::Row newrow = *(tlmodel)->append(); newrow[tlcols.trackname] = rui->route()->name(); newrow[tlcols.visible] = true; newrow[tlcols.color] = rui->color(); newrow[tlcols.graph] = res; - } + } + - free(buf); free(mixbuf); track_list_ready = true; } /* end lock */ - + fft_graph.redraw(); } @@ -384,13 +384,13 @@ AnalysisWindow::source_selection_changed (Gtk::RadioButton *button) /* cerr << "AnalysisWindow: signal source = "; - + if (button == &source_selection_ranges_rb) { cerr << "selected ranges" << endl; - + } else if (button == &source_selection_regions_rb) { cerr << "selected regions" << endl; - + } else { cerr << "unknown?" << endl; } @@ -406,7 +406,7 @@ AnalysisWindow::display_model_changed (Gtk::RadioButton *button) /* cerr << "AnalysisWindow: display model = "; - + if (button == &display_model_composite_separate_rb) { cerr << "separate composites of tracks" << endl; } else if (button == &display_model_composite_all_tracks_rb) { @@ -416,5 +416,5 @@ AnalysisWindow::display_model_changed (Gtk::RadioButton *button) } */ } - + diff --git a/gtk2_ardour/ardour_dialog.cc b/gtk2_ardour/ardour_dialog.cc index 7c78677d3e..5affa6e363 100644 --- a/gtk2_ardour/ardour_dialog.cc +++ b/gtk2_ardour/ardour_dialog.cc @@ -87,7 +87,7 @@ ArdourDialog::on_show () Dialog::on_show (); } -void +void ArdourDialog::init () { session = 0; diff --git a/gtk2_ardour/ardour_dialog.h b/gtk2_ardour/ardour_dialog.h index 3384c013d4..cd0fce4162 100644 --- a/gtk2_ardour/ardour_dialog.h +++ b/gtk2_ardour/ardour_dialog.h @@ -37,7 +37,7 @@ class ArdourDialog : public Gtk::Dialog { public: ArdourDialog (std::string title, bool modal = false, bool use_separator = false); - ArdourDialog (Gtk::Window& parent, std::string title, bool modal = false, bool use_separator = false); + ArdourDialog (Gtk::Window& parent, std::string title, bool modal = false, bool use_separator = false); ~ArdourDialog(); static int close_all_current_dialogs (int response); diff --git a/gtk2_ardour/ardour_image_compositor_socket.h b/gtk2_ardour/ardour_image_compositor_socket.h index 6ed92ef8ac..88e9e377b8 100644 --- a/gtk2_ardour/ardour_image_compositor_socket.h +++ b/gtk2_ardour/ardour_image_compositor_socket.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,28 +21,28 @@ #ifndef __ardour_image_comp_h__ #define __ardour_image_comp_h__ -#include <string> +#include <string> namespace ardourvis { /** Simple version number */ const int32_t MSG_VERSION = 1 ; - + /** the default port we use */ const int32_t DEFAULT_PORT = 30000 ; - + /** the maximum buffer size we will use to send receive a message (image data handled differently) */ const int32_t MAX_MSG_SIZE = 256 ; - + /** the number of characters used for a value describing the characters within a textual data element */ const int32_t TEXT_SIZE_CHARS = 3 ; - + /** the number of characters we use for time values within a message */ const int32_t TIME_VALUE_CHARS = 10 ; - + /** the number of charachters we use for other value data, ie image width/height values */ const int32_t IMAGE_SIZE_CHARS = 3 ; - + /** the number of characters used to for the size of the image data message */ const int32_t IMAGE_DATA_MESSAGE_SIZE_CHARS = 32 ; @@ -51,116 +51,116 @@ namespace ardourvis // we join the action chars with items to create the message // with the exception of the return values, all messages begin with one // of these message parts - + /** Insert an Item */ const std::string INSERT_ITEM = "IN" ; - + /** Remove an Item */ const std::string REMOVE_ITEM = "RM" ; - + /** Rename a named item */ const std::string RENAME_ITEM = "MV" ; - + /** Request some aditional data */ const std::string REQUEST_DATA = "RQ" ; - + /** Return of a data request */ const std::string RETURN_DATA = "RD" ; - + /** Update a item */ const std::string ITEM_UPDATE = "IU" ; - + /** Select an Item */ const std::string ITEM_SELECTED = "IS" ; - + /** Sesion Action */ const std::string SESSION_ACTION = "SA" ; - + /** Sesion Action */ const std::string SHUTDOWN = "SD" ; - + // ------------------------------------------------------------------------- // // Return values const std::string RETURN_TRUE = "RT1" ; const std::string RETURN_FALSE = "RT0" ; - - - + + + // ------------------------------------------------------------------------- // // Updateable attributes - + /** Update the position of a time axis item */ const std::string POSITION_CHANGE = "PC" ; - + /** Update the duration of a time axis item */ const std::string DURATION_CHANGE = "DC" ; - + /** Enable the position lock constraint no a time axis item */ const std::string POSITION_LOCK_CHANGE = "PL" ; - + /** Enable the duration lock constraint no a time axis item */ const std::string DURATION_LOCK_CHANGE = "PL" ; - + /** Update the Maximum duration of a time axis item (_Upper _Duration) */ const std::string MAX_DURATION_CHANGE = "UD" ; - + /** Enable the Maximum duration constraint of a time axis item (_Enable _Upper (Duration)) */ const std::string MAX_DURATION_ENABLE_CHANGE = "EU" ; - + /** Update the Minimum duration of a time axis item (_Lowerr _Duration) */ const std::string MIN_DURATION_CHANGE = "LD" ; - + /** Enable the Minimum duration constraint of a time axis item (_Enable _Lower (Duration)) */ const std::string MIN_DURATION_ENABLE_CHANGE = "EL" ; - + /** Refresh the image data of an imageframe item (original image has been altered?) */ const std::string IMAGE_REFRESH = "IR" ; - + /** the session sample rate has changed */ const std::string SAMPLE_RATE_CHANGE = "RC" ; - - - + + + // ------------------------------------------------------------------------- // // Requestable data items - + /** RGB data of the iamge */ // this is probably a bad choice of string ! const std::string IMAGE_RGB_DATA = "ID" ; - + /** the (path) name of the Ardour session */ const std::string SESSION_NAME = "SN" ; - + /** the current sample rate */ const std::string SAMPLE_RATE = "SR" ; - + /** the (path) name of the image compositor session */ const std::string COMPOSITOR_SESSION = "CS" ; - - + + // ------------------------------------------------------------------------- // // Session Actions - follwed by session path - + /** Close a session */ const std::string CLOSE_SESSION = "CS" ; - + /** Open a session */ const std::string OPEN_SESSION = "OS" ; - - - + + + // ------------------------------------------------------------------------- // // Items - + const std::string IMAGEFRAME_TIME_AXIS = "IT" ; const std::string MARKER_TIME_AXIS = "MT" ; const std::string IMAGEFRAME_ITEM = "II" ; const std::string MARKER_ITEM = "MI" ; - + /** or an ImageFrameTimeAxisGroup */ const std::string IMAGEFRAME_GROUP = "IG" ; - + } /* namespace ardour_visual */ #endif /* __ardour_image_comp_socket_h__ */ diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 45f6191dd3..423f9de14a 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 1999-2007 Paul Davis + Copyright (C) 1999-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -115,7 +115,7 @@ sigc::signal<void,nframes_t, bool, nframes_t> ARDOUR_UI::Clock; ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) : Gtkmm2ext::UI (X_("Ardour"), argcp, argvp), - + primary_clock (X_("primary"), false, X_("TransportClockDisplay"), true, false, true), secondary_clock (X_("secondary"), false, X_("SecondaryClockDisplay"), true, false, true), preroll_clock (X_("preroll"), false, X_("PreRollClock"), true, true), @@ -149,7 +149,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) auto_loop_button (auto_loop_controllable), play_selection_button (play_selection_controllable), rec_button (rec_controllable), - + shuttle_units_button (_("% ")), punch_in_button (_("Punch In")), @@ -169,7 +169,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) using namespace Gtk::Menu_Helpers; Gtkmm2ext::init(); - + #ifdef TOP_MENUBAR // _auto_display_errors = false; @@ -190,7 +190,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) ui_config = new UIConfiguration(); theme_manager = new ThemeManager(); - + editor = 0; mixer = 0; session = 0; @@ -232,9 +232,9 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) shuttle_unit_menu = 0; // We do not have jack linked in yet so; - + last_shuttle_request = last_peak_grab = 0; // get_microseconds(); - + ARDOUR::Diskstream::DiskOverrun.connect (mem_fun(*this, &ARDOUR_UI::disk_overrun_handler)); ARDOUR::Diskstream::DiskUnderrun.connect (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler)); @@ -267,7 +267,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) error << _("could not initialize Ardour.") << endmsg; // pass it on up throw; - } + } /* we like keyboards */ @@ -293,7 +293,7 @@ ARDOUR_UI::run_startup (bool should_be_new) main().run(); - /* we don't return here until the startup assistant is finished */ + /* we don't return here until the startup assistant is finished */ _startup->hide (); } @@ -309,7 +309,7 @@ ARDOUR_UI::create_engine () loading_message (_("Starting audio engine")); - try { + try { engine = new ARDOUR::AudioEngine (ARDOUR_COMMAND_LINE::jack_client_name); } catch (...) { @@ -344,7 +344,7 @@ ARDOUR_UI::post_engine () if (setup_windows ()) { throw failed_constructor (); } - + check_memory_locking(); /* this is the first point at which all the keybindings are available */ @@ -384,7 +384,7 @@ ARDOUR_UI::post_engine () } /* start the time-of-day-clock */ - + #ifndef GTKOSX /* OS X provides an always visible wallclock, so don't be stupid */ update_wall_clock (); @@ -399,8 +399,8 @@ ARDOUR_UI::post_engine () if (do_engine_start () == 0) { if (session && _session_is_new) { - /* we need to retain initial visual - settings for a new session + /* we need to retain initial visual + settings for a new session */ session->save_state (""); } @@ -455,7 +455,7 @@ ARDOUR_UI::configure_handler (GdkEventConfigure* /*conf*/) Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::configure_timeout), 100); have_configure_timeout = true; } - + return FALSE; } @@ -522,7 +522,7 @@ ARDOUR_UI::save_ardour_state () if (!keyboard || !mixer || !editor) { return; } - + /* XXX this is all a bit dubious. add_extra_xml() uses a different lifetime model from add_instant_xml(). */ @@ -555,7 +555,7 @@ ARDOUR_UI::autosave_session () { if (g_main_depth() > 1) { /* inside a recursive main loop, - give up because we may not be able to + give up because we may not be able to take a lock. */ return 1; @@ -588,7 +588,7 @@ ARDOUR_UI::update_autosave () } else { if (_autosave_connection.connected()) { _autosave_connection.disconnect(); - } + } } } @@ -606,7 +606,7 @@ ARDOUR_UI::backend_audio_error (bool we_set_params, Gtk::Window* toplevel) false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_NONE); - + if (we_set_params) { win.set_secondary_text(_("There are several possible reasons:\n\ \n\ @@ -635,7 +635,7 @@ Please consider the possibilities, and perhaps (re)start JACK.")); } win.set_default_response (RESPONSE_CLOSE); - + win.show_all (); win.set_position (Gtk::WIN_POS_CENTER); pop_back_splash (); @@ -649,11 +649,11 @@ void ARDOUR_UI::startup () { XMLNode* audio_setup = Config->extra_xml ("AudioSetup"); - + if (audio_setup && _startup && _startup->engine_control()) { _startup->engine_control()->set_state (*audio_setup); } - + if (get_session_parameters (ARDOUR_COMMAND_LINE::new_session)) { exit (1); } @@ -661,7 +661,7 @@ ARDOUR_UI::startup () use_config (); goto_editor_window (); - + BootMessage (_("Ardour is ready for use")); show (); } @@ -698,24 +698,24 @@ ARDOUR_UI::check_memory_locking () if (getrlimit (RLIMIT_MEMLOCK, &limits)) { return; } - + if (limits.rlim_cur != RLIM_INFINITY) { if (ram == 0 || ((double) limits.rlim_cur / ram) < 0.75) { - + MessageDialog msg (_("WARNING: Your system has a limit for maximum amount of locked memory. " "This might cause Ardour to run out of memory before your system " "runs out of memory. \n\n" "You can view the memory limit with 'ulimit -l', " "and it is normally controlled by /etc/security/limits.conf")); - + VBox* vbox = msg.get_vbox(); HBox hbox; CheckButton cb (_("Do not show this window again")); - + cb.signal_toggled().connect (mem_fun (*this, &ARDOUR_UI::no_memory_warning)); - + hbox.pack_start (cb, true, false); vbox->pack_start (hbox); cb.show(); @@ -723,7 +723,7 @@ ARDOUR_UI::check_memory_locking () hbox.show (); pop_back_splash (); - + editor->ensure_float (msg); msg.run (); } @@ -752,7 +752,7 @@ ARDOUR_UI::finish() /* use the default name */ if (save_state_canfail ("")) { /* failed - don't quit */ - MessageDialog msg (*editor, + MessageDialog msg (*editor, _("\ Ardour was unable to save your session.\n\n\ If you still wish to quit, please use the\n\n\ @@ -766,7 +766,7 @@ If you still wish to quit, please use the\n\n\ break; } } - + session->set_deletion_in_progress (); } @@ -806,9 +806,9 @@ ARDOUR_UI::ask_about_saving_session (const string & what) } else { type = _("snapshot"); } - prompt = string_compose(_("The %1 \"%2\"\nhas not been saved.\n\nAny changes made this time\nwill be lost unless you save it.\n\nWhat do you want to do?"), + prompt = string_compose(_("The %1 \"%2\"\nhas not been saved.\n\nAny changes made this time\nwill be lost unless you save it.\n\nWhat do you want to do?"), type, session->snap_name()); - + prompt_label.set_text (prompt); prompt_label.set_name (X_("PrompterLabel")); prompt_label.set_alignment(ALIGN_LEFT, ALIGN_TOP); @@ -846,7 +846,7 @@ ARDOUR_UI::ask_about_saving_session (const string & what) return -1; } - + gint ARDOUR_UI::every_second () { @@ -887,13 +887,13 @@ ARDOUR_UI::update_sample_rate (nframes_t ignored) } else { nframes_t rate = engine->frame_rate(); - + if (fmod (rate, 1000.0) != 0.0) { - snprintf (buf, sizeof (buf), _("%.1f kHz / %4.1f ms"), + snprintf (buf, sizeof (buf), _("%.1f kHz / %4.1f ms"), (float) rate/1000.0f, (engine->frames_per_cycle() / (float) rate) * 1000.0f); } else { - snprintf (buf, sizeof (buf), _("%u kHz / %4.1f ms"), + snprintf (buf, sizeof (buf), _("%u kHz / %4.1f ms"), rate/1000, (engine->frames_per_cycle() / (float) rate) * 1000.0f); } @@ -919,10 +919,10 @@ ARDOUR_UI::update_buffer_load () if (session) { c = session->capture_load (); p = session->playback_load (); - + push_buffer_stats (c, p); - snprintf (buf, sizeof (buf), _("Buffers p:%" PRIu32 "%% c:%" PRIu32 "%%"), + snprintf (buf, sizeof (buf), _("Buffers p:%" PRIu32 "%% c:%" PRIu32 "%%"), session->playback_load(), session->capture_load()); buffer_load_label.set_text (buf); } else { @@ -949,41 +949,41 @@ ARDOUR_UI::update_disk_space() nframes_t frames = session->available_capture_duration(); char buf[64]; nframes_t fr = session->frame_rate(); - + if (frames == max_frames) { strcpy (buf, _("Disk: 24hrs+")); } else { rec_enabled_streams = 0; session->foreach_route (this, &ARDOUR_UI::count_recenabled_streams); - + if (rec_enabled_streams) { frames /= rec_enabled_streams; } - + int hrs; int mins; int secs; - + hrs = frames / (fr * 3600); frames -= hrs * fr * 3600; mins = frames / (fr * 60); frames -= mins * fr * 60; secs = frames / fr; - + snprintf (buf, sizeof(buf), _("Disk: %02dh:%02dm:%02ds"), hrs, mins, secs); } - + disk_space_label.set_text (buf); - + // An attempt to make the disk space label flash red when space has run out. - + if (frames < fr * 60 * 5) { /* disk_space_box.style ("disk_space_label_empty"); */ } else { /* disk_space_box.style ("disk_space_label"); */ } -} +} gint ARDOUR_UI::update_wall_clock () @@ -1013,7 +1013,7 @@ ARDOUR_UI::redisplay_recent_sessions () { std::vector<sys::path> session_directories; RecentSessionsSorter cmp; - + recent_session_display.set_model (Glib::RefPtr<TreeModel>(0)); recent_session_model->clear (); @@ -1027,16 +1027,16 @@ ARDOUR_UI::redisplay_recent_sessions () // // sort them alphabetically sort (rs.begin(), rs.end(), cmp); - + for (ARDOUR::RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) { session_directories.push_back ((*i).second); } - + for (vector<sys::path>::const_iterator i = session_directories.begin(); i != session_directories.end(); ++i) { std::vector<sys::path> state_file_paths; - + // now get available states for this session get_state_files_in_directory (*i, state_file_paths); @@ -1044,7 +1044,7 @@ ARDOUR_UI::redisplay_recent_sessions () vector<string*>* states; vector<const gchar*> item; string fullpath = (*i).to_string(); - + /* remove any trailing / */ if (fullpath[fullpath.length()-1] == '/') { @@ -1056,22 +1056,22 @@ ARDOUR_UI::redisplay_recent_sessions () /* session doesn't exist */ cerr << "skipping non-existent session " << fullpath << endl; continue; - } - + } + /* now get available states for this session */ if ((states = Session::possible_states (fullpath)) == 0) { /* no state file? */ continue; } - + std::vector<string> state_file_names(get_file_names_no_extension (state_file_paths)); Gtk::TreeModel::Row row = *(recent_session_model->append()); row[recent_session_columns.visible_name] = Glib::path_get_basename (fullpath); row[recent_session_columns.fullpath] = fullpath; - + if (state_file_names.size() > 1) { // add the children @@ -1095,9 +1095,9 @@ void ARDOUR_UI::build_session_selector () { session_selector_window = new ArdourDialog (_("Recent Sessions")); - + Gtk::ScrolledWindow *scroller = manage (new Gtk::ScrolledWindow); - + session_selector_window->add_button (Stock::CANCEL, RESPONSE_CANCEL); session_selector_window->add_button (Stock::OPEN, RESPONSE_ACCEPT); session_selector_window->set_default_response (RESPONSE_ACCEPT); @@ -1134,15 +1134,15 @@ ARDOUR_UI::open_recent_session () if (session_selector_window == 0) { build_session_selector (); } - + redisplay_recent_sessions (); while (true) { - + session_selector_window->set_position (WIN_POS_MOUSE); ResponseType r = (ResponseType) session_selector_window->run (); - + switch (r) { case RESPONSE_ACCEPT: break; @@ -1158,20 +1158,20 @@ ARDOUR_UI::open_recent_session () if (recent_session_display.get_selection()->count_selected_rows() == 0) { continue; } - + session_selector_window->hide(); Gtk::TreeModel::iterator i = recent_session_display.get_selection()->get_selected(); - + if (i == recent_session_model->children().end()) { return; } - + Glib::ustring path = (*i)[recent_session_columns.fullpath]; Glib::ustring state = (*i)[recent_session_columns.visible_name]; - + _session_is_new = false; - + if (load_session (path, state) == 0) { break; } @@ -1202,7 +1202,7 @@ ARDOUR_UI::open_session () { if (!check_audioengine()) { return; - + } /* popup selector window */ @@ -1258,7 +1258,7 @@ ARDOUR_UI::session_add_midi_route (bool disk, RouteGroup* route_group, uint32_t return; } - try { + try { if (disk) { tracks = session->new_midi_track (ARDOUR::Normal, route_group, how_many); @@ -1278,7 +1278,7 @@ ARDOUR_UI::session_add_midi_route (bool disk, RouteGroup* route_group, uint32_t } catch (...) { - MessageDialog msg (*editor, + MessageDialog msg (*editor, _("There are insufficient JACK ports available\n\ to create a new track or bus.\n\ You should save Ardour, exit and\n\ @@ -1299,7 +1299,7 @@ ARDOUR_UI::session_add_audio_route (bool track, int32_t input_channels, int32_t return; } - try { + try { if (track) { tracks = session->new_audio_track (input_channels, output_channels, mode, route_group, how_many); @@ -1307,7 +1307,7 @@ ARDOUR_UI::session_add_audio_route (bool track, int32_t input_channels, int32_t if (how_many == 1) { error << _("could not create a new audio track") << endmsg; } else { - error << string_compose (_("could only create %1 of %2 new audio %3"), + error << string_compose (_("could only create %1 of %2 new audio %3"), tracks.size(), how_many, (track ? _("tracks") : _("busses"))) << endmsg; } } @@ -1324,14 +1324,14 @@ ARDOUR_UI::session_add_audio_route (bool track, int32_t input_channels, int32_t } } } - + #if CONTROLOUTS if (need_control_room_outs) { pan_t pans[2]; - + pans[0] = 0.5; pans[1] = 0.5; - + route->set_stereo_control_outs (control_lr_channels); route->control_outs()->set_stereo_pan (pans, this); } @@ -1339,7 +1339,7 @@ ARDOUR_UI::session_add_audio_route (bool track, int32_t input_channels, int32_t } catch (...) { - MessageDialog msg (*editor, + MessageDialog msg (*editor, _("There are insufficient JACK ports available\n\ to create a new track or bus.\n\ You should save Ardour, exit and\n\ @@ -1369,16 +1369,16 @@ ARDOUR_UI::do_transport_locate (nframes_t new_position) } void -ARDOUR_UI::transport_goto_start () +ARDOUR_UI::transport_goto_start () { if (session) { session->goto_start(); - + /* force displayed area in editor to start no matter what "follow playhead" setting is. */ - + if (editor) { editor->reset_x_origin (session->current_start_frame()); } @@ -1391,11 +1391,11 @@ ARDOUR_UI::transport_goto_zero () if (session) { session->request_locate (0); - + /* force displayed area in editor to start no matter what "follow playhead" setting is. */ - + if (editor) { editor->reset_x_origin (0); } @@ -1410,10 +1410,10 @@ ARDOUR_UI::transport_goto_wallclock () time_t now; struct tm tmnow; nframes64_t frames; - + time (&now); localtime_r (&now, &tmnow); - + frames = tmnow.tm_hour * (60 * 60 * session->frame_rate()); frames += tmnow.tm_min * (60 * session->frame_rate()); frames += tmnow.tm_sec * session->frame_rate(); @@ -1423,7 +1423,7 @@ ARDOUR_UI::transport_goto_wallclock () /* force displayed area in editor to start no matter what "follow playhead" setting is. */ - + if (editor) { editor->reset_x_origin (frames - (editor->current_page_frames()/2)); } @@ -1440,7 +1440,7 @@ ARDOUR_UI::transport_goto_end () /* force displayed area in editor to start no matter what "follow playhead" setting is. */ - + if (editor) { editor->reset_x_origin (frame); } @@ -1458,11 +1458,11 @@ ARDOUR_UI::transport_stop () session->cancel_audition (); return; } - + if (session->get_play_loop ()) { session->request_play_loop (false); } - + session->request_stop (); } @@ -1485,7 +1485,7 @@ ARDOUR_UI::remove_last_capture() void ARDOUR_UI::transport_record (bool roll) { - + if (session) { switch (session->record_status()) { case Session::Disabled: @@ -1577,10 +1577,10 @@ void ARDOUR_UI::transport_rewind (int option) { float current_transport_speed; - + if (session) { current_transport_speed = session->transport_speed(); - + if (current_transport_speed >= 0.0f) { switch (option) { case 0: @@ -1604,10 +1604,10 @@ void ARDOUR_UI::transport_forward (int option) { float current_transport_speed; - + if (session) { current_transport_speed = session->transport_speed(); - + if (current_transport_speed <= 0.0f) { switch (option) { case 0: @@ -1635,7 +1635,7 @@ ARDOUR_UI::toggle_record_enable (uint32_t dstream) } boost::shared_ptr<Route> r; - + if ((r = session->route_by_remote_id (dstream)) != 0) { Track* t; @@ -1722,7 +1722,7 @@ ARDOUR_UI::engine_running () if (action_name) { action = ActionManager::get_action (X_("JACK"), action_name); - + if (action) { Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (action); ract->set_active (); @@ -1740,7 +1740,7 @@ ARDOUR_UI::engine_halted () update_sample_rate (0); - MessageDialog msg (*editor, + MessageDialog msg (*editor, _("\ JACK has either been shutdown or it\n\ disconnected Ardour because Ardour\n\ @@ -1753,7 +1753,7 @@ JACK, reconnect and save the session.")); int32_t ARDOUR_UI::do_engine_start () { - try { + try { engine->start(); } @@ -1764,7 +1764,7 @@ ARDOUR_UI::do_engine_start () unload_session (); return -2; } - + return 0; } @@ -1793,7 +1793,7 @@ ARDOUR_UI::stop_clocking () { clock_signal_connection.disconnect (); } - + void ARDOUR_UI::toggle_clocking () { @@ -1828,7 +1828,7 @@ ARDOUR_UI::start_blinking () */ if (blink_timeout_tag < 0) { - blink_on = false; + blink_on = false; blink_timeout_tag = g_timeout_add (240, _blink, this); } } @@ -1862,7 +1862,7 @@ ARDOUR_UI::snapshot_session () prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); prompter.set_prompt (_("Name of New Snapshot")); prompter.set_initial_text (timebuf); - + switch (prompter.run()) { case RESPONSE_ACCEPT: { @@ -1886,7 +1886,7 @@ ARDOUR_UI::snapshot_session () do_save = false; } } - + if (do_save) { save_state (snapname); } @@ -1903,7 +1903,7 @@ ARDOUR_UI::save_state (const string & name) { (void) save_state_canfail (name); } - + int ARDOUR_UI::save_state_canfail (string name) { @@ -1947,7 +1947,7 @@ ARDOUR_UI::secondary_clock_value_changed () } void -ARDOUR_UI::transport_rec_enable_blink (bool onoff) +ARDOUR_UI::transport_rec_enable_blink (bool onoff) { if (session == 0) { return; @@ -1955,7 +1955,7 @@ ARDOUR_UI::transport_rec_enable_blink (bool onoff) Session::RecordState const r = session->record_status (); bool const h = session->have_rec_enabled_diskstream (); - + if (r == Session::Enabled || (r == Session::Recording && !h)) { if (onoff) { rec_button.set_visual_state (2); @@ -1988,7 +1988,7 @@ ARDOUR_UI::save_template () switch (prompter.run()) { case RESPONSE_ACCEPT: prompter.get_result (name); - + if (name.length()) { session->save_template (name); } @@ -2021,12 +2021,12 @@ void ARDOUR_UI::fontconfig_dialog () { #ifdef GTKOSX - /* X11 users will always have fontconfig info around, but new GTK-OSX users + /* X11 users will always have fontconfig info around, but new GTK-OSX users may not and it can take a while to build it. Warn them. */ - + Glib::ustring fontconfig = Glib::build_filename (Glib::get_home_dir(), ".fontconfig"); - + if (!Glib::file_test (fontconfig, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_DIR)) { MessageDialog msg (*_startup, _("Welcome to Ardour.\n\n" @@ -2060,7 +2060,7 @@ ARDOUR_UI::parse_cmdline_path (const Glib::ustring& cmdline_path, Glib::ustring& /* it doesn't exist, assume the best */ session_path = Glib::path_get_dirname (string (cmdline_path)); } - + session_name = basename_nosuffix (string (cmdline_path)); } @@ -2078,22 +2078,22 @@ ARDOUR_UI::load_cmdline_session (const Glib::ustring& session_name, const Glib:: if (session_name.length() == 0 || session_path.length() == 0) { return false; } - + if (Glib::file_test (session_path, Glib::FILE_TEST_IS_DIR)) { Glib::ustring predicted_session_file; - + predicted_session_file = session_path; predicted_session_file += '/'; predicted_session_file += session_name; predicted_session_file += ARDOUR::statefile_suffix; - + if (Glib::file_test (predicted_session_file, Glib::FILE_TEST_EXISTS)) { existing_session = true; } - + } else if (Glib::file_test (session_path, Glib::FILE_TEST_EXISTS)) { - + if (session_path.find (ARDOUR::statefile_suffix) == session_path.length() - 7) { /* existing .ardour file */ existing_session = true; @@ -2102,14 +2102,14 @@ ARDOUR_UI::load_cmdline_session (const Glib::ustring& session_name, const Glib:: } else { existing_session = false; } - + /* lets just try to load it */ - + if (create_engine ()) { backend_audio_error (false, _startup); return -1; } - + return load_session (session_path, session_name); } @@ -2117,14 +2117,14 @@ bool ARDOUR_UI::ask_about_loading_existing_session (const Glib::ustring& session_path) { Glib::ustring str = string_compose (_("This session\n%1\nalready exists. Do you want to open it?"), session_path); - + MessageDialog msg (str, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true); - - + + msg.set_name (X_("CleanupDialog")); msg.set_wmclass (X_("existing_session"), "Ardour"); msg.set_position (Gtk::WIN_POS_MOUSE); @@ -2141,59 +2141,59 @@ ARDOUR_UI::ask_about_loading_existing_session (const Glib::ustring& session_path int ARDOUR_UI::build_session_from_nsd (const Glib::ustring& session_path, const Glib::ustring& session_name) { - + uint32_t cchns; uint32_t mchns; AutoConnectOption iconnect; AutoConnectOption oconnect; uint32_t nphysin; uint32_t nphysout; - + if (Profile->get_sae()) { - + cchns = 0; mchns = 2; iconnect = AutoConnectPhysical; oconnect = AutoConnectMaster; nphysin = 0; // use all available nphysout = 0; // use all available - + } else { - + /* get settings from advanced section of NSD */ - + if (_startup->create_control_bus()) { cchns = (uint32_t) _startup->control_channel_count(); } else { cchns = 0; } - + if (_startup->create_master_bus()) { mchns = (uint32_t) _startup->master_channel_count(); } else { mchns = 0; } - + if (_startup->connect_inputs()) { iconnect = AutoConnectPhysical; } else { iconnect = AutoConnectOption (0); } - + /// @todo some minor tweaks. - + if (_startup->connect_outs_to_master()) { oconnect = AutoConnectMaster; } else if (_startup->connect_outs_to_physical()) { oconnect = AutoConnectPhysical; } else { oconnect = AutoConnectOption (0); - } - + } + nphysin = (uint32_t) _startup->input_limit_count(); nphysout = (uint32_t) _startup->output_limit_count(); } - + if (build_session (session_path, session_name, cchns, @@ -2201,9 +2201,9 @@ ARDOUR_UI::build_session_from_nsd (const Glib::ustring& session_path, const Glib iconnect, oconnect, nphysin, - nphysout, + nphysout, engine->frame_rate() * 60 * 5)) { - + return -1; } @@ -2272,7 +2272,7 @@ ARDOUR_UI::get_session_parameters (bool should_be_new) if (!should_be_new && !ARDOUR_COMMAND_LINE::session_name.empty()) { - /* if they named a specific statefile, use it, otherwise they are + /* if they named a specific statefile, use it, otherwise they are just giving a session folder, and we want to use it as is to find the session. */ @@ -2288,33 +2288,33 @@ ARDOUR_UI::get_session_parameters (bool should_be_new) } else { run_startup (should_be_new); - + /* if we run the startup dialog again, offer more than just "new session" */ - + should_be_new = false; - + session_name = _startup->session_name (likely_new); - + /* this shouldn't happen, but we catch it just in case it does */ - + if (session_name.empty()) { break; - } + } if (_startup->use_session_template()) { template_name = _startup->session_template_name(); _session_is_new = true; - } + } - if (session_name[0] == '/' || + if (session_name[0] == '/' || (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') || (session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) { - + session_path = Glib::path_get_dirname (session_name); session_name = Glib::path_get_basename (session_name); - + } else { - + session_path = _startup->session_folder(); } } @@ -2322,18 +2322,18 @@ ARDOUR_UI::get_session_parameters (bool should_be_new) if (create_engine ()) { break; } - + if (Glib::file_test (session_path, Glib::FileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { if (likely_new) { Glib::ustring existing = Glib::build_filename (session_path, session_name); - + if (!ask_about_loading_existing_session (existing)) { ARDOUR_COMMAND_LINE::session_name = ""; // cancel that continue; - } - } + } + } _session_is_new = false; @@ -2350,7 +2350,7 @@ ARDOUR_UI::get_session_parameters (bool should_be_new) } if (likely_new && template_name.empty()) { - + ret = build_session_from_nsd (session_path, session_name); } else { @@ -2358,9 +2358,9 @@ ARDOUR_UI::get_session_parameters (bool should_be_new) ret = load_session (session_path, session_name, template_name); } } - + return ret; -} +} void ARDOUR_UI::close_session() @@ -2411,7 +2411,7 @@ ARDOUR_UI::load_session (const Glib::ustring& path, const Glib::ustring& snap_na true, Gtk::MESSAGE_INFO, Gtk::BUTTONS_CLOSE); - + msg.set_title (_("Port Registration Error")); msg.set_secondary_text (_("Click the Close button to try again.")); msg.set_position (Gtk::WIN_POS_CENTER); @@ -2437,7 +2437,7 @@ ARDOUR_UI::load_session (const Glib::ustring& path, const Glib::ustring& snap_na true, Gtk::MESSAGE_INFO, Gtk::BUTTONS_CLOSE); - + msg.set_title (_("Loading Error")); msg.set_secondary_text (_("Click the Close button to try again.")); msg.set_position (Gtk::WIN_POS_CENTER); @@ -2460,7 +2460,7 @@ ARDOUR_UI::load_session (const Glib::ustring& path, const Glib::ustring& snap_na connect_to_session (new_session); session_loaded = true; - + goto_editor_window (); if (session) { @@ -2475,9 +2475,9 @@ ARDOUR_UI::load_session (const Glib::ustring& path, const Glib::ustring& snap_na } int -ARDOUR_UI::build_session (const Glib::ustring& path, const Glib::ustring& snap_name, +ARDOUR_UI::build_session (const Glib::ustring& path, const Glib::ustring& snap_name, uint32_t control_channels, - uint32_t master_channels, + uint32_t master_channels, AutoConnectOption input_connect, AutoConnectOption output_connect, uint32_t nphysin, @@ -2500,7 +2500,7 @@ ARDOUR_UI::build_session (const Glib::ustring& path, const Glib::ustring& snap_n } else if (x > 0) { return 0; } - + _session_is_new = true; try { @@ -2530,7 +2530,7 @@ ARDOUR_UI::show () { if (editor) { editor->show_window (); - + if (!shown_flag) { editor->present (); } @@ -2592,7 +2592,7 @@ ARDOUR_UI::hide_splash () } void -ARDOUR_UI::display_cleanup_results (Session::cleanup_report& rep, const gchar* list_title, +ARDOUR_UI::display_cleanup_results (Session::cleanup_report& rep, const gchar* list_title, const string& plural_msg, const string& singular_msg) { size_t removed; @@ -2601,7 +2601,7 @@ ARDOUR_UI::display_cleanup_results (Session::cleanup_report& rep, const gchar* l if (removed == 0) { MessageDialog msgd (*editor, - _("No audio files were ready for cleanup"), + _("No audio files were ready for cleanup"), true, Gtk::MESSAGE_INFO, (Gtk::ButtonsType)(Gtk::BUTTONS_OK) ); @@ -2609,15 +2609,15 @@ ARDOUR_UI::display_cleanup_results (Session::cleanup_report& rep, const gchar* l check for any existing snapshots.\n\ These may still include regions that\n\ require some unused files to continue to exist.")); - + msgd.run (); return; - } + } ArdourDialog results (_("ardour: cleanup"), true, false); - + struct CleanupResultsModelColumns : public Gtk::TreeModel::ColumnRecord { - CleanupResultsModelColumns() { + CleanupResultsModelColumns() { add (visible_name); add (fullpath); } @@ -2625,11 +2625,11 @@ require some unused files to continue to exist.")); Gtk::TreeModelColumn<Glib::ustring> fullpath; }; - + CleanupResultsModelColumns results_columns; Glib::RefPtr<Gtk::ListStore> results_model; Gtk::TreeView results_display; - + results_model = ListStore::create (results_columns); results_display.set_model (results_model); results_display.append_column (list_title, results_columns.visible_name); @@ -2684,7 +2684,7 @@ require some unused files to continue to exist.")); row[results_columns.visible_name] = *i; row[results_columns.fullpath] = *i; } - + list_scroller.add (results_display); list_scroller.set_size_request (-1, 150); list_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); @@ -2731,7 +2731,7 @@ ARDOUR_UI::cleanup () ALL undo/redo information will be lost if you cleanup.\n\ After cleanup, unused audio files will be moved to a \ \"dead sounds\" location.")); - + checker.add_button (Stock::CANCEL, RESPONSE_CANCEL); checker.add_button (_("Clean Up"), RESPONSE_ACCEPT); checker.set_default_response (RESPONSE_CANCEL); @@ -2762,11 +2762,11 @@ After cleanup, unused audio files will be moved to a \ editor->finish_cleanup (); return; } - + editor->finish_cleanup (); checker.hide(); - display_cleanup_results (rep, + display_cleanup_results (rep, _("cleaned files"), _("\ The following %1 files were not in use and \n\ @@ -2800,7 +2800,7 @@ ARDOUR_UI::flush_trash () return; } - display_cleanup_results (rep, + display_cleanup_results (rep, _("deleted file"), _("The following %1 files were deleted from\n\ %2,\n\ @@ -2848,7 +2848,7 @@ ARDOUR_UI::add_route (Gtk::Window* float_window) } string template_path = add_route_dialog->track_template(); - + if (!template_path.empty()) { session->new_route_from_template (count, template_path); return; @@ -2869,7 +2869,7 @@ ARDOUR_UI::add_route (Gtk::Window* float_window) } /* XXX do something with name template */ - + if (add_route_dialog->type() == ARDOUR::DataType::MIDI) { if (track) { session_add_midi_track (route_group, count); @@ -2879,7 +2879,7 @@ ARDOUR_UI::add_route (Gtk::Window* float_window) msg.run (); //session_add_midi_bus(); } - } else { + } else { if (track) { session_add_audio_track (input_chan, output_chan, add_route_dialog->mode(), route_group, count); } else { @@ -2916,7 +2916,7 @@ ARDOUR_UI::editor_settings () const } else { node = Config->instant_xml(X_("Editor")); } - + if (!node) { if (getenv("ARDOUR_INSTANT_XML_PATH")) { node = Config->instant_xml(getenv("ARDOUR_INSTANT_XML_PATH")); @@ -2936,7 +2936,7 @@ ARDOUR_UI::keyboard_settings () const XMLNode* node = 0; node = Config->extra_xml(X_("Keyboard")); - + if (!node) { node = new XMLNode (X_("Keyboard")); } @@ -3013,7 +3013,7 @@ ARDOUR_UI::write_buffer_stats () strftime (buf, sizeof (buf), "%T", &tm); fprintf(fout, "%s %u %u\n", buf, (*i).capture, (*i).playback); } - + disk_buffer_stats.clear (); fclose (fout); @@ -3060,7 +3060,7 @@ Specifically, it failed to read data from disk\n\ quickly enough to keep up with playback.\n")); msg->signal_response().connect (bind (mem_fun (*this, &ARDOUR_UI::disk_speed_dialog_gone), msg)); msg->show (); - } + } } void @@ -3074,7 +3074,7 @@ void ARDOUR_UI::session_dialog (std::string msg) { ENSURE_GUI_THREAD (bind (mem_fun(*this, &ARDOUR_UI::session_dialog), msg)); - + MessageDialog* d; if (editor) { @@ -3086,7 +3086,7 @@ ARDOUR_UI::session_dialog (std::string msg) d->show_all (); d->run (); delete d; -} +} int ARDOUR_UI::pending_state_dialog () @@ -3153,7 +3153,7 @@ The audioengine is currently running at %2 Hz\n"), desired, actual)); } } - + void ARDOUR_UI::disconnect_from_jack () { @@ -3222,7 +3222,7 @@ ARDOUR_UI::record_state_changed () Session::RecordState const r = session->record_status (); bool const h = session->have_rec_enabled_diskstream (); - + if (r == Session::Recording && h) { big_clock.set_widget_name ("BigClockRecording"); } else { @@ -3259,11 +3259,11 @@ ARDOUR_UI::store_clock_modes () } - + ARDOUR_UI::TransportControllable::TransportControllable (std::string name, ARDOUR_UI& u, ToggleType tp) : Controllable (name), ui (u), type(tp) { - + } void @@ -3281,7 +3281,7 @@ ARDOUR_UI::TransportControllable::set_value (float val) fract = ((val - 0.5f)/0.5f); } } - + ui.set_shuttle_fract (fract); return; } @@ -3334,7 +3334,7 @@ float ARDOUR_UI::TransportControllable::get_value (void) const { float val = 0.0f; - + switch (type) { case Roll: break; diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 407867167a..eb161d8e2d 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -139,7 +139,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI void set_will_create_new_session_automatically (bool yn) { _will_create_new_session_automatically = yn; } - + int get_session_parameters (bool should_be_new = false); void parse_cmdline_path (const Glib::ustring& cmdline_path, Glib::ustring& session_name, Glib::ustring& session_path, bool& existing_session); int load_cmdline_session (const Glib::ustring& session_name, const Glib::ustring& session_path, bool& existing_session); @@ -521,7 +521,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI void open_session (); void open_recent_session (); void save_template (); - + void edit_metadata (); void import_metadata (); @@ -616,7 +616,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI Gtk::MenuItem *cleanup_item; - void display_cleanup_results (ARDOUR::Session::cleanup_report& rep, const gchar* list_title, + void display_cleanup_results (ARDOUR::Session::cleanup_report& rep, const gchar* list_title, const std::string& plural_msg, const std::string& singular_msg); void cleanup (); void flush_trash (); @@ -633,10 +633,10 @@ class ARDOUR_UI : public Gtkmm2ext::UI uint32_t capture; uint32_t playback; - DiskBufferStat (time_t w, uint32_t c, uint32_t p) + DiskBufferStat (time_t w, uint32_t c, uint32_t p) : when (w), capture (c), playback (p) {} }; - + std::list<DiskBufferStat> disk_buffer_stats; void push_buffer_stats (uint32_t, uint32_t); void write_buffer_stats (); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 0394d8be8c..0b9ad8bcba 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 1999 Paul Davis + Copyright (C) 1999 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,7 +55,7 @@ using namespace Gtk; using namespace Glib; using namespace sigc; -int +int ARDOUR_UI::setup_windows () { if (create_editor ()) { @@ -80,18 +80,18 @@ ARDOUR_UI::setup_windows () #ifdef TOP_MENUBAR HBox* status_bar_packer = manage (new HBox); - + status_bar_label.set_size_request (300, -1); status_bar_packer->pack_start (status_bar_label, true, true, 6); status_bar_packer->pack_start (error_log_button, false, false); - + error_log_button.signal_clicked().connect (mem_fun (*this, &UI::toggle_errors)); editor->get_status_bar_packer().pack_start (*status_bar_packer, true, true); editor->get_status_bar_packer().pack_start (menu_bar_base, false, false, 6); #else top_packer.pack_start (menu_bar_base, false, false); -#endif +#endif top_packer.pack_start (transport_frame, false, false); @@ -130,7 +130,7 @@ void ARDOUR_UI::transport_stopped () { stop_button.set_visual_state (1); - + roll_button.set_visual_state (0); play_selection_button.set_visual_state (0); auto_loop_button.set_visual_state (0); @@ -206,15 +206,15 @@ ARDOUR_UI::setup_transport () transport_frame.set_name ("BaseFrame"); transport_frame.add (transport_base); - transport_tearoff->Detach.connect (bind (mem_fun(*this, &ARDOUR_UI::detach_tearoff), static_cast<Box*>(&top_packer), + transport_tearoff->Detach.connect (bind (mem_fun(*this, &ARDOUR_UI::detach_tearoff), static_cast<Box*>(&top_packer), static_cast<Widget*>(&transport_frame))); - transport_tearoff->Attach.connect (bind (mem_fun(*this, &ARDOUR_UI::reattach_tearoff), static_cast<Box*> (&top_packer), + transport_tearoff->Attach.connect (bind (mem_fun(*this, &ARDOUR_UI::reattach_tearoff), static_cast<Box*> (&top_packer), static_cast<Widget*> (&transport_frame), 1)); - transport_tearoff->Hidden.connect (bind (mem_fun(*this, &ARDOUR_UI::detach_tearoff), static_cast<Box*>(&top_packer), + transport_tearoff->Hidden.connect (bind (mem_fun(*this, &ARDOUR_UI::detach_tearoff), static_cast<Box*>(&top_packer), static_cast<Widget*>(&transport_frame))); - transport_tearoff->Visible.connect (bind (mem_fun(*this, &ARDOUR_UI::reattach_tearoff), static_cast<Box*> (&top_packer), + transport_tearoff->Visible.connect (bind (mem_fun(*this, &ARDOUR_UI::reattach_tearoff), static_cast<Box*> (&top_packer), static_cast<Widget*> (&transport_frame), 1)); - + shuttle_box.set_name ("TransportButton"); goto_start_button.set_name ("TransportButton"); goto_end_button.set_name ("TransportButton"); @@ -239,11 +239,11 @@ ARDOUR_UI::setup_transport () goto_start_button.set_size_request(29, -1); goto_end_button.set_size_request(29, -1); rec_button.set_size_request(29, -1); - + Widget* w; stop_button.set_visual_state (1); - + w = manage (new Image (get_icon (X_("transport_start")))); w->show(); goto_start_button.add (*w); @@ -303,7 +303,7 @@ ARDOUR_UI::setup_transport () ARDOUR_UI::instance()->tooltips().set_tip (shuttle_box, _("Shuttle speed control")); ARDOUR_UI::instance()->tooltips().set_tip (shuttle_units_button, _("Select semitones or %%-age for speed display")); ARDOUR_UI::instance()->tooltips().set_tip (speed_display_box, _("Current transport speed")); - + shuttle_box.set_flags (CAN_FOCUS); shuttle_box.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK); shuttle_box.set_size_request (100, 15); @@ -376,7 +376,7 @@ ARDOUR_UI::setup_transport () shuttle_units_button.set_name (X_("ShuttleButton")); shuttle_units_button.signal_clicked().connect (mem_fun(*this, &ARDOUR_UI::shuttle_unit_clicked)); - + shuttle_style_button.set_name (X_("ShuttleStyleButton")); vector<string> shuttle_strings; @@ -399,7 +399,7 @@ ARDOUR_UI::setup_transport () shbox->pack_start (*sdframe, false, false); shbox->pack_start (shuttle_units_button, true, true); shbox->pack_start (shuttle_style_button, false, false); - + svbox->pack_start (*sframe, false, false); svbox->pack_start (*shbox, false, false); @@ -429,7 +429,7 @@ ARDOUR_UI::setup_transport () transport_tearoff_hbox.pack_start (*clock_box, false, false, 0); HBox* toggle_box = manage(new HBox); - + VBox* punch_box = manage (new VBox); punch_box->pack_start (punch_in_button, false, false); punch_box->pack_start (punch_out_button, false, false); @@ -439,12 +439,12 @@ ARDOUR_UI::setup_transport () auto_box->pack_start (auto_play_button, false, false); auto_box->pack_start (auto_return_button, false, false); toggle_box->pack_start (*auto_box, false, false); - + VBox* io_box = manage (new VBox); io_box->pack_start (auto_input_button, false, false); io_box->pack_start (click_button, false, false); toggle_box->pack_start (*io_box, false, false); - + /* desensitize */ set_transport_sensitivity (false); @@ -457,7 +457,7 @@ ARDOUR_UI::setup_transport () transport_tearoff_hbox.pack_start (*toggle_box, false, false, 4); transport_tearoff_hbox.pack_start (alert_box, false, false); - + if (Profile->get_sae()) { Image* img = manage (new Image ((::get_icon (X_("sae"))))); transport_tearoff_hbox.pack_end (*img, false, false, 6); @@ -531,7 +531,7 @@ ARDOUR_UI::solo_blink (bool onoff) if (session == 0) { return; } - + if (session->soloing()) { if (onoff) { solo_alert_button.set_state (STATE_ACTIVE); @@ -550,7 +550,7 @@ ARDOUR_UI::audition_blink (bool onoff) if (session == 0) { return; } - + if (session->is_auditioning()) { if (onoff) { auditioning_alert_button.set_state (STATE_ACTIVE); @@ -578,27 +578,27 @@ ARDOUR_UI::build_shuttle_context_menu () speed_items.push_back (RadioMenuElem (group, "8", bind (mem_fun (*this, &ARDOUR_UI::set_shuttle_max_speed), 8.0f))); if (shuttle_max_speed == 8.0) { - static_cast<RadioMenuItem*>(&speed_items.back())->set_active (); + static_cast<RadioMenuItem*>(&speed_items.back())->set_active (); } speed_items.push_back (RadioMenuElem (group, "6", bind (mem_fun (*this, &ARDOUR_UI::set_shuttle_max_speed), 6.0f))); if (shuttle_max_speed == 6.0) { - static_cast<RadioMenuItem*>(&speed_items.back())->set_active (); + static_cast<RadioMenuItem*>(&speed_items.back())->set_active (); } speed_items.push_back (RadioMenuElem (group, "4", bind (mem_fun (*this, &ARDOUR_UI::set_shuttle_max_speed), 4.0f))); if (shuttle_max_speed == 4.0) { - static_cast<RadioMenuItem*>(&speed_items.back())->set_active (); + static_cast<RadioMenuItem*>(&speed_items.back())->set_active (); } speed_items.push_back (RadioMenuElem (group, "3", bind (mem_fun (*this, &ARDOUR_UI::set_shuttle_max_speed), 3.0f))); if (shuttle_max_speed == 3.0) { - static_cast<RadioMenuItem*>(&speed_items.back())->set_active (); + static_cast<RadioMenuItem*>(&speed_items.back())->set_active (); } speed_items.push_back (RadioMenuElem (group, "2", bind (mem_fun (*this, &ARDOUR_UI::set_shuttle_max_speed), 2.0f))); if (shuttle_max_speed == 2.0) { - static_cast<RadioMenuItem*>(&speed_items.back())->set_active (); + static_cast<RadioMenuItem*>(&speed_items.back())->set_active (); } speed_items.push_back (RadioMenuElem (group, "1.5", bind (mem_fun (*this, &ARDOUR_UI::set_shuttle_max_speed), 1.5f))); if (shuttle_max_speed == 1.5) { - static_cast<RadioMenuItem*>(&speed_items.back())->set_active (); + static_cast<RadioMenuItem*>(&speed_items.back())->set_active (); } items.push_back (MenuElem (_("Maximum speed"), *speed_menu)); @@ -658,7 +658,7 @@ ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev) if (!session) { return true; } - + switch (ev->button) { case 1: mouse_shuttle (ev->x, true); @@ -666,7 +666,7 @@ ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev) shuttle_box.remove_modal_grab (); if (Config->get_shuttle_behaviour() == Sprung) { if (session->config.get_auto_play() || roll_button.get_visual_state()) { - shuttle_fract = SHUTTLE_FRACT_SPEED1; + shuttle_fract = SHUTTLE_FRACT_SPEED1; session->request_transport_speed (1.0); stop_button.set_visual_state (0); roll_button.set_visual_state (1); @@ -707,9 +707,9 @@ ARDOUR_UI::shuttle_box_scroll (GdkEventScroll* ev) if (!session) { return true; } - + switch (ev->direction) { - + case GDK_SCROLL_UP: shuttle_fract += 0.005; break; @@ -764,7 +764,7 @@ void ARDOUR_UI::use_shuttle_fract (bool force) { microseconds_t now = get_microseconds(); - + /* do not attempt to submit a motion-driven transport speed request more than once per process cycle. */ @@ -772,7 +772,7 @@ ARDOUR_UI::use_shuttle_fract (bool force) if (!force && (last_shuttle_request - now) < (microseconds_t) engine->usecs_per_cycle()) { return; } - + last_shuttle_request = now; if (Config->get_shuttle_units() == Semitones) { @@ -790,7 +790,7 @@ ARDOUR_UI::use_shuttle_fract (bool force) bool neg; double fract; - + neg = (shuttle_fract < 0.0); fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1 @@ -886,8 +886,8 @@ ARDOUR_UI::update_speed_display () last_speed_displayed = x; } -} - +} + void ARDOUR_UI::set_transport_sensitivity (bool yn) { diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index ac7c8cfdde..6755b27d1e 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -77,7 +77,7 @@ ARDOUR_UI::connect_dependents_to_session (ARDOUR::Session *s) mixer->connect_to_session (s); /* its safe to do this now */ - + BootMessage (_("Reload Session History")); s->restore_history (""); } @@ -93,7 +93,7 @@ void ARDOUR_UI::goto_editor_window () { if (splash && splash->is_visible()) { - // in 2 seconds, hide the splash screen + // in 2 seconds, hide the splash screen Glib::signal_timeout().connect (bind (sigc::ptr_fun (_hide_splash), this), 2000); } diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index e816c3ce91..486c60dbe4 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ */ /* This file contains any ARDOUR_UI methods that require knowledge of - the various dialog boxes, and exists so that no compilation dependency + the various dialog boxes, and exists so that no compilation dependency exists between the main ARDOUR_UI modules and their respective classes. This is to cut down on the compile times. It also helps with my sanity. */ @@ -58,7 +58,7 @@ ARDOUR_UI::connect_to_session (Session *s) ActionManager::set_sensitive (ActionManager::session_sensitive_actions, true); ActionManager::set_sensitive (ActionManager::write_sensitive_actions, session->writable()); - + if (session->locations()->num_range_markers()) { ActionManager::set_sensitive (ActionManager::range_sensitive_actions, true); } else { @@ -92,7 +92,7 @@ ARDOUR_UI::connect_to_session (Session *s) rec_button.set_sensitive (true); shuttle_box.set_sensitive (true); - + if (location_ui) { location_ui->set_session(s); } @@ -134,7 +134,7 @@ ARDOUR_UI::connect_to_session (Session *s) /* Clocks are on by default after we are connected to a session, so show that here. */ - + connect_dependents_to_session (s); /* listen to clock mode changes. don't do this earlier because otherwise as the clocks @@ -164,7 +164,7 @@ ARDOUR_UI::unload_session (bool hide_stuff) case -1: // cancel return 1; - + case 1: session->save_state (""); break; @@ -183,7 +183,7 @@ ARDOUR_UI::unload_session (bool hide_stuff) point_zero_one_second_connection.disconnect(); ActionManager::set_sensitive (ActionManager::session_sensitive_actions, false); - + rec_button.set_sensitive (false); shuttle_box.set_sensitive (false); @@ -214,13 +214,13 @@ ARDOUR_UI::toggle_big_clock_window () RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleBigClock")); if (act) { RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act); - + if (tact->get_active()) { big_clock_window->show_all (); big_clock_window->present (); } else { big_clock_window->hide (); - } + } } } @@ -231,18 +231,18 @@ ARDOUR_UI::toggle_rc_options_window () rc_option_editor = new RCOptionEditor; rc_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleRCOptionsEditor"))); rc_option_editor->set_session (session); - } + } RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleRCOptionsEditor")); if (act) { RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act); - + if (tact->get_active()) { rc_option_editor->show_all (); rc_option_editor->present (); } else { rc_option_editor->hide (); - } + } } } @@ -252,18 +252,18 @@ ARDOUR_UI::toggle_session_options_window () if (session_option_editor == 0) { session_option_editor = new SessionOptionEditor (session); session_option_editor->signal_unmap().connect(sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleSessionOptionsEditor"))); - } + } RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleSessionOptionsEditor")); if (act) { RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act); - + if (tact->get_active()) { session_option_editor->show_all (); session_option_editor->present (); } else { session_option_editor->hide (); - } + } } } @@ -288,13 +288,13 @@ ARDOUR_UI::toggle_location_window () RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleLocations")); if (act) { RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act); - + if (tact->get_active()) { location_ui->show_all (); location_ui->present (); } else { location_ui->hide (); - } + } } } @@ -303,19 +303,19 @@ ARDOUR_UI::toggle_key_editor () { if (key_editor == 0) { key_editor = new KeyEditor; - key_editor->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleKeyEditor"))); + key_editor->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleKeyEditor"))); } RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleKeyEditor")); if (act) { RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act); - + if (tact->get_active()) { key_editor->show_all (); key_editor->present (); } else { key_editor->hide (); - } + } } } @@ -325,13 +325,13 @@ ARDOUR_UI::toggle_theme_manager () RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleThemeManager")); if (act) { RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act); - + if (tact->get_active()) { theme_manager->show_all (); theme_manager->present (); } else { theme_manager->hide (); - } + } } } @@ -348,17 +348,17 @@ void ARDOUR_UI::toggle_bundle_manager () { create_bundle_manager (); - + RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleBundleManager")); if (act) { RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act); - + if (tact->get_active()) { bundle_manager->show_all (); bundle_manager->present (); } else { bundle_manager->hide (); - } + } } } @@ -383,13 +383,13 @@ ARDOUR_UI::toggle_route_params_window () RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleInspector")); if (act) { RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act); - + if (tact->get_active()) { route_params->show_all (); route_params->present (); } else { route_params->hide (); - } + } } } @@ -410,14 +410,14 @@ ARDOUR_UI::main_window_state_event_handler (GdkEventWindowState* ev, bool window { if (window_was_editor) { - if ((ev->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) && + if ((ev->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) && (ev->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)) { float_big_clock (editor); } } else { - if ((ev->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) && + if ((ev->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) && (ev->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)) { float_big_clock (mixer); } diff --git a/gtk2_ardour/ardour_ui_mixer.cc b/gtk2_ardour/ardour_ui_mixer.cc index 6373bc8b8c..0fbc7fe11d 100644 --- a/gtk2_ardour/ardour_ui_mixer.cc +++ b/gtk2_ardour/ardour_ui_mixer.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ ARDOUR_UI::create_mixer () { try { mixer = new Mixer_UI (); - } + } catch (failed_constructor& err) { return -1; diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h index 41f15a80ba..445ab27ec5 100644 --- a/gtk2_ardour/au_pluginui.h +++ b/gtk2_ardour/au_pluginui.h @@ -33,12 +33,12 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox public: AUPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>); ~AUPluginUI (); - + gint get_preferred_height () { return prefheight; } gint get_preferred_width () { return prefwidth; } bool start_updating(GdkEventAny*); bool stop_updating(GdkEventAny*); - + void activate (); void deactivate (); @@ -77,7 +77,7 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox NSWindow* cocoa_parent; ComponentDescription carbon_descriptor; AudioUnitCarbonView editView; - WindowRef carbon_window; + WindowRef carbon_window; EventHandlerRef carbon_event_handler; bool _activating_from_app; NSView* packView; diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index e79ba1906e..42531732fa 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 1999 Paul Davis + Copyright (C) 1999 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,7 +63,7 @@ const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = { 10 /* Audio Frame */ }; -AudioClock::AudioClock (std::string clock_name, bool transient, std::string widget_name, bool allow_edit, bool duration, bool with_info) +AudioClock::AudioClock (std::string clock_name, bool transient, std::string widget_name, bool allow_edit, bool duration, bool with_info) : _name (clock_name), is_transient (transient), is_duration (duration), @@ -93,7 +93,7 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg smpte_lower_info_label = manage (new Label); bbt_upper_info_label = manage (new Label); bbt_lower_info_label = manage (new Label); - + frames_upper_info_label->set_name ("AudioClockFramesUpperInfo"); frames_lower_info_label->set_name ("AudioClockFramesLowerInfo"); smpte_upper_info_label->set_name ("AudioClockSMPTEUpperInfo"); @@ -113,7 +113,7 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg smpte_info_box.pack_start (*smpte_lower_info_label, true, true); bbt_info_box.pack_start (*bbt_upper_info_label, true, true); bbt_info_box.pack_start (*bbt_lower_info_label, true, true); - + } else { frames_upper_info_label = 0; frames_lower_info_label = 0; @@ -121,18 +121,18 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg smpte_lower_info_label = 0; bbt_upper_info_label = 0; bbt_lower_info_label = 0; - } - + } + audio_frames_ebox.add (audio_frames_label); - + frames_packer.set_homogeneous (false); frames_packer.set_border_width (2); frames_packer.pack_start (audio_frames_ebox, false, false); - + if (with_info) { frames_packer.pack_start (frames_info_box, false, false, 5); } - + frames_packer_hbox.pack_start (frames_packer, true, false); hours_ebox.add (hours_label); @@ -254,7 +254,7 @@ AudioClock::set_widget_name (string name) ms_hours_ebox.set_name (name); ms_minutes_ebox.set_name (name); ms_seconds_ebox.set_name (name); - + colon1.set_name (name); colon2.set_name (name); colon3.set_name (name); @@ -418,7 +418,7 @@ AudioClock::set (nframes_t when, bool force, nframes_t offset, char which) if ((!force && !is_visible()) || session == 0) { return; } - + if (when == last_when && !offset && !force) { return; } @@ -495,22 +495,22 @@ AudioClock::set_frames (nframes_t when, bool /*force*/) char buf[32]; snprintf (buf, sizeof (buf), "%u", when); audio_frames_label.set_text (buf); - + if (frames_upper_info_label) { nframes_t rate = session->frame_rate(); - + if (fmod (rate, 1000.0) == 0.000) { sprintf (buf, "%uK", rate/1000); } else { sprintf (buf, "%.3fK", rate/1000.0f); } - + if (frames_upper_info_label->get_text() != buf) { frames_upper_info_label->set_text (buf); } - + float vid_pullup = session->config.get_video_pullup(); - + if (vid_pullup == 0.0) { if (frames_lower_info_label->get_text () != _("none")) { frames_lower_info_label->set_text(_("none")); @@ -522,7 +522,7 @@ AudioClock::set_frames (nframes_t when, bool /*force*/) } } } -} +} void AudioClock::set_minsec (nframes_t when, bool force) @@ -532,7 +532,7 @@ AudioClock::set_minsec (nframes_t when, bool force) int hrs; int mins; float secs; - + left = when; hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f)); left -= (nframes_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f); @@ -564,7 +564,7 @@ AudioClock::set_smpte (nframes_t when, bool force) { char buf[32]; SMPTE::Time smpte; - + if (is_duration) { session->smpte_duration (when, smpte); } else { @@ -599,20 +599,20 @@ AudioClock::set_smpte (nframes_t when, bool force) frames_label.set_text (buf); last_frames = smpte.frames; } - + if (smpte_upper_info_label) { double smpte_frames = session->smpte_frames_per_second(); - + if ( fmod(smpte_frames, 1.0) == 0.0) { - sprintf (buf, "%u", int (smpte_frames)); + sprintf (buf, "%u", int (smpte_frames)); } else { sprintf (buf, "%.2f", smpte_frames); } - + if (smpte_upper_info_label->get_text() != buf) { smpte_upper_info_label->set_text (buf); } - + if ((fabs(smpte_frames - 29.97) < 0.0001) || smpte_frames == 30) { if (session->smpte_drop_frames()) { sprintf (buf, "DF"); @@ -623,7 +623,7 @@ AudioClock::set_smpte (nframes_t when, bool force) // there is no drop frame alternative buf[0] = '\0'; } - + if (smpte_lower_info_label->get_text() != buf) { smpte_lower_info_label->set_text (buf); } @@ -641,7 +641,7 @@ AudioClock::set_bbt (nframes_t when, bool force) if (when == 0) { bbt.bars = 0; bbt.beats = 0; - bbt.ticks = 0; + bbt.ticks = 0; } else { session->tempo_map().bbt_time (when, bbt); bbt.bars--; @@ -663,7 +663,7 @@ AudioClock::set_bbt (nframes_t when, bool force) if (force || ticks_label.get_text () != buf) { ticks_label.set_text (buf); } - + if (bbt_upper_info_label) { nframes64_t pos; @@ -696,7 +696,7 @@ AudioClock::set_session (Session *s) XMLProperty* prop; XMLNode* node = session->extra_xml (X_("ClockModes")); AudioClock::Mode amode; - + if (node) { if ((prop = node->property (_name)) != 0) { amode = AudioClock::Mode (string_2_enum (prop->value(), amode)); @@ -889,11 +889,11 @@ AudioClock::field_key_release_event (GdkEventKey *ev, Field field) if (key_entry_state == field_length[field]) { move_on = true; } - + if (move_on) { if (key_entry_state) { - + switch (field) { case SMPTE_Hours: case SMPTE_Minutes: @@ -917,17 +917,17 @@ AudioClock::field_key_release_event (GdkEventKey *ev, Field field) default: break; } - + ValueChanged(); /* EMIT_SIGNAL */ } - + /* move on to the next field. */ - + switch (field) { - + /* SMPTE */ - + case SMPTE_Hours: minutes_ebox.grab_focus (); break; @@ -1130,7 +1130,7 @@ AudioClock::field_button_release_event (GdkEventButton *ev, Field field) } ops_menu->popup (1, ev->time); return true; - } + } switch (ev->button) { case 1: @@ -1151,7 +1151,7 @@ AudioClock::field_button_release_event (GdkEventButton *ev, Field field) case AudioFrames: audio_frames_ebox.grab_focus(); break; - + case MS_Hours: ms_hours_ebox.grab_focus(); break; @@ -1161,7 +1161,7 @@ AudioClock::field_button_release_event (GdkEventButton *ev, Field field) case MS_Seconds: ms_seconds_ebox.grab_focus(); break; - + case Bars: bars_ebox.grab_focus (); break; @@ -1173,7 +1173,7 @@ AudioClock::field_button_release_event (GdkEventButton *ev, Field field) break; } break; - + default: break; } @@ -1196,10 +1196,10 @@ AudioClock::field_button_press_event (GdkEventButton *ev, Field /*field*/) set (frames, true); ValueChanged (); /* EMIT_SIGNAL */ } - + /* make absolutely sure that the pointer is grabbed */ gdk_pointer_grab(ev->window,false , - GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK), + GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK), NULL,NULL,ev->time); dragging = true; drag_accum = 0; @@ -1223,7 +1223,7 @@ AudioClock::field_button_press_event (GdkEventButton *ev, Field /*field*/) return false; break; } - + return true; } @@ -1255,13 +1255,13 @@ AudioClock::field_button_scroll_event (GdkEventScroll *ev, Field field) if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { frames *= 10; } - + if ((double)current_time() - (double)frames < 0.0) { set (0, true); } else { set (current_time() - frames, true); } - + ValueChanged (); /* EMIT_SIGNAL */ } break; @@ -1270,7 +1270,7 @@ AudioClock::field_button_scroll_event (GdkEventScroll *ev, Field field) return false; break; } - + return true; } @@ -1280,7 +1280,7 @@ AudioClock::field_motion_notify_event (GdkEventMotion *ev, Field field) if (session == 0 || !dragging) { return false; } - + float pixel_frame_scale_factor = 0.2f; /* @@ -1289,7 +1289,7 @@ AudioClock::field_motion_notify_event (GdkEventMotion *ev, Field field) } - if (Keyboard::modifier_state_contains (ev->state, + if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier|Keyboard::SecondaryModifier)) { pixel_frame_scale_factor = 0.025f; @@ -1309,19 +1309,19 @@ AudioClock::field_motion_notify_event (GdkEventMotion *ev, Field field) dir = (drag_accum < 0 ? 1:-1); pos = current_time(); frames = get_frames (field,pos,dir); - + if (frames != 0 && frames * drag_accum < current_time()) { - + set ((nframes_t) floor (pos - drag_accum * frames), false); // minus because up is negative in computer-land - + } else { set (0 , false); - + } drag_accum= 0; - ValueChanged(); /* EMIT_SIGNAL */ - + ValueChanged(); /* EMIT_SIGNAL */ + } @@ -1448,11 +1448,11 @@ AudioClock::smpte_sanitize_display() if (atoi(minutes_label.get_text()) > 59) { minutes_label.set_text("59"); } - + if (atoi(seconds_label.get_text()) > 59) { seconds_label.set_text("59"); } - + switch ((long)rint(session->smpte_frames_per_second())) { case 24: if (atoi(frames_label.get_text()) > 23) { @@ -1472,7 +1472,7 @@ AudioClock::smpte_sanitize_display() default: break; } - + if (session->smpte_drop_frames()) { if ((atoi(minutes_label.get_text()) % 10) && (atoi(seconds_label.get_text()) == 0) && (atoi(frames_label.get_text()) < 2)) { frames_label.set_text("02"); @@ -1486,10 +1486,10 @@ AudioClock::smpte_frame_from_display () const if (session == 0) { return 0; } - + SMPTE::Time smpte; nframes_t sample; - + smpte.hours = atoi (hours_label.get_text()); smpte.minutes = atoi (minutes_label.get_text()); smpte.seconds = atoi (seconds_label.get_text()); @@ -1498,7 +1498,7 @@ AudioClock::smpte_frame_from_display () const smpte.drop= session->smpte_drop_frames(); session->smpte_to_sample( smpte, sample, false /* use_offset */, false /* use_subframes */ ); - + #if 0 #define SMPTE_SAMPLE_TEST_1 @@ -1533,7 +1533,7 @@ AudioClock::smpte_frame_from_display () const cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; break; } - + if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) { cout << "ERROR: smpte2 not equal smpte1" << endl; cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; @@ -1554,7 +1554,7 @@ AudioClock::smpte_frame_from_display () const #ifdef SMPTE_SAMPLE_TEST_2 // Test 2: use_offset = true, use_subframes = false cout << "use_offset = true, use_subframes = false" << endl; - + smpte1.hours = 0; smpte1.minutes = 0; smpte1.seconds = 0; @@ -1574,7 +1574,7 @@ AudioClock::smpte_frame_from_display () const // cout << "sample: " << sample1 << endl; // cout << "sample: " << sample1 << " -> "; // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; - + if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) { cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl; cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; @@ -1583,7 +1583,7 @@ AudioClock::smpte_frame_from_display () const cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; break; } - + if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) { cout << "ERROR: smpte2 not equal smpte1" << endl; cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; @@ -1603,7 +1603,7 @@ AudioClock::smpte_frame_from_display () const #ifdef SMPTE_SAMPLE_TEST_3 // Test 3: use_offset = true, use_subframes = false, decrement - cout << "use_offset = true, use_subframes = false, decrement" << endl; + cout << "use_offset = true, use_subframes = false, decrement" << endl; session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ ); cout << "Starting at sample: " << sample1 << " -> "; @@ -1617,7 +1617,7 @@ AudioClock::smpte_frame_from_display () const // cout << "sample: " << sample1 << endl; // cout << "sample: " << sample1 << " -> "; // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; - + if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) { cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl; cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; @@ -1626,7 +1626,7 @@ AudioClock::smpte_frame_from_display () const cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; break; } - + if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) { cout << "ERROR: smpte2 not equal smpte1" << endl; cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; @@ -1648,7 +1648,7 @@ AudioClock::smpte_frame_from_display () const #ifdef SMPTE_SAMPLE_TEST_4 // Test 4: use_offset = true, use_subframes = true cout << "use_offset = true, use_subframes = true" << endl; - + for (long sub = 5; sub < 80; sub += 5) { smpte1.hours = 0; smpte1.minutes = 0; @@ -1656,16 +1656,16 @@ AudioClock::smpte_frame_from_display () const smpte1.frames = 0; smpte1.subframes = 0; sample1 = oldsample = (sample_increment * sub) / 80; - + session->sample_to_smpte( sample1, smpte1, true /* use_offset */, true /* use_subframes */ ); - + cout << "starting at sample: " << sample1 << " -> "; cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl; - + for (int i = 0; i < 108003; i++) { session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ ); session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ ); - + if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) { cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl; cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; @@ -1674,7 +1674,7 @@ AudioClock::smpte_frame_from_display () const cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; //break; } - + if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) { cout << "ERROR: smpte2 not equal smpte1" << endl; cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; @@ -1686,7 +1686,7 @@ AudioClock::smpte_frame_from_display () const oldsample = sample1; session->smpte_increment( smpte1 ); } - + cout << "sample_increment: " << sample_increment << endl; cout << "sample: " << sample1 << " -> "; cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; @@ -1694,7 +1694,7 @@ AudioClock::smpte_frame_from_display () const for (int i = 0; i < 108003; i++) { session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ ); session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ ); - + if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) { cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl; cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; @@ -1703,7 +1703,7 @@ AudioClock::smpte_frame_from_display () const cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; //break; } - + if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) { cout << "ERROR: smpte2 not equal smpte1" << endl; cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; @@ -1715,7 +1715,7 @@ AudioClock::smpte_frame_from_display () const oldsample = sample1; session->smpte_decrement( smpte1 ); } - + cout << "sample_decrement: " << sample_increment << endl; cout << "sample: " << sample1 << " -> "; cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; @@ -1726,7 +1726,7 @@ AudioClock::smpte_frame_from_display () const #ifdef SMPTE_SAMPLE_TEST_5 // Test 5: use_offset = true, use_subframes = false, increment seconds cout << "use_offset = true, use_subframes = false, increment seconds" << endl; - + smpte1.hours = 0; smpte1.minutes = 0; smpte1.seconds = 0; @@ -1747,13 +1747,13 @@ AudioClock::smpte_frame_from_display () const // cout << "sample: " << sample1 << endl; // cout << "sample: " << sample1 << " -> "; // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; - + // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) // { // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl; // break; // } - + if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) { cout << "ERROR: smpte2 not equal smpte1" << endl; cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; @@ -1775,7 +1775,7 @@ AudioClock::smpte_frame_from_display () const #ifdef SMPTE_SAMPLE_TEST_6 // Test 6: use_offset = true, use_subframes = false, increment minutes cout << "use_offset = true, use_subframes = false, increment minutes" << endl; - + smpte1.hours = 0; smpte1.minutes = 0; smpte1.seconds = 0; @@ -1796,13 +1796,13 @@ AudioClock::smpte_frame_from_display () const // cout << "sample: " << sample1 << endl; // cout << "sample: " << sample1 << " -> "; // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; - + // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) // { // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl; // break; // } - + if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) { cout << "ERROR: smpte2 not equal smpte1" << endl; cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; @@ -1823,7 +1823,7 @@ AudioClock::smpte_frame_from_display () const #ifdef SMPTE_SAMPLE_TEST_7 // Test 7: use_offset = true, use_subframes = false, increment hours cout << "use_offset = true, use_subframes = false, increment hours" << endl; - + smpte1.hours = 0; smpte1.minutes = 0; smpte1.seconds = 0; @@ -1844,13 +1844,13 @@ AudioClock::smpte_frame_from_display () const // cout << "sample: " << sample1 << endl; // cout << "sample: " << sample1 << " -> "; // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; - + // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) // { // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl; // break; // } - + if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) { cout << "ERROR: smpte2 not equal smpte1" << endl; cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> "; @@ -1868,7 +1868,7 @@ AudioClock::smpte_frame_from_display () const cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl; #endif -#endif +#endif return sample; } @@ -1929,7 +1929,7 @@ AudioClock::bbt_frame_duration_from_display (nframes_t pos) const bbt.bars = atoi (bars_label.get_text()); bbt.beats = atoi (beats_label.get_text()); bbt.ticks = atoi (ticks_label.get_text()); - + return session->tempo_map().bbt_duration_at(pos,bbt,1); } @@ -1946,7 +1946,7 @@ AudioClock::build_ops_menu () ops_menu = new Menu; MenuList& ops_items = ops_menu->items(); ops_menu->set_name ("ArdourContextMenu"); - + if (!Profile->get_sae()) { ops_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), SMPTE))); } @@ -1967,13 +1967,13 @@ AudioClock::set_mode (Mode m) */ clock_base.grab_focus (); - + if (_mode == m) { return; } - + clock_base.remove (); - + _mode = m; switch (_mode) { @@ -1999,7 +1999,7 @@ AudioClock::set_mode (Mode m) } set_size_requests (); - + set (last_when, true); clock_base.show_all (); key_entry_state = 0; @@ -2042,7 +2042,7 @@ AudioClock::set_size_requests () case Off: Gtkmm2ext::set_size_request_to_display_given_text (off_hbox, "00000", 5, 5); break; - + } } diff --git a/gtk2_ardour/audio_clock.h b/gtk2_ardour/audio_clock.h index 1d9c550052..2de4cee3eb 100644 --- a/gtk2_ardour/audio_clock.h +++ b/gtk2_ardour/audio_clock.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1999 Paul Davis + Copyright (C) 1999 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ class AudioClock : public Gtk::HBox Frames, Off }; - + AudioClock (std::string clock_name, bool transient, std::string widget_name, bool editable, bool is_duration = false, bool with_info = false); Mode mode() const { return _mode; } @@ -66,7 +66,7 @@ class AudioClock : public Gtk::HBox static sigc::signal<void> ModeChanged; static std::vector<AudioClock*> clocks; - + static bool has_focus() { return _has_focus; } private: @@ -91,7 +91,7 @@ class AudioClock : public Gtk::HBox Gtk::HBox frames_packer_hbox; Gtk::HBox frames_packer; - + enum Field { SMPTE_Hours, SMPTE_Minutes, @@ -101,7 +101,7 @@ class AudioClock : public Gtk::HBox MS_Minutes, MS_Seconds, Bars, - Beats, + Beats, Ticks, AudioFrames }; @@ -146,7 +146,7 @@ class AudioClock : public Gtk::HBox Gtk::Label* smpte_upper_info_label; Gtk::Label* smpte_lower_info_label; - + Gtk::Label* bbt_upper_info_label; Gtk::Label* bbt_lower_info_label; @@ -178,7 +178,7 @@ class AudioClock : public Gtk::HBox double drag_accum; void on_realize (); - + bool field_motion_notify_event (GdkEventMotion *ev, Field); bool field_button_press_event (GdkEventButton *ev, Field); bool field_button_release_event (GdkEventButton *ev, Field); @@ -195,7 +195,7 @@ class AudioClock : public Gtk::HBox void set_frames (nframes_t, bool); nframes_t get_frames (Field,nframes_t pos = 0,int dir=1); - + void smpte_sanitize_display(); nframes_t smpte_frame_from_display () const; nframes_t bbt_frame_from_display (nframes_t) const; @@ -211,7 +211,7 @@ class AudioClock : public Gtk::HBox static const uint32_t field_length[(int)AudioFrames+1]; static bool _has_focus; - + }; #endif /* __audio_clock_h__ */ diff --git a/gtk2_ardour/audio_region_editor.cc b/gtk2_ardour/audio_region_editor.cc index 73a9f92f1b..07d87cab75 100644 --- a/gtk2_ardour/audio_region_editor.cc +++ b/gtk2_ardour/audio_region_editor.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -72,14 +72,14 @@ AudioRegionEditor::AudioRegionEditor (Session& s, boost::shared_ptr<AudioRegion> ARDOUR_UI::instance()->tooltips().set_tip (audition_button, _("audition this region")); audition_button.unset_flags (Gtk::CAN_FOCUS); - + audition_button.set_events (audition_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK)); top_row_button_hbox.set_border_width (5); top_row_button_hbox.set_spacing (5); top_row_button_hbox.set_homogeneous (false); top_row_button_hbox.pack_end (audition_button, false, false); - + top_row_hbox.pack_start (name_hbox, true, true); top_row_hbox.pack_end (top_row_button_hbox, true, true); @@ -93,7 +93,7 @@ AudioRegionEditor::AudioRegionEditor (Session& s, boost::shared_ptr<AudioRegion> sync_label.set_text (_("SYNC POINT:")); start_label.set_name ("AudioRegionEditorLabel"); start_label.set_text (_("FILE START:")); - + time_table.set_col_spacings (2); time_table.set_row_spacings (5); time_table.set_border_width (5); @@ -149,9 +149,9 @@ AudioRegionEditor::AudioRegionEditor (Session& s, boost::shared_ptr<AudioRegion> bounds_changed (Change (StartChanged|LengthChanged|PositionChanged|StartChanged|Region::SyncOffsetChanged)); _region->StateChanged.connect (mem_fun(*this, &AudioRegionEditor::region_changed)); - + spin_arrow_grab = false; - + connect_editor_events (); } @@ -171,7 +171,7 @@ AudioRegionEditor::region_changed (Change what_changed) } } -gint +gint AudioRegionEditor::bpressed (GdkEventButton* ev, Gtk::SpinButton* /*but*/, void (AudioRegionEditor::*/*pmf*/)()) { switch (ev->button) { @@ -184,9 +184,9 @@ AudioRegionEditor::bpressed (GdkEventButton* ev, Gtk::SpinButton* /*but*/, void // if ((ev->window == but->gobj()->panel)) { // spin_arrow_grab = true; // (this->*pmf)(); - // } - } - } + // } + } + } break; default: break; @@ -194,7 +194,7 @@ AudioRegionEditor::bpressed (GdkEventButton* ev, Gtk::SpinButton* /*but*/, void return FALSE; } -gint +gint AudioRegionEditor::breleased (GdkEventButton* /*ev*/, Gtk::SpinButton* /*but*/, void (AudioRegionEditor::*pmf)()) { if (spin_arrow_grab) { @@ -240,7 +240,7 @@ AudioRegionEditor::end_clock_changed () _session.begin_reversible_command (_("change region end position")); boost::shared_ptr<Playlist> pl = _region->playlist(); - + if (pl) { XMLNode &before = pl->get_state(); _region->trim_end (end_clock.current_time(), this); @@ -257,9 +257,9 @@ void AudioRegionEditor::length_clock_changed () { nframes_t frames = length_clock.current_time(); - + _session.begin_reversible_command (_("change region length")); - + boost::shared_ptr<Playlist> pl = _region->playlist(); if (pl) { @@ -319,8 +319,8 @@ AudioRegionEditor::bounds_changed (Change what_changed) void AudioRegionEditor::activation () { - -} + +} void AudioRegionEditor::name_entry_changed () diff --git a/gtk2_ardour/audio_region_editor.h b/gtk2_ardour/audio_region_editor.h index 57a9ba40c6..00e77e430e 100644 --- a/gtk2_ardour/audio_region_editor.h +++ b/gtk2_ardour/audio_region_editor.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -71,7 +71,7 @@ class AudioRegionEditor : public RegionEditor Gtk::ToggleButton audition_button; Gtk::HBox lower_hbox; - + Gtk::Table time_table; Gtk::Label position_label; diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index d688e9e629..c8d33ec2e2 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001-2006 Paul Davis + Copyright (C) 2001-2006 Paul Davis This program is free software; you can r>edistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -82,7 +82,7 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView } -AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu, +AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu, Gdk::Color const & basic_color, bool recording, TimeAxisViewItem::Visibility visibility) : RegionView (parent, tv, r, spu, basic_color, recording, visibility) , sync_mark(0) @@ -118,7 +118,7 @@ AudioRegionView::AudioRegionView (const AudioRegionView& other) UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a); c.set_rgb_p (r/255.0, g/255.0, b/255.0); - + init (c, false); } @@ -149,9 +149,9 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd) { // FIXME: Some redundancy here with RegionView::init. Need to figure out // where order is important and where it isn't... - + RegionView::init (basic_color, wfd); - + XMLNode *node; _amplitude_above_axis = 1.0; @@ -170,13 +170,13 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd) } compute_colors (basic_color); - + create_waves (); fade_in_shape = new ArdourCanvas::Polygon (*group); fade_in_shape->property_fill_color_rgba() = fade_color; fade_in_shape->set_data ("regionview", this); - + fade_out_shape = new ArdourCanvas::Polygon (*group); fade_out_shape->property_fill_color_rgba() = fade_color; fade_out_shape->set_data ("regionview", this); @@ -184,17 +184,17 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd) { uint32_t r,g,b,a; UINT_TO_RGBA(fill_color,&r,&g,&b,&a); - + fade_in_handle = new ArdourCanvas::SimpleRect (*group); fade_in_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,0); fade_in_handle->property_outline_pixels() = 0; - + fade_in_handle->set_data ("regionview", this); - + fade_out_handle = new ArdourCanvas::SimpleRect (*group); fade_out_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,0); fade_out_handle->property_outline_pixels() = 0; - + fade_out_handle->set_data ("regionview", this); } @@ -315,7 +315,7 @@ AudioRegionView::fade_in_active_changed () fade_in_shape->property_fill_color_rgba() = col; fade_in_shape->property_width_pixels() = 0; fade_in_shape->property_outline_color_rgba() = RGBA_TO_UINT(r,g,b,0); - } else { + } else { col = RGBA_TO_UINT(r,g,b,0); fade_in_shape->property_fill_color_rgba() = col; fade_in_shape->property_width_pixels() = 1; @@ -335,7 +335,7 @@ AudioRegionView::fade_out_active_changed () fade_out_shape->property_fill_color_rgba() = col; fade_out_shape->property_width_pixels() = 0; fade_out_shape->property_outline_color_rgba() = RGBA_TO_UINT(r,g,b,0); - } else { + } else { col = RGBA_TO_UINT(r,g,b,0); fade_out_shape->property_fill_color_rgba() = col; fade_out_shape->property_width_pixels() = 1; @@ -359,7 +359,7 @@ void AudioRegionView::region_renamed () { Glib::ustring str = RegionView::make_name (); - + if (audio_region()->speed_mismatch (trackview.session().frame_rate())) { str = string ("*") + str; } @@ -384,7 +384,7 @@ AudioRegionView::region_resized (Change what_changed) for (uint32_t n = 0; n < waves.size(); ++n) { waves[n]->property_region_start() = _region->start(); } - + for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { if((agr = dynamic_cast<AudioGhostRegion*>(*i)) != 0) { @@ -452,7 +452,7 @@ AudioRegionView::setup_fade_handle_positions() fade_in_handle->property_y1() = handle_pos; fade_in_handle->property_y2() = handle_pos + handle_height; } - + if (fade_out_handle) { fade_out_handle->property_y1() = handle_pos; fade_out_handle->property_y2() = handle_pos + handle_height; @@ -468,7 +468,7 @@ AudioRegionView::set_height (gdouble height) // FIXME: ick height -= 2; - + _height = height; for (uint32_t n=0; n < wcnt; ++n) { @@ -479,9 +479,9 @@ AudioRegionView::set_height (gdouble height) } else { ht = (((height-2*wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt); } - + gdouble yoff = n * (ht+1); - + waves[n]->property_height() = ht; waves[n]->property_y() = yoff + 2; } @@ -535,7 +535,7 @@ AudioRegionView::reset_fade_in_shape () { reset_fade_in_shape_width ((nframes_t) audio_region()->fade_in()->back()->when); } - + void AudioRegionView::reset_fade_in_shape_width (nframes_t width) { @@ -550,8 +550,8 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width) Points* points; double pwidth = width / samples_per_unit; uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth); - double h; - + double h; + if (_height < 5) { fade_in_shape->hide(); fade_in_handle->hide(); @@ -560,7 +560,7 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width) double handle_center; handle_center = pwidth; - + if (handle_center > 7.0) { handle_center -= 3.0; } else { @@ -569,7 +569,7 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width) fade_in_handle->property_x1() = handle_center - 3.0; fade_in_handle->property_x2() = handle_center + 3.0; - + if (pwidth < 5) { fade_in_shape->hide(); return; @@ -599,7 +599,7 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width) (*points)[pi].set_x(1 + (pc * xdelta)); (*points)[pi++].set_y(2 + (h - (curve[pc] * h))); } - + /* fold back */ (*points)[pi].set_x(pwidth); @@ -611,10 +611,10 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width) /* connect the dots ... */ (*points)[pi] = (*points)[0]; - + fade_in_shape->property_points() = *points; delete points; - + /* ensure trim handle stays on top */ frame_handle_start->raise_to_top(); } @@ -627,7 +627,7 @@ AudioRegionView::reset_fade_out_shape () void AudioRegionView::reset_fade_out_shape_width (nframes_t width) -{ +{ if (fade_out_handle == 0) { return; } @@ -649,23 +649,23 @@ AudioRegionView::reset_fade_out_shape_width (nframes_t width) double handle_center; handle_center = (_region->length() - width) / samples_per_unit; - + if (handle_center > 7.0) { handle_center -= 3.0; } else { handle_center = 3.0; } - + fade_out_handle->property_x1() = handle_center - 3.0; fade_out_handle->property_x2() = handle_center + 3.0; /* don't show shape if its too small */ - + if (pwidth < 5) { fade_out_shape->hide(); return; - } - + } + if (trackview.session().config.get_show_region_fades()) { fade_out_shape->show(); } @@ -690,7 +690,7 @@ AudioRegionView::reset_fade_out_shape_width (nframes_t width) (*points)[pi].set_x(_pixel_width - 1 - pwidth + (pc*xdelta)); (*points)[pi++].set_y(2 + (h - (curve[pc] * h))); } - + /* fold back */ (*points)[pi].set_x(_pixel_width); @@ -705,7 +705,7 @@ AudioRegionView::reset_fade_out_shape_width (nframes_t width) fade_out_shape->property_points() = *points; delete points; - + /* ensure trim handle stays on top */ frame_handle_end->raise_to_top(); } @@ -740,7 +740,7 @@ void AudioRegionView::compute_colors (Gdk::Color const & basic_color) { RegionView::compute_colors (basic_color); - + uint32_t r, g, b, a; /* gain color computed in envelope_active_changed() */ @@ -753,7 +753,7 @@ void AudioRegionView::set_colors () { RegionView::set_colors(); - + if (gain_line) { gain_line->set_line_color (audio_region()->envelope_active() ? ARDOUR_UI::config()->canvasvar_GainLine.get() : ARDOUR_UI::config()->canvasvar_GainLineInactive.get()); } @@ -778,7 +778,7 @@ AudioRegionView::show_region_editor () // GTK2FIX : how to ensure float without realizing // editor->realize (); // trackview.editor.ensure_float (*editor); - } + } editor->present (); editor->show_all(); @@ -852,18 +852,18 @@ AudioRegionView::create_waves () // cerr << "creating waves for " << _region->name() << " with wfd = " << wait_for_data // << " and channels = " << nchans.n_audio() << endl; - + /* in tmp_waves, set up null pointers for each channel so the vector is allocated */ for (uint32_t n = 0; n < nchans.n_audio(); ++n) { tmp_waves.push_back (0); } for (uint32_t n = 0; n < nchans.n_audio(); ++n) { - + if (n >= audio_region()->n_channels()) { break; } - + wave_caches.push_back (WaveView::create_cache ()); // cerr << "\tchannel " << n << endl; @@ -877,7 +877,7 @@ AudioRegionView::create_waves () // we'll get a PeaksReady signal from the source in the future // and will call create_one_wave(n) then. } - + } else { // cerr << "\tdon't delay, display today!\n"; create_one_wave (n, true); @@ -948,9 +948,9 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/) } else { /* n-channel track, >n-channel source */ } - + /* see if we're all ready */ - + for (n = 0; n < nchans; ++n) { if (tmp_waves[n] == 0) { break; @@ -965,7 +965,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/) tmp_waves.clear (); /* all waves created, don't hook into peaks ready anymore */ - data_ready_connection.disconnect (); + data_ready_connection.disconnect (); #if 0 if (!zero_line) { @@ -998,7 +998,7 @@ AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev) /* don't create points that can't be seen */ set_envelope_visible (true); - + x = ev->button.x; y = ev->button.y; @@ -1029,7 +1029,7 @@ AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev) } audio_region()->envelope()->add (fx, y); - + XMLNode &after = audio_region()->envelope()->get_state(); trackview.session().add_command (new MementoCommand<AutomationList>(*audio_region()->envelope().get(), &before, &after)); trackview.session().commit_reversible_command (); @@ -1084,13 +1084,13 @@ AudioRegionView::set_flags (XMLNode* node) } } } - + void AudioRegionView::set_waveform_shape (WaveformShape shape) { bool yn; - /* this slightly odd approach is to leave the door open to + /* this slightly odd approach is to leave the door open to other "shapes" such as spectral displays, etc. */ @@ -1155,15 +1155,15 @@ AudioRegionView::add_ghost (TimeAxisView& tv) double unit_position = _region->position () / samples_per_unit; AudioGhostRegion* ghost = new AudioGhostRegion (tv, trackview, unit_position); uint32_t nchans; - + nchans = rtv->get_diskstream()->n_channels().n_audio(); for (uint32_t n = 0; n < nchans; ++n) { - + if (n >= audio_region()->n_channels()) { break; } - + WaveView *wave = new WaveView(*ghost->group); wave->property_data_src() = _region.get(); @@ -1202,7 +1202,7 @@ AudioRegionView::entered () uint32_t r,g,b,a; UINT_TO_RGBA(fade_color,&r,&g,&b,&a); a=255; - + if (fade_in_handle) { fade_in_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,a); fade_out_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,a); @@ -1215,11 +1215,11 @@ AudioRegionView::exited () if (gain_line) { gain_line->hide_all_but_selected_control_points (); } - + uint32_t r,g,b,a; UINT_TO_RGBA(fade_color,&r,&g,&b,&a); a=0; - + if (fade_in_handle) { fade_in_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,a); fade_out_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,a); @@ -1244,11 +1244,11 @@ AudioRegionView::set_waveview_data_src() // TODO: something else to let it know the channel waves[n]->property_data_src() = _region.get(); } - + for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { - + (*i)->set_duration (unit_length); - + if((agr = dynamic_cast<AudioGhostRegion*>(*i)) != 0) { for (vector<WaveView*>::iterator w = agr->waves.begin(); w != agr->waves.end(); ++w) { (*w)->property_data_src() = _region.get(); @@ -1287,7 +1287,7 @@ AudioRegionView::set_frame_color () } uint32_t r,g,b,a; - + if (_selected && should_show_selection) { UINT_TO_RGBA(ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get(), &r, &g, &b, &a); frame->property_fill_color_rgba() = RGBA_TO_UINT(r, g, b, fill_opacity ? fill_opacity : a); @@ -1338,10 +1338,10 @@ AudioRegionView::set_fade_visibility (bool yn) } if (fade_out_shape) { fade_out_shape->show (); - } + } if (fade_in_handle) { fade_in_handle->show (); - } + } if (fade_out_handle) { fade_out_handle->show (); } @@ -1351,10 +1351,10 @@ AudioRegionView::set_fade_visibility (bool yn) } if (fade_out_shape) { fade_out_shape->hide (); - } + } if (fade_in_handle) { fade_in_handle->hide (); - } + } if (fade_out_handle) { fade_out_handle->hide (); } diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index cbd9e1f645..9fe658f877 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001-2006 Paul Davis + Copyright (C) 2001-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,13 +48,13 @@ class RouteTimeAxisView; class AudioRegionView : public RegionView { public: - AudioRegionView (ArdourCanvas::Group *, + AudioRegionView (ArdourCanvas::Group *, RouteTimeAxisView&, boost::shared_ptr<ARDOUR::AudioRegion>, double initial_samples_per_unit, Gdk::Color const & basic_color); - AudioRegionView (ArdourCanvas::Group *, + AudioRegionView (ArdourCanvas::Group *, RouteTimeAxisView&, boost::shared_ptr<ARDOUR::AudioRegion>, double samples_per_unit, @@ -66,43 +66,43 @@ class AudioRegionView : public RegionView AudioRegionView (const AudioRegionView& other, boost::shared_ptr<ARDOUR::AudioRegion>); ~AudioRegionView (); - + virtual void init (Gdk::Color const & base_color, bool wait_for_data); - + boost::shared_ptr<ARDOUR::AudioRegion> audio_region() const; - + void create_waves (); void set_height (double); void set_samples_per_unit (double); - + void set_amplitude_above_axis (gdouble spp); - + void temporarily_hide_envelope (); ///< Dangerous! void unhide_envelope (); ///< Dangerous! - + void set_envelope_visible (bool); void set_waveform_visible (bool yn); void set_waveform_shape (ARDOUR::WaveformShape); void set_waveform_scale (ARDOUR::WaveformScale); - + bool waveform_rectified() const { return _flags & WaveformRectified; } bool waveform_logscaled() const { return _flags & WaveformLogScaled; } bool waveform_visible() const { return _flags & WaveformVisible; } bool envelope_visible() const { return _flags & EnvelopeVisible; } - + void show_region_editor (); - + void add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event); void remove_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event); - + AudioRegionGainLine* get_gain_line() const { return gain_line; } - + void region_changed (ARDOUR::Change); void envelope_active_changed (); - + GhostRegion* add_ghost (TimeAxisView&); - + void reset_fade_in_shape_width (nframes_t); void reset_fade_out_shape_width (nframes_t); @@ -111,14 +111,14 @@ class AudioRegionView : public RegionView virtual void entered (); virtual void exited (); - + protected: /* this constructor allows derived types to specify their visibility requirements to the TimeAxisViewItem parent class */ - + enum Flags { EnvelopeVisible = 0x1, WaveformVisible = 0x4, @@ -128,20 +128,20 @@ class AudioRegionView : public RegionView std::vector<ArdourCanvas::WaveView *> waves; std::vector<ArdourCanvas::WaveView *> tmp_waves; ///< see ::create_waves() - ArdourCanvas::Polygon* sync_mark; ///< polgyon for sync position + ArdourCanvas::Polygon* sync_mark; ///< polgyon for sync position ArdourCanvas::SimpleLine* zero_line; ArdourCanvas::Polygon* fade_in_shape; ArdourCanvas::Polygon* fade_out_shape; ArdourCanvas::SimpleRect* fade_in_handle; ArdourCanvas::SimpleRect* fade_out_handle; - + AudioRegionGainLine * gain_line; double _amplitude_above_axis; uint32_t _flags; uint32_t fade_color; - + void reset_fade_shapes (); void reset_fade_in_shape (); void reset_fade_out_shape (); diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index 901828bb4e..6fcca999ce 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001, 2006 Paul Davis + Copyright (C) 2001, 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -71,7 +71,7 @@ AudioStreamView::~AudioStreamView () { } -int +int AudioStreamView::set_samples_per_unit (gdouble spp) { StreamView::set_samples_per_unit(spp); @@ -83,7 +83,7 @@ AudioStreamView::set_samples_per_unit (gdouble spp) return 0; } -int +int AudioStreamView::set_amplitude_above_axis (gdouble app) { RegionViewList::iterator i; @@ -114,20 +114,20 @@ AudioStreamView::create_region_view (boost::shared_ptr<Region> r, bool wait_for_ } switch (_trackview.audio_track()->mode()) { - + case NonLayered: case Normal: if (recording) { - region_view = new AudioRegionView (canvas_group, _trackview, region, + region_view = new AudioRegionView (canvas_group, _trackview, region, _samples_per_unit, region_color, recording, TimeAxisViewItem::Visibility( TimeAxisViewItem::ShowFrame | TimeAxisViewItem::HideFrameRight)); } else { - region_view = new AudioRegionView (canvas_group, _trackview, region, + region_view = new AudioRegionView (canvas_group, _trackview, region, _samples_per_unit, region_color); } break; case Destructive: - region_view = new TapeAudioRegionView (canvas_group, _trackview, region, + region_view = new TapeAudioRegionView (canvas_group, _trackview, region, _samples_per_unit, region_color); break; default: @@ -140,8 +140,8 @@ AudioStreamView::create_region_view (boost::shared_ptr<Region> r, bool wait_for_ region_view->set_amplitude_above_axis(_amplitude_above_axis); region_view->set_height (child_height ()); - /* if its the special single-sample length that we use for rec-regions, make it - insensitive to events + /* if its the special single-sample length that we use for rec-regions, make it + insensitive to events */ if (region->length() == 1) { @@ -152,7 +152,7 @@ AudioStreamView::create_region_view (boost::shared_ptr<Region> r, bool wait_for_ region_view->set_waveform_shape (Config->get_waveform_shape ()); region_view->set_waveform_visible (Config->get_show_waveforms ()); - return region_view; + return region_view; } RegionView* @@ -168,7 +168,7 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wai // if ((*i)->region() == r) { // cerr << "audio_streamview in add_region_view_internal region found" << endl; /* great. we already have a AudioRegionView for this Region. use it again. */ - + // (*i)->set_valid (true); // this might not be necessary @@ -178,7 +178,7 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wai // arv->set_waveform_scale (_waveform_scale); // arv->set_waveform_shape (_waveform_shape); // } - + // return NULL; // } // } @@ -209,16 +209,16 @@ AudioStreamView::remove_region_view (boost::weak_ptr<Region> weak_r) for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end();) { CrossfadeViewList::iterator tmp; - + tmp = i; ++tmp; - + boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion>(r); if (ar && i->second->crossfade->involves (ar)) { delete i->second; crossfade_views.erase (i); } - + i = tmp; } } @@ -254,7 +254,7 @@ AudioStreamView::playlist_modified (boost::shared_ptr<Diskstream> ds) ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::playlist_modified_weak), ds)); StreamView::playlist_modified (ds); - + /* make sure xfades are on top and all the regionviews are stacked correctly. */ for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { @@ -306,7 +306,7 @@ AudioStreamView::add_crossfade (boost::shared_ptr<Crossfade> crossfade) AudioRegionView* rview = 0; /* we do not allow shared_ptr<T> to be bound to slots */ - + ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::add_crossfade_weak), boost::weak_ptr<Crossfade> (crossfade))); /* first see if we already have a CrossfadeView for this Crossfade */ @@ -397,12 +397,12 @@ AudioStreamView::redisplay_diskstream () boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>( _trackview.get_diskstream()->playlist() ); - + if (apl) { apl->foreach_crossfade (sigc::mem_fun (*this, &AudioStreamView::add_crossfade)); } } - + // Remove invalid crossfade views for (xi = crossfade_views.begin(); xi != crossfade_views.end();) { tmpx = xi; @@ -439,7 +439,7 @@ AudioStreamView::set_waveform_shape (WaveformShape shape) if (arv) arv->set_waveform_shape (shape); } -} +} void AudioStreamView::set_waveform_scale (WaveformScale scale) @@ -450,7 +450,7 @@ AudioStreamView::set_waveform_scale (WaveformScale scale) arv->set_waveform_scale (scale); } } -} +} void AudioStreamView::setup_rec_box () @@ -461,8 +461,8 @@ AudioStreamView::setup_rec_box () // cerr << "\trolling\n"; - if (!rec_active && - _trackview.session().record_status() == Session::Recording && + if (!rec_active && + _trackview.session().record_status() == Session::Recording && _trackview.get_diskstream()->record_enabled()) { if (_trackview.audio_track()->mode() == Normal && use_rec_regions && rec_regions.size() == rec_rects.size()) { @@ -474,7 +474,7 @@ AudioStreamView::setup_rec_box () (*prc).disconnect(); } rec_data_ready_connections.clear(); - + // FIXME boost::shared_ptr<AudioDiskstream> ads = boost::dynamic_pointer_cast<AudioDiskstream>(_trackview.get_diskstream()); assert(ads); @@ -483,19 +483,19 @@ AudioStreamView::setup_rec_box () boost::shared_ptr<AudioFileSource> src = boost::static_pointer_cast<AudioFileSource> (ads->write_source (n)); if (src) { sources.push_back (src); - + rec_data_ready_connections.push_back (src->PeakRangeReady.connect (bind - (mem_fun (*this, &AudioStreamView::rec_peak_range_ready), boost::weak_ptr<Source>(src)))); + (mem_fun (*this, &AudioStreamView::rec_peak_range_ready), boost::weak_ptr<Source>(src)))); } } // handle multi - + nframes_t start = 0; if (rec_regions.size() > 0) { start = rec_regions.back().first->start() + _trackview.get_diskstream()->get_captured_frames(rec_regions.size()-1); } - + boost::shared_ptr<AudioRegion> region (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (sources, start, 1 , "", 0, (Region::Flag)(Region::DefaultFlags), false))); assert(region); @@ -503,7 +503,7 @@ AudioStreamView::setup_rec_box () region->set_position (_trackview.session().transport_frame(), this); rec_regions.push_back (make_pair(region, (RegionView*)0)); } - + /* start a new rec box */ boost::shared_ptr<AudioTrack> at; @@ -531,7 +531,7 @@ AudioStreamView::setup_rec_box () fill_color = UINT_RGBA_CHANGE_A (fill_color, 120); break; } - + ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*canvas_group); rec_rect->property_x1() = xstart; rec_rect->property_y1() = 1.0; @@ -541,16 +541,16 @@ AudioStreamView::setup_rec_box () rec_rect->property_outline_what() = 0x1 | 0x2 | 0x4 | 0x8; rec_rect->property_fill_color_rgba() = fill_color; rec_rect->lower_to_bottom(); - + RecBoxInfo recbox; recbox.rectangle = rec_rect; recbox.start = _trackview.session().transport_frame(); recbox.length = 0; - + rec_rects.push_back (recbox); - + screen_update_connection.disconnect(); - screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun (*this, &AudioStreamView::update_rec_box)); + screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun (*this, &AudioStreamView::update_rec_box)); rec_updating = true; rec_active = true; @@ -561,7 +561,7 @@ AudioStreamView::setup_rec_box () rec_active = false; rec_updating = false; } - + } else { // cerr << "\tNOT rolling, rec_rects = " << rec_rects.size() << " rec_regions = " << rec_regions.size() << endl; @@ -578,7 +578,7 @@ AudioStreamView::setup_rec_box () rec_updating = false; rec_active = false; - + /* remove temp regions */ for (list<pair<boost::shared_ptr<Region>,RegionView*> >::iterator iter = rec_regions.begin(); iter != rec_regions.end(); ) { @@ -591,7 +591,7 @@ AudioStreamView::setup_rec_box () iter = tmp; } - + rec_regions.clear(); // cerr << "\tclear " << rec_rects.size() << " rec rects\n"; @@ -601,9 +601,9 @@ AudioStreamView::setup_rec_box () RecBoxInfo &rect = (*iter); delete rect.rectangle; } - + rec_rects.clear(); - + } } } @@ -620,21 +620,21 @@ void AudioStreamView::rec_peak_range_ready (nframes_t start, nframes_t cnt, boost::weak_ptr<Source> weak_src) { ENSURE_GUI_THREAD(bind (mem_fun (*this, &AudioStreamView::rec_peak_range_ready), start, cnt, weak_src)); - + boost::shared_ptr<Source> src (weak_src.lock()); if (!src) { - return; + return; } // this is called from the peak building thread - + if (rec_data_ready_map.size() == 0 || start+cnt > last_rec_data_frame) { last_rec_data_frame = start + cnt; } - + rec_data_ready_map[src] = true; - + if (rec_data_ready_map.size() == _trackview.get_diskstream()->n_channels().n_audio()) { this->update_rec_regions (); rec_data_ready_map.clear(); @@ -659,7 +659,7 @@ AudioStreamView::update_rec_regions () iter = tmp; continue; } - + boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion>(iter->first); if (!region) { continue; @@ -704,12 +704,12 @@ AudioStreamView::update_rec_regions () region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this); region->set_length (nlen, this); region->thaw ("updated"); - + if (origlen == 1) { /* our special initial length */ add_region_view_internal (region, false, true); } - + /* also hide rect */ ArdourCanvas::Item * rect = rec_rects[n].rectangle; rect->hide(); @@ -785,7 +785,7 @@ AudioStreamView::color_handler () //case cAudioTrackBase: if (_trackview.is_track()) { canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioTrackBase.get(); - } + } //case cAudioBusBase: if (!_trackview.is_track()) { @@ -811,25 +811,25 @@ void AudioStreamView::update_content_height (CrossfadeView* cv) { cv->show (); - + if (_layer_display == Overlaid) { - + cv->set_y (0); cv->set_height (height); - + } else { - + layer_t const inl = cv->crossfade->in()->layer (); layer_t const outl = cv->crossfade->out()->layer (); layer_t const high = max (inl, outl); layer_t const low = min (inl, outl); - + const double h = child_height (); cv->set_y ((_layers - high - 1) * h); cv->set_height ((high - low + 1) * h); - + } } diff --git a/gtk2_ardour/audio_streamview.h b/gtk2_ardour/audio_streamview.h index 8173e9bfb7..14c8465179 100644 --- a/gtk2_ardour/audio_streamview.h +++ b/gtk2_ardour/audio_streamview.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001, 2006 Paul Davis + Copyright (C) 2001, 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -79,9 +79,9 @@ class AudioStreamView : public StreamView private: void setup_rec_box (); - void rec_peak_range_ready (nframes_t start, nframes_t cnt, boost::weak_ptr<ARDOUR::Source> src); + void rec_peak_range_ready (nframes_t start, nframes_t cnt, boost::weak_ptr<ARDOUR::Source> src); void update_rec_regions (); - + RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>, bool wait_for_waves, bool recording = false); void remove_region_view (boost::weak_ptr<ARDOUR::Region> ); void remove_audio_region_view (boost::shared_ptr<ARDOUR::AudioRegion> ); @@ -105,9 +105,9 @@ class AudioStreamView : public StreamView void parameter_changed (std::string const &); void set_waveform_shape (ARDOUR::WaveformShape); void set_waveform_scale (ARDOUR::WaveformScale); - + double _amplitude_above_axis; - + typedef std::map<boost::shared_ptr<ARDOUR::Crossfade>, CrossfadeView*> CrossfadeViewList; CrossfadeViewList crossfade_views; bool crossfades_visible; diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index 50f0df74cc..7f239f4e67 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -91,7 +91,7 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::sh mute_button->set_active (false); solo_button->set_active (false); - + if (is_audio_track()) { controls_ebox.set_name ("AudioTrackControlsBaseUnselected"); } else { // bus @@ -106,7 +106,7 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::sh if (automation_track (GainAutomation) == 0) { create_automation_child (GainAutomation, false); } - + if (_route->panner()) { _route->panner()->Changed.connect (bind ( mem_fun(*this, &AudioTimeAxisView::ensure_pan_views), @@ -158,7 +158,7 @@ AudioTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent) { ensure_xml_node (); xml_node->add_property ("shown-editor", "yes"); - + return TimeAxisView::show_at (y, nth, parent); } @@ -185,7 +185,7 @@ AudioTimeAxisView::append_extra_display_menu_items () items.push_back (MenuElem (_("Show all crossfades"), mem_fun(*this, &AudioTimeAxisView::show_all_xfades))); } } - + Gtk::Menu* AudioTimeAxisView::build_mode_menu() { @@ -245,7 +245,7 @@ AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool return; } - boost::shared_ptr<AutomationTimeAxisView> + boost::shared_ptr<AutomationTimeAxisView> gain_track(new AutomationTimeAxisView (_session, _route, _route->amp(), c, _editor, @@ -285,7 +285,7 @@ AudioTimeAxisView::ensure_pan_views (bool show) boost::shared_ptr<ARDOUR::AutomationControl> pan_control = boost::dynamic_pointer_cast<ARDOUR::AutomationControl>( _route->panner()->data().control(*p)); - + if (pan_control->parameter().type() == NullAutomation) { error << "Pan control has NULL automation type!" << endmsg; continue; @@ -299,13 +299,13 @@ AudioTimeAxisView::ensure_pan_views (bool show) boost::shared_ptr<AutomationTimeAxisView> pan_track ( new AutomationTimeAxisView (_session, - _route, _route->panner(), pan_control, + _route, _route->panner(), pan_control, _editor, *this, false, parent_canvas, name)); - + add_automation_child (*p, pan_track, show); } } @@ -329,7 +329,7 @@ AudioTimeAxisView::toggle_gain_track () } /* now trigger a redisplay */ - + if (!no_redraw) { _route->gui_changed (X_("visible_tracks"), (void *) 0); /* EMIT_SIGNAL */ } @@ -369,7 +369,7 @@ AudioTimeAxisView::toggle_pan_track () } } #endif - + void AudioTimeAxisView::show_all_automation () { @@ -419,7 +419,7 @@ void AudioTimeAxisView::hide_all_xfades () { AudioStreamView* asv = audio_view(); - + if (asv) { asv->hide_all_xfades (); } diff --git a/gtk2_ardour/audio_time_axis.h b/gtk2_ardour/audio_time_axis.h index 9c66bbfce3..02c7ed4f19 100644 --- a/gtk2_ardour/audio_time_axis.h +++ b/gtk2_ardour/audio_time_axis.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -68,7 +68,7 @@ class AudioTimeAxisView : public RouteTimeAxisView public: AudioTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas); virtual ~AudioTimeAxisView (); - + AudioStreamView* audio_view(); void set_show_waveforms_recording (bool yn); @@ -76,24 +76,24 @@ class AudioTimeAxisView : public RouteTimeAxisView void hide_all_xfades (); void hide_dependent_views (TimeAxisViewItem&); void reveal_dependent_views (TimeAxisViewItem&); - + /* Overridden from parent to store display state */ guint32 show_at (double y, int& nth, Gtk::VBox *parent); void hide (); - + void create_automation_child (const Evoral::Parameter& param, bool show); - + void first_idle (); private: friend class AudioStreamView; friend class AudioRegionView; - + void route_active_changed (); void append_extra_display_menu_items (); Gtk::Menu* build_mode_menu(); - + void show_all_automation (); void show_existing_automation (); void hide_all_automation (); diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc index 90c6279f17..5d601cd829 100644 --- a/gtk2_ardour/automation_controller.cc +++ b/gtk2_ardour/automation_controller.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -44,16 +44,16 @@ AutomationController::AutomationController(boost::shared_ptr<AutomationControl> set_name (X_("PluginSlider")); // FIXME: get yer own name! set_style (BarController::LeftToRight); set_use_parent (true); - + StartGesture.connect (mem_fun(*this, &AutomationController::start_touch)); StopGesture.connect (mem_fun(*this, &AutomationController::end_touch)); - + _adjustment->signal_value_changed().connect ( mem_fun(*this, &AutomationController::value_adjusted)); - + _screen_update_connection = ARDOUR_UI::RapidScreenUpdate.connect ( mem_fun (*this, &AutomationController::display_effective_value)); - + ac->Changed.connect (mem_fun(*this, &AutomationController::value_changed)); } @@ -88,7 +88,7 @@ AutomationController::get_label (int&) } else { s << std::fixed << std::setprecision(3) << _controllable->get_value(); } - + return s.str (); } @@ -99,9 +99,9 @@ AutomationController::display_effective_value() // return; float value = _controllable->get_value(); - + if (_adjustment->get_value() != value) { - _ignore_change = true; + _ignore_change = true; _adjustment->set_value (value); _ignore_change = false; } @@ -133,9 +133,9 @@ AutomationController::automation_state_changed () ENSURE_GUI_THREAD(mem_fun(*this, &AutomationController::automation_state_changed)); bool x = (_controllable->automation_state() != Off); - + /* start watching automation so that things move */ - + _screen_update_connection.disconnect(); if (x) { diff --git a/gtk2_ardour/automation_controller.h b/gtk2_ardour/automation_controller.h index 6217aa10d2..05170b2a6b 100644 --- a/gtk2_ardour/automation_controller.h +++ b/gtk2_ardour/automation_controller.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -41,18 +41,18 @@ public: boost::shared_ptr<ARDOUR::AutomationControl> ac); ~AutomationController(); - + boost::shared_ptr<ARDOUR::AutomationControl> controllable() { return _controllable; } Gtk::Adjustment* adjustment() { return _adjustment; } - + void display_effective_value(); void value_adjusted(); private: AutomationController (boost::shared_ptr<ARDOUR::AutomationControl> ac, Gtk::Adjustment* adj); std::string get_label (int&); - + void start_touch(); void end_touch(); diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 553c23c88e..61687c79dd 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2003 Paul Davis + Copyright (C) 2002-2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -120,7 +120,7 @@ AutomationLine::queue_reset () } void -AutomationLine::show () +AutomationLine::show () { if (_interpolation != AutomationList::Discrete) { line->show(); @@ -136,7 +136,7 @@ AutomationLine::show () } void -AutomationLine::hide () +AutomationLine::hide () { line->hide(); for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) { @@ -157,7 +157,7 @@ AutomationLine::control_point_box_size () return 8.0; } else if (_height > (guint32) TimeAxisView::hNormal) { return 6.0; - } + } return 4.0; } @@ -262,7 +262,7 @@ AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi /* x-coord cannot move beyond adjacent points or the start/end, and is already in frames. it needs to be converted to canvas units. */ - + x = trackview.editor().frame_to_unit (x); /* clamp x position using view coordinates */ @@ -280,14 +280,14 @@ AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi if (!with_push) { if (cp.view_index() < control_points.size() - 1) { - + after = nth (cp.view_index() + 1); - + /*if it is a "spike" leave the x alone */ - + if (after->get_x() - before->get_x() < 2) { x = cp.get_x(); - + } else { x = min (x, after->get_x()-1.0); } @@ -298,7 +298,7 @@ AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi } else { ControlPoint* after; - + /* find the first point that can't move */ for (uint32_t n = cp.view_index() + 1; (after = nth (n)) != 0; ++n) { @@ -308,10 +308,10 @@ AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi break; } } - + delta = x - cp.get_x(); } - + } else { /* leave the x-coordinate alone */ @@ -328,17 +328,17 @@ AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi } else { uint32_t limit = min (control_points.size(), (size_t)last_movable); - + /* move the current point to wherever the user told it to go, subject to x_limit. */ - + cp.move_to (min (x, x_limit), y, ControlPoint::Full); reset_line_coords (cp); - + /* now move all subsequent control points, to reflect the motion. */ - + for (uint32_t i = cp.view_index() + 1; i < limit; ++i) { ControlPoint *p = nth (i); double new_x; @@ -354,7 +354,7 @@ AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi void AutomationLine::reset_line_coords (ControlPoint& cp) -{ +{ if (cp.view_index() < line_points.size()) { line_points[cp.view_index()].set_x (cp.get_x()); line_points[cp.view_index()].set_y (cp.get_y()); @@ -381,7 +381,7 @@ AutomationLine::model_representation (ControlPoint& cp, ModelRepresentation& mr) initial results are in canvas units. ask the line to convert them to something relevant. */ - + mr.xval = cp.get_x(); mr.yval = 1.0 - (cp.get_y() / _height); @@ -395,7 +395,7 @@ AutomationLine::model_representation (ControlPoint& cp, ModelRepresentation& mr) /* convert to model units */ - + view_to_model_coord (mr.xval, mr.yval); /* part 2: find out where the model point is now @@ -451,7 +451,7 @@ AutomationLine::determine_visible_control_points (ALPoints& points) uint32_t this_rx = 0; uint32_t prev_rx = 0; uint32_t this_ry = 0; - uint32_t prev_ry = 0; + uint32_t prev_ry = 0; double* slope; uint32_t box_size; uint32_t cpsize; @@ -459,7 +459,7 @@ AutomationLine::determine_visible_control_points (ALPoints& points) /* hide all existing points, and the line */ cpsize = 0; - + for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) { (*i)->hide(); ++cpsize; @@ -493,7 +493,7 @@ AutomationLine::determine_visible_control_points (ALPoints& points) double tx = points[pi].x; double ty = points[pi].y; - + if (isnan (tx) || isnan (ty)) { warning << string_compose (_("Ignoring illegal points on AutomationLine \"%1\""), _name) << endmsg; @@ -518,11 +518,11 @@ AutomationLine::determine_visible_control_points (ALPoints& points) if (slope[pi] == slope[pi-1]) { /* no reason to display this point */ - + continue; } } - + /* need to round here. the ultimate coordinates are integer pixels, so tiny deltas in the coords will be eliminated and we end up with "colinear" line segments. since the @@ -532,14 +532,14 @@ AutomationLine::determine_visible_control_points (ALPoints& points) */ this_rx = (uint32_t) rint (tx); - this_ry = (uint32_t) rint (ty); - + this_ry = (uint32_t) rint (ty); + if (view_index && pi != npoints && /* not the first, not the last */ (((this_rx == prev_rx) && (this_ry == prev_ry)) || /* same point */ (((this_rx - prev_rx) < (box_size + 2)) && /* not identical, but still too close horizontally */ (abs ((int)(this_ry - prev_ry)) < (int) (box_size + 2))))) { /* too close vertically */ continue; - } + } /* ok, we should display this point */ @@ -548,8 +548,8 @@ AutomationLine::determine_visible_control_points (ALPoints& points) /* make sure we have enough control points */ ControlPoint* ncp = new ControlPoint (*this); - - ncp->set_size (box_size); + + ncp->set_size (box_size); control_points.push_back (ncp); ++cpsize; @@ -586,7 +586,7 @@ AutomationLine::determine_visible_control_points (ALPoints& points) prev_ry = this_ry; /* finally, control visibility */ - + if (_visible && points_visible) { control_points[view_index]->show (); control_points[view_index]->set_visible (true); @@ -598,7 +598,7 @@ AutomationLine::determine_visible_control_points (ALPoints& points) view_index++; } - + /* discard extra CP's to avoid confusing ourselves */ while (control_points.size() > view_index) { @@ -616,7 +616,7 @@ AutomationLine::determine_visible_control_points (ALPoints& points) if (view_index > 1) { npoints = view_index; - + /* reset the line coordinates */ while (line_points.size() < npoints) { @@ -631,14 +631,14 @@ AutomationLine::determine_visible_control_points (ALPoints& points) line_points[view_index].set_x (control_points[view_index]->get_x()); line_points[view_index].set_y (control_points[view_index]->get_y()); } - + line->property_points() = line_points; if (_visible && _interpolation != AutomationList::Discrete) { line->show(); } - } + } set_selected_points (trackview.editor().get_selection().points); @@ -697,7 +697,7 @@ AutomationLine::string_to_fraction (string const & s) const double v; sscanf (s.c_str(), "%lf", &v); - + if (_uses_gain_mapping) { v = gain_to_slider_position (dB_to_coefficient (v)); } else { @@ -722,7 +722,7 @@ AutomationLine::invalidate_point (ALPoints& p, uint32_t index) } void -AutomationLine::start_drag (ControlPoint* cp, nframes_t x, float fraction) +AutomationLine::start_drag (ControlPoint* cp, nframes_t x, float fraction) { if (trackview.editor().current_session() == 0) { /* how? */ return; @@ -738,7 +738,7 @@ AutomationLine::start_drag (ControlPoint* cp, nframes_t x, float fraction) trackview.editor().current_session()->begin_reversible_command (str); trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0)); - + drag_x = x; drag_distance = 0; first_drag_fraction = fraction; @@ -748,7 +748,7 @@ AutomationLine::start_drag (ControlPoint* cp, nframes_t x, float fraction) } void -AutomationLine::point_drag (ControlPoint& cp, nframes_t x, float fraction, bool with_push) +AutomationLine::point_drag (ControlPoint& cp, nframes_t x, float fraction, bool with_push) { if (x > drag_x) { drag_distance += (x - drag_x); @@ -769,17 +769,17 @@ AutomationLine::point_drag (ControlPoint& cp, nframes_t x, float fraction, bool } void -AutomationLine::line_drag (uint32_t i1, uint32_t i2, float fraction, bool with_push) +AutomationLine::line_drag (uint32_t i1, uint32_t i2, float fraction, bool with_push) { double ydelta = fraction - last_drag_fraction; did_push = with_push; - + last_drag_fraction = fraction; line_drag_cp1 = i1; line_drag_cp2 = i2; - + //check if one of the control points on the line is in a selected range bool range_found = false; ControlPoint *cp; @@ -804,7 +804,7 @@ AutomationLine::line_drag (uint32_t i1, uint32_t i2, float fraction, bool with_p modify_view_point (*cp, trackview.editor().unit_to_frame (cp->get_x()), ((_height - cp->get_y()) /_height) + ydelta, with_push); } } - + if (line_points.size() > 1) { line->property_points() = line_points; } @@ -813,7 +813,7 @@ AutomationLine::line_drag (uint32_t i1, uint32_t i2, float fraction, bool with_p } void -AutomationLine::end_drag (ControlPoint* cp) +AutomationLine::end_drag (ControlPoint* cp) { if (!drags) { return; @@ -826,7 +826,7 @@ AutomationLine::end_drag (ControlPoint* cp) } else { sync_model_with_view_line (line_drag_cp1, line_drag_cp2); } - + alist->thaw (); update_pending = false; @@ -845,7 +845,7 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp, bool did_push, int model_representation (cp, mr); - /* how much are we changing the central point by */ + /* how much are we changing the central point by */ ydelta = mr.yval - mr.ypos; @@ -858,13 +858,13 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp, bool did_push, int /* change all points before the primary point */ for (AutomationList::iterator i = mr.start; i != cp.model(); ++i) { - + double fract = ((*i)->when - mr.xmin) / (mr.xpos - mr.xmin); double y_delta = ydelta * fract; double x_delta = distance * fract; /* interpolate */ - + if (y_delta || x_delta) { alist->modify (i, (*i)->when + x_delta, mr.ymin + y_delta); } @@ -877,24 +877,24 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp, bool did_push, int /* change later points */ - + AutomationList::iterator i = cp.model(); - + ++i; - + while (i != mr.end) { - + double delta = ydelta * (mr.xmax - (*i)->when) / (mr.xmax - mr.xpos); /* all later points move by the same distance along the x-axis as the main point */ - + if (delta) { alist->modify (i, (*i)->when + distance, (*i)->value + delta); } - + ++i; } - + if (did_push) { /* move all points after the range represented by the view by the same distance @@ -906,7 +906,7 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp, bool did_push, int } -bool +bool AutomationLine::control_points_adjacent (double xval, uint32_t & before, uint32_t& after) { ControlPoint *bcp = 0; @@ -916,13 +916,13 @@ AutomationLine::control_points_adjacent (double xval, uint32_t & before, uint32_ unit_xval = trackview.editor().frame_to_unit (xval); for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) { - + if ((*i)->get_x() <= unit_xval) { if (!bcp || (*i)->get_x() > bcp->get_x()) { bcp = *i; before = bcp->view_index(); - } + } } else if ((*i)->get_x() > unit_xval) { acp = *i; @@ -946,7 +946,7 @@ AutomationLine::is_last_point (ControlPoint& cp) if (!alist->empty() && mr.end == alist->end()) { return true; } - + return false; } @@ -962,7 +962,7 @@ AutomationLine::is_first_point (ControlPoint& cp) if (!alist->empty() && mr.start == alist->begin()) { return true; } - + return false; } @@ -997,10 +997,10 @@ AutomationLine::get_selectables (nframes_t& start, nframes_t& end, bool collecting = false; /* Curse X11 and its inverted coordinate system! */ - + bot = (1.0 - topfrac) * _height; top = (1.0 - botfrac) * _height; - + nstart = max_frames; nend = 0; @@ -1008,7 +1008,7 @@ AutomationLine::get_selectables (nframes_t& start, nframes_t& end, double when = (*(*i)->model())->when; if (when >= start && when <= end) { - + if ((*i)->get_y() >= bot && (*i)->get_y() <= top) { (*i)->show(); @@ -1018,7 +1018,7 @@ AutomationLine::get_selectables (nframes_t& start, nframes_t& end, nend = max (nend, when); } else { - + if (collecting) { results.push_back (new AutomationSelectable (nstart, nend, botfrac, topfrac, trackview)); @@ -1054,10 +1054,10 @@ AutomationLine::set_selected_points (PointSelection& points) if (points.empty()) { goto out; - } - + } + for (PointSelection::iterator r = points.begin(); r != points.end(); ++r) { - + if (&(*r).track != &trackview) { continue; } @@ -1068,16 +1068,16 @@ AutomationLine::set_selected_points (PointSelection& points) top = (1.0 - (*r).low_fract) * _height; for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) { - + double rstart, rend; - + rstart = trackview.editor().frame_to_unit ((*r).start); rend = trackview.editor().frame_to_unit ((*r).end); - + if ((*i)->get_x() >= rstart && (*i)->get_x() <= rend) { - + if ((*i)->get_y() >= bot && (*i)->get_y() <= top) { - + (*i)->set_selected(true); } } @@ -1105,21 +1105,21 @@ AutomationLine::show_selection () TimeSelection& time (trackview.editor().get_selection().time); for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) { - + (*i)->set_selected(false); for (list<AudioRange>::iterator r = time.begin(); r != time.end(); ++r) { double rstart, rend; - + rstart = trackview.editor().frame_to_unit ((*r).start); rend = trackview.editor().frame_to_unit ((*r).end); - + if ((*i)->get_x() >= rstart && (*i)->get_x() <= rend) { (*i)->set_selected(true); break; } } - + (*i)->show_color (false, !points_visible); } } @@ -1154,14 +1154,14 @@ AutomationLine::reset_callback (const Evoral::ControlList& events) AutomationList::const_iterator ai; for (ai = events.begin(); ai != events.end(); ++ai) { - + double translated_x = (*ai)->when; double translated_y = (*ai)->value; model_to_view_coord (translated_x, translated_y); add_model_point (tmp_points, (*ai)->when, translated_y); } - + determine_visible_control_points (tmp_points); } @@ -1236,7 +1236,7 @@ AutomationLine::hide_all_but_selected_control_points () } } } - + void AutomationLine::track_entered() { @@ -1260,7 +1260,7 @@ AutomationLine::get_state (void) return alist->get_state(); } -int +int AutomationLine::set_state (const XMLNode &node) { /* function as a proxy for the model */ @@ -1303,11 +1303,11 @@ AutomationLine::model_to_view_coord (double& x, double& y) const } else { y = y / (double)alist->parameter().max(); /* ... like this */ } - + x = _time_converter.to(x); } - + void AutomationLine::set_interpolation(AutomationList::InterpolationStyle style) { diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index 136196cd72..a171be1512 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,7 +33,7 @@ #include "evoral/TimeConverter.hpp" #include "pbd/undo.h" -#include "pbd/statefuldestructible.h" +#include "pbd/statefuldestructible.h" #include "ardour/automation_list.h" #include "ardour/types.h" @@ -66,13 +66,13 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin void set_selected_points (PointSelection&); void get_selectables (nframes_t& start, nframes_t& end, - double botfrac, double topfrac, + double botfrac, double topfrac, std::list<Selectable*>& results); void get_inverted_selectables (Selection&, std::list<Selectable*>& results); virtual void remove_point (ControlPoint&); bool control_points_adjacent (double xval, uint32_t& before, uint32_t& after); - + /* dragging API */ virtual void start_drag (ControlPoint*, nframes_t x, float fraction); virtual void point_drag(ControlPoint&, nframes_t x, float, bool with_push); @@ -129,13 +129,13 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin void set_colors(); void modify_point_y (ControlPoint&, double); - + protected: std::string _name; guint32 _height; uint32_t _line_color; - + boost::shared_ptr<ARDOUR::AutomationList> alist; bool _visible : 1; @@ -162,11 +162,11 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin static void invalidate_point (ALPoints&, uint32_t index); static bool invalid_point (ALPoints&, uint32_t index); - + void determine_visible_control_points (ALPoints&); void sync_model_with_view_point (ControlPoint&, bool did_push, int64_t distance); void sync_model_with_view_line (uint32_t, uint32_t); - + virtual void change_model (ARDOUR::AutomationList::iterator, double x, double y); void reset_callback (const Evoral::ControlList&); @@ -174,7 +174,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin virtual bool event_handler (GdkEvent*); virtual void add_model_point (ALPoints& tmp_points, double frame, double yfract); - + private: uint32_t drags; double first_drag_fraction; diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index ad10851c73..4d8f61fed5 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -36,12 +36,12 @@ AutomationRegionView::AutomationRegionView(ArdourCanvas::Group* Gdk::Color const & basic_color) : RegionView(parent, time_axis, region, spu, basic_color) , _parameter(param) -{ +{ if (list) { assert(list->parameter() == param); create_line(list); } - + group->signal_event().connect (mem_fun (this, &AutomationRegionView::canvas_event), false); } @@ -49,7 +49,7 @@ void AutomationRegionView::init (Gdk::Color const & basic_color, bool /*wfd*/) { _enable_display = false; - + RegionView::init(basic_color, false); compute_colors (basic_color); @@ -149,7 +149,7 @@ void AutomationRegionView::reset_width_dependent_items (double pixel_width) { RegionView::reset_width_dependent_items(pixel_width); - + if (_line) _line->reset(); } diff --git a/gtk2_ardour/automation_region_view.h b/gtk2_ardour/automation_region_view.h index 6ab9118017..5219fd7dc6 100644 --- a/gtk2_ardour/automation_region_view.h +++ b/gtk2_ardour/automation_region_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -48,18 +48,18 @@ public: Gdk::Color const & basic_color); ~AutomationRegionView() {} - + void init (Gdk::Color const & basic_color, bool wfd); - + inline AutomationTimeAxisView* automation_view() const { return dynamic_cast<AutomationTimeAxisView*>(&trackview); } - + void set_line(boost::shared_ptr<AutomationLine> line) { _line = line; } boost::shared_ptr<AutomationLine> line() { return _line; } - + // We are a ghost. Meta ghosts? Crazy talk. virtual GhostRegion* add_ghost(TimeAxisView&) { return NULL; } - + void set_height (double); void reset_width_dependent_items(double pixel_width); diff --git a/gtk2_ardour/automation_selectable.h b/gtk2_ardour/automation_selectable.h index e7139bedf0..851da8bf79 100644 --- a/gtk2_ardour/automation_selectable.h +++ b/gtk2_ardour/automation_selectable.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/automation_selection.h b/gtk2_ardour/automation_selection.h index f132ea95d8..f22d4831e2 100644 --- a/gtk2_ardour/automation_selection.h +++ b/gtk2_ardour/automation_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc index bed1bac502..273494e29b 100644 --- a/gtk2_ardour/automation_streamview.cc +++ b/gtk2_ardour/automation_streamview.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001-2007 Paul Davis + Copyright (C) 2001-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -98,7 +98,7 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region for (i = region_views.begin(); i != region_views.end(); ++i) { if ((*i)->region() == region) { - + /* great. we already have an AutomationRegionView for this Region. use it again. */ AutomationRegionView* arv = dynamic_cast<AutomationRegionView*>(*i);; @@ -111,14 +111,14 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region return NULL; } } - + region_view = new AutomationRegionView (canvas_group, _automation_view, region, _controller->controllable()->parameter(), list, _samples_per_unit, region_color); - + region_view->init (region_color, false); region_views.push_front (region_view); - + /* follow global waveform setting */ if (wfd) { @@ -130,7 +130,7 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region /* catch regionview going away */ region->GoingAway.connect (bind (mem_fun (*this, &AutomationStreamView::remove_region_view), region)); - + RegionViewAdded (region_view); return region_view; @@ -170,7 +170,7 @@ AutomationStreamView::redisplay_diskstream () sigc::hide_return (sigc::mem_fun (*this, &StreamView::add_region_view)) ); } - + // Stack regions by layer, and remove invalid regions layer_regions(); } @@ -190,9 +190,9 @@ void AutomationStreamView::rec_data_range_ready (jack_nframes_t start, jack_nframes_t dur) { // this is called from the butler thread for now - + ENSURE_GUI_THREAD(bind (mem_fun (*this, &AutomationStreamView::rec_data_range_ready), start, dur)); - + this->update_rec_regions (start, dur); } @@ -201,7 +201,7 @@ AutomationStreamView::color_handler () { /*if (_trackview.is_midi_track()) { canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MidiTrackBase.get(); - } + } if (!_trackview.is_midi_track()) { canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MidiBusBase.get();; diff --git a/gtk2_ardour/automation_streamview.h b/gtk2_ardour/automation_streamview.h index d11de8113b..0ab0086315 100644 --- a/gtk2_ardour/automation_streamview.h +++ b/gtk2_ardour/automation_streamview.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001, 2007 Paul Davis + Copyright (C) 2001, 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,23 +48,23 @@ class AutomationStreamView : public StreamView void set_automation_state (ARDOUR::AutoState state); void redisplay_diskstream (); - - inline double contents_height() const { + + inline double contents_height() const { return (_trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2); } - + private: void setup_rec_box (); - void rec_data_range_ready (jack_nframes_t start, jack_nframes_t dur); + void rec_data_range_ready (jack_nframes_t start, jack_nframes_t dur); void update_rec_regions (jack_nframes_t start, jack_nframes_t dur); - + RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>, bool wait_for_data, bool recording = false); void display_region(AutomationRegionView* region_view); - + void color_handler (); - + boost::shared_ptr<AutomationController> _controller; - + AutomationTimeAxisView& _automation_view; }; diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 806359e2ab..00bba2ba1b 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -61,7 +61,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro boost::shared_ptr<Automatable> a, boost::shared_ptr<AutomationControl> c, PublicEditor& e, TimeAxisView& parent, bool show_regions, ArdourCanvas::Canvas& canvas, const string & nom, const string & nomparent) - : AxisView (s), + : AxisView (s), TimeAxisView (s, e, &parent, canvas), _route (r), _control (c), @@ -87,17 +87,17 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro ignore_state_request = false; first_call_to_set_height = true; - + _base_rect = new SimpleRect(*_canvas_display); _base_rect->property_x1() = 0.0; _base_rect->property_y1() = 0.0; _base_rect->property_x2() = LONG_MAX - 2; _base_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_AutomationTrackOutline.get(); - + /* outline ends and bottom */ _base_rect->property_outline_what() = (guint32) (0x1|0x2|0x8); _base_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AutomationTrackFill.get(); - + _base_rect->set_data ("trackview", this); _base_rect->signal_event().connect (bind ( @@ -172,12 +172,12 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro tipname += _name; ARDOUR_UI::instance()->tooltips().set_tip(controls_ebox, tipname); } - + /* add the buttons */ controls_table.attach (hide_button, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); controls_table.attach (auto_button, 5, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - + /* add bar controller */ controls_table.attach (*_controller.get(), 0, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); @@ -195,14 +195,14 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro if (xml_node) { set_state (*xml_node); - } - + } + /* ask for notifications of any new RegionViews */ if (show_regions) { assert(_view); _view->attach (); - + /* no regions, just a single line for the entire track (e.g. bus gain) */ } else { boost::shared_ptr<AutomationLine> line(new AutomationLine ( @@ -281,7 +281,7 @@ AutomationTimeAxisView::automation_state_changed () } else { state = _control->alist()->automation_state (); } - + switch (state & (Off|Play|Touch|Write)) { case Off: auto_button.set_label (_("Manual")); @@ -335,9 +335,9 @@ AutomationTimeAxisView::automation_state_changed () void AutomationTimeAxisView::interpolation_changed () -{ +{ AutomationList::InterpolationStyle style = _control->list()->interpolation(); - + if (mode_line_item && mode_discrete_item) { if (style == AutomationList::Discrete) { mode_discrete_item->set_active(true); @@ -347,7 +347,7 @@ AutomationTimeAxisView::interpolation_changed () mode_discrete_item->set_active(false); } } - + if (_line) { _line->set_interpolation(style); } @@ -376,7 +376,7 @@ void AutomationTimeAxisView::set_height (uint32_t h) { bool changed = (height != (uint32_t) h) || first_call_to_set_height; - bool changed_between_small_and_normal = ( + bool changed_between_small_and_normal = ( (height < hNormal && h >= hNormal) || (height >= hNormal || h < hNormal) ); @@ -386,10 +386,10 @@ AutomationTimeAxisView::set_height (uint32_t h) TimeAxisView::set_height (h); _base_rect->property_y2() = h; - + if (_line) _line->set_height(h); - + if (_view) { _view->set_height(h); _view->update_contents_height(); @@ -407,7 +407,7 @@ AutomationTimeAxisView::set_height (uint32_t h) if (h >= hNormal) { controls_table.remove (name_hbox); - + if (plugname) { if (plugname_packed) { controls_table.remove (*plugname); @@ -422,7 +422,7 @@ AutomationTimeAxisView::set_height (uint32_t h) hide_name_entry (); show_name_label (); name_hbox.show_all (); - + auto_button.show(); hide_button.show_all(); @@ -439,7 +439,7 @@ AutomationTimeAxisView::set_height (uint32_t h) hide_name_entry (); show_name_label (); name_hbox.show_all (); - + auto_button.hide(); hide_button.hide(); } @@ -460,20 +460,20 @@ AutomationTimeAxisView::set_samples_per_unit (double spu) if (_line) _line->reset (); - + if (_view) _view->set_samples_per_unit (spu); } - + void AutomationTimeAxisView::hide_clicked () { // LAME fix for refreshing the hide button hide_button.set_sensitive(false); - + set_marked_for_display (false); hide (); - + hide_button.set_sensitive(true); } @@ -506,7 +506,7 @@ AutomationTimeAxisView::build_display_menu () Menu* auto_state_menu = manage (new Menu); auto_state_menu->set_name ("ArdourContextMenu"); MenuList& as_items = auto_state_menu->items(); - + as_items.push_back (CheckMenuElem (_("Manual"), bind ( mem_fun(*this, &AutomationTimeAxisView::set_automation_state), (AutoState) Off))); @@ -528,17 +528,17 @@ AutomationTimeAxisView::build_display_menu () auto_touch_item = dynamic_cast<CheckMenuItem*>(&as_items.back()); items.push_back (MenuElem (_("State"), *auto_state_menu)); - + /* mode menu */ if ( EventTypeMap::instance().is_midi_parameter(_control->parameter()) ) { - + Menu* auto_mode_menu = manage (new Menu); auto_mode_menu->set_name ("ArdourContextMenu"); MenuList& am_items = auto_mode_menu->items(); - + RadioMenuItem::Group group; - + am_items.push_back (RadioMenuElem (group, _("Discrete"), bind ( mem_fun(*this, &AutomationTimeAxisView::set_interpolation), AutomationList::Discrete))); @@ -661,7 +661,7 @@ AutomationTimeAxisView::reset_objects_one (AutomationLine& line, PointSelection& if (&(*i).track != this) { continue; } - + alist->reset_range ((*i).start, (*i).end); } } @@ -700,7 +700,7 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS _editor.get_cut_buffer().add (what_we_got); } break; - + case Clear: if ((what_we_got = alist->cut ((*i).start, (*i).end)) != 0) { _session.add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state())); @@ -736,7 +736,7 @@ AutomationTimeAxisView::paste_one (AutomationLine& line, nframes_t pos, float ti { AutomationSelection::iterator p; boost::shared_ptr<AutomationList> alist(line.the_list()); - + for (p = selection.lines.begin(); p != selection.lines.end() && nth; ++p, --nth) {} if (p == selection.lines.end()) { @@ -747,7 +747,7 @@ AutomationTimeAxisView::paste_one (AutomationLine& line, nframes_t pos, float ti values from view coordinates to model coordinates, and we're not supposed to modify the points in the selection. */ - + AutomationList copy (**p); for (AutomationList::iterator x = copy.begin(); x != copy.end(); ++x) { @@ -857,7 +857,7 @@ AutomationTimeAxisView::exited () } void -AutomationTimeAxisView::color_handler () +AutomationTimeAxisView::color_handler () { if (_line) { _line->set_colors(); @@ -877,7 +877,7 @@ AutomationTimeAxisView::set_state (const XMLNode& node) _canvas_display->show (); /* FIXME: necessary? show_at? */ } } - + if (!_marked_for_display) { hide(); } @@ -910,7 +910,7 @@ guint32 AutomationTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent) { update_extra_xml_shown (true); - + return TimeAxisView::show_at (y, nth, parent); } diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index 7390ee3d4f..f676034237 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -66,7 +66,7 @@ class AutomationTimeAxisView : public TimeAxisView { const std::string & plug_name = ""); ~AutomationTimeAxisView(); - + virtual void set_height (uint32_t); void set_samples_per_unit (double); std::string name() const { return _name; } @@ -84,20 +84,20 @@ class AutomationTimeAxisView : public TimeAxisView { void hide_timestretch () {} /* editing operations */ - + bool cut_copy_clear (Selection&, Editing::CutCopyOp); bool cut_copy_clear_objects (PointSelection&, Editing::CutCopyOp); bool paste (nframes_t, float times, Selection&, size_t nth); void reset_objects (PointSelection&); int set_state (const XMLNode&); - + guint32 show_at (double y, int& nth, Gtk::VBox *parent); void hide (); - + static const std::string state_node_name; XMLNode* get_state_node(); - + boost::shared_ptr<ARDOUR::AutomationControl> control() { return _control; } boost::shared_ptr<AutomationController> controller() { return _controller; } @@ -105,20 +105,20 @@ class AutomationTimeAxisView : public TimeAxisView { boost::shared_ptr<ARDOUR::Route> _route; ///< Parent route boost::shared_ptr<ARDOUR::AutomationControl> _control; ///< Control boost::shared_ptr<ARDOUR::Automatable> _automatable; ///< Control owner, maybe = _route - + boost::shared_ptr<AutomationController> _controller; - + ArdourCanvas::SimpleRect* _base_rect; boost::shared_ptr<AutomationLine> _line; AutomationStreamView* _view; - + std::string _name; bool ignore_toggle; bool first_call_to_set_height; Gtk::Button hide_button; - Gtk::Button auto_button; + Gtk::Button auto_button; Gtk::Menu* automation_menu; Gtk::Label* plugname; bool plugname_packed; @@ -132,7 +132,7 @@ class AutomationTimeAxisView : public TimeAxisView { Gtk::CheckMenuItem* mode_line_item; void add_line (boost::shared_ptr<AutomationLine>); - + void clear_clicked (); void hide_clicked (); void auto_clicked (); diff --git a/gtk2_ardour/axis_view.cc b/gtk2_ardour/axis_view.cc index 8e817c435c..bed5e098b0 100644 --- a/gtk2_ardour/axis_view.cc +++ b/gtk2_ardour/axis_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -59,7 +59,7 @@ Gdk::Color AxisView::unique_random_color() { Gdk::Color newcolor; - + while (1) { /* avoid neon/glowing tones by limiting them to the @@ -76,11 +76,11 @@ AxisView::unique_random_color() used_colors.push_back (newcolor); return newcolor; } - + for (list<Gdk::Color>::iterator i = used_colors.begin(); i != used_colors.end(); ++i) { Gdk::Color c = *i; float rdelta, bdelta, gdelta; - + rdelta = newcolor.get_red() - c.get_red(); bdelta = newcolor.get_blue() - c.get_blue(); gdelta = newcolor.get_green() - c.get_green(); diff --git a/gtk2_ardour/axis_view.h b/gtk2_ardour/axis_view.h index 9bd39eec3e..21220d5439 100644 --- a/gtk2_ardour/axis_view.h +++ b/gtk2_ardour/axis_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,7 +55,7 @@ class AxisView : public virtual Selectable virtual void set_marked_for_display (bool yn) { _marked_for_display = yn; } - + sigc::signal<void> Hiding; sigc::signal<void> GoingAway; @@ -66,7 +66,7 @@ class AxisView : public virtual Selectable AxisView (ARDOUR::Session& sess); virtual ~AxisView(); - + /** * Generate a new random TrackView color, unique from those colors already used. diff --git a/gtk2_ardour/bundle_manager.cc b/gtk2_ardour/bundle_manager.cc index ba62d73f0e..dd62751453 100644 --- a/gtk2_ardour/bundle_manager.cc +++ b/gtk2_ardour/bundle_manager.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -98,21 +98,21 @@ void BundleEditorMatrix::add_channel (boost::shared_ptr<Bundle> b) { if (b == _bundle) { - + NameChannelDialog d; d.set_position (Gtk::WIN_POS_MOUSE); - + if (d.run () != Gtk::RESPONSE_ACCEPT) { return; } - + _bundle->add_channel (d.get_name()); setup_ports (OURS); - + } else { - + PortMatrix::add_channel (b); - + } } @@ -185,7 +185,7 @@ BundleEditor::BundleEditor (Session& session, boost::shared_ptr<UserBundle> bund t->attach (*Gtk::manage (a), 1, 2, 1, 2); _input_or_output.append_text (_("Input")); _input_or_output.append_text (_("Output")); - + if (bundle->ports_are_inputs()) { _input_or_output.set_active_text (_("Input")); } else { @@ -201,10 +201,10 @@ BundleEditor::BundleEditor (Session& session, boost::shared_ptr<UserBundle> bund a = new Gtk::Alignment (0, 0.5, 0, 1); a->add (_type); t->attach (*Gtk::manage (a), 1, 2, 2, 3); - + _type.append_text (_("Audio")); _type.append_text (_("MIDI")); - + switch (bundle->type ()) { case DataType::AUDIO: _type.set_active_text (_("Audio")); @@ -215,7 +215,7 @@ BundleEditor::BundleEditor (Session& session, boost::shared_ptr<UserBundle> bund } _type.signal_changed().connect (sigc::mem_fun (*this, &BundleEditor::type_changed)); - + get_vbox()->pack_start (*Gtk::manage (t), false, false); get_vbox()->pack_start (_matrix); get_vbox()->set_spacing (4); @@ -226,7 +226,7 @@ BundleEditor::BundleEditor (Session& session, boost::shared_ptr<UserBundle> bund } else { add_button (Gtk::Stock::APPLY, Gtk::RESPONSE_ACCEPT); } - + show_all (); } @@ -248,7 +248,7 @@ void BundleEditor::input_or_output_changed () { _bundle->remove_ports_from_channels (); - + if (_input_or_output.get_active_text() == _("Output")) { _bundle->set_ports_are_outputs (); } else { @@ -262,7 +262,7 @@ void BundleEditor::type_changed () { _bundle->remove_ports_from_channels (); - + DataType const t = _type.get_active_text() == _("Audio") ? DataType::AUDIO : DataType::MIDI; @@ -290,7 +290,7 @@ BundleManager::BundleManager (Session& session) for (BundleList::iterator i = bundles->begin(); i != bundles->end(); ++i) { add_bundle (*i); } - + /* New / Edit / Delete buttons */ Gtk::VBox* buttons = new Gtk::VBox; buttons->set_spacing (8); @@ -304,7 +304,7 @@ BundleManager::BundleManager (Session& session) delete_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::DELETE, Gtk::ICON_SIZE_BUTTON))); delete_button.signal_clicked().connect (sigc::mem_fun (*this, &BundleManager::delete_clicked)); buttons->pack_start (delete_button, false, false); - + Gtk::HBox* h = new Gtk::HBox; h->set_spacing (8); h->set_border_width (8); @@ -395,7 +395,7 @@ BundleManager::bundle_changed (Bundle::Change c, boost::shared_ptr<UserBundle> b if ((c & Bundle::NameChanged) == 0) { return; } - + Gtk::TreeModel::iterator i = _list_model->children().begin (); while (i != _list_model->children().end()) { boost::shared_ptr<UserBundle> t = (*i)[_list_model_columns.bundle]; @@ -430,7 +430,7 @@ NameChannelDialog::NameChannelDialog (boost::shared_ptr<Bundle> b, uint32_t c) void NameChannelDialog::setup () -{ +{ Gtk::HBox* box = Gtk::manage (new Gtk::HBox ()); box->pack_start (*Gtk::manage (new Gtk::Label (_("Name")))); diff --git a/gtk2_ardour/bundle_manager.h b/gtk2_ardour/bundle_manager.h index dd4c711d4e..b9709c73ee 100644 --- a/gtk2_ardour/bundle_manager.h +++ b/gtk2_ardour/bundle_manager.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ class BundleEditorMatrix : public PortMatrix PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const; bool can_add_channel (boost::shared_ptr<ARDOUR::Bundle>) const; - + void add_channel (boost::shared_ptr<ARDOUR::Bundle>); bool can_remove_channels (boost::shared_ptr<ARDOUR::Bundle>) const; void remove_channel (ARDOUR::BundleChannel); @@ -59,7 +59,7 @@ class BundleEditorMatrix : public PortMatrix OTHER = 0, OURS = 1 }; - + boost::shared_ptr<PortGroup> _port_group; boost::shared_ptr<ARDOUR::Bundle> _bundle; }; @@ -77,7 +77,7 @@ class BundleEditor : public ArdourDialog void input_or_output_changed (); void type_changed (); void on_show (); - + BundleEditorMatrix _matrix; boost::shared_ptr<ARDOUR::UserBundle> _bundle; Gtk::Entry _name; @@ -106,11 +106,11 @@ class BundleManager : public ArdourDialog add (name); add (bundle); } - + Gtk::TreeModelColumn<Glib::ustring> name; Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::UserBundle> > bundle; }; - + Gtk::TreeView _tree_view; Glib::RefPtr<Gtk::ListStore> _list_model; ModelColumns _list_model_columns; @@ -130,7 +130,7 @@ public: private: void setup (); - + boost::shared_ptr<ARDOUR::Bundle> _bundle; uint32_t _channel; Gtk::Entry _name; diff --git a/gtk2_ardour/cairo_widget.cc b/gtk2_ardour/cairo_widget.cc index 573f3e5ba6..ae18c889c7 100644 --- a/gtk2_ardour/cairo_widget.cc +++ b/gtk2_ardour/cairo_widget.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ CairoWidget::on_expose_event (GdkEventExpose *event) Gdk::Rectangle content (0, 0, _width, _height); bool intersects; r.intersect (content, intersects); - + if (intersects) { GdkDrawable* drawable = get_window()->gobj (); @@ -79,7 +79,7 @@ CairoWidget::on_expose_event (GdkEventExpose *event) r.get_height() ); } - + return true; } diff --git a/gtk2_ardour/cairo_widget.h b/gtk2_ardour/cairo_widget.h index c274c0aaeb..8665f66198 100644 --- a/gtk2_ardour/cairo_widget.h +++ b/gtk2_ardour/cairo_widget.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,7 +43,7 @@ protected: int _width; ///< pixmap width int _height; ///< pixmap height - + private: bool _dirty; ///< true if the pixmap requires re-rendering GdkPixmap* _pixmap; ///< our pixmap diff --git a/gtk2_ardour/canvas-curve.h b/gtk2_ardour/canvas-curve.h index 2656330b17..cad9270454 100644 --- a/gtk2_ardour/canvas-curve.h +++ b/gtk2_ardour/canvas-curve.h @@ -46,7 +46,7 @@ struct _GnomeCanvasCurve float* vector; size_t veclen; uint32_t color; - + /* cached values set during update/used during render */ unsigned char r, b, g, a; diff --git a/gtk2_ardour/canvas-flag.cc b/gtk2_ardour/canvas-flag.cc index 813c0b1468..55bf853b7c 100644 --- a/gtk2_ardour/canvas-flag.cc +++ b/gtk2_ardour/canvas-flag.cc @@ -5,7 +5,7 @@ using namespace Gnome::Canvas; using namespace std; -void +void CanvasFlag::delete_allocated_objects() { delete _text; @@ -18,11 +18,11 @@ CanvasFlag::delete_allocated_objects() _rect = 0; } -void +void CanvasFlag::set_text(const string& a_text) { delete_allocated_objects(); - + _text = new InteractiveText(*this, this, 0.0, 0.0, Glib::ustring(a_text)); _text->property_justification() = Gtk::JUSTIFY_CENTER; _text->property_fill_color_rgba() = _outline_color_rgba; @@ -36,7 +36,7 @@ CanvasFlag::set_text(const string& a_text) _rect = new InteractiveRect(*this, this, 0.0, 0.0, flagwidth, flagheight); _rect->property_outline_color_rgba() = _outline_color_rgba; _rect->property_fill_color_rgba() = _fill_color_rgba; - _text->raise_to_top(); + _text->raise_to_top(); } CanvasFlag::~CanvasFlag() diff --git a/gtk2_ardour/canvas-flag.h b/gtk2_ardour/canvas-flag.h index a9dbb09175..781430f8e4 100644 --- a/gtk2_ardour/canvas-flag.h +++ b/gtk2_ardour/canvas-flag.h @@ -36,9 +36,9 @@ public: , _line(0) , _rect(0) {} - + virtual ~CanvasFlag(); - + virtual bool on_event(GdkEvent* ev); void set_text(const std::string& a_text); @@ -49,10 +49,10 @@ protected: guint _outline_color_rgba; guint _fill_color_rgba; MidiRegionView& _region; - + private: void delete_allocated_objects(); - + SimpleLine* _line; InteractiveRect* _rect; }; diff --git a/gtk2_ardour/canvas-hit.cc b/gtk2_ardour/canvas-hit.cc index 23a9a19137..9075eaaddd 100644 --- a/gtk2_ardour/canvas-hit.cc +++ b/gtk2_ardour/canvas-hit.cc @@ -19,7 +19,7 @@ CanvasHit::on_event(GdkEvent* ev) } } -void +void CanvasHit::move_event(double dx, double dy) { move_by (dx, dy); diff --git a/gtk2_ardour/canvas-hit.h b/gtk2_ardour/canvas-hit.h index 2a94907cd6..387f7c9860 100644 --- a/gtk2_ardour/canvas-hit.h +++ b/gtk2_ardour/canvas-hit.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -40,7 +40,7 @@ public: : Diamond(group, size), CanvasNoteEvent(region, this, note) { } - + void show() { Diamond::show(); } void hide() { Diamond::hide(); } @@ -48,7 +48,7 @@ public: double y1() { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return y1; } double x2() { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return x2; } double y2() { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return y2; } - + void set_outline_color(uint32_t c) { property_outline_color_rgba() = c; } void set_fill_color(uint32_t c) { property_fill_color_rgba() = c; } diff --git a/gtk2_ardour/canvas-imageframe.c b/gtk2_ardour/canvas-imageframe.c index 1f0e7e877b..3654836c79 100644 --- a/gtk2_ardour/canvas-imageframe.c +++ b/gtk2_ardour/canvas-imageframe.c @@ -7,8 +7,8 @@ * * Author: Federico Mena <federico@nuclecu.unam.mx> */ - - + + #include <string.h> /* for memcpy() */ #include <math.h> #include <stdio.h> @@ -103,7 +103,7 @@ gnome_canvas_imageframe_class_init (GnomeCanvasImageFrameClass *class) g_param_spec_pointer ("pixbuf", _("pixbuf"), _("the pixbuf"), - G_PARAM_WRITABLE)); + G_PARAM_WRITABLE)); g_object_class_install_property (gobject_class, PROP_X, g_param_spec_double ("x", @@ -112,8 +112,8 @@ gnome_canvas_imageframe_class_init (GnomeCanvasImageFrameClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_Y, g_param_spec_double ("y", @@ -122,7 +122,7 @@ gnome_canvas_imageframe_class_init (GnomeCanvasImageFrameClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_WIDTH, g_param_spec_double ("width", @@ -131,8 +131,8 @@ gnome_canvas_imageframe_class_init (GnomeCanvasImageFrameClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_DRAWWIDTH, g_param_spec_double ("drawwidth", @@ -141,7 +141,7 @@ gnome_canvas_imageframe_class_init (GnomeCanvasImageFrameClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_HEIGHT, g_param_spec_double ("height", @@ -150,7 +150,7 @@ gnome_canvas_imageframe_class_init (GnomeCanvasImageFrameClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_ANCHOR, g_param_spec_enum ("anchor", @@ -158,7 +158,7 @@ gnome_canvas_imageframe_class_init (GnomeCanvasImageFrameClass *class) _("the anchor"), GTK_TYPE_ANCHOR_TYPE, GTK_ANCHOR_NW, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); object_class->destroy = gnome_canvas_imageframe_destroy; @@ -191,7 +191,7 @@ gnome_canvas_imageframe_destroy (GtkObject *object) g_return_if_fail (GNOME_CANVAS_IS_CANVAS_IMAGEFRAME (object)); image = GNOME_CANVAS_IMAGEFRAME (object); - + image->cwidth = 0; image->cheight = 0; @@ -315,7 +315,7 @@ gnome_canvas_imageframe_set_property (GObject *object, image->height = fabs (g_value_get_double (value)); update = TRUE; break; - + case PROP_DRAWWIDTH: image->drawwidth = fabs (g_value_get_double (value)); update = TRUE; @@ -357,11 +357,11 @@ gnome_canvas_imageframe_get_property (GObject *object, case PROP_WIDTH: g_value_set_double (value, image->width); break; - + case PROP_HEIGHT: g_value_set_double (value, image->height); break; - + case PROP_DRAWWIDTH: g_value_set_double (value, image->drawwidth); break; diff --git a/gtk2_ardour/canvas-imageframe.h b/gtk2_ardour/canvas-imageframe.h index 7c66c5e1db..8cfb6e273a 100644 --- a/gtk2_ardour/canvas-imageframe.h +++ b/gtk2_ardour/canvas-imageframe.h @@ -7,15 +7,15 @@ * * Author: Federico Mena <federico@nuclecu.unam.mx> */ - - + + #ifndef __GNOME_CANVAS_IMAGEFRAME_H__ #define __GNOME_CANVAS_IMAGEFRAME_H__ #include <stdint.h> #include <libgnomecanvas/libgnomecanvas.h> -#include <gtk/gtkenums.h> +#include <gtk/gtkenums.h> #ifdef __cplusplus extern "C" { diff --git a/gtk2_ardour/canvas-note-event.cc b/gtk2_ardour/canvas-note-event.cc index b3c6b49ee0..958ba3e29a 100644 --- a/gtk2_ardour/canvas-note-event.cc +++ b/gtk2_ardour/canvas-note-event.cc @@ -32,9 +32,9 @@ namespace Canvas { /// dividing the hue circle in 16 parts, hand adjusted for equal look, courtesy Thorsten Wilms const uint32_t CanvasNoteEvent::midi_channel_colors[16] = { - 0xd32d2dff, 0xd36b2dff, 0xd3972dff, 0xd3d12dff, - 0xa0d32dff, 0x7dd32dff, 0x2dd45eff, 0x2dd3c4ff, - 0x2da5d3ff, 0x2d6fd3ff, 0x432dd3ff, 0x662dd3ff, + 0xd32d2dff, 0xd36b2dff, 0xd3972dff, 0xd3d12dff, + 0xa0d32dff, 0x7dd32dff, 0x2dd45eff, 0x2dd3c4ff, + 0x2da5d3ff, 0x2d6fd3ff, 0x432dd3ff, 0x662dd3ff, 0x832dd3ff, 0xa92dd3ff, 0xd32dbfff, 0xd32d67ff }; @@ -51,13 +51,13 @@ CanvasNoteEvent::CanvasNoteEvent(MidiRegionView& region, Item* item, { } -CanvasNoteEvent::~CanvasNoteEvent() -{ +CanvasNoteEvent::~CanvasNoteEvent() +{ if (_text) { _text->hide(); delete _text; } - + delete _channel_selector_widget; } @@ -100,7 +100,7 @@ CanvasNoteEvent::hide_velocity() } } -void +void CanvasNoteEvent::on_channel_selection_change(uint16_t selection) { // make note change its color if its channel is not marked active @@ -116,7 +116,7 @@ CanvasNoteEvent::on_channel_selection_change(uint16_t selection) _item->show(); } -void +void CanvasNoteEvent::on_channel_change(uint8_t channel) { _region.note_selected(this, true); @@ -134,11 +134,11 @@ CanvasNoteEvent::show_channel_selector(void) _channel_selector->channel_selected.connect( sigc::mem_fun(this, &CanvasNoteEvent::on_channel_change)); - _channel_selector_widget = new Widget(*(_item->property_parent()), - x1(), - y2() + 2, + _channel_selector_widget = new Widget(*(_item->property_parent()), + x1(), + y2() + 2, (Gtk::Widget &) *_channel_selector); - + _channel_selector_widget->hide(); _channel_selector_widget->property_height() = 100; _channel_selector_widget->property_width() = 100; @@ -179,35 +179,35 @@ CanvasNoteEvent::selected(bool selected) #define SCALE_USHORT_TO_UINT8_T(x) ((x) / 257) -uint32_t +uint32_t CanvasNoteEvent::base_color() { using namespace ARDOUR; - + ColorMode mode = _region.color_mode(); - + const uint8_t min_opacity = 15; uint8_t opacity = std::max(min_opacity, uint8_t(_note->velocity() + _note->velocity())); - + switch (mode) { case TrackColor: { Gdk::Color color = _region.midi_stream_view()->get_region_color(); return RGBA_TO_UINT( - SCALE_USHORT_TO_UINT8_T(color.get_red()), - SCALE_USHORT_TO_UINT8_T(color.get_green()), - SCALE_USHORT_TO_UINT8_T(color.get_blue()), + SCALE_USHORT_TO_UINT8_T(color.get_red()), + SCALE_USHORT_TO_UINT8_T(color.get_green()), + SCALE_USHORT_TO_UINT8_T(color.get_blue()), opacity); } - + case ChannelColors: - return UINT_RGBA_CHANGE_A(CanvasNoteEvent::midi_channel_colors[_note->channel()], + return UINT_RGBA_CHANGE_A(CanvasNoteEvent::midi_channel_colors[_note->channel()], opacity); - + default: return meter_style_fill_color(_note->velocity()); }; - + return 0; } diff --git a/gtk2_ardour/canvas-note-event.h b/gtk2_ardour/canvas-note-event.h index a9fa6ccb2d..9546141d8b 100644 --- a/gtk2_ardour/canvas-note-event.h +++ b/gtk2_ardour/canvas-note-event.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -74,24 +74,24 @@ public: void selected(bool yn); virtual void move_event(double dx, double dy) = 0; - + uint32_t base_color(); - + void show_velocity(); void hide_velocity(); - + /** Channel changed for this specific event */ void on_channel_change(uint8_t channel); /** Channel selection changed */ void on_channel_selection_change(uint16_t selection); - + void show_channel_selector(); void hide_channel_selector(); virtual void set_outline_color(uint32_t c) = 0; virtual void set_fill_color(uint32_t c) = 0; - + virtual double x1() = 0; virtual double y1() = 0; virtual double x2() = 0; @@ -99,7 +99,7 @@ public: const boost::shared_ptr<NoteType> note() const { return _note; } MidiRegionView& region_view() const { return _region; } - + inline static uint32_t meter_style_fill_color(uint8_t vel) { if (vel < 64) { return UINT_INTERPOLATE( @@ -113,12 +113,12 @@ public: ((vel-64) / (double)63.0)); } } - + /// calculate outline colors from fill colors of notes inline static uint32_t calculate_outline(uint32_t color) { return UINT_INTERPOLATE(color, 0x000000ff, 0.5); } - + /// hue circle divided into 16 equal-looking parts, courtesy Thorsten Wilms static const uint32_t midi_channel_colors[16]; diff --git a/gtk2_ardour/canvas-note.cc b/gtk2_ardour/canvas-note.cc index 4686a80df9..a3aa6ed8ac 100644 --- a/gtk2_ardour/canvas-note.cc +++ b/gtk2_ardour/canvas-note.cc @@ -18,7 +18,7 @@ CanvasNote::on_event(GdkEvent* ev) } } -void +void CanvasNote::move_event(double dx, double dy) { property_x1() = property_x1() + dx; diff --git a/gtk2_ardour/canvas-program-change.cc b/gtk2_ardour/canvas-program-change.cc index 94e367b345..27a163ef7c 100644 --- a/gtk2_ardour/canvas-program-change.cc +++ b/gtk2_ardour/canvas-program-change.cc @@ -24,10 +24,10 @@ CanvasProgramChange::CanvasProgramChange( uint8_t channel, uint8_t program) : CanvasFlag( - region, - parent, - height, - ARDOUR_UI::config()->canvasvar_MidiProgramChangeOutline.get(), + region, + parent, + height, + ARDOUR_UI::config()->canvasvar_MidiProgramChangeOutline.get(), ARDOUR_UI::config()->canvasvar_MidiProgramChangeFill.get(), x, y) @@ -45,57 +45,57 @@ CanvasProgramChange::~CanvasProgramChange() { } -void +void CanvasProgramChange::initialize_popup_menus() { - boost::shared_ptr<ChannelNameSet> channel_name_set = + boost::shared_ptr<ChannelNameSet> channel_name_set = MidiPatchManager::instance() .find_channel_name_set(_model_name, _custom_device_mode, _channel); if (!channel_name_set) { return; } - + const ChannelNameSet::PatchBanks& patch_banks = channel_name_set->patch_banks(); - + // fill popup menu: Gtk::Menu::MenuList& patch_bank_menus = _popup.items(); - + for (ChannelNameSet::PatchBanks::const_iterator bank = patch_banks.begin(); bank != patch_banks.end(); ++bank) { Glib::RefPtr<Glib::Regex> underscores = Glib::Regex::create("_"); Glib::ustring replacement(" "); - + Gtk::Menu& patch_bank_menu = *manage(new Gtk::Menu()); - + const PatchBank::PatchNameList& patches = (*bank)->patch_name_list(); Gtk::Menu::MenuList& patch_menus = patch_bank_menu.items(); - + for (PatchBank::PatchNameList::const_iterator patch = patches.begin(); patch != patches.end(); ++patch) { Glib::ustring name = underscores->replace((*patch)->name().c_str(), -1, 0, replacement); - + patch_menus.push_back( Gtk::Menu_Helpers::MenuElem( - name, + name, sigc::bind( - sigc::mem_fun(*this, &CanvasProgramChange::on_patch_menu_selected), - (*patch)->patch_primary_key())) ); + sigc::mem_fun(*this, &CanvasProgramChange::on_patch_menu_selected), + (*patch)->patch_primary_key())) ); } Glib::ustring name = underscores->replace((*bank)->name().c_str(), -1, 0, replacement); - - patch_bank_menus.push_back( + + patch_bank_menus.push_back( Gtk::Menu_Helpers::MenuElem( - name, - patch_bank_menu) ); + name, + patch_bank_menu) ); } } -void +void CanvasProgramChange::on_patch_menu_selected(const PatchPrimaryKey& key) { cerr << " got patch program number " << key.program_number << endl; @@ -117,7 +117,7 @@ CanvasProgramChange::on_event(GdkEvent* ev) return true; } break; - + case GDK_SCROLL: if (ev->scroll.direction == GDK_SCROLL_UP) { _region.previous_program(*this); @@ -125,12 +125,12 @@ CanvasProgramChange::on_event(GdkEvent* ev) } else if (ev->scroll.direction == GDK_SCROLL_DOWN) { _region.next_program(*this); return true; - } + } break; - + default: break; } - + return false; } diff --git a/gtk2_ardour/canvas-program-change.h b/gtk2_ardour/canvas-program-change.h index ef69089f93..cddd78059b 100644 --- a/gtk2_ardour/canvas-program-change.h +++ b/gtk2_ardour/canvas-program-change.h @@ -30,14 +30,14 @@ public: uint8_t channel, uint8_t program ); - + virtual ~CanvasProgramChange(); - + virtual bool on_event(GdkEvent* ev); - + string model_name() const { return _model_name; } void set_model_name(string model_name) { _model_name = model_name; } - + string custom_device_mode() const { return _custom_device_mode; } void set_custom_device_mode(string custom_device_mode) { _custom_device_mode = custom_device_mode; } @@ -49,14 +49,14 @@ public: uint8_t channel() const { return _channel; } void set_channel(uint8_t new_channel) { _channel = new_channel; }; - + void initialize_popup_menus(); - + void on_patch_menu_selected(const MIDI::Name::PatchPrimaryKey& key); private: string _model_name; - string _custom_device_mode; + string _custom_device_mode; nframes_t _event_time; uint8_t _channel; uint8_t _program; diff --git a/gtk2_ardour/canvas-simpleline.c b/gtk2_ardour/canvas-simpleline.c index 9a046230d4..7bff05487e 100644 --- a/gtk2_ardour/canvas-simpleline.c +++ b/gtk2_ardour/canvas-simpleline.c @@ -104,7 +104,7 @@ gnome_canvas_simpleline_class_init (GnomeCanvasSimpleLineClass *class) gobject_class->set_property = gnome_canvas_simpleline_set_property; gobject_class->get_property = gnome_canvas_simpleline_get_property; - + g_object_class_install_property (gobject_class, PROP_X1, g_param_spec_double ("x1", @@ -113,8 +113,8 @@ gnome_canvas_simpleline_class_init (GnomeCanvasSimpleLineClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_Y1, g_param_spec_double ("y1", @@ -123,8 +123,8 @@ gnome_canvas_simpleline_class_init (GnomeCanvasSimpleLineClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_X2, @@ -134,8 +134,8 @@ gnome_canvas_simpleline_class_init (GnomeCanvasSimpleLineClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_Y2, g_param_spec_double ("y2", @@ -144,7 +144,7 @@ gnome_canvas_simpleline_class_init (GnomeCanvasSimpleLineClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_COLOR_RGBA, g_param_spec_uint ("color_rgba", @@ -153,8 +153,8 @@ gnome_canvas_simpleline_class_init (GnomeCanvasSimpleLineClass *class) 0, G_MAXUINT, 0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + object_class->destroy = gnome_canvas_simpleline_destroy; item_class->update = gnome_canvas_simpleline_update; @@ -204,7 +204,7 @@ gnome_canvas_simpleline_bounds_world (GnomeCanvasItem *item, int* ix1, int* iy1, i1.y = y1; i2.x = x2; i2.y = y2; - + gnome_canvas_item_i2w_affine (item, i2w); art_affine_point (&w1, &i1, i2w); art_affine_point (&w2, &i2, i2w); @@ -225,7 +225,7 @@ gnome_canvas_simpleline_bounds_world (GnomeCanvasItem *item, int* ix1, int* iy1, } } -static void +static void gnome_canvas_simpleline_reset_bounds (GnomeCanvasItem *item) { int Ix1, Ix2, Iy1, Iy2; @@ -234,8 +234,8 @@ gnome_canvas_simpleline_reset_bounds (GnomeCanvasItem *item) gnome_canvas_update_bbox (item, Ix1, Iy1, Ix2, Iy2); } -/* - * CANVAS CALLBACKS +/* + * CANVAS CALLBACKS */ static void @@ -246,7 +246,7 @@ gnome_canvas_simpleline_set_property (GObject *object, { (void) pspec; - + GnomeCanvasSimpleLine *simpleline; int update = FALSE; int bounds_changed = FALSE; @@ -284,7 +284,7 @@ gnome_canvas_simpleline_set_property (GObject *object, bounds_changed = TRUE; } break; - + case PROP_COLOR_RGBA: if (simpleline->color != g_value_get_uint(value)) { simpleline->color = g_value_get_uint(value); @@ -309,7 +309,7 @@ gnome_canvas_simpleline_get_property (GObject *object, { g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_CANVAS_SIMPLELINE (object)); - + GnomeCanvasSimpleLine *line = GNOME_CANVAS_SIMPLELINE (object); switch (prop_id) { @@ -381,13 +381,13 @@ gnome_canvas_simpleline_render (GnomeCanvasItem *item, //begin = MAX(simpleline->bbox_ulx,buf->rect.x0); //end = MIN(simpleline->bbox_lrx,buf->rect.x1); - + begin = simpleline->bbox_ulx; end = simpleline->bbox_lrx; if (simpleline->color != 0) { if (simpleline->horizontal) { - PAINT_HORIZA(buf, simpleline->r, simpleline->g, simpleline->b, simpleline->a, + PAINT_HORIZA(buf, simpleline->r, simpleline->g, simpleline->b, simpleline->a, begin, end, simpleline->bbox_uly); } else { PAINT_VERTA(buf, simpleline->r, simpleline->g, simpleline->b, simpleline->a, @@ -442,10 +442,10 @@ gnome_canvas_simpleline_draw (GnomeCanvasItem *item, lrx -= x; lry -= y; - cairo_set_source_rgba (cr, - simpleline->r/255.0, - simpleline->g/255.0, - simpleline->b/255.0, + cairo_set_source_rgba (cr, + simpleline->r/255.0, + simpleline->g/255.0, + simpleline->b/255.0, simpleline->a/255.0); cairo_set_line_width (cr, 1); cairo_move_to (cr, ulx+0.5, uly+0.5); @@ -469,7 +469,7 @@ gnome_canvas_simpleline_point (GnomeCanvasItem *item, double x, double y, int cx { (void) cx; (void) cy; - + GnomeCanvasSimpleLine *simpleline; double x1, y1, x2, y2; double dx, dy; @@ -483,7 +483,7 @@ gnome_canvas_simpleline_point (GnomeCanvasItem *item, double x, double y, int cx gnome_canvas_simpleline_bounds (item, &x1, &y1, &x2, &y2); /* Is point inside line */ - + if ((x >= x1) && (y >= y1) && (x <= x2) && (y <= y2)) { return 0.0; } diff --git a/gtk2_ardour/canvas-simplerect.c b/gtk2_ardour/canvas-simplerect.c index 6ad0c791f8..a3894b0790 100644 --- a/gtk2_ardour/canvas-simplerect.c +++ b/gtk2_ardour/canvas-simplerect.c @@ -20,7 +20,7 @@ enum { PROP_FILL_COLOR_RGBA, PROP_OUTLINE_COLOR_RGBA, PROP_DRAW - + }; static void gnome_canvas_simplerect_class_init (GnomeCanvasSimpleRectClass *class); @@ -95,12 +95,12 @@ gnome_canvas_simplerect_class_init (GnomeCanvasSimpleRectClass *class) gobject_class = (GObjectClass *) class; object_class = (GtkObjectClass *) class; item_class = (GnomeCanvasItemClass *) class; - + parent_class = g_type_class_peek_parent (class); gobject_class->set_property = gnome_canvas_simplerect_set_property; gobject_class->get_property = gnome_canvas_simplerect_get_property; - + g_object_class_install_property (gobject_class, PROP_X1, g_param_spec_double ("x1", @@ -109,8 +109,8 @@ gnome_canvas_simplerect_class_init (GnomeCanvasSimpleRectClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_Y1, g_param_spec_double ("y1", @@ -119,8 +119,8 @@ gnome_canvas_simplerect_class_init (GnomeCanvasSimpleRectClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_X2, @@ -130,8 +130,8 @@ gnome_canvas_simplerect_class_init (GnomeCanvasSimpleRectClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_Y2, g_param_spec_double ("y2", @@ -140,8 +140,8 @@ gnome_canvas_simplerect_class_init (GnomeCanvasSimpleRectClass *class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_OUTLINE_PIXELS, @@ -151,8 +151,8 @@ gnome_canvas_simplerect_class_init (GnomeCanvasSimpleRectClass *class) 0, G_MAXUINT, 0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_OUTLINE_WHAT, @@ -162,8 +162,8 @@ gnome_canvas_simplerect_class_init (GnomeCanvasSimpleRectClass *class) 0, G_MAXUINT, 0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, @@ -172,16 +172,16 @@ gnome_canvas_simplerect_class_init (GnomeCanvasSimpleRectClass *class) _("fill"), _("fill rectangle"), TRUE, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_DRAW, g_param_spec_boolean ("draw", _("draw"), _("draw rectangle"), TRUE, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_OUTLINE_COLOR_RGBA, @@ -191,8 +191,8 @@ gnome_canvas_simplerect_class_init (GnomeCanvasSimpleRectClass *class) 0, G_MAXUINT, 0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_FILL_COLOR_RGBA, @@ -202,7 +202,7 @@ gnome_canvas_simplerect_class_init (GnomeCanvasSimpleRectClass *class) 0, G_MAXUINT, 0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); object_class->destroy = gnome_canvas_simplerect_destroy; @@ -234,7 +234,7 @@ static void gnome_canvas_simplerect_destroy (GtkObject *object) { GnomeCanvasSimpleRect *rect; - + g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_CANVAS_SIMPLERECT (object)); @@ -259,7 +259,7 @@ gnome_canvas_simplerect_bounds (GnomeCanvasItem *item, double *x1, double *y1, d } -static void +static void gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item) { GnomeCanvasSimpleRect* simplerect; @@ -271,7 +271,7 @@ gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item) old_y1 = item->y1; old_x2 = item->x2; old_y2 = item->y2; - + gnome_canvas_simplerect_bounds (item, &x1, &y1, &x2, &y2); gnome_canvas_item_i2w (item, &x1, &y1); gnome_canvas_item_i2w (item, &x2, &y2); @@ -331,7 +331,7 @@ gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item) } else if (item->x2 == old_x2) { /* end didn't change, so just draw at the start */ - + double start_x = MIN (item->x1, old_x1); double end_x = MAX (item->x1, old_x1); @@ -339,7 +339,7 @@ gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item) return; } - } + } new.x0 = x1; new.y0 = y1; @@ -352,15 +352,15 @@ gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item) old.y1 = old_y2; art_drect_union (&unionrect, &old, &new); - gnome_canvas_request_redraw (item->canvas, + gnome_canvas_request_redraw (item->canvas, unionrect.x0 - 0.5, unionrect.y0 - 0.5, unionrect.x1 + 1.5, unionrect.y1 + 1.5); } -/* - * CANVAS CALLBACKS +/* + * CANVAS CALLBACKS */ static void @@ -371,7 +371,7 @@ gnome_canvas_simplerect_set_property (GObject *object, { (void) pspec; - + GnomeCanvasSimpleRect *simplerect; int update = FALSE; int bounds_changed = FALSE; @@ -470,7 +470,7 @@ gnome_canvas_simplerect_get_property (GObject *object, GParamSpec *pspec) { GnomeCanvasSimpleRect *rect = GNOME_CANVAS_SIMPLERECT (object); - + g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_CANVAS_SIMPLERECT (object)); @@ -505,7 +505,7 @@ gnome_canvas_simplerect_get_property (GObject *object, case PROP_DRAW: g_value_set_boolean (value, rect->draw); break; - + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -527,7 +527,7 @@ gnome_canvas_simplerect_update (GnomeCanvasItem *item, double *affine, ArtSVP *c gnome_canvas_simplerect_reset_bounds (item); if (simplerect->full_draw_on_update) { - gnome_canvas_request_redraw (item->canvas, + gnome_canvas_request_redraw (item->canvas, simplerect->bbox_ulx, simplerect->bbox_uly, simplerect->bbox_lrx+0.5, @@ -563,7 +563,7 @@ gnome_canvas_simplerect_render (GnomeCanvasItem *item, if (parent_class->render) { (*parent_class->render) (item, buf); } - + if (buf->is_bg) { #ifdef HARLEQUIN_DEBUGGING @@ -580,7 +580,7 @@ gnome_canvas_simplerect_render (GnomeCanvasItem *item, if (!simplerect->draw) { return; } - + self.x0 = simplerect->bbox_ulx; self.y0 = simplerect->bbox_uly; self.x1 = simplerect->bbox_lrx; @@ -595,7 +595,7 @@ gnome_canvas_simplerect_render (GnomeCanvasItem *item, ey = simplerect->bbox_lry-1; if (simplerect->fill) { - + // this can be useful for debugging/understanding how the canvas redraws // stuff. @@ -605,12 +605,12 @@ gnome_canvas_simplerect_render (GnomeCanvasItem *item, randg = random() % 255; randb = random() % 255; PAINT_BOX(buf, randr, randg, randb, simplerect->fill_a, begin, sy, end, ey); -#else - PAINT_BOX (buf, simplerect->fill_r, simplerect->fill_g, simplerect->fill_b, simplerect->fill_a, +#else + PAINT_BOX (buf, simplerect->fill_r, simplerect->fill_g, simplerect->fill_b, simplerect->fill_a, intersection.x0, intersection.y0, intersection.x1, intersection.y1); #endif - + } for (i = 0; i < simplerect->outline_pixels; ++i) { @@ -630,7 +630,7 @@ gnome_canvas_simplerect_render (GnomeCanvasItem *item, if (simplerect->outline_what & 0x4) { PAINT_HORIZ(buf, simplerect->outline_r, simplerect->outline_g, simplerect->outline_b, begin, end, sy+i); } - + if (simplerect->outline_what & 0x8) { PAINT_HORIZ(buf, simplerect->outline_r, simplerect->outline_g, simplerect->outline_b, begin, end + 1, ey-i); } @@ -678,14 +678,14 @@ gnome_canvas_simplerect_render (GnomeCanvasItem *item, ey = simplerect->bbox_lry-1; if (simplerect->fill) { - + #ifdef HARLEQUIN_DEBUGGING gint randr, randg, randb; randr = random() % 255; randg = random() % 255; randb = random() % 255; PAINT_BOX(buf, randr, randg, randb, simplerect->fill_a, begin, sy, end, ey); -#else +#else PAINT_BOX(buf, simplerect->fill_r, simplerect->fill_g, simplerect->fill_b, simplerect->fill_a, begin, sy, end, ey); #endif } @@ -707,7 +707,7 @@ gnome_canvas_simplerect_render (GnomeCanvasItem *item, if (simplerect->outline_what & 0x4) { PAINT_HORIZ(buf, simplerect->outline_r, simplerect->outline_g, simplerect->outline_b, begin, end, sy+i); } - + if (simplerect->outline_what & 0x8) { PAINT_HORIZ(buf, simplerect->outline_r, simplerect->outline_g, simplerect->outline_b, begin, end + 1, ey-i); } @@ -730,7 +730,7 @@ gnome_canvas_simplerect_draw (GnomeCanvasItem *item, simplerect = GNOME_CANVAS_SIMPLERECT (item); - cr = gdk_cairo_create (drawable); + cr = gdk_cairo_create (drawable); if (x > simplerect->bbox_ulx) { ulx = x; @@ -765,23 +765,23 @@ gnome_canvas_simplerect_draw (GnomeCanvasItem *item, if (simplerect->fill) { cairo_set_source_rgba (cr, - simplerect->fill_r/255.0, - simplerect->fill_g/255.0, - simplerect->fill_b/255.0, + simplerect->fill_r/255.0, + simplerect->fill_g/255.0, + simplerect->fill_b/255.0, simplerect->fill_a/255.0); cairo_fill (cr); } - + if (simplerect->outline_what && simplerect->outline_pixels) { #define x_in_range(a) (x <= (a) && (a) < x + width) #define y_in_range(a) (y <= (a) && (a) < y + height) cairo_set_line_width (cr, simplerect->outline_pixels); - + cairo_set_source_rgb (cr, - simplerect->outline_r/255.0, - simplerect->outline_g/255.0, + simplerect->outline_r/255.0, + simplerect->outline_g/255.0, simplerect->outline_b/255.0); if (simplerect->outline_what & 0x1) { @@ -792,7 +792,7 @@ gnome_canvas_simplerect_draw (GnomeCanvasItem *item, cairo_stroke (cr); } } - + if (simplerect->outline_what & 0x2) { /* right edge, if visible */ if (x_in_range (simplerect->bbox_lrx)) { @@ -801,7 +801,7 @@ gnome_canvas_simplerect_draw (GnomeCanvasItem *item, cairo_stroke (cr); } } - + if (simplerect->outline_what & 0x4) { /* top edge */ if (y_in_range (simplerect->bbox_uly)) { @@ -810,7 +810,7 @@ gnome_canvas_simplerect_draw (GnomeCanvasItem *item, cairo_stroke (cr); } } - + if (simplerect->outline_what & 0x8) { /* bottom edge */ if (y_in_range (simplerect->bbox_lry)) { @@ -829,7 +829,7 @@ gnome_canvas_simplerect_point (GnomeCanvasItem *item, double x, double y, int cx { (void) cx; (void) cy; - + GnomeCanvasSimpleRect *simplerect; double x1, y1, x2, y2; double dx, dy; @@ -843,7 +843,7 @@ gnome_canvas_simplerect_point (GnomeCanvasItem *item, double x, double y, int cx gnome_canvas_simplerect_bounds (item, &x1, &y1, &x2, &y2); /* Is point inside rectangle */ - + if ((x >= x1) && (y >= y1) && (x <= x2) && (y <= y2)) { return 0.0; } diff --git a/gtk2_ardour/canvas-sysex.cc b/gtk2_ardour/canvas-sysex.cc index db93b61050..667b493d5c 100644 --- a/gtk2_ardour/canvas-sysex.cc +++ b/gtk2_ardour/canvas-sysex.cc @@ -34,10 +34,10 @@ CanvasSysEx::CanvasSysEx( double x, double y) : CanvasFlag( - region, - parent, - height, - ARDOUR_UI::config()->canvasvar_MidiSysExOutline.get(), + region, + parent, + height, + ARDOUR_UI::config()->canvasvar_MidiSysExOutline.get(), ARDOUR_UI::config()->canvasvar_MidiSysExFill.get(), x, y) @@ -58,19 +58,19 @@ CanvasSysEx::on_event(GdkEvent* ev) return true; } break; - + case GDK_SCROLL: if (ev->scroll.direction == GDK_SCROLL_UP) { return true; } else if (ev->scroll.direction == GDK_SCROLL_DOWN) { return true; - } + } break; - + default: break; } - + return false; } diff --git a/gtk2_ardour/canvas-sysex.h b/gtk2_ardour/canvas-sysex.h index e69581a061..281cbb557a 100644 --- a/gtk2_ardour/canvas-sysex.h +++ b/gtk2_ardour/canvas-sysex.h @@ -37,9 +37,9 @@ public: double height, double x, double y); - + virtual ~CanvasSysEx(); - + virtual bool on_event(GdkEvent* ev); }; diff --git a/gtk2_ardour/canvas-waveview.c b/gtk2_ardour/canvas-waveview.c index e41fe5944f..439bddc035 100644 --- a/gtk2_ardour/canvas-waveview.c +++ b/gtk2_ardour/canvas-waveview.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2002 Paul Davis + Copyright (C) 2000-2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -163,106 +163,106 @@ gnome_canvas_waveview_class_init (GnomeCanvasWaveViewClass *class) PROP_DATA_SRC, g_param_spec_pointer ("data_src", NULL, NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_CHANNEL, g_param_spec_uint ("channel", NULL, NULL, 0, G_MAXUINT, 0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_LENGTH_FUNCTION, g_param_spec_pointer ("length_function", NULL, NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_SOURCEFILE_LENGTH_FUNCTION, g_param_spec_pointer ("sourcefile_length_function", NULL, NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_PEAK_FUNCTION, g_param_spec_pointer ("peak_function", NULL, NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_GAIN_FUNCTION, g_param_spec_pointer ("gain_function", NULL, NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_GAIN_SRC, g_param_spec_pointer ("gain_src", NULL, NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_CACHE, g_param_spec_pointer ("cache", NULL, NULL, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_CACHE_UPDATER, g_param_spec_boolean ("cache_updater", NULL, NULL, FALSE, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_SAMPLES_PER_UNIT, g_param_spec_double ("samples_per_unit", NULL, NULL, 0.0, G_MAXDOUBLE, 0.0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_AMPLITUDE_ABOVE_AXIS, g_param_spec_double ("amplitude_above_axis", NULL, NULL, 0.0, G_MAXDOUBLE, 0.0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_X, g_param_spec_double ("x", NULL, NULL, 0.0, G_MAXDOUBLE, 0.0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_Y, g_param_spec_double ("y", NULL, NULL, 0.0, G_MAXDOUBLE, 0.0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_HEIGHT, g_param_spec_double ("height", NULL, NULL, 0.0, G_MAXDOUBLE, 0.0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_WAVE_COLOR, g_param_spec_uint ("wave_color", NULL, NULL, 0, G_MAXUINT, 0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_CLIP_COLOR, g_param_spec_uint ("clip_color", NULL, NULL, 0, G_MAXUINT, 0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_ZERO_COLOR, @@ -283,7 +283,7 @@ gnome_canvas_waveview_class_init (GnomeCanvasWaveViewClass *class) g_param_spec_boolean ("filled", NULL, NULL, FALSE, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_RECTIFIED, @@ -304,16 +304,16 @@ gnome_canvas_waveview_class_init (GnomeCanvasWaveViewClass *class) g_param_spec_boolean ("logscaled", NULL, NULL, FALSE, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + g_object_class_install_property (gobject_class, PROP_REGION_START, g_param_spec_uint ("region_start", NULL, NULL, 0, G_MAXUINT, 0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - + object_class->destroy = gnome_canvas_waveview_destroy; - + item_class->update = gnome_canvas_waveview_update; item_class->bounds = gnome_canvas_waveview_bounds; item_class->point = gnome_canvas_waveview_point; @@ -418,12 +418,12 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ #if DEBUG_CACHE // printf("waveview->region_start == %lu\n",waveview->region_start); // c_stacktrace (); - printf ("\n\n=> 0x%x cache @ 0x%x range: %lu - %lu request: %lu - %lu (%lu frames)\n", + printf ("\n\n=> 0x%x cache @ 0x%x range: %lu - %lu request: %lu - %lu (%lu frames)\n", waveview, cache, cache->start, cache->end, start_sample, end_sample, end_sample - start_sample); #endif - + if (cache->start <= start_sample && cache->end >= end_sample) { #if DEBUG_CACHE // printf ("0x%x: cache hit for %lu-%lu (cache holds: %lu-%lu\n", @@ -433,11 +433,11 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ } /* make sure the cache is at least twice as wide as the screen width, and put the start sample - in the middle, ensuring that we cover the end_sample. + in the middle, ensuring that we cover the end_sample. */ /* Note the assumption that we have a 1:1 units:pixel ratio for the canvas. Its everywhere ... */ - + half_width = (gulong) floor ((waveview->screen_width * waveview->samples_per_unit)/2.0 + 0.5); if (start_sample < half_width) { @@ -462,7 +462,7 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ } #if DEBUG_CACHE - fprintf (stderr, "AVAILABLE FRAMES = %lu of %lu, start = %lu, sstart = %lu, cstart = %lu\n", + fprintf (stderr, "AVAILABLE FRAMES = %lu of %lu, start = %lu, sstart = %lu, cstart = %lu\n", rf3, waveview->sourcefile_length_function (waveview->data_src, waveview->samples_per_unit), waveview->region_start, start_sample, new_cache_start); #endif @@ -489,7 +489,7 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ ostart = new_cache_start; #ifdef CACHE_MEMMOVE_OPTIMIZATION - + /* data is not entirely in the cache, so go fetch it, making sure to fill the cache */ /* some of the required cache entries are in the cache, but in the wrong @@ -497,24 +497,24 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ */ if (cache->start < new_cache_start && new_cache_start < cache->end) { - - /* case one: the common area is at the end of the existing cache. move it + + /* case one: the common area is at the end of the existing cache. move it to the beginning of the cache, and set up to refill whatever remains. - - + + wv->cache_start wv->cache_end |-------------------------------------------------------| cache |--------------------------------| requested <-------------------> "present" - new_cache_start new_cache_end + new_cache_start new_cache_end */ - + present_frames = cache->end - new_cache_start; present_entries = (gulong) floor (present_frames / waveview->samples_per_unit); -#if DEBUG_CACHE +#if DEBUG_CACHE fprintf (stderr, "existing material at end of current cache, move to start of new cache\n" "\tcopy from %lu to start\n", cache->data_size - present_entries); #endif @@ -522,7 +522,7 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ memmove (&cache->data[0], &cache->data[cache->data_size - present_entries], present_entries * sizeof (GnomeCanvasWaveViewCacheEntry)); - + #if DEBUG_CACHE fprintf (stderr, "satisfied %lu of %lu frames, offset = %lu, will start at %lu (ptr = 0x%x)\n", present_frames, required_frames, present_entries, new_cache_start + present_entries, @@ -536,8 +536,8 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ } else if (new_cache_end > cache->start && new_cache_end < cache->end) { - /* case two: the common area lives at the beginning of the existing cache. - + /* case two: the common area lives at the beginning of the existing cache. + wv->cache_start wv->cache_end |-----------------------------------------------------| |--------------------------------| @@ -546,15 +546,15 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ new_cache_start new_cache_end */ - + present_frames = new_cache_end - cache->start; present_entries = (gulong) floor (present_frames / waveview->samples_per_unit); memmove (&cache->data[cache->data_size - present_entries], &cache->data[0], present_entries * sizeof (GnomeCanvasWaveViewCacheEntry)); - -#if DEBUG_CACHE + +#if DEBUG_CACHE fprintf (stderr, "existing material at start of current cache, move to start of end cache\n"); #endif @@ -568,7 +568,7 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ offset = 0; required_frames -= present_frames; - + } else { copied = 0; offset = 0; @@ -605,7 +605,7 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ waveview->peak_function (waveview->data_src, npeaks, new_cache_start, required_frames, cache->data + offset, waveview->channel,waveview->samples_per_unit); /* take into account any copied peaks */ - + npeaks += copied; } else { npeaks = copied; @@ -634,15 +634,15 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ } free (gain); - + } /* do optional log scaling. this implementation is not particularly efficient */ - + if (waveview->logscaled) { guint32 n; GnomeCanvasWaveViewCacheEntry* buf = cache->data; - + for (n = 0; n < cache->data_size; ++n) { if (buf[n].max > 0.0f) { @@ -650,7 +650,7 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ } else if (buf[n].max < 0.0f) { buf[n].max = -alt_log_meter(fast_coefficient_to_dB(-buf[n].max)); } - + if (buf[n].min > 0.0f) { buf[n].min = alt_log_meter(fast_coefficient_to_dB(buf[n].min)); } else if (buf[n].min < 0.0f) { @@ -664,7 +664,7 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ out: #if DEBUG_CACHE - fprintf (stderr, "return cache index = %d\n", + fprintf (stderr, "return cache index = %d\n", (guint32) floor ((((double) (start_sample - cache->start)) / waveview->samples_per_unit) + 0.5)); #endif return (guint32) floor ((((double) (start_sample - cache->start)) / waveview->samples_per_unit) + 0.5); @@ -680,7 +680,7 @@ gnome_canvas_waveview_set_data_src (GnomeCanvasWaveView *waveview, void *data_sr waveview->reload_cache_in_render = TRUE; return; } - + waveview->cache->start = 0; waveview->cache->end = 0; } @@ -694,11 +694,11 @@ gnome_canvas_waveview_set_channel (GnomeCanvasWaveView *waveview, guint32 chan) if (waveview->channel == chan) { return; } - + waveview->channel = chan; } -static void +static void gnome_canvas_waveview_reset_bounds (GnomeCanvasItem *item) { @@ -727,8 +727,8 @@ gnome_canvas_waveview_reset_bounds (GnomeCanvasItem *item) gnome_canvas_update_bbox (item, Ix1, Iy1, Ix2, Iy2); } -/* - * CANVAS CALLBACKS +/* + * CANVAS CALLBACKS */ static void @@ -739,7 +739,7 @@ gnome_canvas_waveview_set_property (GObject *object, { (void) pspec; - + GnomeCanvasItem *item; GnomeCanvasWaveView *waveview; int redraw = FALSE; @@ -929,8 +929,8 @@ gnome_canvas_waveview_get_property ( GValue *value, GParamSpec *pspec) { - - + + g_return_if_fail (object != NULL); g_return_if_fail (GNOME_IS_CANVAS_WAVEVIEW (object)); @@ -1083,7 +1083,7 @@ gnome_canvas_waveview_update (GnomeCanvasItem *item, double *affine, ArtSVP *cli &waveview->fill_a); // check_cache (waveview, "end of update"); -} +} static void gnome_canvas_waveview_render (GnomeCanvasItem *item, @@ -1186,7 +1186,7 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item, clip_length = MIN(5,(waveview->height/4)); - /* + /* Now draw each line, clipping it appropriately. The clipping is done by the macros PAINT_FOO(). */ @@ -1240,40 +1240,40 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item, guint index = cache_index + (end - begin); if (index >= waveview->cache->data_size) { - + /* the data we want is off the end of the cache, which must mean its beyond the end of the region's source; hence the peak values are 0 */ last_pymax = (int) rint ((item->y1 + origin) * item->canvas->pixels_per_unit); last_pymin = (int) rint ((item->y1 + origin) * item->canvas->pixels_per_unit); - + } else { - + last_pymax = (int) rint ((item->y1 + origin - MIN(waveview->cache->data[index].max, 1.0) * half_height) * item->canvas->pixels_per_unit); last_pymin = (int) rint ((item->y1 + origin - MAX(waveview->cache->data[index].min, -1.0) * half_height) * item->canvas->pixels_per_unit); - + } - + } - /* + /* * initialize NEXT* variables for the first run, duplicated in the loop for speed */ max = waveview->cache->data[cache_index].max; min = waveview->cache->data[cache_index].min; - + if (max >= 1.0) { max = 1.0; next_clip_max = 1; } - + if (min <= -1.0) { min = -1.0; next_clip_min = 1; } - + max *= half_height; min *= half_height; - + next_pymax = (int) rint ((item->y1 + origin - max) * item->canvas->pixels_per_unit); next_pymin = (int) rint ((item->y1 + origin - min) * item->canvas->pixels_per_unit); @@ -1311,7 +1311,7 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item, max = 1.0; next_clip_max = 1; } - + if (min <= -1.0) { min = -1.0; next_clip_min = 1; @@ -1319,11 +1319,11 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item, max *= half_height; min *= half_height; - + next_pymax = (int) rint ((item->y1 + origin - max) * item->canvas->pixels_per_unit); next_pymin = (int) rint ((item->y1 + origin - min) * item->canvas->pixels_per_unit); } - + /* render */ if (pymax == pymin) { PAINT_DOTA(buf, waveview->wave_r, waveview->wave_g, waveview->wave_b, waveview->wave_a, x, pymin); @@ -1370,7 +1370,7 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item, if (clip_max) { PAINT_VERTA(buf, waveview->clip_r, waveview->clip_g, waveview->clip_b, waveview->clip_a, x, pymax, pymax+clip_length); } - + if (clip_min) { PAINT_VERTA(buf, waveview->clip_r, waveview->clip_g, waveview->clip_b, waveview->clip_a, x, pymin-clip_length, pymin); } @@ -1426,7 +1426,7 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item, if(last_pymax < 0) { /* take the index of one sample right of what we render */ int index = cache_index + (end - begin); - + max = MIN(waveview->cache->data[index].max, 1.0); min = MAX(waveview->cache->data[index].min, -1.0); @@ -1437,26 +1437,26 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item, last_pymax = (int) rint ((item->y1 + waveview->height - max * waveview->height) * item->canvas->pixels_per_unit); } - /* + /* * initialize NEXT* variables for the first run, duplicated in the loop for speed */ max = waveview->cache->data[cache_index].max; min = waveview->cache->data[cache_index].min; - + if (max >= 1.0) { max = 1.0; next_clip_max = 1; } - + if (min <= -1.0) { min = -1.0; next_clip_min = 1; } - + if (fabs (min) > fabs (max)) { max = fabs (min); - } - + } + next_pymax = (int) rint ((item->y1 + waveview->height - max * waveview->height) * item->canvas->pixels_per_unit); /* @@ -1479,24 +1479,24 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item, max = waveview->cache->data[cache_index].max; min = waveview->cache->data[cache_index].min; - + if (max >= 1.0) { max = 1.0; next_clip_max = 1; } - + if (min <= -1.0) { min = -1.0; next_clip_min = 1; } - + if (fabs (min) > fabs (max)) { max = fabs (min); - } - + } + next_pymax = (int) rint ((item->y1 + waveview->height - max * waveview->height) * item->canvas->pixels_per_unit); } - + /* render */ if (pymax == pymin) { PAINT_DOTA(buf, waveview->wave_r, waveview->wave_g, waveview->wave_b, waveview->wave_a, x, pymin); @@ -1528,7 +1528,7 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item, if (clip_max) { PAINT_VERTA(buf, waveview->clip_r, waveview->clip_g, waveview->clip_b, waveview->clip_a, x, pymax, pymax+clip_length); } - + if (clip_min) { PAINT_VERTA(buf, waveview->clip_r, waveview->clip_g, waveview->clip_b, waveview->clip_a, x, pymin-clip_length, pymin); } @@ -1540,68 +1540,68 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item, cache_index = gnome_canvas_waveview_ensure_cache (waveview, s1, s2); for (x = begin; x < end; x++) { - + double max, min; int clip_max, clip_min; - + clip_max = 0; clip_min = 0; - + max = waveview->cache->data[cache_index].max; min = waveview->cache->data[cache_index].min; - + if (max >= 1.0) { max = 1.0; clip_max = 1; } - + if (min <= -1.0) { min = -1.0; clip_min = 1; } - + if (rectify) { - + if (fabs (min) > fabs (max)) { max = fabs (min); - } - + } + max = max * waveview->height; - + pymax = (int) rint ((item->y1 + waveview->height - max) * item->canvas->pixels_per_unit); pymin = (int) rint ((item->y1 + waveview->height) * item->canvas->pixels_per_unit); - + } else { - + max = max * half_height; min = min * half_height; - + pymax = (int) rint ((item->y1 + origin - max) * item->canvas->pixels_per_unit); pymin = (int) rint ((item->y1 + origin - min) * item->canvas->pixels_per_unit); } - + /* OK, now fill the RGB buffer at x=i with a line between pymin and pymax, or, if samples_per_unit == 1, then a dot at each location. */ - + if (pymax == pymin) { PAINT_DOTA(buf, waveview->wave_r, waveview->wave_g, waveview->wave_b, waveview->wave_a, x, pymin); } else { PAINT_VERTA(buf, waveview->wave_r, waveview->wave_g, waveview->wave_b, waveview->wave_a, x, pymax, pymin); } - + /* show clipped waveforms with small red lines */ - + if (clip_max) { PAINT_VERTA(buf, waveview->clip_r, waveview->clip_g, waveview->clip_b, waveview->clip_a, x, pymax, pymax+clip_length); } - + if (clip_min) { PAINT_VERTA(buf, waveview->clip_r, waveview->clip_g, waveview->clip_b, waveview->clip_a, x, pymin-clip_length, pymin); } /* presto, we're done */ - + cache_index++; } } @@ -1609,7 +1609,7 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item, if (!waveview->rectified && waveview->zero_line) { // Paint zeroline. //PAINT_HORIZA(buf, waveview->zero_r, waveview->zero_g, waveview->zero_b, waveview->zero_a, begin, endi-1, origin ); - + unsigned char zero_r, zero_g, zero_b, zero_a; UINT_TO_RGBA( waveview->zero_color, &zero_r, &zero_g, &zero_b, &zero_a ); int zeroline_y = (int) rint ((item->y1 + origin) * item->canvas->pixels_per_unit); @@ -1718,7 +1718,7 @@ gnome_canvas_waveview_draw (GnomeCanvasItem *item, printf ("%p r (%d,%d)(%d,%d)[%d x %d] bbox (%d,%d)(%d,%d)[%d x %d]" " draw (%.1f,%.1f)(%.1f,%.1f)[%.1f x %.1f] s= %lu..%lu\n", waveview, - x, y, + x, y, x + width, y + height, width, @@ -1737,7 +1737,7 @@ gnome_canvas_waveview_draw (GnomeCanvasItem *item, #endif /* draw the top half */ - + for (xoff = ulx; xoff < lrx; xoff++) { double max, min; @@ -1747,19 +1747,19 @@ gnome_canvas_waveview_draw (GnomeCanvasItem *item, if (min <= -1.0) { min = -1.0; } - + if (max >= 1.0) { max = 1.0; } - + if (rectify) { if (fabs (min) > fabs (max)) { max = fabs (min); - } - } - + } + } + yoff = origin - (waveview->half_height * max) + 0.5; - + if (xoff == ulx) { /* first point */ cairo_move_to (cr, xoff+0.5, yoff); @@ -1771,9 +1771,9 @@ gnome_canvas_waveview_draw (GnomeCanvasItem *item, } /* from the final top point, move out of the clip zone */ - + cairo_line_to (cr, xoff + 10, yoff); - + /* now draw the bottom half */ for (--xoff, --cache_index; xoff >= ulx; --xoff) { @@ -1794,23 +1794,23 @@ gnome_canvas_waveview_draw (GnomeCanvasItem *item, /* from the final lower point, move out of the clip zone */ cairo_line_to (cr, xoff - 10, yoff); - + /* close path to fill */ cairo_close_path (cr); /* fill and stroke */ - cairo_set_source_rgba (cr, - (waveview->fill_r/255.0), - (waveview->fill_g/255.0), - (waveview->fill_b/255.0), + cairo_set_source_rgba (cr, + (waveview->fill_r/255.0), + (waveview->fill_g/255.0), + (waveview->fill_b/255.0), (waveview->fill_a/255.0)); cairo_fill_preserve (cr); - cairo_set_source_rgba (cr, - (waveview->wave_r/255.0), - (waveview->wave_g/255.0), - (waveview->wave_b/255.0), + cairo_set_source_rgba (cr, + (waveview->wave_r/255.0), + (waveview->wave_g/255.0), + (waveview->wave_b/255.0), (waveview->wave_a/255.0)); cairo_stroke (cr); @@ -1827,13 +1827,13 @@ gnome_canvas_waveview_draw (GnomeCanvasItem *item, cairo_line_to (cr, xoff, yoff1 + clip_length); cairo_stroke (cr); } - + if (clip_min) { cairo_move_to (cr, xoff, yoff2); cairo_line_to (cr, xoff, yoff2 - clip_length); cairo_stroke (cr); } - + #endif static void @@ -1856,7 +1856,7 @@ gnome_canvas_waveview_bounds (GnomeCanvasItem *item, double *x1, double *y1, dou gnome_canvas_item_i2w (item, &x, &y); gnome_canvas_w2c_d (GNOME_CANVAS(item->canvas), x, y, &c, &d); printf ("item bounds now (%g,%g),(%g,%g)\n", a, b, c, d); -#endif +#endif } @@ -1869,8 +1869,8 @@ gnome_canvas_waveview_point (GnomeCanvasItem *item, double x, double y, int cx, (void) cx; (void) cy; (void) actual_item; - - /* XXX for now, point is never inside the wave + + /* XXX for now, point is never inside the wave GnomeCanvasWaveView *waveview; double x1, y1, x2, y2; double dx, dy; @@ -1888,7 +1888,7 @@ gnome_canvas_waveview_point (GnomeCanvasItem *item, double x, double y, int cx, gnome_canvas_waveview_bounds (item, &x1, &y1, &x2, &y2); /* Is point inside rectangle */ - + if ((x >= x1) && (y >= y1) && (x <= x2) && (y <= y2)) { return 0.0; } diff --git a/gtk2_ardour/canvas-waveview.h b/gtk2_ardour/canvas-waveview.h index 520e9b3e17..89c193a440 100644 --- a/gtk2_ardour/canvas-waveview.h +++ b/gtk2_ardour/canvas-waveview.h @@ -59,7 +59,7 @@ struct _GnomeCanvasWaveViewCache guint64 data_size; gulong start; gulong end; -}; +}; GnomeCanvasWaveViewCache* gnome_canvas_waveview_cache_new (); void gnome_canvas_waveview_cache_destroy (GnomeCanvasWaveViewCache*); @@ -67,7 +67,7 @@ void gnome_canvas_waveview_cache_destroy (GnomeCanvasWaveView struct _GnomeCanvasWaveView { GnomeCanvasItem item; - + GnomeCanvasWaveViewCache *cache; gboolean cache_updater; gint screen_width; @@ -82,9 +82,9 @@ struct _GnomeCanvasWaveView /** x-axis: samples per canvas unit. */ double samples_per_unit; - + /** y-axis: amplitude_above_axis. - * + * * the default is that an (scaled, normalized -1.0 ... +1.0) amplitude of 1.0 * corresponds to the top of the area assigned to the waveview. * @@ -107,7 +107,7 @@ struct _GnomeCanvasWaveView char rectified; char zero_line; char logscaled; - + /* These are updated by the update() routine to optimize the render() routine, which may be called several times after a single update(). diff --git a/gtk2_ardour/canvas.h b/gtk2_ardour/canvas.h index 3c5b17d999..1bf3be96d2 100644 --- a/gtk2_ardour/canvas.h +++ b/gtk2_ardour/canvas.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/canvas_impl.h b/gtk2_ardour/canvas_impl.h index 377ac02998..d8f9a63ad5 100644 --- a/gtk2_ardour/canvas_impl.h +++ b/gtk2_ardour/canvas_impl.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/control_point.cc b/gtk2_ardour/control_point.cc index 5893c29e28..047417d82a 100644 --- a/gtk2_ardour/control_point.cc +++ b/gtk2_ardour/control_point.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2007 Paul Davis + Copyright (C) 2002-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ ControlPoint::ControlPoint (const ControlPoint& other, bool /*dummy_arg_to_force _item->property_fill() = false; _item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get(); _item->property_outline_pixels() = 1; - + /* NOTE: no event handling in copied ControlPoints */ hide (); @@ -111,7 +111,7 @@ ControlPoint::set_visible (bool yn) { _item->property_draw() = (gboolean) yn; } - + void ControlPoint::reset (double x, double y, AutomationList::iterator mi, uint32_t vi, ShapeType shape) { @@ -157,7 +157,7 @@ ControlPoint::set_size (double sz) { _size = sz; -#if 0 +#if 0 if (_size > 6.0) { item->property_fill() = (gboolean) TRUE; } else { diff --git a/gtk2_ardour/control_point.h b/gtk2_ardour/control_point.h index d8c18f10b3..f2ff37ea6d 100644 --- a/gtk2_ardour/control_point.h +++ b/gtk2_ardour/control_point.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2007 Paul Davis + Copyright (C) 2002-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ namespace Gnome { } } -class ControlPoint +class ControlPoint { public: ControlPoint (AutomationLine& al); @@ -54,13 +54,13 @@ class ControlPoint Start, End }; - + void move_to (double x, double y, ShapeType); void reset (double x, double y, ARDOUR::AutomationList::iterator, uint32_t, ShapeType); double get_x() const { return _x; } double get_y() const { return _y; } - void hide (); + void hide (); void show (); void show_color (bool entered, bool hide_too); @@ -73,7 +73,7 @@ class ControlPoint void set_selected(bool yn) { _selected = yn; } uint32_t view_index() const { return _view_index; } void set_view_index(uint32_t i) { _view_index = i; } - + ARDOUR::AutomationList::iterator model() const { return _model; } AutomationLine& line() const { return _line; } ArdourCanvas::Item* item() const { return _item; } diff --git a/gtk2_ardour/control_point_dialog.cc b/gtk2_ardour/control_point_dialog.cc index e61be312a3..178b2f5feb 100644 --- a/gtk2_ardour/control_point_dialog.cc +++ b/gtk2_ardour/control_point_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2008 Paul Davis + Copyright (C) 2000-2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,9 +36,9 @@ ControlPointDialog::ControlPointDialog (ControlPoint* p) assert (point_); double const y_fraction = 1.0 - (p->get_y () / p->line().height ()); - + value_.set_text (p->line().fraction_to_string (y_fraction)); - + Gtk::HBox* b = Gtk::manage (new Gtk::HBox ()); b->pack_start (*Gtk::manage (new Gtk::Label (_("Value")))); @@ -47,7 +47,7 @@ ControlPointDialog::ControlPointDialog (ControlPoint* p) if (p->line ().get_uses_gain_mapping ()) { b->pack_start (*Gtk::manage (new Gtk::Label (_("dB")))); } - + get_vbox ()->pack_end (*b); b->show_all (); diff --git a/gtk2_ardour/control_point_dialog.h b/gtk2_ardour/control_point_dialog.h index 8bb58883db..6fc337926d 100644 --- a/gtk2_ardour/control_point_dialog.h +++ b/gtk2_ardour/control_point_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2008 Paul Davis + Copyright (C) 2000-2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index 19723b6241..cc8d487185 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -85,7 +85,7 @@ CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr<Crossfade> xf, d preroll_button (_("With Pre-roll")), postroll_button (_("With Post-roll")), - + miny (my), maxy (mxy), @@ -124,7 +124,7 @@ CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr<Crossfade> xf, d canvas = new ArdourCanvas::CanvasAA (); canvas->signal_size_allocate().connect (mem_fun(*this, &CrossfadeEditor::canvas_allocation)); canvas->set_size_request (425, 200); - + toplevel = new ArdourCanvas::SimpleRect (*(canvas->root())); toplevel->property_x1() = 0.0; toplevel->property_y1() = 0.0; @@ -134,21 +134,21 @@ CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr<Crossfade> xf, d toplevel->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorBase.get(); toplevel->property_outline_pixels() = 0; toplevel->signal_event().connect (mem_fun (*this, &CrossfadeEditor::canvas_event)); - + fade[Out].line = new ArdourCanvas::Line (*(canvas->root())); fade[Out].line->property_width_pixels() = 1; fade[Out].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get(); - + fade[Out].shading = new ArdourCanvas::Polygon (*(canvas->root())); fade[Out].shading->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLineShading.get(); fade[In].line = new ArdourCanvas::Line (*(canvas->root())); fade[In].line->property_width_pixels() = 1; fade[In].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get(); - + fade[In].shading = new ArdourCanvas::Polygon (*(canvas->root())); fade[In].shading->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLineShading.get(); - + fade[In].shading->signal_event().connect (mem_fun (*this, &CrossfadeEditor::canvas_event)); fade[In].line->signal_event().connect (mem_fun (*this, &CrossfadeEditor::curve_event)); fade[Out].shading->signal_event().connect (mem_fun (*this, &CrossfadeEditor::canvas_event)); @@ -161,7 +161,7 @@ CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr<Crossfade> xf, d select_out_button.signal_clicked().connect (bind (mem_fun (*this, &CrossfadeEditor::curve_select_clicked), Out)); HBox* acbox = manage (new HBox); - + audition_box.set_border_width (7); audition_box.set_spacing (5); audition_box.set_homogeneous (false); @@ -172,7 +172,7 @@ CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr<Crossfade> xf, d audition_box.pack_start (audition_right_dry_button, false, false); Frame* audition_frame = manage (new Frame (_("Audition"))); - + audition_frame->set_name (X_("CrossfadeEditFrame")); audition_frame->add (audition_box); @@ -271,7 +271,7 @@ CrossfadeEditor::CrossfadeEditor (Session& s, boost::shared_ptr<Crossfade> xf, d curve_button_box.pack_start (fade_out_table, false, false, 12); curve_button_box.pack_start (*vpacker2, false, false, 12); curve_button_box.pack_start (fade_in_table, false, false, 12); - + get_vbox()->pack_start (*canvas_frame, true, true); get_vbox()->pack_start (curve_button_box, false, false); @@ -339,7 +339,7 @@ CrossfadeEditor::set (const ARDOUR::AutomationList& curve, WhichFade which) for (list<Point*>::iterator i = fade[which].points.begin(); i != fade[which].points.end(); ++i) { delete *i; } - + fade[which].points.clear (); fade[which].gain_curve.clear (); fade[which].normative_curve.clear (); @@ -347,30 +347,30 @@ CrossfadeEditor::set (const ARDOUR::AutomationList& curve, WhichFade which) if (curve.empty()) { goto out; } - + the_end = curve.end(); --the_end; - + firstx = (*curve.begin())->when; endx = (*the_end)->when; for (ARDOUR::AutomationList::const_iterator i = curve.begin(); i != curve.end(); ++i) { - + double xfract = ((*i)->when - firstx) / (endx - firstx); double yfract = ((*i)->value - miny) / (maxy - miny); - + Point* p = make_point (); p->move_to (x_coordinate (xfract), y_coordinate (yfract), xfract, yfract); - + fade[which].points.push_back (p); } /* no need to sort because curve is already time-ordered */ out: - + swap (which, current); redraw (); swap (which, current); @@ -402,7 +402,7 @@ CrossfadeEditor::point_event (GdkEvent* event, Point* point) if (Keyboard::is_delete_event (&event->button)) { fade[current].points.remove (point); delete point; - } + } redraw (); break; @@ -420,7 +420,7 @@ CrossfadeEditor::point_event (GdkEvent* event, Point* point) } new_y = 1.0 - ((event->motion.y - canvas_border)/effective_height()); - point->move_to (x_coordinate (new_x), y_coordinate (new_y), + point->move_to (x_coordinate (new_x), y_coordinate (new_y), new_x, new_y); redraw (); } @@ -465,7 +465,7 @@ CrossfadeEditor::make_point () p->curve = fade[current].line; p->box->signal_event().connect (bind (mem_fun (*this, &CrossfadeEditor::point_event), p)); - + return p; } @@ -475,12 +475,12 @@ CrossfadeEditor::add_control_point (double x, double y) PointSorter cmp; /* enforce end point x location */ - + if (fade[current].points.empty()) { x = 0.0; } else if (fade[current].points.size() == 1) { x = 1.0; - } + } Point* p = make_point (); @@ -518,9 +518,9 @@ CrossfadeEditor::canvas_allocation (Gtk::Allocation& /*alloc*/) toplevel->property_x2() = (double) canvas->get_allocation().get_width() + canvas_border; toplevel->property_y2() = (double) canvas->get_allocation().get_height() + canvas_border; } - - canvas->set_scroll_region (0.0, 0.0, - canvas->get_allocation().get_width(), + + canvas->set_scroll_region (0.0, 0.0, + canvas->get_allocation().get_width(), canvas->get_allocation().get_height()); Point* end = make_point (); @@ -547,9 +547,9 @@ CrossfadeEditor::canvas_allocation (Gtk::Allocation& /*alloc*/) (*i)->move_to (x_coordinate((*i)->x), y_coordinate((*i)->y), (*i)->x, (*i)->y); } - + end = make_point (); - + if (fade[Out].points.size() > 1) { Point* old_end = fade[Out].points.back(); fade[Out].points.pop_back (); @@ -572,7 +572,7 @@ CrossfadeEditor::canvas_allocation (Gtk::Allocation& /*alloc*/) y_coordinate ((*i)->y), (*i)->x, (*i)->y); } - + WhichFade old_current = current; current = In; redraw (); @@ -655,7 +655,7 @@ CrossfadeEditor::redraw () float vec[npoints]; fade[current].normative_curve.curve().get_vector (0, 1.0, vec, npoints); - + ArdourCanvas::Points pts; ArdourCanvas::Points spts; @@ -687,11 +687,11 @@ CrossfadeEditor::redraw () spts[2].set_x (effective_width() + canvas_border); spts[2].set_y (canvas_border); - + } else { /* upper left */ - + spts[0].set_x (canvas_border); spts[0].set_y (canvas_border); @@ -712,7 +712,7 @@ CrossfadeEditor::redraw () for (size_t i = 0; i < npoints; ++i) { double y = vec[i]; - + pts[i].set_x (canvas_border + i); pts[i].set_y (y_coordinate (y)); @@ -731,20 +731,20 @@ CrossfadeEditor::redraw () void CrossfadeEditor::apply_preset (Preset *preset) { - + WhichFade wf = find(fade_in_presets->begin(), fade_in_presets->end(), preset) != fade_in_presets->end() ? In : Out; - + if (current != wf) { - + if (wf == In) { select_in_button.clicked(); } else { select_out_button.clicked(); } - + curve_select_clicked (wf); - } - + } + for (list<Point*>::iterator i = fade[current].points.begin(); i != fade[current].points.end(); ++i) { delete *i; } @@ -910,7 +910,7 @@ CrossfadeEditor::build_presets () p->push_back (PresetPoint (0.976959, 0.697222)); p->push_back (PresetPoint (1, 1)); fade_in_presets->push_back (p); - + p = new Preset ("Slow cut", "crossfade-in-slow-cut"); p->push_back (PresetPoint (0, 0)); p->push_back (PresetPoint (0.304147, 0.0694444)); @@ -920,7 +920,7 @@ CrossfadeEditor::build_presets () p->push_back (PresetPoint (0.919355, 0.730556)); p->push_back (PresetPoint (1, 1)); fade_in_presets->push_back (p); - + p = new Preset ("Fast cut", "crossfade-in-fast-cut"); p->push_back (PresetPoint (0, 0)); p->push_back (PresetPoint (0.0737327, 0.308333)); @@ -942,7 +942,7 @@ CrossfadeEditor::build_presets () p->push_back (PresetPoint (1, 1)); fade_in_presets->push_back (p); } - + /* FADE OUT */ // p = new Preset ("regout.xpm"); @@ -985,7 +985,7 @@ CrossfadeEditor::build_presets () p->push_back (PresetPoint (0.833333, 0.282192)); p->push_back (PresetPoint (1.000000, 0.000000)); fade_out_presets->push_back (p); - + if (!Profile->get_sae()) { // p = new Preset ("hiout.xpm"); p = new Preset ("Short cut", "crossfade-out-short-cut"); @@ -997,7 +997,7 @@ CrossfadeEditor::build_presets () p->push_back (PresetPoint (0.976852, 0.22865)); p->push_back (PresetPoint (1, 0)); fade_out_presets->push_back (p); - + p = new Preset ("Slow cut", "crossfade-out-slow-cut"); p->push_back (PresetPoint (0, 1)); p->push_back (PresetPoint (0.228111, 0.988889)); @@ -1007,7 +1007,7 @@ CrossfadeEditor::build_presets () p->push_back (PresetPoint (0.9262673, 0.308333)); p->push_back (PresetPoint (1, 0)); fade_out_presets->push_back (p); - + p = new Preset ("Fast cut", "crossfade-out-fast-cut"); p->push_back (PresetPoint (0, 1)); p->push_back (PresetPoint (0.080645, 0.730556)); @@ -1016,7 +1016,7 @@ CrossfadeEditor::build_presets () p->push_back (PresetPoint (0.695853, 0.0694444)); p->push_back (PresetPoint (1, 0)); fade_out_presets->push_back (p); - + // p = new Preset ("loout.xpm"); p = new Preset ("Long cut", "crossfade-out-long-cut"); p->push_back (PresetPoint (0, 1)); @@ -1027,7 +1027,7 @@ CrossfadeEditor::build_presets () p->push_back (PresetPoint (0.610599, 0.0333333)); p->push_back (PresetPoint (1, 0)); fade_out_presets->push_back (p); - + } } @@ -1035,9 +1035,9 @@ void CrossfadeEditor::curve_select_clicked (WhichFade wf) { current = wf; - + if (wf == In) { - + for (vector<ArdourCanvas::WaveView*>::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) { (*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get(); (*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get(); @@ -1081,7 +1081,7 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf) for (list<Point*>::iterator i = fade[In].points.begin(); i != fade[In].points.end(); ++i) { (*i)->box->hide(); } - + for (list<Point*>::iterator i = fade[Out].points.begin(); i != fade[Out].points.end(); ++i) { (*i)->box->show(); } @@ -1089,7 +1089,7 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf) } } -double +double CrossfadeEditor::x_coordinate (double& xfract) const { xfract = min (1.0, xfract); @@ -1125,9 +1125,9 @@ CrossfadeEditor::make_waves (boost::shared_ptr<AudioRegion> region, WhichFade wh spu = xfade->length() / (double) effective_width(); for (uint32_t n = 0; n < nchans; ++n) { - + gdouble yoff = n * ht; - + if (region->audio_source(n)->peaks_ready (bind (mem_fun(*this, &CrossfadeEditor::peaks_ready), region, which), peaks_ready_connection)) { WaveView* waveview = new WaveView (*(canvas->root())); @@ -1147,7 +1147,7 @@ CrossfadeEditor::make_waves (boost::shared_ptr<AudioRegion> region, WhichFade wh waveview->property_amplitude_above_axis() = 2.0; waveview->property_wave_color() = color; waveview->property_fill_color() = color; - + if (which==In) waveview->property_region_start() = region->start(); else @@ -1212,11 +1212,11 @@ CrossfadeEditor::audition (Audition which) right_length = xfade->in()->length(); } - boost::shared_ptr<AudioRegion> left (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->out(), left_start_offset, left_length, "xfade out", + boost::shared_ptr<AudioRegion> left (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->out(), left_start_offset, left_length, "xfade out", 0, Region::DefaultFlags, false))); - boost::shared_ptr<AudioRegion> right (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->in(), 0, right_length, "xfade in", + boost::shared_ptr<AudioRegion> right (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->in(), 0, right_length, "xfade in", 0, Region::DefaultFlags, false))); - + //apply a 20ms declicking fade at the start and end of auditioning left->set_fade_in_active(true); left->set_fade_in_length(session.frame_rate() / 50); @@ -1225,7 +1225,7 @@ CrossfadeEditor::audition (Audition which) pl.add_region (left, 0); pl.add_region (right, 1 + preroll); - + if (which == Left) { right->set_scale_amplitude (0.0); } else if (which == Right) { @@ -1247,9 +1247,9 @@ CrossfadeEditor::audition_both () void CrossfadeEditor::audition_left_dry () { - boost::shared_ptr<AudioRegion> left (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->out(), xfade->out()->length() - xfade->length(), xfade->length(), "xfade left", + boost::shared_ptr<AudioRegion> left (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->out(), xfade->out()->length() - xfade->length(), xfade->length(), "xfade left", 0, Region::DefaultFlags, false))); - + session.audition_region (left); } @@ -1262,7 +1262,7 @@ CrossfadeEditor::audition_left () void CrossfadeEditor::audition_right_dry () { - boost::shared_ptr<AudioRegion> right (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->in(), 0, xfade->length(), "xfade in", + boost::shared_ptr<AudioRegion> right (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->in(), 0, xfade->length(), "xfade in", 0, Region::DefaultFlags, false))); session.audition_region (right); } @@ -1272,7 +1272,7 @@ CrossfadeEditor::audition_right () { audition (Right); } - + void CrossfadeEditor::cancel_audition () { @@ -1298,7 +1298,7 @@ void CrossfadeEditor::audition_right_toggled () { bool x; - + if ((x = audition_right_button.get_active ()) != session.is_auditioning()) { if (x) { @@ -1345,7 +1345,7 @@ CrossfadeEditor::audition_left_dry_toggled () bool x; if ((x = audition_left_dry_button.get_active ()) != session.is_auditioning()) { - + if (x) { audition_left_dry (); } else { diff --git a/gtk2_ardour/crossfade_edit.h b/gtk2_ardour/crossfade_edit.h index 694625a9b5..f2ec1a125b 100644 --- a/gtk2_ardour/crossfade_edit.h +++ b/gtk2_ardour/crossfade_edit.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,69 +42,69 @@ class CrossfadeEditor : public ArdourDialog public: CrossfadeEditor (ARDOUR::Session&, boost::shared_ptr<ARDOUR::Crossfade>, double miny, double maxy); ~CrossfadeEditor (); - + void apply (); - + static const double canvas_border; - + /* these are public so that a caller/subclass can make them do the right thing. */ - + Gtk::Button* cancel_button; Gtk::Button* ok_button; - + struct PresetPoint { double x; double y; - - PresetPoint (double a, double b) + + PresetPoint (double a, double b) : x (a), y (b) {} }; - + struct Preset : public std::list<PresetPoint> { const char* name; const char* image_name; Preset (const char* n, const char* x) : name (n), image_name (x) {} }; - + typedef std::list<Preset*> Presets; - + static Presets* fade_in_presets; static Presets* fade_out_presets; protected: bool on_key_press_event (GdkEventKey*); bool on_key_release_event (GdkEventKey*); - + private: boost::shared_ptr<ARDOUR::Crossfade> xfade; ARDOUR::Session& session; - + Gtk::VBox vpacker; - + struct Point { ~Point(); - + ArdourCanvas::SimpleRect* box; ArdourCanvas::Line* curve; double x; double y; - + static const int32_t size; - + void move_to (double x, double y, double xfract, double yfract); }; - + struct PointSorter { bool operator() (const CrossfadeEditor::Point* a, const CrossfadeEditor::Point *b) { return a->x < b->x; } }; - + ArdourCanvas::SimpleRect* toplevel; ArdourCanvas::Canvas* canvas; - + struct Half { ArdourCanvas::Line* line; ArdourCanvas::Polygon* shading; @@ -112,18 +112,18 @@ class CrossfadeEditor : public ArdourDialog ARDOUR::AutomationList normative_curve; /* 0 - 1.0, linear */ ARDOUR::AutomationList gain_curve; /* 0 - 2.0, gain mapping */ std::vector<ArdourCanvas::WaveView*> waves; - + Half(); }; - + enum WhichFade { In = 0, Out = 1 }; - + Half fade[2]; WhichFade current; - + bool point_grabbed; std::vector<Gtk::Button*> fade_out_buttons; std::vector<Gtk::Button*> fade_in_buttons; @@ -154,7 +154,7 @@ class CrossfadeEditor : public ArdourDialog void add_control_point (double x, double y); Point* make_point (); void redraw (); - + double effective_width () const { return canvas->get_allocation().get_width() - (2.0 * canvas_border); } double effective_height () const { return canvas->get_allocation().get_height() - (2.0 * canvas_border); } @@ -169,7 +169,7 @@ class CrossfadeEditor : public ArdourDialog void build_presets (); void apply_preset (Preset*); - + Gtk::RadioButton select_in_button; Gtk::RadioButton select_out_button; Gtk::HBox curve_button_box; @@ -179,25 +179,25 @@ class CrossfadeEditor : public ArdourDialog double x_coordinate (double& xfract) const; double y_coordinate (double& yfract) const; - + void set (const ARDOUR::AutomationList& alist, WhichFade); sigc::connection peaks_ready_connection; void make_waves (boost::shared_ptr<ARDOUR::AudioRegion>, WhichFade); void peaks_ready (boost::shared_ptr<ARDOUR::AudioRegion> r, WhichFade); - + void _apply_to (boost::shared_ptr<ARDOUR::Crossfade> xf); void setup (boost::shared_ptr<ARDOUR::Crossfade>); void cancel_audition (); void audition_state_changed (bool); - + enum Audition { Both, Left, Right }; - + void audition_toggled (); void audition_right_toggled (); void audition_right_dry_toggled (); diff --git a/gtk2_ardour/crossfade_view.cc b/gtk2_ardour/crossfade_view.cc index 152e1bf5c0..e03c8ed478 100644 --- a/gtk2_ardour/crossfade_view.cc +++ b/gtk2_ardour/crossfade_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,21 +42,21 @@ using namespace Canvas; sigc::signal<void,CrossfadeView*> CrossfadeView::GoingAway; -CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent, - RouteTimeAxisView &tv, - boost::shared_ptr<Crossfade> xf, +CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent, + RouteTimeAxisView &tv, + boost::shared_ptr<Crossfade> xf, double spu, Gdk::Color& basic_color, AudioRegionView& lview, AudioRegionView& rview) - - : TimeAxisViewItem ("xfade" /*xf.name()*/, *parent, tv, spu, basic_color, xf->position(), + + : TimeAxisViewItem ("xfade" /*xf.name()*/, *parent, tv, spu, basic_color, xf->position(), xf->length(), false, TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowFrame)), crossfade (xf), left_view (lview), right_view (rview) - + { _valid = true; _visible = true; @@ -68,7 +68,7 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent, fade_out = new Line (*group); fade_out->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeLine.get(); fade_out->property_width_pixels() = 1; - + set_height (get_time_axis_view().current_height()); /* no frame around the xfade or overlap rects */ @@ -79,9 +79,9 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent, vestigial_frame->hide(); show_vestigial = false; - + group->signal_event().connect (bind (mem_fun (tv.editor(), &PublicEditor::canvas_crossfade_view_event), group, this)); - + crossfade_changed (Change (~0)); crossfade->StateChanged.connect (mem_fun(*this, &CrossfadeView::crossfade_changed)); @@ -139,7 +139,7 @@ CrossfadeView::crossfade_changed (Change what_changed) if (what_changed & Crossfade::FollowOverlapChanged) { need_redraw_curves = true; } - + if (what_changed & Crossfade::ActiveChanged) { /* calls redraw_curves */ active_changed (); @@ -151,7 +151,7 @@ CrossfadeView::crossfade_changed (Change what_changed) void CrossfadeView::redraw_curves () { - Points* points; + Points* points; int32_t npoints; float* vec; @@ -177,7 +177,7 @@ CrossfadeView::redraw_curves () } else { fade_in->show(); fade_out->show(); - } + } points = get_canvas_points ("xfade edit redraw", npoints); vec = new float[npoints]; diff --git a/gtk2_ardour/crossfade_view.h b/gtk2_ardour/crossfade_view.h index 2d9c5e4b2d..3e4021742e 100644 --- a/gtk2_ardour/crossfade_view.h +++ b/gtk2_ardour/crossfade_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,10 +32,10 @@ class AudioRegionView; struct CrossfadeView : public TimeAxisViewItem { - CrossfadeView (ArdourCanvas::Group*, + CrossfadeView (ArdourCanvas::Group*, RouteTimeAxisView&, boost::shared_ptr<ARDOUR::Crossfade>, - double initial_samples_per_unit, + double initial_samples_per_unit, Gdk::Color& basic_color, AudioRegionView& leftview, AudioRegionView& rightview); @@ -59,7 +59,7 @@ struct CrossfadeView : public TimeAxisViewItem void fake_hide (); void hide (); void show (); - + protected: void reset_width_dependent_items (double pixel_width); diff --git a/gtk2_ardour/crossfade_xpms.h b/gtk2_ardour/crossfade_xpms.h index e353dcb38b..f32d84e369 100644 --- a/gtk2_ardour/crossfade_xpms.h +++ b/gtk2_ardour/crossfade_xpms.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/curvetest.cc b/gtk2_ardour/curvetest.cc index d93d75504f..498ed45eba 100644 --- a/gtk2_ardour/curvetest.cc +++ b/gtk2_ardour/curvetest.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ curvetest (string filename) in >> x; in >> y; - + if (!in) { break; } @@ -58,11 +58,11 @@ curvetest (string filename) if (x < minx) { minx = x; } - + if (x > maxx) { maxx = x; } - + al.add (x, y); } @@ -70,10 +70,10 @@ curvetest (string filename) float foo[1024]; al.curve().get_vector (minx, maxx, foo, 1024); - + for (int i = 0; i < 1024; ++i) { cout << minx + (((double) i / 1024.0) * (maxx - minx)) << ' ' << foo[i] << endl; } - + return 0; } diff --git a/gtk2_ardour/diamond.cc b/gtk2_ardour/diamond.cc index 48c0dd4b68..57b86250f9 100644 --- a/gtk2_ardour/diamond.cc +++ b/gtk2_ardour/diamond.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -59,7 +59,7 @@ Diamond::move_to (double x, double y) points->coords[4] = _x; points->coords[5] = _y; - + points->coords[6] = _x - _h; points->coords[7] = _y + _h; diff --git a/gtk2_ardour/diamond.h b/gtk2_ardour/diamond.h index d9bcf3cff8..a8169becb9 100644 --- a/gtk2_ardour/diamond.h +++ b/gtk2_ardour/diamond.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ namespace Gnome { namespace Canvas { -class Diamond : public Polygon +class Diamond : public Polygon { public: Diamond(Group& group, double height); diff --git a/gtk2_ardour/editing.cc b/gtk2_ardour/editing.cc index cd1c820d61..486808065e 100644 --- a/gtk2_ardour/editing.cc +++ b/gtk2_ardour/editing.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/editing.h b/gtk2_ardour/editing.h index 19a3d13370..6bc575116b 100644 --- a/gtk2_ardour/editing.h +++ b/gtk2_ardour/editing.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/editing_syms.h b/gtk2_ardour/editing_syms.h index 7b3e87db16..56cd91f691 100644 --- a/gtk2_ardour/editing_syms.h +++ b/gtk2_ardour/editing_syms.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 5aec06170e..a68f51af49 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2009 Paul Davis + Copyright (C) 2000-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -227,28 +227,28 @@ Editor::Editor () /* the values here don't matter: layout widgets reset them as needed. */ - + , vertical_adjustment (0.0, 0.0, 10.0, 400.0) , horizontal_adjustment (0.0, 0.0, 20.0, 1200.0) - + /* tool bar related */ , edit_point_clock (X_("editpoint"), false, X_("EditPointClock"), true) , zoom_range_clock (X_("zoomrange"), false, X_("ZoomRangeClock"), true, true) - + , toolbar_selection_clock_table (2,3) - + , automation_mode_button (_("mode")) , global_automation_button (_("automation")) - + , midi_panic_button (_("Panic")) - + #ifdef WITH_CMT , image_socket_listener(0) #endif - + /* nudge */ - + , nudge_clock (X_("nudge"), false, X_("NudgeClock"), true, true) , meters_running(false) , _pending_locate_request (false) @@ -276,7 +276,7 @@ Editor::Editor () current_mixer_strip = 0; current_bbt_points = 0; tempo_lines = 0; - + snap_type_strings = I18N (_snap_type_strings); snap_mode_strings = I18N (_snap_mode_strings); zoom_focus_strings = I18N (_zoom_focus_strings); @@ -284,7 +284,7 @@ Editor::Editor () #ifdef USE_RUBBERBAND rb_opt_strings = I18N (_rb_opt_strings); #endif - + snap_threshold = 5.0; bbt_beat_subdivision = 4; _canvas_width = 0; @@ -364,7 +364,7 @@ Editor::Editor () frames_per_unit = 2048; /* too early to use reset_zoom () */ reset_hscrollbar_stepping (); - + zoom_focus = ZoomFocusLeft; set_zoom_focus (ZoomFocusLeft); zoom_range_clock.ValueChanged.connect (mem_fun(*this, &Editor::zoom_adjustment_changed)); @@ -451,11 +451,11 @@ Editor::Editor () h->pack_start (*_group_tabs, PACK_SHRINK); h->pack_start (edit_controls_vbox); controls_layout.add (*h); - + controls_layout.set_name ("EditControlsBase"); controls_layout.add_events (Gdk::SCROLL_MASK); controls_layout.signal_scroll_event().connect (mem_fun(*this, &Editor::control_layout_scroll), false); - + controls_layout.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK); controls_layout.signal_button_release_event().connect (mem_fun(*this, &Editor::edit_controls_button_release)); controls_layout_size_request_connection = controls_layout.signal_size_request().connect (mem_fun (*this, &Editor::controls_layout_size_request)); @@ -472,7 +472,7 @@ Editor::Editor () build_cursors (); edit_point_clock.ValueChanged.connect (mem_fun(*this, &Editor::edit_point_clock_changed)); - + ArdourCanvas::Canvas* time_pad = manage(new ArdourCanvas::Canvas()); ArdourCanvas::SimpleLine* pad_line_1 = manage(new ArdourCanvas::SimpleLine(*time_pad->root(), 0.0, 1.0, 100.0, 1.0)); @@ -483,7 +483,7 @@ Editor::Editor () time_canvas_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars) + 2); time_canvas_vbox.set_size_request (-1, -1); - ruler_label_event_box.add (ruler_label_vbox); + ruler_label_event_box.add (ruler_label_vbox); ruler_label_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); ruler_label_event_box.signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_label_button_release)); @@ -491,7 +491,7 @@ Editor::Editor () time_button_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); time_button_event_box.signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_label_button_release)); - /* these enable us to have a dedicated window (for cursor setting, etc.) + /* these enable us to have a dedicated window (for cursor setting, etc.) for the canvas areas. */ @@ -535,7 +535,7 @@ Editor::Editor () named_selection_display.set_headers_visible (false); named_selection_display.set_size_request (100, -1); named_selection_display.set_name ("NamedSelectionDisplay"); - + named_selection_display.get_selection()->set_mode (SELECTION_SINGLE); named_selection_display.set_size_request (100, -1); named_selection_display.signal_button_release_event().connect (mem_fun(*this, &Editor::named_selection_display_button_release), false); @@ -556,7 +556,7 @@ Editor::Editor () nlabel = manage (new Label (_("Route Groups"))); nlabel->set_angle (-90); the_notebook.append_page (_route_groups->widget (), *nlabel); - + if (!Profile->get_sae()) { nlabel = manage (new Label (_("Chunks"))); nlabel->set_angle (-90); @@ -578,7 +578,7 @@ Editor::Editor () edit_pane.pack1 (*editor_summary_pane, true, true); edit_pane.pack2 (the_notebook, false, true); - + edit_pane.signal_size_allocate().connect (bind (mem_fun(*this, &Editor::pane_allocation_handler), static_cast<Paned*> (&edit_pane))); top_hbox.pack_start (toolbar_frame, false, true); @@ -600,7 +600,7 @@ Editor::Editor () vpacker.pack_end (global_hpacker, true, true); /* register actions now so that set_state() can find them and set toggles/checks etc */ - + register_actions (); setup_toolbar (); @@ -691,7 +691,7 @@ Editor::~Editor() { image_socket_listener->close_connection() ; } - + delete image_socket_listener ; image_socket_listener = 0 ; } @@ -779,7 +779,7 @@ Editor::show_window () */ TimeAxisView *tv; - + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { tv = (static_cast<TimeAxisView*>(*i)); tv->reset_height (); @@ -840,7 +840,7 @@ Editor::zoom_adjustment_changed () fpu = session->current_end_frame() / _canvas_width; zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width)); } - + temporal_zoom (fpu); } @@ -857,7 +857,7 @@ Editor::control_scroll (float fraction) /* _control_scroll_target is an optional<T> - + it acts like a pointer to an nframes64_t, with a operator conversion to boolean to check that it has a value could possibly use @@ -883,7 +883,7 @@ Editor::control_scroll (float fraction) playhead_cursor->set_position (*_control_scroll_target); UpdateAllTransportClocks (*_control_scroll_target); - + if (*_control_scroll_target > (current_page_frames() / 2)) { /* try to center PH in window */ reset_x_origin (*_control_scroll_target - (current_page_frames()/2)); @@ -931,7 +931,7 @@ Editor::access_action (std::string action_group, std::string action_item) if (act) { act->activate(); } - + } @@ -945,7 +945,7 @@ Editor::on_realize () void Editor::start_scrolling () { - scroll_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect + scroll_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun(*this, &Editor::update_current_screen)); } @@ -967,7 +967,7 @@ Editor::map_position_change (nframes64_t frame) center_screen (frame); playhead_cursor->set_position (frame); -} +} void Editor::center_screen (nframes64_t frame) @@ -976,7 +976,7 @@ Editor::center_screen (nframes64_t frame) /* if we're off the page, then scroll. */ - + if (frame < leftmost_frame || frame >= leftmost_frame + page) { center_screen_internal (frame, page); } @@ -986,7 +986,7 @@ void Editor::center_screen_internal (nframes64_t frame, float page) { page /= 2; - + if (frame > page) { frame -= (nframes64_t) page; } else { @@ -1019,7 +1019,7 @@ void Editor::update_title_s (const string & snap_name) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::update_title_s), snap_name)); - + update_title (); } @@ -1107,7 +1107,7 @@ Editor::connect_to_session (Session *t) nframes_t pos = session->tempo_map().bbt_duration_at (0, bbt, 1); nudge_clock.set_mode(AudioClock::BBT); nudge_clock.set (pos, true, 0, AudioClock::BBT); - + } else { nudge_clock.set (session->frame_rate() * 5, true, 0, AudioClock::SMPTE); // default of 5 seconds } @@ -1133,7 +1133,7 @@ Editor::connect_to_session (Session *t) // force name loc->set_name (_("Loop")); } - + loc = session->locations()->auto_punch_location(); if (loc == 0) { loc = new Location (0, session->current_end_frame(), _("Punch"), (Location::Flags) (Location::IsAutoPunch | Location::IsHidden)); @@ -1149,9 +1149,9 @@ Editor::connect_to_session (Session *t) Config->map_parameters (mem_fun (*this, &Editor::parameter_changed)); session->config.map_parameters (mem_fun (*this, &Editor::parameter_changed)); - + session->StateSaved.connect (mem_fun(*this, &Editor::session_state_saved)); - + refresh_location_display (); session->locations()->added.connect (mem_fun(*this, &Editor::add_new_location)); session->locations()->removed.connect (mem_fun(*this, &Editor::location_gone)); @@ -1198,7 +1198,7 @@ Editor::connect_to_session (Session *t) _regions->connect_to_session (session); _snapshots->connect_to_session (session); _routes->connect_to_session (session); - + start_updating (); } @@ -1206,7 +1206,7 @@ void Editor::build_cursors () { using namespace Gdk; - + Gdk::Color mbg ("#000000" ); /* Black */ Gdk::Color mfg ("#0000ff" ); /* Blue. */ @@ -1219,23 +1219,23 @@ Editor::build_cursors () Gdk::Color fbg ("#ffffff" ); Gdk::Color ffg ("#000000" ); - + { RefPtr<Bitmap> source, mask; - + source = Bitmap::create (fader_cursor_bits, fader_cursor_width, fader_cursor_height); mask = Bitmap::create (fader_cursor_mask_bits, fader_cursor_width, fader_cursor_height); fader_cursor = new Gdk::Cursor (source, mask, ffg, fbg, fader_cursor_x_hot, fader_cursor_y_hot); } - - { + + { RefPtr<Bitmap> source, mask; source = Bitmap::create (speaker_cursor_bits, speaker_cursor_width, speaker_cursor_height); mask = Bitmap::create (speaker_cursor_mask_bits, speaker_cursor_width, speaker_cursor_height); speaker_cursor = new Gdk::Cursor (source, mask, ffg, fbg, speaker_cursor_x_hot, speaker_cursor_y_hot); } - - { + + { RefPtr<Bitmap> bits; char pix[4] = { 0, 0, 0, 0 }; bits = Bitmap::create (pix, 2, 2); @@ -1243,17 +1243,17 @@ Editor::build_cursors () transparent_cursor = new Gdk::Cursor (bits, bits, c, c, 0, 0); } - { + { RefPtr<Bitmap> bits; char pix[4] = { 0, 0, 0, 0 }; bits = Bitmap::create (pix, 2, 2); Gdk::Color c; transparent_cursor = new Gdk::Cursor (bits, bits, c, c, 0, 0); } - + grabber_cursor = new Gdk::Cursor (HAND2); - + { Glib::RefPtr<Gdk::Pixbuf> grabber_edit_point_pixbuf (::get_icon ("grabber_edit_point")); grabber_edit_point_cursor = new Gdk::Cursor (Gdk::Display::get_default(), grabber_edit_point_pixbuf, 5, 17); @@ -1295,7 +1295,7 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i } else { items.push_back (MenuElem (_("Activate"), bind (mem_fun (*this, &Editor::set_fade_in_active), true))); } - + items.push_back (SeparatorElem()); if (Profile->get_sae()) { @@ -1318,9 +1318,9 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i } else { items.push_back (MenuElem (_("Activate"), bind (mem_fun (*this, &Editor::set_fade_out_active), true))); } - + items.push_back (SeparatorElem()); - + if (Profile->get_sae()) { items.push_back (MenuElem (_("Linear"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Linear))); items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Slow))); @@ -1389,7 +1389,7 @@ Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type, menu = (this->*build_menu_function)(frame); menu->set_name ("ArdourContextMenu"); - + /* now handle specific situations */ switch (item_type) { @@ -1434,10 +1434,10 @@ Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type, if (item_type != SelectionItem && clicked_routeview && clicked_routeview->audio_track()) { /* Bounce to disk */ - + using namespace Menu_Helpers; MenuList& edit_items = menu->items(); - + edit_items.push_back (SeparatorElem()); switch (clicked_routeview->audio_track()->freeze_state()) { @@ -1448,7 +1448,7 @@ Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type, case AudioTrack::Frozen: edit_items.push_back (MenuElem (_("Unfreeze"), mem_fun(*this, &Editor::unfreeze_route))); break; - + case AudioTrack::UnFrozen: edit_items.push_back (MenuElem (_("Freeze"), mem_fun(*this, &Editor::freeze_route))); break; @@ -1499,16 +1499,16 @@ Editor::build_track_region_context_menu (nframes64_t frame) if (rtv) { boost::shared_ptr<Diskstream> ds; boost::shared_ptr<Playlist> pl; - + if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) { Playlist::RegionList* regions = pl->regions_at ((nframes64_t) floor ( (double)frame * ds->speed())); if (selection->regions.size() > 1) { - // there's already a multiple selection: just add a - // single region context menu that will act on all + // there's already a multiple selection: just add a + // single region context menu that will act on all // selected regions - boost::shared_ptr<Region> dummy_region; // = NULL - add_region_context_items (rtv->view(), dummy_region, edit_items); + boost::shared_ptr<Region> dummy_region; // = NULL + add_region_context_items (rtv->view(), dummy_region, edit_items); } else { for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) { add_region_context_items (rtv->view(), (*i), edit_items); @@ -1552,11 +1552,11 @@ Editor::build_track_crossfade_context_menu (nframes64_t frame) } if (selection->regions.size() > 1) { - // there's already a multiple selection: just add a - // single region context menu that will act on all + // there's already a multiple selection: just add a + // single region context menu that will act on all // selected regions - boost::shared_ptr<Region> dummy_region; // = NULL - add_region_context_items (atv->audio_view(), dummy_region, edit_items); + boost::shared_ptr<Region> dummy_region; // = NULL + add_region_context_items (atv->audio_view(), dummy_region, edit_items); } else { for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) { add_region_context_items (atv->audio_view(), (*i), edit_items); @@ -1585,7 +1585,7 @@ Editor::analyze_region_selection() analysis_window->set_regionmode(); analysis_window->analyze(); - + analysis_window->present(); } @@ -1603,7 +1603,7 @@ Editor::analyze_range_selection() analysis_window->set_rangemode(); analysis_window->analyze(); - + analysis_window->present(); } @@ -1635,7 +1635,7 @@ Editor::add_crossfade_context_items (AudioStreamView* /*view*/, boost::shared_pt if (xfade->active()) { str = _("Mute"); - } else { + } else { str = _("Unmute"); } @@ -1697,13 +1697,13 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi ar = boost::dynamic_pointer_cast<AudioRegion> (region); mr = boost::dynamic_pointer_cast<MidiRegion> (region); - /* when this particular menu pops up, make the relevant region + /* when this particular menu pops up, make the relevant region become selected. */ region_menu->signal_map_event().connect ( bind (mem_fun(*this, &Editor::set_selected_regionview_from_map_event), sv, boost::weak_ptr<Region>(region))); - + items.push_back (MenuElem (_("Rename"), mem_fun(*this, &Editor::rename_region))); if (mr && internal_editing()) { items.push_back (MenuElem (_("Popup list editor"), mem_fun(*this, &Editor::show_midi_list_editor))); @@ -1744,10 +1744,10 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi region_lock_item->set_active(); } region_lock_item->signal_activate().connect (mem_fun(*this, &Editor::toggle_region_lock)); - + items.push_back (CheckMenuElem (_("Glue to Bars&Beats"))); CheckMenuItem* bbt_glue_item = static_cast<CheckMenuItem*>(&items.back()); - + switch (region_to_check->positional_lock_style()) { case Region::MusicTime: bbt_glue_item->set_active (true); @@ -1756,9 +1756,9 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi bbt_glue_item->set_active (false); break; } - + bbt_glue_item->signal_activate().connect (bind (mem_fun (*this, &Editor::set_region_lock_style), Region::MusicTime)); - + items.push_back (CheckMenuElem (_("Mute"))); CheckMenuItem* region_mute_item = static_cast<CheckMenuItem*>(&items.back()); fooc = region_mute_item->signal_activate().connect (mem_fun(*this, &Editor::toggle_region_mute)); @@ -1767,7 +1767,7 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi region_mute_item->set_active(); fooc.block (false); } - + if (!Profile->get_sae()) { items.push_back (CheckMenuElem (_("Opaque"))); CheckMenuItem* region_opaque_item = static_cast<CheckMenuItem*>(&items.back()); @@ -1778,19 +1778,19 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi fooc.block (false); } } - + items.push_back (CheckMenuElem (_("Original position"), mem_fun(*this, &Editor::naturalize))); if (region_to_check->at_natural_position()) { items.back().set_sensitive (false); } - + items.push_back (SeparatorElem()); - + if (ar) { - + RegionView* rv = sv->find_view (ar); AudioRegionView* arv = dynamic_cast<AudioRegionView*>(rv); - + if (!Profile->get_sae()) { items.push_back (MenuElem (_("Reset Envelope"), mem_fun(*this, &Editor::reset_region_gain_envelopes))); @@ -1802,11 +1802,11 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi region_envelope_visible_item->set_active (true); fooc.block (false); } - + items.push_back (CheckMenuElem (_("Envelope Active"))); CheckMenuItem* region_envelope_active_item = static_cast<CheckMenuItem*> (&items.back()); fooc = region_envelope_active_item->signal_activate().connect (mem_fun(*this, &Editor::toggle_gain_envelope_active)); - + if (ar->envelope_active()) { fooc.block (true); region_envelope_active_item->set_active (true); @@ -1840,13 +1840,13 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi items.push_back (MenuElem (_("Set Range Selection"), mem_fun (*this, &Editor::set_selection_from_region))); items.push_back (SeparatorElem()); - + /* Nudge region */ Menu *nudge_menu = manage (new Menu()); MenuList& nudge_items = nudge_menu->items(); nudge_menu->set_name ("ArdourContextMenu"); - + nudge_items.push_back (MenuElem (_("Nudge fwd"), (bind (mem_fun(*this, &Editor::nudge_forward), false, false)))); nudge_items.push_back (MenuElem (_("Nudge bwd"), (bind (mem_fun(*this, &Editor::nudge_backward), false, false)))); nudge_items.push_back (MenuElem (_("Nudge fwd by capture offset"), (mem_fun(*this, &Editor::nudge_forward_capture_offset)))); @@ -1858,7 +1858,7 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi Menu *trim_menu = manage (new Menu); MenuList& trim_items = trim_menu->items(); trim_menu->set_name ("ArdourContextMenu"); - + trim_items.push_back (MenuElem (_("Start to edit point"), mem_fun(*this, &Editor::trim_region_from_edit_point))); foo_item = &trim_items.back(); if (_edit_point == EditAtMouse) { @@ -1871,13 +1871,13 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi } trim_items.push_back (MenuElem (_("Trim To Loop"), mem_fun(*this, &Editor::trim_region_to_loop))); trim_items.push_back (MenuElem (_("Trim To Punch"), mem_fun(*this, &Editor::trim_region_to_punch))); - + items.push_back (MenuElem (_("Trim"), *trim_menu)); items.push_back (SeparatorElem()); items.push_back (MenuElem (_("Split"), (mem_fun(*this, &Editor::split)))); region_edit_menu_split_item = &items.back(); - + if (_edit_point == EditAtMouse) { region_edit_menu_split_item->set_sensitive (false); } @@ -1906,7 +1906,7 @@ Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> regi menu_item_name.replace (pos, 1, "__"); pos += 2; } - + edit_items.push_back (MenuElem (menu_item_name, *region_menu)); edit_items.push_back (SeparatorElem()); } @@ -1934,23 +1934,23 @@ Editor::add_selection_context_items (Menu_Helpers::MenuList& edit_items) edit_items.push_back (SeparatorElem()); edit_items.push_back (MenuElem (_("Silence Range"), mem_fun(*this, &Editor::separate_region_from_selection))); edit_items.push_back (MenuElem (_("Convert to Region in Region List"), mem_fun(*this, &Editor::new_region_from_selection))); - + edit_items.push_back (SeparatorElem()); edit_items.push_back (MenuElem (_("Select All in Range"), mem_fun(*this, &Editor::select_all_selectables_using_time_selection))); edit_items.push_back (SeparatorElem()); edit_items.push_back (MenuElem (_("Set Loop from Range"), bind (mem_fun(*this, &Editor::set_loop_from_selection), false))); edit_items.push_back (MenuElem (_("Set Punch from Range"), mem_fun(*this, &Editor::set_punch_from_selection))); - + edit_items.push_back (SeparatorElem()); edit_items.push_back (MenuElem (_("Add Range Markers"), mem_fun (*this, &Editor::add_location_from_selection))); - + edit_items.push_back (SeparatorElem()); edit_items.push_back (MenuElem (_("Crop Region to Range"), mem_fun(*this, &Editor::crop_region_to_selection))); edit_items.push_back (MenuElem (_("Fill Range with Region"), mem_fun(*this, &Editor::region_fill_selection))); edit_items.push_back (MenuElem (_("Duplicate Range"), bind (mem_fun(*this, &Editor::duplicate_dialog), false))); edit_items.push_back (MenuElem (_("Create Chunk from Range"), mem_fun(*this, &Editor::create_named_selection))); - + edit_items.push_back (SeparatorElem()); edit_items.push_back (MenuElem (_("Consolidate Range"), bind (mem_fun(*this, &Editor::bounce_range_selection), true, false))); edit_items.push_back (MenuElem (_("Consolidate Range With Processing"), bind (mem_fun(*this, &Editor::bounce_range_selection), true, true))); @@ -1959,7 +1959,7 @@ Editor::add_selection_context_items (Menu_Helpers::MenuList& edit_items) edit_items.push_back (MenuElem (_("Export Range"), mem_fun(*this, &Editor::export_range))); } - + void Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items) { @@ -1970,13 +1970,13 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items) Menu *play_menu = manage (new Menu); MenuList& play_items = play_menu->items(); play_menu->set_name ("ArdourContextMenu"); - + play_items.push_back (MenuElem (_("Play from edit point"), mem_fun(*this, &Editor::play_from_edit_point))); play_items.push_back (MenuElem (_("Play from start"), mem_fun(*this, &Editor::play_from_start))); play_items.push_back (MenuElem (_("Play region"), mem_fun(*this, &Editor::play_selected_region))); play_items.push_back (SeparatorElem()); play_items.push_back (MenuElem (_("Loop Region"), mem_fun(*this, &Editor::loop_selected_region))); - + edit_items.push_back (MenuElem (_("Play"), *play_menu)); /* Selection */ @@ -1984,7 +1984,7 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items) Menu *select_menu = manage (new Menu); MenuList& select_items = select_menu->items(); select_menu->set_name ("ArdourContextMenu"); - + select_items.push_back (MenuElem (_("Select All in track"), bind (mem_fun(*this, &Editor::select_all_in_track), Selection::Set))); select_items.push_back (MenuElem (_("Select All"), bind (mem_fun(*this, &Editor::select_all), Selection::Set))); select_items.push_back (MenuElem (_("Invert selection in track"), mem_fun(*this, &Editor::invert_selection_in_track))); @@ -2008,7 +2008,7 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items) Menu *cutnpaste_menu = manage (new Menu); MenuList& cutnpaste_items = cutnpaste_menu->items(); cutnpaste_menu->set_name ("ArdourContextMenu"); - + cutnpaste_items.push_back (MenuElem (_("Cut"), mem_fun(*this, &Editor::cut))); cutnpaste_items.push_back (MenuElem (_("Copy"), mem_fun(*this, &Editor::copy))); cutnpaste_items.push_back (MenuElem (_("Paste"), bind (mem_fun(*this, &Editor::paste), 1.0f))); @@ -2025,7 +2025,7 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items) edit_items.push_back (MenuElem (_("Edit"), *cutnpaste_menu)); /* Adding new material */ - + edit_items.push_back (SeparatorElem()); edit_items.push_back (MenuElem (_("Insert Selected Region"), bind (mem_fun(*this, &Editor::insert_region_list_selection), 1.0f))); edit_items.push_back (MenuElem (_("Insert Existing Media"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportToTrack))); @@ -2035,7 +2035,7 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items) Menu *nudge_menu = manage (new Menu()); MenuList& nudge_items = nudge_menu->items(); nudge_menu->set_name ("ArdourContextMenu"); - + edit_items.push_back (SeparatorElem()); nudge_items.push_back (MenuElem (_("Nudge entire track fwd"), (bind (mem_fun(*this, &Editor::nudge_track), false, true)))); nudge_items.push_back (MenuElem (_("Nudge track after edit point fwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, true)))); @@ -2055,7 +2055,7 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items) Menu *play_menu = manage (new Menu); MenuList& play_items = play_menu->items(); play_menu->set_name ("ArdourContextMenu"); - + play_items.push_back (MenuElem (_("Play from edit point"), mem_fun(*this, &Editor::play_from_edit_point))); play_items.push_back (MenuElem (_("Play from start"), mem_fun(*this, &Editor::play_from_start))); edit_items.push_back (MenuElem (_("Play"), *play_menu)); @@ -2065,7 +2065,7 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items) Menu *select_menu = manage (new Menu); MenuList& select_items = select_menu->items(); select_menu->set_name ("ArdourContextMenu"); - + select_items.push_back (MenuElem (_("Select All in track"), bind (mem_fun(*this, &Editor::select_all_in_track), Selection::Set))); select_items.push_back (MenuElem (_("Select All"), bind (mem_fun(*this, &Editor::select_all), Selection::Set))); select_items.push_back (MenuElem (_("Invert selection in track"), mem_fun(*this, &Editor::invert_selection_in_track))); @@ -2083,7 +2083,7 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items) Menu *cutnpaste_menu = manage (new Menu); MenuList& cutnpaste_items = cutnpaste_menu->items(); cutnpaste_menu->set_name ("ArdourContextMenu"); - + cutnpaste_items.push_back (MenuElem (_("Cut"), mem_fun(*this, &Editor::cut))); cutnpaste_items.push_back (MenuElem (_("Copy"), mem_fun(*this, &Editor::copy))); cutnpaste_items.push_back (MenuElem (_("Paste"), bind (mem_fun(*this, &Editor::paste), 1.0f))); @@ -2091,7 +2091,7 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items) Menu *nudge_menu = manage (new Menu()); MenuList& nudge_items = nudge_menu->items(); nudge_menu->set_name ("ArdourContextMenu"); - + edit_items.push_back (SeparatorElem()); nudge_items.push_back (MenuElem (_("Nudge entire track fwd"), (bind (mem_fun(*this, &Editor::nudge_track), false, true)))); nudge_items.push_back (MenuElem (_("Nudge track after edit point fwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, true)))); @@ -2107,12 +2107,12 @@ Editor::set_snap_to (SnapType st) unsigned int snap_ind = (unsigned int)st; snap_type = st; - + if (snap_ind > snap_type_strings.size() - 1) { snap_ind = 0; snap_type = (SnapType)snap_ind; } - + string str = snap_type_strings[snap_ind]; if (str != snap_type_selector.get_active_text()) { @@ -2302,7 +2302,7 @@ Editor::set_state (const XMLNode& node) position may be zero already, and it does nothing in such circumstances. */ - + leftmost_frame = 0; horizontal_adjustment.set_value (0); } @@ -2361,7 +2361,7 @@ Editor::set_state (const XMLNode& node) tact->set_active (yn); } } - + if ((prop = node.property ("show-measures"))) { bool yn = string_is_affirmative (prop->value()); _show_measures = !yn; @@ -2405,12 +2405,12 @@ Editor::set_state (const XMLNode& node) bool yn = string_is_affirmative (prop->value()); /* do it twice to force the change */ - + tact->set_active (!yn); tact->set_active (yn); } } - + if ((prop = node.property ("show-editor-list"))) { Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-list")); @@ -2421,7 +2421,7 @@ Editor::set_state (const XMLNode& node) bool yn = string_is_affirmative (prop->value()); /* do it twice to force the change */ - + tact->set_active (!yn); tact->set_active (yn); } @@ -2439,15 +2439,15 @@ Editor::get_state () _id.print (buf, sizeof (buf)); node->add_property ("id", buf); - + if (is_realized()) { Glib::RefPtr<Gdk::Window> win = get_window(); - + int x, y, xoff, yoff, width, height; win->get_root_origin(x, y); win->get_position(xoff, yoff); win->get_size(width, height); - + XMLNode* geometry = new XMLNode ("geometry"); snprintf(buf, sizeof(buf), "%d", width); @@ -2469,7 +2469,7 @@ Editor::get_state () } 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); @@ -2491,13 +2491,13 @@ Editor::get_state () node->add_property ("region-list-sort-type", enum2str (_regions->sort_type ())); node->add_property ("mouse-mode", enum2str(mouse_mode)); node->add_property ("internal-edit", _internal_editing ? "yes" : "no"); - + Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer")); if (act) { Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); node->add_property (X_("show-editor-mixer"), tact->get_active() ? "yes" : "no"); } - + act = ActionManager::get_action (X_("Editor"), X_("show-editor-list")); if (act) { Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); @@ -2596,13 +2596,13 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) start += session->smpte_offset (); } else { start -= session->smpte_offset (); - } + } if (((direction == 0) && (start % one_smpte_second > one_smpte_second / 2)) || direction > 0) { start = (nframes64_t) ceil ((double) start / one_smpte_second) * one_smpte_second; } else { start = (nframes64_t) floor ((double) start / one_smpte_second) * one_smpte_second; } - + if (session->smpte_offset_negative()) { start -= session->smpte_offset (); @@ -2610,7 +2610,7 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) start += session->smpte_offset (); } break; - + case SnapToSMPTEMinutes: if (session->smpte_offset_negative()) { @@ -2630,7 +2630,7 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) start += session->smpte_offset (); } break; - + case SnapToSeconds: if (((direction == 0) && (start % one_second > one_second / 2)) || (direction > 0)) { start = (nframes64_t) ceil ((double) start / one_second) * one_second; @@ -2638,7 +2638,7 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) start = (nframes64_t) floor ((double) start / one_second) * one_second; } break; - + case SnapToMinutes: if (((direction == 0) && (start % one_minute > one_minute / 2)) || (direction > 0)) { start = (nframes64_t) ceil ((double) start / one_minute) * one_minute; @@ -2723,13 +2723,13 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) vector<nframes64_t>::iterator prev = region_boundary_cache.end (); vector<nframes64_t>::iterator next = region_boundary_cache.end (); - + if (direction > 0) { next = std::upper_bound (region_boundary_cache.begin(), region_boundary_cache.end(), start); } else { next = std::lower_bound (region_boundary_cache.begin(), region_boundary_cache.end(), start); } - + if (next != region_boundary_cache.begin ()) { prev = next; prev--; @@ -2743,31 +2743,31 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) } else { start = p; } - } + } break; } switch (snap_mode) { case SnapNormal: - return; - + return; + case SnapMagnetic: - + if (presnap > start) { if (presnap > (start + unit_to_frame(snap_threshold))) { start = presnap; } - + } else if (presnap < start) { if (presnap < (start - unit_to_frame(snap_threshold))) { start = presnap; } } - + default: /* handled at entry */ return; - + } } @@ -2817,7 +2817,7 @@ Editor::setup_toolbar () mode_box->pack_start(edit_mode_selector); mode_box->pack_start(mouse_mode_button_box); - + mouse_mode_tearoff = manage (new TearOff (*mode_box)); mouse_mode_tearoff->set_name ("MouseModeBase"); mouse_mode_tearoff->tearoff_window().signal_key_press_event().connect (bind (sigc::ptr_fun (relay_key_press), &mouse_mode_tearoff->tearoff_window()), false); @@ -2826,13 +2826,13 @@ Editor::setup_toolbar () mouse_mode_tearoff->set_can_be_torn_off (false); } - mouse_mode_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox), + mouse_mode_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox), &mouse_mode_tearoff->tearoff_window())); - mouse_mode_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox), + mouse_mode_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox), &mouse_mode_tearoff->tearoff_window(), 1)); - mouse_mode_tearoff->Hidden.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox), + mouse_mode_tearoff->Hidden.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox), &mouse_mode_tearoff->tearoff_window())); - mouse_mode_tearoff->Visible.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox), + mouse_mode_tearoff->Visible.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox), &mouse_mode_tearoff->tearoff_window(), 1)); mouse_move_button.set_mode (false); @@ -2860,7 +2860,7 @@ Editor::setup_toolbar () internal_edit_button.unset_flags (CAN_FOCUS); /* Zoom */ - + zoom_box.set_spacing (1); zoom_box.set_border_width (0); @@ -2869,7 +2869,7 @@ Editor::setup_toolbar () zoom_in_button.add (*(manage (new Image (::get_icon("zoom_in"))))); zoom_in_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::temporal_zoom_step), false)); ARDOUR_UI::instance()->tooltips().set_tip (zoom_in_button, _("Zoom In")); - + zoom_out_button.set_name ("EditorTimeButton"); zoom_out_button.set_size_request(-1,16); zoom_out_button.add (*(manage (new Image (::get_icon("zoom_out"))))); @@ -2890,14 +2890,14 @@ Editor::setup_toolbar () zoom_box.pack_start (zoom_out_button, false, false); zoom_box.pack_start (zoom_in_button, false, false); zoom_box.pack_start (zoom_out_full_button, false, false); - + /* Track zoom buttons */ tav_expand_button.set_name ("TrackHeightButton"); tav_expand_button.set_size_request(-1,20); tav_expand_button.add (*(manage (new Image (::get_icon("tav_exp"))))); tav_expand_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::tav_zoom_step), true)); ARDOUR_UI::instance()->tooltips().set_tip (tav_expand_button, _("Expand Tracks")); - + tav_shrink_button.set_name ("TrackHeightButton"); tav_shrink_button.set_size_request(-1,20); tav_shrink_button.add (*(manage (new Image (::get_icon("tav_shrink"))))); @@ -2907,9 +2907,9 @@ Editor::setup_toolbar () track_zoom_box.set_spacing (1); track_zoom_box.set_border_width (0); - track_zoom_box.pack_start (tav_shrink_button, false, false); + track_zoom_box.pack_start (tav_shrink_button, false, false); track_zoom_box.pack_start (tav_expand_button, false, false); - + HBox* zbc = manage (new HBox); zbc->pack_start (zoom_focus_selector, PACK_SHRINK); zoom_vbox.pack_start (*zbc, PACK_SHRINK); @@ -2966,13 +2966,13 @@ Editor::setup_toolbar () tools_tearoff->set_can_be_torn_off (false); } - tools_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox), + tools_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox), &tools_tearoff->tearoff_window())); - tools_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox), + tools_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox), &tools_tearoff->tearoff_window(), 0)); - tools_tearoff->Hidden.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox), + tools_tearoff->Hidden.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox), &tools_tearoff->tearoff_window())); - tools_tearoff->Visible.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox), + tools_tearoff->Visible.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox), &tools_tearoff->tearoff_window(), 0)); toolbar_hbox.set_spacing (10); @@ -2980,13 +2980,13 @@ Editor::setup_toolbar () toolbar_hbox.pack_start (*mouse_mode_tearoff, false, false); toolbar_hbox.pack_start (*tools_tearoff, false, false); - + hbox->pack_start (snap_box, false, false); hbox->pack_start (*nudge_box, false, false); hbox->pack_start (panic_box, false, false); hbox->show_all (); - + toolbar_base.set_name ("ToolBarBase"); toolbar_base.add (toolbar_hbox); @@ -3015,9 +3015,9 @@ Editor::setup_midi_toolbar () midi_sound_notes.set_relief(Gtk::RELIEF_NONE); ARDOUR_UI::instance()->tooltips().set_tip (midi_sound_notes, _("Sound Notes")); midi_sound_notes.unset_flags (CAN_FOCUS); - + /* Panic */ - + act = ActionManager::get_action (X_("MIDI"), X_("panic")); midi_panic_button.set_name("MidiPanicButton"); act->connect_proxy (midi_panic_button); @@ -3028,14 +3028,14 @@ Editor::setup_midi_toolbar () int Editor::convert_drop_to_paths ( - vector<ustring>& paths, + vector<ustring>& paths, const RefPtr<Gdk::DragContext>& /*context*/, gint /*x*/, gint /*y*/, const SelectionData& data, guint /*info*/, guint /*time*/) -{ +{ if (session == 0) { return -1; } @@ -3051,8 +3051,8 @@ Editor::convert_drop_to_paths ( if (data.get_target() != "text/plain") { return -1; } - - /* Parse the "uri-list" format that Nautilus provides, + + /* Parse the "uri-list" format that Nautilus provides, where each pathname is delimited by \r\n. THERE MAY BE NO NULL TERMINATING CHAR!!! @@ -3072,18 +3072,18 @@ Editor::convert_drop_to_paths ( { while (g_ascii_isspace (*p)) p++; - + q = p; while (*q && (*q != '\n') && (*q != '\r')) { q++; } - + if (q > p) { q--; while (q > p && g_ascii_isspace (*q)) q--; - + if (q > p) { uris.push_back (ustring (p, q - p + 1)); @@ -3096,21 +3096,21 @@ Editor::convert_drop_to_paths ( } free ((void*)p); - + if (uris.empty()) { return -1; } } - + for (vector<ustring>::iterator i = uris.begin(); i != uris.end(); ++i) { if ((*i).substr (0,7) == "file://") { - + ustring p = *i; PBD::url_decode (p); // scan forward past three slashes - + ustring::size_type slashcnt = 0; ustring::size_type n = 0; ustring::iterator x = p.begin(); @@ -3227,7 +3227,7 @@ Editor::set_route_group_mute (Route& route, bool yn) route.set_mute (yn, this); } } - + void Editor::history_changed () { @@ -3265,7 +3265,7 @@ Editor::duplicate_dialog (bool with_dialog) RegionSelection rs; get_regions_for_action (rs); - + if (mouse_mode != MouseRange) { if (rs.empty()) { @@ -3280,16 +3280,16 @@ Editor::duplicate_dialog (bool with_dialog) Adjustment adjustment (1.0, 1.0, 1000000.0, 1.0, 5.0); SpinButton spinner (adjustment, 0.0, 1); HBox hbox; - + win.get_vbox()->set_spacing (12); win.get_vbox()->pack_start (hbox); hbox.set_border_width (6); hbox.pack_start (label, PACK_EXPAND_PADDING, 12); - + /* dialogs have ::add_action_widget() but that puts the spinner in the wrong place, visually. so do this by hand. */ - + hbox.pack_start (spinner, PACK_EXPAND_PADDING, 12); spinner.signal_activate().connect (sigc::bind (mem_fun (win, &ArdourDialog::response), RESPONSE_ACCEPT)); spinner.grab_focus(); @@ -3297,22 +3297,22 @@ Editor::duplicate_dialog (bool with_dialog) hbox.show (); label.show (); spinner.show (); - + win.add_button (Stock::CANCEL, RESPONSE_CANCEL); win.add_button (_("Duplicate"), RESPONSE_ACCEPT); win.set_default_response (RESPONSE_ACCEPT); - + win.set_position (WIN_POS_MOUSE); - + spinner.grab_focus (); - + switch (win.run ()) { case RESPONSE_ACCEPT: break; default: return; } - + times = adjustment.get_value(); } @@ -3445,7 +3445,7 @@ Editor::edit_mode_selection_done () } Config->set_edit_mode (mode); -} +} void Editor::snap_type_selection_done () @@ -3495,7 +3495,7 @@ Editor::snap_type_selection_done () if (ract) { ract->set_active (); } -} +} void Editor::snap_mode_selection_done () @@ -3581,14 +3581,14 @@ Editor::zoom_focus_selection_done () focus_type = ZoomFocusEdit; } else { focus_type = ZoomFocusMouse; - } - + } + RefPtr<RadioAction> ract = zoom_focus_action (focus_type); if (ract) { ract->set_active (); } -} +} gint Editor::edit_controls_button_release (GdkEventButton* ev) @@ -3627,16 +3627,16 @@ Editor::get_valid_views (TimeAxisView* track, RouteGroup* group) } } else if ((track != 0 && group == 0) || (track != 0 && group != 0 && !group->active_property (RouteGroup::Select))) { - + /* just the view for this track */ v->push_back (track); } else { - + /* views for all tracks in the route group */ - + for (i = track_views.begin(); i != track_views.end (); ++i) { if (group == 0 || ((*i)->route_group() == group && group->active_property (RouteGroup::Select))) { @@ -3644,7 +3644,7 @@ Editor::get_valid_views (TimeAxisView* track, RouteGroup* group) } } } - + return v; } @@ -3656,7 +3656,7 @@ Editor::set_zoom_focus (ZoomFocus f) if (str != zoom_focus_selector.get_active_text()) { zoom_focus_selector.set_active_text (str); } - + if (zoom_focus != f) { zoom_focus = f; @@ -3672,7 +3672,7 @@ Editor::ensure_float (Window& win) win.set_transient_for (*this); } -void +void Editor::pane_allocation_handler (Allocation &alloc, Paned* which) { /* recover or initialize pane positions. do this here rather than earlier because @@ -3732,7 +3732,7 @@ Editor::detach_tearoff (Box* /*b*/, Window* /*w*/) { cerr << "remove tearoff\n"; - if (tools_tearoff->torn_off() && + if (tools_tearoff->torn_off() && mouse_mode_tearoff->torn_off()) { top_hbox.remove (toolbar_frame); } @@ -3812,16 +3812,16 @@ Editor::edit_xfade (boost::weak_ptr<Crossfade> wxfade) } CrossfadeEditor cew (*session, xfade, xfade->fade_in().get_min_y(), 1.0); - + ensure_float (cew); - + switch (cew.run ()) { case RESPONSE_ACCEPT: break; default: return; } - + cew.apply (); xfade->StateChanged (Change (~0)); } @@ -3843,7 +3843,7 @@ Editor::get_grid_type_as_beats (bool& success, nframes64_t position) break; case SnapToAThirtysecondBeat: - return 1.0/32.0; + return 1.0/32.0; break; case SnapToASixteenthBeat: @@ -3861,7 +3861,7 @@ Editor::get_grid_type_as_beats (bool& success, nframes64_t position) case SnapToAThirdBeat: return 1.0/3.0; break; - + case SnapToBar: if (session) { return session->tempo_map().meter_at (position).beats_per_bar(); @@ -3914,7 +3914,7 @@ Editor::playlist_deletion_dialog (boost::shared_ptr<Playlist> pl) "If left alone, no audio files used by it will be cleaned.\n" "If deleted, audio files used by it alone by will cleaned."), pl->name())); - + dialog.set_position (WIN_POS_CENTER); dialog.get_vbox()->pack_start (label); @@ -4004,7 +4004,7 @@ Editor::control_layout_scroll (GdkEventScroll* ev) case GDK_SCROLL_DOWN: scroll_tracks_down_line (); return true; - + default: /* no left/right handling yet */ break; @@ -4017,7 +4017,7 @@ void Editor::session_state_saved (string snap_name) { ENSURE_GUI_THREAD (bind (mem_fun(*this, &Editor::session_state_saved), snap_name)); - + _snapshots->redisplay (); } @@ -4037,7 +4037,7 @@ Editor::maximise_editing_space () fullscreen(); if(post_maximal_editor_width) { - edit_pane.set_position (post_maximal_pane_position - + edit_pane.set_position (post_maximal_pane_position - abs(post_maximal_editor_width - pre_maximal_editor_width)); } else { edit_pane.set_position (post_maximal_pane_position); @@ -4068,7 +4068,7 @@ Editor::restore_editing_space () * @param v Track. */ -void +void Editor::new_playlists (TimeAxisView* v) { begin_reversible_command (_("new playlists")); @@ -4099,7 +4099,7 @@ Editor::copy_playlists (TimeAxisView* v) * @param v Track. */ -void +void Editor::clear_playlists (TimeAxisView* v) { begin_reversible_command (_("clear playlists")); @@ -4109,7 +4109,7 @@ Editor::clear_playlists (TimeAxisView* v) commit_reversible_command (); } -void +void Editor::mapped_use_new_playlist (RouteTimeAxisView& atv, uint32_t sz, vector<boost::shared_ptr<ARDOUR::Playlist> > const & playlists) { atv.use_new_playlist (sz > 1 ? false : true, playlists); @@ -4121,7 +4121,7 @@ Editor::mapped_use_copy_playlist (RouteTimeAxisView& atv, uint32_t sz, vector<bo atv.use_copy_playlist (sz > 1 ? false : true, playlists); } -void +void Editor::mapped_clear_playlist (RouteTimeAxisView& atv, uint32_t /*sz*/) { atv.clear_playlist (); @@ -4186,7 +4186,7 @@ Editor::current_visual_state (bool with_tracks) vs->track_states.push_back (TAVState ((*i), &(*i)->get_state())); } } - + return vs; } @@ -4238,7 +4238,7 @@ Editor::use_visual_state (VisualState& vs) set_zoom_focus (vs.zoom_focus); reposition_and_zoom (vs.leftmost_frame, vs.frames_per_unit); zoomed_to_region = vs.zoomed_to_region; - + for (list<TAVState>::iterator i = vs.track_states.begin(); i != vs.track_states.end(); ++i) { TrackViewList::iterator t; @@ -4252,7 +4252,7 @@ Editor::use_visual_state (VisualState& vs) if (!vs.track_states.empty()) { _routes->update_visibility (); - } + } _routes->resume_redisplay (); @@ -4274,7 +4274,7 @@ Editor::set_frames_per_unit (double fpu) fpu = 2.0; } - + /* don't allow zooms that fit more than the maximum number of frames into an 800 pixel wide space. */ @@ -4282,7 +4282,7 @@ Editor::set_frames_per_unit (double fpu) if (max_frames / fpu < 800.0) { return; } - + if (tempo_lines) tempo_lines->tempo_map_changed(); @@ -4342,17 +4342,17 @@ void Editor::queue_visual_change (nframes64_t where) { pending_visual_change.add (VisualChange::TimeOrigin); - + /* if we're moving beyond the end, make sure the upper limit of the horizontal adjustment can reach. */ - + if (where > session->current_end_frame()) { horizontal_adjustment.set_upper ((where + current_page_frames()) / frames_per_unit); } - + pending_visual_change.time_origin = where; - + ensure_visual_change_idle_handler (); } @@ -4363,7 +4363,7 @@ Editor::queue_visual_change (double fpu) pending_visual_change.frames_per_unit = fpu; ensure_visual_change_idle_handler (); - + } void @@ -4413,15 +4413,15 @@ Editor::idle_visual_changer () if (p & VisualChange::YOrigin) { vertical_adjustment.set_value (pending_visual_change.y_origin); } - + nframes64_t csf=0, cef=0; nframes64_t current_time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit); - + if (session) { csf = session->current_start_frame(); cef = session->current_end_frame(); } - + /* if we seek beyond the current end of the canvas, move the end */ #ifdef FIX_THIS_FOR_V3 @@ -4431,7 +4431,7 @@ Editor::idle_visual_changer () redisplay_tempo (true); } #endif - + if (current_time_origin != pending_visual_change.time_origin) { cef += current_page_frames() / 10; // Add a little extra so we can see the end marker horizontal_adjustment.set_upper (cef / frames_per_unit); @@ -4442,7 +4442,7 @@ Editor::idle_visual_changer () } _summary->set_overlays_dirty (); - + //cerr << "Editor::idle_visual_changer () called ha v:l:u:ps:fpu = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << frames_per_unit << endl;//DEBUG pending_visual_change.idle_handler_id = -1; return 0; /* this is always a one-shot call */ @@ -4453,7 +4453,7 @@ struct EditorOrderTimeAxisSorter { return a->order () < b->order (); } }; - + void Editor::sort_track_selection (TrackSelection* sel) { @@ -4485,7 +4485,7 @@ Editor::get_preferred_edit_position (bool ignore_playhead) case EditAtPlayhead: where = session->audible_frame(); break; - + case EditAtSelectedMarker: if (!selection->markers.empty()) { bool is_start; @@ -4498,9 +4498,9 @@ Editor::get_preferred_edit_position (bool ignore_playhead) } break; } - } + } /* fallthru */ - + default: case EditAtMouse: if (!mouse_frame (where, ignored)) { @@ -4520,7 +4520,7 @@ Editor::set_loop_range (nframes64_t start, nframes64_t end, string cmd) if (!session) return; begin_reversible_command (cmd); - + Location* tll; if ((tll = transport_loop_location()) == 0) { @@ -4537,7 +4537,7 @@ Editor::set_loop_range (nframes64_t start, nframes64_t end, string cmd) XMLNode &after = tll->get_state(); session->add_command (new MementoCommand<Location>(*tll, &before, &after)); } - + commit_reversible_command (); } @@ -4547,7 +4547,7 @@ Editor::set_punch_range (nframes64_t start, nframes64_t end, string cmd) if (!session) return; begin_reversible_command (cmd); - + Location* tpl; if ((tpl = transport_punch_location()) == 0) { @@ -4565,7 +4565,7 @@ Editor::set_punch_range (nframes64_t start, nframes64_t end, string cmd) XMLNode &after = tpl->get_state(); session->add_command (new MementoCommand<Location>(*tpl, &before, &after)); } - + commit_reversible_command (); } @@ -4590,7 +4590,7 @@ Editor::get_regions_at (RegionSelection& rs, nframes64_t where, const TrackSelec if (rtv) { boost::shared_ptr<Diskstream> ds; boost::shared_ptr<Playlist> pl; - + if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) { Playlist::RegionList* regions = pl->regions_at ( @@ -4625,7 +4625,7 @@ Editor::get_regions_after (RegionSelection& rs, nframes64_t where, const TrackSe if (rtv) { boost::shared_ptr<Diskstream> ds; boost::shared_ptr<Playlist> pl; - + if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) { Playlist::RegionList* regions = pl->regions_touched ( @@ -4666,14 +4666,14 @@ Editor::get_regions_for_action (RegionSelection& rs, bool allow_entered, bool al } if (allow_edit_position) { - + TrackSelection tracks = selection->tracks; - + /* tracks is currently the set of selected tracks; add any other tracks that * have regions that are in the same edit-activated route group as one of * our regions */ for (RegionSelection::iterator i = rs.begin (); i != rs.end(); ++i) { - + RouteGroup* g = (*i)->get_time_axis_view().route_group (); if (g && g->active_property (RouteGroup::Edit)) { tracks.add (axis_views_from_routes (g->route_list())); @@ -4690,34 +4690,34 @@ void Editor::get_regions_corresponding_to (boost::shared_ptr<Region> region, vector<RegionView*>& regions) { for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - + RouteTimeAxisView* tatv; - + if ((tatv = dynamic_cast<RouteTimeAxisView*> (*i)) != 0) { - + boost::shared_ptr<Playlist> pl; vector<boost::shared_ptr<Region> > results; RegionView* marv; boost::shared_ptr<Diskstream> ds; - + if ((ds = tatv->get_diskstream()) == 0) { /* bus */ continue; } - + if ((pl = (ds->playlist())) != 0) { pl->get_region_list_equivalent_regions (region, results); } - + for (vector<boost::shared_ptr<Region> >::iterator ir = results.begin(); ir != results.end(); ++ir) { if ((marv = tatv->view()->find_view (*ir)) != 0) { regions.push_back (marv); } } - + } } -} +} void Editor::show_rhythm_ferret () @@ -4756,8 +4756,8 @@ Editor::first_idle () { MessageDialog* dialog = 0; - if (track_views.size() > 1) { - dialog = new MessageDialog (*this, + if (track_views.size() > 1) { + dialog = new MessageDialog (*this, _("Please wait while Ardour loads visual data"), true, Gtk::MESSAGE_INFO, @@ -4772,7 +4772,7 @@ Editor::first_idle () // first idle adds route children (automation tracks), so we need to redisplay here _routes->redisplay (); - + delete dialog; _have_idled = true; @@ -4826,18 +4826,18 @@ Editor::idle_resize () if (dynamic_cast<AutomationTimeAxisView*> (_pending_resize_view) == 0 && selection->tracks.contains (_pending_resize_view)) { - + for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { if (*i != _pending_resize_view) { (*i)->idle_resize ((*i)->current_height() + _pending_resize_amount); } } } - + flush_canvas (); _group_tabs->set_dirty (); resize_idle_id = -1; - + return false; } @@ -4881,7 +4881,7 @@ TrackSelection Editor::axis_views_from_routes (list<Route*> r) const { TrackSelection t; - + for (list<Route*>::const_iterator i = r.begin(); i != r.end(); ++i) { TimeAxisView* tv = axis_view_from_route (*i); if (tv) { @@ -4897,7 +4897,7 @@ void Editor::handle_new_route (RouteList& routes) { ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::handle_new_route), routes)); - + RouteTimeAxisView *rtv; list<RouteTimeAxisView*> new_views; @@ -4920,12 +4920,12 @@ Editor::handle_new_route (RouteList& routes) new_views.push_back (rtv); track_views.push_back (rtv); - + rtv->effective_gain_display (); - + rtv->view()->RegionViewAdded.connect (mem_fun (*this, &Editor::region_view_added)); rtv->view()->HeightChanged.connect (mem_fun (*this, &Editor::streamview_height_changed)); - + rtv->GoingAway.connect (bind (mem_fun(*this, &Editor::remove_route), rtv)); } @@ -4965,7 +4965,7 @@ Editor::remove_route (TimeAxisView *tv) next_tv = (*i); } } - + if (current_mixer_strip && current_mixer_strip->route() == route) { if (next_tv) { @@ -4977,7 +4977,7 @@ Editor::remove_route (TimeAxisView *tv) ActionManager::uncheck_toggleaction ("<Actions>/Editor/show-editor-mixer"); } - } + } } void @@ -4997,10 +4997,10 @@ bool Editor::sync_track_view_list_and_routes () { track_views = TrackSelection (_routes->views ()); - + _summary->set_dirty (); _group_tabs->set_dirty (); - + return false; // do not call again (until needed) } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 76830f4474..bd092d2640 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2003 Paul Davis + Copyright (C) 2000-2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -138,10 +138,10 @@ struct EditorCursor { ArdourCanvas::Line canvas_item; nframes64_t current_frame; double length; - + EditorCursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*)); ~EditorCursor (); - + void set_position (nframes64_t); void set_length (double units); void set_y_axis (double position); @@ -154,7 +154,7 @@ class Editor : public PublicEditor public: Editor (); ~Editor (); - + void connect_to_session (ARDOUR::Session *); ARDOUR::Session* current_session() const { return session; } void first_idle (); @@ -165,7 +165,7 @@ class Editor : public PublicEditor nframes64_t current_page_frames() const { return (nframes64_t) floor (_canvas_width * frames_per_unit); } - + double canvas_height () const { return _canvas_height; } @@ -215,7 +215,7 @@ class Editor : public PublicEditor void set_show_waveforms_recording (bool yn); bool show_waveforms_recording() const { return _show_waveforms_recording; } - + /* things that need to be public to be used in the main menubar */ void new_region_from_selection (); @@ -232,7 +232,7 @@ class Editor : public PublicEditor nframes64_t unit_to_frame (double unit) const { return (nframes64_t) rint (unit * frames_per_unit); } - + double frame_to_unit (nframes64_t frame) const { return rint ((double) frame / (double) frames_per_unit); } @@ -245,11 +245,11 @@ class Editor : public PublicEditor the result of using the world->canvas affine transform on a world coordinate. These coordinates already take into account any scrolling carried out by adjusting the - xscroll_adjustment. + xscroll_adjustment. */ nframes64_t pixel_to_frame (double pixel) const { - + /* pixel can be less than zero when motion events are processed. since we've already run the world->canvas affine, that means that the location *really* is "off @@ -282,7 +282,7 @@ class Editor : public PublicEditor void invert_selection_in_track (); void invert_selection (); void deselect_all (); - + void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set); /* tempo */ @@ -296,7 +296,7 @@ class Editor : public PublicEditor void analyze_range_selection(); /* export */ - + void export_audio (); void export_selection (); void export_range (); @@ -346,7 +346,7 @@ class Editor : public PublicEditor void nudge_backward_capture_offset (); /* playhead/screen stuff */ - + void set_follow_playhead (bool yn); void toggle_follow_playhead (); bool follow_playhead() const { return _follow_playhead; } @@ -422,7 +422,7 @@ class Editor : public PublicEditor void show_verbose_canvas_cursor_with (const std::string& txt); void hide_verbose_canvas_cursor(); - + protected: void map_transport_state (); void map_position_change (nframes64_t); @@ -432,13 +432,13 @@ class Editor : public PublicEditor private: void color_handler (); - + ARDOUR::Session *session; ///< The session that we are editing, or 0 bool constructed; // to keep track of the playhead position for control_scroll boost::optional<nframes64_t> _control_scroll_target; - + PlaylistSelector* _playlist_selector; typedef std::pair<TimeAxisView*,XMLNode*> TAVState; @@ -451,7 +451,7 @@ class Editor : public PublicEditor bool zoomed_to_region; std::list<TAVState> track_states; }; - + std::list<VisualState*> undo_visual_stack; std::list<VisualState*> redo_visual_stack; VisualState* current_visual_state (bool with_tracks = true); @@ -460,7 +460,7 @@ class Editor : public PublicEditor void use_visual_state (VisualState&); bool no_save_visual; void swap_visual_state (); - + std::vector<VisualState*> visual_states; sigc::connection visual_state_op_connection; void start_visual_state_op (uint32_t n); @@ -476,7 +476,7 @@ class Editor : public PublicEditor Editing::MouseMode mouse_mode; bool _internal_editing; - + int post_maximal_editor_width; int post_maximal_pane_position; int pre_maximal_pane_position; @@ -515,7 +515,7 @@ class Editor : public PublicEditor bool valid; LocationMarkers () : start(0), end(0), valid (true) {} - + ~LocationMarkers (); void hide(); @@ -575,7 +575,7 @@ class Editor : public PublicEditor void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false); void select_all_tracks (); - + bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false); void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false); void set_selected_track_as_side_effect (bool force = false); @@ -584,7 +584,7 @@ class Editor : public PublicEditor bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>); void collect_new_region_view (RegionView *); void collect_and_select_new_region_view (RegionView *); - + Gtk::Menu track_context_menu; Gtk::Menu track_region_context_menu; Gtk::Menu track_selection_context_menu; @@ -626,7 +626,7 @@ class Editor : public PublicEditor bool verbose_cursor_visible; void parameter_changed (std::string); - + bool track_canvas_motion (GdkEvent*); void set_verbose_canvas_cursor (const std::string &, double x, double y); @@ -664,20 +664,20 @@ class Editor : public PublicEditor /** The group containing all items that require horizontal scrolling. */ ArdourCanvas::Group* _background_group; - /* + /* The _master_group is the group containing all items that require horizontal scrolling.. - It is primarily used to separate canvas items - that require horizontal scrolling from those that do not. + It is primarily used to separate canvas items + that require horizontal scrolling from those that do not. */ ArdourCanvas::Group* _master_group; /* The group containing all trackviews. Only scrolled vertically. */ ArdourCanvas::Group* _trackview_group; - + /* The group used for region motion. Sits on top of _trackview_group */ ArdourCanvas::Group* _region_motion_group; - + enum RulerType { ruler_metric_smpte = 0, ruler_metric_bbt = 1, @@ -704,19 +704,19 @@ class Editor : public PublicEditor Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action; Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action; bool no_ruler_shown_update; - + gint ruler_button_press (GdkEventButton*); gint ruler_button_release (GdkEventButton*); gint ruler_mouse_motion (GdkEventMotion*); bool ruler_scroll (GdkEventScroll* event); Gtk::Widget * ruler_grabbed_widget; - + void initialize_rulers (); void update_just_smpte (); void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers void update_fixed_rulers (); - void update_tempo_based_rulers (); + void update_tempo_based_rulers (); void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem); void update_ruler_visibility (); void set_ruler_visible (RulerType, bool); @@ -725,12 +725,12 @@ class Editor : public PublicEditor gint ruler_label_button_release (GdkEventButton*); void store_ruler_visibility (); void restore_ruler_visibility (); - + static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint); static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint); static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint); static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint); - + enum MinsecRulerScale { minsec_show_seconds, minsec_show_minutes, @@ -801,14 +801,14 @@ class Editor : public PublicEditor gdouble canvas_timebars_vsize; gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; } Gtk::Menu *editor_ruler_menu; - + ArdourCanvas::SimpleRect* tempo_bar; ArdourCanvas::SimpleRect* meter_bar; ArdourCanvas::SimpleRect* marker_bar; ArdourCanvas::SimpleRect* range_marker_bar; ArdourCanvas::SimpleRect* transport_marker_bar; ArdourCanvas::SimpleRect* cd_marker_bar; - + Gtk::Label minsec_label; Gtk::Label bbt_label; Gtk::Label smpte_label; @@ -824,7 +824,7 @@ class Editor : public PublicEditor Gtk::HBox time_button_hbox; friend class EditorCursor; - + EditorCursor* playhead_cursor; ArdourCanvas::Group* cursor_group; @@ -861,7 +861,7 @@ class Editor : public PublicEditor Gtk::HBox top_hbox; Gtk::HBox bottom_hbox; - + Gtk::Table edit_packer; Gtk::VScrollbar edit_vscrollbar; @@ -877,7 +877,7 @@ class Editor : public PublicEditor bool _dragging_hscrollbar; void reset_hscrollbar_stepping (); - + bool hscrollbar_button_press (GdkEventButton*); bool hscrollbar_button_release (GdkEventButton*); void hscrollbar_allocate (Gtk::Allocation &alloc); @@ -904,7 +904,7 @@ class Editor : public PublicEditor sigc::connection control_scroll_connection; gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;} - + ArdourCanvas::Group* get_background_group () const { return _background_group; } ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; } double last_trackview_group_vertical_offset; @@ -913,19 +913,19 @@ class Editor : public PublicEditor void scroll_canvas_vertically (); struct VisualChange { - enum Type { + enum Type { TimeOrigin = 0x1, ZoomLevel = 0x2, YOrigin = 0x4 }; - + Type pending; nframes64_t time_origin; double frames_per_unit; double y_origin; - + int idle_handler_id; - + VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {} void add (Type t) { pending = Type (pending | t); @@ -948,7 +948,7 @@ class Editor : public PublicEditor /* named selections */ struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord { - NamedSelectionDisplayModelColumns() { + NamedSelectionDisplayModelColumns() { add (text); add (selection); } @@ -1005,9 +1005,9 @@ class Editor : public PublicEditor nframes64_t last_update_frame; void center_screen (nframes64_t); void center_screen_internal (nframes64_t, float); - + void update_current_screen (); - + void session_going_away (); nframes64_t cut_buffer_start; @@ -1021,7 +1021,7 @@ class Editor : public PublicEditor bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false); bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); - + /* KEYMAP HANDLING */ void register_actions (); @@ -1039,7 +1039,7 @@ class Editor : public PublicEditor void paste_internal (nframes64_t position, float times); /* EDITING OPERATIONS */ - + void reset_point_selection (); void toggle_region_mute (); void toggle_region_lock (); @@ -1143,7 +1143,7 @@ class Editor : public PublicEditor void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y); /* import & embed */ - + void add_external_audio_action (Editing::ImportMode); void external_audio_dialog (); void session_import_dialog (); @@ -1152,15 +1152,15 @@ class Editor : public PublicEditor bool check_multichannel_status (const std::vector<Glib::ustring>& paths); SoundFileOmega* sfbrowser; - + void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos); bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos); void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos); - + int import_sndfiles (std::vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>, bool, uint32_t total); - int embed_sndfiles (std::vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode, + int embed_sndfiles (std::vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode, nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&); int add_sources (std::vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode, @@ -1172,7 +1172,7 @@ class Editor : public PublicEditor boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const; /* generic interthread progress window */ - + ArdourDialog* interthread_progress_window; Gtk::Label interthread_progress_label; Gtk::VBox interthread_progress_vbox; @@ -1304,12 +1304,12 @@ class Editor : public PublicEditor void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape); void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape); - + void set_fade_length (bool in); void toggle_fade_active (bool in); void set_fade_in_active (bool); void set_fade_out_active (bool); - + std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists; RegionSelection pre_drag_region_selection; @@ -1352,7 +1352,7 @@ class Editor : public PublicEditor bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); - + // These variables are used to detect a feedback loop and break it to avoid a gui hang private: @@ -1416,15 +1416,15 @@ public: void initialize_canvas (); /* display control */ - + bool _show_measures; /// true if the editor should follow the playhead, otherwise false bool _follow_playhead; /// true if waveforms should be shown while recording audio tracks, otherwise false bool _show_waveforms_recording; - + ARDOUR::TempoMap::BBTPointList *current_bbt_points; - + TempoLines* tempo_lines; ArdourCanvas::Group* time_line_group; @@ -1442,13 +1442,13 @@ public: void remove_meter_marker (ArdourCanvas::Item*); gint real_remove_tempo_marker (ARDOUR::TempoSection*); gint real_remove_meter_marker (ARDOUR::MeterSection*); - + void edit_tempo_section (ARDOUR::TempoSection*); void edit_meter_section (ARDOUR::MeterSection*); void edit_tempo_marker (ArdourCanvas::Item*); void edit_meter_marker (ArdourCanvas::Item*); void edit_control_point (ArdourCanvas::Item*); - + void marker_menu_edit (); void marker_menu_remove (); void marker_menu_rename (); @@ -1496,7 +1496,7 @@ public: void compute_current_bbt_points (nframes_t left, nframes_t right); void tempo_map_changed (ARDOUR::Change); void redisplay_tempo (bool immediate_redraw); - + void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false); void snap_to_with_modifier (nframes64_t& first, GdkEvent const *, int32_t direction = 0, bool for_mark = false); void snap_to (nframes64_t& first, nframes64_t& last, int32_t direction = 0, bool for_mark = false); @@ -1519,12 +1519,12 @@ public: Gtk::Button tav_expand_button; Gtk::Button tav_shrink_button; - + Gtk::VBox toolbar_clock_vbox; - Gtk::VBox toolbar_selection_clock_vbox; + Gtk::VBox toolbar_selection_clock_vbox; Gtk::Table toolbar_selection_clock_table; Gtk::Label toolbar_selection_cursor_label; - + Gtk::HBox mouse_mode_button_box; Gtkmm2ext::TearOff* mouse_mode_tearoff; Gtk::ToggleButton mouse_select_button; @@ -1572,7 +1572,7 @@ public: Gtk::VBox zoom_focus_box; std::vector<std::string> zoom_focus_strings; - + void zoom_focus_selection_done (); void zoom_focus_chosen (Editing::ZoomFocus); @@ -1585,7 +1585,7 @@ public: void zoom_adjustment_changed(); void edit_point_clock_changed(); - + void setup_toolbar (); Gtkmm2ext::TearOff* tools_tearoff; @@ -1600,7 +1600,7 @@ public: Gtk::ToggleButton midi_sound_notes; void midi_panic (); bool sound_notes () const { return midi_sound_notes.get_active(); } - + void setup_midi_toolbar (); /* selection process */ @@ -1647,13 +1647,13 @@ public: ARDOUR::Location* transport_punch_location(); ARDOUR::Location *temp_location; - + /* object rubberband select process */ - + bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op); - + ArdourCanvas::SimpleRect *rubberband_rect; - + /* mouse zoom process */ ArdourCanvas::SimpleRect *zoom_rect; @@ -1663,7 +1663,7 @@ public: EditorRoutes* _routes; EditorRegions* _regions; EditorSnapshots* _snapshots; - + /* diskstream/route display management */ Glib::RefPtr<Gdk::Pixbuf> rec_enabled_icon; Glib::RefPtr<Gdk::Pixbuf> rec_disabled_icon; @@ -1778,7 +1778,7 @@ public: void begin_reversible_command (std::string cmd_name); void commit_reversible_command (); - void update_title (); + void update_title (); void update_title_s (const std::string & snapshot_name); struct State { @@ -1795,7 +1795,7 @@ public: void instant_save (); boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region; - + /* freeze operations */ ARDOUR::InterThreadInfo freeze_status; @@ -1814,7 +1814,7 @@ public: /* duplication */ void duplicate_dialog (bool with_dialog); - + nframes64_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const; /* returns false if mouse pointer is not in track or marker canvas @@ -1855,7 +1855,7 @@ public: /* xfades */ bool _xfade_visibility; - + #ifdef WITH_CMT void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ; void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ; @@ -1883,7 +1883,7 @@ public: void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ; void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ; void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ; - + void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ; void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ; void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ; @@ -1916,7 +1916,7 @@ public: bool nudge_forward_release (GdkEventButton*); bool nudge_backward_release (GdkEventButton*); - + /* audio filters */ void apply_filter (ARDOUR::Filter&, std::string cmd); @@ -1989,7 +1989,7 @@ public: void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const; void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const; - + void get_regions_for_action (RegionSelection&, bool allow_entered = false, bool allow_edit_position = true); sigc::connection fast_screen_update_connection; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 0418942164..dea84f4789 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ Editor::register_actions () RefPtr<Action> act; editor_actions = ActionGroup::create (X_("Editor")); - + /* non-operative menu items for menu bar */ ActionManager::register_action (editor_actions, X_("AlignMenu"), _("Align")); @@ -199,12 +199,12 @@ Editor::register_actions () ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "select-all-in-loop-range", _("Select All in Loop Range"), mem_fun(*this, &Editor::select_all_selectables_using_loop)); ActionManager::session_sensitive_actions.push_back (act); - + act = ActionManager::register_action (editor_actions, "select-next-route", _("Select Next Track/Bus"), mem_fun(*this, &Editor::select_next_route)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "select-prev-route", _("Select Previous Track/Bus"), mem_fun(*this, &Editor::select_prev_route)); ActionManager::session_sensitive_actions.push_back (act); - + act = ActionManager::register_action (editor_actions, "track-record-enable-toggle", _("Toggle Record Enable"), mem_fun(*this, &Editor::toggle_record_enable)); ActionManager::session_sensitive_actions.push_back (act); @@ -404,7 +404,7 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, "add-range-markers-from-region", _("Add Range Marker(s)"), mem_fun(*this, &Editor::add_locations_from_audio_region)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::region_selection_sensitive_actions.push_back (act); - + act = ActionManager::register_action (editor_actions, "set-fade-in-length", _("Set Fade In Length"), bind (mem_fun(*this, &Editor::set_fade_length), true)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "toggle-fade-in-active", _("Toggle Fade In Active"), bind (mem_fun(*this, &Editor::toggle_fade_active), true)); @@ -553,7 +553,7 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, "quantize-region", _("Quantize Region"), mem_fun(*this, &Editor::quantize_region)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::region_selection_sensitive_actions.push_back (act); - + act = ActionManager::register_action (editor_actions, "set-tempo-from-region", _("Set Tempo from Region=Bar"), mem_fun(*this, &Editor::use_region_as_bar)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::region_selection_sensitive_actions.push_back (act); @@ -705,9 +705,9 @@ Editor::register_actions () mouse_timefx_button.set_image (*(manage (new Image (::get_icon("tool_stretch"))))); mouse_timefx_button.set_label (""); mouse_timefx_button.set_name ("MouseModeButton"); - + ActionManager::register_action (editor_actions, "step-mouse-mode", _("Step Mouse Mode"), bind (mem_fun(*this, &Editor::step_mouse_mode), true)); - + act = ActionManager::register_toggle_action (mouse_mode_actions, "toggle-internal-edit", _("Edit MIDI"), mem_fun(*this, &Editor::toggle_internal_editing)); act->connect_proxy (internal_edit_button); internal_edit_button.set_image (*(manage (new Image (::get_icon("tool_note"))))); @@ -762,7 +762,7 @@ Editor::register_actions () ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-boundary"), _("Snap to Region Boundary"), (bind (mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionBoundary))); /* RULERS */ - + Glib::RefPtr<ActionGroup> ruler_actions = ActionGroup::create (X_("Rulers")); ruler_tempo_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-tempo-ruler"), _("Tempo"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_tempo))); ruler_meter_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-meter-ruler"), _("Meter"), bind (mem_fun(*this, &Editor::toggle_ruler_visibility), ruler_time_meter))); @@ -797,7 +797,7 @@ Editor::register_actions () } ruler_samples_action->set_active (false); no_ruler_shown_update = false; - + /* REGION LIST */ Glib::RefPtr<ActionGroup> rl_actions = ActionGroup::create (X_("RegionList")); @@ -820,7 +820,7 @@ Editor::register_actions () bind (mem_fun (*_regions, &EditorRegions::reset_sort_direction), true)); ActionManager::register_radio_action (rl_actions, sort_order_group, X_("SortDescending"), _("Descending"), bind (mem_fun (*_regions, &EditorRegions::reset_sort_direction), false)); - + ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionName"), _("By Region Name"), bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), ByName, false)); ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortByRegionLength"), _("By Region Length"), @@ -841,7 +841,7 @@ Editor::register_actions () bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), BySourceFileCreationDate, false)); ActionManager::register_radio_action (rl_actions, sort_type_group, X_("SortBySourceFilesystem"), _("By Source Filesystem"), bind (mem_fun (*_regions, &EditorRegions::reset_sort_type), BySourceFileFS, false)); - + /* the next two are duplicate items with different names for use in two different contexts */ @@ -861,9 +861,9 @@ Editor::register_actions () ActionManager::register_toggle_action (editor_actions, X_("ToggleSummary"), _("Show Summary"), mem_fun (*this, &Editor::set_summary)); ActionManager::register_toggle_action (editor_actions, X_("ToggleGroupTabs"), _("Show Group Tabs"), mem_fun (*this, &Editor::set_group_tabs)); - + ActionManager::register_toggle_action (editor_actions, X_("ToggleMeasureVisibility"), _("Show Measures"), mem_fun (*this, &Editor::toggle_measure_visibility)); - + /* if there is a logo in the editor canvas, its always visible at startup */ act = ActionManager::register_toggle_action (editor_actions, X_("ToggleLogoVisibility"), _("Show Logo"), mem_fun (*this, &Editor::toggle_logo_visibility)); @@ -997,7 +997,7 @@ Editor::snap_type_action (SnapType type) const char* action = 0; RefPtr<Action> act; - + switch (type) { case Editing::SnapToCDFrame: action = "snap-to-cd-frame"; @@ -1151,7 +1151,7 @@ Editor::snap_mode_action (SnapMode mode) { const char* action = 0; RefPtr<Action> act; - + switch (mode) { case Editing::SnapOff: action = X_("snap-off"); @@ -1166,13 +1166,13 @@ Editor::snap_mode_action (SnapMode mode) fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible snap mode type", (int) mode) << endmsg; /*NOTREACHED*/ } - + act = ActionManager::get_action (X_("Editor"), action); - + if (act) { RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); return ract; - + } else { error << string_compose (_("programming error: %1: %2"), "Editor::snap_mode_chosen could not find action to match mode.", action) << endmsg; return RefPtr<RadioAction> (); @@ -1215,7 +1215,7 @@ Editor::edit_point_action (EditPoint ep) { const char* action = 0; RefPtr<Action> act; - + switch (ep) { case Editing::EditAtPlayhead: action = X_("edit-at-playhead"); @@ -1230,13 +1230,13 @@ Editor::edit_point_action (EditPoint ep) fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible edit point type", (int) ep) << endmsg; /*NOTREACHED*/ } - + act = ActionManager::get_action (X_("Editor"), action); - + if (act) { RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); return ract; - + } else { error << string_compose (_("programming error: %1: %2"), "Editor::edit_point_action could not find action to match edit point.", action) << endmsg; return RefPtr<RadioAction> (); @@ -1264,7 +1264,7 @@ Editor::zoom_focus_action (ZoomFocus focus) { const char* action = 0; RefPtr<Action> act; - + switch (focus) { case ZoomFocusLeft: action = X_("zoom-focus-left"); @@ -1288,9 +1288,9 @@ Editor::zoom_focus_action (ZoomFocus focus) fatal << string_compose (_("programming error: %1: %2"), "Editor: impossible focus type", (int) focus) << endmsg; /*NOTREACHED*/ } - + act = ActionManager::get_action (X_("Zoom"), action); - + if (act) { RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); return ract; @@ -1343,7 +1343,7 @@ Editor::parameter_changed (std::string p) } else if (p == "show-track-meters") { toggle_meter_updating(); } else if (p == "show-summary") { - + bool const s = session->config.get_show_summary (); if (s) { _summary->show (); @@ -1390,7 +1390,7 @@ Editor::reset_canvas_action_sensitivity (bool onoff) onoff = true; } - for (vector<Glib::RefPtr<Action> >::iterator x = ActionManager::mouse_edit_point_requires_canvas_actions.begin(); + for (vector<Glib::RefPtr<Action> >::iterator x = ActionManager::mouse_edit_point_requires_canvas_actions.begin(); x != ActionManager::mouse_edit_point_requires_canvas_actions.end(); ++x) { (*x)->set_sensitive (onoff); } diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index 8459ccba6e..53438b9dcb 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -80,7 +80,7 @@ Editor::add_external_audio_action (ImportMode mode_hint) msg.run (); return; } - + if (sfbrowser == 0) { sfbrowser = new SoundFileOmega (*this, _("Add existing media"), session, 0, true, mode_hint); } else { @@ -101,12 +101,12 @@ Editor::external_audio_dialog () msg.run (); return; } - + track_cnt = 0; for (TrackSelection::iterator x = selection->tracks.begin(); x != selection->tracks.end(); ++x) { AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*>(*x); - + if (!atv) { continue; } else if (atv->is_audio_track()) { @@ -247,7 +247,7 @@ Editor::check_whether_and_how_to_import(string path, bool all_or_nothing) dialog.add_button("Import", 1); dialog.add_button("Cancel", 2); } - + //dialog.add_button("Skip all", 4); // All or rest? dialog.show(); @@ -265,60 +265,60 @@ Editor::get_nth_selected_audio_track (int nth) const { AudioTimeAxisView* atv; TrackSelection::iterator x; - + for (x = selection->tracks.begin(); nth > 0 && x != selection->tracks.end(); ++x) { atv = dynamic_cast<AudioTimeAxisView*>(*x); - + if (!atv) { continue; } else if (atv->is_audio_track()) { --nth; } } - + if (x == selection->tracks.end()) { atv = dynamic_cast<AudioTimeAxisView*>(selection->tracks.back()); } else { atv = dynamic_cast<AudioTimeAxisView*>(*x); } - + if (!atv || !atv->is_audio_track()) { return boost::shared_ptr<AudioTrack>(); } - + return atv->audio_track(); -} +} boost::shared_ptr<MidiTrack> Editor::get_nth_selected_midi_track (int nth) const { MidiTimeAxisView* mtv; TrackSelection::iterator x; - + for (x = selection->tracks.begin(); nth > 0 && x != selection->tracks.end(); ++x) { mtv = dynamic_cast<MidiTimeAxisView*>(*x); - + if (!mtv) { continue; } else if (mtv->is_midi_track()) { --nth; } } - + if (x == selection->tracks.end()) { mtv = dynamic_cast<MidiTimeAxisView*>(selection->tracks.back()); } else { mtv = dynamic_cast<MidiTimeAxisView*>(*x); } - + if (!mtv || !mtv->is_midi_track()) { return boost::shared_ptr<MidiTrack>(); } - + return mtv->midi_track(); -} +} void Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mode, SrcQuality quality, nframes64_t& pos) @@ -360,23 +360,23 @@ Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mod to_import.push_back (*a); } } - + bool ok = true; switch (chns) { case Editing::ImportDistinctFiles: - + if (mode == Editing::ImportToTrack) { track = get_nth_selected_audio_track (nth++); } - + ok = (import_sndfiles (to_import, mode, quality, pos, 1, -1, track, false, to_import.size()) == 0); break; - + case Editing::ImportDistinctChannels: ok = (import_sndfiles (to_import, mode, quality, pos, -1, -1, track, false, to_import.size()) == 0); break; - + case Editing::ImportSerializeFiles: ok = (import_sndfiles (to_import, mode, quality, pos, 1, 1, track, false, to_import.size()) == 0); break; @@ -416,7 +416,7 @@ Editor::do_embed (vector<ustring> paths, ImportDisposition chns, ImportMode mode } } break; - + case Editing::ImportDistinctChannels: for (vector<ustring>::iterator a = paths.begin(); a != paths.end(); ++a) { @@ -449,15 +449,15 @@ Editor::do_embed (vector<ustring> paths, ImportDisposition chns, ImportMode mode } ok = true; - - out: + + out: if (ok) { session->save_state (""); } } int -Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality quality, nframes64_t& pos, +Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality quality, nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<Track> track, bool replace, uint32_t total) { WindowTitle title = string_compose (_("importing %1"), paths.front()); @@ -483,9 +483,9 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality qual import_status.target_regions = target_regions; import_status.track = track; import_status.replace = replace; - interthread_progress_connection = Glib::signal_timeout().connect + interthread_progress_connection = Glib::signal_timeout().connect (bind (mem_fun(*this, &Editor::import_progress_timeout), (gpointer) 0), 500); - + track_canvas->get_window()->set_cursor (Gdk::Cursor (Gdk::WATCH)); gdk_flush (); @@ -496,7 +496,7 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality qual pthread_create_and_store ("import", &import_status.thread, 0, _import_thread, this); pthread_detach (import_status.thread); - + while (!import_status.done && !import_status.cancel) { gtk_main_iteration (); } @@ -504,20 +504,20 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality qual interthread_progress_window->hide (); import_status.done = true; interthread_progress_connection.disconnect (); - + if (!import_status.cancel && !import_status.sources.empty()) { - if (add_sources (import_status.paths, - import_status.sources, - import_status.pos, - import_status.mode, - import_status.target_regions, - import_status.target_tracks, + if (add_sources (import_status.paths, + import_status.sources, + import_status.pos, + import_status.mode, + import_status.target_regions, + import_status.target_tracks, import_status.track, false) == 0) { session->save_state (""); } - + /* update position from results */ - + pos = import_status.pos; } @@ -546,12 +546,12 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile, ustring path = *p; /* lets see if we can link it into the session */ - + sys::path tmp = session->session_directory().sound_path() / Glib::path_get_basename(path); linked_path = tmp.to_string(); path_to_use = linked_path; - + if (link (path.c_str(), linked_path.c_str()) == 0) { /* there are many reasons why link(2) might have failed. @@ -559,7 +559,7 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile, session sound dir that will protect against unlinking of the original path. nice. */ - + path = linked_path; path_to_use = Glib::path_get_basename (path); @@ -578,31 +578,31 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile, } } } - + /* note that we temporarily truncated _id at the colon */ - + string error_msg; if (!AudioFileSource::get_soundfile_info (path, finfo, error_msg)) { error << string_compose(_("Editor: cannot open file \"%1\", (%2)"), path, error_msg ) << endmsg; goto out; } - + if (check_sample_rate && (finfo.samplerate != (int) session->frame_rate())) { vector<string> choices; - + if (multifile) { choices.push_back (_("Cancel entire import")); choices.push_back (_("Don't embed it")); choices.push_back (_("Embed all without questions")); - + Gtkmm2ext::Choice rate_choice ( - string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"), + string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"), short_path (path, 40)), choices, false); - + int resx = rate_choice.run (); - + switch (resx) { case 0: /* stop a multi-file import */ ret = -2; @@ -622,13 +622,13 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile, } else { choices.push_back (_("Cancel")); choices.push_back (_("Embed it anyway")); - + Gtkmm2ext::Choice rate_choice ( string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"), path), choices, false); - + int resx = rate_choice.run (); - + switch (resx) { case 0: /* don't import */ ret = -1; @@ -641,7 +641,7 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile, } } } - + track_canvas->get_window()->set_cursor (Gdk::Cursor (Gdk::WATCH)); for (int n = 0; n < finfo.channels; ++n) { @@ -665,13 +665,13 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile, } sources.push_back(source); - } - + } + catch (failed_constructor& err) { error << string_compose(_("could not open %1"), path) << endmsg; goto out; } - + ARDOUR_UI::instance()->flush_pending (); } } @@ -688,7 +688,7 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile, } int -Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64_t& pos, ImportMode mode, +Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64_t& pos, ImportMode mode, int target_regions, int target_tracks, boost::shared_ptr<Track>& track, bool /*add_channel_suffix*/) { vector<boost::shared_ptr<Region> > regions; @@ -696,7 +696,7 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64 uint32_t input_chan = 0; uint32_t output_chan = 0; bool use_timestamp; - + use_timestamp = (pos == -1); if (use_timestamp) { @@ -716,17 +716,17 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64 /* take all the sources we have and package them up as a region */ region_name = region_name_from_path (paths.front(), (sources.size() > 1), false); - + boost::shared_ptr<Region> r = RegionFactory::create (sources, 0, sources[0]->length(pos), region_name, 0, Region::Flag (Region::DefaultFlags|Region::WholeFile|Region::External)); if (use_timestamp && boost::dynamic_pointer_cast<AudioRegion>(r)) { boost::dynamic_pointer_cast<AudioRegion>(r)->special_set_position(sources[0]->natural_position()); } - + regions.push_back (r); - + } else if (target_regions == -1 || target_regions > 1) { /* take each source and create a region for each one */ @@ -739,16 +739,16 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64 just_one.clear (); just_one.push_back (*x); - + region_name = region_name_from_path ((*x)->path(), false, false, sources.size(), n); boost::shared_ptr<Region> r = RegionFactory::create (just_one, 0, (*x)->length(pos), region_name, 0, Region::Flag (Region::DefaultFlags|Region::WholeFile|Region::External)); - + if (use_timestamp && boost::dynamic_pointer_cast<AudioRegion>(r)) { boost::dynamic_pointer_cast<AudioRegion>(r)->special_set_position((*x)->natural_position()); } - + regions.push_back (r); } } @@ -779,7 +779,7 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64 track.reset (); } else { pos += (*r)->length(); - } + } } /* setup peak file building in another thread */ @@ -790,9 +790,9 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64 return 0; } - + int -Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t in_chans, uint32_t out_chans, nframes64_t& pos, +Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t in_chans, uint32_t out_chans, nframes64_t& pos, ImportMode mode, boost::shared_ptr<Track>& existing_track) { boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion>(region); @@ -802,7 +802,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t case ImportAsRegion: /* relax, its been done */ break; - + case ImportToTrack: { if (!existing_track) { @@ -829,7 +829,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t } case ImportAsTrack: - { + { if (!existing_track) { if (ar) { list<boost::shared_ptr<AudioTrack> > at (session->new_audio_track (in_chans, out_chans, Normal, 0, 1)); @@ -923,9 +923,9 @@ Editor::import_progress_timeout (void */*arg*/) if (reset) { /* the window is now visible, speed up the updates */ - + interthread_progress_connection.disconnect (); - interthread_progress_connection = Glib::signal_timeout().connect + interthread_progress_connection = Glib::signal_timeout().connect (bind (mem_fun(*this, &Editor::import_progress_timeout), (gpointer) 0), 100); return false; } else { diff --git a/gtk2_ardour/editor_audiotrack.cc b/gtk2_ardour/editor_audiotrack.cc index 997bf41a3f..084a7f9984 100644 --- a/gtk2_ardour/editor_audiotrack.cc +++ b/gtk2_ardour/editor_audiotrack.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -73,7 +73,7 @@ gint Editor::stop_updating () { RouteTimeAxisView* rtv; - + meters_running = false; fast_screen_update_connection.disconnect(); //cerr << "Editor::stop_updating () called" << endl;//DEBUG diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index b99189218a..cd3ee76116 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2005 Paul Davis + Copyright (C) 2005 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,22 +69,22 @@ GType gnome_canvas_imageframe_get_type(void); } -static void ardour_canvas_type_init() +static void ardour_canvas_type_init() { // Map gtypes to gtkmm wrapper-creation functions: - + Glib::wrap_register(gnome_canvas_simpleline_get_type(), &Gnome::Canvas::SimpleLine_Class::wrap_new); Glib::wrap_register(gnome_canvas_simplerect_get_type(), &Gnome::Canvas::SimpleRect_Class::wrap_new); Glib::wrap_register(gnome_canvas_waveview_get_type(), &Gnome::Canvas::WaveView_Class::wrap_new); // Glib::wrap_register(gnome_canvas_imageframe_get_type(), &Gnome::Canvas::ImageFrame_Class::wrap_new); - + // Register the gtkmm gtypes: (void) Gnome::Canvas::WaveView::get_type(); (void) Gnome::Canvas::SimpleLine::get_type(); (void) Gnome::Canvas::SimpleRect::get_type(); (void) Gnome::Canvas::ImageFrame::get_type(); -} +} void Editor::initialize_canvas () @@ -94,7 +94,7 @@ Editor::initialize_canvas () } else { track_canvas = new ArdourCanvas::CanvasAA (); } - + ArdourCanvas::init (); ardour_canvas_type_init (); @@ -120,11 +120,11 @@ Editor::initialize_canvas () verbose_canvas_cursor->property_anchor() = ANCHOR_NW; delete font; - + verbose_cursor_visible = false; /* on the bottom, an image */ - + if (Profile->get_sae()) { Image img (::get_icon (X_("saelogo"))); logo_item = new ArdourCanvas::Pixbuf (*track_canvas->root(), 0.0, 0.0, img.get_pixbuf()); @@ -135,7 +135,7 @@ Editor::initialize_canvas () logo_item->show (); } - /* a group to hold time (measure) lines */ + /* a group to hold time (measure) lines */ time_line_group = new ArdourCanvas::Group (*track_canvas->root()); #ifdef GTKOSX @@ -186,7 +186,7 @@ Editor::initialize_canvas () range_marker_bar->property_outline_pixels() = 0; } range_marker_bar->property_outline_what() = (0x1 | 0x8); - + transport_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ()); if (Profile->get_sae()) { transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height - 1)); @@ -206,7 +206,7 @@ Editor::initialize_canvas () marker_bar->property_outline_pixels() = 0; } marker_bar->property_outline_what() = (0x1 | 0x8); - + cd_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ()); if (Profile->get_sae()) { cd_marker_bar = new ArdourCanvas::SimpleRect (*cd_marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height - 1)); @@ -245,27 +245,27 @@ Editor::initialize_canvas () transport_punchin_line->property_x2() = 0.0; transport_punchin_line->property_y2() = physical_screen_height; transport_punchin_line->hide (); - + transport_punchout_line = new ArdourCanvas::SimpleLine (*_master_group); transport_punchout_line->property_x1() = 0.0; transport_punchout_line->property_y1() = 0.0; transport_punchout_line->property_x2() = 0.0; transport_punchout_line->property_y2() = physical_screen_height; transport_punchout_line->hide(); - + // used to show zoom mode active zooming zoom_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0); zoom_rect->property_outline_pixels() = 1; zoom_rect->hide(); - + zoom_rect->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_zoom_rect_event), (ArdourCanvas::Item*) 0)); - + // used as rubberband rect rubberband_rect = new ArdourCanvas::SimpleRect (*_trackview_group, 0.0, 0.0, 0.0, 0.0); rubberband_rect->property_outline_pixels() = 1; rubberband_rect->hide(); - + tempo_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_tempo_bar_event), tempo_bar)); meter_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_meter_bar_event), meter_bar)); marker_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_marker_bar_event), marker_bar)); @@ -295,7 +295,7 @@ Editor::initialize_canvas () /* set up drag-n-drop */ vector<TargetEntry> target_table; - + // Drag-N-Drop from the region list can generate this target target_table.push_back (TargetEntry ("regions")); @@ -336,7 +336,7 @@ Editor::track_canvas_size_allocated () height += (*i)->effective_height (); (*i)->clip_to_viewport (); } - + full_canvas_height = height + canvas_timebars_vsize; } @@ -344,7 +344,7 @@ Editor::track_canvas_size_allocated () if (playhead_cursor) { playhead_cursor->set_length (_canvas_height); } - + for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) { (*x)->set_line_vpos (0, _canvas_height); } @@ -352,7 +352,7 @@ Editor::track_canvas_size_allocated () vertical_adjustment.set_page_size (_canvas_height); last_trackview_group_vertical_offset = get_trackview_group_vertical_offset (); if ((vertical_adjustment.get_value() + _canvas_height) >= vertical_adjustment.get_upper()) { - /* + /* We're increasing the size of the canvas while the bottom is visible. We scroll down to keep in step with the controls layout. */ @@ -381,14 +381,14 @@ Editor::controls_layout_size_request (Requisition* req) } gint height = min ((gint) pos, (gint) (physical_screen_height - 600)); - + bool changed = false; gint w = edit_controls_vbox.get_width(); if (_group_tabs->is_mapped()) { w += _group_tabs->get_width (); } - + gint width = max (w, controls_layout.get_width()); /* don't get too big. the fudge factors here are just guesses */ @@ -407,7 +407,7 @@ Editor::controls_layout_size_request (Requisition* req) } req->width = width; - /* this one is important: it determines how big the layout thinks it really is, as + /* this one is important: it determines how big the layout thinks it really is, as opposed to what it displays on the screen */ controls_layout.property_width () = vbox_width; @@ -426,7 +426,7 @@ Editor::controls_layout_size_request (Requisition* req) if (changed) { controls_layout_size_request_connection = controls_layout.signal_size_request().connect (mem_fun (*this, &Editor::controls_layout_size_request)); } - //cerr << "sizes = " << req->width << " " << edit_controls_vbox.get_width() << " " << controls_layout.get_width() << " " << zoom_box.get_width() << " " << time_button_frame.get_width() << endl;//DEBUG + //cerr << "sizes = " << req->width << " " << edit_controls_vbox.get_width() << " " << controls_layout.get_width() << " " << zoom_box.get_width() << " " << time_button_frame.get_width() << endl;//DEBUG } bool @@ -438,9 +438,9 @@ Editor::track_canvas_map_handler (GdkEventAny* /*ev*/) return false; } -void +void Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context, - int x, int y, + int x, int y, const SelectionData& data, guint info, guint time) { @@ -471,21 +471,21 @@ Editor::drop_paths_part_two (const vector<ustring>& paths, nframes64_t frame, do frame = 0; if (Profile->get_sae() || Config->get_only_copy_imported_files()) { - do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, SrcBest, frame); + do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, SrcBest, frame); } else { do_embed (paths, Editing::ImportDistinctFiles, ImportAsTrack, frame); } - + } else if ((tv = dynamic_cast<RouteTimeAxisView*> (tvp.first)) != 0) { /* check that its an audio track, not a bus */ - + if (tv->get_diskstream()) { /* select the track, then embed/import */ selection->set (tv); if (Profile->get_sae() || Config->get_only_copy_imported_files()) { - do_import (paths, Editing::ImportSerializeFiles, Editing::ImportToTrack, SrcBest, frame); + do_import (paths, Editing::ImportSerializeFiles, Editing::ImportToTrack, SrcBest, frame); } else { do_embed (paths, Editing::ImportSerializeFiles, ImportToTrack, frame); } @@ -495,7 +495,7 @@ Editor::drop_paths_part_two (const vector<ustring>& paths, nframes64_t frame, do void Editor::drop_paths (const RefPtr<Gdk::DragContext>& context, - int x, int y, + int x, int y, const SelectionData& data, guint info, guint time) { @@ -507,20 +507,20 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context, double cy; if (convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) { - + /* D-n-D coordinates are window-relative, so convert to "world" coordinates */ track_canvas->window_to_world (x, y, wx, wy); - + ev.type = GDK_BUTTON_RELEASE; ev.button.x = wx; ev.button.y = wy; - + frame = event_frame (&ev, 0, &cy); - + snap_to (frame); - + #ifdef GTKOSX /* We are not allowed to call recursive main event loops from within the main event loop with GTK/Quartz. Since import/embed wants @@ -537,7 +537,7 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context, void Editor::drop_regions (const RefPtr<Gdk::DragContext>& /*context*/, - int /*x*/, int /*y*/, + int /*x*/, int /*y*/, const SelectionData& /*data*/, guint /*info*/, guint /*time*/) { @@ -586,7 +586,7 @@ Editor::maybe_autoscroll (GdkEventMotion* event, bool allow_vert) if ((autoscroll_x != last_autoscroll_x) || (autoscroll_y != last_autoscroll_y) || (autoscroll_x == 0 && autoscroll_y == 0)) { stop_canvas_autoscroll (); } - + if (startit && autoscroll_timeout_tag < 0) { start_canvas_autoscroll (autoscroll_x, autoscroll_y); } @@ -672,13 +672,13 @@ Editor::autoscroll_canvas () new_pixel = min (top_of_bottom_of_canvas, new_pixel); target_pixel = _drag->current_pointer_y() + autoscroll_y_distance; - + /* don't move to the full canvas height because the item will be invisible (its top edge will line up with the bottom of the visible canvas. */ target_pixel = min (target_pixel, full_canvas_height - 10); - + } else { target_pixel = _drag->current_pointer_y(); new_pixel = vertical_pos; @@ -717,7 +717,7 @@ Editor::autoscroll_canvas () autoscroll_timeout_tag = g_idle_add ( _autoscroll_canvas, this); return false; - } + } return true; } @@ -737,7 +737,7 @@ Editor::start_canvas_autoscroll (int dx, int dy) autoscroll_x_distance = (nframes64_t) floor (current_page_frames()/50.0); autoscroll_y_distance = fabs (dy * 5); /* pixels */ autoscroll_cnt = 0; - + /* do it right now, which will start the repeated callbacks */ autoscroll_canvas (); @@ -921,7 +921,7 @@ Editor::update_canvas_now () and need_redraw to FALSE without checking to see if an idle handler is scheduled. If one is scheduled, GC should probably remove it. */ - + GnomeCanvas* c = track_canvas->gobj (); if (c->need_update || c->need_redraw) { track_canvas->update_now (); diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index 2ea0a476fb..c176652547 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -65,7 +65,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) double wx, wy; nframes64_t xdelta; int direction = ev->direction; - + Gnome::Canvas::Item* item = track_canvas->get_item_at(ev->x, ev->y); InteractiveItem* interactive_item = dynamic_cast<InteractiveItem*>(item); if (interactive_item) { @@ -77,9 +77,9 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) case GDK_SCROLL_UP: if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { //if (ev->state == GDK_CONTROL_MASK) { - /* XXX + /* XXX the ev->x will be out of step with the canvas - if we're in mid zoom, so we have to get the damn mouse + if we're in mid zoom, so we have to get the damn mouse pointer again */ track_canvas->get_pointer (x, y); @@ -89,7 +89,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) event.type = GDK_BUTTON_RELEASE; event.button.x = wx; event.button.y = wy; - + nframes64_t where = event_frame (&event, 0, 0); temporal_zoom_to_frame (false, where); return true; @@ -124,7 +124,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) event.type = GDK_BUTTON_RELEASE; event.button.x = wx; event.button.y = wy; - + nframes64_t where = event_frame (&event, 0, 0); temporal_zoom_to_frame (true, where); return true; @@ -147,7 +147,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) scroll_tracks_down_line (); return true; } - break; + break; case GDK_SCROLL_LEFT: xdelta = (current_page_frames() / 8); @@ -226,7 +226,7 @@ bool Editor::typed_event (ArdourCanvas::Item* item, GdkEvent *event, ItemType type) { gint ret = FALSE; - + switch (event->type) { case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: @@ -304,7 +304,7 @@ bool Editor::canvas_stream_view_event (GdkEvent *event, ArdourCanvas::Item* item, RouteTimeAxisView *tv) { bool ret = FALSE; - + switch (event->type) { case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: @@ -406,11 +406,11 @@ Editor::canvas_fade_in_event (GdkEvent *event, ArdourCanvas::Item* item, AudioRe default: break; - + } /* proxy for the regionview */ - + return canvas_region_view_event (event, rv->get_canvas_group(), rv); } @@ -418,7 +418,7 @@ bool Editor::canvas_fade_in_handle_event (GdkEvent *event, ArdourCanvas::Item* item, AudioRegionView *rv) { bool ret = false; - + if (!rv->sensitive()) { return false; } @@ -485,11 +485,11 @@ Editor::canvas_fade_out_event (GdkEvent *event, ArdourCanvas::Item* item, AudioR default: break; - + } /* proxy for the regionview */ - + return canvas_region_view_event (event, rv->get_canvas_group(), rv); } @@ -497,7 +497,7 @@ bool Editor::canvas_fade_out_handle_event (GdkEvent *event, ArdourCanvas::Item* item, AudioRegionView *rv) { bool ret = false; - + if (!rv->sensitive()) { return false; } @@ -553,7 +553,7 @@ Editor::canvas_crossfade_view_event (GdkEvent* event, ArdourCanvas::Item* item, clicked_axisview = &clicked_crossfadeview->get_time_axis_view(); if (event->button.button == 3) { return button_press_handler (item, event, CrossfadeViewItem); - } + } break; case GDK_BUTTON_RELEASE: @@ -565,7 +565,7 @@ Editor::canvas_crossfade_view_event (GdkEvent* event, ArdourCanvas::Item* item, default: break; - + } /* XXX do not forward double clicks */ @@ -573,13 +573,13 @@ Editor::canvas_crossfade_view_event (GdkEvent* event, ArdourCanvas::Item* item, if (event->type == GDK_2BUTTON_PRESS) { return false; } - + /* proxy for an underlying regionview */ /* XXX really need to check if we are in the name highlight, and proxy to that when required. */ - + TimeAxisView& tv (xfv->get_time_axis_view()); AudioTimeAxisView* atv; @@ -589,26 +589,26 @@ Editor::canvas_crossfade_view_event (GdkEvent* event, ArdourCanvas::Item* item, boost::shared_ptr<AudioPlaylist> pl; if ((pl = boost::dynamic_pointer_cast<AudioPlaylist> (atv->get_diskstream()->playlist())) != 0) { - + Playlist::RegionList* rl = pl->regions_at (event_frame (event)); if (!rl->empty()) { - + if (atv->layer_display() == Overlaid) { - + /* we're in overlaid mode; proxy to the uppermost region view */ - + DescendingRegionLayerSorter cmp; rl->sort (cmp); - + RegionView* rv = atv->view()->find_view (rl->front()); - + delete rl; - + /* proxy */ return canvas_region_view_event (event, rv->get_canvas_group(), rv); } else { - + /* we're in stacked mode; proxy to the region view under the mouse */ /* XXX: FIXME: this is an evil hack; it assumes that any event for which @@ -692,7 +692,7 @@ bool Editor::canvas_selection_rect_event (GdkEvent *event, ArdourCanvas::Item* item, SelectionRect* rect) { bool ret = false; - + switch (event->type) { case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: @@ -718,7 +718,7 @@ Editor::canvas_selection_rect_event (GdkEvent *event, ArdourCanvas::Item* item, default: break; } - + return ret; } @@ -751,7 +751,7 @@ Editor::canvas_selection_start_trim_event (GdkEvent *event, ArdourCanvas::Item* default: break; } - + return ret; } @@ -784,7 +784,7 @@ Editor::canvas_selection_end_trim_event (GdkEvent *event, ArdourCanvas::Item* it default: break; } - + return ret; } @@ -1012,7 +1012,7 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const & /*c*/, double px; double py; nframes64_t const pos = event_frame (&event, &px, &py); - + std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (py); if (tv.first == 0) { return true; @@ -1027,20 +1027,20 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const & /*c*/, boost::shared_ptr<Region> region_copy = RegionFactory::create (region); - if (boost::dynamic_pointer_cast<AudioRegion> (region_copy) != 0 && + if (boost::dynamic_pointer_cast<AudioRegion> (region_copy) != 0 && dynamic_cast<AudioTimeAxisView*> (tv.first) == 0) { /* audio -> non-audio */ return true; } - if (boost::dynamic_pointer_cast<MidiRegion> (region_copy) == 0 && + if (boost::dynamic_pointer_cast<MidiRegion> (region_copy) == 0 && dynamic_cast<MidiTimeAxisView*> (tv.first) != 0) { /* MIDI -> non-MIDI */ return true; } - + _drag = new RegionInsertDrag (this, region_copy, rtav, pos); _drag->start_grab (&event); } diff --git a/gtk2_ardour/editor_component.cc b/gtk2_ardour/editor_component.cc index e78f7804f1..3265caca74 100644 --- a/gtk2_ardour/editor_component.cc +++ b/gtk2_ardour/editor_component.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ EditorComponent::EditorComponent (Editor* e) { } - + void EditorComponent::connect_to_session (Session* s) { diff --git a/gtk2_ardour/editor_component.h b/gtk2_ardour/editor_component.h index 328bfb15b2..e5ec1259dc 100644 --- a/gtk2_ardour/editor_component.h +++ b/gtk2_ardour/editor_component.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ protected: private: void session_going_away (); - + }; #endif diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc index bedff56701..0d5c3da667 100644 --- a/gtk2_ardour/editor_cursors.cc +++ b/gtk2_ardour/editor_cursors.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,7 +60,7 @@ void EditorCursor::set_position (nframes64_t frame) { PositionChanged (frame); - + double new_pos = editor.frame_to_unit (frame); if (new_pos != points.front().get_x()) { @@ -76,12 +76,12 @@ EditorCursor::set_position (nframes64_t frame) void EditorCursor::set_length (double units) { - length = units; + length = units; points.back().set_y (points.front().get_y() + length); canvas_item.property_points() = points; } -void +void EditorCursor::set_y_axis (double position) { points.front().set_y (position); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 5aef521608..c2e30b9aab 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -138,7 +138,7 @@ bool Drag::end_grab (GdkEvent* event) { _ending = true; - + _editor->stop_canvas_autoscroll (); _item->ungrab (event ? event->button.time : 0); @@ -158,13 +158,13 @@ nframes64_t Drag::adjusted_current_frame (GdkEvent* event) const { nframes64_t pos = 0; - + if (_current_pointer_frame > _pointer_frame_offset) { pos = _current_pointer_frame - _pointer_frame_offset; } _editor->snap_to_with_modifier (pos, event); - + return pos; } @@ -176,20 +176,20 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll) _current_pointer_frame = _editor->event_frame (event, &_current_pointer_x, &_current_pointer_y); if (!from_autoscroll && !_move_threshold_passed) { - + bool const xp = (::llabs ((nframes64_t) (_current_pointer_x - _grab_x)) > 4LL); bool const yp = (::llabs ((nframes64_t) (_current_pointer_y - _grab_y)) > 4LL); - + _move_threshold_passed = (xp || yp); if (apply_move_threshold() && _move_threshold_passed) { - + _grab_frame = _current_pointer_frame; _grab_x = _current_pointer_x; _grab_y = _current_pointer_y; _last_pointer_frame = _grab_frame; _pointer_frame_offset = _grab_frame - _last_frame_position; - + } } @@ -259,7 +259,7 @@ RegionMotionDrag::RegionMotionDrag (Editor* e, ArdourCanvas::Item* i, RegionView _dest_layer (0), _brushing (b) { - + } @@ -267,7 +267,7 @@ void RegionMotionDrag::start_grab (GdkEvent* event, Gdk::Cursor *) { Drag::start_grab (event); - + _editor->show_verbose_time_cursor (_last_frame_position, 10); } @@ -278,30 +278,30 @@ RegionMotionDrag::get_time_axis_view_summary () TimeAxisViewSummary sum; _editor->visible_order_range (&sum.visible_y_low, &sum.visible_y_high); - + /* get a bitmask representing the visible tracks */ for (Editor::TrackViewList::iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) { RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*i); TimeAxisView::Children children_list; - + /* zeroes are audio/MIDI tracks. ones are other types. */ - + if (!rtv->hidden()) { - + if (!rtv->is_track()) { /* not an audio nor MIDI track */ sum.tracks = sum.tracks |= (0x01 << rtv->order()); } - + sum.height_list[rtv->order()] = (*i)->current_height(); children = 1; if ((children_list = rtv->get_child_list()).size() > 0) { - for (TimeAxisView::Children::iterator j = children_list.begin(); j != children_list.end(); ++j) { + for (TimeAxisView::Children::iterator j = children_list.begin(); j != children_list.end(); ++j) { sum.tracks = sum.tracks |= (0x01 << (rtv->order() + children)); sum.height_list[rtv->order() + children] = (*j)->current_height(); - children++; + children++; } } } @@ -326,7 +326,7 @@ RegionMotionDrag::compute_y_delta ( } bool clamp_y_axis = false; - + /* the change in track order between this callback and the last */ *pointer_order_span = last_pointer_view->order() - current_pointer_view->order(); /* the change in layer between this callback and the last; @@ -355,7 +355,7 @@ RegionMotionDrag::compute_y_delta ( } for (list<RegionView*>::const_iterator i = _views.begin(); i != _views.end(); ++i) { - + RegionView* rv = (*i); if (rv->region()->locked()) { @@ -374,7 +374,7 @@ RegionMotionDrag::compute_y_delta ( /* XXX: not sure that we should be passing canvas_pointer_order_span in here, as surely this is a per-region thing... */ - + clamp_y_axis = y_movement_disallowed ( rtv->order(), last_pointer_view->order(), *canvas_pointer_order_span, tavs ); @@ -389,7 +389,7 @@ RegionMotionDrag::compute_y_delta ( if (current_pointer_layer == last_pointer_layer) { /* No movement; clamp */ clamp_y_axis = true; - } + } } if (!clamp_y_axis) { @@ -405,7 +405,7 @@ double RegionMotionDrag::compute_x_delta (GdkEvent const * event, nframes64_t* pending_region_position) { *pending_region_position = 0; - + /* compute the amount of pointer motion in frames, and where the region would be if we moved it by that much. */ @@ -414,62 +414,62 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, nframes64_t* pending_ nframes64_t sync_frame; nframes64_t sync_offset; int32_t sync_dir; - + *pending_region_position = _current_pointer_frame - _pointer_frame_offset; - + sync_offset = _primary->region()->sync_offset (sync_dir); - + /* we don't handle a sync point that lies before zero. */ if (sync_dir >= 0 || (sync_dir < 0 && *pending_region_position >= sync_offset)) { - + sync_frame = *pending_region_position + (sync_dir*sync_offset); - + _editor->snap_to_with_modifier (sync_frame, event); - + *pending_region_position = _primary->region()->adjust_to_sync (sync_frame); - + } else { *pending_region_position = _last_frame_position; } - + } - + if (*pending_region_position > max_frames - _primary->region()->length()) { *pending_region_position = _last_frame_position; } double x_delta = 0; - + if ((*pending_region_position != _last_frame_position) && x_move_allowed ()) { - + /* now compute the canvas unit distance we need to move the regionview to make it appear at the new location. */ x_delta = (static_cast<double> (*pending_region_position) - _last_frame_position) / _editor->frames_per_unit; - + if (*pending_region_position <= _last_frame_position) { - + for (list<RegionView*>::const_iterator i = _views.begin(); i != _views.end(); ++i) { - + RegionView* rv = (*i); - + // If any regionview is at zero, we need to know so we can stop further leftward motion. - + double ix1, ix2, iy1, iy2; rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2); rv->get_canvas_frame()->i2w (ix1, iy1); - + if (-x_delta > ix1 + _editor->horizontal_adjustment.get_value()) { x_delta = 0; *pending_region_position = _last_frame_position; break; } } - + } - + _last_frame_position = *pending_region_position; } @@ -508,7 +508,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move) int32_t pointer_order_span; int32_t pointer_layer_span; int32_t canvas_pointer_order_span; - + bool const clamp_y_axis = compute_y_delta ( last_pointer_view, current_pointer_view, last_pointer_layer, current_pointer_layer, tavs, @@ -531,68 +531,68 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move) } /************************************************************* - MOTION + MOTION ************************************************************/ pair<set<boost::shared_ptr<Playlist> >::iterator,bool> insert_result; - + for (list<RegionView*>::const_iterator i = _views.begin(); i != _views.end(); ++i) { - + RegionView* rv = (*i); - + if (rv->region()->locked()) { continue; } - + /* here we are calculating the y distance from the top of the first track view to the top of the region area of the track view that we're working on */ - + /* this x value is just a dummy value so that we have something to pass to i2w () */ - + double ix1 = 0; - + /* distance from the top of this track view to the region area of our track view is always 1 */ - + double iy1 = 1; - + /* convert to world coordinates, ie distance from the top of the ruler section */ - + rv->get_canvas_frame()->i2w (ix1, iy1); - + /* compensate for the ruler section and the vertical scrollbar position */ iy1 += _editor->get_trackview_group_vertical_offset (); - + if (first_move) { - - // hide any dependent views - + + // hide any dependent views + rv->get_time_axis_view().hide_dependent_views (*rv); - - /* - reparent to a non scrolling group so that we can keep the + + /* + reparent to a non scrolling group so that we can keep the region selection above all time axis views. - reparenting means we have to move the rv as the two + reparenting means we have to move the rv as the two parent groups have different coordinates. */ - + rv->get_canvas_group()->property_y() = iy1 - 1; rv->get_canvas_group()->reparent(*(_editor->_region_motion_group)); - + rv->fake_set_opaque (true); } - + /* current view for this particular region */ pair<TimeAxisView*, int> pos = _editor->trackview_by_y_position (iy1); RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (pos.first); - + if (pointer_order_span != 0 && !clamp_y_axis) { - + /* INTER-TRACK MOVEMENT */ - + /* move through the height list to the track that the region is currently on */ vector<int32_t>::iterator j = tavs.height_list.begin (); int32_t x = 0; @@ -600,25 +600,25 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move) ++x; ++j; } - + y_delta = 0; int32_t temp_pointer_order_span = canvas_pointer_order_span; - + if (j != tavs.height_list.end ()) { - + /* Account for layers in the original and destination tracks. If we're moving around in layers we assume that only one track is involved, so it's ok to use *pointer* variables here. */ - + StreamView* lv = last_pointer_view->view (); assert (lv); - + /* move to the top of the last trackview */ if (lv->layer_display () == Stacked) { y_delta -= (lv->layers() - last_pointer_layer - 1) * lv->child_height (); } - + StreamView* cv = current_pointer_view->view (); assert (cv); @@ -626,75 +626,75 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move) if (cv->layer_display () == Stacked) { y_delta += (cv->layers() - current_pointer_layer - 1) * cv->child_height (); } - + /* And for being on a non-topmost layer on the new track */ - + while (temp_pointer_order_span > 0) { /* we're moving up canvas-wise, so we need to find the next track height */ - if (j != tavs.height_list.begin()) { + if (j != tavs.height_list.begin()) { j--; } - + if (x != last_pointer_order) { if ((*j) == 0) { ++temp_pointer_order_span; } } - + y_delta -= (*j); temp_pointer_order_span--; } - + while (temp_pointer_order_span < 0) { - + y_delta += (*j); - + if (x != last_pointer_order) { if ((*j) == 0) { --temp_pointer_order_span; } } - - if (j != tavs.height_list.end()) { + + if (j != tavs.height_list.end()) { j++; } - + temp_pointer_order_span++; } - - + + /* find out where we'll be when we move and set height accordingly */ - + pair<TimeAxisView*, int> const pos = _editor->trackview_by_y_position (iy1 + y_delta); RouteTimeAxisView const * temp_rtv = dynamic_cast<RouteTimeAxisView*> (pos.first); rv->set_height (temp_rtv->view()->child_height()); - + /* if you un-comment the following, the region colours will follow the track colours whilst dragging; personally i think this can confuse things, but never mind. */ - + //const GdkColor& col (temp_rtv->view->get_region_color()); //rv->set_color (const_cast<GdkColor&>(col)); } } - + if (pointer_order_span == 0 && pointer_layer_span != 0 && !clamp_y_axis) { - + /* INTER-LAYER MOVEMENT in the same track */ y_delta = rtv->view()->child_height () * pointer_layer_span; } - - + + if (_brushing) { _editor->mouse_brush_insert_region (rv, pending_region_position); } else { rv->move (x_delta, y_delta); } - + } /* foreach region */ if (first_move) { @@ -745,7 +745,7 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) if (_brushing) { /* all changes were made during motion event handlers */ - + if (_copy) { for (list<RegionView*>::iterator i = _views.begin(); i != _views.end(); ++i) { copies.push_back (*i); @@ -758,7 +758,7 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) /* reverse this here so that we have the correct logic to finalize the drag. */ - + if (Config->get_edit_mode() == Lock && !_copy) { _x_constrained = !_x_constrained; } @@ -768,7 +768,7 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) _editor->begin_reversible_command (_("fixed time region copy")); } else { _editor->begin_reversible_command (_("region copy")); - } + } } else { if (_x_constrained) { _editor->begin_reversible_command (_("fixed time region drag")); @@ -805,7 +805,7 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) } else { where = rv->region()->position(); } - + boost::shared_ptr<Region> new_region; if (_copy) { @@ -813,11 +813,11 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) new_region = rv->region(); /* undo the previous hide_dependent_views so that xfades don't - disappear on copying regions + disappear on copying regions */ - + //rv->get_time_axis_view().reveal_dependent_views (*rv); - + } else if (changed_tracks && dest_rtv->playlist()) { new_region = RegionFactory::create (rv->region()); } @@ -825,7 +825,7 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) if (changed_tracks || _copy) { boost::shared_ptr<Playlist> to_playlist = dest_rtv->playlist(); - + if (!to_playlist) { ++i; continue; @@ -834,9 +834,9 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) _editor->latest_regionviews.clear (); sigc::connection c = dest_rtv->view()->RegionViewAdded.connect (mem_fun(*_editor, &Editor::collect_new_region_view)); - + insert_result = modified_playlists.insert (to_playlist); - + if (insert_result.second) { _editor->session->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0)); } @@ -848,7 +848,7 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) } c.disconnect (); - + if (!_editor->latest_regionviews.empty()) { // XXX why just the first one ? we only expect one // commented out in nick_m's canvas reworking. is that intended? @@ -857,32 +857,32 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) } } else { - /* - motion on the same track. plonk the previously reparented region + /* + motion on the same track. plonk the previously reparented region back to its original canvas group (its streamview). No need to do anything for copies as they are fake regions which will be deleted. */ rv->get_canvas_group()->reparent (*dest_rtv->view()->canvas_item()); rv->get_canvas_group()->property_y() = 0; - + /* just change the model */ - + boost::shared_ptr<Playlist> playlist = dest_rtv->playlist(); if (dest_rtv->view()->layer_display() == Stacked) { rv->region()->set_layer (dest_layer); rv->region()->set_pending_explicit_relayer (true); } - + insert_result = modified_playlists.insert (playlist); - + if (insert_result.second) { _editor->session->add_command (new MementoCommand<Playlist>(*playlist, &playlist->get_state(), 0)); } /* freeze to avoid lots of relayering in the case of a multi-region drag */ frozen_insert_result = frozen_playlists.insert(playlist); - + if (frozen_insert_result.second) { playlist->freeze(); } @@ -895,7 +895,7 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) /* get the playlist where this drag started. we can't use rv->region()->playlist() because we may have copied the region and it has not been attached to a playlist. */ - + source_tv = dynamic_cast<RouteTimeAxisView*> (&rv->get_time_axis_view()); ds = source_tv->get_diskstream(); from_playlist = ds->playlist(); @@ -910,21 +910,21 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) moved to the new one - we use a copy of it. as a result, any existing editor for the region should no longer be visible. - */ - + */ + rv->hide_region_editor(); rv->fake_set_opaque (false); - + /* remove the region from the old playlist */ insert_result = modified_playlists.insert (from_playlist); - + if (insert_result.second) { _editor->session->add_command (new MementoCommand<Playlist>(*from_playlist, &from_playlist->get_state(), 0)); } - + from_playlist->remove_region (rv->region()); - + /* OK, this is where it gets tricky. If the playlist was being used by >1 tracks, and the region was selected in all of them, then removing it from a playlist will have removed all trace of it from the selection (i.e. there were N regions selected, we removed 1, @@ -944,14 +944,14 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) if (_views.empty()) { break; - } else { + } else { i = _views.begin(); } } else { ++i; } - + if (_copy) { copies.push_back (rv); } @@ -962,12 +962,12 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred) for (set<boost::shared_ptr<Playlist> >::iterator p = frozen_playlists.begin(); p != frozen_playlists.end(); ++p) { (*p)->thaw(); } - + out: for (set<boost::shared_ptr<Playlist> >::iterator p = modified_playlists.begin(); p != modified_playlists.end(); ++p) { - _editor->session->add_command (new MementoCommand<Playlist>(*(*p), 0, &(*p)->get_state())); + _editor->session->add_command (new MementoCommand<Playlist>(*(*p), 0, &(*p)->get_state())); } - + _editor->commit_reversible_command (); for (vector<RegionView*>::iterator x = copies.begin(); x != copies.end(); ++x) { @@ -987,7 +987,7 @@ RegionMoveDrag::x_move_allowed () const return _x_constrained; } } - + return !_x_constrained; } @@ -1007,13 +1007,13 @@ RegionMotionDrag::copy_regions (GdkEvent* event) /* duplicate the regionview(s) and region(s) */ list<RegionView*> new_regionviews; - + for (list<RegionView*>::const_iterator i = _views.begin(); i != _views.end(); ++i) { - + RegionView* rv = (*i); AudioRegionView* arv = dynamic_cast<AudioRegionView*>(rv); MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(rv); - + const boost::shared_ptr<const Region> original = rv->region(); boost::shared_ptr<Region> region_copy = RegionFactory::create (original); @@ -1029,27 +1029,27 @@ RegionMotionDrag::copy_regions (GdkEvent* event) } else { continue; } - + nrv->get_canvas_group()->show (); new_regionviews.push_back (nrv); } - + if (new_regionviews.empty()) { return; } - + /* reflect the fact that we are dragging the copies */ - + _primary = new_regionviews.front(); _views = new_regionviews; - + swap_grab (new_regionviews.front()->get_canvas_group (), 0, event ? event->motion.time : 0); - - /* - sync the canvas to what we think is its current state - without it, the canvas seems to - "forget" to update properly after the upcoming reparent() - ..only if the mouse is in rapid motion at the time of the grab. + + /* + sync the canvas to what we think is its current state + without it, the canvas seems to + "forget" to update properly after the upcoming reparent() + ..only if the mouse is in rapid motion at the time of the grab. something to do with regionview creation raking so long? */ _editor->update_canvas_now(); @@ -1071,10 +1071,10 @@ RegionMotionDrag::check_possible (RouteTimeAxisView** tv, layer_t* layer) /* The region motion is only processed if the pointer is over an audio track. */ - + if (!(*tv) || !(*tv)->is_track()) { - /* To make sure we hide the verbose canvas cursor when the mouse is - not held over and audiotrack. + /* To make sure we hide the verbose canvas cursor when the mouse is + not held over and audiotrack. */ _editor->hide_verbose_canvas_cursor (); return false; @@ -1093,7 +1093,7 @@ RegionMotionDrag::y_movement_disallowed (int new_order, int old_order, int y_spa { if (new_order != old_order) { - /* this isn't the pointer track */ + /* this isn't the pointer track */ if (y_span > 0) { @@ -1109,20 +1109,20 @@ RegionMotionDrag::y_movement_disallowed (int new_order, int old_order, int y_spa while (tavs.height_list[new_order - (visible_tracks - n)] == 0) { /* passing through a hidden track */ n--; - } + } } - + if (tavs.tracks[new_order - (y_span - n)] != 0x00) { /* moving to a non-track; disallow */ return true; } - + } else { /* moving beyond the lowest visible track; disallow */ return true; - } - + } + } else if (y_span < 0) { /* moving down the canvas */ @@ -1132,30 +1132,30 @@ RegionMotionDrag::y_movement_disallowed (int new_order, int old_order, int y_spa int32_t n = 0; while (visible_tracks > y_span ) { visible_tracks--; - + while (tavs.height_list[new_order - (visible_tracks - n)] == 0) { /* passing through a hidden track */ n++; - } + } } - + if (tavs.tracks[new_order - (y_span - n)] != 0x00) { /* moving to a non-track; disallow */ return true; } - + } else { /* moving beyond the highest visible track; disallow */ return true; } - } - + } + } else { - + /* this is the pointer's track */ - + if ((new_order - y_span) > tavs.visible_y_high) { /* we will overflow */ return true; @@ -1174,7 +1174,7 @@ RegionMoveDrag::RegionMoveDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, _copy (c) { TimeAxisView* const tv = &_primary->get_time_axis_view (); - + _dest_trackview = tv; if (tv->layer_display() == Overlaid) { _dest_layer = 0; @@ -1195,7 +1195,7 @@ void RegionMoveDrag::start_grab (GdkEvent* event, Gdk::Cursor* c) { RegionMotionDrag::start_grab (event, c); - + _pointer_frame_offset = _grab_frame - _last_frame_position; } @@ -1206,7 +1206,7 @@ RegionInsertDrag::RegionInsertDrag (Editor* e, boost::shared_ptr<Region> r, Rout (boost::dynamic_pointer_cast<MidiRegion> (r) && dynamic_cast<MidiTimeAxisView*> (v))); _primary = v->view()->create_region_view (r, false, false); - + _primary->get_canvas_group()->show (); _primary->set_position (pos, 0); _views.push_back (_primary); @@ -1222,7 +1222,7 @@ map<RegionView*, pair<RouteTimeAxisView*, int> > RegionMotionDrag::find_time_axis_views_and_layers () { map<RegionView*, pair<RouteTimeAxisView*, int> > tav; - + for (list<RegionView*>::const_iterator i = _views.begin(); i != _views.end(); ++i) { double ix1, ix2, iy1, iy2; @@ -1244,7 +1244,7 @@ RegionInsertDrag::finished (GdkEvent* /*event*/, bool /*movement_occurred*/) _editor->update_canvas_now (); map<RegionView*, pair<RouteTimeAxisView*, int> > final = find_time_axis_views_and_layers (); - + RouteTimeAxisView* dest_rtv = final[_primary].first; _primary->get_canvas_group()->reparent (*dest_rtv->view()->canvas_item()); @@ -1280,7 +1280,7 @@ RegionSpliceDrag::motion (GdkEvent* /*event*/, bool) { RouteTimeAxisView* tv; layer_t layer; - + if (!check_possible (&tv, &layer)) { return; } @@ -1314,7 +1314,7 @@ RegionSpliceDrag::motion (GdkEvent* /*event*/, bool) if (!playlist->region_is_shuffle_constrained ((*i)->region())) { continue; - } + } if (dir > 0) { if (_current_pointer_frame < (*i)->region()->last_frame() + 1) { @@ -1326,7 +1326,7 @@ RegionSpliceDrag::motion (GdkEvent* /*event*/, bool) } } - + playlist->shuffle ((*i)->region(), dir); _grab_x = _current_pointer_x; @@ -1336,7 +1336,7 @@ RegionSpliceDrag::motion (GdkEvent* /*event*/, bool) void RegionSpliceDrag::finished (GdkEvent* /*event*/, bool) { - + } @@ -1344,14 +1344,14 @@ RegionCreateDrag::RegionCreateDrag (Editor* e, ArdourCanvas::Item* i, TimeAxisVi : Drag (e, i), _view (v) { - + } void RegionCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor *) { _dest_trackview = _view; - + Drag::start_grab (event); } @@ -1364,7 +1364,7 @@ RegionCreateDrag::motion (GdkEvent* /*event*/, bool first_move) } // TODO: resize region-create-drag region view here -} +} void RegionCreateDrag::finished (GdkEvent* event, bool movement_occurred) @@ -1387,7 +1387,7 @@ NoteResizeDrag::NoteResizeDrag (Editor* e, ArdourCanvas::Item* i) : Drag (e, i) , region (0) { - + } void @@ -1395,14 +1395,14 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor *) { Gdk::Cursor cursor; ArdourCanvas::CanvasNote* cnote = dynamic_cast<ArdourCanvas::CanvasNote*>(_item); - + Drag::start_grab (event); region = &cnote->region_view(); double region_start = region->get_position_pixels(); double middle_point = region_start + cnote->x1() + (cnote->x2() - cnote->x1()) / 2.0L; - + if (_grab_x <= middle_point) { cursor = Gdk::Cursor(Gdk::LEFT_SIDE); at_front = true; @@ -1410,9 +1410,9 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor *) cursor = Gdk::Cursor(Gdk::RIGHT_SIDE); at_front = false; } - + _item->grab(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, cursor, event->motion.time); - + if (event->motion.state & Keyboard::PrimaryModifier) { relative = false; } else { @@ -1425,7 +1425,7 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor *) /* has to be relative, may make no sense otherwise */ relative = true; } - + region->note_selected (cnote, true); for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ) { @@ -1444,7 +1444,7 @@ NoteResizeDrag::motion (GdkEvent* /*event*/, bool /*first_move*/) for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) { (*r)->update_resizing (at_front, _current_pointer_x - _grab_x, relative); } -} +} void NoteResizeDrag::finished (GdkEvent*, bool /*movement_occurred*/) @@ -1458,7 +1458,7 @@ NoteResizeDrag::finished (GdkEvent*, bool /*movement_occurred*/) void RegionGainDrag::motion (GdkEvent* /*event*/, bool) { - + } void @@ -1483,13 +1483,13 @@ TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor *) if (tv && tv->is_track()) { speed = tv->get_diskstream()->speed(); } - + nframes64_t region_start = (nframes64_t) (_primary->region()->position() / speed); nframes64_t region_end = (nframes64_t) (_primary->region()->last_frame() / speed); nframes64_t region_length = (nframes64_t) (_primary->region()->length() / speed); Drag::start_grab (event, _editor->trimmer_cursor); - + if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) { _operation = ContentsTrim; } else { @@ -1505,13 +1505,13 @@ TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor *) switch (_operation) { case StartTrim: - _editor->show_verbose_time_cursor (region_start, 10); + _editor->show_verbose_time_cursor (region_start, 10); break; case EndTrim: - _editor->show_verbose_time_cursor (region_end, 10); + _editor->show_verbose_time_cursor (region_end, 10); break; case ContentsTrim: - _editor->show_verbose_time_cursor (_current_pointer_frame, 10); + _editor->show_verbose_time_cursor (_current_pointer_frame, 10); break; } } @@ -1526,9 +1526,9 @@ TrimDrag::motion (GdkEvent* event, bool first_move) bool obey_snap = !Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier()); /* snap modifier works differently here.. - its' current state has to be passed to the - various trim functions in order to work properly - */ + its' current state has to be passed to the + various trim functions in order to work properly + */ double speed = 1.0; TimeAxisView* tvp = &_primary->get_time_axis_view (); @@ -1538,7 +1538,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) if (tv && tv->is_track()) { speed = tv->get_diskstream()->speed(); } - + if (_last_pointer_frame > _current_pointer_frame) { left_direction = true; } else { @@ -1568,7 +1568,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) for (list<RegionView*>::const_iterator i = _views.begin(); i != _views.end(); ++i) { (*i)->fake_set_opaque(false); (*i)->region()->freeze (); - + AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i); if (arv){ @@ -1601,7 +1601,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) non_overlap_trim = true; } - switch (_operation) { + switch (_operation) { case StartTrim: if ((left_direction == false) && (_current_pointer_frame <= rv->region()->first_frame()/speed)) { break; @@ -1612,7 +1612,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) } break; } - + case EndTrim: if ((left_direction == true) && (_current_pointer_frame > (nframes64_t) (rv->region()->last_frame()/speed))) { break; @@ -1623,7 +1623,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) } break; } - + case ContentsTrim: { bool swap_direction = false; @@ -1631,7 +1631,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) { swap_direction = true; } - + for (list<RegionView*>::const_iterator i = _views.begin(); i != _views.end(); ++i) { _editor->single_contents_trim (**i, frame_delta, left_direction, swap_direction, obey_snap); @@ -1642,13 +1642,13 @@ TrimDrag::motion (GdkEvent* event, bool first_move) switch (_operation) { case StartTrim: - _editor->show_verbose_time_cursor((nframes64_t) (rv->region()->position()/speed), 10); + _editor->show_verbose_time_cursor((nframes64_t) (rv->region()->position()/speed), 10); break; case EndTrim: - _editor->show_verbose_time_cursor((nframes64_t) (rv->region()->last_frame()/speed), 10); + _editor->show_verbose_time_cursor((nframes64_t) (rv->region()->last_frame()/speed), 10); break; case ContentsTrim: - _editor->show_verbose_time_cursor(_current_pointer_frame, 10); + _editor->show_verbose_time_cursor(_current_pointer_frame, 10); break; } @@ -1661,22 +1661,22 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred) { if (movement_occurred) { motion (event, false); - + if (!_editor->selection->selected (_primary)) { - _editor->thaw_region_after_trim (*_primary); + _editor->thaw_region_after_trim (*_primary); } else { - + for (list<RegionView*>::const_iterator i = _views.begin(); i != _views.end(); ++i) { _editor->thaw_region_after_trim (**i); (*i)->fake_set_opaque (true); } } - + for (set<boost::shared_ptr<Playlist> >::iterator p = _editor->motion_frozen_playlists.begin(); p != _editor->motion_frozen_playlists.end(); ++p) { (*p)->thaw (); _editor->session->add_command (new MementoCommand<Playlist>(*(*p).get(), 0, &(*p)->get_state())); } - + _editor->motion_frozen_playlists.clear (); _editor->commit_reversible_command(); @@ -1702,25 +1702,25 @@ MeterMarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) // The actual copying is not done before we reach the finish callback. char name[64]; snprintf (name, sizeof(name), "%g/%g", _marker->meter().beats_per_bar(), _marker->meter().note_divisor ()); - MeterMarker* new_marker = new MeterMarker(*_editor, *_editor->meter_group, ARDOUR_UI::config()->canvasvar_MeterMarker.get(), name, + MeterMarker* new_marker = new MeterMarker(*_editor, *_editor->meter_group, ARDOUR_UI::config()->canvasvar_MeterMarker.get(), name, *new MeterSection (_marker->meter())); _item = &new_marker->the_item (); _marker = new_marker; - + } else { MetricSection& section (_marker->meter()); - + if (!section.movable()) { return; } - + } Drag::start_grab (event, cursor); - - _pointer_frame_offset = _grab_frame - _marker->meter().frame(); + + _pointer_frame_offset = _grab_frame - _marker->meter().frame(); _editor->show_verbose_time_cursor (_current_pointer_frame, 10); } @@ -1729,13 +1729,13 @@ void MeterMarkerDrag::motion (GdkEvent* event, bool) { nframes64_t const adjusted_frame = adjusted_current_frame (event); - + if (adjusted_frame == _last_pointer_frame) { return; } _marker->set_position (adjusted_frame); - + _last_pointer_frame = adjusted_frame; _editor->show_verbose_time_cursor (adjusted_frame, 10); @@ -1749,12 +1749,12 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred) } motion (event, false); - + BBT_Time when; - + TempoMap& map (_editor->session->tempo_map()); map.bbt_time (_last_pointer_frame, when); - + if (_copy == true) { _editor->begin_reversible_command (_("copy meter mark")); XMLNode &before = map.get_state(); @@ -1789,12 +1789,12 @@ TempoMarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) { if (_copy) { - + // create a dummy marker for visual representation of moving the copy. // The actual copying is not done before we reach the finish callback. char name[64]; snprintf (name, sizeof (name), "%.2f", _marker->tempo().beats_per_minute()); - TempoMarker* new_marker = new TempoMarker(*_editor, *_editor->tempo_group, ARDOUR_UI::config()->canvasvar_TempoMarker.get(), name, + TempoMarker* new_marker = new TempoMarker(*_editor, *_editor->tempo_group, ARDOUR_UI::config()->canvasvar_TempoMarker.get(), name, *new TempoSection (_marker->tempo())); _item = &new_marker->the_item (); @@ -1803,7 +1803,7 @@ TempoMarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) } else { MetricSection& section (_marker->tempo()); - + if (!section.movable()) { return; } @@ -1811,7 +1811,7 @@ TempoMarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) Drag::start_grab (event, cursor); - _pointer_frame_offset = _grab_frame - _marker->tempo().frame(); + _pointer_frame_offset = _grab_frame - _marker->tempo().frame(); _editor->show_verbose_time_cursor (_current_pointer_frame, 10); } @@ -1819,15 +1819,15 @@ void TempoMarkerDrag::motion (GdkEvent* event, bool) { nframes64_t const adjusted_frame = adjusted_current_frame (event); - + if (adjusted_frame == _last_pointer_frame) { return; } /* OK, we've moved far enough to make it worth actually move the thing. */ - + _marker->set_position (adjusted_frame); - + _editor->show_verbose_time_cursor (adjusted_frame, 10); _last_pointer_frame = adjusted_frame; @@ -1839,11 +1839,11 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred) if (!movement_occurred) { return; } - + motion (event, false); - + BBT_Time when; - + TempoMap& map (_editor->session->tempo_map()); map.bbt_time (_last_pointer_frame, when); @@ -1854,7 +1854,7 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred) XMLNode &after = map.get_state(); _editor->session->add_command (new MementoCommand<TempoMap>(map, &before, &after)); _editor->commit_reversible_command (); - + // delete the dummy marker we used for visual representation of copying. // a new visual marker will show up automatically. delete _marker; @@ -1883,7 +1883,7 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c) Drag::start_grab (event, c); if (!_stop) { - + nframes64_t where = _editor->event_frame (event, 0, 0); _editor->snap_to_with_modifier (where, event); @@ -1935,21 +1935,21 @@ CursorDrag::finished (GdkEvent* event, bool movement_occurred) if (!movement_occurred && _stop) { return; } - + motion (event, false); - + if (_item == &_editor->playhead_cursor->canvas_item) { if (_editor->session) { _editor->session->request_locate (_editor->playhead_cursor->current_frame, _was_rolling); _editor->_pending_locate_request = true; } - } + } } FadeInDrag::FadeInDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v) : RegionDrag (e, i, p, v) { - + } void @@ -1959,8 +1959,8 @@ FadeInDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) AudioRegionView* a = dynamic_cast<AudioRegionView*> (_primary); boost::shared_ptr<AudioRegion> const r = a->audio_region (); - - _pointer_frame_offset = _grab_frame - ((nframes64_t) r->fade_in()->back()->when + r->position()); + + _pointer_frame_offset = _grab_frame - ((nframes64_t) r->fade_in()->back()->when + r->position()); } void @@ -1969,7 +1969,7 @@ FadeInDrag::motion (GdkEvent* event, bool) nframes64_t fade_length; nframes64_t const pos = adjusted_current_frame (event); - + boost::shared_ptr<Region> region = _primary->region (); if (pos < (region->position() + 64)) { @@ -1978,16 +1978,16 @@ FadeInDrag::motion (GdkEvent* event, bool) fade_length = region->length(); } else { fade_length = pos - region->position(); - } + } for (RegionSelection::iterator i = _views.begin(); i != _views.end(); ++i) { AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*i); - + if (!tmp) { continue; } - + tmp->reset_fade_in_shape_width (fade_length); } @@ -2004,7 +2004,7 @@ FadeInDrag::finished (GdkEvent* event, bool movement_occurred) nframes64_t fade_length; nframes64_t const pos = adjusted_current_frame (event); - + boost::shared_ptr<Region> region = _primary->region (); if (pos < (region->position() + 64)) { @@ -2014,23 +2014,23 @@ FadeInDrag::finished (GdkEvent* event, bool movement_occurred) } else { fade_length = pos - region->position(); } - + _editor->begin_reversible_command (_("change fade in length")); for (RegionSelection::iterator i = _views.begin(); i != _views.end(); ++i) { AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*i); - + if (!tmp) { continue; } - + boost::shared_ptr<AutomationList> alist = tmp->audio_region()->fade_in(); XMLNode &before = alist->get_state(); tmp->audio_region()->set_fade_in_length (fade_length); tmp->audio_region()->set_fade_in_active (true); - + XMLNode &after = alist->get_state(); _editor->session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after)); } @@ -2041,7 +2041,7 @@ FadeInDrag::finished (GdkEvent* event, bool movement_occurred) FadeOutDrag::FadeOutDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v) : RegionDrag (e, i, p, v) { - + } void @@ -2051,7 +2051,7 @@ FadeOutDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) AudioRegionView* a = dynamic_cast<AudioRegionView*> (_primary); boost::shared_ptr<AudioRegion> r = a->audio_region (); - + _pointer_frame_offset = _grab_frame - (r->length() - (nframes64_t) r->fade_out()->back()->when + r->position()); } @@ -2063,7 +2063,7 @@ FadeOutDrag::motion (GdkEvent* event, bool) nframes64_t const pos = adjusted_current_frame (event); boost::shared_ptr<Region> region = _primary->region (); - + if (pos > (region->last_frame() - 64)) { fade_length = 64; // this should really be a minimum fade defined somewhere } @@ -2073,15 +2073,15 @@ FadeOutDrag::motion (GdkEvent* event, bool) else { fade_length = region->last_frame() - pos; } - + for (RegionSelection::iterator i = _views.begin(); i != _views.end(); ++i) { AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*i); - + if (!tmp) { continue; } - + tmp->reset_fade_out_shape_width (fade_length); } @@ -2116,14 +2116,14 @@ FadeOutDrag::finished (GdkEvent* event, bool movement_occurred) for (RegionSelection::iterator i = _views.begin(); i != _views.end(); ++i) { AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*i); - + if (!tmp) { continue; } - + boost::shared_ptr<AutomationList> alist = tmp->audio_region()->fade_out(); XMLNode &before = alist->get_state(); - + tmp->audio_region()->set_fade_out_length (fade_length); tmp->audio_region()->set_fade_out_active (true); @@ -2162,13 +2162,13 @@ void MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) { Drag::start_grab (event, cursor); - + bool is_start; Location *location = _editor->find_location_from_marker (_marker, is_start); _editor->_dragging_edit_point = true; - _pointer_frame_offset = _grab_frame - (is_start ? location->start() : location->end()); + _pointer_frame_offset = _grab_frame - (is_start ? location->start() : location->end()); update_item (location); @@ -2248,8 +2248,8 @@ MarkerDrag::motion (GdkEvent* event, bool) nframes64_t const newframe = adjusted_current_frame (event); nframes64_t next = newframe; - - if (_current_pointer_frame == _last_pointer_frame) { + + if (_current_pointer_frame == _last_pointer_frame) { return; } @@ -2262,8 +2262,8 @@ MarkerDrag::motion (GdkEvent* event, bool) /* find the marker we're dragging, and compute the delta */ - for (i = _editor->selection->markers.begin(), x = _copied_locations.begin(); - x != _copied_locations.end() && i != _editor->selection->markers.end(); + for (i = _editor->selection->markers.begin(), x = _copied_locations.begin(); + x != _copied_locations.end() && i != _editor->selection->markers.end(); ++i, ++x) { copy_location = *x; @@ -2309,19 +2309,19 @@ MarkerDrag::motion (GdkEvent* event, bool) /* now move them all */ - for (i = _editor->selection->markers.begin(), x = _copied_locations.begin(); - x != _copied_locations.end() && i != _editor->selection->markers.end(); + for (i = _editor->selection->markers.begin(), x = _copied_locations.begin(); + x != _copied_locations.end() && i != _editor->selection->markers.end(); ++i, ++x) { copy_location = *x; marker = *i; /* call this to find out if its the start or end */ - + if ((real_location = _editor->find_location_from_marker (marker, is_start)) == 0) { continue; } - + if (real_location->locked()) { continue; } @@ -2329,29 +2329,29 @@ MarkerDrag::motion (GdkEvent* event, bool) if (copy_location->is_mark()) { /* just move it */ - + copy_location->set_start (copy_location->start() + f_delta); } else { - + nframes64_t new_start = copy_location->start() + f_delta; nframes64_t new_end = copy_location->end() + f_delta; - + if (is_start) { // start-of-range marker - + if (move_both) { copy_location->set_start (new_start); copy_location->set_end (new_end); } else if (new_start < copy_location->end()) { copy_location->set_start (new_start); - } else { + } else { _editor->snap_to (next, 1, true); copy_location->set_end (next); copy_location->set_start (newframe); } - + } else { // end marker - + if (move_both) { copy_location->set_end (new_end); copy_location->set_start (new_start); @@ -2410,12 +2410,12 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred) case Selection::Add: break; } - + return; } _editor->_dragging_edit_point = false; - + _editor->begin_reversible_command ( _("move marker") ); XMLNode &before = _editor->session->locations()->get_state(); @@ -2423,18 +2423,18 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred) list<Location*>::iterator x; bool is_start; - for (i = _editor->selection->markers.begin(), x = _copied_locations.begin(); - x != _copied_locations.end() && i != _editor->selection->markers.end(); + for (i = _editor->selection->markers.begin(), x = _copied_locations.begin(); + x != _copied_locations.end() && i != _editor->selection->markers.end(); ++i, ++x) { - + Location * location = _editor->find_location_from_marker (*i, is_start); - + if (location) { - + if (location->locked()) { return; } - + if (location->is_mark()) { location->set_start ((*x)->start()); } else { @@ -2446,7 +2446,7 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred) XMLNode &after = _editor->session->locations()->get_state(); _editor->session->add_command(new MementoCommand<Locations>(*(_editor->session->locations()), &before, &after)); _editor->commit_reversible_command (); - + _line->hide(); } @@ -2488,7 +2488,7 @@ ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/) _point->line().start_drag (_point, _grab_frame, 0); float fraction = 1.0 - (_point->get_y() / _point->line().height()); - _editor->set_verbose_canvas_cursor (_point->line().get_verbose_cursor_string (fraction), + _editor->set_verbose_canvas_cursor (_point->line().get_verbose_cursor_string (fraction), _current_pointer_x + 10, _current_pointer_y + 10); _editor->show_verbose_canvas_cursor (); @@ -2548,7 +2548,7 @@ ControlPointDrag::motion (GdkEvent* event, bool) bool const push = Keyboard::modifier_state_contains (event->button.state, Keyboard::PrimaryModifier); _point->line().point_drag (*_point, cx_frames, fraction, push); - + _editor->set_verbose_canvas_cursor_text (_point->line().get_verbose_cursor_string (fraction)); } @@ -2558,7 +2558,7 @@ ControlPointDrag::finished (GdkEvent* event, bool movement_occurred) if (!movement_occurred) { /* just a click */ - + if ((event->type == GDK_BUTTON_RELEASE) && (event->button.button == 1) && Keyboard::modifier_state_equals (event->button.state, Keyboard::TertiaryModifier)) { _editor->reset_point_selection (); } @@ -2622,10 +2622,10 @@ LineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/) double fraction = 1.0 - (cy / _line->height()); _line->start_drag (0, _grab_frame, fraction); - + _editor->set_verbose_canvas_cursor (_line->get_verbose_cursor_string (fraction), _current_pointer_x + 10, _current_pointer_y + 10); - + _editor->show_verbose_canvas_cursor (); } @@ -2633,7 +2633,7 @@ void LineDrag::motion (GdkEvent* event, bool) { double dy = _current_pointer_y - _last_pointer_y; - + if (event->button.state & Keyboard::SecondaryModifier) { dy *= 0.1; } @@ -2656,7 +2656,7 @@ LineDrag::motion (GdkEvent* event, bool) } _line->line_drag (_before, _after, fraction, push); - + _editor->set_verbose_canvas_cursor_text (_line->get_verbose_cursor_string (fraction)); } @@ -2691,7 +2691,7 @@ RubberbandSelectDrag::motion (GdkEvent* event, bool first_move) if (Config->get_rubberbanding_snaps_to_grid()) { if (first_move) { _editor->snap_to_with_modifier (_grab_frame, event); - } + } _editor->snap_to_with_modifier (_current_pointer_frame, event); } @@ -2713,12 +2713,12 @@ RubberbandSelectDrag::motion (GdkEvent* event, bool first_move) y1 = _grab_y; } - + if (start != end || y1 != y2) { double x1 = _editor->frame_to_pixel (start); double x2 = _editor->frame_to_pixel (end); - + _editor->rubberband_rect->property_x1() = x1; _editor->rubberband_rect->property_y1() = y1; _editor->rubberband_rect->property_x2() = x2; @@ -2726,7 +2726,7 @@ RubberbandSelectDrag::motion (GdkEvent* event, bool first_move) _editor->rubberband_rect->show(); _editor->rubberband_rect->raise_to_top(); - + _last_pointer_frame = _current_pointer_frame; _editor->show_verbose_time_cursor (_current_pointer_frame, 10); @@ -2759,12 +2759,12 @@ RubberbandSelectDrag::finished (GdkEvent* event, bool movement_occurred) committed = _editor->select_all_within (_grab_frame, _last_pointer_frame - 1, y1, y2, _editor->track_views, op); } else { committed = _editor->select_all_within (_last_pointer_frame, _grab_frame - 1, y1, y2, _editor->track_views, op); - } + } if (!committed) { _editor->commit_reversible_command (); } - + } else { if (!getenv("ARDOUR_SAE")) { _editor->selection->clear_tracks(); @@ -2781,7 +2781,7 @@ void TimeFXDrag::start_grab (GdkEvent* event, Gdk::Cursor *) { Drag::start_grab (event); - + _editor->show_verbose_time_cursor (_current_pointer_frame, 10); } @@ -2818,22 +2818,22 @@ TimeFXDrag::finished (GdkEvent* /*event*/, bool movement_occurred) /* backwards drag of the left edge - not usable */ return; } - + nframes64_t newlen = _last_pointer_frame - _primary->region()->position(); float percentage = (double) newlen / (double) _primary->region()->length(); - + #ifndef USE_RUBBERBAND - // Soundtouch uses percentage / 100 instead of normal (/ 1) + // Soundtouch uses percentage / 100 instead of normal (/ 1) if (_primary->region()->data_type() == DataType::AUDIO) { percentage = (float) ((double) newlen - (double) _primary->region()->length()) / ((double) newlen) * 100.0f; } -#endif - +#endif + _editor->begin_reversible_command (_("timestretch")); - + // XXX how do timeFX on multiple regions ? - + RegionSelection rs; rs.add (_primary); @@ -2860,7 +2860,7 @@ ScrubDrag::finished (GdkEvent* /*event*/, bool movement_occurred) if (movement_occurred && _editor->session) { /* make sure we stop */ _editor->session->request_transport_speed (0.0); - } + } } SelectionDrag::SelectionDrag (Editor* e, ArdourCanvas::Item* i, Operation o) @@ -2897,13 +2897,13 @@ SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*) case SelectionStartTrim: if (_editor->clicked_axisview) { _editor->clicked_axisview->order_selection_trims (_item, true); - } + } Drag::start_grab (event, cursor); cursor = _editor->trimmer_cursor; start = _editor->selection->time[_editor->clicked_selection].start; - _pointer_frame_offset = _grab_frame - start; + _pointer_frame_offset = _grab_frame - start; break; - + case SelectionEndTrim: if (_editor->clicked_axisview) { _editor->clicked_axisview->order_selection_trims (_item, false); @@ -2911,20 +2911,20 @@ SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*) Drag::start_grab (event, cursor); cursor = _editor->trimmer_cursor; end = _editor->selection->time[_editor->clicked_selection].end; - _pointer_frame_offset = _grab_frame - end; + _pointer_frame_offset = _grab_frame - end; break; case SelectionMove: start = _editor->selection->time[_editor->clicked_selection].start; Drag::start_grab (event, cursor); - _pointer_frame_offset = _grab_frame - start; + _pointer_frame_offset = _grab_frame - start; break; } if (_operation == SelectionMove) { - _editor->show_verbose_time_cursor (start, 10); + _editor->show_verbose_time_cursor (start, 10); } else { - _editor->show_verbose_time_cursor (_current_pointer_frame, 10); + _editor->show_verbose_time_cursor (_current_pointer_frame, 10); } } @@ -2936,22 +2936,22 @@ SelectionDrag::motion (GdkEvent* event, bool first_move) nframes64_t length; nframes64_t const pending_position = adjusted_current_frame (event); - - /* only alter selection if the current frame is + + /* only alter selection if the current frame is different from the last frame position (adjusted) */ - + if (pending_position == _last_pointer_frame) { return; } - + switch (_operation) { case CreateSelection: - + if (first_move) { _editor->snap_to (_grab_frame); } - + if (pending_position < _grab_frame) { start = pending_position; end = _grab_frame; @@ -2959,15 +2959,15 @@ SelectionDrag::motion (GdkEvent* event, bool first_move) end = pending_position; start = _grab_frame; } - + /* first drag: Either add to the selection or create a new selection-> */ - + if (first_move) { - + _editor->begin_reversible_command (_("range selection")); - + if (_copy) { /* adding to the selection */ _editor->clicked_selection = _editor->selection->add (start, end); @@ -2976,15 +2976,15 @@ SelectionDrag::motion (GdkEvent* event, bool first_move) /* new selection-> */ _editor->clicked_selection = _editor->selection->set (_editor->clicked_axisview, start, end); } - } + } break; - + case SelectionStartTrim: - + if (first_move) { _editor->begin_reversible_command (_("trim selection start")); } - + start = _editor->selection->time[_editor->clicked_selection].start; end = _editor->selection->time[_editor->clicked_selection].end; @@ -2994,13 +2994,13 @@ SelectionDrag::motion (GdkEvent* event, bool first_move) start = pending_position; } break; - + case SelectionEndTrim: - + if (first_move) { _editor->begin_reversible_command (_("trim selection end")); } - + start = _editor->selection->time[_editor->clicked_selection].start; end = _editor->selection->time[_editor->clicked_selection].end; @@ -3009,28 +3009,28 @@ SelectionDrag::motion (GdkEvent* event, bool first_move) } else { end = pending_position; } - + break; - + case SelectionMove: - + if (first_move) { _editor->begin_reversible_command (_("move selection")); } - + start = _editor->selection->time[_editor->clicked_selection].start; end = _editor->selection->time[_editor->clicked_selection].end; - + length = end - start; - + start = pending_position; _editor->snap_to (start); - + end = start + length; - + break; } - + if (event->button.x >= _editor->horizontal_adjustment.get_value() + _editor->_canvas_width) { _editor->start_canvas_autoscroll (1, 0); } @@ -3042,9 +3042,9 @@ SelectionDrag::motion (GdkEvent* event, bool first_move) _last_pointer_frame = pending_position; if (_operation == SelectionMove) { - _editor->show_verbose_time_cursor(start, 10); + _editor->show_verbose_time_cursor(start, 10); } else { - _editor->show_verbose_time_cursor(pending_position, 10); + _editor->show_verbose_time_cursor(pending_position, 10); } } @@ -3065,7 +3065,7 @@ SelectionDrag::finished (GdkEvent* event, bool movement_occurred) _editor->selection->clear_time(); - } + } } /* XXX what happens if its a music selection? */ @@ -3097,12 +3097,12 @@ RangeMarkerBarDrag::start_grab (GdkEvent* event, Gdk::Cursor *) if (!_editor->temp_location) { _editor->temp_location = new Location; } - + switch (_operation) { case CreateRangeMarker: case CreateTransportMarker: case CreateCDMarker: - + if (Keyboard::modifier_state_equals (event->button.state, Keyboard::TertiaryModifier)) { _copy = true; } else { @@ -3114,7 +3114,7 @@ RangeMarkerBarDrag::start_grab (GdkEvent* event, Gdk::Cursor *) Drag::start_grab (event, cursor); - _editor->show_verbose_time_cursor (_current_pointer_frame, 10); + _editor->show_verbose_time_cursor (_current_pointer_frame, 10); } void @@ -3139,17 +3139,17 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move) return; break; } - + _editor->snap_to_with_modifier (_current_pointer_frame, event); - /* only alter selection if the current frame is + /* only alter selection if the current frame is different from the last frame position. */ - + if (_current_pointer_frame == _last_pointer_frame) { return; } - + switch (_operation) { case CreateRangeMarker: case CreateTransportMarker: @@ -3157,7 +3157,7 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move) if (first_move) { _editor->snap_to (_grab_frame); } - + if (_current_pointer_frame < _grab_frame) { start = _current_pointer_frame; end = _grab_frame; @@ -3165,29 +3165,29 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move) end = _current_pointer_frame; start = _grab_frame; } - + /* first drag: Either add to the selection or create a new selection. */ - + if (first_move) { - + _editor->temp_location->set (start, end); - + crect->show (); update_item (_editor->temp_location); _drag_rect->show(); //_drag_rect->raise_to_top(); - - } - break; + + } + break; } - + if (event->button.x >= _editor->horizontal_adjustment.get_value() + _editor->_canvas_width) { _editor->start_canvas_autoscroll (1, 0); } - + if (start != end) { _editor->temp_location->set (start, end); @@ -3201,8 +3201,8 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move) _last_pointer_frame = _current_pointer_frame; - _editor->show_verbose_time_cursor (_current_pointer_frame, 10); - + _editor->show_verbose_time_cursor (_current_pointer_frame, 10); + } void @@ -3211,7 +3211,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred) Location * newloc = 0; string rangename; int flags; - + if (movement_occurred) { motion (event, false); _drag_rect->hide(); @@ -3254,7 +3254,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred) start = _editor->session->locations()->first_mark_before (_grab_frame); end = _editor->session->locations()->first_mark_after (_grab_frame); - + if (end == max_frames) { end = _editor->session->current_end_frame (); } @@ -3277,7 +3277,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred) default: break; } - } + } } _editor->stop_canvas_autoscroll (); @@ -3309,11 +3309,11 @@ MouseZoomDrag::motion (GdkEvent* event, bool first_move) nframes64_t end; _editor->snap_to_with_modifier (_current_pointer_frame, event); - + if (first_move) { _editor->snap_to_with_modifier (_grab_frame, event); } - + if (_current_pointer_frame == _last_pointer_frame) { return; } @@ -3326,7 +3326,7 @@ MouseZoomDrag::motion (GdkEvent* event, bool first_move) end = _current_pointer_frame; start = _grab_frame; } - + if (start != end) { if (first_move) { @@ -3347,12 +3347,12 @@ MouseZoomDrag::finished (GdkEvent* event, bool movement_occurred) { if (movement_occurred) { motion (event, false); - + if (_grab_frame < _last_pointer_frame) { _editor->temporal_zoom_by_frame (_grab_frame, _last_pointer_frame, "mouse zoom"); } else { _editor->temporal_zoom_by_frame (_last_pointer_frame, _grab_frame, "mouse zoom"); - } + } } else { _editor->temporal_zoom_to_frame (false, _grab_frame); /* @@ -3367,7 +3367,7 @@ MouseZoomDrag::finished (GdkEvent* event, bool movement_occurred) NoteDrag::NoteDrag (Editor* e, ArdourCanvas::Item* i) : Drag (e, i) { - CanvasNoteEvent* cnote = dynamic_cast<CanvasNoteEvent*>(_item); + CanvasNoteEvent* cnote = dynamic_cast<CanvasNoteEvent*>(_item); region = &cnote->region_view(); } @@ -3387,10 +3387,10 @@ NoteDrag::start_grab (GdkEvent* event, Gdk::Cursor *) _item->property_parent().get_value()->w2i(event_x, event_y); - last_x = region->snap_to_pixel(event_x); + last_x = region->snap_to_pixel(event_x); last_y = event_y; - CanvasNoteEvent* cnote = dynamic_cast<CanvasNoteEvent*>(_item); + CanvasNoteEvent* cnote = dynamic_cast<CanvasNoteEvent*>(_item); if (!(was_selected = cnote->selected())) { @@ -3425,12 +3425,12 @@ NoteDrag::motion (GdkEvent*, bool) _item->property_parent().get_value()->w2i(event_x, event_y); - event_x = region->snap_to_pixel(event_x); + event_x = region->snap_to_pixel(event_x); double dx = event_x - last_x; double dy = event_y - last_y; last_x = event_x; - + drag_delta_x += dx; // Snap to note rows @@ -3451,7 +3451,7 @@ NoteDrag::motion (GdkEvent*, bool) if (dx || dy) { region->move_selection (dx, dy); - + CanvasNoteEvent* cnote = dynamic_cast<CanvasNoteEvent*>(_item); char buf[4]; snprintf (buf, sizeof (buf), "%g", (int) cnote->note()->note() + drag_delta_note); @@ -3459,7 +3459,7 @@ NoteDrag::motion (GdkEvent*, bool) _editor->show_verbose_canvas_cursor_with (buf); } } - + void NoteDrag::finished (GdkEvent* ev, bool moved) { @@ -3467,7 +3467,7 @@ NoteDrag::finished (GdkEvent* ev, bool moved) if (!moved) { if (_editor->current_mouse_mode() == Editing::MouseObject) { - + if (was_selected) { bool add = Keyboard::modifier_state_equals (ev->button.state, Keyboard::PrimaryModifier); if (add) { diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index c10034c835..ae504dbef5 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ class TimeAxisView; /** Abstract base class for dragging of things within the editor */ class Drag { - + public: Drag (Editor *, ArdourCanvas::Item *); virtual ~Drag () {} @@ -116,7 +116,7 @@ public: protected: nframes64_t adjusted_current_frame (GdkEvent *) const; - + Editor* _editor; ///< our editor ArdourCanvas::Item* _item; ///< our item nframes64_t _pointer_frame_offset; ///< offset from the mouse's position for the drag @@ -138,7 +138,7 @@ protected: bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false private: - + bool _ending; ///< true if end_grab is in progress, otherwise false bool _had_movement; ///< true if movement has occurred, otherwise false bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false @@ -153,7 +153,7 @@ public: virtual ~RegionDrag () {} protected: - + RegionView* _primary; ///< the view that was clicked on (or whatever) to start the drag std::list<RegionView*> _views; ///< all views that are being dragged @@ -166,7 +166,7 @@ private: class RegionMotionDrag : public RegionDrag { public: - + RegionMotionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool); virtual ~RegionMotionDrag () {} @@ -177,13 +177,13 @@ public: protected: struct TimeAxisViewSummary { TimeAxisViewSummary () : height_list(512) {} - + std::bitset<512> tracks; std::vector<int32_t> height_list; int visible_y_low; int visible_y_high; }; - + void copy_regions (GdkEvent *); bool y_movement_disallowed (int, int, int, TimeAxisViewSummary const &) const; std::map<RegionView*, std::pair<RouteTimeAxisView*, int> > find_time_axis_views_and_layers (); @@ -195,7 +195,7 @@ protected: TimeAxisViewSummary get_time_axis_view_summary (); virtual bool x_move_allowed () const = 0; - + TimeAxisView* _dest_trackview; ARDOUR::layer_t _dest_layer; bool check_possible (RouteTimeAxisView **, ARDOUR::layer_t *); @@ -215,7 +215,7 @@ public: virtual void start_grab (GdkEvent *, Gdk::Cursor *); void motion (GdkEvent *, bool); void finished (GdkEvent *, bool); - + bool apply_move_threshold () const { return true; } @@ -233,7 +233,7 @@ public: RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, nframes64_t); void finished (GdkEvent *, bool); - + private: bool x_move_allowed () const; }; @@ -281,7 +281,7 @@ private: class NoteDrag : public Drag { - public: + public: NoteDrag (Editor*, ArdourCanvas::Item*); void start_grab (GdkEvent *, Gdk::Cursor* c = 0); @@ -383,7 +383,7 @@ public: private: EditorCursor* _cursor; ///< cursor being dragged bool _stop; ///< true to stop the transport on starting the drag, otherwise false - + }; /** Region fade-in drag */ @@ -421,7 +421,7 @@ public: private: void update_item (ARDOUR::Location *); - + Marker* _marker; ///< marker being dragged std::list<ARDOUR::Location*> _copied_locations; ArdourCanvas::Line* _line; @@ -441,7 +441,7 @@ public: bool active (Editing::MouseMode m); private: - + ControlPoint* _point; double _cumulative_x_drag; double _cumulative_y_drag; @@ -457,7 +457,7 @@ public: void start_grab (GdkEvent *, Gdk::Cursor* c = 0); void motion (GdkEvent *, bool); void finished (GdkEvent *, bool); - + bool active (Editing::MouseMode) { return true; } @@ -497,7 +497,7 @@ class ScrubDrag : public Drag { public: ScrubDrag (Editor *e, ArdourCanvas::Item *i) : Drag (e, i) {} - + void start_grab (GdkEvent *, Gdk::Cursor* c = 0); void motion (GdkEvent *, bool); void finished (GdkEvent *, bool); diff --git a/gtk2_ardour/editor_enums.h b/gtk2_ardour/editor_enums.h index d665e8ea11..fe3b3b909a 100644 --- a/gtk2_ardour/editor_enums.h +++ b/gtk2_ardour/editor_enums.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc index ca73c4d8b0..82b98c7650 100644 --- a/gtk2_ardour/editor_export_audio.cc +++ b/gtk2_ardour/editor_export_audio.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -94,18 +94,18 @@ Editor::export_region () if (selection->regions.empty()) { return; } - + try { boost::shared_ptr<Region> r = selection->regions.front()->region(); AudioRegion & region (dynamic_cast<AudioRegion &> (*r)); - + RouteTimeAxisView & rtv (dynamic_cast<RouteTimeAxisView &> (selection->regions.front()->get_time_axis_view())); AudioTrack & track (dynamic_cast<AudioTrack &> (*rtv.route())); - + ExportRegionDialog dialog (*this, region, track); dialog.set_session (session); dialog.run(); - + } catch (std::bad_cast & e) { error << "Exporting Region failed!" << endmsg; return; @@ -130,7 +130,7 @@ void Editor::bounce_region_selection () { for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) { - + boost::shared_ptr<Region> region ((*i)->region()); RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(&(*i)->get_time_axis_view()); Track* track = dynamic_cast<Track*>(rtv->route().get()); @@ -167,7 +167,7 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region) const string sound_directory = session->session_directory().sound_path().to_string(); nchans = region->n_channels(); - + /* don't do duplicate of the entire source if that's what is going on here */ if (region->start() == 0 && region->length() == region->source_length(0)) { @@ -178,7 +178,7 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region) if (path.length() == 0) { for (uint32_t n=0; n < nchans; ++n) { - + for (cnt = 0; cnt < 999999; ++cnt) { if (nchans == 1) { snprintf (s, sizeof(s), "%s/%s_%" PRIu32 ".wav", sound_directory.c_str(), @@ -190,26 +190,26 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region) } path = s; - + if (::access (path.c_str(), F_OK) != 0) { break; } } - + if (cnt == 999999) { error << "" << endmsg; goto error_out; } - - - + + + try { fs = boost::dynamic_pointer_cast<AudioFileSource> ( SourceFactory::createWritable (DataType::AUDIO, *session, path, true, false, session->frame_rate())); } - + catch (failed_constructor& err) { goto error_out; } @@ -221,7 +221,7 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region) /* TODO: make filesources based on passed path */ } - + to_read = region->length(); pos = region->position(); @@ -231,13 +231,13 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region) this_time = min (to_read, chunk_size); for (vector<boost::shared_ptr<AudioFileSource> >::iterator src=sources.begin(); src != sources.end(); ++src) { - + fs = (*src); if (region->read_at (buf, buf, gain_buffer, pos, this_time) != this_time) { break; } - + if (fs->write (buf, this_time) != this_time) { error << "" << endmsg; goto error_out; @@ -252,7 +252,7 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region) struct tm* now; time (&tnow); now = localtime (&tnow); - + for (vector<boost::shared_ptr<AudioFileSource> >::iterator src = sources.begin(); src != sources.end(); ++src) { (*src)->update_header (0, *now, tnow); (*src)->mark_immutable (); @@ -289,7 +289,7 @@ Editor::write_audio_selection (TimeSelection& ts) if (atv->is_audio_track()) { boost::shared_ptr<AudioPlaylist> playlist = boost::dynamic_pointer_cast<AudioPlaylist>(atv->get_diskstream()->playlist()); - + if (playlist && write_audio_range (*playlist, atv->get_diskstream()->n_channels(), ts) == 0) { ret = -1; break; @@ -319,7 +319,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list uint32_t channels = count.n_audio(); for (uint32_t n=0; n < channels; ++n) { - + for (cnt = 0; cnt < 999999; ++cnt) { if (channels == 1) { snprintf (s, sizeof(s), "%s/%s_%" PRIu32 ".wav", sound_directory.c_str(), @@ -329,69 +329,69 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list snprintf (s, sizeof(s), "%s/%s_%" PRIu32 "-%" PRId32 ".wav", sound_directory.c_str(), legalize_for_path(playlist.name()).c_str(), cnt, n); } - + if (::access (s, F_OK) != 0) { break; } } - + if (cnt == 999999) { error << "" << endmsg; goto error_out; } path = s; - + try { fs = boost::dynamic_pointer_cast<AudioFileSource> ( SourceFactory::createWritable (DataType::AUDIO, *session, path, true, false, session->frame_rate())); } - + catch (failed_constructor& err) { goto error_out; } - + sources.push_back (fs); } - + for (list<AudioRange>::iterator i = range.begin(); i != range.end();) { - + nframes = (*i).length(); pos = (*i).start; - + while (nframes) { nframes64_t this_time; - + this_time = min (nframes, chunk_size); for (uint32_t n=0; n < channels; ++n) { fs = sources[n]; - + if (playlist.read (buf, buf, gain_buffer, pos, this_time, n) != this_time) { break; } - + if (fs->write (buf, this_time) != this_time) { goto error_out; } } - + nframes -= this_time; pos += this_time; } - + list<AudioRange>::iterator tmp = i; ++tmp; if (tmp != range.end()) { - + /* fill gaps with silence */ - + nframes = (*tmp).start - (*i).end; while (nframes) { @@ -424,7 +424,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list (*s)->mark_immutable (); // do we need to ref it again? } - + return true; error_out: diff --git a/gtk2_ardour/editor_group_tabs.cc b/gtk2_ardour/editor_group_tabs.cc index 7007c37a05..61f3c50735 100644 --- a/gtk2_ardour/editor_group_tabs.cc +++ b/gtk2_ardour/editor_group_tabs.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ using namespace ARDOUR; EditorGroupTabs::EditorGroupTabs (Editor* e) : GroupTabs (e) { - + } list<GroupTabs::Tab> @@ -48,7 +48,7 @@ EditorGroupTabs::compute_tabs () const if ((*i)->marked_for_display() == false) { continue; } - + RouteGroup* g = (*i)->route_group (); if (g != tab.group) { @@ -85,7 +85,7 @@ EditorGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const } else { cairo_set_source_rgba (cr, 1, 1, 1, 0.2); } - + cairo_move_to (cr, 0, tab.from + arc_radius); cairo_arc (cr, _width, tab.from + arc_radius, arc_radius, M_PI, 3 * M_PI / 2); cairo_line_to (cr, _width, tab.to); @@ -116,7 +116,7 @@ void EditorGroupTabs::reflect_tabs (list<Tab> const & tabs) { list<Tab>::const_iterator j = tabs.begin (); - + int32_t y = 0; for (Editor::TrackViewList::iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) { @@ -128,12 +128,12 @@ EditorGroupTabs::reflect_tabs (list<Tab> const & tabs) if (rtv) { if (j == tabs.end()) { - + /* already run out of tabs, so no edit group */ rtv->route()->set_route_group (0, this); - + } else { - + if (y >= j->to) { /* this tab finishes before this track starts, so onto the next tab */ ++j; @@ -146,7 +146,7 @@ EditorGroupTabs::reflect_tabs (list<Tab> const & tabs) } else { rtv->route()->set_route_group (0, this); } - + } } diff --git a/gtk2_ardour/editor_group_tabs.h b/gtk2_ardour/editor_group_tabs.h index 9e37992902..2d1abcf46f 100644 --- a/gtk2_ardour/editor_group_tabs.h +++ b/gtk2_ardour/editor_group_tabs.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/editor_hscroller.cc b/gtk2_ardour/editor_hscroller.cc index f97b4610b6..802d635b2a 100644 --- a/gtk2_ardour/editor_hscroller.cc +++ b/gtk2_ardour/editor_hscroller.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/editor_imageframe.cc b/gtk2_ardour/editor_imageframe.cc index 4fee0c7062..d5d9481b5d 100644 --- a/gtk2_ardour/editor_imageframe.cc +++ b/gtk2_ardour/editor_imageframe.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2003 Paul Davis + Copyright (C) 2000-2003 Paul Davis Written by Colin Law, CMT, Glasgow This program is free software; you can redistribute it and/or modify @@ -50,7 +50,7 @@ TimeAxisView* Editor::get_named_time_axis(const string & name) { TimeAxisView* tav = 0 ; - + for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i) { if (((TimeAxisView*)*i)->name() == name) @@ -85,7 +85,7 @@ Editor::connect_to_image_compositor() { image_socket_listener = ImageFrameSocketHandler::create_instance(*this) ; } - + if(image_socket_listener->is_connected() == true) { return ; @@ -93,16 +93,16 @@ Editor::connect_to_image_compositor() // XXX should really put this somewhere safe const char * host_ip = "127.0.0.1" ; - + bool retcode = image_socket_listener->connect(host_ip, ardourvis::DEFAULT_PORT) ; - + if(retcode == false) { // XXX need to get some return status here warning << "Image Compositor Connection attempt failed" << std::endl ; return ; } - + // add the socket to the gui loop, and keep the retuned tag value of the input gint tag = gdk_input_add(image_socket_listener->get_socket_descriptor(), GDK_INPUT_READ,ImageFrameSocketHandler::image_socket_callback,image_socket_listener) ; image_socket_listener->set_gdk_input_tag(tag) ; @@ -122,7 +122,7 @@ Editor::scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) } else { x_pos = item->get_position() - offset + (item->get_duration() / 2); } - + reset_x_origin (x_pos); } @@ -139,11 +139,11 @@ void Editor::popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_item) { ImageFrameTimeAxis* ifta = dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview) ; - + if(ifta) { ImageFrameTimeAxisGroup* iftag = ifta->get_view()->get_selected_imageframe_group() ; - + if(iftag) { ImageFrameView* selected_ifv = ifta->get_view()->get_selected_imageframe_view() ; @@ -156,7 +156,7 @@ void Editor::popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_item) { MarkerTimeAxis* mta = dynamic_cast<MarkerTimeAxis*>(clicked_axisview) ; - + if(mta) { MarkerView* selected_mv = mta->get_view()->get_selected_time_axis_item() ; @@ -179,7 +179,7 @@ Editor::canvas_imageframe_item_view_event (GdkEvent *event, ArdourCanvas::Item* { gint ret = FALSE ; ImageFrameTimeAxisGroup* iftag = 0 ; - + switch (event->type) { case GDK_BUTTON_PRESS: @@ -207,7 +207,7 @@ Editor::canvas_imageframe_start_handle_event (GdkEvent *event, ArdourCanvas::Ite { gint ret = FALSE ; ImageFrameTimeAxisGroup* iftag = 0 ; - + switch (event->type) { case GDK_BUTTON_PRESS: @@ -216,7 +216,7 @@ Editor::canvas_imageframe_start_handle_event (GdkEvent *event, ArdourCanvas::Ite clicked_axisview = &ifv->get_time_axis_view() ; iftag = ifv->get_time_axis_group() ; dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview)->get_view()->set_selected_imageframe_view(iftag, ifv); - + ret = button_press_handler (item, event, ImageFrameHandleStartItem) ; break ; case GDK_BUTTON_RELEASE: @@ -242,7 +242,7 @@ Editor::canvas_imageframe_end_handle_event (GdkEvent *event, ArdourCanvas::Item* { gint ret = FALSE ; ImageFrameTimeAxisGroup* iftag = 0 ; - + switch (event->type) { case GDK_BUTTON_PRESS: @@ -251,7 +251,7 @@ Editor::canvas_imageframe_end_handle_event (GdkEvent *event, ArdourCanvas::Item* clicked_axisview = &ifv->get_time_axis_view() ; iftag = ifv->get_time_axis_group() ; dynamic_cast<ImageFrameTimeAxis*>(clicked_axisview)->get_view()->set_selected_imageframe_view(iftag, ifv); - + ret = button_press_handler (item, event, ImageFrameHandleEndItem) ; break ; case GDK_BUTTON_RELEASE: @@ -429,10 +429,10 @@ Editor::start_imageframe_grab(ArdourCanvas::Item* item, GdkEvent* event) drag_info.motion_callback = &Editor::imageframe_drag_motion_callback; drag_info.finished_callback = &Editor::timeaxis_item_drag_finished_callback; drag_info.last_frame_position = ifv->get_position() ; - + drag_info.source_trackview = &ifv->get_time_axis_view() ; drag_info.dest_trackview = drag_info.source_trackview; - + /* this is subtle. raising the regionview itself won't help, because raise_to_top() just puts the item on the top of its parent's stack. so, we need to put the trackview canvas_display group @@ -482,7 +482,7 @@ Editor::start_markerview_grab(ArdourCanvas::Item* item, GdkEvent* event) cursor_group->raise_to_top (); start_grab(event) ; - + drag_info.pointer_frame_offset = pixel_to_frame(drag_info.grab_x) - drag_info.last_frame_position ; } @@ -504,14 +504,14 @@ Editor::markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent* event) { pending_region_position = pointer_frame - drag_info.pointer_frame_offset ; snap_to(pending_region_position) ; - + // we dont allow marker items to extend beyond, or in front of the marked items so // cap the value to the marked items position and duration - if((pending_region_position + mv->get_duration()) >= ((mv->get_marked_item()->get_position()) + (mv->get_marked_item()->get_duration()))) + if((pending_region_position + mv->get_duration()) >= ((mv->get_marked_item()->get_position()) + (mv->get_marked_item()->get_duration()))) { pending_region_position = (mv->get_marked_item()->get_position() + mv->get_marked_item()->get_duration()) - (mv->get_duration()) ; } - else if(pending_region_position <= mv->get_marked_item()->get_position()) + else if(pending_region_position <= mv->get_marked_item()->get_position()) { pending_region_position = mv->get_marked_item()->get_position() ; } @@ -522,7 +522,7 @@ Editor::markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent* event) } drag_info.last_frame_position = pending_region_position ; - + // we treat this as a special case, usually we want to send the identitiy of the caller // but in this case, that would trigger our socket handler to handle the event, sending // notification to the image compositor. This would be fine, except that we have not @@ -538,9 +538,9 @@ void Editor::imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent* event) { double cx, cy ; - + ImageFrameView* ifv = reinterpret_cast<ImageFrameView*>(drag_info.data) ; - + nframes64_t pending_region_position; nframes64_t pointer_frame; @@ -561,7 +561,7 @@ Editor::imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent* event) drag_info.grab_x = cx; //drag_info.last_frame_position = pending_region_position ; drag_info.current_pointer_frame = pending_region_position ; - + // we treat this as a special case, usually we want to send the identitiy of the caller // but in this case, that would trigger our socket handler to handle the event, sending // notification to the image compositor. This would be fine, except that we have not @@ -569,7 +569,7 @@ Editor::imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent* event) // completed the drag, only then do we want the image compositor notofied. // We therefore set the caller identity to the special case of 0 ifv->set_position(pending_region_position, 0) ; - + show_verbose_time_cursor(pending_region_position) ; } @@ -598,7 +598,7 @@ Editor::timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent* even { /* base the new region position on the current position of the regionview.*/ where = drag_info.current_pointer_frame ; - + // final call to set position after the motion to tell interested parties of the new position tavi->set_position(where, this) ; } @@ -606,7 +606,7 @@ Editor::timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent* even { //where = tavi->get_position() ; } - + } @@ -632,9 +632,9 @@ Editor::imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) drag_info.cumulative_x_drag = 0; drag_info.motion_callback = &Editor::imageframe_start_handle_trim_motion ; drag_info.finished_callback = &Editor::imageframe_start_handle_end_trim ; - + start_grab(event) ; - + show_verbose_time_cursor(ifv->get_position(), 10) ; } } @@ -648,14 +648,14 @@ Editor::imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) if(ifta) { ImageFrameView* ifv = ifta->get_view()->get_selected_imageframe_view() ; - + if (ifv == 0) { fatal << _("programming error: no ImageFrameView selected") << endmsg ; /*NOTREACHED*/ return ; } - + drag_info.item = ifv->get_canvas_frame() ; drag_info.data = ifv ; drag_info.grab_x = event->motion.x ; @@ -673,11 +673,11 @@ void Editor::imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) { ImageFrameView* ifv = reinterpret_cast<ImageFrameView*> (drag_info.data) ; - + nframes64_t start = 0 ; nframes64_t end = 0 ; nframes64_t pointer_frame = event_frame(event) ; - + // chekc th eposition of the item is not locked if(!ifv->get_position_locked()) { snap_to(pointer_frame) ; @@ -685,18 +685,18 @@ Editor::imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* if(pointer_frame != drag_info.last_pointer_frame) { start = ifv->get_position() ; end = ifv->get_position() + ifv->get_duration() ; - + if (pointer_frame > end) { start = end ; } else { start = pointer_frame ; } - + // are we getting bigger or smaller? nframes64_t new_dur_val = end - start ; - + // start handle, so a smaller pointer frame increases our component size - if(pointer_frame <= drag_info.grab_frame) + if(pointer_frame <= drag_info.grab_frame) { if(ifv->get_max_duration_active() && (new_dur_val > ifv->get_max_duration())) { @@ -720,9 +720,9 @@ Editor::imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* // current values are ok } } - + drag_info.last_pointer_frame = pointer_frame ; - + /* re-calculatethe duration and position of the imageframeview */ drag_info.cumulative_x_drag = new_dur_val ; @@ -736,7 +736,7 @@ Editor::imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* ifv->set_position(start, 0) ; } } - + show_verbose_time_cursor(start, 10) ; } @@ -744,7 +744,7 @@ void Editor::imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) { ImageFrameView* ifv = reinterpret_cast<ImageFrameView *> (drag_info.data) ; - + if (drag_info.cumulative_x_drag == 0) { /* just a click */ @@ -752,7 +752,7 @@ Editor::imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* eve else { nframes64_t temp = ifv->get_position() + ifv->get_duration() ; - + ifv->set_position((nframes64_t) (temp - drag_info.cumulative_x_drag), this) ; ifv->set_duration((nframes64_t) drag_info.cumulative_x_drag, this) ; } @@ -762,14 +762,14 @@ void Editor::imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) { ImageFrameView* ifv = reinterpret_cast<ImageFrameView *> (drag_info.data) ; - + nframes64_t start = 0 ; nframes64_t end = 0 ; nframes64_t pointer_frame = event_frame(event) ; nframes64_t new_dur_val = 0 ; snap_to(pointer_frame) ; - + if (pointer_frame != drag_info.last_pointer_frame) { start = ifv->get_position() ; @@ -782,9 +782,9 @@ Editor::imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* ev { end = pointer_frame ; } - + new_dur_val = end - start ; - + // are we getting bigger or smaller? if(pointer_frame >= drag_info.last_pointer_frame) { @@ -800,10 +800,10 @@ Editor::imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* ev new_dur_val = ifv->get_min_duration() ; } } - + drag_info.last_pointer_frame = pointer_frame ; drag_info.cumulative_x_drag = new_dur_val ; - + // we treat this as a special case, usually we want to send the identitiy of the caller // but in this case, that would trigger our socket handler to handle the event, sending // notification to the image compositor. This would be fine, except that we have not @@ -812,7 +812,7 @@ Editor::imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* ev // We therefore set the caller identity to the special case of 0 ifv->set_duration(new_dur_val, 0) ; } - + show_verbose_time_cursor(new_dur_val, 10) ; } @@ -870,15 +870,15 @@ Editor::markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) /*NOTREACHED*/ return ; } - + drag_info.item = mv->get_canvas_frame() ; drag_info.data = mv ; drag_info.grab_x = event->motion.x ; drag_info.cumulative_x_drag = 0 ; - + drag_info.motion_callback = &Editor::markerview_end_handle_trim_motion ; drag_info.finished_callback = &Editor::markerview_end_handle_end_trim ; - + start_grab(event, trimmer_cursor) ; } @@ -887,11 +887,11 @@ void Editor::markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) { MarkerView* mv = reinterpret_cast<MarkerView*> (drag_info.data) ; - + nframes64_t start = 0 ; nframes64_t end = 0 ; nframes64_t pointer_frame = event_frame(event) ; - + // chekc th eposition of the item is not locked if(!mv->get_position_locked()) { @@ -900,7 +900,7 @@ Editor::markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* { start = mv->get_position() ; end = mv->get_position() + mv->get_duration() ; - + if (pointer_frame > end) { start = end ; @@ -909,10 +909,10 @@ Editor::markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* { start = pointer_frame ; } - + // are we getting bigger or smaller? nframes64_t new_dur_val = end - start ; - + if(pointer_frame <= drag_info.grab_frame) { if(mv->get_max_duration_active() && (new_dur_val > mv->get_max_duration())) @@ -937,12 +937,12 @@ Editor::markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* // current values are ok } } - + drag_info.last_pointer_frame = pointer_frame ; - + /* re-calculatethe duration and position of the imageframeview */ drag_info.cumulative_x_drag = new_dur_val ; - + // we treat this as a special case, usually we want to send the identitiy of the caller // but in this case, that would trigger our socket handler to handle the event, sending // notification to the image compositor. This would be fine, except that we have not @@ -953,7 +953,7 @@ Editor::markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* mv->set_position(start, 0) ; } } - + show_verbose_time_cursor(start, 10) ; } @@ -961,7 +961,7 @@ void Editor::markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) { MarkerView* mv = reinterpret_cast<MarkerView*> (drag_info.data) ; - + if (drag_info.cumulative_x_drag == 0) { /* just a click */ @@ -969,7 +969,7 @@ Editor::markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* eve else { nframes64_t temp = mv->get_position() + mv->get_duration() ; - + mv->set_position((nframes64_t) (temp - drag_info.cumulative_x_drag), this) ; mv->set_duration((nframes64_t) drag_info.cumulative_x_drag, this) ; } @@ -979,19 +979,19 @@ void Editor::markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) { MarkerView* mv = reinterpret_cast<MarkerView*> (drag_info.data) ; - + nframes64_t start = 0 ; nframes64_t end = 0 ; nframes64_t pointer_frame = event_frame(event) ; nframes64_t new_dur_val = 0 ; snap_to(pointer_frame) ; - + if (pointer_frame != drag_info.last_pointer_frame) { start = mv->get_position() ; end = mv->get_position() + mv->get_duration() ; - + if(pointer_frame < start) { end = start ; @@ -1000,16 +1000,16 @@ Editor::markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* ev { end = pointer_frame ; } - + new_dur_val = end - start ; - + // are we getting bigger or smaller? if(pointer_frame >= drag_info.last_pointer_frame) { // we cant extend beyond the item we are marking ImageFrameView* marked_item = mv->get_marked_item() ; nframes64_t marked_end = marked_item->get_position() + marked_item->get_duration() ; - + if(mv->get_max_duration_active() && (new_dur_val > mv->get_max_duration())) { if((start + mv->get_max_duration()) > marked_end) @@ -1037,7 +1037,7 @@ Editor::markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* ev drag_info.last_pointer_frame = pointer_frame ; drag_info.cumulative_x_drag = new_dur_val ; - + // we treat this as a special case, usually we want to send the identitiy of the caller // but in this case, that would trigger our socket handler to handle the event, sending // notification to the image compositor. This would be fine, except that we have not @@ -1046,7 +1046,7 @@ Editor::markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* ev // We therefore set the caller identity to the special case of 0 mv->set_duration(new_dur_val, 0) ; } - + show_verbose_time_cursor(new_dur_val, 10) ; } diff --git a/gtk2_ardour/editor_items.h b/gtk2_ardour/editor_items.h index 15e56a3313..44765ffe91 100644 --- a/gtk2_ardour/editor_items.h +++ b/gtk2_ardour/editor_items.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,9 +60,9 @@ enum ItemType { #endif CrossfadeViewItem, - + /* don't remove this */ - + NoItem }; diff --git a/gtk2_ardour/editor_keyboard.cc b/gtk2_ardour/editor_keyboard.cc index 69bfb3ba8a..977a7ec10c 100644 --- a/gtk2_ardour/editor_keyboard.cc +++ b/gtk2_ardour/editor_keyboard.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,7 +51,7 @@ Editor::kbd_driver (sigc::slot<void,GdkEvent*> theslot, bool use_track_canvas, b /* any use of "keyboard mouse buttons" invalidates an existing grab */ - + if (_drag) { _drag->item()->ungrab (GDK_CURRENT_TIME); delete _drag; @@ -101,16 +101,16 @@ Editor::kbd_mute_unmute_region () commit_reversible_command (); } else if (entered_regionview) { - + begin_reversible_command (_("mute region")); XMLNode &before = entered_regionview->region()->playlist()->get_state(); - + entered_regionview->region()->set_muted (!entered_regionview->region()->muted()); - + XMLNode &after = entered_regionview->region()->playlist()->get_state(); session->add_command (new MementoCommand<ARDOUR::Playlist>(*(entered_regionview->region()->playlist()), &before, &after)); commit_reversible_command(); - + } } diff --git a/gtk2_ardour/editor_keys.cc b/gtk2_ardour/editor_keys.cc index f5ca92deb3..a31711a4d0 100644 --- a/gtk2_ardour/editor_keys.cc +++ b/gtk2_ardour/editor_keys.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -80,7 +80,7 @@ Editor::keyboard_selection_begin () pending_keyboard_selection_start = where; have_pending_keyboard_selection = true; } - + } } } diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 83a3beabc5..a83d30cb7b 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -86,34 +86,34 @@ Editor::add_new_location (Location *location) lam->start = new Marker (*this, *marker_group, color, location->name(), Marker::Mark, location->start()); } lam->end = 0; - + } else if (location->is_auto_loop()) { // transport marker - lam->start = new Marker (*this, *transport_marker_group, color, + lam->start = new Marker (*this, *transport_marker_group, color, location->name(), Marker::LoopStart, location->start()); - lam->end = new Marker (*this, *transport_marker_group, color, + lam->end = new Marker (*this, *transport_marker_group, color, location->name(), Marker::LoopEnd, location->end()); - + } else if (location->is_auto_punch()) { // transport marker - lam->start = new Marker (*this, *transport_marker_group, color, + lam->start = new Marker (*this, *transport_marker_group, color, location->name(), Marker::PunchIn, location->start()); - lam->end = new Marker (*this, *transport_marker_group, color, + lam->end = new Marker (*this, *transport_marker_group, color, location->name(), Marker::PunchOut, location->end()); - + } else { // range marker if (location->is_cd_marker() && ruler_cd_marker_action->get_active()) { - lam->start = new Marker (*this, *cd_marker_group, color, + lam->start = new Marker (*this, *cd_marker_group, color, location->name(), Marker::Start, location->start()); - lam->end = new Marker (*this, *cd_marker_group, color, + lam->end = new Marker (*this, *cd_marker_group, color, location->name(), Marker::End, location->end()); } else { - - lam->start = new Marker (*this, *range_marker_group, color, + + lam->start = new Marker (*this, *range_marker_group, color, location->name(), Marker::Start, location->start()); - lam->end = new Marker (*this, *range_marker_group, color, + lam->end = new Marker (*this, *range_marker_group, color, location->name(), Marker::End, location->end()); } } @@ -154,7 +154,7 @@ Editor::location_changed (Location *location) /* a location that isn't "marked" with markers */ return; } - + lam->set_name (location->name()); lam->set_position (location->start(), location->end()); @@ -169,9 +169,9 @@ void Editor::location_flags_changed (Location *location, void *src) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::location_flags_changed), location, src)); - + LocationMarkers *lam = find_location_markers (location); - + if (lam == 0) { /* a location that isn't "marked" with markers */ return; @@ -191,7 +191,7 @@ Editor::location_flags_changed (Location *location, void *src) } else { lam->set_color_rgba (location_range_color); } - + if (location->is_hidden()) { lam->hide(); } else { @@ -222,8 +222,8 @@ void Editor::ensure_cd_marker_updated (LocationMarkers * lam, Location * locatio lam->end->reparent (*cd_marker_group); } } - else if ( (!location->is_cd_marker() || !ruler_cd_marker_action->get_active()) - && (lam->start->get_parent() == cd_marker_group)) + else if ( (!location->is_cd_marker() || !ruler_cd_marker_action->get_active()) + && (lam->start->get_parent() == cd_marker_group)) { //cerr << "reparenting non-cd marker so it can be relocated: " << location->name() << endl; if (location->is_mark()) { @@ -292,7 +292,7 @@ Editor::refresh_location_display_internal (Locations::LocationList& locations) for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) { i->second->valid = false; } - + /* add new ones */ for (Locations::LocationList::iterator i = locations.begin(); i != locations.end(); ++i) { @@ -319,7 +319,7 @@ Editor::refresh_location_display_internal (Locations::LocationList& locations) if (!i->second->valid) { delete i->second; location_markers.erase (i); - } + } i = tmp; } @@ -332,7 +332,7 @@ void Editor::refresh_location_display () { ENSURE_GUI_THREAD(mem_fun(*this, &Editor::refresh_location_display)); - + if (session) { session->locations()->apply (*this, &Editor::refresh_location_display_internal); } @@ -349,36 +349,36 @@ Editor::refresh_location_display_s (Change ignored) } void -Editor::LocationMarkers::hide() +Editor::LocationMarkers::hide() { start->hide (); if (end) { end->hide(); } } void -Editor::LocationMarkers::show() +Editor::LocationMarkers::show() { start->show (); if (end) { end->show(); } } void -Editor::LocationMarkers::set_name (const string& str) +Editor::LocationMarkers::set_name (const string& str) { start->set_name (str); if (end) { end->set_name (str); } } void -Editor::LocationMarkers::set_position (nframes64_t startf, - nframes64_t endf) +Editor::LocationMarkers::set_position (nframes64_t startf, + nframes64_t endf) { start->set_position (startf); if (end) { end->set_position (endf); } } void -Editor::LocationMarkers::set_color_rgba (uint32_t rgba) +Editor::LocationMarkers::set_color_rgba (uint32_t rgba) { start->set_color_rgba (rgba); if (end) { end->set_color_rgba (rgba); } @@ -401,7 +401,7 @@ Editor::mouse_add_new_marker (nframes64_t where, bool is_cd, bool is_xrun) session->locations()->next_available_name(markername, markerprefix); if (!is_xrun && !choose_new_marker_name(markername)) { return; - } + } Location *location = new Location (where, where, markername, (Location::Flags) flags); session->begin_reversible_command (_("add marker")); XMLNode &before = session->locations()->get_state(); @@ -458,7 +458,7 @@ void Editor::location_gone (Location *location) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::location_gone), location)); - + LocationMarkerMap::iterator i; if (location == transport_loop_location()) { @@ -468,7 +468,7 @@ Editor::location_gone (Location *location) if (location == transport_punch_location()) { update_punch_range_view (true); } - + for (i = location_markers.begin(); i != location_markers.end(); ++i) { if ((*i).first == location) { delete (*i).second; @@ -498,7 +498,7 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item) fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } - + bool is_start; Location * loc = find_location_from_marker (marker, is_start); if (loc == transport_loop_location() || loc == transport_punch_location()) { @@ -536,7 +536,7 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item) } } } -#endif +#endif marker_menu_item = item; markerMenu->popup (1, ev->time); } @@ -673,7 +673,7 @@ Editor::build_new_transport_marker_menu () items.push_back (MenuElem (_("Set Loop Range"), mem_fun(*this, &Editor::new_transport_marker_menu_set_loop))); items.push_back (MenuElem (_("Set Punch Range"), mem_fun(*this, &Editor::new_transport_marker_menu_set_punch))); - new_transport_marker_menu->signal_unmap().connect ( mem_fun(*this, &Editor::new_transport_marker_menu_popdown)); + new_transport_marker_menu->signal_unmap().connect ( mem_fun(*this, &Editor::new_transport_marker_menu_popdown)); } void @@ -688,7 +688,7 @@ Editor::marker_menu_hide () Location* l; bool is_start; - + if ((l = find_location_from_marker (marker, is_start)) != 0) { l->set_hidden (true, this); } @@ -728,7 +728,7 @@ Editor::marker_menu_select_all_selectables_using_range () if (((l = find_location_from_marker (marker, is_start)) != 0) && (l->end() > l->start())) { select_all_within (l->start(), l->end() - 1, 0, DBL_MAX, track_views, Selection::Set); } - + } void @@ -747,7 +747,7 @@ Editor::marker_menu_separate_regions_using_location () if (((l = find_location_from_marker (marker, is_start)) != 0) && (l->end() > l->start())) { separate_regions_using_location (*l); } - + } void @@ -762,7 +762,7 @@ Editor::marker_menu_play_from () Location* l; bool is_start; - + if ((l = find_location_from_marker (marker, is_start)) != 0) { if (l->is_mark()) { @@ -770,7 +770,7 @@ Editor::marker_menu_play_from () } else { //session->request_bounded_roll (l->start(), l->end()); - + if (is_start) { session->request_locate (l->start(), true); } else { @@ -792,7 +792,7 @@ Editor::marker_menu_set_playhead () Location* l; bool is_start; - + if ((l = find_location_from_marker (marker, is_start)) != 0) { if (l->is_mark()) { @@ -827,7 +827,7 @@ Editor::marker_menu_range_to_next () if ((l = find_location_from_marker (marker, is_start)) == 0) { return; } - + nframes_t end = session->locations()->first_mark_after (marker->position()); if (end != max_frames) { @@ -851,7 +851,7 @@ Editor::marker_menu_set_from_playhead () Location* l; bool is_start; - + if ((l = find_location_from_marker (marker, is_start)) != 0) { if (l->is_mark()) { @@ -879,7 +879,7 @@ Editor::marker_menu_set_from_selection () Location* l; bool is_start; - + if ((l = find_location_from_marker (marker, is_start)) != 0) { if (l->is_mark()) { @@ -918,7 +918,7 @@ Editor::marker_menu_play_range () Location* l; bool is_start; - + if ((l = find_location_from_marker (marker, is_start)) != 0) { if (l->is_mark()) { @@ -926,7 +926,7 @@ Editor::marker_menu_play_range () } else { session->request_bounded_roll (l->start(), l->end()); - + } } } @@ -943,12 +943,12 @@ Editor::marker_menu_loop_range () Location* l; bool is_start; - + if ((l = find_location_from_marker (marker, is_start)) != 0) { Location* l2; if ((l2 = transport_loop_location()) != 0) { l2->set (l->start(), l->end()); - + // enable looping, reposition and start rolling session->request_play_loop(true); session->request_locate (l2->start(), true); @@ -1118,10 +1118,10 @@ Editor::update_loop_range_view (bool visibility) double x1 = frame_to_pixel (tll->start()); double x2 = frame_to_pixel (tll->end()); - + transport_loop_range_rect->property_x1() = x1; transport_loop_range_rect->property_x2() = x2; - + if (visibility) { transport_loop_range_rect->show(); } @@ -1150,7 +1150,7 @@ Editor::update_punch_range_view (bool visibility) transport_punch_range_rect->property_x1() = 0; transport_punch_range_rect->property_x2() = (session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : track_canvas_width); } - + if (visibility) { transport_punch_range_rect->show(); } @@ -1171,7 +1171,7 @@ Editor::marker_selection_changed () if (lam->start) { lam->start->hide_line(); - } + } if (lam->end) { lam->end->hide_line(); @@ -1208,7 +1208,7 @@ Editor::selected_marker_moved (Location* loc) edit_point_clock.set (loc->start()); } -struct SortLocationsByPosition { +struct SortLocationsByPosition { bool operator() (Location* a, Location* b) { return a->start() < b->start(); } @@ -1226,7 +1226,7 @@ Editor::goto_nth_marker (int n) SortLocationsByPosition cmp; ordered.sort (cmp); - + for (Locations::LocationList::iterator i = ordered.begin(); n >= 0 && i != ordered.end(); ++i) { if ((*i)->is_mark() && !(*i)->is_hidden() && !(*i)->is_start()) { if (n == 0) { diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index 46b05a20f4..0903de68ff 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003-2004 Paul Davis + Copyright (C) 2003-2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -83,14 +83,14 @@ Editor::show_editor_mixer (bool yn) if (selection->tracks.empty()) { - if (track_views.empty()) { + if (track_views.empty()) { show_editor_mixer_when_tracks_arrive = true; return; - } + } for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { RouteTimeAxisView* atv; - + if ((atv = dynamic_cast<RouteTimeAxisView*> (*i)) != 0) { r = atv->route(); break; @@ -99,10 +99,10 @@ Editor::show_editor_mixer (bool yn) } else { sort_track_selection (); - + for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { RouteTimeAxisView* atv; - + if ((atv = dynamic_cast<RouteTimeAxisView*> (*i)) != 0) { r = atv->route(); break; @@ -126,7 +126,7 @@ Editor::show_editor_mixer (bool yn) current_mixer_strip->set_width_enum (editor_mixer_strip_width, (void*) this); } } - + if (current_mixer_strip->get_parent() == 0) { global_hpacker.pack_start (*current_mixer_strip, Gtk::PACK_SHRINK ); global_hpacker.reorder_child (*current_mixer_strip, 0); @@ -180,7 +180,7 @@ Editor::create_editor_mixer () current_mixer_strip->WidthChanged.connect (mem_fun(*this, &Editor::ensure_all_elements_drawn)); #endif current_mixer_strip->set_embedded (true); -} +} void Editor::set_selected_mixer_strip (TimeAxisView& view) @@ -193,7 +193,7 @@ Editor::set_selected_mixer_strip (TimeAxisView& view) } Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer")); - + if (act) { Glib::RefPtr<Gtk::ToggleAction> tact = Glib::RefPtr<Gtk::ToggleAction>::cast_dynamic(act); if (!tact || !tact->get_active()) { @@ -210,11 +210,11 @@ Editor::set_selected_mixer_strip (TimeAxisView& view) } /* might be nothing to do */ - + if (current_mixer_strip->route() == at->route()) { return; } - + if (created) { current_mixer_strip->set_width_enum (editor_mixer_strip_width, (void*) this); } @@ -234,7 +234,7 @@ Editor::update_current_screen () a visual glitch. */ return; } - + if (session && session->engine().running()) { nframes64_t const frame = session->audible_frame(); @@ -255,7 +255,7 @@ Editor::update_current_screen () #undef CONTINUOUS_SCROLL #ifndef CONTINUOUS_SCROLL if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) { - + if (session->transport_speed() < 0) { if (frame > (current_page_frames()/2)) { center_screen (frame-(current_page_frames()/2)); @@ -270,11 +270,11 @@ Editor::update_current_screen () playhead_cursor->set_position (frame); #else // CONTINUOUS_SCROLL - - /* don't do continuous scroll till the new position is in the rightmost quarter of the + + /* don't do continuous scroll till the new position is in the rightmost quarter of the editor canvas */ - + if (session->transport_speed()) { double target = ((double)frame - (double)current_page_frames()/2.0) / frames_per_unit; if (target <= 0.0) target = 0.0; @@ -287,7 +287,7 @@ Editor::update_current_screen () current = target; horizontal_adjustment.set_value ( current ); } - + playhead_cursor->set_position (frame); #endif // CONTINUOUS_SCROLL @@ -305,7 +305,7 @@ Editor::update_current_screen () if (current_mixer_strip) { current_mixer_strip->fast_update (); } - + } } @@ -322,9 +322,9 @@ void Editor::current_mixer_strip_hidden () { for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - + RouteTimeAxisView* tmp; - + if ((tmp = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) { if (tmp->route() == current_mixer_strip->route()) { (*i)->set_selected (false); @@ -344,7 +344,7 @@ void Editor::session_going_away () { _have_idled = false; - + for (vector<sigc::connection>::iterator i = session_connections.begin(); i != session_connections.end(); ++i) { (*i).disconnect (); } @@ -387,7 +387,7 @@ Editor::session_going_away () editor_list_button.set_active(false); editor_list_button.set_sensitive(false); - + /* clear tempo/meter rulers */ remove_metric_marks (); hide_measures (); @@ -395,9 +395,9 @@ Editor::session_going_away () delete current_bbt_points; current_bbt_points = 0; - + /* get rid of any existing editor mixer strip */ - + if (current_mixer_strip) { if (current_mixer_strip->get_parent() != 0) { global_hpacker.remove (*current_mixer_strip); diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 78947ea808..0a715e3fd4 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2001 Paul Davis + Copyright (C) 2000-2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -91,7 +91,7 @@ Editor::mouse_frame (nframes64_t& where, bool& in_track_canvas) const if (!canvas_window) { return false; } - + pointer_window = canvas_window->get_pointer (x, y, mask); if (pointer_window == track_canvas->get_bin_window()) { @@ -108,7 +108,7 @@ Editor::mouse_frame (nframes64_t& where, bool& in_track_canvas) const event.type = GDK_BUTTON_RELEASE; event.button.x = wx; event.button.y = wy; - + where = event_frame (&event, 0, 0); return true; } @@ -139,7 +139,7 @@ Editor::event_frame (GdkEvent const * event, double* pcx, double* pcy) const _trackview_group->w2i(*pcx, *pcy); break; case GDK_MOTION_NOTIFY: - + *pcx = event->motion.x; *pcy = event->motion.y; _trackview_group->w2i(*pcx, *pcy); @@ -161,7 +161,7 @@ Editor::event_frame (GdkEvent const * event, double* pcx, double* pcy) const position is negative (as can be the case with motion events in particular), the frame location is always positive. */ - + return pixel_to_frame (*pcx); } @@ -175,11 +175,11 @@ Editor::which_grabber_cursor () case MouseRange: c = midi_pencil_cursor; break; - + case MouseObject: c = grabber_cursor; break; - + case MouseTimeFX: c = midi_resize_cursor; break; @@ -211,11 +211,11 @@ Editor::set_canvas_cursor () case MouseRange: current_canvas_cursor = midi_pencil_cursor; break; - + case MouseObject: current_canvas_cursor = which_grabber_cursor(); break; - + case MouseTimeFX: current_canvas_cursor = midi_resize_cursor; break; @@ -230,23 +230,23 @@ Editor::set_canvas_cursor () case MouseRange: current_canvas_cursor = selector_cursor; break; - + case MouseObject: current_canvas_cursor = which_grabber_cursor(); break; - + case MouseGain: current_canvas_cursor = cross_hair_cursor; break; - + case MouseZoom: current_canvas_cursor = zoom_cursor; break; - + case MouseTimeFX: current_canvas_cursor = time_fx_cursor; // just use playhead break; - + case MouseAudition: current_canvas_cursor = speaker_cursor; break; @@ -329,7 +329,7 @@ Editor::mouse_mode_toggled (MouseMode m) } else { - /* + /* in range mode,show the range selection. */ @@ -379,12 +379,12 @@ Editor::step_mouse_mode (bool next) } } break; - + case MouseGain: if (next) set_mouse_mode (MouseTimeFX); else set_mouse_mode (MouseZoom); break; - + case MouseTimeFX: if (next) { set_mouse_mode (MouseAudition); @@ -423,16 +423,16 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp (mouse_mode != MouseRange)) || ((event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE) || event->button.button > 3)) { - + return; } if (event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) { if ((event->button.state & Keyboard::RelevantModifierKeyMask) && event->button.button != 1) { - + /* almost no selection action on modified button-2 or button-3 events */ - + if (item_type != RegionItem && event->button.button != 2) { return; } @@ -443,7 +443,7 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp bool press = (event->type == GDK_BUTTON_PRESS); // begin_reversible_command (_("select on click")); - + switch (item_type) { case RegionItem: if (mouse_mode != MouseRange) { @@ -452,7 +452,7 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp set_selected_track_as_side_effect (); } break; - + case RegionViewNameHighlight: case RegionViewName: if (mouse_mode != MouseRange) { @@ -480,7 +480,7 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp set_selected_control_point_from_click (op, false); } break; - + case StreamItem: /* for context click or range selection, select track */ if (event->button.button == 3) { @@ -489,11 +489,11 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp set_selected_track_as_side_effect (); } break; - + case AutomationTrackItem: set_selected_track_as_side_effect (true); break; - + default: break; } @@ -505,20 +505,20 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT if (_drag) { _drag->item()->ungrab (event->button.time); } - + /* single mouse clicks on any of these item types operate independent of mouse mode, mostly because they are not on the main track canvas or because we want them to be modeless. */ - + switch (item_type) { case PlayheadCursorItem: assert (_drag == 0); _drag = new CursorDrag (this, item, true); _drag->start_grab (event); return true; - + case MarkerItem: if (Keyboard::modifier_state_equals (event->button.state, Keyboard::ModifierMask(Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { hide_marker (item, event); @@ -528,7 +528,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT _drag->start_grab (event); } return true; - + case TempoMarkerItem: assert (_drag == 0); _drag = new TempoMarkerDrag ( @@ -538,17 +538,17 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT ); _drag->start_grab (event); return true; - + case MeterMarkerItem: assert (_drag == 0); _drag = new MeterMarkerDrag ( this, - item, + item, Keyboard::modifier_state_contains (event->button.state, Keyboard::CopyModifier) ); _drag->start_grab (event); return true; - + case MarkerBarItem: case TempoBarItem: case MeterBarItem: @@ -560,18 +560,18 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT return true; break; - + case RangeMarkerBarItem: assert (_drag == 0); if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) { _drag = new CursorDrag (this, &playhead_cursor->canvas_item, false); } else { - _drag = new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateRangeMarker); - } + _drag = new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateRangeMarker); + } _drag->start_grab (event); return true; break; - + case CdMarkerBarItem: assert (_drag == 0); if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) { @@ -582,7 +582,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT _drag->start_grab (event); return true; break; - + case TransportMarkerBarItem: assert (_drag == 0); if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) { @@ -593,11 +593,11 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT _drag->start_grab (event); return true; break; - + default: break; } - + if (internal_editing()) { switch (item_type) { case StreamItem: @@ -633,15 +633,15 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT _drag = new SelectionDrag (this, item, SelectionDrag::SelectionStartTrim); _drag->start_grab (event); break; - + case EndSelectionTrimItem: assert (_drag == 0); _drag = new SelectionDrag (this, item, SelectionDrag::SelectionEndTrim); _drag->start_grab (event); break; - + case SelectionItem: - if (Keyboard::modifier_state_contains + if (Keyboard::modifier_state_contains (event->button.state, Keyboard::ModifierMask(Keyboard::SecondaryModifier))) { // contains and not equals because I can't use alt as a modifier alone. start_selection_grab (item, event); @@ -658,7 +658,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT _drag->start_grab (event); } break; - + default: assert (_drag == 0); _drag = new SelectionDrag (this, item, SelectionDrag::CreateSelection); @@ -666,17 +666,17 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT } return true; break; - + case MouseObject: if (Keyboard::modifier_state_contains (event->button.state, Keyboard::ModifierMask(Keyboard::PrimaryModifier|Keyboard::SecondaryModifier)) && event->type == GDK_BUTTON_PRESS) { - + assert (_drag == 0); _drag = new RubberbandSelectDrag (this, item); _drag->start_grab (event); - + } else if (event->type == GDK_BUTTON_PRESS) { - + switch (item_type) { case FadeInHandleItem: { @@ -686,7 +686,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT _drag->start_grab (event); return true; } - + case FadeOutHandleItem: { assert (_drag == 0); @@ -695,7 +695,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT _drag->start_grab (event); return true; } - + case RegionItem: if (Keyboard::modifier_state_contains (event->button.state, Keyboard::CopyModifier)) { start_region_copy_grab (item, event, clicked_regionview); @@ -705,7 +705,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT start_region_grab (item, event, clicked_regionview); } break; - + case RegionViewNameHighlight: { assert (_drag == 0); @@ -715,7 +715,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT return true; break; } - + case RegionViewName: { /* rename happens on edit clicks */ @@ -726,14 +726,14 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT return true; break; } - + case ControlPointItem: assert (_drag == 0); _drag = new ControlPointDrag (this, item); _drag->start_grab (event); return true; break; - + case AutomationLineItem: assert (_drag == 0); _drag = new LineDrag (this, item); @@ -747,7 +747,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT _drag = new RubberbandSelectDrag (this, item); _drag->start_grab (event); break; - + #ifdef WITH_CMT case ImageFrameHandleStartItem: imageframe_start_handle_op(item, event) ; @@ -772,18 +772,18 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT start_imageframe_grab(item, event) ; break ; #endif - + case MarkerBarItem: - + break; - + default: break; } } return true; break; - + case MouseGain: switch (item_type) { case RegionItem: @@ -794,61 +794,61 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT _drag = new RegionGainDrag (this, item); _drag->start_grab (event, current_canvas_cursor); break; - + case GainLineItem: assert (_drag == 0); _drag = new LineDrag (this, item); _drag->start_grab (event); return true; - + case ControlPointItem: assert (_drag == 0); _drag = new ControlPointDrag (this, item); _drag->start_grab (event); return true; break; - + default: break; } return true; break; - + switch (item_type) { case ControlPointItem: assert (_drag == 0); _drag = new ControlPointDrag (this, item); _drag->start_grab (event); break; - + case AutomationLineItem: assert (_drag == 0); _drag = new LineDrag (this, item); _drag->start_grab (event); break; - + case RegionItem: // XXX need automation mode to identify which // line to use // start_line_grab_from_regionview (item, event); break; - + default: break; } return true; break; - + case MouseZoom: if (event->type == GDK_BUTTON_PRESS) { assert (_drag == 0); _drag = new MouseZoomDrag (this, item); _drag->start_grab (event); } - + return true; break; - + case MouseTimeFX: if (item_type == RegionItem) { assert (_drag == 0); @@ -856,7 +856,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT _drag->start_grab (event); } break; - + case MouseAudition: _drag = new ScrubDrag (this, item); _drag->start_grab (event); @@ -866,7 +866,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT scrubbing_direction = 0; track_canvas->get_window()->set_cursor (*transparent_cursor); break; - + default: break; } @@ -895,11 +895,11 @@ Editor::button_press_handler_2 (ArdourCanvas::Item* item, GdkEvent* event, ItemT _drag->start_grab (event); return true; break; - + default: break; } - + switch (item_type) { case RegionViewNameHighlight: assert (_drag == 0); @@ -907,26 +907,26 @@ Editor::button_press_handler_2 (ArdourCanvas::Item* item, GdkEvent* event, ItemT _drag->start_grab (event); return true; break; - + case RegionViewName: assert (_drag == 0); _drag = new TrimDrag (this, clicked_regionview->get_name_highlight(), clicked_regionview, selection->regions.by_layer()); _drag->start_grab (event); return true; break; - + default: break; } - + break; case MouseRange: /* relax till release */ return true; break; - - + + case MouseZoom: if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) { temporal_zoom_session(); @@ -935,7 +935,7 @@ Editor::button_press_handler_2 (ArdourCanvas::Item* item, GdkEvent* event, ItemT } return true; break; - + default: break; } @@ -949,7 +949,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp if (event->type != GDK_BUTTON_PRESS) { return false; } - + Glib::RefPtr<Gdk::Window> canvas_window = const_cast<Editor*>(this)->track_canvas->get_window(); if (canvas_window) { @@ -959,7 +959,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp Gdk::ModifierType mask; pointer_window = canvas_window->get_pointer (x, y, mask); - + if (pointer_window == track_canvas->get_bin_window()) { track_canvas->window_to_world (x, y, wx, wy); allow_vertical_scroll = true; @@ -980,7 +980,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp (Keyboard::is_delete_event (&event->button) || Keyboard::is_context_menu_event (&event->button) || Keyboard::is_edit_event (&event->button))) { - + /* handled by button release */ return true; } @@ -1010,9 +1010,9 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT { nframes64_t where = event_frame (event, 0, 0); AutomationTimeAxisView* atv = 0; - + /* no action if we're recording */ - + if (session && session->actively_recording()) { return true; } @@ -1031,7 +1031,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT were_dragging = true; } - + button_selection (item, event, item_type); /* edit events get handled here */ @@ -1045,11 +1045,11 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT case TempoMarkerItem: edit_tempo_marker (item); break; - + case MeterMarkerItem: edit_meter_marker (item); break; - + case RegionViewName: if (clicked_regionview->name_active()) { return mouse_rename_region (item, event); @@ -1083,17 +1083,17 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT case FadeOutHandleItem: popup_fade_context_menu (1, event->button.time, item, item_type); break; - + case StreamItem: popup_track_context_menu (1, event->button.time, item_type, false, where); break; - + case RegionItem: case RegionViewNameHighlight: case RegionViewName: popup_track_context_menu (1, event->button.time, item_type, false, where); break; - + case SelectionItem: popup_track_context_menu (1, event->button.time, item_type, true, where); break; @@ -1102,8 +1102,8 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT popup_track_context_menu (1, event->button.time, item_type, false, where); break; - case MarkerBarItem: - case RangeMarkerBarItem: + case MarkerBarItem: + case RangeMarkerBarItem: case TransportMarkerBarItem: case CdMarkerBarItem: case TempoBarItem: @@ -1118,11 +1118,11 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT case TempoMarkerItem: tm_marker_context_menu (&event->button, item); break; - + case MeterMarkerItem: tm_marker_context_menu (&event->button, item); break; - + case CrossfadeViewItem: popup_track_context_menu (1, event->button.time, item_type, false, where); break; @@ -1141,7 +1141,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT popup_marker_time_axis_edit_menu(1, event->button.time, item, false) ; break ; #endif - + default: break; } @@ -1158,7 +1158,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT case TempoMarkerItem: remove_tempo_marker (item); break; - + case MeterMarkerItem: remove_meter_marker (item); break; @@ -1172,7 +1172,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT remove_clicked_region (); } break; - + case ControlPointItem: if (mouse_mode == MouseGain) { remove_gain_control_point (item, event); @@ -1221,18 +1221,18 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT mouse_add_new_tempo_event (where); } return true; - + case MeterBarItem: if (!_dragging_playhead) { mouse_add_new_meter_event (pixel_to_frame (event->button.x)); - } + } return true; break; default: break; } - + switch (mouse_mode) { case MouseObject: switch (item_type) { @@ -1240,11 +1240,11 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT atv = dynamic_cast<AutomationTimeAxisView*>(clicked_axisview); if (atv) { atv->add_automation_event (item, event, where, event->button.y); - } + } return true; - + break; - + default: break; } @@ -1268,7 +1268,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT } return true; break; - + case AutomationTrackItem: dynamic_cast<AutomationTimeAxisView*>(clicked_axisview)-> add_automation_event (item, event, where, event->button.y); @@ -1278,7 +1278,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT break; } break; - + case MouseAudition: track_canvas->get_window()->set_cursor (*current_canvas_cursor); if (scrubbing_direction == 0) { @@ -1295,7 +1295,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT session->request_transport_speed (0.0); } break; - + default: break; @@ -1307,7 +1307,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT case 2: switch (mouse_mode) { - + case MouseObject: switch (item_type) { case RegionItem: @@ -1319,29 +1319,29 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT // Button2 click is unused } return true; - + break; - + default: break; } break; - + case MouseRange: - + // x_style_paste (where, 1.0); return true; break; - + default: break; } break; - + case 3: break; - + default: break; } @@ -1354,7 +1354,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* /*event*/, ItemType i ControlPoint* cp; Marker * marker; double fraction; - + if (last_item_entered != item) { last_item_entered = item; last_item_entered_n = 0; @@ -1397,7 +1397,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* /*event*/, ItemType i } } break; - + case AutomationLineItem: if (mouse_mode == MouseGain || mouse_mode == MouseObject) { { @@ -1410,7 +1410,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* /*event*/, ItemType i } } break; - + case RegionViewNameHighlight: if (is_drawable() && mouse_mode == MouseObject) { track_canvas->get_window()->set_cursor (*trimmer_cursor); @@ -1446,14 +1446,14 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* /*event*/, ItemType i break; case RegionViewName: - + /* when the name is not an active item, the entire name highlight is for trimming */ if (!reinterpret_cast<RegionView *> (item->get_data ("regionview"))->name_active()) { if (mouse_mode == MouseObject && is_drawable()) { track_canvas->get_window()->set_cursor (*trimmer_cursor); } - } + } break; @@ -1562,14 +1562,14 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* /*event*/, ItemType i cp->set_visible (false); } } - + if (is_drawable()) { track_canvas->get_window()->set_cursor (*current_canvas_cursor); } hide_verbose_canvas_cursor (); break; - + case RegionViewNameHighlight: case StartSelectionTrimItem: case EndSelectionTrimItem: @@ -1619,7 +1619,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* /*event*/, ItemType i track_canvas->get_window()->set_cursor (*current_canvas_cursor); } break; - + case MarkerItem: if ((marker = static_cast<Marker *> (item->get_data ("marker"))) == 0) { break; @@ -1631,7 +1631,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* /*event*/, ItemType i // fall through case MeterMarkerItem: case TempoMarkerItem: - + if (is_drawable()) { track_canvas->get_window()->set_cursor (*timebar_cursor); } @@ -1657,7 +1657,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* /*event*/, ItemType i Glib::signal_idle().connect (mem_fun(*this, &Editor::left_automation_track)); } break; - + default: break; } @@ -1679,63 +1679,63 @@ void Editor::scrub () { double delta; - + if (scrubbing_direction == 0) { /* first move */ session->request_locate (_drag->current_pointer_frame(), false); session->request_transport_speed (0.1); scrubbing_direction = 1; - + } else { - + if (last_scrub_x > _drag->current_pointer_x()) { - + /* pointer moved to the left */ - + if (scrubbing_direction > 0) { - + /* we reversed direction to go backwards */ - + scrub_reversals++; scrub_reverse_distance += (int) (last_scrub_x - _drag->current_pointer_x()); - + } else { - + /* still moving to the left (backwards) */ - + scrub_reversals = 0; scrub_reverse_distance = 0; - + delta = 0.01 * (last_scrub_x - _drag->current_pointer_x()); session->request_transport_speed (session->transport_speed() - delta); } - + } else { /* pointer moved to the right */ - + if (scrubbing_direction < 0) { /* we reversed direction to go forward */ - + scrub_reversals++; scrub_reverse_distance += (int) (_drag->current_pointer_x() - last_scrub_x); - + } else { /* still moving to the right */ - + scrub_reversals = 0; scrub_reverse_distance = 0; - + delta = 0.01 * (_drag->current_pointer_x() - last_scrub_x); session->request_transport_speed (session->transport_speed() + delta); } } - + /* if there have been more than 2 opposite motion moves detected, or one that moves back more than 10 pixels, reverse direction */ - + if (scrub_reversals >= 2 || scrub_reverse_distance > 10) { - + if (scrubbing_direction > 0) { /* was forwards, go backwards */ session->request_transport_speed (-0.1); @@ -1745,12 +1745,12 @@ Editor::scrub () session->request_transport_speed (0.1); scrubbing_direction = 1; } - + scrub_reverse_distance = 0; scrub_reversals = 0; } } - + last_scrub_x = _drag->current_pointer_x(); } @@ -1759,18 +1759,18 @@ Editor::motion_handler (ArdourCanvas::Item* /*item*/, GdkEvent* event, bool from { if (event->motion.is_hint) { gint x, y; - + /* We call this so that MOTION_NOTIFY events continue to be delivered to the canvas. We need to do this because we set Gdk::POINTER_MOTION_HINT_MASK on the canvas. This reduces the density of the events, at the expense of a round-trip to the server. Given that this will mostly occur on cases where DISPLAY = :0.0, and given the cost of what the motion - event might do, its a good tradeoff. + event might do, its a good tradeoff. */ track_canvas->get_pointer (x, y); - } + } if (current_stepping_trackview) { /* don't keep the persistent stepped trackview if the mouse moves */ @@ -1808,7 +1808,7 @@ Editor::remove_gain_control_point (ArdourCanvas::Item*item, GdkEvent* /*event*/) // We shouldn't remove the first or last gain point if (control_point->line().is_last_point(*control_point) || - control_point->line().is_first_point(*control_point)) { + control_point->line().is_first_point(*control_point)) { return; } @@ -1855,17 +1855,17 @@ Editor::visible_order_range (int* low, int* high) const { *low = TimeAxisView::max_order (); *high = 0; - + for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i) { RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*i); - + if (!rtv->hidden()) { - + if (*high < rtv->order()) { *high = rtv->order (); } - + if (*low > rtv->order()) { *low = rtv->order (); } @@ -1879,7 +1879,7 @@ Editor::region_view_item_click (AudioRegionView& rv, GdkEventButton* event) /* Either add to or set the set the region selection, unless this is an alignment click (control used) */ - + if (Keyboard::modifier_state_contains (event->state, Keyboard::PrimaryModifier)) { TimeAxisView* tv = &rv.get_time_axis_view(); RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(tv); @@ -1893,15 +1893,15 @@ Editor::region_view_item_click (AudioRegionView& rv, GdkEventButton* event) if (where >= 0) { if (Keyboard::modifier_state_equals (event->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) { - + align_region (rv.region(), SyncPoint, (nframes64_t) (where * speed)); - + } else if (Keyboard::modifier_state_equals (event->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { - + align_region (rv.region(), End, (nframes64_t) (where * speed)); - + } else { - + align_region (rv.region(), Start, (nframes64_t) (where * speed)); } } @@ -1909,7 +1909,7 @@ Editor::region_view_item_click (AudioRegionView& rv, GdkEventButton* event) } void -Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos, double ypos) +Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos, double ypos) { char buf[128]; SMPTE::Time smpte; @@ -1935,7 +1935,7 @@ Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos, session->bbt_time (frame, bbt); snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bbt.bars, bbt.beats, bbt.ticks); break; - + case AudioClock::SMPTE: session->smpte_time (frame, smpte); snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); @@ -1967,7 +1967,7 @@ Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos, } void -Editor::show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset, double xpos, double ypos) +Editor::show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset, double xpos, double ypos) { char buf[128]; SMPTE::Time smpte; @@ -2013,10 +2013,10 @@ Editor::show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double ebbt.beats--; ebbt.ticks = int(Meter::ticks_per_beat) + ebbt.ticks - sbbt.ticks; } - + snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, ebbt.bars, ebbt.beats, ebbt.ticks); break; - + case AudioClock::SMPTE: session->smpte_duration (end - start, smpte); snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); @@ -2071,7 +2071,7 @@ Editor::cancel_selection () selection->clear (); clicked_selection = 0; -} +} void @@ -2092,7 +2092,7 @@ Editor::single_contents_trim (RegionView& rv, nframes64_t frame_delta, bool left if (tv && tv->is_track()) { speed = tv->get_diskstream()->speed(); } - + if (left_direction) { if (swap_direction) { new_bound = (nframes64_t) (region->position()/speed) + frame_delta; @@ -2110,14 +2110,14 @@ Editor::single_contents_trim (RegionView& rv, nframes64_t frame_delta, bool left if (obey_snap) { snap_to (new_bound); } - region->trim_start ((nframes64_t) (new_bound * speed), this); + region->trim_start ((nframes64_t) (new_bound * speed), this); rv.region_changed (StartChanged); } void Editor::single_start_trim (RegionView& rv, nframes64_t frame_delta, bool left_direction, bool obey_snap, bool no_overlap) { - boost::shared_ptr<Region> region (rv.region()); + boost::shared_ptr<Region> region (rv.region()); if (region->locked()) { return; @@ -2132,7 +2132,7 @@ Editor::single_start_trim (RegionView& rv, nframes64_t frame_delta, bool left_di if (tv && tv->is_track()) { speed = tv->get_diskstream()->speed(); } - + if (left_direction) { new_bound = (nframes64_t) (region->position()/speed) - frame_delta; } else { @@ -2140,18 +2140,18 @@ Editor::single_start_trim (RegionView& rv, nframes64_t frame_delta, bool left_di } if (obey_snap) { - snap_to (new_bound, (left_direction ? 0 : 1)); + snap_to (new_bound, (left_direction ? 0 : 1)); } - + nframes64_t pre_trim_first_frame = region->first_frame(); region->trim_front ((nframes64_t) (new_bound * speed), this); - + if (no_overlap) { //Get the next region on the left of this region and shrink/expand it. boost::shared_ptr<Playlist> playlist (region->playlist()); boost::shared_ptr<Region> region_left = playlist->find_next_region (pre_trim_first_frame, End, 0); - + bool regions_touching = false; if (region_left != 0 && (pre_trim_first_frame == region_left->last_frame() + 1)){ @@ -2159,14 +2159,14 @@ Editor::single_start_trim (RegionView& rv, nframes64_t frame_delta, bool left_di } //Only trim region on the left if the first frame has gone beyond the left region's last frame. - if (region_left != 0 && - (region_left->last_frame() > region->first_frame() || regions_touching)) + if (region_left != 0 && + (region_left->last_frame() > region->first_frame() || regions_touching)) { region_left->trim_end(region->first_frame(), this); } } - + rv.region_changed (Change (LengthChanged|PositionChanged|StartChanged)); } @@ -2217,11 +2217,11 @@ Editor::single_end_trim (RegionView& rv, nframes64_t frame_delta, bool left_dire //Only trim region on the right if the last frame has gone beyond the right region's first frame. if (region_right != 0 && - (region_right->first_frame() < region->last_frame() || regions_touching)) + (region_right->first_frame() < region->last_frame() || regions_touching)) { region_right->trim_front(region->last_frame() + 1, this); } - + rv.region_changed (Change (LengthChanged|PositionChanged|StartChanged)); } else { @@ -2274,13 +2274,13 @@ Editor::point_trim (GdkEvent* event) } commit_reversible_command(); - + break; case 2: begin_reversible_command (_("End point trim")); if (selection->selected (rv)) { - + for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) { if (!(*i)->region()->locked()) { @@ -2304,7 +2304,7 @@ Editor::point_trim (GdkEvent* event) } commit_reversible_command(); - + break; default: break; @@ -2323,7 +2323,7 @@ Editor::thaw_region_after_trim (RegionView& rv) region->thaw (_("trimmed region")); AudioRegionView* arv = dynamic_cast<AudioRegionView*>(&rv); - + if (arv) { arv->unhide_envelope (); } @@ -2340,7 +2340,7 @@ Editor::hide_marker (ArdourCanvas::Item* item, GdkEvent* /*event*/) /*NOTREACHED*/ } - Location* location = find_location_from_marker (marker, is_start); + Location* location = find_location_from_marker (marker, is_start); location->set_hidden (true, this); } @@ -2405,7 +2405,7 @@ Editor::mouse_brush_insert_region (RegionView* rv, nframes64_t pos) } /* don't brush a copy over the original */ - + if (pos == rv->region()->position()) { return; } @@ -2418,14 +2418,14 @@ Editor::mouse_brush_insert_region (RegionView* rv, nframes64_t pos) boost::shared_ptr<Playlist> playlist = rtv->playlist(); double speed = rtv->get_diskstream()->speed(); - + XMLNode &before = playlist->get_state(); playlist->add_region (RegionFactory::create (rv->region()), (nframes64_t) (pos * speed)); XMLNode &after = playlist->get_state(); session->add_command(new MementoCommand<Playlist>(*playlist.get(), &before, &after)); - + // playlist is frozen, so we have to update manually - + playlist->Modified(); /* EMIT SIGNAL */ } @@ -2445,16 +2445,16 @@ Editor::start_region_grab (ArdourCanvas::Item* item, GdkEvent* event, RegionView assert (region_view); _region_motion_group->raise_to_top (); - + assert (_drag == 0); - + if (Config->get_edit_mode() == Splice) { _drag = new RegionSpliceDrag (this, item, region_view, selection->regions.by_layer()); } else { RegionSelection s = get_equivalent_regions (selection->regions, RouteGroup::Edit); _drag = new RegionMoveDrag (this, item, region_view, s.by_layer(), false, false); } - + _drag->start_grab (event); begin_reversible_command (_("move region(s)")); @@ -2468,7 +2468,7 @@ Editor::start_region_copy_grab (ArdourCanvas::Item* item, GdkEvent* event, Regio { assert (region_view); assert (_drag == 0); - + _region_motion_group->raise_to_top (); RegionSelection s = get_equivalent_regions (selection->regions, RouteGroup::Edit); @@ -2481,7 +2481,7 @@ Editor::start_region_brush_grab (ArdourCanvas::Item* item, GdkEvent* event, Regi { assert (region_view); assert (_drag == 0); - + if (Config->get_edit_mode() == Splice) { return; } @@ -2489,7 +2489,7 @@ Editor::start_region_brush_grab (ArdourCanvas::Item* item, GdkEvent* event, Regi RegionSelection s = get_equivalent_regions (selection->regions, RouteGroup::Edit); _drag = new RegionMoveDrag (this, item, region_view, s.by_layer(), true, false); _drag->start_grab (event); - + begin_reversible_command (_("Drag region brush")); } @@ -2514,7 +2514,7 @@ Editor::start_selection_grab (ArdourCanvas::Item* /*item*/, GdkEvent* event) } /* XXX fix me one day to use all new regions */ - + boost::shared_ptr<Region> region (new_regions.front()); /* add it to the current stream/playlist. @@ -2523,11 +2523,11 @@ Editor::start_selection_grab (ArdourCanvas::Item* /*item*/, GdkEvent* event) catch the signal it sends when it creates the regionview to set the regionview we want to then drag. */ - + latest_regionviews.clear(); sigc::connection c = clicked_routeview->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view)); - - /* A selection grab currently creates two undo/redo operations, one for + + /* A selection grab currently creates two undo/redo operations, one for creating the new region and another for moving it. */ @@ -2541,19 +2541,19 @@ Editor::start_selection_grab (ArdourCanvas::Item* /*item*/, GdkEvent* event) session->add_command(new MementoCommand<Playlist>(*playlist, before, after)); commit_reversible_command (); - + c.disconnect (); - + if (latest_regionviews.empty()) { /* something went wrong */ return; } /* we need to deselect all other regionviews, and select this one - i'm ignoring undo stuff, because the region creation will take care of it + i'm ignoring undo stuff, because the region creation will take care of it */ selection->set (latest_regionviews); - + assert (_drag == 0); _drag = new RegionMoveDrag (this, latest_regionviews.front()->get_canvas_group(), latest_regionviews.front(), latest_regionviews, false, false); _drag->start_grab (event); @@ -2574,7 +2574,7 @@ Editor::set_internal_edit (bool yn) if (yn) { mouse_select_button.set_image (*(manage (new Image (::get_icon("midi_tool_pencil"))))); - + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { MidiTimeAxisView* mtv = dynamic_cast<MidiTimeAxisView*> (*i); if (mtv) { diff --git a/gtk2_ardour/editor_nudge.cc b/gtk2_ardour/editor_nudge.cc index 1420fd6fc2..a6961d43cd 100644 --- a/gtk2_ardour/editor_nudge.cc +++ b/gtk2_ardour/editor_nudge.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 55e8014638..159336bf67 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2004 Paul Davis + Copyright (C) 2000-2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -145,7 +145,7 @@ Editor::split_regions_at (nframes64_t where, RegionSelection& regions) /* XXX this test needs to be more complicated, to make sure we really have something to split. */ - + if (!(*a)->region()->covers (where)) { ++a; continue; @@ -159,7 +159,7 @@ Editor::split_regions_at (nframes64_t where, RegionSelection& regions) if (! pl->frozen()) { /* we haven't seen this playlist before */ - /* remember used playlists so we can thaw them later */ + /* remember used playlists so we can thaw them later */ used_playlists.push_back(pl); pl->freeze(); } @@ -168,7 +168,7 @@ Editor::split_regions_at (nframes64_t where, RegionSelection& regions) if (arv) { _new_regionviews_show_envelope = arv->envelope_visible(); } - + if (pl) { XMLNode &before = pl->get_state(); pl->split_region ((*a)->region(), where); @@ -184,7 +184,7 @@ Editor::split_regions_at (nframes64_t where, RegionSelection& regions) (*i)->thaw(); used_playlists.pop_front(); } - + commit_reversible_command (); _new_regionviews_show_envelope = false; } @@ -197,14 +197,14 @@ Editor::select_region_for_operation (int /*dir*/, TimeAxisView **tv) nframes64_t start = 0; if (selection->time.start () == selection->time.end_frame ()) { - + /* no current selection-> is there a selected regionview? */ if (selection->regions.empty()) { return region; } - } + } if (!selection->regions.empty()) { @@ -220,18 +220,18 @@ Editor::select_region_for_operation (int /*dir*/, TimeAxisView **tv) if ((rtv = dynamic_cast<RouteTimeAxisView*> (*tv)) != 0) { boost::shared_ptr<Playlist> pl; - + if ((pl = rtv->playlist()) == 0) { return region; } - + region = pl->top_region_at (start); } - } - + } + return region; } - + void Editor::extend_selection_to_end_of_region (bool next) { @@ -278,7 +278,7 @@ Editor::extend_selection_to_start_of_region (bool previous) } /* Try to leave the selection with the same route if possible */ - + if ((tv = selection->time.track) == 0) { return; } @@ -316,19 +316,19 @@ Editor::nudge_forward (bool next, bool force_playhead) { nframes64_t distance; nframes64_t next_distance; - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); if (!session) return; - + if (!force_playhead && !rs.empty()) { begin_reversible_command (_("nudge regions forward")); for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { boost::shared_ptr<Region> r ((*i)->region()); - + distance = get_nudge_distance (r->position(), next_distance); if (next) { @@ -343,21 +343,21 @@ Editor::nudge_forward (bool next, bool force_playhead) commit_reversible_command (); - + } else if (!force_playhead && !selection->markers.empty()) { bool is_start; begin_reversible_command (_("nudge location forward")); - + for (MarkerSelection::iterator i = selection->markers.begin(); i != selection->markers.end(); ++i) { - + Location* loc = find_location_from_marker ((*i), is_start); - + if (loc) { - + XMLNode& before (loc->get_state()); - + if (is_start) { distance = get_nudge_distance (loc->start(), next_distance); if (next) { @@ -383,26 +383,26 @@ Editor::nudge_forward (bool next, bool force_playhead) session->add_command (new MementoCommand<Location>(*loc, &before, &after)); } } - + commit_reversible_command (); - + } else { distance = get_nudge_distance (playhead_cursor->current_frame, next_distance); session->request_locate (playhead_cursor->current_frame + distance); } } - + void Editor::nudge_backward (bool next, bool force_playhead) { nframes64_t distance; nframes64_t next_distance; - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); if (!session) return; - + if (!force_playhead && !rs.empty()) { begin_reversible_command (_("nudge regions backward")); @@ -411,13 +411,13 @@ Editor::nudge_backward (bool next, bool force_playhead) boost::shared_ptr<Region> r ((*i)->region()); distance = get_nudge_distance (r->position(), next_distance); - + if (next) { distance = next_distance; } XMLNode &before = r->playlist()->get_state(); - + if (r->position() > distance) { r->set_position (r->position() - distance, this); } else { @@ -438,11 +438,11 @@ Editor::nudge_backward (bool next, bool force_playhead) for (MarkerSelection::iterator i = selection->markers.begin(); i != selection->markers.end(); ++i) { Location* loc = find_location_from_marker ((*i), is_start); - + if (loc) { - + XMLNode& before (loc->get_state()); - + if (is_start) { distance = get_nudge_distance (loc->start(), next_distance); if (next) { @@ -455,25 +455,25 @@ Editor::nudge_backward (bool next, bool force_playhead) } } else { distance = get_nudge_distance (loc->end(), next_distance); - + if (next) { distance = next_distance; } - + if (distance < loc->end() - loc->length()) { loc->set_end (loc->end() - distance); } else { loc->set_end (loc->length()); } } - + XMLNode& after (loc->get_state()); session->add_command (new MementoCommand<Location>(*loc, &before, &after)); } } commit_reversible_command (); - + } else { distance = get_nudge_distance (playhead_cursor->current_frame, next_distance); @@ -490,12 +490,12 @@ void Editor::nudge_forward_capture_offset () { nframes64_t distance; - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); if (!session) return; - + if (!rs.empty()) { begin_reversible_command (_("nudge forward")); @@ -504,7 +504,7 @@ Editor::nudge_forward_capture_offset () for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { boost::shared_ptr<Region> r ((*i)->region()); - + XMLNode &before = r->playlist()->get_state(); r->set_position (r->position() + distance, this); XMLNode &after = r->playlist()->get_state(); @@ -513,19 +513,19 @@ Editor::nudge_forward_capture_offset () commit_reversible_command (); - } + } } - + void Editor::nudge_backward_capture_offset () { nframes64_t distance; - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); if (!session) return; - + if (!rs.empty()) { begin_reversible_command (_("nudge forward")); @@ -536,7 +536,7 @@ Editor::nudge_backward_capture_offset () boost::shared_ptr<Region> r ((*i)->region()); XMLNode &before = r->playlist()->get_state(); - + if (r->position() > distance) { r->set_position (r->position() - distance, this); } else { @@ -579,27 +579,27 @@ Editor::build_region_boundary_cache () if (session == 0) { return; } - + switch (snap_type) { case SnapToRegionStart: interesting_points.push_back (Start); break; case SnapToRegionEnd: interesting_points.push_back (End); - break; + break; case SnapToRegionSync: interesting_points.push_back (SyncPoint); - break; + break; case SnapToRegionBoundary: interesting_points.push_back (Start); interesting_points.push_back (End); - break; + break; default: fatal << string_compose (_("build_region_boundary_cache called with snap_type = %1"), snap_type) << endmsg; /*NOTREACHED*/ return; } - + TimeAxisView *ontrack = 0; TrackViewList tlist; @@ -631,7 +631,7 @@ Editor::build_region_boundary_cache () case End: rpos = r->last_frame(); - break; + break; case SyncPoint: rpos = r->sync_position (); @@ -641,16 +641,16 @@ Editor::build_region_boundary_cache () default: break; } - + float speed = 1.0f; RouteTimeAxisView *rtav; - + if (ontrack != 0 && (rtav = dynamic_cast<RouteTimeAxisView*>(ontrack)) != 0 ) { if (rtav->get_diskstream() != 0) { speed = rtav->get_diskstream()->speed(); } } - + rpos = track_frame_to_session_frame (rpos, speed); if (rpos < lpos) { @@ -661,8 +661,8 @@ Editor::build_region_boundary_cache () to sort later. */ - vector<nframes64_t>::iterator ri; - + vector<nframes64_t>::iterator ri; + for (ri = region_boundary_cache.begin(); ri != region_boundary_cache.end(); ++ri) { if (*ri == rpos) { break; @@ -698,7 +698,7 @@ Editor::find_next_region (nframes64_t frame, RegionPoint point, int32_t dir, Tra nframes64_t distance; boost::shared_ptr<Region> r; - + track_speed = 1.0f; if ( (rtav = dynamic_cast<RouteTimeAxisView*>(*i)) != 0 ) { if (rtav->get_diskstream()!=0) @@ -774,7 +774,7 @@ Editor::find_next_region_boundary (nframes64_t pos, int32_t dir, const TrackView distance = d; } } - + return current_nearest; } @@ -787,11 +787,11 @@ Editor::get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, if (with_selection && Config->get_region_boundaries_from_selected_tracks()) { if (!selection->tracks.empty()) { - + target = find_next_region_boundary (pos, dir, selection->tracks); - + } else { - + if (only_onscreen || Config->get_region_boundaries_from_onscreen_tracks()) { get_onscreen_tracks (tvl); target = find_next_region_boundary (pos, dir, tvl); @@ -799,7 +799,7 @@ Editor::get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, target = find_next_region_boundary (pos, dir, track_views); } } - + } else { if (only_onscreen || Config->get_region_boundaries_from_onscreen_tracks()) { @@ -809,7 +809,7 @@ Editor::get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, target = find_next_region_boundary (pos, dir, track_views); } } - + return target; } @@ -865,25 +865,25 @@ Editor::cursor_to_region_point (EditorCursor* cursor, RegionPoint point, int32_t pos+=dir; if (!selection->tracks.empty()) { - + r = find_next_region (pos, point, dir, selection->tracks, &ontrack); - + } else if (clicked_axisview) { - + TrackViewList t; t.push_back (clicked_axisview); - + r = find_next_region (pos, point, dir, t, &ontrack); - + } else { - + r = find_next_region (pos, point, dir, track_views, &ontrack); } if (r == 0) { return; } - + switch (point){ case Start: pos = r->first_frame (); @@ -896,9 +896,9 @@ Editor::cursor_to_region_point (EditorCursor* cursor, RegionPoint point, int32_t case SyncPoint: pos = r->sync_position (); // r->adjust_to_sync (r->first_frame()); - break; + break; } - + float speed = 1.0f; RouteTimeAxisView *rtav; @@ -909,7 +909,7 @@ Editor::cursor_to_region_point (EditorCursor* cursor, RegionPoint point, int32_t } pos = track_frame_to_session_frame(pos, speed); - + if (cursor == playhead_cursor) { session->request_locate (pos); } else { @@ -933,7 +933,7 @@ void Editor::cursor_to_selection_start (EditorCursor *cursor) { nframes64_t pos = 0; - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -965,7 +965,7 @@ void Editor::cursor_to_selection_end (EditorCursor *cursor) { nframes64_t pos = 0; - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -1011,7 +1011,7 @@ Editor::selected_marker_to_region_boundary (bool with_selection, int32_t dir) if (!mouse_frame (mouse, ignored)) { return; } - + add_location_mark (mouse); } @@ -1070,18 +1070,18 @@ Editor::selected_marker_to_region_point (RegionPoint point, int32_t dir) pos+=dir; if (!selection->tracks.empty()) { - + r = find_next_region (pos, point, dir, selection->tracks, &ontrack); - + } else { - + r = find_next_region (pos, point, dir, track_views, &ontrack); } if (r == 0) { return; } - + switch (point){ case Start: pos = r->first_frame (); @@ -1093,9 +1093,9 @@ Editor::selected_marker_to_region_point (RegionPoint point, int32_t dir) case SyncPoint: pos = r->adjust_to_sync (r->first_frame()); - break; + break; } - + float speed = 1.0f; RouteTimeAxisView *rtav; @@ -1137,7 +1137,7 @@ Editor::selected_marker_to_selection_start () return; } - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -1176,7 +1176,7 @@ Editor::selected_marker_to_selection_end () return; } - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -1215,13 +1215,13 @@ Editor::scroll_playhead (bool forward) pos += delta ; } else { pos = max_frames; - } + } } else { if (pos == 0) { return; - } + } if (pos > delta) { pos -= delta; @@ -1258,7 +1258,7 @@ Editor::playhead_backward () } else { pos -= cnt; } - + /* XXX this is completely insane. with the current buffering design, we'll force a complete track buffer flush and reload, just to move 1 sample !!! @@ -1286,7 +1286,7 @@ Editor::playhead_forward () } pos = playhead_cursor->current_frame; - + /* XXX this is completely insane. with the current buffering design, we'll force a complete track buffer flush and reload, just to move 1 sample !!! @@ -1307,17 +1307,17 @@ Editor::cursor_align (bool playhead_to_edit) if (selection->markers.empty()) { return; } - + session->request_locate (selection->markers.front()->position(), session->transport_rolling()); - + } else { /* move selected markers to playhead */ - + for (MarkerSelection::iterator i = selection->markers.begin(); i != selection->markers.end(); ++i) { bool ignored; - + Location* loc = find_location_from_marker (*i, ignored); - + if (loc->is_mark()) { loc->set_start (playhead_cursor->current_frame); } else { @@ -1355,7 +1355,7 @@ Editor::edit_cursor_backward () } else { pos -= cnt; } - + // EDIT CURSOR edit_cursor->set_position (pos); } @@ -1409,7 +1409,7 @@ Editor::scroll_backward (float pages) bool was_floating; float prefix; nframes64_t cnt; - + if (get_prefix (prefix, was_floating)) { cnt = (nframes64_t) floor (pages * one_page); } else { @@ -1437,7 +1437,7 @@ Editor::scroll_forward (float pages) bool was_floating; float prefix; nframes64_t cnt; - + if (get_prefix (prefix, was_floating)) { cnt = (nframes64_t) floor (pages * one_page); } else { @@ -1520,7 +1520,7 @@ void Editor::tav_zoom_step (bool coarser) { ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::temporal_zoom_step), coarser)); - + _routes->suspend_redisplay (); for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { @@ -1529,7 +1529,7 @@ Editor::tav_zoom_step (bool coarser) } _routes->resume_redisplay (); -} +} void Editor::temporal_zoom_step (bool coarser) @@ -1539,21 +1539,21 @@ Editor::temporal_zoom_step (bool coarser) double nfpu; nfpu = frames_per_unit; - - if (coarser) { + + if (coarser) { nfpu *= 1.61803399; - } else { + } else { nfpu = max(1.0,(nfpu/1.61803399)); } temporal_zoom (nfpu); -} +} void Editor::temporal_zoom (gdouble fpu) { if (!session) return; - + nframes64_t current_page = current_page_frames(); nframes64_t current_leftmost = leftmost_frame; nframes64_t current_rightmost; @@ -1573,7 +1573,7 @@ Editor::temporal_zoom (gdouble fpu) } nfpu = fpu; - + new_page_size = (nframes64_t) floor (_canvas_width * nfpu); half_page_size = new_page_size / 2; @@ -1581,7 +1581,7 @@ Editor::temporal_zoom (gdouble fpu) case ZoomFocusLeft: leftmost_after_zoom = current_leftmost; break; - + case ZoomFocusRight: current_rightmost = leftmost_frame + current_page; if (current_rightmost < new_page_size) { @@ -1590,26 +1590,26 @@ Editor::temporal_zoom (gdouble fpu) leftmost_after_zoom = current_rightmost - new_page_size; } break; - + case ZoomFocusCenter: - current_center = current_leftmost + (current_page/2); + current_center = current_leftmost + (current_page/2); if (current_center < half_page_size) { leftmost_after_zoom = 0; } else { leftmost_after_zoom = current_center - half_page_size; } break; - + case ZoomFocusPlayhead: /* try to keep the playhead in the same place */ where = playhead_cursor->current_frame; - + l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where); if (l < 0) { leftmost_after_zoom = 0; - } else if (l > max_frames) { + } else if (l > max_frames) { leftmost_after_zoom = max_frames - new_page_size; } else { leftmost_after_zoom = (nframes64_t) l; @@ -1635,7 +1635,7 @@ Editor::temporal_zoom (gdouble fpu) if (l < 0) { leftmost_after_zoom = 0; - } else if (l > max_frames) { + } else if (l > max_frames) { leftmost_after_zoom = max_frames - new_page_size; } else { leftmost_after_zoom = (nframes64_t) l; @@ -1654,7 +1654,7 @@ Editor::temporal_zoom (gdouble fpu) if (l < 0) { leftmost_after_zoom = 0; - } else if (l > max_frames) { + } else if (l > max_frames) { leftmost_after_zoom = max_frames - new_page_size; } else { leftmost_after_zoom = (nframes64_t) l; @@ -1665,13 +1665,13 @@ Editor::temporal_zoom (gdouble fpu) return; } break; - + } - + // leftmost_after_zoom = min (leftmost_after_zoom, session->current_end_frame()); reposition_and_zoom (leftmost_after_zoom, nfpu); -} +} void Editor::temporal_zoom_region (bool both_axes) @@ -1679,7 +1679,7 @@ Editor::temporal_zoom_region (bool both_axes) nframes64_t start = max_frames; nframes64_t end = 0; - RegionSelection rs; + RegionSelection rs; set<TimeAxisView*> tracks; get_regions_for_action (rs); @@ -1724,7 +1724,7 @@ Editor::temporal_zoom_region (bool both_axes) start -= extra_samples; } else { start = 0; - } + } if (max_frames - extra_samples > end) { end += extra_samples; @@ -1744,13 +1744,13 @@ Editor::temporal_zoom_region (bool both_axes) if (both_axes) { uint32_t per_track_height = (uint32_t) floor ((_canvas_height - canvas_timebars_vsize - 10.0) / tracks.size()); - + /* set visible track heights appropriately */ - + for (set<TimeAxisView*>::iterator t = tracks.begin(); t != tracks.end(); ++t) { (*t)->set_height (per_track_height); } - + /* hide irrelevant tracks */ _routes->suspend_redisplay (); @@ -1785,7 +1785,7 @@ void Editor::temporal_zoom_selection () { if (!selection) return; - + if (selection->time.empty()) { return; } @@ -1818,7 +1818,7 @@ Editor::temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string nframes64_t range = end - start; double new_fpu = (double)range / (double)_canvas_width; - + nframes64_t new_page = (nframes64_t) floor (_canvas_width * new_fpu); nframes64_t middle = (nframes64_t) floor( (double)start + ((double)range / 2.0f )); nframes64_t new_leftmost = (nframes64_t) floor( (double)middle - ((double)new_page/2.0f)); @@ -1830,7 +1830,7 @@ Editor::temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string reposition_and_zoom (new_leftmost, new_fpu); } -void +void Editor::temporal_zoom_to_frame (bool coarser, nframes64_t frame) { if (!session) { @@ -1838,13 +1838,13 @@ Editor::temporal_zoom_to_frame (bool coarser, nframes64_t frame) } double range_before = frame - leftmost_frame; double new_fpu; - + new_fpu = frames_per_unit; - - if (coarser) { + + if (coarser) { new_fpu *= 1.61803399; range_before *= 1.61803399; - } else { + } else { new_fpu = max(1.0,(new_fpu/1.61803399)); range_before /= 1.61803399; } @@ -1899,7 +1899,7 @@ Editor::choose_new_marker_name(string &name) { default: return false; } - + dialog.get_result(name); return true; @@ -1962,7 +1962,7 @@ Editor::add_location_from_playhead_cursor () void Editor::add_locations_from_audio_region () { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -1972,15 +1972,15 @@ Editor::add_locations_from_audio_region () session->begin_reversible_command (rs.size () > 1 ? _("add markers") : _("add marker")); XMLNode &before = session->locations()->get_state(); - + cerr << "Add locations\n"; for (RegionSelection::iterator i = rs.begin (); i != rs.end (); ++i) { - + boost::shared_ptr<Region> region = (*i)->region (); - + Location *location = new Location (region->position(), region->last_frame(), region->name(), Location::IsRangeMarker); - + session->locations()->add (location, true); } @@ -1992,7 +1992,7 @@ Editor::add_locations_from_audio_region () void Editor::add_location_from_audio_region () { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -2012,14 +2012,14 @@ Editor::add_location_from_audio_region () boost::shared_ptr<Region> region = rv->region(); markername = region->name(); } - + if (!choose_new_marker_name(markername)) { return; } cerr << "Add location\n"; - // single range spanning all selected + // single range spanning all selected Location *location = new Location (rs.start(), rs.end_frame(), markername, Location::IsRangeMarker); session->locations()->add (location, true); @@ -2046,7 +2046,7 @@ Editor::amplitude_zoom_step (bool in) #ifdef FIX_FOR_CANVAS /* XXX DO SOMETHING */ #endif -} +} /* DELETION */ @@ -2089,7 +2089,7 @@ Editor::jump_forward_to_mark () if (!session) { return; } - + Location *location = session->locations()->first_location_after (playhead_cursor->current_frame); if (location) { @@ -2107,7 +2107,7 @@ Editor::jump_backward_to_mark () } Location *location = session->locations()->first_location_before (playhead_cursor->current_frame); - + if (location) { session->request_locate (location->start(), session->transport_rolling()); } else { @@ -2159,15 +2159,15 @@ Editor::clear_ranges () if (session) { session->begin_reversible_command (_("clear ranges")); XMLNode &before = session->locations()->get_state(); - + Location * looploc = session->locations()->auto_loop_location(); Location * punchloc = session->locations()->auto_punch_location(); - + session->locations()->clear_ranges (); // re-add these if (looploc) session->locations()->add (looploc); if (punchloc) session->locations()->add (punchloc); - + XMLNode &after = session->locations()->get_state(); session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after)); session->commit_reversible_command (); @@ -2202,7 +2202,7 @@ Editor::unhide_ranges () { for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) { Location *l = (*i).first; - if (l->is_hidden() && l->is_range_marker()) { + if (l->is_hidden() && l->is_range_marker()) { l->set_hidden(false, this); } } @@ -2218,7 +2218,7 @@ Editor::insert_region_list_drag (boost::shared_ptr<Region> region, int x, int y) nframes64_t where; RouteTimeAxisView *rtv = 0; boost::shared_ptr<Playlist> playlist; - + track_canvas->window_to_world (x, y, wx, wy); //wx += horizontal_adjustment.get_value(); //wy += vertical_adjustment.get_value(); @@ -2227,7 +2227,7 @@ Editor::insert_region_list_drag (boost::shared_ptr<Region> region, int x, int y) event.type = GDK_BUTTON_RELEASE; event.button.x = wx; event.button.y = wy; - + where = event_frame (&event, &cx, &cy); if (where < leftmost_frame || where > leftmost_frame + current_page_frames()) { @@ -2239,7 +2239,7 @@ Editor::insert_region_list_drag (boost::shared_ptr<Region> region, int x, int y) if (tv.first == 0) { return; } - + if ((rtv = dynamic_cast<RouteTimeAxisView*> (tv.first)) == 0) { return; } @@ -2247,9 +2247,9 @@ Editor::insert_region_list_drag (boost::shared_ptr<Region> region, int x, int y) if ((playlist = rtv->playlist()) == 0) { return; } - + snap_to (where); - + begin_reversible_command (_("insert dragged region")); XMLNode &before = playlist->get_state(); playlist->add_region (RegionFactory::create (region), where, 1.0); @@ -2285,13 +2285,13 @@ Editor::insert_route_list_drag (boost::shared_ptr<Route> route, int x, int y) { return; } - /* use this drag source to add underlay to a track. But we really don't care + /* use this drag source to add underlay to a track. But we really don't care about the Route, only the view of the route, so find it first */ for(TrackViewList::iterator it = track_views.begin(); it != track_views.end(); ++it) { if((source_rtv = dynamic_cast<RouteTimeAxisView*>(*it)) == 0) { continue; } - + if(source_rtv->route() == route && source_rtv != dest_rtv) { dest_rtv->add_underlay(source_rtv->view()); break; @@ -2327,7 +2327,7 @@ Editor::insert_region_list_selection (float times) if (region == 0) { return; } - + begin_reversible_command (_("insert region")); XMLNode &before = playlist->get_state(); playlist->add_region ((RegionFactory::create (region)), get_preferred_edit_position(), times); @@ -2372,7 +2372,7 @@ Editor::transition_to_rolling (bool fwd) session->cancel_audition (); return; } - + session->request_transport_speed (fwd ? 1.0f : -1.0f); } @@ -2396,7 +2396,7 @@ Editor::toggle_playback (bool with_abort) session->cancel_audition (); return; } - + if (session->transport_rolling()) { session->request_stop (with_abort); if (session->get_play_loop()) { @@ -2456,7 +2456,7 @@ Editor::play_selection () void Editor::loop_selected_region () { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -2467,7 +2467,7 @@ Editor::loop_selected_region () if ((tll = transport_loop_location()) != 0) { tll->set (rv->region()->position(), rv->region()->last_frame()); - + // enable looping, reposition and start rolling session->request_play_loop (true); @@ -2546,7 +2546,7 @@ Editor::show_midi_list_editor () void Editor::rename_region() { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -2579,9 +2579,9 @@ Editor::rename_region() entry.select_region (0, -1); entry.signal_activate().connect (bind (mem_fun (d, &Dialog::response), RESPONSE_OK)); - + d.show_all (); - + entry.grab_focus(); int ret = d.run(); @@ -2603,7 +2603,7 @@ Editor::audition_playlist_region_via_route (boost::shared_ptr<Region> region, Ro { if (session->is_auditioning()) { session->cancel_audition (); - } + } // note: some potential for creativity here, because region doesn't // have to belong to the playlist that Route is handling @@ -2611,9 +2611,9 @@ Editor::audition_playlist_region_via_route (boost::shared_ptr<Region> region, Ro // bool was_soloed = route.soloed(); route.set_solo (true, this); - + session->request_bounded_roll (region->position(), region->position() + region->length()); - + /* XXX how to unset the solo state ? */ } @@ -2633,10 +2633,10 @@ Editor::play_selected_region () { nframes64_t start = max_frames; nframes64_t end = 0; - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); - + if (rs.empty()) { return; } @@ -2666,7 +2666,7 @@ Editor::build_interthread_progress_window () interthread_progress_window = new ArdourDialog (X_("interthread progress"), true); interthread_progress_bar.set_orientation (Gtk::PROGRESS_LEFT_TO_RIGHT); - + interthread_progress_window->set_border_width (12); interthread_progress_window->get_vbox()->set_spacing (6); @@ -2710,7 +2710,7 @@ Editor::region_from_selection () TrackSelection tracks = get_tracks_for_range_action (); nframes64_t selection_cnt = end - start + 1; - + for (TrackSelection::iterator i = tracks.begin(); i != tracks.end(); ++i) { boost::shared_ptr<Region> current; boost::shared_ptr<Playlist> pl; @@ -2730,7 +2730,7 @@ Editor::region_from_selection () boost::shared_ptr<Region> region (RegionFactory::create (current, internal_start, selection_cnt, new_name)); } -} +} void Editor::create_region_from_selection (vector<boost::shared_ptr<Region> >& new_regions) @@ -2741,7 +2741,7 @@ Editor::create_region_from_selection (vector<boost::shared_ptr<Region> >& new_re nframes64_t start = selection->time[clicked_selection].start; nframes64_t end = selection->time[clicked_selection].end; - + sort_track_selection (); for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { @@ -2769,7 +2769,7 @@ Editor::create_region_from_selection (vector<boost::shared_ptr<Region> >& new_re void Editor::split_multichannel_region () { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -2812,9 +2812,9 @@ TrackSelection Editor::get_tracks_for_range_action () const { TrackSelection t; - + if (selection->tracks.empty()) { - + /* use tracks with selected regions */ RegionSelection rs = selection->regions; @@ -2863,7 +2863,7 @@ Editor::separate_regions_between (const TimeSelection& ts) if (rtv->track()->diskstream()->destructive()) { continue; } - + if ((playlist = rtv->playlist()) != 0) { XMLNode *before; @@ -2889,21 +2889,21 @@ Editor::separate_regions_between (const TimeSelection& ts) c.disconnect (); if (!latest_regionviews.empty()) { - + got_some = true; rtv->view()->foreach_regionview (bind ( sigc::ptr_fun (add_if_covered), &(*t), &new_selection)); - + if (!in_command) { begin_reversible_command (_("separate")); in_command = true; } - + session->add_command(new MementoCommand<Playlist>( *playlist, before, &playlist->get_state())); - } + } } if (!got_some) { @@ -2942,9 +2942,9 @@ Editor::separate_region_from_selection () nframes64_t start; nframes64_t end; - + if (get_edit_op_range (start, end)) { - + AudioRange ar (start, end, 1); TimeSelection ts; ts.push_back (ar); @@ -3003,8 +3003,8 @@ Editor::crop_region_to_selection () crop_region_to (start, end); } } - -} + +} void Editor::crop_region_to (nframes64_t start, nframes64_t end) @@ -3019,17 +3019,17 @@ Editor::crop_region_to (nframes64_t start, nframes64_t end) sort_track_selection (); ts = &selection->tracks; } - + for (TrackSelection::iterator i = ts->begin(); i != ts->end(); ++i) { - + RouteTimeAxisView* rtv; - + if ((rtv = dynamic_cast<RouteTimeAxisView*> ((*i))) != 0) { boost::shared_ptr<Track> t = rtv->track(); if (t != 0 && ! t->diskstream()->destructive()) { - + if ((playlist = rtv->playlist()) != 0) { playlists.push_back (playlist); } @@ -3040,27 +3040,27 @@ Editor::crop_region_to (nframes64_t start, nframes64_t end) if (playlists.empty()) { return; } - + nframes64_t the_start; nframes64_t the_end; nframes64_t cnt; - + begin_reversible_command (_("trim to selection")); - + for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) { - + boost::shared_ptr<Region> region; - + the_start = start; - + if ((region = (*i)->top_region_at(the_start)) == 0) { continue; } - + /* now adjust lengths to that we do the right thing if the selection extends beyond the region */ - + the_start = max (the_start, (nframes64_t) region->position()); if (max_frames - the_start < region->length()) { the_end = the_start + region->length() - 1; @@ -3069,21 +3069,21 @@ Editor::crop_region_to (nframes64_t start, nframes64_t end) } the_end = min (end, the_end); cnt = the_end - the_start + 1; - + XMLNode &before = (*i)->get_state(); region->trim_to (the_start, cnt, this); XMLNode &after = (*i)->get_state(); session->add_command (new MementoCommand<Playlist>(*(*i), &before, &after)); } - + commit_reversible_command (); -} +} void Editor::region_fill_track () { nframes64_t end; - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -3098,7 +3098,7 @@ Editor::region_fill_track () for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { boost::shared_ptr<Region> region ((*i)->region()); - + // FIXME boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion>(region); assert(ar); @@ -3142,7 +3142,7 @@ Editor::region_fill_selection () nframes64_t start = selection->time[clicked_selection].start; nframes64_t end = selection->time[clicked_selection].end; - boost::shared_ptr<Playlist> playlist; + boost::shared_ptr<Playlist> playlist; if (selection->tracks.empty()) { return; @@ -3150,21 +3150,21 @@ Editor::region_fill_selection () nframes64_t selection_length = end - start; float times = (float)selection_length / region->length(); - + begin_reversible_command (_("fill selection")); - + for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { if ((playlist = (*i)->playlist()) == 0) { continue; - } - + } + XMLNode &before = playlist->get_state(); playlist->add_region (RegionFactory::create (region), start, times); session->add_command (new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state())); } - - commit_reversible_command (); + + commit_reversible_command (); } void @@ -3182,7 +3182,7 @@ Editor::set_sync_point (nframes64_t where, const RegionSelection& rs) bool in_command = false; for (RegionSelection::const_iterator r = rs.begin(); r != rs.end(); ++r) { - + if (!(*r)->region()->covers (where)) { continue; } @@ -3209,7 +3209,7 @@ Editor::set_sync_point (nframes64_t where, const RegionSelection& rs) void Editor::remove_region_sync () { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -3231,7 +3231,7 @@ Editor::remove_region_sync () void Editor::naturalize () { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -3252,7 +3252,7 @@ Editor::naturalize () void Editor::align (RegionPoint what) { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); nframes64_t where = get_preferred_edit_position(); @@ -3271,13 +3271,13 @@ void Editor::align_relative (RegionPoint what) { nframes64_t where = get_preferred_edit_position(); - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); if (!rs.empty()) { align_selection_relative (what, where, rs); - } + } } struct RegionSortByTime { @@ -3312,7 +3312,7 @@ Editor::align_selection_relative (RegionPoint point, nframes64_t position, const dir = -1; } break; - + case End: if (position > r->last_frame()) { distance = position - r->last_frame(); @@ -3332,7 +3332,7 @@ Editor::align_selection_relative (RegionPoint point, nframes64_t position, const distance = r->position() - pos; dir = -1; } - break; + break; } if (pos == r->position()) { @@ -3349,15 +3349,15 @@ Editor::align_selection_relative (RegionPoint point, nframes64_t position, const session->add_command(new MementoCommand<Playlist>(*(r->playlist()), &before, &after)); /* move rest by the same amount */ - + sorted.pop_front(); - + for (list<RegionView*>::iterator i = sorted.begin(); i != sorted.end(); ++i) { boost::shared_ptr<Region> region ((*i)->region()); XMLNode &before = region->playlist()->get_state(); - + if (dir > 0) { region->set_position (region->position() + distance, this); } else { @@ -3419,7 +3419,7 @@ Editor::align_region_internal (boost::shared_ptr<Region> region, RegionPoint poi XMLNode &after = region->playlist()->get_state(); session->add_command(new MementoCommand<Playlist>(*(region->playlist()), &before, &after)); -} +} void Editor::trim_region_front () @@ -3452,9 +3452,9 @@ Editor::trim_region (bool front) boost::shared_ptr<Playlist> pl = (*i)->region()->playlist(); XMLNode &before = pl->get_state(); if (front) { - (*i)->region()->trim_front (where, this); + (*i)->region()->trim_front (where, this); } else { - (*i)->region()->trim_end (where, this); + (*i)->region()->trim_end (where, this); } XMLNode &after = pl->get_state(); session->add_command(new MementoCommand<Playlist>(*pl.get(), &before, &after)); @@ -3503,7 +3503,7 @@ Editor::trim_region_to_location (const Location& loc, const char* str) default: continue; } - + RouteTimeAxisView* tav = dynamic_cast<RouteTimeAxisView*> (&rv->get_time_axis_view()); if (!tav) { return; @@ -3516,7 +3516,7 @@ Editor::trim_region_to_location (const Location& loc, const char* str) if (tav->get_diskstream() != 0) { speed = tav->get_diskstream()->speed(); } - + start = session_frame_to_track_frame (loc.start(), speed); end = session_frame_to_track_frame (loc.end(), speed); @@ -3534,7 +3534,7 @@ void Editor::trim_region_to_edit_point () { RegionSelection rs; - + get_regions_for_action (rs); nframes64_t where = get_preferred_edit_position(); @@ -3566,7 +3566,7 @@ Editor::trim_region_to_edit_point () session->add_command(new MementoCommand<Playlist>( *(rv->region()->playlist()), &before, &after)); } - + commit_reversible_command (); } @@ -3606,7 +3606,7 @@ Editor::trim_region_from_edit_point () session->add_command(new MementoCommand<Playlist>( *(rv->region()->playlist()), &before, &after)); } - + commit_reversible_command (); } @@ -3653,10 +3653,10 @@ Editor::trim_to_region(bool forward) speed = atav->get_diskstream()->speed(); } - + boost::shared_ptr<Region> region = arv->region(); boost::shared_ptr<Playlist> playlist (region->playlist()); - + XMLNode &before = playlist->get_state(); if(forward){ @@ -3678,7 +3678,7 @@ Editor::trim_to_region(bool forward) continue; } - region->trim_front((nframes64_t) ((next_region->last_frame() + 1) * speed), this); + region->trim_front((nframes64_t) ((next_region->last_frame() + 1) * speed), this); arv->region_changed (Change (LengthChanged|PositionChanged|StartChanged)); } @@ -3695,7 +3695,7 @@ Editor::unfreeze_route () if (clicked_routeview == 0 || !clicked_routeview->is_track()) { return; } - + clicked_routeview->track()->unfreeze (); } @@ -3727,7 +3727,7 @@ Editor::freeze_route () if (clicked_routeview == 0 || !clicked_routeview->is_audio_track()) { return; } - + InterThreadInfo itt; if (interthread_progress_window == 0) { @@ -3744,13 +3744,13 @@ Editor::freeze_route () interthread_cancel_label.set_text (_("Cancel Freeze")); current_interthread_info = &itt; - interthread_progress_connection = + interthread_progress_connection = Glib::signal_timeout().connect (bind (mem_fun(*this, &Editor::freeze_progress_timeout), (gpointer) 0), 100); itt.done = false; itt.cancel = false; itt.progress = 0.0f; - + pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 500000); @@ -3793,22 +3793,22 @@ Editor::bounce_range_selection (bool replace, bool enable_processing) if ((rtv = dynamic_cast<RouteTimeAxisView*> (*i)) == 0) { continue; } - + boost::shared_ptr<Playlist> playlist; - + if ((playlist = rtv->playlist()) == 0) { return; } InterThreadInfo itt; - + itt.done = false; itt.cancel = false; itt.progress = false; XMLNode &before = playlist->get_state(); boost::shared_ptr<Region> r = rtv->track()->bounce_range (start, start+cnt, itt, enable_processing); - + if (replace) { list<AudioRange> ranges; ranges.push_back (AudioRange (start, start+cnt, 0)); @@ -3819,7 +3819,7 @@ Editor::bounce_range_selection (bool replace, bool enable_processing) XMLNode &after = playlist->get_state(); session->add_command (new MementoCommand<Playlist> (*playlist, &before, &after)); } - + commit_reversible_command (); } @@ -3843,19 +3843,19 @@ bool Editor::can_cut_copy () const { switch (current_mouse_mode()) { - + case MouseObject: if (!selection->regions.empty() || !selection->points.empty()) { return true; } break; - + case MouseRange: if (!selection->time.empty()) { return true; } break; - + default: break; } @@ -3867,7 +3867,7 @@ Editor::can_cut_copy () const /** Cut, copy or clear selected regions, automation points or a time range. * @param op Operation (Cut, Copy or Clear) */ -void +void Editor::cut_copy (CutCopyOp op) { /* only cancel selection if cut/copy is successful.*/ @@ -3899,7 +3899,7 @@ Editor::cut_copy (CutCopyOp op) _drag = 0; } } - + cut_buffer->clear (); if (entered_marker) { @@ -3930,26 +3930,26 @@ Editor::cut_copy (CutCopyOp op) default: break; } - + } else { - - RegionSelection rs; - + + RegionSelection rs; + /* we only want to cut regions if some are selected */ - + if (!selection->regions.empty()) { get_regions_for_action (rs, false, false); } switch (current_mouse_mode()) { - case MouseObject: + case MouseObject: if (!rs.empty() || !selection->points.empty()) { begin_reversible_command (opname + _(" objects")); if (!rs.empty()) { cut_copy_regions (op, rs); - + if (op == Cut) { selection->clear_regions (); } @@ -3963,15 +3963,15 @@ Editor::cut_copy (CutCopyOp op) } } - commit_reversible_command (); + commit_reversible_command (); break; // terminate case statement here - } + } if (!selection->time.empty()) { /* don't cause suprises */ break; } // fall thru if there was nothing selected - + case MouseRange: if (selection->time.empty()) { nframes64_t start, end; @@ -3980,22 +3980,22 @@ Editor::cut_copy (CutCopyOp op) } selection->set ((TimeAxisView*) 0, start, end); } - + begin_reversible_command (opname + _(" range")); cut_copy_ranges (op); commit_reversible_command (); - + if (op == Cut) { selection->clear_time (); } break; - + default: break; } } - + if (op == Cut || op == Clear) { break_drag (); delete _drag; @@ -4015,7 +4015,7 @@ Editor::cut_copy_points (CutCopyOp op) if (atv) { atv->cut_copy_clear_objects (selection->points, op); - } + } } } @@ -4041,8 +4041,8 @@ struct lt_playlist { return a.playlist < b.playlist; } }; - -struct PlaylistMapping { + +struct PlaylistMapping { TimeAxisView* tv; boost::shared_ptr<Playlist> pl; @@ -4058,7 +4058,7 @@ Editor::remove_clicked_region () } boost::shared_ptr<Playlist> playlist = clicked_routeview->playlist(); - + begin_reversible_command (_("remove region")); XMLNode &before = playlist->get_state(); playlist->remove_region (clicked_regionview->region()); @@ -4072,9 +4072,9 @@ Editor::remove_clicked_region () void Editor::remove_selected_regions () { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); - + if (!session) { return; } @@ -4096,12 +4096,12 @@ Editor::remove_selected_regions () // so, first iterate over the regions to be removed from rs and // add them to the regions_to_remove list, and then // iterate over the list to actually remove them. - + regions_to_remove.push_back ((*i)->region()); } vector<PlaylistState> playlists; - + for (list<boost::shared_ptr<Region> >::iterator rl = regions_to_remove.begin(); rl != regions_to_remove.end(); ++rl) { boost::shared_ptr<Playlist> playlist = (*rl)->playlist(); @@ -4130,7 +4130,7 @@ Editor::remove_selected_regions () playlists.push_back(before); } - playlist->remove_region (*rl); + playlist->remove_region (*rl); } vector<PlaylistState>::iterator pl; @@ -4156,12 +4156,12 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) vector<PlaylistMapping> pmap; nframes64_t first_position = max_frames; - + set<PlaylistState, lt_playlist> freezelist; pair<set<PlaylistState, lt_playlist>::iterator,bool> insert_result; - + /* get ordering correct before we cut/copy */ - + rs.sort_by_position_and_track (); for (RegionSelection::iterator x = rs.begin(); x != rs.end(); ++x) { @@ -4180,7 +4180,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) break; } } - + if (fl == freezelist.end()) { PlaylistState before; before.playlist = pl; @@ -4199,7 +4199,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) break; } } - + if (z == pmap.end()) { pmap.push_back (PlaylistMapping (tv)); } @@ -4208,7 +4208,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) for (RegionSelection::iterator x = rs.begin(); x != rs.end(); ) { boost::shared_ptr<Playlist> pl = (*x)->region()->playlist(); - + if (!pl) { /* impossible, but this handles it for the future */ continue; @@ -4217,20 +4217,20 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) TimeAxisView& tv = (*x)->get_trackview(); boost::shared_ptr<Playlist> npl; RegionSelection::iterator tmp; - + tmp = x; ++tmp; vector<PlaylistMapping>::iterator z; - + for (z = pmap.begin(); z != pmap.end(); ++z) { if ((*z).tv == &tv) { break; } } - + assert (z != pmap.end()); - + if (!(*z).pl) { npl = PlaylistFactory::create (pl->data_type(), *session, "cutlist", true); npl->freeze(); @@ -4238,7 +4238,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) } else { npl = (*z).pl; } - + boost::shared_ptr<Region> r = (*x)->region(); boost::shared_ptr<Region> _xx; @@ -4250,12 +4250,12 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) npl->add_region (_xx, r->position() - first_position); pl->remove_region (r); break; - + case Copy: /* copy region before adding, so we're not putting same object into two different playlists */ npl->add_region (RegionFactory::create (r), r->position() - first_position); break; - + case Clear: pl->remove_region (r); break; @@ -4263,16 +4263,16 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) x = tmp; } - + list<boost::shared_ptr<Playlist> > foo; - + /* the pmap is in the same order as the tracks in which selected regions occured */ - + for (vector<PlaylistMapping>::iterator i = pmap.begin(); i != pmap.end(); ++i) { (*i).pl->thaw(); foo.push_back ((*i).pl); } - + if (!foo.empty()) { cut_buffer->set (foo); @@ -4333,7 +4333,7 @@ Editor::paste_internal (nframes64_t position, float times) if (internal_editing()) { if (cut_buffer->midi_notes.empty()) { return; - } + } } else { if (cut_buffer->empty()) { return; @@ -4364,14 +4364,14 @@ Editor::paste_internal (nframes64_t position, float times) /* undo/redo is handled by individual tracks/regions */ if (internal_editing()) { - + RegionSelection rs; RegionSelection::iterator r; MidiNoteSelection::iterator cb; get_regions_at (rs, position, ts); - for (cb = cut_buffer->midi_notes.begin(), r = rs.begin(); + for (cb = cut_buffer->midi_notes.begin(), r = rs.begin(); cb != cut_buffer->midi_notes.end() && r != rs.end(); ++r) { MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (*r); if (mrv) { @@ -4385,9 +4385,9 @@ Editor::paste_internal (nframes64_t position, float times) if ((*i)->paste (position, times, *cut_buffer, nth)) { commit = true; } - } + } } - + if (commit) { commit_reversible_command (); } @@ -4411,13 +4411,13 @@ Editor::paste_named_selection (float times) list<boost::shared_ptr<Playlist> >::iterator tmp; chunk = ns->playlists.begin(); - + begin_reversible_command (_("paste chunk")); - + sort_track_selection (); for (t = selection->tracks.begin(); t != selection->tracks.end(); ++t) { - + RouteTimeAxisView* rtv; boost::shared_ptr<Playlist> pl; boost::shared_ptr<AudioPlaylist> apl; @@ -4429,7 +4429,7 @@ Editor::paste_named_selection (float times) if ((pl = rtv->playlist()) == 0) { continue; } - + if ((apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl)) == 0) { continue; } @@ -4452,7 +4452,7 @@ Editor::paste_named_selection (float times) void Editor::duplicate_some_regions (RegionSelection& regions, float times) { - boost::shared_ptr<Playlist> playlist; + boost::shared_ptr<Playlist> playlist; RegionSelection sel = regions; // clear (below) may clear the argument list if its the current region selection RegionSelection foo; @@ -4468,14 +4468,14 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times) RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (&tv); latest_regionviews.clear (); sigc::connection c = rtv->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view)); - + playlist = (*i)->region()->playlist(); XMLNode &before = playlist->get_state(); playlist->duplicate (r, r->last_frame(), times); session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state())); c.disconnect (); - + foo.insert (foo.end(), latest_regionviews.begin(), latest_regionviews.end()); } @@ -4493,16 +4493,16 @@ Editor::duplicate_selection (float times) return; } - boost::shared_ptr<Playlist> playlist; + boost::shared_ptr<Playlist> playlist; vector<boost::shared_ptr<Region> > new_regions; vector<boost::shared_ptr<Region> >::iterator ri; - + create_region_from_selection (new_regions); if (new_regions.empty()) { return; } - + begin_reversible_command (_("duplicate selection")); ri = new_regions.begin(); @@ -4531,12 +4531,12 @@ Editor::reset_point_selection () /* reset all selected points to the relevant default value */ for (PointSelection::iterator i = selection->points.begin(); i != selection->points.end(); ++i) { - + AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*>(&(*i).track); - + if (atv) { atv->reset_objects (selection->points); - } + } } } @@ -4568,7 +4568,7 @@ Editor::clear_playlist (boost::shared_ptr<Playlist> playlist) void Editor::nudge_track (bool use_edit, bool forwards) { - boost::shared_ptr<Playlist> playlist; + boost::shared_ptr<Playlist> playlist; nframes64_t distance; nframes64_t next_distance; nframes64_t start; @@ -4582,26 +4582,26 @@ Editor::nudge_track (bool use_edit, bool forwards) if ((distance = get_nudge_distance (start, next_distance)) == 0) { return; } - + if (selection->tracks.empty()) { return; } - + begin_reversible_command (_("nudge track")); - + for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { if ((playlist = (*i)->playlist()) == 0) { continue; - } - + } + XMLNode &before = playlist->get_state(); playlist->nudge_after (start, distance, forwards); XMLNode &after = playlist->get_state(); session->add_command (new MementoCommand<Playlist>(*playlist, &before, &after)); } - - commit_reversible_command (); + + commit_reversible_command (); } void @@ -4609,7 +4609,7 @@ Editor::remove_last_capture () { vector<string> choices; string prompt; - + if (!session) { return; } @@ -4620,9 +4620,9 @@ Editor::remove_last_capture () choices.push_back (_("No, do nothing.")); choices.push_back (_("Yes, destroy it.")); - + Gtkmm2ext::Choice prompter (prompt, choices); - + if (prompter.run () == 1) { session->remove_last_capture (); } @@ -4639,13 +4639,13 @@ Editor::normalize_region () return; } - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); if (rs.empty()) { return; } - + Dialog dialog (rs.size() > 1 ? _("Normalize regions") : _("Normalize region")); HBox hbox; hbox.pack_start (*manage (new Label (_("Normalize to:")))); @@ -4693,7 +4693,7 @@ Editor::reset_region_scale_amplitude () return; } - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -4722,7 +4722,7 @@ Editor::adjust_region_scale_amplitude (bool up) return; } - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -4737,9 +4737,9 @@ Editor::adjust_region_scale_amplitude (bool up) if (!arv) continue; XMLNode &before = arv->region()->get_state(); - + double fraction = gain_to_slider_position (arv->audio_region()->scale_amplitude ()); - + if (up) { fraction += 0.05; fraction = min (fraction, 1.0); @@ -4757,7 +4757,7 @@ Editor::adjust_region_scale_amplitude (bool up) if (up && fraction >= 2.0) { continue; } - + arv->audio_region()->set_scale_amplitude (fraction); session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state())); } @@ -4792,14 +4792,14 @@ Editor::strip_region_silence () } std::list<boost::shared_ptr<AudioRegion> > ar; - + for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { AudioRegionView* const arv = dynamic_cast<AudioRegionView*> (*i); if (arv) { ar.push_back (arv->audio_region ()); } } - + StripSilenceDialog d (ar); int const r = d.run (); @@ -4820,11 +4820,11 @@ Editor::apply_midi_note_edit_op_to_region (MidiOperator& op, MidiRegionView& mrv return op (mrv.midi_region()->model(), v); } - + void Editor::apply_midi_note_edit_op (MidiOperator& op) { - RegionSelection rs; + RegionSelection rs; Command* cmd; get_regions_for_action (rs); @@ -4848,7 +4848,7 @@ Editor::apply_midi_note_edit_op (MidiOperator& op) session->add_command (cmd); } } - + r = tmp; } @@ -4868,8 +4868,8 @@ Editor::quantize_region () qd->present (); qd->run (); qd->hide (); - - Quantize quant (*session, Plain, + + Quantize quant (*session, Plain, qd->snap_start(), qd->snap_end(), qd->start_grid_size(), qd->end_grid_size(), qd->strength(), qd->swing(), qd->threshold()); @@ -4880,7 +4880,7 @@ Editor::quantize_region () void Editor::apply_filter (Filter& filter, string command) { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -4909,7 +4909,7 @@ Editor::apply_filter (Filter& filter, string command) /* no regions returned; remove the old one */ playlist->remove_region (arv->region ()); - + } else { std::vector<boost::shared_ptr<Region> >::iterator res = filter.results.begin (); @@ -4923,7 +4923,7 @@ Editor::apply_filter (Filter& filter, string command) playlist->add_region (*res, (*res)->position()); ++res; } - + } XMLNode &after = playlist->get_state(); @@ -4981,7 +4981,7 @@ void Editor::brush (nframes64_t pos) { RegionSelection sel; - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -5053,7 +5053,7 @@ Editor::toggle_gain_envelope_active () if (!session || rs.empty()) { return; } - + session->begin_reversible_command (_("region gain envelope active")); for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { @@ -5077,7 +5077,7 @@ Editor::toggle_region_lock () if (!session || rs.empty()) { return; } - + session->begin_reversible_command (_("region lock")); for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { @@ -5098,7 +5098,7 @@ Editor::set_region_lock_style (Region::PositionLockStyle ps) if (!session || rs.empty()) { return; } - + session->begin_reversible_command (_("region lock style")); for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { @@ -5120,7 +5120,7 @@ Editor::toggle_region_mute () if (!session || rs.empty()) { return; } - + session->begin_reversible_command (_("region mute")); for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { @@ -5141,7 +5141,7 @@ Editor::toggle_region_opaque () if (!session || rs.empty()) { return; } - + session->begin_reversible_command (_("region opacity")); for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { @@ -5179,7 +5179,7 @@ Editor::toggle_record_enable () void Editor::set_fade_length (bool in) { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs, true); @@ -5194,7 +5194,7 @@ Editor::set_fade_length (bool in) nframes64_t pos = get_preferred_edit_position(); nframes64_t len; char* cmd; - + if (pos > rv->region()->last_frame() || pos < rv->region()->first_frame()) { /* edit point is outside the relevant region */ return; @@ -5241,7 +5241,7 @@ Editor::set_fade_length (bool in) tmp->audio_region()->set_fade_out_length (len); tmp->audio_region()->set_fade_out_active (true); } - + XMLNode &after = alist->get_state(); session->add_command(new MementoCommand<AutomationList>(*alist, &before, &after)); } @@ -5252,7 +5252,7 @@ Editor::set_fade_length (bool in) void Editor::toggle_fade_active (bool in) { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -5268,7 +5268,7 @@ Editor::toggle_fade_active (bool in) for (RegionSelection::iterator x = rs.begin(); x != rs.end(); ++x) { AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*x); - + if (!tmp) { return; } @@ -5276,7 +5276,7 @@ Editor::toggle_fade_active (bool in) boost::shared_ptr<AudioRegion> region (tmp->audio_region()); /* make the behaviour consistent across all regions */ - + if (!have_switch) { if (in) { yn = region->fade_in_active(); @@ -5302,7 +5302,7 @@ Editor::toggle_fade_active (bool in) void Editor::set_fade_in_shape (AudioRegion::FadeShape shape) { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -5323,19 +5323,19 @@ Editor::set_fade_in_shape (AudioRegion::FadeShape shape) XMLNode &before = alist->get_state(); tmp->audio_region()->set_fade_in_shape (shape); - + XMLNode &after = alist->get_state(); session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after)); } commit_reversible_command (); - + } void Editor::set_fade_out_shape (AudioRegion::FadeShape shape) { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -5356,7 +5356,7 @@ Editor::set_fade_out_shape (AudioRegion::FadeShape shape) XMLNode &before = alist->get_state(); tmp->audio_region()->set_fade_out_shape (shape); - + XMLNode &after = alist->get_state(); session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after)); } @@ -5367,7 +5367,7 @@ Editor::set_fade_out_shape (AudioRegion::FadeShape shape) void Editor::set_fade_in_active (bool yn) { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -5390,7 +5390,7 @@ Editor::set_fade_in_active (bool yn) XMLNode &before = ar->get_state(); ar->set_fade_in_active (yn); - + XMLNode &after = ar->get_state(); session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after)); } @@ -5401,7 +5401,7 @@ Editor::set_fade_in_active (bool yn) void Editor::set_fade_out_active (bool yn) { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -5423,7 +5423,7 @@ Editor::set_fade_out_active (bool yn) XMLNode &before = ar->get_state(); ar->set_fade_out_active (yn); - + XMLNode &after = ar->get_state(); session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after)); } @@ -5440,7 +5440,7 @@ Editor::toggle_selected_region_fades (int dir) bool yn; get_regions_for_action (rs); - + if (rs.empty()) { return; } @@ -5500,7 +5500,7 @@ void Editor::update_xfade_visibility () { _xfade_visibility = session->config.get_xfades_visible (); - + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { AudioTimeAxisView* v = dynamic_cast<AudioTimeAxisView*>(*i); if (v) { @@ -5522,11 +5522,11 @@ Editor::set_edit_point () if (!mouse_frame (where, ignored)) { return; } - + snap_to (where); if (selection->markers.empty()) { - + mouse_add_new_marker (where); } else { @@ -5552,9 +5552,9 @@ Editor::set_playhead_cursor () if (!mouse_frame (where, ignored)) { return; } - + snap_to (where); - + if (session) { session->request_locate (where, session->transport_rolling()); } @@ -5564,8 +5564,8 @@ Editor::set_playhead_cursor () void Editor::split () { - RegionSelection rs; - + RegionSelection rs; + get_regions_for_action (rs, true); nframes64_t where = get_preferred_edit_position(); @@ -5704,7 +5704,7 @@ Editor::set_loop_from_selection (bool play) nframes64_t start = selection->time[clicked_selection].start; nframes64_t end = selection->time[clicked_selection].end; - + set_loop_range (start, end, _("set loop range from selection")); if (play) { @@ -5722,7 +5722,7 @@ Editor::set_loop_from_edit_range (bool play) nframes64_t start; nframes64_t end; - + if (!get_edit_op_range (start, end)) { return; } @@ -5741,7 +5741,7 @@ Editor::set_loop_from_region (bool play) nframes64_t start = max_frames; nframes64_t end = 0; - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -5775,7 +5775,7 @@ Editor::set_punch_from_selection () nframes64_t start = selection->time[clicked_selection].start; nframes64_t end = selection->time[clicked_selection].end; - + set_punch_range (start, end, _("set punch range from selection")); } @@ -5788,7 +5788,7 @@ Editor::set_punch_from_edit_range () nframes64_t start; nframes64_t end; - + if (!get_edit_op_range (start, end)) { return; } @@ -5802,7 +5802,7 @@ Editor::set_punch_from_region () nframes64_t start = max_frames; nframes64_t end = 0; - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -5825,17 +5825,17 @@ Editor::set_punch_from_region () void Editor::pitch_shift_regions () { - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); - + if (rs.empty()) { return; } pitch_shift (rs, 1.2); } - + void Editor::use_region_as_bar () { @@ -5843,7 +5843,7 @@ Editor::use_region_as_bar () return; } - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -5869,7 +5869,7 @@ void Editor::define_one_bar (nframes64_t start, nframes64_t end) { nframes64_t length = end - start; - + const Meter& m (session->tempo_map().meter_at (start)); /* length = 1 bar */ @@ -5879,14 +5879,14 @@ Editor::define_one_bar (nframes64_t start, nframes64_t end) */ double frames_per_beat = length / m.beats_per_bar(); - + /* beats per minute = */ double beats_per_minute = (session->frame_rate() * 60.0) / frames_per_beat; /* now decide whether to: - (a) set global tempo + (a) set global tempo (b) add a new tempo marker */ @@ -5896,7 +5896,7 @@ Editor::define_one_bar (nframes64_t start, nframes64_t end) bool do_global = false; if ((session->tempo_map().n_tempos() == 1) && (session->tempo_map().n_meters() == 1)) { - + /* only 1 tempo & 1 meter: ask if the user wants to set the tempo at the start, or create a new marker */ @@ -5925,7 +5925,7 @@ Editor::define_one_bar (nframes64_t start, nframes64_t end) /* more than 1 tempo and/or meter section already, go ahead do the "usual": if the marker is at the region starter, change it, otherwise add - a new tempo marker + a new tempo marker */ } @@ -5955,7 +5955,7 @@ Editor::split_region_at_transients () return; } - RegionSelection rs; + RegionSelection rs; get_regions_for_action (rs); @@ -5973,12 +5973,12 @@ Editor::split_region_at_transients () ++tmp; boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> ((*i)->region()); - + if (ar && (ar->get_transients (positions) == 0)) { split_region_at_points ((*i)->region(), positions, true); positions.clear (); } - + i = tmp; } @@ -5992,11 +5992,11 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList bool use_rhythmic_rodent = false; boost::shared_ptr<Playlist> pl = r->playlist(); - + if (!pl) { return; } - + if (positions.empty()) { return; } @@ -6031,44 +6031,44 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList return; } } - + if (use_rhythmic_rodent) { show_rhythm_ferret (); return; } - AnalysisFeatureList::const_iterator x; - + AnalysisFeatureList::const_iterator x; + nframes64_t pos = r->position(); XMLNode& before (pl->get_state()); - + x = positions.begin(); - + while (x != positions.end()) { if ((*x) > pos) { break; } ++x; } - + if (x == positions.end()) { return; } - + pl->freeze (); pl->remove_region (r); - + while (x != positions.end()) { - - /* file start = original start + how far we from the initial position ? + + /* file start = original start + how far we from the initial position ? */ - + nframes64_t file_start = r->start() + (pos - r->position()); /* length = next position - current position */ - + nframes64_t len = (*x) - pos; /* XXX we do we really want to allow even single-sample regions? @@ -6078,13 +6078,13 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList if (len <= 0) { break; } - + string new_name; - + if (session->region_name (new_name, r->name())) { break; } - + /* do NOT announce new regions 1 by one, just wait till they are all done */ boost::shared_ptr<Region> nr = RegionFactory::create (r->sources(), file_start, len, new_name, 0, Region::DefaultFlags, false); @@ -6096,7 +6096,7 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList if (*x > r->last_frame()) { /* add final fragment */ - + file_start = r->start() + (pos - r->position()); len = r->last_frame() - pos; @@ -6105,12 +6105,12 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList break; } - } + } pl->thaw (); XMLNode& after (pl->get_state()); - + session->add_command (new MementoCommand<Playlist>(*pl, &before, &after)); } @@ -6137,7 +6137,7 @@ Editor::tab_to_transient (bool forward) boost::shared_ptr<Playlist> pl = rtv->get_diskstream()->playlist (); if (pl) { nframes64_t result = pl->find_next_transient (pos, forward ? 1 : -1); - + if (result >= 0) { positions.push_back (result); } @@ -6147,15 +6147,15 @@ Editor::tab_to_transient (bool forward) } } else { - - RegionSelection rs; + + RegionSelection rs; get_regions_for_action (rs); - + if (rs.empty()) { return; } - + for (RegionSelection::iterator r = rs.begin(); r != rs.end(); ++r) { (*r)->region()->get_transients (positions); } @@ -6277,7 +6277,7 @@ Editor::remove_tracks () } routes.push_back (rtv->_route); } - + if (ntracks + nbusses == 0) { return; } @@ -6339,7 +6339,7 @@ Editor::do_insert_time () ArdourDialog d (*this, _("Insert Time")); nframes64_t const pos = get_preferred_edit_position (); - + d.get_vbox()->set_border_width (12); d.get_vbox()->set_spacing (4); @@ -6352,7 +6352,7 @@ Editor::do_insert_time () AudioClock clock ("insertTimeClock", true, X_("InsertTimeClock"), true, true, true); clock.set (0); clock.set_session (session); - clock.set_bbt_reference (pos); + clock.set_bbt_reference (pos); table.attach (clock, 1, 2, 0, 1); Label intersected_label (_("Intersected regions should:")); @@ -6373,7 +6373,7 @@ Editor::do_insert_time () d.get_vbox()->pack_start (move_markers); CheckButton move_tempos (_("Move tempo and meter changes")); d.get_vbox()->pack_start (move_tempos); - + d.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); d.add_button (_("Insert time"), Gtk::RESPONSE_OK); d.show_all (); @@ -6408,7 +6408,7 @@ Editor::do_insert_time () } void -Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt, +Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt, bool ignore_music_glue, bool markers_too, bool tempo_too) { bool commit = false; @@ -6422,23 +6422,23 @@ Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt, for (TrackSelection::iterator x = selection->tracks.begin(); x != selection->tracks.end(); ++x) { /* regions */ boost::shared_ptr<Playlist> pl = (*x)->playlist(); - + if (pl) { XMLNode &before = pl->get_state(); - + if (opt == SplitIntersected) { pl->split (pos); } - + pl->shift (pos, frames, (opt == MoveIntersected), ignore_music_glue); - + XMLNode &after = pl->get_state(); - + session->add_command (new MementoCommand<Playlist> (*pl, &before, &after)); commit = true; } - + /* automation */ RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (*x); if (rtav) { @@ -6454,7 +6454,7 @@ Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt, Locations::LocationList copy (session->locations()->list()); for (Locations::LocationList::iterator i = copy.begin(); i != copy.end(); ++i) { - + Locations::LocationList::const_iterator tmp; if ((*i)->start() >= pos) { @@ -6515,9 +6515,9 @@ Editor::fit_tracks (TrackSelection & tracks) } undo_visual_stack.push_back (current_visual_state()); - + /* operate on all tracks, hide unselected ones that are in the middle of selected ones */ - + bool prev_was_selected = false; bool is_selected = tracks.contains (track_views.front()); bool next_is_selected; @@ -6525,10 +6525,10 @@ Editor::fit_tracks (TrackSelection & tracks) for (TrackViewList::iterator t = track_views.begin(); t != track_views.end(); ++t) { TrackViewList::iterator next; - + next = t; ++next; - + if (next != track_views.end()) { next_is_selected = tracks.contains (*next); } else { @@ -6548,10 +6548,10 @@ Editor::fit_tracks (TrackSelection & tracks) is_selected = next_is_selected; } - /* - set the controls_layout height now, because waiting for its size - request signal handler will cause the vertical adjustment setting to fail - */ + /* + set the controls_layout height now, because waiting for its size + request signal handler will cause the vertical adjustment setting to fail + */ controls_layout.property_height () = full_canvas_height - canvas_timebars_vsize; vertical_adjustment.set_value (first_y_pos); @@ -6613,7 +6613,7 @@ Editor::end_visual_state_op (uint32_t n) { visual_state_op_connection.disconnect(); save_visual_state (n); - + PopUp* pup = new PopUp (WIN_POS_MOUSE, 1000, true); char buf[32]; snprintf (buf, sizeof (buf), _("Saved view %u"), n+1); diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc index 2ec9e4356e..b763a0bbdf 100644 --- a/gtk2_ardour/editor_regions.cc +++ b/gtk2_ardour/editor_regions.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2005 Paul Davis + Copyright (C) 2000-2005 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -87,53 +87,53 @@ EditorRegions::EditorRegions (Editor* e) _display.append_column (_("Path"), _columns.path); _display.set_headers_visible (true); //_display.set_grid_lines (TREE_VIEW_GRID_LINES_BOTH); - + CellRendererText* region_name_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (0)); region_name_cell->property_editable() = true; region_name_cell->signal_edited().connect (mem_fun (*this, &EditorRegions::name_edit)); _display.get_selection()->set_select_function (mem_fun (*this, &EditorRegions::selection_filter)); - + TreeViewColumn* tv_col = _display.get_column(0); CellRendererText* renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (0)); tv_col->add_attribute(renderer->property_text(), _columns.name); tv_col->add_attribute(renderer->property_foreground_gdk(), _columns.color_); - + _display.get_selection()->set_mode (SELECTION_MULTIPLE); _display.add_object_drag (_columns.region.index(), "regions"); - + /* setup DnD handling */ - + list<TargetEntry> region_list_target_table; - + region_list_target_table.push_back (TargetEntry ("text/plain")); region_list_target_table.push_back (TargetEntry ("text/uri-list")); region_list_target_table.push_back (TargetEntry ("application/x-rootwin-drop")); - + _display.add_drop_targets (region_list_target_table); _display.signal_drag_data_received().connect (mem_fun(*this, &EditorRegions::drag_data_received)); _scroller.add (_display); _scroller.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC); - + _display.signal_key_press_event().connect (mem_fun(*this, &EditorRegions::key_press)); _display.signal_key_release_event().connect (mem_fun(*this, &EditorRegions::key_release)); _display.signal_button_press_event().connect (mem_fun(*this, &EditorRegions::button_press), false); _display.signal_button_release_event().connect (mem_fun(*this, &EditorRegions::button_release)); _change_connection = _display.get_selection()->signal_changed().connect (mem_fun(*this, &EditorRegions::selection_changed)); // _display.signal_popup_menu().connect (bind (mem_fun (*this, &Editor::show__display_context_menu), 1, 0)); - + //ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (mem_fun(*this, &Editor::redisplay_regions)); ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (mem_fun(*this, &EditorRegions::update_all_rows)); ARDOUR::Region::RegionPropertyChanged.connect (mem_fun(*this, &EditorRegions::update_row)); - + } void EditorRegions::connect_to_session (ARDOUR::Session* s) { EditorComponent::connect_to_session (s); - + _session_connections.push_back (_session->RegionsAdded.connect (mem_fun(*this, &EditorRegions::handle_new_regions))); _session_connections.push_back (_session->RegionRemoved.connect (mem_fun(*this, &EditorRegions::handle_region_removed))); _session_connections.push_back (_session->RegionHiddenChange.connect (mem_fun(*this, &EditorRegions::region_hidden))); @@ -145,7 +145,7 @@ void EditorRegions::handle_region_removed (boost::weak_ptr<Region> wregion) { ENSURE_GUI_THREAD (bind (mem_fun (*this, &EditorRegions::handle_region_removed), wregion)); - + redisplay (); } @@ -159,7 +159,7 @@ EditorRegions::handle_new_regions (vector<boost::weak_ptr<Region> >& v) void EditorRegions::region_hidden (boost::shared_ptr<Region> r) { - ENSURE_GUI_THREAD(bind (mem_fun(*this, &EditorRegions::region_hidden), r)); + ENSURE_GUI_THREAD(bind (mem_fun(*this, &EditorRegions::region_hidden), r)); redisplay (); } @@ -180,7 +180,7 @@ EditorRegions::add_region (boost::shared_ptr<Region> region) if (!region || !_session) { return; } - + string str; TreeModel::Row row; Gdk::Color c; @@ -220,31 +220,31 @@ EditorRegions::add_region (boost::shared_ptr<Region> region) for (i = rows.begin(); i != rows.end(); ++i) { boost::shared_ptr<Region> rr = (*i)[_columns.region]; - + if (rr && region->region_list_equivalent (rr)) { return; } } row = *(_model->append()); - + if (missing_source) { c.set_rgb(65535,0,0); // FIXME: error color from style - + } else if (region->automatic()){ c.set_rgb(0,65535,0); // FIXME: error color from style - + } else { set_color(c, rgba_from_style ("RegionListWholeFile", 0xff, 0, 0, 0, "fg", Gtk::STATE_NORMAL, false )); - + } - + row[_columns.color_] = c; if (region->source()->name()[0] == '/') { // external file - + if (region->whole_file()) { - + boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(region->source()); str = ".../"; @@ -272,23 +272,23 @@ EditorRegions::add_region (boost::shared_ptr<Region> region) row[_columns.name] = str; row[_columns.region] = region; - + if (missing_source) { row[_columns.path] = _("(MISSING) ") + region->source()->name(); - + } else { row[_columns.path] = region->source()->name(); - - } - + + } + if (region->automatic()) { return; } - + } else { /* find parent node, add as new child */ - + TreeModel::iterator i; TreeModel::Children rows = _model->children(); bool found_parent = false; @@ -296,16 +296,16 @@ EditorRegions::add_region (boost::shared_ptr<Region> region) for (i = rows.begin(); i != rows.end(); ++i) { boost::shared_ptr<Region> rr = (*i)[_columns.region]; boost::shared_ptr<AudioRegion> r = boost::dynamic_pointer_cast<AudioRegion>(rr); - + if (r && r->whole_file()) { - + if (region->source_equivalent (r)) { row = *(_model->append ((*i).children())); found_parent = true; break; } } - + TreeModel::iterator ii; TreeModel::Children subrows = (*i).children(); @@ -314,18 +314,18 @@ EditorRegions::add_region (boost::shared_ptr<Region> region) if (region->region_list_equivalent (rrr)) { return; - + } } } - + if (!found_parent) { row = *(_model->append()); - } + } } - + row[_columns.region] = region; - + populate_row(region, (*row)); } @@ -334,13 +334,13 @@ void EditorRegions::region_changed (Change what_changed, boost::weak_ptr<Region> region) { ENSURE_GUI_THREAD (bind (mem_fun (*this, &EditorRegions::region_changed), what_changed, region)); - + boost::shared_ptr<Region> r = region.lock (); - + if (!r) { return; } - + if (what_changed & ARDOUR::NameChanged) { /* find the region in our model and change its name */ TreeModel::Children rows = _model->children (); @@ -360,7 +360,7 @@ EditorRegions::region_changed (Change what_changed, boost::weak_ptr<Region> regi (*j)[_columns.name] = r->name (); break; } - + ++i; } @@ -368,25 +368,25 @@ EditorRegions::region_changed (Change what_changed, boost::weak_ptr<Region> regi } void -EditorRegions::selection_changed () +EditorRegions::selection_changed () { if (_display.get_selection()->count_selected_rows() > 0) { - + TreeIter iter; TreeView::Selection::ListHandle_Path rows = _display.get_selection()->get_selected_rows (); - + _editor->deselect_all (); - + for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) { - + if (iter = _model->get_iter (*i)) { // they could have clicked on a row that is just a placeholder, like "Hidden" boost::shared_ptr<Region> region = (*iter)[_columns.region]; - + if (region) { - + if (region->automatic()) { _display.get_selection()->unselect(*i); - + } else { _change_connection.block (true); //editor_regions_selection_changed_connection.block(true); @@ -408,20 +408,20 @@ void EditorRegions::set_selected (RegionSelection& regions) { for (RegionSelection::iterator iter = regions.begin(); iter != regions.end(); ++iter) { - + TreeModel::iterator i; TreeModel::Children rows = _model->children(); boost::shared_ptr<Region> r ((*iter)->region()); - + for (i = rows.begin(); i != rows.end(); ++i) { - + boost::shared_ptr<Region> compared_region = (*i)[_columns.region]; if (r == compared_region) { _display.get_selection()->select(*i); break; } - + if (!(*i).children().empty()) { if (set_selected_in_subrow(r, (*i), 2)) { break; @@ -436,16 +436,16 @@ EditorRegions::set_selected_in_subrow (boost::shared_ptr<Region> region, TreeMod { TreeModel::iterator i; TreeModel::Children subrows = (*parent_row).children(); - + for (i = subrows.begin(); i != subrows.end(); ++i) { - + boost::shared_ptr<Region> compared_region = (*i)[_columns.region]; - + if (region == compared_region) { _display.get_selection()->select(*i); return true; } - + if (!(*i).children().empty()) { if (set_selected_in_subrow (region, (*i), level + 1)) { return true; @@ -459,7 +459,7 @@ void EditorRegions::insert_into_tmp_regionlist(boost::shared_ptr<Region> region) { /* keep all whole files at the beginning */ - + if (region->whole_file()) { tmp_region_list.push_front (region); } else { @@ -469,24 +469,24 @@ EditorRegions::insert_into_tmp_regionlist(boost::shared_ptr<Region> region) void EditorRegions::redisplay () -{ +{ if (_no_redisplay || !_session) { return; } - + bool tree_expanded = false; - - if (_toggle_full_action && _toggle_full_action->get_active()) { //If the list was expanded prior to rebuilding, + + if (_toggle_full_action && _toggle_full_action->get_active()) { //If the list was expanded prior to rebuilding, tree_expanded = true; //expand it again afterwards } - + _display.set_model (Glib::RefPtr<Gtk::TreeStore>(0)); _model->clear (); /* now add everything we have, via a temporary list used to help with sorting. */ - + tmp_region_list.clear(); _session->foreach_region (this, &EditorRegions::insert_into_tmp_regionlist); @@ -494,9 +494,9 @@ EditorRegions::redisplay () add_region (*r); } tmp_region_list.clear(); - + _display.set_model (_model); - + if (tree_expanded) { _display.expand_all(); } @@ -504,26 +504,26 @@ EditorRegions::redisplay () void EditorRegions::update_row (boost::shared_ptr<Region> region) -{ +{ if (!region || !_session) { return; } - + TreeModel::iterator i; TreeModel::Children rows = _model->children(); - + for (i = rows.begin(); i != rows.end(); ++i) { - + // cerr << "Level 1: Compare " << region->name() << " with parent " << (*i)[_columns.name] << "\n"; - + boost::shared_ptr<Region> compared_region = (*i)[_columns.region]; - + if (region == compared_region) { // cerr << "Matched\n"; populate_row(region, (*i)); return; } - + if (!(*i).children().empty()) { if (update_subrows(region, (*i), 2)) { return; @@ -538,19 +538,19 @@ EditorRegions::update_subrows (boost::shared_ptr<Region> region, TreeModel::Row { TreeModel::iterator i; TreeModel::Children subrows = (*parent_row).children(); - + for (i = subrows.begin(); i != subrows.end(); ++i) { - + // cerr << "Level " << level << ": Compare " << region->name() << " with child " << (*i)[_columns.name] << "\n"; - + boost::shared_ptr<Region> compared_region = (*i)[_columns.region]; - + if (region == compared_region) { populate_row(region, (*i)); // cerr << "Matched\n"; return true; } - + if (!(*i).children().empty()) { if (update_subrows (region, (*i), level + 1)) { return true; @@ -569,16 +569,16 @@ EditorRegions::update_all_rows () TreeModel::iterator i; TreeModel::Children rows = _model->children(); - + for (i = rows.begin(); i != rows.end(); ++i) { - + boost::shared_ptr<Region> region = (*i)[_columns.region]; - + if (!region->automatic()) { cerr << "level 1 : Updating " << region->name() << "\n"; populate_row(region, (*i)); } - + if (!(*i).children().empty()) { update_all_subrows ((*i), 2); } @@ -590,16 +590,16 @@ EditorRegions::update_all_subrows (TreeModel::Row const &parent_row, int level) { TreeModel::iterator i; TreeModel::Children subrows = (*parent_row).children(); - + for (i = subrows.begin(); i != subrows.end(); ++i) { - + boost::shared_ptr<Region> region = (*i)[_columns.region]; - + if (!region->automatic()) { cerr << "level " << level << " : Updating " << region->name() << "\n"; populate_row(region, (*i)); } - + if (!(*i).children().empty()) { update_all_subrows ((*i), level + 1); } @@ -619,11 +619,11 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co int used; BBT_Time bbt; // FIXME Why do these have to be declared here ? SMPTE::Time smpte; // FIXME I would like them declared in the case statment where they are used. - + bool missing_source = boost::dynamic_pointer_cast<SilentFileSource>(region->source()); - + boost::shared_ptr<AudioRegion> audioRegion = boost::dynamic_pointer_cast<AudioRegion>(region); - + bool fades_in_seconds = false; start_str[0] = '\0'; @@ -636,7 +636,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co used = _editor->get_regionview_count_from_region_list (region); sprintf (used_str, "%4d" , used); - + switch (ARDOUR_UI::instance()->secondary_clock.mode ()) { case AudioClock::SMPTE: case AudioClock::Off: /* If the secondary clock is off, default to SMPTE */ @@ -648,16 +648,16 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co sprintf (length_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); _session->smpte_time (region->sync_position() + region->position(), smpte); sprintf (sync_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); - - if (audioRegion && !fades_in_seconds) { + + if (audioRegion && !fades_in_seconds) { _session->smpte_time (audioRegion->fade_in()->back()->when, smpte); sprintf (fadein_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); _session->smpte_time (audioRegion->fade_out()->back()->when, smpte); sprintf (fadeout_str, "%02d:%02d:%02d:%02d", smpte.hours, smpte.minutes, smpte.seconds, smpte.frames); } - + break; - + case AudioClock::BBT: _session->tempo_map().bbt_time (region->position(), bbt); sprintf (start_str, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks); @@ -667,21 +667,21 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co sprintf (length_str, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks); _session->tempo_map().bbt_time (region->sync_position() + region->position(), bbt); sprintf (sync_str, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks); - + if (audioRegion && !fades_in_seconds) { _session->tempo_map().bbt_time (audioRegion->fade_in()->back()->when, bbt); sprintf (fadein_str, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks); _session->tempo_map().bbt_time (audioRegion->fade_out()->back()->when, bbt); sprintf (fadeout_str, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks); - } + } break; - + case AudioClock::MinSec: nframes_t left; int hrs; int mins; float secs; - + left = region->position(); hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f)); left -= (nframes_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f); @@ -689,7 +689,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co left -= (nframes_t) floor (mins * _session->frame_rate() * 60.0f); secs = left / (float) _session->frame_rate(); sprintf (start_str, "%02d:%02d:%06.3f", hrs, mins, secs); - + left = region->position() + region->length() - 1; hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f)); left -= (nframes_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f); @@ -697,7 +697,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co left -= (nframes_t) floor (mins * _session->frame_rate() * 60.0f); secs = left / (float) _session->frame_rate(); sprintf (end_str, "%02d:%02d:%06.3f", hrs, mins, secs); - + left = region->length(); hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f)); left -= (nframes_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f); @@ -705,7 +705,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co left -= (nframes_t) floor (mins * _session->frame_rate() * 60.0f); secs = left / (float) _session->frame_rate(); sprintf (length_str, "%02d:%02d:%06.3f", hrs, mins, secs); - + left = region->sync_position() + region->position(); hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f)); left -= (nframes_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f); @@ -713,7 +713,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co left -= (nframes_t) floor (mins * _session->frame_rate() * 60.0f); secs = left / (float) _session->frame_rate(); sprintf (sync_str, "%02d:%02d:%06.3f", hrs, mins, secs); - + if (audioRegion && !fades_in_seconds) { left = audioRegion->fade_in()->back()->when; hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f)); @@ -722,7 +722,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co left -= (nframes_t) floor (mins * _session->frame_rate() * 60.0f); secs = left / (float) _session->frame_rate(); sprintf (fadein_str, "%02d:%02d:%06.3f", hrs, mins, secs); - + left = audioRegion->fade_out()->back()->when; hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f)); left -= (nframes_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f); @@ -731,55 +731,55 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co secs = left / (float) _session->frame_rate(); sprintf (fadeout_str, "%02d:%02d:%06.3f", hrs, mins, secs); } - + break; - + case AudioClock::Frames: snprintf (start_str, sizeof (start_str), "%u", region->position()); snprintf (end_str, sizeof (end_str), "%u", (region->position() + region->length() - 1)); snprintf (length_str, sizeof (length_str), "%u", region->length()); snprintf (sync_str, sizeof (sync_str), "%u", region->sync_position() + region->position()); - + if (audioRegion && !fades_in_seconds) { snprintf (fadein_str, sizeof (fadein_str), "%u", uint (audioRegion->fade_in()->back()->when)); snprintf (fadeout_str, sizeof (fadeout_str), "%u", uint (audioRegion->fade_out()->back()->when)); } - + break; - + default: break; } - + if (audioRegion && fades_in_seconds) { - + nframes_t left; int mins; int millisecs; - + left = audioRegion->fade_in()->back()->when; mins = (int) floor (left / (_session->frame_rate() * 60.0f)); left -= (nframes_t) floor (mins * _session->frame_rate() * 60.0f); millisecs = (int) floor ((left * 1000.0f) / _session->frame_rate()); - + if (audioRegion->fade_in()->back()->when >= _session->frame_rate()) { sprintf (fadein_str, "%01dM %01dmS", mins, millisecs); } else { sprintf (fadein_str, "%01dmS", millisecs); } - + left = audioRegion->fade_out()->back()->when; mins = (int) floor (left / (_session->frame_rate() * 60.0f)); left -= (nframes_t) floor (mins * _session->frame_rate() * 60.0f); millisecs = (int) floor ((left * 1000.0f) / _session->frame_rate()); - + if (audioRegion->fade_out()->back()->when >= _session->frame_rate()) { sprintf (fadeout_str, "%01dM %01dmS", mins, millisecs); } else { sprintf (fadeout_str, "%01dmS", millisecs); } } - + if (used > 1) { row[_columns.start] = _("Multiple"); row[_columns.end] = _("Multiple"); @@ -793,7 +793,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co } else { row[_columns.start] = start_str; row[_columns.end] = end_str; - + if (region->sync_position() == 0) { row[_columns.sync] = _("Start"); } else if (region->sync_position() == region->length() - 1) { @@ -801,7 +801,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co } else { row[_columns.sync] = sync_str; } - + if (audioRegion) { if (audioRegion->fade_in_active()) { row[_columns.fadein] = string_compose("%1%2%3", " ", fadein_str, " "); @@ -821,28 +821,28 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co } else { row[_columns.fadeout] = ""; } - + row[_columns.locked] = region->locked(); - + if (region->positional_lock_style() == Region::MusicTime) { row[_columns.glued] = true; } else { row[_columns.glued] = false; } - + row[_columns.muted] = region->muted(); row[_columns.opaque] = region->opaque(); } - + row[_columns.length] = length_str; row[_columns.used] = used_str; - + if (missing_source) { row[_columns.path] = _("MISSING ") + region->source()->name(); } else { row[_columns.path] = region->source()->name(); } - + if (region->n_channels() > 1) { row[_columns.name] = string_compose("%1 [%2]", region->name(), region->n_channels()); } else { @@ -854,7 +854,7 @@ void EditorRegions::build_menu () { _menu = dynamic_cast<Menu*>(ActionManager::get_widget ("/RegionListMenu")); - + /* now grab specific menu items that we need */ Glib::RefPtr<Action> act; @@ -952,9 +952,9 @@ EditorRegions::button_press (GdkEventButton *ev) } return true; } - + return false; -} +} bool EditorRegions::button_release (GdkEventButton *ev) @@ -1022,23 +1022,23 @@ EditorRegions::sorter (TreeModel::iterator a, TreeModel::iterator b) case ByLength: cmp = region1->length() - region2->length(); break; - + case ByPosition: cmp = region1->position() - region2->position(); break; - + case ByTimestamp: cmp = region1->source()->timestamp() - region2->source()->timestamp(); break; - + case ByStartInFile: cmp = region1->start() - region2->start(); break; - + case ByEndInFile: cmp = (region1->start() + region1->length()) - (region2->start() + region2->length()); break; - + case BySourceFileName: cmp = strcasecmp (region1->source()->name().c_str(), region2->source()->name().c_str()); break; @@ -1046,7 +1046,7 @@ EditorRegions::sorter (TreeModel::iterator a, TreeModel::iterator b) case BySourceFileLength: cmp = region1->source_length(0) - region2->source_length(0); break; - + case BySourceFileCreationDate: cmp = region1->source()->timestamp() - region2->source()->timestamp(); break; @@ -1120,9 +1120,9 @@ EditorRegions::remove_region () selection_mapover (mem_fun (*_editor, &Editor::remove_a_region)); } -void +void EditorRegions::drag_data_received (const RefPtr<Gdk::DragContext>& context, - int x, int y, + int x, int y, const SelectionData& data, guint info, guint time) { @@ -1136,7 +1136,7 @@ EditorRegions::drag_data_received (const RefPtr<Gdk::DragContext>& context, if (_editor->convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) { nframes64_t pos = 0; if (Profile->get_sae() || Config->get_only_copy_imported_files()) { - _editor->do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion, SrcBest, pos); + _editor->do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion, SrcBest, pos); } else { _editor->do_embed (paths, Editing::ImportDistinctFiles, ImportAsRegion, pos); } @@ -1148,7 +1148,7 @@ bool EditorRegions::selection_filter (const RefPtr<TreeModel>& model, const TreeModel::Path& path, bool /*yn*/) { /* not possible to select rows that do not represent regions, like "Hidden" */ - + TreeModel::iterator iter = model->get_iter (path); if (iter) { @@ -1156,7 +1156,7 @@ EditorRegions::selection_filter (const RefPtr<TreeModel>& model, const TreeModel if (!r) { return false; } - } + } return true; } @@ -1166,12 +1166,12 @@ EditorRegions::name_edit (const Glib::ustring& path, const Glib::ustring& new_te { boost::shared_ptr<Region> region; TreeIter iter; - + if ((iter = _model->get_iter (path))) { region = (*iter)[_columns.region]; (*iter)[_columns.name] = new_text; } - + /* now mapover everything */ if (region) { @@ -1209,11 +1209,11 @@ boost::shared_ptr<Region> EditorRegions::get_single_selection () { Glib::RefPtr<TreeSelection> selected = _display.get_selection(); - + if (selected->count_selected_rows() != 1) { return boost::shared_ptr<Region> (); } - + TreeView::Selection::ListHandle_Path rows = selected->get_selected_rows (); /* only one row selected, so rows.begin() is it */ diff --git a/gtk2_ardour/editor_regions.h b/gtk2_ardour/editor_regions.h index ddb1477a16..885acca628 100644 --- a/gtk2_ardour/editor_regions.h +++ b/gtk2_ardour/editor_regions.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2009 Paul Davis + Copyright (C) 2000-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ public: } void clear (); - + void toggle_full (); void toggle_show_auto_regions (); void reset_sort_direction (bool); @@ -63,7 +63,7 @@ public: } private: - + struct Columns : public Gtk::TreeModel::ColumnRecord { Columns () { add (name); @@ -82,7 +82,7 @@ private: add (used); add (path); } - + Gtk::TreeModelColumn<Glib::ustring> name; Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region; Gtk::TreeModelColumn<Gdk::Color> color_; @@ -99,9 +99,9 @@ private: Gtk::TreeModelColumn<Glib::ustring> used; Gtk::TreeModelColumn<Glib::ustring> path; }; - + Columns _columns; - + void region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>); void selection_changed (); sigc::connection _change_connection; @@ -148,4 +148,4 @@ private: std::list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list; }; - + diff --git a/gtk2_ardour/editor_route_groups.cc b/gtk2_ardour/editor_route_groups.cc index ded5ce3529..08695f348f 100644 --- a/gtk2_ardour/editor_route_groups.cc +++ b/gtk2_ardour/editor_route_groups.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -155,14 +155,14 @@ EditorRouteGroups::EditorRouteGroups (Editor* e) add_button->signal_clicked().connect (mem_fun (*this, &EditorRouteGroups::new_route_group)); remove_button->signal_clicked().connect (mem_fun (*this, &EditorRouteGroups::remove_selected)); - + button_box->pack_start (*add_button); button_box->pack_start (*remove_button); _display_packer->pack_start (_scroller, true, true); _display_packer->pack_start (*button_box, false, false); } - + Gtk::Menu* EditorRouteGroups::menu (RouteGroup* g) @@ -272,7 +272,7 @@ EditorRouteGroups::new_from_selection () rtv->route()->set_route_group (g, this); } } - + } else { delete g; } @@ -300,7 +300,7 @@ EditorRouteGroups::new_from_rec_enabled () rtv->route()->set_route_group (g, this); } } - + } else { delete g; } @@ -328,7 +328,7 @@ EditorRouteGroups::new_from_soloed () rtv->route()->set_route_group (g, this); } } - + } else { delete g; } @@ -353,7 +353,7 @@ EditorRouteGroups::remove_selected () TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); TreeIter iter; - + /* selection mode is single, so rows.begin() is it */ if ((iter = _model->get_iter (*i))) { @@ -387,7 +387,7 @@ EditorRouteGroups::button_press_event (GdkEventButton* ev) if (p) { iter = _model->get_iter (path); } - + if (iter) { group = (*iter)[_columns.routegroup]; } @@ -413,8 +413,8 @@ EditorRouteGroups::button_press_event (GdkEventButton* ev) return true; } } - - } + + } break; case 1: @@ -497,11 +497,11 @@ EditorRouteGroups::button_press_event (GdkEventButton* ev) default: break; } - + return false; } -void +void EditorRouteGroups::row_change (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) { RouteGroup* group; @@ -549,7 +549,7 @@ EditorRouteGroups::add (RouteGroup* group) bool focus = false; TreeModel::Row row = *(_model->append()); - + row[_columns.is_visible] = !group->is_hidden(); row[_columns.gain] = group->property(RouteGroup::Gain); row[_columns.record] = group->property(RouteGroup::RecEnable); @@ -571,7 +571,7 @@ EditorRouteGroups::add (RouteGroup* group) group->FlagsChanged.connect (bind (mem_fun (*this, &EditorRouteGroups::flags_changed), group)); - if (focus) { + if (focus) { TreeViewColumn* col = _display.get_column (0); CellRendererText* name_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (0)); _display.set_cursor (_model->get_path (row), *col, *name_cell, true); @@ -634,13 +634,13 @@ EditorRouteGroups::name_edit (const Glib::ustring& path, const Glib::ustring& ne { RouteGroup* group; TreeIter iter; - + if ((iter = _model->get_iter (path))) { - + if ((group = (*iter)[_columns.routegroup]) == 0) { return; } - + if (new_text != group->name()) { group->set_name (new_text); } @@ -694,7 +694,7 @@ EditorRouteGroups::collect (RouteGroup* g) boost::shared_ptr<Route> r = rtv->route (); int const k = r->order_key (N_ ("editor")); - + if (*i == r.get()) { if (coll == -1) { @@ -703,19 +703,19 @@ EditorRouteGroups::collect (RouteGroup* g) } else { --diff; } - + r->set_order_key (N_ ("editor"), coll); - + ++coll; ++i; - + } else { - + r->set_order_key (N_ ("editor"), k + diff); - + } } - + ++j; } diff --git a/gtk2_ardour/editor_route_groups.h b/gtk2_ardour/editor_route_groups.h index d87c8f5c83..e5fc6d7c64 100644 --- a/gtk2_ardour/editor_route_groups.h +++ b/gtk2_ardour/editor_route_groups.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2009 Paul Davis + Copyright (C) 2000-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,9 +33,9 @@ public: Gtk::Menu* menu (ARDOUR::RouteGroup *); void clear (); - + private: - + struct Columns : public Gtk::TreeModel::ColumnRecord { Columns () { diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc index e7e8d76795..bbda43a295 100644 --- a/gtk2_ardour/editor_routes.cc +++ b/gtk2_ardour/editor_routes.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2009 Paul Davis + Copyright (C) 2000-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -82,11 +82,11 @@ EditorRoutes::EditorRoutes (Editor* e) _display.append_column (*rec_state_column); _display.append_column (_("Show"), _columns.visible); _display.append_column (_("Name"), _columns.text); - + _display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0)); _display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1)); _display.get_column (2)->set_data (X_("colnum"), GUINT_TO_POINTER(2)); - + _display.set_headers_visible (true); _display.set_name ("TrackListDisplay"); _display.get_selection()->set_mode (SELECTION_NONE); @@ -96,7 +96,7 @@ EditorRoutes::EditorRoutes (Editor* e) _display.add_object_drag (_columns.route.index(), "routes"); CellRendererToggle* visible_cell = dynamic_cast<CellRendererToggle*>(_display.get_column_cell_renderer (1)); - + visible_cell->property_activatable() = true; visible_cell->property_radio() = false; @@ -116,7 +116,7 @@ EditorRoutes::connect_to_session (Session* s) initial_display (); } -void +void EditorRoutes::on_tv_rec_enable_toggled (Glib::ustring const & path_string) { // Get the model row that has been toggled. @@ -137,7 +137,7 @@ EditorRoutes::build_menu () using namespace Gtk; _menu = new Menu; - + MenuList& items = _menu->items(); _menu->set_name ("ArdourContextMenu"); @@ -182,11 +182,11 @@ EditorRoutes::redisplay () } if (!_redisplay_does_not_reset_order_keys) { - + /* this reorder is caused by user action, so reassign sort order keys to tracks. */ - + route->set_order_key (N_ ("editor"), n); } @@ -201,7 +201,7 @@ EditorRoutes::redisplay () tv->set_marked_for_display (false); tv->hide (); } - + n++; } @@ -211,12 +211,12 @@ EditorRoutes::redisplay () */ Glib::signal_idle().connect (mem_fun (*_editor, &Editor::sync_track_view_list_and_routes)); - + _editor->full_canvas_height = position + _editor->canvas_timebars_vsize; _editor->vertical_adjustment.set_upper (_editor->full_canvas_height); if ((_editor->vertical_adjustment.get_value() + _editor->_canvas_height) > _editor->vertical_adjustment.get_upper()) { - /* + /* We're increasing the size of the canvas while the bottom is visible. We scroll down to keep in step with the controls layout. */ @@ -268,12 +268,12 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes) row[_columns.is_track] = (boost::dynamic_pointer_cast<Track> ((*x)->route()) != 0); _ignore_reorder = true; - + /* added a new fresh one at the end */ if ((*x)->route()->order_key (N_ ("editor")) == -1) { (*x)->route()->set_order_key (N_ ("editor"), _model->children().size()-1); } - + _ignore_reorder = false; boost::weak_ptr<Route> wr ((*x)->route()); @@ -297,7 +297,7 @@ EditorRoutes::handle_gui_changes (string const & what, void *src) ENSURE_GUI_THREAD (bind (mem_fun(*this, &EditorRoutes::handle_gui_changes), what, src)); if (what == "track_height") { - /* Optional :make tracks change height while it happens, instead + /* Optional :make tracks change height while it happens, instead of on first-idle */ //update_canvas_now (); @@ -317,7 +317,7 @@ EditorRoutes::route_removed (TimeAxisView *tv) TreeModel::Children rows = _model->children(); TreeModel::Children::iterator ri; - /* the core model has changed, there is no need to sync + /* the core model has changed, there is no need to sync view orders. */ @@ -342,17 +342,17 @@ EditorRoutes::route_name_changed (boost::weak_ptr<Route> r) if (!route) { return; } - + TreeModel::Children rows = _model->children(); TreeModel::Children::iterator i; - + for (i = rows.begin(); i != rows.end(); ++i) { boost::shared_ptr<Route> t = (*i)[_columns.route]; if (t == route) { (*i)[_columns.text] = route->name(); break; } - } + } } void @@ -379,7 +379,7 @@ EditorRoutes::hide_track_in_display (TimeAxisView& tv) TreeModel::Children::iterator i; for (i = rows.begin(); i != rows.end(); ++i) { - if ((*i)[_columns.tv] == &tv) { + if ((*i)[_columns.tv] == &tv) { (*i)[_columns.visible] = false; break; } @@ -391,9 +391,9 @@ EditorRoutes::show_track_in_display (TimeAxisView& tv) { TreeModel::Children rows = _model->children(); TreeModel::Children::iterator i; - + for (i = rows.begin(); i != rows.end(); ++i) { - if ((*i)[_columns.tv] == &tv) { + if ((*i)[_columns.tv] == &tv) { (*i)[_columns.visible] = true; break; } @@ -457,14 +457,14 @@ EditorRoutes::hide_all_tracks (bool /*with_select*/) suspend_redisplay (); for (i = rows.begin(); i != rows.end(); ++i) { - + TreeModel::Row row = (*i); TimeAxisView *tv = row[_columns.tv]; if (tv == 0) { continue; } - + row[_columns.visible] = false; } @@ -493,7 +493,7 @@ EditorRoutes::set_all_tracks_visibility (bool yn) if (tv == 0) { continue; } - + (*i)[_columns.visible] = yn; } @@ -501,7 +501,7 @@ EditorRoutes::set_all_tracks_visibility (bool yn) } void -EditorRoutes::set_all_audio_visibility (int tracks, bool yn) +EditorRoutes::set_all_audio_visibility (int tracks, bool yn) { TreeModel::Children rows = _model->children(); TreeModel::Children::iterator i; @@ -528,7 +528,7 @@ EditorRoutes::set_all_audio_visibility (int tracks, bool yn) (*i)[_columns.visible] = yn; } break; - + case 2: if (!atv->is_audio_track()) { (*i)[_columns.visible] = yn; @@ -588,7 +588,7 @@ EditorRoutes::button_press (GdkEventButton* ev) TreeViewColumn* column; int cellx; int celly; - + if (!_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { return false; } @@ -652,23 +652,23 @@ EditorRoutes::initial_display () TreeModel::Children rows = _model->children(); TreeModel::Children::iterator i; - + _no_redisplay = true; - + for (i = rows.begin(); i != rows.end(); ++i) { TimeAxisView *tv = (*i)[_columns.tv]; RouteTimeAxisView *rtv; - + if ((rtv = dynamic_cast<RouteTimeAxisView*>(tv)) != 0) { if (rtv->route()->is_master()) { _display.get_selection()->unselect (i); } } } - + _no_redisplay = false; redisplay (); - } + } resume_redisplay (); } @@ -682,9 +682,9 @@ EditorRoutes::track_list_reorder (Gtk::TreeModel::Path const &, Gtk::TreeModel:: _redisplay_does_not_sync_order_keys = false; } -void +void EditorRoutes::display_drag_data_received (const RefPtr<Gdk::DragContext>& context, - int x, int y, + int x, int y, const SelectionData& data, guint info, guint time) { @@ -692,7 +692,7 @@ EditorRoutes::display_drag_data_received (const RefPtr<Gdk::DragContext>& contex _display.on_drag_data_received (context, x, y, data, info, time); return; } - + context->drag_finish (true, false, time); } @@ -718,14 +718,14 @@ EditorRoutes::move_selected_tracks (bool up) list<ViewRoute>::iterator trailing; list<ViewRoute>::iterator leading; - + if (up) { - + trailing = view_routes.begin(); leading = view_routes.begin(); - + ++leading; - + while (leading != view_routes.end()) { if (_editor->selection->selected (leading->first)) { view_routes.insert (trailing, ViewRoute (leading->first, leading->second)); @@ -763,7 +763,7 @@ EditorRoutes::move_selected_tracks (bool up) tmp++; view_routes.insert (tmp, ViewRoute (leading->first, leading->second)); - + /* can't use iter = cont.erase (iter); form here, because we need iter to move backwards. */ @@ -782,7 +782,7 @@ EditorRoutes::move_selected_tracks (bool up) } view_routes.erase (leading); - + if (done) { break; } @@ -813,7 +813,7 @@ EditorRoutes::update_rec_display () { TreeModel::Children rows = _model->children(); TreeModel::Children::iterator i; - + for (i = rows.begin(); i != rows.end(); ++i) { boost::shared_ptr<Route> route = (*i)[_columns.route]; @@ -824,7 +824,7 @@ EditorRoutes::update_rec_display () } else { (*i)[_columns.rec_enabled] = false; } - } + } } } diff --git a/gtk2_ardour/editor_routes.h b/gtk2_ardour/editor_routes.h index a075902dee..22bff40e35 100644 --- a/gtk2_ardour/editor_routes.h +++ b/gtk2_ardour/editor_routes.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -75,7 +75,7 @@ private: bool selection_filter (Glib::RefPtr<Gtk::TreeModel> const &, Gtk::TreeModel::Path const &, bool); struct ModelColumns : public Gtk::TreeModel::ColumnRecord { - ModelColumns() { + ModelColumns() { add (text); add (visible); add (rec_enabled); @@ -92,7 +92,7 @@ private: }; Gtk::ScrolledWindow _scroller; - Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > _display; + Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > _display; Glib::RefPtr<Gtk::ListStore> _model; ModelColumns _columns; bool _ignore_reorder; diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 3f1fc6a497..f21c996598 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ -#include <cstdio> // for sprintf, grrr +#include <cstdio> // for sprintf, grrr #include <cmath> #include <string> @@ -148,7 +148,7 @@ Editor::initialize_rulers () bbt_ruler->signal_button_press_event().connect (mem_fun(*this, &Editor::ruler_button_press)); frames_ruler->signal_button_press_event().connect (mem_fun(*this, &Editor::ruler_button_press)); minsec_ruler->signal_button_press_event().connect (mem_fun(*this, &Editor::ruler_button_press)); - + smpte_ruler->signal_motion_notify_event().connect (mem_fun(*this, &Editor::ruler_mouse_motion)); bbt_ruler->signal_motion_notify_event().connect (mem_fun(*this, &Editor::ruler_mouse_motion)); frames_ruler->signal_motion_notify_event().connect (mem_fun(*this, &Editor::ruler_mouse_motion)); @@ -242,7 +242,7 @@ Editor::ruler_button_press (GdkEventButton* ev) if (session->is_auditioning()) { session->cancel_audition (); } - + /* playhead cursor */ assert (_drag == 0); _drag = new CursorDrag (this, &playhead_cursor->canvas_item, false); @@ -259,7 +259,7 @@ Editor::ruler_button_release (GdkEventButton* ev) if (session == 0) { return FALSE; } - + gint x,y; Gdk::ModifierType state; @@ -275,7 +275,7 @@ Editor::ruler_button_release (GdkEventButton* ev) time_canvas_event_box.get_window()->get_pointer (x, y, state); stop_canvas_autoscroll(); - + nframes64_t where = leftmost_frame + pixel_to_frame (x); snap_to (where); popup_ruler_menu (where); @@ -298,7 +298,7 @@ Editor::ruler_label_button_release (GdkEventButton* ev) m->popup (1, ev->time); } } - + return TRUE; } @@ -350,13 +350,13 @@ Editor::popup_ruler_menu (nframes64_t where, ItemType t) case TransportMarkerBarItem: break; - + case CdMarkerBarItem: // TODO ruler_items.push_back (MenuElem (_("New CD track marker"), bind ( mem_fun(*this, &Editor::mouse_add_new_marker), where, true, false))); break; - - + + case TempoBarItem: ruler_items.push_back (MenuElem (_("New Tempo"), bind ( mem_fun(*this, &Editor::mouse_add_new_tempo_event), where))); ruler_items.push_back (MenuElem (_("Clear tempo"))); @@ -445,7 +445,7 @@ Editor::store_ruler_visibility () session->set_dirty (); } -void +void Editor::restore_ruler_visibility () { XMLProperty* prop; @@ -528,7 +528,7 @@ Editor::restore_ruler_visibility () } else { // this session doesn't yet know about the cdmarker ruler - // as a benefit to the user who doesn't know the feature exists, show the ruler if + // as a benefit to the user who doesn't know the feature exists, show the ruler if // any cd marks exist ruler_cd_marker_action->set_active (false); const Locations::LocationList & locs = session->locations()->list(); @@ -614,7 +614,7 @@ Editor::update_ruler_visibility () old_unit_pos = meter_bar_group->property_y(); if (tbgpos != old_unit_pos) { meter_bar_group->move ( 0.0, tbgpos - old_unit_pos); - } + } meter_bar_group->show(); meter_group->show(); meter_label.show(); @@ -626,7 +626,7 @@ Editor::update_ruler_visibility () meter_group->hide(); meter_label.hide(); } - + if (ruler_tempo_action->get_active()) { old_unit_pos = tempo_group->property_y(); if (tbpos != old_unit_pos) { @@ -647,7 +647,7 @@ Editor::update_ruler_visibility () tempo_group->hide(); tempo_label.hide(); } - + if (!Profile->get_sae() && ruler_range_action->get_active()) { old_unit_pos = range_marker_group->property_y(); if (tbpos != old_unit_pos) { @@ -715,7 +715,7 @@ Editor::update_ruler_visibility () // make sure all cd markers show up in their respective places update_cd_marker_display(); } - + if (ruler_marker_action->get_active()) { old_unit_pos = marker_group->property_y(); if (tbpos != old_unit_pos) { @@ -753,7 +753,7 @@ Editor::update_ruler_visibility () _background_group->move (0, 0); last_trackview_group_vertical_offset = get_trackview_group_vertical_offset (); } - + gdouble bottom_track_pos = vertical_adjustment.get_value() + _canvas_height - canvas_timebars_vsize; std::pair<TimeAxisView*, int> const p = trackview_by_y_position (bottom_track_pos); if (p.first) { @@ -771,7 +771,7 @@ void Editor::update_just_smpte () { ENSURE_GUI_THREAD(mem_fun(*this, &Editor::update_just_smpte)); - + if (session == 0) { return; } @@ -794,7 +794,7 @@ Editor::compute_fixed_ruler_scale () if (ruler_timecode_action->get_active()) { set_smpte_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames() ); } - + if (ruler_minsec_action->get_active()) { set_minsec_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames() ); } @@ -823,17 +823,17 @@ Editor::update_fixed_rulers () gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_smpte_ruler), leftmost_frame, rightmost_frame, leftmost_frame, session->current_end_frame()); } - + if (ruler_samples_action->get_active()) { gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_frames_ruler), leftmost_frame, rightmost_frame, leftmost_frame, session->current_end_frame()); } - + if (ruler_minsec_action->get_active()) { gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_minsec_ruler), leftmost_frame, rightmost_frame, leftmost_frame, session->current_end_frame()); } -} +} void Editor::update_tempo_based_rulers () @@ -843,7 +843,7 @@ Editor::update_tempo_based_rulers () } ruler_metrics[ruler_metric_bbt].units_per_pixel = frames_per_unit; - + if (ruler_bbt_action->get_active()) { gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_bbt_ruler), leftmost_frame, leftmost_frame+current_page_frames(), leftmost_frame, session->current_end_frame()); @@ -966,14 +966,14 @@ Editor::set_smpte_ruler_scale (gdouble lower, gdouble upper) smpte_mark_modulo = 1; smpte_nmarks = 2 + 24; } else { - + /* not possible if nframes64_t is a 32 bit quantity */ - + smpte_ruler_scale = smpte_show_hours; smpte_mark_modulo = 4; smpte_nmarks = 2 + 24; } - + } gint @@ -996,14 +996,14 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u } pos = (nframes_t) floor (lower); - - *marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * smpte_nmarks); + + *marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * smpte_nmarks); switch (smpte_ruler_scale) { case smpte_show_bits: // Find smpte time of this sample (pos) with subframe accuracy session->sample_to_smpte(pos, smpte, true /* use_offset */, true /* use_subframes */ ); - + for (n = 0; n < smpte_nmarks; n++) { session->smpte_to_sample(smpte, pos, true /* use_offset */, true /* use_subframes */ ); if ((smpte.subframes % smpte_mark_modulo) == 0) { @@ -1017,7 +1017,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u } else { snprintf (buf, sizeof(buf)," "); (*marks)[n].style = GtkCustomRulerMarkMicro; - + } (*marks)[n].label = g_strdup (buf); (*marks)[n].position = pos; @@ -1047,7 +1047,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u snprintf (buf, sizeof(buf)," "); (*marks)[n].style = GtkCustomRulerMarkMicro; (*marks)[n].position = pos; - + } (*marks)[n].label = g_strdup (buf); SMPTE::increment_seconds( smpte, session->config.get_subframes_per_frame() ); @@ -1071,7 +1071,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u } else { snprintf (buf, sizeof(buf)," "); (*marks)[n].style = GtkCustomRulerMarkMicro; - + } (*marks)[n].label = g_strdup (buf); (*marks)[n].position = pos; @@ -1093,7 +1093,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u } else { snprintf (buf, sizeof(buf)," "); (*marks)[n].style = GtkCustomRulerMarkMicro; - + } (*marks)[n].label = g_strdup (buf); (*marks)[n].position = pos; @@ -1121,7 +1121,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u snprintf (buf, sizeof(buf)," "); (*marks)[n].style = GtkCustomRulerMarkMicro; (*marks)[n].position = pos; - + } (*marks)[n].label = g_strdup (buf); SMPTE::increment( smpte, session->config.get_subframes_per_frame() ); @@ -1129,7 +1129,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble /*u break; } - + return smpte_nmarks; } @@ -1153,7 +1153,7 @@ Editor::compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper) bbt_nmarks = 1; bbt_ruler_scale = bbt_over; - + switch (snap_type) { case SnapToAThirdBeat: bbt_beat_subdivision = 3; @@ -1212,7 +1212,7 @@ Editor::compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper) bbt_ruler_scale = bbt_show_ticks; } else { bbt_ruler_scale = bbt_show_ticks_detail; - } + } if ((bbt_ruler_scale == bbt_show_ticks_detail) && (lower_beat.beats == upper_beat.beats) && (upper_beat.ticks - lower_beat.ticks <= Meter::ticks_per_beat / 4)) { bbt_ruler_scale = bbt_show_ticks_super_detail; @@ -1260,14 +1260,14 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp (*marks)[0].label = g_strdup(" "); (*marks)[0].position = lower; (*marks)[0].style = GtkCustomRulerMarkMicro; - + for (n = 1, i = current_bbt_points->begin(); n < bbt_nmarks && i != current_bbt_points->end(); ++i) { if ((*i).type != TempoMap::Beat) { continue; } if ((*i).frame < lower && (bbt_bar_helper_on)) { snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat); - (*marks)[0].label = g_strdup (buf); + (*marks)[0].label = g_strdup (buf); helper_active = true; } else { @@ -1299,14 +1299,14 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp (*marks)[0].label = g_strdup(" "); (*marks)[0].position = lower; (*marks)[0].style = GtkCustomRulerMarkMicro; - + for (n = 1, i = current_bbt_points->begin(); n < bbt_nmarks && i != current_bbt_points->end(); ++i) { if ((*i).type != TempoMap::Beat) { continue; } if ((*i).frame < lower && (bbt_bar_helper_on)) { snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat); - (*marks)[0].label = g_strdup (buf); + (*marks)[0].label = g_strdup (buf); helper_active = true; } else { @@ -1324,23 +1324,23 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp (*marks)[n].position = (*i).frame; n++; } - + /* Add the tick marks */ /* Find the next beat */ next_beat.beats = (*i).beat; next_beat.bars = (*i).bar; next_beat.ticks = 0; - + if ((*i).meter->beats_per_bar() > (next_beat.beats + 1)) { next_beat.beats += 1; } else { next_beat.bars += 1; next_beat.beats = 1; } - + next_beat_pos = session->tempo_map().frame_time(next_beat); - + frame_skip = (nframes64_t) floor (frame_skip_error = (session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute())); frame_skip_error -= frame_skip; skip = (uint32_t) (Meter::ticks_per_beat / bbt_beat_subdivision); @@ -1349,7 +1349,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp accumulated_error = frame_skip_error; tick = skip; - + for (t = 0; (tick < Meter::ticks_per_beat) && (n < bbt_nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) { if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) { @@ -1391,14 +1391,14 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp (*marks)[0].label = g_strdup(" "); (*marks)[0].position = lower; (*marks)[0].style = GtkCustomRulerMarkMicro; - + for (n = 1, i = current_bbt_points->begin(); n < bbt_nmarks && i != current_bbt_points->end(); ++i) { if ((*i).type != TempoMap::Beat) { continue; } if ((*i).frame < lower && (bbt_bar_helper_on)) { snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat); - (*marks)[0].label = g_strdup (buf); + (*marks)[0].label = g_strdup (buf); helper_active = true; } else { @@ -1416,23 +1416,23 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp (*marks)[n].position = (*i).frame; n++; } - + /* Add the tick marks */ /* Find the next beat */ next_beat.beats = (*i).beat; next_beat.bars = (*i).bar; - + if ((*i).meter->beats_per_bar() > (next_beat.beats + 1)) { next_beat.beats += 1; } else { next_beat.bars += 1; next_beat.beats = 1; } - + next_beat_pos = session->tempo_map().frame_time(next_beat); - + frame_skip = (nframes64_t) floor (frame_skip_error = (session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute())); frame_skip_error -= frame_skip; skip = (uint32_t) (Meter::ticks_per_beat / bbt_beat_subdivision); @@ -1441,7 +1441,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp accumulated_error = frame_skip_error; tick = skip; - + for (t = 0; (tick < Meter::ticks_per_beat) && (n < bbt_nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) { if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) { @@ -1471,7 +1471,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp (*marks)[n].style = GtkCustomRulerMarkMicro; } i_am_accented = false; - n++; + n++; } } @@ -1488,14 +1488,14 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp (*marks)[0].label = g_strdup(" "); (*marks)[0].position = lower; (*marks)[0].style = GtkCustomRulerMarkMicro; - + for (n = 1, i = current_bbt_points->begin(); n < bbt_nmarks && i != current_bbt_points->end(); ++i) { if ((*i).type != TempoMap::Beat) { continue; } if ((*i).frame < lower && (bbt_bar_helper_on)) { snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat); - (*marks)[0].label = g_strdup (buf); + (*marks)[0].label = g_strdup (buf); helper_active = true; } else { @@ -1513,23 +1513,23 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp (*marks)[n].position = (*i).frame; n++; } - + /* Add the tick marks */ /* Find the next beat */ next_beat.beats = (*i).beat; next_beat.bars = (*i).bar; - + if ((*i).meter->beats_per_bar() > (next_beat.beats + 1)) { next_beat.beats += 1; } else { next_beat.bars += 1; next_beat.beats = 1; } - + next_beat_pos = session->tempo_map().frame_time(next_beat); - + frame_skip = (nframes64_t) floor (frame_skip_error = (session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute())); frame_skip_error -= frame_skip; skip = (uint32_t) (Meter::ticks_per_beat / bbt_beat_subdivision); @@ -1538,7 +1538,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp accumulated_error = frame_skip_error; tick = skip; - + for (t = 0; (tick < Meter::ticks_per_beat) && (n < bbt_nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) { if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) { @@ -1561,14 +1561,14 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp } (*marks)[n].position = pos; - + if ((bbt_beat_subdivision > 4) && i_am_accented) { (*marks)[n].style = GtkCustomRulerMarkMinor; } else { (*marks)[n].style = GtkCustomRulerMarkMicro; } i_am_accented = false; - n++; + n++; } } @@ -1682,12 +1682,12 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp n++; } } - + break; } - return n; //return the actual number of marks made, since we might have skipped some from fractional time signatures + return n; //return the actual number of marks made, since we might have skipped some from fractional time signatures } @@ -1720,13 +1720,13 @@ Editor::metric_get_frames (GtkCustomRulerMark **marks, gdouble lower, gdouble up (*marks)[n].position = pos; (*marks)[n].style = GtkCustomRulerMarkMajor; } - + return nmarks; } static void sample_to_clock_parts ( nframes64_t sample, - nframes64_t sample_rate, + nframes64_t sample_rate, long *hrs_p, long *mins_p, long *secs_p, @@ -1738,7 +1738,7 @@ sample_to_clock_parts ( nframes64_t sample, long mins; long secs; long millisecs; - + left = sample; hrs = left / (sample_rate * 60 * 60); left -= hrs * sample_rate * 60 * 60; @@ -1847,9 +1847,9 @@ Editor::set_minsec_ruler_scale (gdouble lower, gdouble upper) minsec_ruler_scale = minsec_show_hours; minsec_mark_modulo = 2; } else { - + /* not possible if nframes64_t is a 32 bit quantity */ - + minsec_mark_interval = 4 * 60 * 60 * fr; /* show 4 hrs */ } minsec_nmarks = 2 + (range / minsec_mark_interval); diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 2da8172fc9..b77d1b4935 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,10 +70,10 @@ Editor::extend_selection_to_track (TimeAxisView& view) } else { return false; } - } + } /* something is already selected, so figure out which range of things to add */ - + TrackViewList to_be_added; TrackViewList sorted = track_views; TrackViewByPositionSorter cmp; @@ -103,18 +103,18 @@ Editor::extend_selection_to_track (TimeAxisView& view) break; } } - + passed_clicked = false; if (forwards) { for (TrackViewList::iterator i = sorted.begin(); i != sorted.end(); ++i) { - + if ((*i) == &view) { passed_clicked = true; continue; } - + if (passed_clicked) { if ((*i)->hidden()) { continue; @@ -130,18 +130,18 @@ Editor::extend_selection_to_track (TimeAxisView& view) } else { for (TrackViewList::reverse_iterator r = sorted.rbegin(); r != sorted.rend(); ++r) { - + if ((*r) == &view) { passed_clicked = true; continue; } - + if (passed_clicked) { - + if ((*r)->hidden()) { continue; } - + if (selection->selected (*r)) { break; } else if (!(*r)->hidden()) { @@ -150,12 +150,12 @@ Editor::extend_selection_to_track (TimeAxisView& view) } } } - + if (!to_be_added.empty()) { selection->add (to_be_added); return true; } - + return false; } @@ -211,7 +211,7 @@ Editor::set_selected_track (TimeAxisView& view, Selection::Operation op, bool no case Selection::Set: selection->set (&view); break; - + case Selection::Extend: extend_selection_to_track (view); break; @@ -224,7 +224,7 @@ Editor::set_selected_track_from_click (bool press, Selection::Operation op, bool if (!clicked_routeview) { return; } - + if (!press) { return; } @@ -278,7 +278,7 @@ Editor::get_equivalent_tracks (RouteTimeAxisView* basis, set<RouteTimeAxisView*> /* the basis is a member of an active route group, with the appropriate properties; find other members */ - + for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i) { RouteTimeAxisView* v = dynamic_cast<RouteTimeAxisView*> (*i); if (v && v->route()->route_group() == group) { @@ -319,7 +319,7 @@ Editor::mapover_tracks (slot<void, RouteTimeAxisView&, uint32_t> sl, TimeAxisVie if (route_basis == 0) { return; } - + set<RouteTimeAxisView*> tracks; get_equivalent_tracks (route_basis, tracks, prop); @@ -363,9 +363,9 @@ void Editor::get_equivalent_regions (RegionView* basis, vector<RegionView*>& equivalent_regions, RouteGroup::Property prop) const { mapover_tracks (bind (mem_fun (*this, &Editor::mapped_get_equivalent_regions), basis, &equivalent_regions), &basis->get_trackview(), prop); - + /* add clicked regionview since we skipped all other regions in the same track as the one it was in */ - + equivalent_regions.push_back (basis); } @@ -373,11 +373,11 @@ RegionSelection Editor::get_equivalent_regions (RegionSelection & basis, RouteGroup::Property prop) const { RegionSelection equivalent; - + for (RegionSelection::const_iterator i = basis.begin(); i != basis.end(); ++i) { vector<RegionView*> eq; - + mapover_tracks ( bind (mem_fun (*this, &Editor::mapped_get_equivalent_regions), *i, &eq), &(*i)->get_trackview(), prop @@ -392,42 +392,42 @@ Editor::get_equivalent_regions (RegionSelection & basis, RouteGroup::Property pr return equivalent; } - + int Editor::get_regionview_count_from_region_list (boost::shared_ptr<Region> region) { int region_count = 0; - + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - + RouteTimeAxisView* tatv; - + if ((tatv = dynamic_cast<RouteTimeAxisView*> (*i)) != 0) { - + boost::shared_ptr<Playlist> pl; vector<boost::shared_ptr<Region> > results; RegionView* marv; boost::shared_ptr<Diskstream> ds; - + if ((ds = tatv->get_diskstream()) == 0) { /* bus */ continue; } - + if ((pl = (ds->playlist())) != 0) { pl->get_region_list_equivalent_regions (region, results); } - + for (vector<boost::shared_ptr<Region> >::iterator ir = results.begin(); ir != results.end(); ++ir) { if ((marv = tatv->view()->find_view (*ir)) != 0) { region_count++; } } - + } } - + return region_count; } @@ -444,14 +444,14 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, if (press) { button_release_can_deselect = false; - } + } if (op == Selection::Toggle || op == Selection::Set) { switch (op) { case Selection::Toggle: - + if (selection->selected (clicked_regionview)) { if (press) { @@ -476,7 +476,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, button_release_can_deselect = false; } - } + } } else { @@ -489,7 +489,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, } /* add all the equivalent regions, but only on button press */ - + if (!all_equivalent_regions.empty()) { @@ -497,10 +497,10 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, } selection->add (all_equivalent_regions); - } + } } break; - + case Selection::Set: if (!selection->selected (clicked_regionview)) { get_equivalent_regions (clicked_regionview, all_equivalent_regions, RouteGroup::Select); @@ -547,7 +547,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, if (same_track) { /* 2. figure out the boundaries for our search for new objects */ - + switch (clicked_regionview->region()->coverage (first_frame, last_frame)) { case OverlapNone: if (last_frame < clicked_regionview->region()->first_frame()) { @@ -558,7 +558,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, first_frame = clicked_regionview->region()->first_frame(); } break; - + case OverlapExternal: if (last_frame < clicked_regionview->region()->first_frame()) { first_frame = last_frame; @@ -568,7 +568,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, first_frame = clicked_regionview->region()->first_frame(); } break; - + case OverlapInternal: if (last_frame < clicked_regionview->region()->first_frame()) { first_frame = last_frame; @@ -578,7 +578,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, first_frame = clicked_regionview->region()->first_frame(); } break; - + case OverlapStart: case OverlapEnd: /* nothing to do except add clicked region to selection, since it @@ -593,11 +593,11 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, to pick out all regions that are defined by the existing selection plus this one. */ - - + + first_frame = entered_regionview->region()->position(); last_frame = entered_regionview->region()->last_frame(); - + for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) { if ((*i)->region()->position() < first_frame) { first_frame = (*i)->region()->position(); @@ -653,12 +653,12 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, if (result.second) { /* newly added to already_in_selection */ - + int d = artv->route()->order_key ("editor"); - + d -= key; - + if (abs (d) < distance) { distance = abs (d); closest = artv; @@ -666,17 +666,17 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, } } } - + if (closest) { /* now add all tracks between that one and this one */ - + int okey = closest->route()->order_key ("editor"); - + if (okey > key) { swap (okey, key); } - + for (TrackViewList::iterator x = track_views.begin(); x != track_views.end(); ++x) { RouteTimeAxisView* artv = dynamic_cast<RouteTimeAxisView*>(*x); if (artv && artv != rtv) { @@ -714,11 +714,11 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, for (set<RouteTimeAxisView*>::iterator t = relevant_tracks.begin(); t != relevant_tracks.end(); ++t) { (*t)->get_selectables (first_frame, last_frame, -1.0, -1.0, results); } - + /* 4. convert to a vector of regions */ vector<RegionView*> regions; - + for (list<Selectable*>::iterator x = results.begin(); x != results.end(); ++x) { RegionView* arv; @@ -750,7 +750,7 @@ Editor::set_selected_regionview_from_region_list (boost::shared_ptr<Region> regi } begin_reversible_command (_("set selected regions")); - + switch (op) { case Selection::Toggle: /* XXX this is not correct */ @@ -784,16 +784,16 @@ Editor::set_selected_regionview_from_map_event (GdkEventAny* /*ev*/, StreamView* return true; } - /* don't reset the selection if its something other than + /* don't reset the selection if its something other than a single other region. */ if (selection->regions.size() > 1) { return true; } - + begin_reversible_command (_("set selected regions")); - + selection->set (rv); commit_reversible_command () ; @@ -883,14 +883,14 @@ Editor::region_selection_changed () editor_regions_selection_changed_connection.block(true); _regions->unselect_all (); - + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - + (*i)->set_selected_regionviews (selection->regions); _regions->set_selected (selection->regions); - + } - + sensitize_the_right_region_actions (!selection->regions.empty()); zoomed_to_region = false; @@ -915,7 +915,7 @@ Editor::select_all_in_track (Selection::Operation op) if (!clicked_routeview) { return; } - + clicked_routeview->get_selectables (0, max_frames, 0, DBL_MAX, touched); switch (op) { @@ -970,7 +970,7 @@ Editor::invert_selection_in_track () if (!clicked_routeview) { return; } - + clicked_routeview->get_inverted_selectables (*selection, touched); selection->set (touched); } @@ -979,7 +979,7 @@ void Editor::invert_selection () { list<Selectable *> touched; - + for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) { if ((*iter)->hidden()) { continue; @@ -1005,7 +1005,7 @@ Editor::select_all_within (nframes64_t start, nframes64_t end, double top, doubl n = touched.size(); (*iter)->get_selectables (start, end, top, bot, touched); - + if (n != touched.size()) { touched_tracks.push_back (*iter); } @@ -1048,7 +1048,7 @@ Editor::select_all_within (nframes64_t start, nframes64_t end, double top, doubl /* not defined yet */ break; } - + commit_reversible_command (); return !touched.empty(); @@ -1315,7 +1315,7 @@ Editor::select_range_between () { nframes64_t start; nframes64_t end; - + if (!get_edit_op_range (start, end)) { return; } @@ -1365,7 +1365,7 @@ Editor::get_edit_op_range (nframes64_t& start, nframes64_t& end) const end = selection->markers.front()->position(); } break; - + case EditAtMouse: /* use mouse + selected marker */ if (selection->markers.empty()) { @@ -1376,11 +1376,11 @@ Editor::get_edit_op_range (nframes64_t& start, nframes64_t& end) const end = m; } break; - + case EditAtSelectedMarker: /* use mouse + selected marker */ if (selection->markers.empty()) { - + MessageDialog win (_("No edit range defined"), false, MESSAGE_INFO, @@ -1388,14 +1388,14 @@ Editor::get_edit_op_range (nframes64_t& start, nframes64_t& end) const win.set_secondary_text ( _("the edit point is Selected Marker\nbut there is no selected marker.")); - + win.set_default_response (RESPONSE_CLOSE); win.set_position (Gtk::WIN_POS_MOUSE); win.show_all(); - + win.run (); - + return false; // NO RANGE } start = selection->markers.front()->position(); diff --git a/gtk2_ardour/editor_selection_list.cc b/gtk2_ardour/editor_selection_list.cc index fab22e8f89..bb85a2e57d 100644 --- a/gtk2_ardour/editor_selection_list.cc +++ b/gtk2_ardour/editor_selection_list.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -154,7 +154,7 @@ Editor::create_named_selection () if (selection->time.empty()) { return; } - + TrackViewList *views = get_valid_views (selection->time.track, selection->time.group); if (views->empty()) { @@ -166,9 +166,9 @@ Editor::create_named_selection () list<boost::shared_ptr<Playlist> > thelist; for (TrackViewList::iterator i = views->begin(); i != views->end(); ++i) { - + boost::shared_ptr<Playlist> pl = (*i)->playlist(); - + if (pl && (what_we_found = pl->copy (selection->time, false)) != 0) { thelist.push_back (what_we_found); } @@ -177,20 +177,20 @@ Editor::create_named_selection () if (!thelist.empty()) { ArdourPrompter p; - + p.set_prompt (_("Name for Chunk:")); p.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT); p.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false); p.change_labels (_("Create Chunk"), _("Forget it")); p.show_all (); - + switch (p.run ()) { - + case Gtk::RESPONSE_ACCEPT: p.get_result (name); if (name.empty()) { return; - } + } break; default: return; @@ -199,7 +199,7 @@ Editor::create_named_selection () new NamedSelection (name, thelist); // creation will add it to the model /* make the one we just added be selected */ - + TreeModel::Children::iterator added = named_selection_model->children().end(); --added; named_selection_display.get_selection()->select (*added); diff --git a/gtk2_ardour/editor_snapshots.cc b/gtk2_ardour/editor_snapshots.cc index 673d5c22a1..80ffdb4491 100644 --- a/gtk2_ardour/editor_snapshots.cc +++ b/gtk2_ardour/editor_snapshots.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2009 Paul Davis + Copyright (C) 2000-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -67,17 +67,17 @@ EditorSnapshots::selection_changed () if (_display.get_selection()->count_selected_rows() > 0) { TreeModel::iterator i = _display.get_selection()->get_selected(); - + Glib::ustring snap_name = (*i)[_columns.real_name]; if (snap_name.length() == 0) { return; } - + if (_session->snap_name() == snap_name) { return; } - + ARDOUR_UI::instance()->load_session (_session->path(), string (snap_name)); } } @@ -138,7 +138,7 @@ EditorSnapshots::rename (Glib::ustring old_name) prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); prompter.set_prompt (_("New name of snapshot")); prompter.set_initial_text (old_name); - + if (prompter.run() == RESPONSE_ACCEPT) { prompter.get_result (new_name); if (new_name.length()) { @@ -191,18 +191,18 @@ EditorSnapshots::redisplay () { string statename = (*i); TreeModel::Row row = *(_model->append()); - + /* this lingers on in case we ever want to change the visible name of the snapshot. */ - + string display_name; display_name = statename; if (statename == _session->snap_name()) { _display.get_selection()->select(row); - } - + } + row[_columns.visible_name] = display_name; row[_columns.real_name] = statename; } diff --git a/gtk2_ardour/editor_snapshots.h b/gtk2_ardour/editor_snapshots.h index 30cde55b28..1a17e6de30 100644 --- a/gtk2_ardour/editor_snapshots.h +++ b/gtk2_ardour/editor_snapshots.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2009 Paul Davis + Copyright (C) 2000-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,11 +37,11 @@ public: void redisplay (); private: - + Gtk::ScrolledWindow _scroller; - + struct Columns : public Gtk::TreeModel::ColumnRecord { - Columns () { + Columns () { add (visible_name); add (real_name); } diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc index 762749eeca..6740ef92eb 100644 --- a/gtk2_ardour/editor_summary.cc +++ b/gtk2_ardour/editor_summary.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,9 +42,9 @@ EditorSummary::EditorSummary (Editor* e) _move_dragging (false), _moved (false), _zoom_dragging (false) - + { - + } /** Connect to a session. @@ -80,11 +80,11 @@ EditorSummary::on_expose_event (GdkEventExpose* event) cairo_t* cr = gdk_cairo_create (get_window()->gobj()); /* Render the view rectangle */ - + pair<double, double> x; pair<double, double> y; get_editor (&x, &y); - + cairo_move_to (cr, x.first, y.first); cairo_line_to (cr, x.second, y.first); cairo_line_to (cr, x.second, y.second); @@ -109,7 +109,7 @@ EditorSummary::on_expose_event (GdkEventExpose* event) _last_playhead = p; cairo_destroy (cr); - + return true; } @@ -120,7 +120,7 @@ void EditorSummary::render (cairo_t* cr) { /* background */ - + cairo_set_source_rgb (cr, 0, 0, 0); cairo_rectangle (cr, 0, 0, _width, _height); cairo_fill (cr); @@ -130,7 +130,7 @@ EditorSummary::render (cairo_t* cr) } /* compute total height of all tracks */ - + int h = 0; int max_height = 0; for (PublicEditor::TrackViewList::const_iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) { @@ -184,7 +184,7 @@ EditorSummary::render_region (RegionView* r, cairo_t* cr, nframes_t start, doubl { uint32_t const c = r->get_fill_color (); cairo_set_source_rgb (cr, UINT_RGBA_R (c) / 255.0, UINT_RGBA_G (c) / 255.0, UINT_RGBA_B (c) / 255.0); - + cairo_move_to (cr, (r->region()->position() - start) * _x_scale, y); cairo_line_to (cr, ((r->region()->position() - start + r->region()->length())) * _x_scale, y); cairo_stroke (cr); @@ -219,7 +219,7 @@ EditorSummary::centre_on_click (GdkEventButton* ev) double const w = xr.second - xr.first; double const h = yr.second - yr.first; - + xr.first = ev->x - w / 2; xr.second = ev->x + w / 2; yr.first = ev->y - h / 2; @@ -259,18 +259,18 @@ EditorSummary::on_button_press_event (GdkEventButton* ev) _start_editor_x = xr; _start_editor_y = yr; _start_mouse_x = ev->x; - _start_mouse_y = ev->y; - + _start_mouse_y = ev->y; + if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { /* primary-modifier-click: start a zoom drag */ - + double const hx = (xr.first + xr.second) * 0.5; _zoom_left = ev->x < hx; _zoom_dragging = true; _editor->_dragging_playhead = true; - - + + /* In theory, we could support vertical dragging, which logically might scale track heights in order to make the editor reflect the dragged viewbox. However, having tried this: @@ -278,13 +278,13 @@ EditorSummary::on_button_press_event (GdkEventButton* ev) b) it's quite slow c) it doesn't seem particularly useful, especially with the limited height of the summary - + So at the moment we don't support that... - */ + */ + - } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) { - + /* secondary-modifier-click: locate playhead */ if (_session) { _session->request_locate (ev->x / _x_scale + _session->current_start_frame()); @@ -293,17 +293,17 @@ EditorSummary::on_button_press_event (GdkEventButton* ev) } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { centre_on_click (ev); - + } else { - + /* ordinary click: start a move drag */ - + _move_dragging = true; _moved = false; _editor->_dragging_playhead = true; } } - + return true; } @@ -322,7 +322,7 @@ EditorSummary::on_motion_notify_event (GdkEventMotion* ev) { pair<double, double> xr = _start_editor_x; pair<double, double> yr = _start_editor_y; - + if (_move_dragging) { _moved = true; @@ -331,7 +331,7 @@ EditorSummary::on_motion_notify_event (GdkEventMotion* ev) xr.second += ev->x - _start_mouse_x; yr.first += ev->y - _start_mouse_y; yr.second += ev->y - _start_mouse_y; - + set_editor (xr, yr); } else if (_zoom_dragging) { @@ -346,7 +346,7 @@ EditorSummary::on_motion_notify_event (GdkEventMotion* ev) set_editor (xr, yr); } - + return true; } @@ -363,15 +363,15 @@ bool EditorSummary::on_scroll_event (GdkEventScroll* ev) { /* mouse wheel */ - + pair<double, double> xr; pair<double, double> yr; get_editor (&xr, &yr); double const amount = 8; - + if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { - + if (ev->direction == GDK_SCROLL_UP) { xr.first += amount; xr.second += amount; @@ -381,7 +381,7 @@ EditorSummary::on_scroll_event (GdkEventScroll* ev) } } else { - + if (ev->direction == GDK_SCROLL_DOWN) { yr.first += amount; yr.second += amount; @@ -389,9 +389,9 @@ EditorSummary::on_scroll_event (GdkEventScroll* ev) yr.first -= amount; yr.second -= amount; } - + } - + set_editor (xr, yr); return true; } @@ -434,4 +434,4 @@ EditorSummary::playhead_position_changed (nframes64_t p) } } - + diff --git a/gtk2_ardour/editor_summary.h b/gtk2_ardour/editor_summary.h index 96d20fffa6..9cc4b12e0d 100644 --- a/gtk2_ardour/editor_summary.h +++ b/gtk2_ardour/editor_summary.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index be7203f2db..e0eba936c8 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ -#include <cstdio> // for sprintf, grrr +#include <cstdio> // for sprintf, grrr #include <cstdlib> #include <cmath> #include <string> @@ -65,7 +65,7 @@ Editor::remove_metric_marks () delete_when_idle (*x); } metric_marks.clear (); -} +} void Editor::draw_metric_marks (const Metrics& metrics) @@ -74,21 +74,21 @@ 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) { - + if ((ms = dynamic_cast<const MeterSection*>(*i)) != 0) { snprintf (buf, sizeof(buf), "%g/%g", ms->beats_per_bar(), ms->note_divisor ()); - metric_marks.push_back (new MeterMarker (*this, *meter_group, ARDOUR_UI::config()->canvasvar_MeterMarker.get(), buf, + metric_marks.push_back (new MeterMarker (*this, *meter_group, ARDOUR_UI::config()->canvasvar_MeterMarker.get(), buf, *(const_cast<MeterSection*>(ms)))); } else if ((ts = dynamic_cast<const TempoSection*>(*i)) != 0) { snprintf (buf, sizeof (buf), "%.2f", ts->beats_per_minute()); - metric_marks.push_back (new TempoMarker (*this, *tempo_group, ARDOUR_UI::config()->canvasvar_TempoMarker.get(), buf, + metric_marks.push_back (new TempoMarker (*this, *tempo_group, ARDOUR_UI::config()->canvasvar_TempoMarker.get(), buf, *(const_cast<TempoSection*>(ts)))); } - + } } @@ -116,7 +116,7 @@ Editor::redisplay_tempo (bool immediate_redraw) if (!session) { return; } - + compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames()); // redraw rulers and measures compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames()); @@ -159,7 +159,7 @@ Editor::compute_current_bbt_points (nframes_t leftmost, nframes_t rightmost) next_beat.beats = 1; } next_beat.ticks = 0; - + delete current_bbt_points; current_bbt_points = 0; @@ -183,7 +183,7 @@ Editor::redraw_measures () void Editor::draw_measures () { - if (session == 0 || _show_measures == false || + if (session == 0 || _show_measures == false || !current_bbt_points || current_bbt_points->empty()) { return; } @@ -204,7 +204,7 @@ Editor::mouse_add_new_tempo_event (nframes64_t frame) TempoMap& map(session->tempo_map()); TempoDialog tempo_dialog (map, frame, _("add")); - + tempo_dialog.set_position (Gtk::WIN_POS_MOUSE); //this causes compiz to display no border. //tempo_dialog.signal_realize().connect (bind (sigc::ptr_fun (set_decoration), &tempo_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH))); @@ -220,20 +220,20 @@ Editor::mouse_add_new_tempo_event (nframes64_t frame) double bpm = 0; BBT_Time requested; - + bpm = tempo_dialog.get_bpm (); double nt = tempo_dialog.get_note_type(); bpm = max (0.01, bpm); - + tempo_dialog.get_bbt_time (requested); - + begin_reversible_command (_("add tempo mark")); XMLNode &before = map.get_state(); map.add_tempo (Tempo (bpm,nt), requested); XMLNode &after = map.get_state(); session->add_command(new MementoCommand<TempoMap>(map, &before, &after)); commit_reversible_command (); - + //map.dump (cerr); } @@ -250,11 +250,11 @@ Editor::mouse_add_new_meter_event (nframes64_t frame) meter_dialog.set_position (Gtk::WIN_POS_MOUSE); - //this causes compiz to display no border.. + //this causes compiz to display no border.. //meter_dialog.signal_realize().connect (bind (sigc::ptr_fun (set_decoration), &meter_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH))); ensure_float (meter_dialog); - + switch (meter_dialog.run ()) { case RESPONSE_ACCEPT: break; @@ -264,7 +264,7 @@ Editor::mouse_add_new_meter_event (nframes64_t frame) double bpb = meter_dialog.get_bpb (); bpb = max (1.0, bpb); // XXX is this a reasonable limit? - + double note_type = meter_dialog.get_note_type (); BBT_Time requested; @@ -275,7 +275,7 @@ Editor::mouse_add_new_meter_event (nframes64_t frame) map.add_meter (Meter (bpb, note_type), requested); session->add_command(new MementoCommand<TempoMap>(map, &before, &map.get_state())); commit_reversible_command (); - + //map.dump (cerr); } @@ -293,7 +293,7 @@ Editor::remove_tempo_marker (ArdourCanvas::Item* item) if ((tempo_marker = dynamic_cast<TempoMarker*> (marker)) == 0) { fatal << _("programming error: marker for tempo is not a tempo marker!") << endmsg; /*NOTREACHED*/ - } + } if (tempo_marker->tempo().movable()) { Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::real_remove_tempo_marker), &tempo_marker->tempo())); @@ -318,7 +318,7 @@ Editor::edit_meter_section (MeterSection* section) double bpb = meter_dialog.get_bpb (); bpb = max (1.0, bpb); // XXX is this a reasonable limit? - + double note_type = meter_dialog.get_note_type (); begin_reversible_command (_("replace tempo mark")); @@ -378,7 +378,7 @@ Editor::edit_tempo_marker (ArdourCanvas::Item *item) if ((tempo_marker = dynamic_cast<TempoMarker*> (marker)) == 0) { fatal << _("programming error: marker for tempo is not a tempo marker!") << endmsg; /*NOTREACHED*/ - } + } edit_tempo_section (&tempo_marker->tempo()); } @@ -397,8 +397,8 @@ Editor::edit_meter_marker (ArdourCanvas::Item *item) if ((meter_marker = dynamic_cast<MeterMarker*> (marker)) == 0) { fatal << _("programming error: marker for meter is not a meter marker!") << endmsg; /*NOTREACHED*/ - } - + } + edit_meter_section (&meter_marker->meter()); } @@ -429,7 +429,7 @@ Editor::remove_meter_marker (ArdourCanvas::Item* item) if ((meter_marker = dynamic_cast<MeterMarker*> (marker)) == 0) { fatal << _("programming error: marker for meter is not a meter marker!") << endmsg; /*NOTREACHED*/ - } + } if (meter_marker->meter().movable()) { Glib::signal_idle().connect (bind (mem_fun(*this, &Editor::real_remove_meter_marker), &meter_marker->meter())); diff --git a/gtk2_ardour/editor_timefx.cc b/gtk2_ardour/editor_timefx.cc index 4339962a87..25d0286d0a 100644 --- a/gtk2_ardour/editor_timefx.cc +++ b/gtk2_ardour/editor_timefx.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -64,7 +64,7 @@ int Editor::time_stretch (RegionSelection& regions, float fraction) { // FIXME: kludge, implement stretching of selection of both types - + if (regions.front()->region()->data_type() == DataType::AUDIO) { // Audio, pop up timefx dialog return time_fx (regions, fraction, false); @@ -73,7 +73,7 @@ Editor::time_stretch (RegionSelection& regions, float fraction) RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (®ions.front()->get_time_axis_view()); if (!rtv) return -1; - + boost::shared_ptr<Playlist> playlist = rtv->track()->diskstream()->playlist(); @@ -135,12 +135,12 @@ Editor::time_fx (RegionSelection& regions, float val, bool pitching) // one octave == 1200 cents // adding one octave doubles the frequency // ratio is 2^^octaves - + pitch_fraction = pow(2, cents/1200); current_timefx->request.time_fraction = 1.0; current_timefx->request.pitch_fraction = pitch_fraction; - + } else { current_timefx->request.time_fraction = val; @@ -166,26 +166,26 @@ Editor::time_fx (RegionSelection& regions, float val, bool pitching) BandLimitedTransients, Transients } transients = Transients; - + precise = current_timefx->precise_button.get_active(); preserve_formants = current_timefx->preserve_formants_button.get_active(); - + txt = current_timefx->stretch_opts_selector.get_active_text (); if (txt == rb_opt_strings[0]) { - transients = NoTransients; peaklock = false; longwin = true; shortwin = false; + transients = NoTransients; peaklock = false; longwin = true; shortwin = false; } else if (txt == rb_opt_strings[1]) { - transients = NoTransients; peaklock = false; longwin = false; shortwin = false; + transients = NoTransients; peaklock = false; longwin = false; shortwin = false; } else if (txt == rb_opt_strings[2]) { - transients = NoTransients; peaklock = true; longwin = false; shortwin = false; + transients = NoTransients; peaklock = true; longwin = false; shortwin = false; } else if (txt == rb_opt_strings[3]) { - transients = BandLimitedTransients; peaklock = true; longwin = false; shortwin = false; + transients = BandLimitedTransients; peaklock = true; longwin = false; shortwin = false; } else if (txt == rb_opt_strings[5]) { - transients = Transients; peaklock = false; longwin = false; shortwin = true; + transients = Transients; peaklock = false; longwin = false; shortwin = true; } else { /* default/4 */ - transients = Transients; peaklock = true; longwin = false; shortwin = false; + transients = Transients; peaklock = true; longwin = false; shortwin = false; } if (realtime) options |= RubberBandStretcher::OptionProcessRealTime; @@ -194,7 +194,7 @@ Editor::time_fx (RegionSelection& regions, float val, bool pitching) if (!peaklock) options |= RubberBandStretcher::OptionPhaseIndependent; if (longwin) options |= RubberBandStretcher::OptionWindowLong; if (shortwin) options |= RubberBandStretcher::OptionWindowShort; - + switch (transients) { case NoTransients: options |= RubberBandStretcher::OptionTransientsSmooth; @@ -215,15 +215,15 @@ Editor::time_fx (RegionSelection& regions, float val, bool pitching) current_timefx->request.progress = 0.0f; current_timefx->request.done = false; current_timefx->request.cancel = false; - + /* re-connect the cancel button and delete events */ - + current_timefx->first_cancel.disconnect(); current_timefx->first_delete.disconnect(); - - current_timefx->first_cancel = current_timefx->cancel_button->signal_clicked().connect + + current_timefx->first_cancel = current_timefx->cancel_button->signal_clicked().connect (mem_fun (current_timefx, &TimeFXDialog::cancel_in_progress)); - current_timefx->first_delete = current_timefx->signal_delete_event().connect + current_timefx->first_delete = current_timefx->signal_delete_event().connect (mem_fun (current_timefx, &TimeFXDialog::delete_in_progress)); if (pthread_create_and_store ("timefx", ¤t_timefx->request.thread, 0, timefx_thread, current_timefx)) { @@ -241,7 +241,7 @@ Editor::time_fx (RegionSelection& regions, float val, bool pitching) } c.disconnect (); - + current_timefx->hide (); return current_timefx->status; } @@ -253,7 +253,7 @@ Editor::do_timefx (TimeFXDialog& dialog) boost::shared_ptr<Playlist> playlist; boost::shared_ptr<Region> new_region; bool in_command = false; - + for (RegionSelection::iterator i = dialog.regions.begin(); i != dialog.regions.end(); ) { AudioRegionView* arv = dynamic_cast<AudioRegionView*>(*i); @@ -265,7 +265,7 @@ Editor::do_timefx (TimeFXDialog& dialog) TimeAxisView* tv = &(arv->get_time_axis_view()); RouteTimeAxisView* rtv; RegionSelection::iterator tmp; - + tmp = i; ++tmp; @@ -278,7 +278,7 @@ Editor::do_timefx (TimeFXDialog& dialog) i = tmp; continue; } - + if ((playlist = t->diskstream()->playlist()) == 0) { i = tmp; continue; diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 51cbdda398..3dbc5b5eea 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -65,7 +65,7 @@ EngineControl::EngineControl () basic_packer (8, 2), options_packer (14, 2), device_packer (6, 2) -#endif +#endif { using namespace Notebook_Helpers; Label* label; @@ -245,7 +245,7 @@ EngineControl::EngineControl () ++row; options_packer.attach (verbose_output_button, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0); ++row; -#else +#else options_packer.attach (verbose_output_button, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0); ++row; #endif @@ -273,7 +273,7 @@ EngineControl::EngineControl () ++row; #ifndef __APPLE__ - label = manage (new Label (_("Dither"))); + label = manage (new Label (_("Dither"))); label->set_alignment (1.0, 0.5); options_packer.attach (dither_mode_combo, 1, 2, row, row + 1, FILL|EXPAND, AttachOptions(0)); options_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0); @@ -286,7 +286,7 @@ EngineControl::EngineControl () fatal << _("No JACK server found anywhere on this system. Please install JACK and restart") << endmsg; /*NOTREACHED*/ } - + set_popdown_strings (serverpath_combo, server_strings); serverpath_combo.set_active_text (server_strings.front()); @@ -312,7 +312,7 @@ EngineControl::EngineControl () label = manage (new Label (_("Output device"))); label->set_alignment (1.0, 0.5); device_packer.attach (*label, 0, 1, row, row+1, FILL|EXPAND, (AttachOptions) 0); - device_packer.attach (output_device_combo, 1, 2, row, row+1, FILL|EXPAND, (AttachOptions) 0); + device_packer.attach (output_device_combo, 1, 2, row, row+1, FILL|EXPAND, (AttachOptions) 0); ++row; #endif label = manage (new Label (_("Input channels"))); @@ -372,7 +372,7 @@ EngineControl::build_command_line (vector<string>& cmd) /* first, path to jackd */ cmd.push_back (serverpath_combo.get_active_text ()); - + /* now jackd arguments */ str = timeout_combo.get_active_text (); @@ -390,7 +390,7 @@ EngineControl::build_command_line (vector<string>& cmd) if (no_memory_lock_button.get_active()) { cmd.push_back ("-m"); /* no munlock */ } - + cmd.push_back ("-p"); /* port max */ cmd.push_back (to_string ((uint32_t) floor (ports_spinner.get_value()), std::dec)); @@ -407,7 +407,7 @@ EngineControl::build_command_line (vector<string>& cmd) if (verbose_output_button.get_active()) { cmd.push_back ("-v"); } - + /* now add fixed arguments (not user-selectable) */ cmd.push_back ("-T"); // temporary */ @@ -451,13 +451,13 @@ EngineControl::build_command_line (vector<string>& cmd) if (!using_coreaudio) { str = audio_mode_combo.get_active_text(); - + if (str == _("Playback/Recording on 1 Device")) { - + /* relax */ - + } else if (str == _("Playback/Recording on 2 Devices")) { - + string input_device = get_device_name (driver, input_device_combo.get_active_text()); string output_device = get_device_name (driver, output_device_combo.get_active_text()); @@ -485,12 +485,12 @@ EngineControl::build_command_line (vector<string>& cmd) cmd.push_back ("-r"); cmd.push_back (to_string (get_rate(), std::dec)); - + cmd.push_back ("-p"); cmd.push_back (period_size_combo.get_active_text()); if (using_alsa) { - + if (audio_mode_combo.get_active_text() != _("Playback/Recording on 2 Devices")) { string device = get_device_name (driver, interface_combo.get_active_text()); @@ -501,12 +501,12 @@ EngineControl::build_command_line (vector<string>& cmd) cmd.push_back ("-d"); cmd.push_back (device); - } + } if (hw_meter_button.get_active()) { cmd.push_back ("-M"); } - + if (hw_monitor_button.get_active()) { cmd.push_back ("-H"); } @@ -525,7 +525,7 @@ EngineControl::build_command_line (vector<string>& cmd) if (force16bit_button.get_active()) { cmd.push_back ("-S"); } - + if (soft_mode_button.get_active()) { cmd.push_back ("-s"); } @@ -534,7 +534,7 @@ EngineControl::build_command_line (vector<string>& cmd) #ifdef __APPLE__ // note: older versions of the CoreAudio JACK backend use -n instead of -d here - + string device = get_device_name (driver, interface_combo.get_active_text()); if (device.empty()) { cmd.clear (); @@ -572,7 +572,7 @@ EngineControl::setup_engine () std::string cwd = "/tmp"; build_command_line (args); - + if (args.empty()) { return 1; // try again } @@ -613,7 +613,7 @@ EngineControl::enumerate_devices (const string& driver) /* note: case matters for the map keys */ if (driver == "CoreAudio") { -#ifdef __APPLE__ +#ifdef __APPLE__ devices[driver] = enumerate_coreaudio_devices (); #endif @@ -635,14 +635,14 @@ EngineControl::enumerate_devices (const string& driver) } #ifdef __APPLE__ -static OSStatus +static OSStatus getDeviceUIDFromID( AudioDeviceID id, char *name, size_t nsize) { UInt32 size = sizeof(CFStringRef); CFStringRef UI; OSStatus res = AudioDeviceGetProperty(id, 0, false, kAudioDevicePropertyDeviceUID, &size, &UI); - if (res == noErr) + if (res == noErr) CFStringGetCString(UI,name,nsize,CFStringGetSystemEncoding()); CFRelease(UI); return res; @@ -652,7 +652,7 @@ vector<string> EngineControl::enumerate_coreaudio_devices () { vector<string> devs; - + // Find out how many Core Audio devices are there, if any... // (code snippet gently "borrowed" from St?hane Letz jackdmp;) OSStatus err; @@ -709,11 +709,11 @@ EngineControl::enumerate_coreaudio_devices () // this returns the unique id for the device // that must be used on the commandline for jack - + if (getDeviceUIDFromID(coreDeviceIDs[i], drivername, sizeof (drivername)) == noErr) { devs.push_back (coreDeviceName); backend_devs.push_back (drivername); - } + } } } } @@ -734,7 +734,7 @@ have no duplex audio device.\n\n\ Alternatively, if you really want just playback\n\ or recording but not both, start JACK before running\n\ Ardour and choose the relevant device then." - ), + ), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK); msg.set_title (_("No suitable audio devices")); msg.set_position (Gtk::WIN_POS_MOUSE); @@ -857,7 +857,7 @@ EngineControl::driver_changed () error << string_compose (_("No devices found for driver \"%1\""), driver) << endmsg; return; } - + for (vector<string>::iterator i = strings.begin(); i != strings.end(); ++i, ++n) { if ((*i).length() > maxlen) { maxlen = (*i).length(); @@ -873,8 +873,8 @@ EngineControl::driver_changed () interface_combo.set_active_text (strings.front()); input_device_combo.set_active_text (strings.front()); output_device_combo.set_active_text (strings.front()); - } - + } + if (driver == "ALSA") { soft_mode_button.set_sensitive (true); force16bit_button.set_sensitive (true); @@ -943,18 +943,18 @@ EngineControl::find_jack_servers (vector<string>& strings) /* this magic lets us finds the path to the OSX bundle, and then we infer JACK's location from there */ - + char execpath[MAXPATHLEN+1]; uint32_t pathsz = sizeof (execpath); _NSGetExecutablePath (execpath, &pathsz); - + string path (Glib::path_get_dirname (execpath)); path += "/jackd"; if (Glib::file_test (path, FILE_TEST_EXISTS)) { strings.push_back (path); - } + } if (getenv ("ARDOUR_WITH_JACK")) { /* no other options - only use the JACK we supply */ @@ -967,7 +967,7 @@ EngineControl::find_jack_servers (vector<string>& strings) #else string path; #endif - + PathScanner scanner; vector<string *> *jack_servers; std::map<string,int> un; @@ -1003,12 +1003,12 @@ EngineControl::find_jack_servers (vector<string>& strings) #endif jack_servers = scanner (path, jack_server_filter, 0, false, true); - + vector<string *>::iterator iter; - + for (iter = jack_servers->begin(); iter != jack_servers->end(); iter++) { string p = **iter; - + if (un[p]++ == 0) { strings.push_back(p); } @@ -1034,13 +1034,13 @@ EngineControl::get_device_name (const string& driver, const string& human_readab if (backend_devs.empty()) { return human_readable; } - + for (i = devices[driver].begin(), n = backend_devs.begin(); i != devices[driver].end(); ++i, ++n) { if (human_readable == (*i)) { return (*n); } } - + if (i == devices[driver].end()) { warning << string_compose (_("Audio device \"%1\" not known on this computer."), human_readable) << endmsg; } @@ -1154,7 +1154,7 @@ EngineControl::get_state () child = new XMLNode ("outputdevice"); child->add_property ("val", output_device_combo.get_active_text()); root->add_child_nocopy (*child); - + return *root; } @@ -1166,17 +1166,17 @@ EngineControl::set_state (const XMLNode& root) XMLNode* child; XMLProperty* prop = NULL; bool using_dummy = false; - + int val; string strval; - + if ( (child = root.child ("driver"))){ prop = child->property("val"); if (prop && (prop->value() == "Dummy") ) { using_dummy = true; } } - + clist = root.children(); for (citer = clist.begin(); citer != clist.end(); ++citer) { @@ -1193,7 +1193,7 @@ EngineControl::set_state (const XMLNode& root) error << string_compose (_("AudioSetup value for %1 is missing data"), child->name()) << endmsg; continue; } - + strval = prop->value(); /* adjustments/spinners */ diff --git a/gtk2_ardour/engine_dialog.h b/gtk2_ardour/engine_dialog.h index a6ebf1e8e6..c806e088cc 100644 --- a/gtk2_ardour/engine_dialog.h +++ b/gtk2_ardour/engine_dialog.h @@ -49,7 +49,7 @@ class EngineControl : public Gtk::VBox { Gtk::CheckButton hw_monitor_button; Gtk::CheckButton hw_meter_button; Gtk::CheckButton verbose_output_button; - + Gtk::Button start_button; Gtk::Button stop_button; Gtk::HButtonBox button_box; @@ -74,7 +74,7 @@ class EngineControl : public Gtk::VBox { Gtk::HBox options_hbox; Gtk::HBox device_hbox; Gtk::Notebook notebook; - + bool _used; void realtime_changed (); @@ -94,7 +94,7 @@ class EngineControl : public Gtk::VBox { std::vector<std::string> enumerate_freebob_devices (); std::vector<std::string> enumerate_ffado_devices (); std::vector<std::string> enumerate_dummy_devices (); -#endif +#endif void redisplay_latency (); uint32_t get_rate(); diff --git a/gtk2_ardour/enums.cc b/gtk2_ardour/enums.cc index cc8b80554d..bec134a73c 100644 --- a/gtk2_ardour/enums.cc +++ b/gtk2_ardour/enums.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/enums.h b/gtk2_ardour/enums.h index 00b7a6e56c..62fe7eeace 100644 --- a/gtk2_ardour/enums.h +++ b/gtk2_ardour/enums.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/evtest.cc b/gtk2_ardour/evtest.cc index db8d502e70..cdf9f028d4 100644 --- a/gtk2_ardour/evtest.cc +++ b/gtk2_ardour/evtest.cc @@ -11,18 +11,18 @@ print_event (GdkEvent* event) switch (event->type) { case GDK_BUTTON_PRESS: - cerr << "Button press, button = " + cerr << "Button press, button = " << event->button.button << " state " - << event->button.state + << event->button.state << endl; break; case GDK_BUTTON_RELEASE: - cerr << "Button release, button = " + cerr << "Button release, button = " << event->button.button << " state " - << event->button.state + << event->button.state << endl; break; @@ -37,7 +37,7 @@ print_event (GdkEvent* event) case GDK_KEY_PRESS: cerr << "Key press, keycode = " << event->key.keyval - << " name " + << " name " << gdk_keyval_name (event->key.keyval) << " state = " << event->key.state @@ -51,7 +51,7 @@ print_event (GdkEvent* event) case GDK_KEY_RELEASE: cerr << "Key release, keycode = " << event->key.keyval - << " name " + << " name " << gdk_keyval_name (event->key.keyval) << " state = " << event->key.state @@ -77,7 +77,7 @@ main (int argc, char* argv[]) Gtk::Main app (&argc, &argv); Gtk::Window window; Gtk::EventBox eventbox; - + window.add (eventbox); window.set_size_request (250, 250); diff --git a/gtk2_ardour/export_channel_selector.cc b/gtk2_ardour/export_channel_selector.cc index 7b665a6087..c0205fa201 100644 --- a/gtk2_ardour/export_channel_selector.cc +++ b/gtk2_ardour/export_channel_selector.cc @@ -51,38 +51,38 @@ PortExportChannelSelector::PortExportChannelSelector (ARDOUR::Session * session, { channels_hbox.pack_start (channels_label, false, false, 0); channels_hbox.pack_end (channels_spinbutton, false, false, 0); - + channels_vbox.pack_start (channels_hbox, false, false, 0); channels_vbox.pack_start (split_checkbox, false, false, 6); - + channel_alignment.add (channel_scroller); channel_alignment.set_padding (0, 0, 12, 0); channel_scroller.add (channel_view); channel_scroller.set_size_request (-1, 130); channel_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - + pack_start (channels_vbox, false, false, 0); pack_start (channel_alignment, true, true, 0); - + /* Channels spinbutton */ - + channels_spinbutton.set_digits (0); channels_spinbutton.set_increments (1, 2); channels_spinbutton.set_range (1, max_channels); channels_spinbutton.set_value (2); - + channels_spinbutton.signal_value_changed().connect (sigc::mem_fun (*this, &PortExportChannelSelector::update_channel_count)); - + /* Other signals */ - + split_checkbox.signal_toggled().connect (sigc::mem_fun (*this, &PortExportChannelSelector::update_split_state)); channel_view.CriticalSelectionChanged.connect (CriticalSelectionChanged.make_slot()); - + /* Finalize */ - + sync_with_manager(); show_all_children (); - + } PortExportChannelSelector::~PortExportChannelSelector () @@ -96,10 +96,10 @@ void PortExportChannelSelector::sync_with_manager () { state = manager->get_channel_configs().front(); - + split_checkbox.set_active (state->config->get_split()); channels_spinbutton.set_value (state->config->get_n_chans()); - + fill_route_list (); channel_view.set_config (state->config); } @@ -111,17 +111,17 @@ PortExportChannelSelector::fill_route_list () RouteList routes = *session->get_routes(); /* Add master bus and then everything else */ - + ARDOUR::IO* master = session->master_out()->output().get(); channel_view.add_route (master); - + for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) { if ((*it)->output().get() == master) { continue; } channel_view.add_route ((*it)->output().get()); } - + update_channel_count (); } @@ -158,12 +158,12 @@ PortExportChannelSelector::RouteCols::get_channel (uint32_t channel) } std::list<Channel>::iterator it = channels.begin(); - + while (channel > 1) { // Channel count starts from one! ++it; --channel; } - + return *it; } @@ -171,26 +171,26 @@ PortExportChannelSelector::ChannelTreeView::ChannelTreeView (uint32_t max_channe n_channels (0) { /* Main columns */ - + route_cols.add_channels (max_channels); - + route_list = Gtk::ListStore::create(route_cols); set_model (route_list); - + /* Add column with toggle and text */ - + append_column_editable (_("Bus or Track"), route_cols.selected); - + Gtk::CellRendererText* text_renderer = Gtk::manage (new Gtk::CellRendererText); text_renderer->property_editable() = false; - + Gtk::TreeView::Column* column = get_column (0); column->pack_start (*text_renderer); column->add_attribute (text_renderer->property_text(), route_cols.name); - + Gtk::CellRendererToggle *toggle = dynamic_cast<Gtk::CellRendererToggle *>(get_column_cell_renderer (0)); toggle->signal_toggled().connect (mem_fun (*this, &PortExportChannelSelector::ChannelTreeView::update_toggle_selection)); - + static_columns = get_columns().size(); } @@ -208,54 +208,54 @@ PortExportChannelSelector::ChannelTreeView::set_config (ChannelConfigPtr c) uint32_t i = 1; ExportChannelConfiguration::ChannelList chan_list = config->get_channels(); for (ExportChannelConfiguration::ChannelList::iterator c_it = chan_list.begin(); c_it != chan_list.end(); ++c_it) { - + for (Gtk::ListStore::Children::iterator r_it = route_list->children().begin(); r_it != route_list->children().end(); ++r_it) { - + ARDOUR::PortExportChannel * pec; if (!(pec = dynamic_cast<ARDOUR::PortExportChannel *> (c_it->get()))) { continue; } - + Glib::RefPtr<Gtk::ListStore> port_list = r_it->get_value (route_cols.port_list_col); std::set<AudioPort *> route_ports; std::set<AudioPort *> intersection; std::map<AudioPort *, ustring> port_labels; - + for (Gtk::ListStore::Children::const_iterator p_it = port_list->children().begin(); p_it != port_list->children().end(); ++p_it) { route_ports.insert ((*p_it)->get_value (route_cols.port_cols.port)); port_labels.insert (std::pair<AudioPort*, ustring> ((*p_it)->get_value (route_cols.port_cols.port), (*p_it)->get_value (route_cols.port_cols.label))); } - + std::set_intersection (pec->get_ports().begin(), pec->get_ports().end(), route_ports.begin(), route_ports.end(), std::insert_iterator<std::set<AudioPort *> > (intersection, intersection.begin())); - + intersection.erase (0); // Remove "none" selection - + if (intersection.empty()) { continue; } - + if (!r_it->get_value (route_cols.selected)) { r_it->set_value (route_cols.selected, true); - + /* Set previous channels (if any) to none */ - + for (uint32_t chn = 1; chn < i; ++chn) { r_it->set_value (route_cols.get_channel (chn).port, (AudioPort *) 0); r_it->set_value (route_cols.get_channel (chn).label, ustring ("(none)")); } } - + AudioPort * port = *intersection.begin(); std::map<AudioPort *, ustring>::iterator label_it = port_labels.find (port); ustring label = label_it != port_labels.end() ? label_it->second : "error"; - + r_it->set_value (route_cols.get_channel (i).port, port); r_it->set_value (route_cols.get_channel (i).label, label); } - + ++i; } } @@ -269,85 +269,85 @@ PortExportChannelSelector::ChannelTreeView::add_route (ARDOUR::IO * io) row[route_cols.selected] = false; row[route_cols.name] = io->name(); row[route_cols.io] = io; - + /* Initialize port list */ - + Glib::RefPtr<Gtk::ListStore> port_list = Gtk::ListStore::create (route_cols.port_cols); row[route_cols.port_list_col] = port_list; - + uint32_t outs = io->n_ports().n_audio(); for (uint32_t i = 0; i < outs; ++i) { iter = port_list->append(); row = *iter; - + row[route_cols.port_cols.selected] = false; row[route_cols.port_cols.port] = io->audio (i); - + std::ostringstream oss; oss << "Out-" << (i + 1); - + row[route_cols.port_cols.label] = oss.str(); } - + iter = port_list->append(); row = *iter; - + row[route_cols.port_cols.selected] = false; row[route_cols.port_cols.port] = 0; row[route_cols.port_cols.label] = "(none)"; - + } void PortExportChannelSelector::ChannelTreeView::set_channel_count (uint32_t channels) { int offset = channels - n_channels; - + while (offset > 0) { ++n_channels; - + std::ostringstream oss; oss << n_channels; - + /* New column */ - - Gtk::TreeView::Column* column = Gtk::manage (new Gtk::TreeView::Column (oss.str())); - + + Gtk::TreeView::Column* column = Gtk::manage (new Gtk::TreeView::Column (oss.str())); + Gtk::CellRendererCombo* combo_renderer = Gtk::manage (new Gtk::CellRendererCombo); - combo_renderer->property_text_column() = 2; + combo_renderer->property_text_column() = 2; column->pack_start (*combo_renderer); - + append_column (*column); - + column->add_attribute (combo_renderer->property_text(), route_cols.get_channel(n_channels).label); column->add_attribute (combo_renderer->property_model(), route_cols.port_list_col); column->add_attribute (combo_renderer->property_editable(), route_cols.selected); - + combo_renderer->signal_edited().connect (sigc::bind (sigc::mem_fun (*this, &PortExportChannelSelector::ChannelTreeView::update_selection_text), n_channels)); - + /* put data into view */ - + for (Gtk::ListStore::Children::iterator it = route_list->children().begin(); it != route_list->children().end(); ++it) { Glib::ustring label = it->get_value(route_cols.selected) ? "(none)" : ""; it->set_value (route_cols.get_channel (n_channels).label, label); it->set_value (route_cols.get_channel (n_channels).port, (AudioPort *) 0); } - + /* set column width */ - + get_column (static_columns + n_channels - 1)->set_min_width (80); - + --offset; } - + while (offset < 0) { --n_channels; - + remove_column (*get_column (n_channels + static_columns)); - + ++offset; } - + update_config (); } @@ -360,26 +360,26 @@ PortExportChannelSelector::ChannelTreeView::update_config () config->clear_channels(); for (uint32_t i = 1; i <= n_channels; ++i) { - + ExportChannelPtr channel (new PortExportChannel ()); PortExportChannel * pec = static_cast<PortExportChannel *> (channel.get()); - + for (Gtk::ListStore::Children::iterator it = route_list->children().begin(); it != route_list->children().end(); ++it) { Gtk::TreeModel::Row row = *it; - + if (!row[route_cols.selected]) { continue; } - + AudioPort * port = row[route_cols.get_channel (i).port]; if (port) { pec->add_port (port); } } - + config->register_channel (channel); } - + CriticalSelectionChanged (); } @@ -388,31 +388,31 @@ PortExportChannelSelector::ChannelTreeView::update_toggle_selection (Glib::ustri { Gtk::TreeModel::iterator iter = get_model ()->get_iter (path); bool selected = iter->get_value (route_cols.selected); - + for (uint32_t i = 1; i <= n_channels; ++i) { - + if (!selected) { iter->set_value (route_cols.get_channel (i).label, Glib::ustring ("")); continue; } - + iter->set_value (route_cols.get_channel (i).label, Glib::ustring("(none)")); iter->set_value (route_cols.get_channel (i).port, (AudioPort *) 0); - + Glib::RefPtr<Gtk::ListStore> port_list = iter->get_value (route_cols.port_list_col); Gtk::ListStore::Children::iterator port_it; uint32_t port_number = 1; - + for (port_it = port_list->children().begin(); port_it != port_list->children().end(); ++port_it) { if (port_number == i) { iter->set_value (route_cols.get_channel (i).label, (Glib::ustring) (*port_it)->get_value (route_cols.port_cols.label)); iter->set_value (route_cols.get_channel (i).port, (AudioPort *) (*port_it)->get_value (route_cols.port_cols.port)); } - + ++port_number; } } - + update_config (); } @@ -421,17 +421,17 @@ PortExportChannelSelector::ChannelTreeView::update_selection_text (Glib::ustring { Gtk::TreeModel::iterator iter = get_model ()->get_iter (path); iter->set_value (route_cols.get_channel (channel).label, new_text); - + Glib::RefPtr<Gtk::ListStore> port_list = iter->get_value (route_cols.port_list_col); Gtk::ListStore::Children::iterator port_it; - + for (port_it = port_list->children().begin(); port_it != port_list->children().end(); ++port_it) { Glib::ustring label = port_it->get_value (route_cols.port_cols.label); if (label == new_text) { iter->set_value (route_cols.get_channel (channel).port, (AudioPort *) (*port_it)[route_cols.port_cols.port]); } } - + update_config (); } @@ -454,15 +454,15 @@ RegionExportChannelSelector::RegionExportChannelSelector (ARDOUR::Session * sess raw_button.set_label (string_compose (_("Region contents without fades (channels: %1)"), region_chans)); raw_button.signal_toggled ().connect (sigc::mem_fun (*this, &RegionExportChannelSelector::handle_selection)); vbox.pack_start (raw_button); - + fades_button.set_label (string_compose (_("Region contents with fades (channels: %1)"), region_chans)); fades_button.signal_toggled ().connect (sigc::mem_fun (*this, &RegionExportChannelSelector::handle_selection)); vbox.pack_start (fades_button); - + processed_button.set_label (string_compose (_("Track output (channels: %1)"), track_chans)); processed_button.signal_toggled ().connect (sigc::mem_fun (*this, &RegionExportChannelSelector::handle_selection)); vbox.pack_start (processed_button); - + sync_with_manager(); vbox.show_all_children (); show_all_children (); @@ -483,7 +483,7 @@ RegionExportChannelSelector::handle_selection () } state->config->clear_channels (); - + if (raw_button.get_active ()) { factory.reset (new RegionExportChannelFactory (session, region, track, RegionExportChannelFactory::Raw)); } else if (fades_button.get_active ()) { @@ -494,10 +494,10 @@ RegionExportChannelSelector::handle_selection () CriticalSelectionChanged (); return; } - + for (size_t chan = 0; chan < region_chans; ++chan) { state->config->register_channel (factory->create (chan)); } - + CriticalSelectionChanged (); } diff --git a/gtk2_ardour/export_channel_selector.h b/gtk2_ardour/export_channel_selector.h index 14b614d5a9..56ce5c9501 100644 --- a/gtk2_ardour/export_channel_selector.h +++ b/gtk2_ardour/export_channel_selector.h @@ -48,7 +48,7 @@ class ExportChannelSelector : public Gtk::HBox protected: typedef boost::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr; typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr; - + ARDOUR::Session * session; ProfileManagerPtr manager; @@ -59,9 +59,9 @@ class ExportChannelSelector : public Gtk::HBox {} virtual ~ExportChannelSelector () {} - + virtual void sync_with_manager () = 0; - + sigc::signal<void> CriticalSelectionChanged; }; @@ -72,7 +72,7 @@ class PortExportChannelSelector : public ExportChannelSelector PortExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager); ~PortExportChannelSelector (); - + void sync_with_manager (); private: @@ -93,101 +93,101 @@ class PortExportChannelSelector : public ExportChannelSelector Gtk::Label channels_label; Gtk::SpinButton channels_spinbutton; Gtk::CheckButton split_checkbox; - + /* Column record for channel selector view */ - + class RouteCols : public Gtk::TreeModelColumnRecord { public: - + struct Channel; - + RouteCols () : n_channels (0) { add (selected); add (name); add (io); add (port_list_col); } - + void add_channels (uint32_t chans); uint32_t n_channels; - + /* Channel count starts from one! */ - + Channel & get_channel (uint32_t channel); - + /* Static columns */ - + Gtk::TreeModelColumn<bool> selected; Gtk::TreeModelColumn<Glib::ustring> name; Gtk::TreeModelColumn<ARDOUR::IO *> io; - + /* Combo list column (shared by all channels) */ - + typedef Gtk::TreeModelColumn<Glib::RefPtr<Gtk::ListStore> > ComboCol; ComboCol port_list_col; - + /* Channel struct, that represents the selected port and it's name */ - + struct Channel { public: Channel (RouteCols & cols) { cols.add (port); cols.add (label); } - + Gtk::TreeModelColumn<ARDOUR::AudioPort *> port; Gtk::TreeModelColumn<Glib::ustring> label; }; std::list<Channel> channels; - + /* List of available ports * Note: We need only one list of selectable ports per route, * so the list is kept in the column record */ - + /* Column record for selecting ports for a channel from a route */ - + class PortCols : public Gtk::TreeModel::ColumnRecord { public: PortCols () { add (selected); add(port); add(label); } - + Gtk::TreeModelColumn<bool> selected; // not used ATM Gtk::TreeModelColumn<ARDOUR::AudioPort *> port; Gtk::TreeModelColumn<Glib::ustring> label; }; PortCols port_cols; }; - + /* Channels view */ - + class ChannelTreeView : public Gtk::TreeView { public: - + ChannelTreeView (uint32_t max_channels); void set_config (ChannelConfigPtr c); - + /* Routes have to be added before adding channels */ - + void clear_routes () { route_list->clear (); } void add_route (ARDOUR::IO * route); void set_channel_count (uint32_t channels); - + sigc::signal<void> CriticalSelectionChanged; - + private: - + ChannelConfigPtr config; void update_config (); - + /* Signal handlers for selections changes in the view */ - + void update_toggle_selection (Glib::ustring const & path); void update_selection_text (Glib::ustring const & path, Glib::ustring const & new_text, uint32_t channel); - + RouteCols route_cols; Glib::RefPtr<Gtk::ListStore> route_list; - + uint32_t static_columns; uint32_t n_channels; }; - + uint32_t max_channels; - + Gtk::ScrolledWindow channel_scroller; Gtk::Alignment channel_alignment; ChannelTreeView channel_view; @@ -201,7 +201,7 @@ class RegionExportChannelSelector : public ExportChannelSelector ProfileManagerPtr manager, ARDOUR::AudioRegion const & region, ARDOUR::AudioTrack & track); - + virtual void sync_with_manager (); private: @@ -212,14 +212,14 @@ class RegionExportChannelSelector : public ExportChannelSelector boost::shared_ptr<ARDOUR::RegionExportChannelFactory> factory; ARDOUR::AudioRegion const & region; ARDOUR::AudioTrack & track; - + uint32_t region_chans; uint32_t track_chans; - + /*** GUI components ***/ - + Gtk::VBox vbox; - + Gtk::RadioButtonGroup type_group; Gtk::RadioButton raw_button; Gtk::RadioButton fades_button; diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index c05c4e0140..c9a92bd79f 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -46,44 +46,44 @@ void ExportDialog::set_session (ARDOUR::Session* s) { session = s; - + /* Init handler and profile manager */ - + handler = session->get_export_handler (); status = session->get_export_status (); profile_manager.reset (new ExportProfileManager (*session)); - + /* Possibly init stuff in derived classes */ - + init (); - + /* Rest of session related initialization */ - + preset_selector->set_manager (profile_manager); file_notebook->set_session_and_manager (session, profile_manager); - + /* Hand on selection range to profile manager */ - + TimeSelection const & time (editor.get_selection().time); if (!time.empty()) { profile_manager->set_selection_range (time.front().start, time.front().end); } else { profile_manager->set_selection_range (); } - + /* Load states */ - + profile_manager->load_profile (); sync_with_manager (); - + /* Warnings */ - + preset_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::sync_with_manager)); timespan_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings)); channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings)); file_notebook->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings)); status->Aborting.connect (sigc::mem_fun (*this, &ExportDialog::notify_errors)); - + update_warnings (); } @@ -94,38 +94,38 @@ ExportDialog::init () init_gui (); /* warnings */ - + warning_widget.pack_start (warn_hbox, true, true, 6); warning_widget.pack_end (list_files_hbox, false, false, 0); - + warn_hbox.pack_start (warn_label, true, true, 16); warn_label.set_use_markup (true); - + list_files_hbox.pack_end (list_files_button, false, false, 6); list_files_hbox.pack_end (list_files_label, false, false, 6); list_files_label.set_use_markup (true); - + list_files_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::show_conflicting_files)); - + /* Progress indicators */ - + progress_widget.pack_start (progress_label, false, false, 6); progress_widget.pack_start (progress_bar, false, false, 6); - + /* Buttons */ - + cancel_button = add_button (Gtk::Stock::CANCEL, RESPONSE_CANCEL); rt_export_button = add_button (_("Realtime Export"), RESPONSE_RT); fast_export_button = add_button (_("Fast Export"), RESPONSE_FAST); - + list_files_button.set_name ("PaddedButton"); - + cancel_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::close_dialog)); rt_export_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::export_rt)); fast_export_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::export_fw)); - + /* Done! */ - + show_all_children (); progress_widget.hide_all(); } @@ -141,21 +141,21 @@ ExportDialog::init_gui () Gtk::VBox* advanced_vbox = Gtk::manage (new Gtk::VBox()); advanced_vbox->set_spacing (12); advanced_vbox->set_border_width (12); - + Gtk::Alignment * timespan_align = Gtk::manage (new Gtk::Alignment()); timespan_label = Gtk::manage (new Gtk::Label (_("Time Span"), Gtk::ALIGN_LEFT)); timespan_align->add (*timespan_selector); timespan_align->set_padding (0, 12, 18, 0); advanced_vbox->pack_start (*timespan_label, false, false, 0); advanced_vbox->pack_start (*timespan_align, false, false, 0); - + Gtk::Alignment * channels_align = Gtk::manage (new Gtk::Alignment()); channels_label = Gtk::manage (new Gtk::Label (_("Channels"), Gtk::ALIGN_LEFT)); channels_align->add (*channel_selector); channels_align->set_padding (0, 12, 18, 0); advanced_vbox->pack_start (*channels_label, false, false, 0); advanced_vbox->pack_start (*channels_align, false, false, 0); - + get_vbox()->pack_start (*file_notebook, false, false, 0); get_vbox()->pack_start (warning_widget, false, false, 0); get_vbox()->pack_start (progress_widget, false, false, 0); @@ -164,11 +164,11 @@ ExportDialog::init_gui () advanced->add (*advanced_vbox); get_vbox()->pack_start (*advanced, false, false); - + Pango::AttrList bold; Pango::Attribute b = Pango::Attribute::create_attr_weight (Pango::WEIGHT_BOLD); bold.insert (b); - + timespan_label->set_attributes (bold); channels_label->set_attributes (bold); } @@ -198,10 +198,10 @@ ExportDialog::close_dialog () if (status->running) { status->abort(); } - + hide_all (); set_modal (false); - + } void @@ -224,7 +224,7 @@ ExportDialog::update_warnings () list_files_hbox.hide (); list_files_string = ""; - + fast_export_button->set_sensitive (true); rt_export_button->set_sensitive (true); @@ -253,15 +253,15 @@ void ExportDialog::show_conflicting_files () { ArdourDialog dialog (_("Files that will be overwritten"), true); - + Gtk::Label label ("", Gtk::ALIGN_LEFT); label.set_use_markup (true); label.set_markup (list_files_string); - + dialog.get_vbox()->pack_start (label); dialog.add_button (Gtk::Stock::OK, 0); dialog.show_all_children (); - + dialog.run(); } @@ -295,7 +295,7 @@ ExportDialog::show_progress () progress_widget.show (); progress_widget.show_all_children (); progress_connection = Glib::signal_timeout().connect (mem_fun(*this, &ExportDialog::progress_timeout), 100); - + gtk_main_iteration (); while (status->running) { if (gtk_events_pending()) { @@ -339,13 +339,13 @@ ExportDialog::add_error (Glib::ustring const & text) { fast_export_button->set_sensitive (false); rt_export_button->set_sensitive (false); - + if (warn_string.empty()) { warn_string = _("<span color=\"#ffa755\">Error: ") + text + "</span>"; } else { warn_string = _("<span color=\"#ffa755\">Error: ") + text + "</span>\n" + warn_string; } - + warn_label.set_markup (warn_string); } @@ -357,7 +357,7 @@ ExportDialog::add_warning (Glib::ustring const & text) } else { warn_string = warn_string + _("\n<span color=\"#ffa755\">Warning: ") + text + "</span>"; } - + warn_label.set_markup (warn_string); } @@ -400,7 +400,7 @@ void ExportRegionDialog::init_gui () { ExportDialog::init_gui (); - + channels_label->set_text (_("Source")); } diff --git a/gtk2_ardour/export_dialog.h b/gtk2_ardour/export_dialog.h index 8e70920b7c..5a1d7839ca 100644 --- a/gtk2_ardour/export_dialog.h +++ b/gtk2_ardour/export_dialog.h @@ -50,9 +50,9 @@ class ExportDialog : public ArdourDialog { explicit ExportDialog (PublicEditor & editor, Glib::ustring title = _("Export")); ~ExportDialog (); - + void set_session (ARDOUR::Session* s); - + /* Responses */ enum Responses { @@ -65,7 +65,7 @@ class ExportDialog : public ArdourDialog { typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr; typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ManagerPtr; - + HandlerPtr handler; ManagerPtr profile_manager; @@ -79,10 +79,10 @@ class ExportDialog : public ArdourDialog { boost::shared_ptr<ExportTimespanSelector> timespan_selector; boost::shared_ptr<ExportChannelSelector> channel_selector; boost::shared_ptr<ExportFileNotebook> file_notebook; - + Gtk::VBox warning_widget; Gtk::VBox progress_widget; - + Gtk::Label * timespan_label; Gtk::Label * channels_label; @@ -92,46 +92,46 @@ class ExportDialog : public ArdourDialog { void notify_errors (); void close_dialog (); - + void sync_with_manager (); void update_warnings (); void show_conflicting_files (); void export_rt (); void export_fw (); - + void show_progress (); gint progress_timeout (); - + typedef boost::shared_ptr<ARDOUR::ExportStatus> StatusPtr; - + PublicEditor & editor; StatusPtr status; - + /*** GUI components ***/ - + /* Warning area */ - + Gtk::HBox warn_hbox; Gtk::Label warn_label; Glib::ustring warn_string; - + Gtk::HBox list_files_hbox; Gtk::Label list_files_label; Gtk::Button list_files_button; Glib::ustring list_files_string; - + void add_error (Glib::ustring const & text); void add_warning (Glib::ustring const & text); - + /* Progress bar */ - + Gtk::Label progress_label; Gtk::ProgressBar progress_bar; sigc::connection progress_connection; - + /* Buttons */ - + Gtk::Button * cancel_button; Gtk::Button * rt_export_button; Gtk::Button * fast_export_button; @@ -145,7 +145,7 @@ class ExportRangeDialog : public ExportDialog private: void init_components (); - + Glib::ustring range_id; }; @@ -166,7 +166,7 @@ class ExportRegionDialog : public ExportDialog private: void init_gui (); void init_components (); - + ARDOUR::AudioRegion const & region; ARDOUR::AudioTrack & track; }; diff --git a/gtk2_ardour/export_file_notebook.cc b/gtk2_ardour/export_file_notebook.cc index 9b5136c9a4..ab9a22ee28 100644 --- a/gtk2_ardour/export_file_notebook.cc +++ b/gtk2_ardour/export_file_notebook.cc @@ -31,17 +31,17 @@ ExportFileNotebook::ExportFileNotebook () : page_counter (1) { /* Last page */ - + new_file_button.set_image (*Gtk::manage (new Gtk::Image (::get_icon("add")))); new_file_button.set_label (_(" Click here to add another format")); new_file_button.set_alignment (0, 0.5); new_file_button.set_relief (Gtk::RELIEF_NONE); - + new_file_hbox.pack_start (new_file_button, true, true); append_page (new_file_dummy, new_file_hbox); set_tab_label_packing (new_file_dummy, true, true, Gtk::PACK_START); new_file_hbox.show_all_children (); - + page_change_connection = signal_switch_page().connect (sigc::mem_fun (*this, &ExportFileNotebook::handle_page_change)); new_file_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportFileNotebook::add_new_file_page)); } @@ -51,7 +51,7 @@ ExportFileNotebook::set_session_and_manager (ARDOUR::Session * s, boost::shared_ { session = s; profile_manager = manager; - + sync_with_manager (); } @@ -67,7 +67,7 @@ ExportFileNotebook::sync_with_manager () remove_page (0); } page_change_connection.block(false); - + page_counter = 1; last_visible_page = 0; @@ -82,7 +82,7 @@ ExportFileNotebook::sync_with_manager () ++format_it, ++filename_it) { add_file_page (*format_it, *filename_it); } - + set_current_page (0); CriticalSelectionChanged (); } @@ -117,7 +117,7 @@ ExportFileNotebook::add_file_page (ARDOUR::ExportProfileManager::FormatStatePtr update_remove_file_page_sensitivity (); show_all_children(); ++page_counter; - + CriticalSelectionChanged (); } @@ -129,7 +129,7 @@ ExportFileNotebook::remove_file_page (FilePage * page) remove_page (*page); update_remove_file_page_sensitivity (); - + CriticalSelectionChanged (); } @@ -173,51 +173,51 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, pack_start (format_align, false, false, 0); pack_start (filename_label, false, false, 0); pack_start (filename_align, false, false, 0); - + format_align.add (format_selector); format_align.set_padding (6, 12, 18, 0); - + filename_align.add (filename_selector); filename_align.set_padding (0, 12, 18, 0); - + Pango::AttrList bold; Pango::Attribute b = Pango::Attribute::create_attr_weight (Pango::WEIGHT_BOLD); bold.insert (b); - + format_label.set_attributes (bold); filename_label.set_attributes (bold); tab_label.set_attributes (bold); - + /* Set states */ format_selector.set_state (format_state, s); filename_selector.set_state (filename_state, s); - + /* Signals */ - + tab_close_button.signal_clicked().connect (sigc::bind (sigc::mem_fun (*parent, &ExportFileNotebook::remove_file_page), this)); - + profile_manager->FormatListChanged.connect (sigc::mem_fun (format_selector, &ExportFormatSelector::update_format_list)); - + format_selector.FormatEdited.connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::save_format_to_manager)); format_selector.FormatRemoved.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::remove_format_profile)); format_selector.NewFormat.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::get_new_format)); - + format_selector.CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::update_tab_label)); filename_selector.CriticalSelectionChanged.connect (CriticalSelectionChanged.make_slot()); - + /* Tab widget */ - + tab_close_button.add (*Gtk::manage (new Gtk::Image (::get_icon("close")))); tab_close_alignment.add (tab_close_button); tab_close_alignment.set (0.5, 0.5, 0, 0); - + tab_widget.pack_start (tab_label, false, false, 3); tab_widget.pack_end (tab_close_alignment, false, false, 0); tab_widget.show_all_children (); update_tab_label (); - + /* Done */ - + show_all_children (); } diff --git a/gtk2_ardour/export_file_notebook.h b/gtk2_ardour/export_file_notebook.h index b6aee9992c..4eed7dc200 100644 --- a/gtk2_ardour/export_file_notebook.h +++ b/gtk2_ardour/export_file_notebook.h @@ -37,23 +37,23 @@ namespace ARDOUR { class ExportFileNotebook : public Gtk::Notebook { public: - + ExportFileNotebook (); - + void set_session_and_manager (ARDOUR::Session * s, boost::shared_ptr<ARDOUR::ExportProfileManager> manager); void sync_with_manager (); - + Glib::ustring get_nth_format_name (uint32_t n); - + sigc::signal<void> CriticalSelectionChanged; - + private: typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ManagerPtr; typedef boost::shared_ptr<ARDOUR::ExportFormatSpecification> FormatPtr; typedef boost::shared_ptr<ARDOUR::ExportFilename> FilenamePtr; class FilePage; - + ManagerPtr profile_manager; ARDOUR::Session * session; @@ -61,52 +61,52 @@ class ExportFileNotebook : public Gtk::Notebook void add_file_page (ARDOUR::ExportProfileManager::FormatStatePtr format_state, ARDOUR::ExportProfileManager::FilenameStatePtr filename_state); void remove_file_page (FilePage * page); void update_remove_file_page_sensitivity (); - + sigc::connection page_change_connection; void handle_page_change (GtkNotebookPage*, uint32_t page); - + Gtk::HBox new_file_hbox; Gtk::Button new_file_button; Gtk::VBox new_file_dummy; - + uint32_t last_visible_page; uint32_t page_counter; class FilePage : public Gtk::VBox { public: - FilePage (ARDOUR::Session * s, ManagerPtr profile_manager, ExportFileNotebook * parent, uint32_t number, + FilePage (ARDOUR::Session * s, ManagerPtr profile_manager, ExportFileNotebook * parent, uint32_t number, ARDOUR::ExportProfileManager::FormatStatePtr format_state, ARDOUR::ExportProfileManager::FilenameStatePtr filename_state); - + virtual ~FilePage (); - + Gtk::Widget & get_tab_widget () { return tab_widget; } void set_remove_sensitive (bool value); Glib::ustring get_format_name () const; - + ARDOUR::ExportProfileManager::FormatStatePtr get_format_state () const { return format_state; } ARDOUR::ExportProfileManager::FilenameStatePtr get_filename_state () const { return filename_state; } - + sigc::signal<void> CriticalSelectionChanged; - + private: void save_format_to_manager (FormatPtr format); void update_tab_label (); - + ARDOUR::ExportProfileManager::FormatStatePtr format_state; ARDOUR::ExportProfileManager::FilenameStatePtr filename_state; ManagerPtr profile_manager; - + /* GUI components */ - + Gtk::Label format_label; Gtk::Alignment format_align; ExportFormatSelector format_selector; - + Gtk::Label filename_label; Gtk::Alignment filename_align; ExportFilenameSelector filename_selector; - + Gtk::HBox tab_widget; Gtk::Label tab_label; Gtk::Alignment tab_close_alignment; diff --git a/gtk2_ardour/export_filename_selector.cc b/gtk2_ardour/export_filename_selector.cc index a78c0e7890..30a7fbce7f 100644 --- a/gtk2_ardour/export_filename_selector.cc +++ b/gtk2_ardour/export_filename_selector.cc @@ -43,7 +43,7 @@ ExportFilenameSelector::ExportFilenameSelector () : pack_start (include_label, false, false, 6); pack_start (include_hbox, false, false, 0); pack_start (path_hbox, false, false, 12); - + include_hbox.pack_start (label_label, false, false, 3); include_hbox.pack_start (label_entry, false, false, 3); include_hbox.pack_start (session_checkbox, false, false, 3); @@ -51,53 +51,53 @@ ExportFilenameSelector::ExportFilenameSelector () : include_hbox.pack_start (time_format_combo, false, false, 3); include_hbox.pack_start (revision_checkbox, false, false, 3); include_hbox.pack_start (revision_spinbutton, false, false, 3); - + path_hbox.pack_start (path_label, false, false, 3); path_hbox.pack_start (path_entry, true, true, 3); path_hbox.pack_start (browse_button, false, false, 3); - + date_format_combo.set_name ("PaddedButton"); time_format_combo.set_name ("PaddedButton"); browse_button.set_name ("PaddedButton"); - + label_sizegroup = Gtk::SizeGroup::create (Gtk::SIZE_GROUP_HORIZONTAL); label_sizegroup->add_widget (label_label); label_sizegroup->add_widget (path_label); - + /* Date */ - + date_format_list = Gtk::ListStore::create (date_format_cols); date_format_combo.set_model (date_format_list); date_format_combo.pack_start (date_format_cols.label); - + date_format_combo.signal_changed().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_date_format)); - + /* Time */ - + time_format_list = Gtk::ListStore::create (time_format_cols); time_format_combo.set_model (time_format_list); time_format_combo.pack_start (time_format_cols.label); - + time_format_combo.signal_changed().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_time_format)); - + /* Revision */ - + revision_spinbutton.set_digits (0); revision_spinbutton.set_increments (1, 10); revision_spinbutton.set_range (1, 1000); revision_spinbutton.set_sensitive (false); - + /* Signals */ - + label_entry.signal_changed().connect (sigc::mem_fun (*this, &ExportFilenameSelector::update_label)); path_entry.signal_changed().connect (sigc::mem_fun (*this, &ExportFilenameSelector::update_folder)); - + session_checkbox.signal_toggled().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_session_selection)); - + revision_checkbox.signal_toggled().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_revision_selection)); revision_spinbutton.signal_value_changed().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_revision_value)); - - browse_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportFilenameSelector::open_browse_dialog)); + + browse_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportFilenameSelector::open_browse_dialog)); } ExportFilenameSelector::~ExportFilenameSelector () @@ -117,15 +117,15 @@ ExportFilenameSelector::load_state () revision_checkbox.set_active (filename->include_revision); revision_spinbutton.set_value (filename->get_revision()); path_entry.set_text (filename->get_folder()); - + Gtk::TreeModel::Children::iterator it; - + for (it = date_format_list->children().begin(); it != date_format_list->children().end(); ++it) { if (it->get_value (date_format_cols.format) == filename->get_date_format()) { date_format_combo.set_active (it); } } - + for (it = time_format_list->children().begin(); it != time_format_list->children().end(); ++it) { if (it->get_value (time_format_cols.format) == filename->get_time_format()) { time_format_combo.set_active (it); @@ -137,57 +137,57 @@ void ExportFilenameSelector::set_state (ARDOUR::ExportProfileManager::FilenameStatePtr state_, ARDOUR::Session * session_) { session = session_; - + filename = state_->filename; - + /* Fill combo boxes */ - + Gtk::TreeModel::iterator iter; Gtk::TreeModel::Row row; - + /* Dates */ - + date_format_list->clear(); - + iter = date_format_list->append(); row = *iter; row[date_format_cols.format] = ExportFilename::D_None; row[date_format_cols.label] = filename->get_date_format_str (ExportFilename::D_None); - + iter = date_format_list->append(); row = *iter; row[date_format_cols.format] = ExportFilename::D_ISO; row[date_format_cols.label] = filename->get_date_format_str (ExportFilename::D_ISO); - + iter = date_format_list->append(); row = *iter; row[date_format_cols.format] = ExportFilename::D_ISOShortY; row[date_format_cols.label] = filename->get_date_format_str (ExportFilename::D_ISOShortY); - + iter = date_format_list->append(); row = *iter; row[date_format_cols.format] = ExportFilename::D_BE; row[date_format_cols.label] = filename->get_date_format_str (ExportFilename::D_BE); - + iter = date_format_list->append(); row = *iter; row[date_format_cols.format] = ExportFilename::D_BEShortY; row[date_format_cols.label] = filename->get_date_format_str (ExportFilename::D_BEShortY); - + /* Times */ - + time_format_list->clear(); - + iter = time_format_list->append(); row = *iter; row[time_format_cols.format] = ExportFilename::T_None; row[time_format_cols.label] = filename->get_time_format_str (ExportFilename::T_None); - + iter = time_format_list->append(); row = *iter; row[time_format_cols.format] = ExportFilename::T_NoDelim; row[time_format_cols.label] = filename->get_time_format_str (ExportFilename::T_NoDelim); - + iter = time_format_list->append(); row = *iter; row[time_format_cols.format] = ExportFilename::T_Delim; @@ -205,9 +205,9 @@ ExportFilenameSelector::update_label () if (!filename) { return; } - + filename->set_label (label_entry.get_text()); - + filename->include_label = !label_entry.get_text().empty(); CriticalSelectionChanged(); } @@ -218,7 +218,7 @@ ExportFilenameSelector::update_folder () if (!filename) { return; } - + filename->set_folder (path_entry.get_text()); CriticalSelectionChanged(); } @@ -229,7 +229,7 @@ ExportFilenameSelector::change_date_format () if (!filename) { return; } - + DateFormat format = date_format_combo.get_active()->get_value (date_format_cols.format); filename->set_date_format (format); CriticalSelectionChanged(); @@ -241,7 +241,7 @@ ExportFilenameSelector::change_time_format () if (!filename) { return; } - + TimeFormat format = time_format_combo.get_active()->get_value (time_format_cols.format); filename->set_time_format (format); CriticalSelectionChanged(); @@ -253,7 +253,7 @@ ExportFilenameSelector::change_session_selection () if (!filename) { return; } - + filename->include_session = session_checkbox.get_active(); CriticalSelectionChanged(); } @@ -264,10 +264,10 @@ ExportFilenameSelector::change_revision_selection () if (!filename) { return; } - + bool selected = revision_checkbox.get_active(); filename->include_revision = selected; - + revision_spinbutton.set_sensitive (selected); CriticalSelectionChanged(); } @@ -278,7 +278,7 @@ ExportFilenameSelector::change_revision_value () if (!filename) { return; } - + filename->set_revision ((uint32_t) revision_spinbutton.get_value_as_int()); CriticalSelectionChanged(); } @@ -297,11 +297,11 @@ ExportFilenameSelector::open_browse_dialog () if (result == Gtk::RESPONSE_OK) { Glib::ustring filename = dialog.get_filename(); - + if (filename.length()) { path_entry.set_text (filename); } } - + CriticalSelectionChanged(); } diff --git a/gtk2_ardour/export_filename_selector.h b/gtk2_ardour/export_filename_selector.h index faa508de41..a6c36da83d 100644 --- a/gtk2_ardour/export_filename_selector.h +++ b/gtk2_ardour/export_filename_selector.h @@ -30,7 +30,7 @@ namespace ARDOUR { class Session; } -/// +/// class ExportFilenameSelector : public Gtk::VBox { public: typedef boost::shared_ptr<ARDOUR::ExportFilename> FilenamePtr; @@ -39,9 +39,9 @@ class ExportFilenameSelector : public Gtk::VBox { ~ExportFilenameSelector (); void set_state (ARDOUR::ExportProfileManager::FilenameStatePtr state_, ARDOUR::Session * session_); - + /* Compatibility with other elements */ - + sigc::signal<void> CriticalSelectionChanged; private: @@ -53,11 +53,11 @@ class ExportFilenameSelector : public Gtk::VBox { void change_date_format (); void change_time_format (); - + void change_session_selection (); void change_revision_selection (); void change_revision_value (); - + void open_browse_dialog (); ARDOUR::Session * session; @@ -66,49 +66,49 @@ class ExportFilenameSelector : public Gtk::VBox { Glib::RefPtr<Gtk::SizeGroup> label_sizegroup; Gtk::Label include_label; - + Gtk::HBox include_hbox; - + Gtk::Label label_label; Gtk::Entry label_entry; - + Gtk::CheckButton session_checkbox; - + Gtk::CheckButton revision_checkbox; Gtk::SpinButton revision_spinbutton; - + Gtk::HBox path_hbox; - + Gtk::Label path_label; Gtk::Entry path_entry; Gtk::Button browse_button; - + /* Date combo */ - + typedef ARDOUR::ExportFilename::DateFormat DateFormat; - + struct DateFormatCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn<DateFormat> format; Gtk::TreeModelColumn<Glib::ustring> label; - + DateFormatCols () { add(format); add(label); } }; DateFormatCols date_format_cols; Glib::RefPtr<Gtk::ListStore> date_format_list; Gtk::ComboBox date_format_combo; - + /* Time combo */ - + typedef ARDOUR::ExportFilename::TimeFormat TimeFormat; - + struct TimeFormatCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn<TimeFormat> format; Gtk::TreeModelColumn<Glib::ustring> label; - + TimeFormatCols () { add(format); add(label); } }; TimeFormatCols time_format_cols; diff --git a/gtk2_ardour/export_format_dialog.cc b/gtk2_ardour/export_format_dialog.cc index 22852882ba..593f16ec58 100644 --- a/gtk2_ardour/export_format_dialog.cc +++ b/gtk2_ardour/export_format_dialog.cc @@ -68,110 +68,110 @@ ExportFormatDialog::ExportFormatDialog (FormatPtr format, bool new_dialog) : { /* Pack containers in dialog */ - + get_vbox()->pack_start (name_hbox, false, false, 0); get_vbox()->pack_start (silence_table, false, false, 6); get_vbox()->pack_start (format_table, false, false, 6); get_vbox()->pack_start (encoding_options_vbox, false, false, 0); - + /* Name, new and remove */ - + name_hbox.pack_start (name_label, false, false, 0); name_hbox.pack_start (name_entry, true, true, 0); - + /* Normalize */ - + normalize_hbox.pack_start (normalize_checkbox, false, false, 0); normalize_hbox.pack_start (normalize_spinbutton, false, false, 6); normalize_hbox.pack_start (normalize_db_label, false, false, 0); - + normalize_spinbutton.configure (normalize_adjustment, 0.1, 2); - + /* Silence */ - + silence_table.set_row_spacings (6); silence_table.set_col_spacings (12); - + silence_table.attach (normalize_hbox, 0, 3, 0, 1); - + silence_table.attach (trim_start_checkbox, 0, 1, 1, 2); silence_table.attach (silence_start_checkbox, 1, 2, 1, 2); silence_table.attach (silence_start_clock, 2, 3, 1, 2); - + silence_table.attach (trim_end_checkbox, 0, 1, 2, 3); silence_table.attach (silence_end_checkbox, 1, 2, 2, 3); silence_table.attach (silence_end_clock, 2, 3, 2, 3); - + /* Format table */ init_format_table(); - + /* Encoding options */ - + init_encoding_option_widgets(); - + encoding_options_table.set_spacings (1); - + encoding_options_vbox.pack_start (encoding_options_label, false, false, 0); encoding_options_vbox.pack_start (encoding_options_table, false, false, 12); - + Pango::AttrList bold; Pango::Attribute b = Pango::Attribute::create_attr_weight (Pango::WEIGHT_BOLD); bold.insert (b); encoding_options_label.set_attributes (bold); - + /* Buttons */ - + revert_button = add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); revert_button->signal_clicked().connect (mem_fun(*this, &ExportFormatDialog::revert)); close_button = add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_APPLY); close_button->set_sensitive (false); close_button->signal_clicked().connect (mem_fun (*this, &ExportFormatDialog::end_dialog)); manager.CompleteChanged.connect (mem_fun (*close_button, &Gtk::Button::set_sensitive)); - + /* Load state before hooking up the rest of the signals */ - + load_state (format); - + /* Name entry */ - + name_entry.signal_changed().connect (mem_fun (*this, &ExportFormatDialog::update_name)); - + /* Normalize, silence and src_quality signals */ - + trim_start_checkbox.signal_toggled().connect (mem_fun (*this, &ExportFormatDialog::update_trim_start_selection)); trim_end_checkbox.signal_toggled().connect (mem_fun (*this, &ExportFormatDialog::update_trim_end_selection)); - + normalize_checkbox.signal_toggled().connect (mem_fun (*this, &ExportFormatDialog::update_normalize_selection)); normalize_spinbutton.signal_value_changed().connect (mem_fun (*this, &ExportFormatDialog::update_normalize_selection)); - + silence_start_checkbox.signal_toggled().connect (mem_fun (*this, &ExportFormatDialog::update_silence_start_selection)); silence_start_clock.ValueChanged.connect (mem_fun (*this, &ExportFormatDialog::update_silence_start_selection)); - + silence_end_checkbox.signal_toggled().connect (mem_fun (*this, &ExportFormatDialog::update_silence_end_selection)); silence_end_clock.ValueChanged.connect (mem_fun (*this, &ExportFormatDialog::update_silence_end_selection)); - + src_quality_combo.signal_changed().connect (mem_fun (*this, &ExportFormatDialog::update_src_quality_selection)); - + /* Format table signals */ - + Gtk::CellRendererToggle *toggle = dynamic_cast<Gtk::CellRendererToggle *>(compatibility_view.get_column_cell_renderer (0)); toggle->signal_toggled().connect (mem_fun (*this, &ExportFormatDialog::update_compatibility_selection)); compatibility_select_connection = compatibility_view.get_selection()->signal_changed().connect (mem_fun (*this, &ExportFormatDialog::prohibit_compatibility_selection)); - + quality_view.get_selection()->signal_changed().connect (mem_fun(*this, &ExportFormatDialog::update_quality_selection)); format_view.get_selection()->signal_changed().connect (mem_fun(*this, &ExportFormatDialog::update_format_selection)); sample_rate_view.get_selection()->signal_changed().connect (mem_fun(*this, &ExportFormatDialog::update_sample_rate_selection)); - + /* Encoding option signals */ - + sample_format_view.get_selection()->signal_changed().connect (mem_fun(*this, &ExportFormatDialog::update_sample_format_selection)); dither_type_view.get_selection()->signal_changed().connect (mem_fun(*this, &ExportFormatDialog::update_dither_type_selection)); - + tag_checkbox.signal_toggled().connect (mem_fun (*this, &ExportFormatDialog::update_tagging_selection)); - + /* Finalize */ - + show_all_children(); } @@ -184,10 +184,10 @@ void ExportFormatDialog::revert () { ++applying_changes_from_engine; - + format->set_state (original_state); load_state (format); - + --applying_changes_from_engine; } @@ -198,15 +198,15 @@ ExportFormatDialog::set_session (ARDOUR::Session* s) if (!session) { return; } - + silence_start_clock.set_session (s); silence_end_clock.set_session (s); - + update_clock (silence_start_clock, silence_start); update_clock (silence_end_clock, silence_end); - + /* Select native samplerate if no selection is yet made */ - + if (sample_rate_view.get_selection()->count_selected_rows() == 0) { Gtk::ListStore::Children::iterator it; for (it = sample_rate_list->children().begin(); it != sample_rate_list->children().end(); ++it) { @@ -222,39 +222,39 @@ void ExportFormatDialog::load_state (FormatPtr spec) { name_entry.set_text (spec->name()); - + normalize_checkbox.set_active (spec->normalize()); normalize_spinbutton.set_value (spec->normalize_target()); - + trim_start_checkbox.set_active (spec->trim_beginning()); silence_start = spec->silence_beginning_time(); silence_start_checkbox.set_active (spec->silence_beginning() > 0); - + trim_end_checkbox.set_active (spec->trim_end()); silence_end = spec->silence_end_time(); silence_end_checkbox.set_active (spec->silence_end() > 0); - + for (Gtk::ListStore::Children::iterator it = src_quality_list->children().begin(); it != src_quality_list->children().end(); ++it) { if (it->get_value (src_quality_cols.id) == spec->src_quality()) { src_quality_combo.set_active (it); break; } } - + for (Gtk::ListStore::Children::iterator it = format_list->children().begin(); it != format_list->children().end(); ++it) { if (it->get_value (format_cols.ptr)->get_format_id() == spec->format_id()) { it->get_value (format_cols.ptr)->set_selected (true); break; } } - + for (Gtk::ListStore::Children::iterator it = sample_rate_list->children().begin(); it != sample_rate_list->children().end(); ++it) { if (it->get_value (sample_rate_cols.ptr)->rate == spec->sample_rate()) { it->get_value (sample_rate_cols.ptr)->set_selected (true); break; } } - + if (spec->sample_format()) { for (Gtk::ListStore::Children::iterator it = sample_format_list->children().begin(); it != sample_format_list->children().end(); ++it) { if (it->get_value (sample_format_cols.ptr)->format == spec->sample_format()) { @@ -262,7 +262,7 @@ ExportFormatDialog::load_state (FormatPtr spec) break; } } - + for (Gtk::ListStore::Children::iterator it = dither_type_list->children().begin(); it != dither_type_list->children().end(); ++it) { if (it->get_value (dither_type_cols.ptr)->type == spec->dither_type()) { it->get_value (dither_type_cols.ptr)->set_selected (true); @@ -270,7 +270,7 @@ ExportFormatDialog::load_state (FormatPtr spec) } } } - + tag_checkbox.set_active (spec->tag()); } @@ -279,20 +279,20 @@ ExportFormatDialog::init_format_table () { format_table.set_spacings (1); - + format_table.attach (compatibility_label, 0, 1, 0, 1); format_table.attach (quality_label, 1, 2, 0, 1); format_table.attach (format_label, 2, 3, 0, 1); format_table.attach (sample_rate_label, 3, 4, 0, 1); - + format_table.attach (compatibility_view, 0, 1, 1, 2); format_table.attach (quality_view, 1, 2, 1, 2); format_table.attach (format_view, 2, 3, 1, 2); format_table.attach (sample_rate_view, 3, 4, 1, 2); - + format_table.attach (src_quality_label, 0, 3, 2, 3); format_table.attach (src_quality_combo, 3, 4, 2, 3); - + compatibility_view.set_headers_visible (false); quality_view.set_headers_visible (false); format_view.set_headers_visible (false); @@ -307,108 +307,108 @@ ExportFormatDialog::init_format_table () compatibility_list = Gtk::ListStore::create (compatibility_cols); compatibility_view.set_model (compatibility_list); - + ExportFormatManager::CompatList const & compat_list = manager.get_compatibilities(); - + for (ExportFormatManager::CompatList::const_iterator it = compat_list.begin(); it != compat_list.end(); ++it) { iter = compatibility_list->append(); row = *iter; - + row[compatibility_cols.ptr] = *it; row[compatibility_cols.selected] = false; row[compatibility_cols.label] = (*it)->name(); - + WeakCompatPtr ptr (*it); (*it)->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatDialog::change_compatibility_selection), ptr)); } - + compatibility_view.append_column_editable ("", compatibility_cols.selected); - + Gtk::CellRendererText* text_renderer = Gtk::manage (new Gtk::CellRendererText); text_renderer->property_editable() = false; - + Gtk::TreeView::Column* column = compatibility_view.get_column (0); column->pack_start (*text_renderer); column->add_attribute (text_renderer->property_text(), compatibility_cols.label); - + /* Qualities */ quality_list = Gtk::ListStore::create (quality_cols); quality_view.set_model (quality_list); - + ExportFormatManager::QualityList const & qualities = manager.get_qualities (); - + for (ExportFormatManager::QualityList::const_iterator it = qualities.begin(); it != qualities.end(); ++it) { iter = quality_list->append(); row = *iter; - + row[quality_cols.ptr] = *it; row[quality_cols.color] = "white"; row[quality_cols.label] = (*it)->name(); - + WeakQualityPtr ptr (*it); (*it)->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatDialog::change_quality_selection), ptr)); (*it)->CompatibleChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatDialog::change_quality_compatibility), ptr)); } - + quality_view.append_column ("", quality_cols.label); - + /* Formats */ - + format_list = Gtk::ListStore::create (format_cols); format_view.set_model (format_list); - + ExportFormatManager::FormatList const & formats = manager.get_formats (); - + for (ExportFormatManager::FormatList::const_iterator it = formats.begin(); it != formats.end(); ++it) { iter = format_list->append(); row = *iter; - + row[format_cols.ptr] = *it; row[format_cols.color] = "white"; row[format_cols.label] = (*it)->name(); - + WeakFormatPtr ptr (*it); (*it)->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatDialog::change_format_selection), ptr)); (*it)->CompatibleChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatDialog::change_format_compatibility), ptr)); - + /* Encoding options */ - + boost::shared_ptr<HasSampleFormat> hsf; - + if (hsf = boost::dynamic_pointer_cast<HasSampleFormat> (*it)) { hsf->SampleFormatSelectChanged.connect (sigc::mem_fun (*this, &ExportFormatDialog::change_sample_format_selection)); hsf->SampleFormatCompatibleChanged.connect (sigc::mem_fun (*this, &ExportFormatDialog::change_sample_format_compatibility)); - + hsf->DitherTypeSelectChanged.connect (sigc::mem_fun (*this, &ExportFormatDialog::change_dither_type_selection)); hsf->DitherTypeCompatibleChanged.connect (sigc::mem_fun (*this, &ExportFormatDialog::change_dither_type_compatibility)); } } - + format_view.append_column ("", format_cols.label); - + /* Sample Rates */ - + sample_rate_list = Gtk::ListStore::create (sample_rate_cols); sample_rate_view.set_model (sample_rate_list); - + ExportFormatManager::SampleRateList const & rates = manager.get_sample_rates (); - + for (ExportFormatManager::SampleRateList::const_iterator it = rates.begin(); it != rates.end(); ++it) { iter = sample_rate_list->append(); row = *iter; - + row[sample_rate_cols.ptr] = *it; row[sample_rate_cols.color] = "white"; row[sample_rate_cols.label] = (*it)->name(); - + WeakSampleRatePtr ptr (*it); (*it)->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatDialog::change_sample_rate_selection), ptr)); (*it)->CompatibleChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatDialog::change_sample_rate_compatibility), ptr)); } sample_rate_view.append_column ("", sample_rate_cols.label); - + /* Color rendering */ Gtk::TreeViewColumn * label_col; @@ -417,45 +417,45 @@ ExportFormatDialog::init_format_table () label_col = quality_view.get_column(0); renderer = dynamic_cast<Gtk::CellRendererText*> (quality_view.get_column_cell_renderer (0)); label_col->add_attribute(renderer->property_foreground(), quality_cols.color); - + label_col = format_view.get_column(0); renderer = dynamic_cast<Gtk::CellRendererText*> (format_view.get_column_cell_renderer (0)); label_col->add_attribute(renderer->property_foreground(), format_cols.color); - + label_col = sample_rate_view.get_column(0); renderer = dynamic_cast<Gtk::CellRendererText*> (sample_rate_view.get_column_cell_renderer (0)); label_col->add_attribute(renderer->property_foreground(), sample_rate_cols.color); - + /* SRC Qualities */ - + src_quality_list = Gtk::ListStore::create (src_quality_cols); src_quality_combo.set_model (src_quality_list); - + iter = src_quality_list->append(); row = *iter; row[src_quality_cols.id] = ExportFormatBase::SRC_SincBest; row[src_quality_cols.label] = _("Best (sinc)"); - + iter = src_quality_list->append(); row = *iter; row[src_quality_cols.id] = ExportFormatBase::SRC_SincMedium; row[src_quality_cols.label] = _("Medium (sinc)"); - + iter = src_quality_list->append(); row = *iter; row[src_quality_cols.id] = ExportFormatBase::SRC_SincFast; row[src_quality_cols.label] = _("Fast (sinc)"); - + iter = src_quality_list->append(); row = *iter; row[src_quality_cols.id] = ExportFormatBase::SRC_Linear; row[src_quality_cols.label] = _("Linear"); - + iter = src_quality_list->append(); row = *iter; row[src_quality_cols.id] = ExportFormatBase::SRC_ZeroOrderHold; row[src_quality_cols.label] = _("Zero order hold"); - + src_quality_combo.pack_start (src_quality_cols.label); src_quality_combo.set_active (0); } @@ -473,7 +473,7 @@ ExportFormatDialog::init_encoding_option_widgets () label_col = sample_format_view.get_column(0); renderer = dynamic_cast<Gtk::CellRendererText*> (sample_format_view.get_column_cell_renderer (0)); label_col->add_attribute(renderer->property_foreground(), sample_format_cols.color); - + dither_type_list = Gtk::ListStore::create (dither_type_cols); dither_type_view.set_model (dither_type_list); dither_type_view.set_headers_visible (false); @@ -481,20 +481,20 @@ ExportFormatDialog::init_encoding_option_widgets () label_col = dither_type_view.get_column(0); renderer = dynamic_cast<Gtk::CellRendererText*> (dither_type_view.get_column_cell_renderer (0)); label_col->add_attribute(renderer->property_foreground(), dither_type_cols.color); - + } void ExportFormatDialog::update_compatibility_selection (Glib::ustring const & path) { - + Gtk::TreeModel::iterator iter = compatibility_view.get_model ()->get_iter (path); ExportFormatManager::CompatPtr ptr = iter->get_value (compatibility_cols.ptr); bool state = iter->get_value (compatibility_cols.selected); - + iter->set_value (compatibility_cols.selected, state); ptr->set_selected (state); - + } void @@ -537,7 +537,7 @@ ExportFormatDialog::update_selection (Glib::RefPtr<Gtk::ListStore> & list, Gtk:: Gtk::ListStore::Children::iterator it; Glib::RefPtr<Gtk::TreeSelection> selection = view.get_selection(); - + for (it = list->children().begin(); it != list->children().end(); ++it) { bool selected = selection->is_selected (it); it->get_value (cols.ptr)->set_selected (selected); @@ -548,16 +548,16 @@ void ExportFormatDialog::change_compatibility_selection (bool select, WeakCompatPtr compat) { ++applying_changes_from_engine; - + ExportFormatManager::CompatPtr ptr = compat.lock(); - + for (Gtk::ListStore::Children::iterator it = compatibility_list->children().begin(); it != compatibility_list->children().end(); ++it) { if (it->get_value (compatibility_cols.ptr) == ptr) { it->set_value (compatibility_cols.selected, select); break; } } - + --applying_changes_from_engine; } @@ -583,7 +583,7 @@ void ExportFormatDialog::change_sample_rate_selection (bool select, WeakSampleRatePtr rate) { change_selection<ExportFormatManager::SampleRateState, SampleRateCols> (select, rate, sample_rate_list, sample_rate_view, sample_rate_cols); - + if (select) { ExportFormatManager::SampleRatePtr ptr = rate.lock(); if (ptr && session) { @@ -609,14 +609,14 @@ void ExportFormatDialog::change_selection (bool select, boost::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, Gtk::TreeView & view, ColsT & cols) { ++applying_changes_from_engine; - + boost::shared_ptr<T> ptr = w_ptr.lock(); - + Gtk::ListStore::Children::iterator it; Glib::RefPtr<Gtk::TreeSelection> selection; - + selection = view.get_selection(); - + if (!ptr) { selection->unselect_all(); } else { @@ -631,7 +631,7 @@ ExportFormatDialog::change_selection (bool select, boost::weak_ptr<T> w_ptr, Gli } } } - + --applying_changes_from_engine; } @@ -671,7 +671,7 @@ ExportFormatDialog::change_compatibility (bool compatibility, boost::weak_ptr<T> Glib::ustring const & c_incompatible, Glib::ustring const & c_compatible) { boost::shared_ptr<T> ptr = w_ptr.lock(); - + Gtk::ListStore::Children::iterator it; for (it = list->children().begin(); it != list->children().end(); ++it) { if (it->get_value (cols.ptr) == ptr) { @@ -729,9 +729,9 @@ ExportFormatDialog::update_clock (AudioClock & clock, ARDOUR::AnyTime const & ti { // TODO position clock.set (session->convert_to_frames_at (0, time), true); - + AudioClock::Mode mode(AudioClock::SMPTE); - + switch (time.type) { case AnyTime::SMPTE: mode = AudioClock::SMPTE; @@ -746,7 +746,7 @@ ExportFormatDialog::update_clock (AudioClock & clock, ARDOUR::AnyTime const & ti mode = AudioClock::MinSec; break; } - + clock.set_mode (mode); } @@ -756,9 +756,9 @@ ExportFormatDialog::update_time (AnyTime & time, AudioClock const & clock) if (!session) { return; } - + nframes_t frames = clock.current_duration(); - + switch (clock.mode()) { case AudioClock::SMPTE: time.type = AnyTime::SMPTE; @@ -778,7 +778,7 @@ ExportFormatDialog::update_time (AnyTime & time, AudioClock const & clock) break; case AudioClock::Off: silence_end_checkbox.set_active (false); - return; + return; } } @@ -837,15 +837,15 @@ ExportFormatDialog::show_linear_enconding_options (boost::shared_ptr<ARDOUR::Exp /* Set label and pack table */ encoding_options_label.set_label (_("Linear encoding options")); - + encoding_options_table.resize (2, 2); encoding_options_table.attach (sample_format_label, 0, 1, 0, 1); encoding_options_table.attach (dither_label, 1, 2, 0, 1); encoding_options_table.attach (sample_format_view, 0, 1, 1, 2); encoding_options_table.attach (dither_type_view, 1, 2, 1, 2); - + fill_sample_format_lists (boost::dynamic_pointer_cast<HasSampleFormat> (ptr)); - + show_all_children (); } @@ -853,12 +853,12 @@ void ExportFormatDialog::show_ogg_enconding_options (boost::shared_ptr<ARDOUR::ExportFormatOggVorbis> /*ptr*/) { encoding_options_label.set_label (_("Ogg Vorbis options")); - + encoding_options_table.resize (1, 1); encoding_options_table.attach (tag_checkbox, 0, 1, 0, 1); - + update_tagging_selection (); - + show_all_children (); } @@ -866,16 +866,16 @@ void ExportFormatDialog::show_flac_enconding_options (boost::shared_ptr<ARDOUR::ExportFormatFLAC> ptr) { encoding_options_label.set_label (_("FLAC options")); - + encoding_options_table.resize (3, 2); encoding_options_table.attach (sample_format_label, 0, 1, 0, 1); encoding_options_table.attach (dither_label, 1, 2, 0, 1); encoding_options_table.attach (sample_format_view, 0, 1, 1, 2); encoding_options_table.attach (dither_type_view, 1, 2, 1, 2); encoding_options_table.attach (tag_checkbox, 0, 2, 2, 3); - + fill_sample_format_lists (boost::dynamic_pointer_cast<HasSampleFormat> (ptr)); - + show_all_children (); } @@ -883,15 +883,15 @@ void ExportFormatDialog::show_bwf_enconding_options (boost::shared_ptr<ARDOUR::ExportFormatBWF> ptr) { encoding_options_label.set_label (_("Broadcast Wave options")); - + encoding_options_table.resize (2, 2); encoding_options_table.attach (sample_format_label, 0, 1, 0, 1); encoding_options_table.attach (dither_label, 1, 2, 0, 1); encoding_options_table.attach (sample_format_view, 0, 1, 1, 2); encoding_options_table.attach (dither_type_view, 1, 2, 1, 2); - + fill_sample_format_lists (boost::dynamic_pointer_cast<HasSampleFormat> (ptr)); - + show_all_children (); } @@ -899,39 +899,39 @@ void ExportFormatDialog::fill_sample_format_lists (boost::shared_ptr<ARDOUR::HasSampleFormat> ptr) { /* Fill lists */ - + Gtk::TreeModel::iterator iter; Gtk::TreeModel::Row row; - + sample_format_list->clear (); - + HasSampleFormat::SampleFormatList const & formats = ptr->get_sample_formats (); - + for (HasSampleFormat::SampleFormatList::const_iterator it = formats.begin(); it != formats.end(); ++it) { iter = sample_format_list->append(); row = *iter; - + row[sample_format_cols.ptr] = *it; row[sample_format_cols.color] = (*it)->compatible() ? "white" : "red"; row[sample_format_cols.label] = (*it)->name(); - + if ((*it)->selected()) { sample_format_view.get_selection()->select (iter); } } - + dither_type_list->clear (); - + HasSampleFormat::DitherTypeList const & types = ptr->get_dither_types (); - + for (HasSampleFormat::DitherTypeList::const_iterator it = types.begin(); it != types.end(); ++it) { iter = dither_type_list->append(); row = *iter; - + row[dither_type_cols.ptr] = *it; row[dither_type_cols.color] = "white"; row[dither_type_cols.label] = (*it)->name(); - + if ((*it)->selected()) { dither_type_view.get_selection()->select (iter); } diff --git a/gtk2_ardour/export_format_dialog.h b/gtk2_ardour/export_format_dialog.h index acb561b06b..418b015d8c 100644 --- a/gtk2_ardour/export_format_dialog.h +++ b/gtk2_ardour/export_format_dialog.h @@ -57,9 +57,9 @@ class ExportFormatDialog : public ArdourDialog { FormatPtr format; ARDOUR::ExportFormatManager manager; - + XMLNode & original_state; - + ARDOUR::AnyTime silence_start; ARDOUR::AnyTime silence_end; @@ -67,7 +67,7 @@ class ExportFormatDialog : public ArdourDialog { void revert (); /*** Init functions ***/ - + void load_state (FormatPtr spec); void init_format_table (); void init_encoding_option_widgets (); @@ -75,71 +75,71 @@ class ExportFormatDialog : public ArdourDialog { /*** Interactive selections ***/ /* These are connected to signals from GUI components, and should change element states */ - + void update_compatibility_selection (Glib::ustring const & path); void update_quality_selection (); void update_format_selection (); void update_sample_rate_selection (); void update_sample_format_selection (); void update_dither_type_selection (); - + template<typename ColsT> void update_selection (Glib::RefPtr<Gtk::ListStore> & list, Gtk::TreeView & view, ColsT & cols); - + /* These are connected to signals from elements, and should only update the gui */ - + void change_compatibility_selection (bool select, WeakCompatPtr compat); - + void change_quality_selection (bool select, WeakQualityPtr quality); void change_format_selection (bool select, WeakFormatPtr format); void change_sample_rate_selection (bool select, WeakSampleRatePtr rate); void change_sample_format_selection (bool select, WeakSampleFormatPtr format); void change_dither_type_selection (bool select, WeakDitherTypePtr type); - + template<typename T, typename ColsT> void change_selection (bool select, boost::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, Gtk::TreeView & view, ColsT & cols); - + void change_quality_compatibility (bool compatibility, WeakQualityPtr quality); void change_format_compatibility (bool compatibility, WeakFormatPtr format); void change_sample_rate_compatibility (bool compatibility, WeakSampleRatePtr rate); void change_sample_format_compatibility (bool compatibility, WeakSampleFormatPtr format); void change_dither_type_compatibility (bool compatibility, WeakDitherTypePtr type); - + template<typename T, typename ColsT> void change_compatibility (bool compatibility, boost::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, ColsT & cols, Glib::ustring const & c_incompatible = "red", Glib::ustring const & c_compatible = "white"); - + uint32_t applying_changes_from_engine; - + /*** Non-interactive selections ***/ - + void update_name (); - + void update_trim_start_selection (); void update_trim_end_selection (); - + void update_normalize_selection (); void update_silence_start_selection (); void update_silence_end_selection (); - + void update_clock (AudioClock & clock, ARDOUR::AnyTime const & time); void update_time (ARDOUR::AnyTime & time, AudioClock const & clock); - + void update_src_quality_selection (); void update_tagging_selection (); - + /*** Encoding options */ - + void change_encoding_options (ARDOUR::ExportFormatManager::FormatPtr ptr); - + void empty_encoding_option_table (); void remove_widget (Gtk::Widget & to_remove, Gtk::Container * remove_from); - + void show_linear_enconding_options (boost::shared_ptr<ARDOUR::ExportFormatLinear> ptr); void show_ogg_enconding_options (boost::shared_ptr<ARDOUR::ExportFormatOggVorbis> ptr); void show_flac_enconding_options (boost::shared_ptr<ARDOUR::ExportFormatFLAC> ptr); void show_bwf_enconding_options (boost::shared_ptr<ARDOUR::ExportFormatBWF> ptr); - + void fill_sample_format_lists (boost::shared_ptr<ARDOUR::HasSampleFormat> ptr); /*** GUI components ***/ @@ -150,159 +150,159 @@ class ExportFormatDialog : public ArdourDialog { Gtk::Label name_label; Gtk::Entry name_entry; - + /* Normalize */ - + Gtk::HBox normalize_hbox; Gtk::CheckButton normalize_checkbox; Gtk::SpinButton normalize_spinbutton; Gtk::Adjustment normalize_adjustment; Gtk::Label normalize_db_label; - + /* Silence */ - + Gtk::Table silence_table; - + Gtk::CheckButton trim_start_checkbox; Gtk::CheckButton silence_start_checkbox; AudioClock silence_start_clock; - + Gtk::CheckButton trim_end_checkbox; Gtk::CheckButton silence_end_checkbox; AudioClock silence_end_clock; - + /* Format table */ - + struct CompatibilityCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn<ARDOUR::ExportFormatManager::CompatPtr> ptr; Gtk::TreeModelColumn<bool> selected; Gtk::TreeModelColumn<Glib::ustring> label; - + CompatibilityCols () { add(ptr); add(selected); add(label); } }; CompatibilityCols compatibility_cols; Glib::RefPtr<Gtk::ListStore> compatibility_list; - + /* Hack to disallow row selection in compatibilities */ void prohibit_compatibility_selection (); sigc::connection compatibility_select_connection; - + struct QualityCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn<ARDOUR::ExportFormatManager::QualityPtr> ptr; Gtk::TreeModelColumn<Glib::ustring> color; Gtk::TreeModelColumn<Glib::ustring> label; - + QualityCols () { add(ptr); add(color); add(label); } }; QualityCols quality_cols; Glib::RefPtr<Gtk::ListStore> quality_list; - + struct FormatCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn<ARDOUR::ExportFormatManager::FormatPtr> ptr; Gtk::TreeModelColumn<Glib::ustring> color; Gtk::TreeModelColumn<Glib::ustring> label; - + FormatCols () { add(ptr); add(color); add(label); } - }; + }; FormatCols format_cols; Glib::RefPtr<Gtk::ListStore> format_list; - + struct SampleRateCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn<ARDOUR::ExportFormatManager::SampleRatePtr> ptr; Gtk::TreeModelColumn<Glib::ustring> color; Gtk::TreeModelColumn<Glib::ustring> label; - + SampleRateCols () { add(ptr); add(color); add(label); } }; SampleRateCols sample_rate_cols; Glib::RefPtr<Gtk::ListStore> sample_rate_list; - + Gtk::Table format_table; - + Gtk::Label compatibility_label; Gtk::Label quality_label; Gtk::Label format_label; Gtk::Label sample_rate_label; - + Gtk::TreeView compatibility_view; Gtk::TreeView quality_view; Gtk::TreeView format_view; Gtk::TreeView sample_rate_view; - + /* SRC quality combo */ - + struct SRCQualityCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn<ARDOUR::ExportFormatBase::SRCQuality> id; Gtk::TreeModelColumn<Glib::ustring> label; - + SRCQualityCols () { add(id); add(label); } }; SRCQualityCols src_quality_cols; Glib::RefPtr<Gtk::ListStore> src_quality_list; - + Gtk::Label src_quality_label; Gtk::ComboBox src_quality_combo; /* Common encoding option components */ - + Gtk::VBox encoding_options_vbox; Gtk::Label encoding_options_label; - + Gtk::Table encoding_options_table; /* Other common components */ - + Gtk::Button * revert_button; Gtk::Button * close_button; - + /*** Changing encoding option stuff ***/ - + /* Linear */ - + struct SampleFormatCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn<ARDOUR::HasSampleFormat::SampleFormatPtr> ptr; Gtk::TreeModelColumn<Glib::ustring> color; Gtk::TreeModelColumn<Glib::ustring> label; - + SampleFormatCols () { add(ptr); add(color); add(label); } }; SampleFormatCols sample_format_cols; Glib::RefPtr<Gtk::ListStore> sample_format_list; - + struct DitherTypeCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn<ARDOUR::HasSampleFormat::DitherTypePtr> ptr; Gtk::TreeModelColumn<Glib::ustring> color; Gtk::TreeModelColumn<Glib::ustring> label; - + DitherTypeCols () { add(ptr); add (color); add(label); } }; DitherTypeCols dither_type_cols; Glib::RefPtr<Gtk::ListStore> dither_type_list; - + Gtk::Label sample_format_label; Gtk::Label dither_label; - + Gtk::TreeView sample_format_view; Gtk::TreeView dither_type_view; - + /* Tagging */ - + Gtk::CheckButton tag_checkbox; - + }; #endif /* __export_format_dialog_h__ */ diff --git a/gtk2_ardour/export_format_selector.cc b/gtk2_ardour/export_format_selector.cc index 122facdd39..002edaf50c 100644 --- a/gtk2_ardour/export_format_selector.cc +++ b/gtk2_ardour/export_format_selector.cc @@ -46,14 +46,14 @@ ExportFormatSelector::ExportFormatSelector () : edit_button.signal_clicked().connect (sigc::hide_return (sigc::bind (sigc::mem_fun (*this, &ExportFormatSelector::open_edit_dialog), false))); remove_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportFormatSelector::remove_format)); new_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportFormatSelector::add_new_format)); - + /* Format combo */ - + format_list = Gtk::ListStore::create (format_cols); format_combo.set_model (format_list); format_combo.pack_start (format_cols.label); format_combo.set_active (0); - + format_combo.signal_changed().connect (sigc::mem_fun (*this, &ExportFormatSelector::update_format_combo)); } @@ -67,7 +67,7 @@ ExportFormatSelector::set_state (ARDOUR::ExportProfileManager::FormatStatePtr co { session = session_; state = state_; - + update_format_list (); } @@ -97,7 +97,7 @@ ExportFormatSelector::update_format_list () if (format_combo.get_active_row_number() == -1) { format_combo.set_active (0); } - + select_format (format_to_select); } @@ -111,7 +111,7 @@ ExportFormatSelector::select_format (FormatPtr f) break; } } - + CriticalSelectionChanged(); } @@ -119,7 +119,7 @@ void ExportFormatSelector::add_new_format () { FormatPtr new_format = state->format = NewFormat (state->format); - + if (open_edit_dialog (true) != Gtk::RESPONSE_APPLY) { remove_format(); if (state->list->empty()) { @@ -163,7 +163,7 @@ ExportFormatSelector::update_format_combo () edit_button.set_sensitive (false); remove_button.set_sensitive (false); } - + CriticalSelectionChanged(); } diff --git a/gtk2_ardour/export_format_selector.h b/gtk2_ardour/export_format_selector.h index 78daf5b5c6..46d9bc3f06 100644 --- a/gtk2_ardour/export_format_selector.h +++ b/gtk2_ardour/export_format_selector.h @@ -33,7 +33,7 @@ namespace ARDOUR { class ExportProfileManager; } -/// +/// class ExportFormatSelector : public Gtk::HBox { private: @@ -45,16 +45,16 @@ class ExportFormatSelector : public Gtk::HBox { ExportFormatSelector (); ~ExportFormatSelector (); - + void set_state (ARDOUR::ExportProfileManager::FormatStatePtr state_, ARDOUR::Session * session_); void update_format_list (); - + sigc::signal<void, FormatPtr> FormatEdited; sigc::signal<void, FormatPtr> FormatRemoved; sigc::signal<FormatPtr, FormatPtr> NewFormat; - + /* Compatibility with other elements */ - + sigc::signal<void> CriticalSelectionChanged; private: @@ -76,7 +76,7 @@ class ExportFormatSelector : public Gtk::HBox { public: Gtk::TreeModelColumn<FormatPtr> format; Gtk::TreeModelColumn<Glib::ustring> label; - + FormatCols () { add (format); add (label); } }; FormatCols format_cols; diff --git a/gtk2_ardour/export_multiplicator.cc b/gtk2_ardour/export_multiplicator.cc index 757039dc9d..f6f31bfc0a 100644 --- a/gtk2_ardour/export_multiplicator.cc +++ b/gtk2_ardour/export_multiplicator.cc @@ -51,7 +51,7 @@ ExportMultiplicator::set_manager (boost::shared_ptr<ARDOUR::ExportProfileManager { manager = _manager; manager->GraphChanged.connect (sigc::mem_fun (*this, &ExportMultiplicator::redraw)); - + redraw(); } @@ -61,59 +61,59 @@ ExportMultiplicator::redraw () if (!manager) { return; } graph = &manager->get_graph(); - + /* Empty table */ - + table.foreach (sigc::mem_fun (table, &Gtk::Table::remove)); widget_map.clear(); /* Calculate table dimensions */ - + uint32_t max_width = 0; GraphLevel max_level = NoLevel; - + if (graph->timespans.size() > max_width) { max_width = graph->timespans.size(); max_level = Timespans; } - + if (graph->channel_configs.size() > max_width) { max_width = graph->channel_configs.size(); max_level = ChannelConfigs; } - + if (graph->formats.size() > max_width) { max_width = graph->formats.size(); max_level = Formats; } - + if (graph->filenames.size() > max_width) { max_width = graph->filenames.size(); max_level = Filenames; } - + table.resize (4, max_width); - + std::cout << "Table width: " << max_width << std::endl; - + /* Fill table */ - + for (list<ExportProfileManager::TimespanNodePtr>::const_iterator it = graph->timespans.begin(); it != graph->timespans.end(); ++it) { draw_timespan (*it, get_bounds (it->get(), Timespans, max_level)); } - + for (list<ExportProfileManager::ChannelConfigNodePtr>::const_iterator it = graph->channel_configs.begin(); it != graph->channel_configs.end(); ++it) { draw_channel_config (*it, get_bounds (it->get(), ChannelConfigs, max_level)); } - + for (list<ExportProfileManager::FormatNodePtr>::const_iterator it = graph->formats.begin(); it != graph->formats.end(); ++it) { draw_format (*it, get_bounds (it->get(), Formats, max_level)); } - + for (list<ExportProfileManager::FilenameNodePtr>::const_iterator it = graph->filenames.begin(); it != graph->filenames.end(); ++it) { draw_filename (*it, get_bounds (it->get(), Filenames, max_level)); } - + show_all_children (); } @@ -124,9 +124,9 @@ ExportMultiplicator::get_bounds (ARDOUR::ExportProfileManager::GraphNode * node, uint32_t left_bound = 0; uint32_t right_bound = 0; - + bool left_bound_found = false; - + bool (ExportProfileManager::GraphNode::*relation_func) (ExportProfileManager::GraphNode const *) const; if (max_level < current_level) { std::cout << "using 'is_ancestor_of'" << std::endl; @@ -138,7 +138,7 @@ ExportMultiplicator::get_bounds (ARDOUR::ExportProfileManager::GraphNode * node, std::cout << "using 'equals'" << std::endl; relation_func = &ExportProfileManager::GraphNode::equals; } - + switch (max_level) { case Timespans: for (list<ExportProfileManager::TimespanNodePtr>::const_iterator it = graph->timespans.begin(); it != graph->timespans.end(); ++it) { @@ -147,7 +147,7 @@ ExportMultiplicator::get_bounds (ARDOUR::ExportProfileManager::GraphNode * node, } else if (!left_bound_found) { ++left_bound; } - + if (left_bound_found && !CALL_MEMBER_FN(**it, relation_func) (node)) { break; } else { @@ -155,7 +155,7 @@ ExportMultiplicator::get_bounds (ARDOUR::ExportProfileManager::GraphNode * node, } } break; - + case ChannelConfigs: for (list<ExportProfileManager::ChannelConfigNodePtr>::const_iterator it = graph->channel_configs.begin(); it != graph->channel_configs.end(); ++it) { if (CALL_MEMBER_FN(**it, relation_func) (node)) { @@ -163,7 +163,7 @@ ExportMultiplicator::get_bounds (ARDOUR::ExportProfileManager::GraphNode * node, } else if (!left_bound_found) { ++left_bound; } - + if (left_bound_found && !CALL_MEMBER_FN(**it, relation_func) (node)) { break; } else { @@ -171,7 +171,7 @@ ExportMultiplicator::get_bounds (ARDOUR::ExportProfileManager::GraphNode * node, } } break; - + case Formats: for (list<ExportProfileManager::FormatNodePtr>::const_iterator it = graph->formats.begin(); it != graph->formats.end(); ++it) { if (CALL_MEMBER_FN(**it, relation_func) (node)) { @@ -179,7 +179,7 @@ ExportMultiplicator::get_bounds (ARDOUR::ExportProfileManager::GraphNode * node, } else if (!left_bound_found) { ++left_bound; } - + if (left_bound_found && !CALL_MEMBER_FN(**it, relation_func) (node)) { break; } else { @@ -187,7 +187,7 @@ ExportMultiplicator::get_bounds (ARDOUR::ExportProfileManager::GraphNode * node, } } break; - + case Filenames: for (list<ExportProfileManager::FilenameNodePtr>::const_iterator it = graph->filenames.begin(); it != graph->filenames.end(); ++it) { if (CALL_MEMBER_FN(**it, relation_func) (node)) { @@ -197,7 +197,7 @@ ExportMultiplicator::get_bounds (ARDOUR::ExportProfileManager::GraphNode * node, std::cout << "filename relation check returned false" << std::endl; ++left_bound; } - + if (left_bound_found && !CALL_MEMBER_FN(**it, relation_func) (node)) { break; } else { @@ -205,12 +205,12 @@ ExportMultiplicator::get_bounds (ARDOUR::ExportProfileManager::GraphNode * node, } } break; - + case NoLevel: // Not reached ! break; } - + return std::pair<uint32_t, uint32_t> (left_bound, right_bound); } @@ -247,10 +247,10 @@ ExportMultiplicator::get_hbox (TablePosition position) { WidgetMap::iterator it = widget_map.find (position); if (it != widget_map.end()) { return it->second; } - + boost::shared_ptr<Gtk::HBox> widget = widget_map.insert (WidgetPair (position, boost::shared_ptr<Gtk::HBox> (new Gtk::HBox ()))).first->second; table.attach (*widget, position.left, position.right, position.row - 1, position.row); - + return widget; } @@ -264,10 +264,10 @@ ExportMultiplicator::ButtonWidget::ButtonWidget (Glib::ustring name, boost::shar menu_actions = Gtk::ActionGroup::create(); menu_actions->add (Gtk::Action::create ("Split", _("_Split here")), sigc::mem_fun (*this, &ExportMultiplicator::ButtonWidget::split)); menu_actions->add (Gtk::Action::create ("Remove", _("_Remove")), sigc::mem_fun (*this, &ExportMultiplicator::ButtonWidget::remove)); - + ui_manager = Gtk::UIManager::create(); ui_manager->insert_action_group (menu_actions); - + Glib::ustring ui_info = "<ui>" " <popup name='PopupMenu'>" @@ -277,11 +277,11 @@ ExportMultiplicator::ButtonWidget::ButtonWidget (Glib::ustring name, boost::shar "</ui>"; ui_manager->add_ui_from_string (ui_info); - menu = dynamic_cast<Gtk::Menu*> (ui_manager->get_widget ("/PopupMenu")); + menu = dynamic_cast<Gtk::Menu*> (ui_manager->get_widget ("/PopupMenu")); add_events (Gdk::BUTTON_PRESS_MASK); signal_button_press_event ().connect (sigc::mem_fun (*this, &ExportMultiplicator::ButtonWidget::on_button_press_event)); - + modify_bg (Gtk::STATE_NORMAL, Gdk::Color ("#0000")); set_border_width (1); vbox.pack_start (label, true, true, 4); @@ -294,7 +294,7 @@ ExportMultiplicator::ButtonWidget::on_button_press_event (GdkEventButton* event) if(event->type != GDK_BUTTON_PRESS) { return false; } if (event->button == 1) { node->select (!node->selected ()); - + if (node->selected ()) { unset_bg (Gtk::STATE_NORMAL); modify_bg (Gtk::STATE_NORMAL, Gdk::Color ("#194756")); @@ -302,14 +302,14 @@ ExportMultiplicator::ButtonWidget::on_button_press_event (GdkEventButton* event) unset_bg (Gtk::STATE_NORMAL); modify_bg (Gtk::STATE_NORMAL, Gdk::Color ("#0000")); } - + return true; - + } else if (event->button == 3) { int x, y; get_pointer (x, y); split_position = (float) x / get_width(); - + menu->popup (event->button, event->time); return true; } diff --git a/gtk2_ardour/export_multiplicator.h b/gtk2_ardour/export_multiplicator.h index 679c6bc1d3..c58cce1011 100644 --- a/gtk2_ardour/export_multiplicator.h +++ b/gtk2_ardour/export_multiplicator.h @@ -42,7 +42,7 @@ class ExportMultiplicator : public Gtk::EventBox { ExportMultiplicator (); ~ExportMultiplicator (); - + void set_manager (boost::shared_ptr<ExportProfileManager> _manager); private: @@ -55,7 +55,7 @@ class ExportMultiplicator : public Gtk::EventBox { Gtk::Table table; void redraw (); - + enum GraphLevel { NoLevel = 0, Timespans = 1, @@ -63,9 +63,9 @@ class ExportMultiplicator : public Gtk::EventBox { Formats = 3, Filenames = 4 }; - + std::pair<uint32_t, uint32_t> get_bounds (ExportProfileManager::GraphNode * node, GraphLevel current_level, GraphLevel max_level) const; - + void draw_timespan (ExportProfileManager::TimespanNodePtr node, std::pair<uint32_t, uint32_t> bounds); void draw_channel_config (ExportProfileManager::ChannelConfigNodePtr node, std::pair<uint32_t, uint32_t> bounds); void draw_format (ExportProfileManager::FormatNodePtr node, std::pair<uint32_t, uint32_t> bounds); @@ -75,42 +75,42 @@ class ExportMultiplicator : public Gtk::EventBox { uint32_t left; uint32_t right; uint32_t row; - + TablePosition (uint32_t left, uint32_t right, uint32_t row) : left (left), right (right), row (row) {} - + bool operator== (TablePosition const & other) const { return (row == other.row && left == other.left && right == other.right); } bool operator< (TablePosition const & other) const { return (row < other.row || left < other.left || right < other.right); } }; - + typedef std::map<TablePosition, boost::shared_ptr<Gtk::HBox> > WidgetMap; typedef std::pair<TablePosition, boost::shared_ptr<Gtk::HBox> > WidgetPair; - + boost::shared_ptr<Gtk::HBox> get_hbox (TablePosition position); WidgetMap widget_map; - + /* Button Widget */ - + class ButtonWidget : public Gtk::EventBox { public: ButtonWidget (Glib::ustring name, boost::shared_ptr<ExportProfileManager> m, ExportProfileManager::GraphNode * node); - + private: - + Gtk::Label label; Gtk::VBox vbox; - + bool on_button_press_event (GdkEventButton* event); - + void split (); void remove (); - + boost::shared_ptr<ExportProfileManager> manager; ExportProfileManager::GraphNode * node; float split_position; - + /* Context menu */ - + Glib::RefPtr<Gtk::ActionGroup> menu_actions; Glib::RefPtr<Gtk::UIManager> ui_manager; Gtk::Menu * menu; diff --git a/gtk2_ardour/export_preset_selector.cc b/gtk2_ardour/export_preset_selector.cc index fbbc215fb0..dab10e335d 100644 --- a/gtk2_ardour/export_preset_selector.cc +++ b/gtk2_ardour/export_preset_selector.cc @@ -33,27 +33,27 @@ ExportPresetSelector::ExportPresetSelector () : list = Gtk::ListStore::create (cols); entry.set_model (list); entry.set_text_column (cols.label); - + pack_start (label, false, false, 0); pack_start (entry, true, true, 6); pack_start (save_button, false, false, 0); pack_start (remove_button, false, false, 6); pack_start (new_button, false, false, 0); - + entry.set_name ("PaddedButton"); save_button.set_name ("PaddedButton"); remove_button.set_name ("PaddedButton"); new_button.set_name ("PaddedButton"); - + save_button.set_sensitive (false); remove_button.set_sensitive (false); new_button.set_sensitive (false); - + select_connection = entry.signal_changed().connect (sigc::mem_fun (*this, &ExportPresetSelector::update_selection)); save_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportPresetSelector::save_current)); new_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportPresetSelector::save_current)); remove_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportPresetSelector::remove_current)); - + show_all_children (); } @@ -68,15 +68,15 @@ void ExportPresetSelector::sync_with_manager () { list->clear(); - + PresetList const & presets = profile_manager->get_presets(); Gtk::ListStore::iterator tree_it; - + for (PresetList::const_iterator it = presets.begin(); it != presets.end(); ++it) { tree_it = list->append(); tree_it->set_value (cols.preset, *it); tree_it->set_value (cols.label, Glib::ustring ((*it)->name())); - + if (*it == current) { select_connection.block (true); entry.set_active (tree_it); @@ -91,13 +91,13 @@ ExportPresetSelector::update_selection () Gtk::ListStore::iterator it = entry.get_active (); Glib::ustring text = entry.get_entry()->get_text(); bool preset_name_exists = false; - + for (PresetList::const_iterator it = profile_manager->get_presets().begin(); it != profile_manager->get_presets().end(); ++it) { if (!(*it)->name().compare (text)) { preset_name_exists = true; } } - + if (list->iter_is_valid (it)) { - + previous = current = it->get_value (cols.preset); if (!profile_manager->load_preset (current)) { Gtk::MessageDialog dialog (_("The selected preset did not load successfully!\nPerhaps it references a format that has been removed?"), @@ -106,14 +106,14 @@ ExportPresetSelector::update_selection () } sync_with_manager (); CriticalSelectionChanged(); - + /* Make an edit, so that signal changed will be emitted on re-selection */ - + select_connection.block (true); entry.get_entry()->set_text (""); entry.get_entry()->set_text (text); select_connection.block (false); - + } else { // Text has been edited, this should not make any changes in the profile manager if (previous && !text.compare (previous->name())) { current = previous; @@ -121,7 +121,7 @@ ExportPresetSelector::update_selection () current.reset (); } } - + save_button.set_sensitive (current); remove_button.set_sensitive (current); new_button.set_sensitive (!current && !text.empty() && !preset_name_exists); @@ -131,7 +131,7 @@ void ExportPresetSelector::save_current () { if (!profile_manager) { return; } - + previous = current = profile_manager->save_preset (entry.get_entry()->get_text()); sync_with_manager (); update_selection (); // Update preset widget states @@ -141,7 +141,7 @@ void ExportPresetSelector::remove_current () { if (!profile_manager) { return; } - + profile_manager->remove_preset(); entry.get_entry()->set_text (""); sync_with_manager (); diff --git a/gtk2_ardour/export_preset_selector.h b/gtk2_ardour/export_preset_selector.h index ea7e61b32e..fe78e4bd78 100644 --- a/gtk2_ardour/export_preset_selector.h +++ b/gtk2_ardour/export_preset_selector.h @@ -30,11 +30,11 @@ class ExportPresetSelector : public Gtk::HBox { public: - + ExportPresetSelector (); - + void set_manager (boost::shared_ptr<ARDOUR::ExportProfileManager> manager); - + sigc::signal<void> CriticalSelectionChanged; private: @@ -42,31 +42,31 @@ class ExportPresetSelector : public Gtk::HBox typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ManagerPtr; typedef ARDOUR::ExportProfileManager::PresetPtr PresetPtr; typedef ARDOUR::ExportProfileManager::PresetList PresetList; - + ManagerPtr profile_manager; sigc::connection select_connection; - + void sync_with_manager (); void update_selection (); void save_current (); void remove_current (); - + struct PresetCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn<PresetPtr> preset; Gtk::TreeModelColumn<Glib::ustring> label; - + PresetCols () { add (preset); add (label); } }; PresetCols cols; Glib::RefPtr<Gtk::ListStore> list; PresetPtr current; PresetPtr previous; - + Gtk::Label label; Gtk::ComboBoxEntry entry; - + Gtk::Button save_button; Gtk::Button remove_button; Gtk::Button new_button; diff --git a/gtk2_ardour/export_range_markers_dialog.cc b/gtk2_ardour/export_range_markers_dialog.cc index df612a340d..fa9b3abfe5 100644 --- a/gtk2_ardour/export_range_markers_dialog.cc +++ b/gtk2_ardour/export_range_markers_dialog.cc @@ -35,14 +35,14 @@ using namespace ARDOUR; using namespace PBD; using namespace std; -ExportRangeMarkersDialog::ExportRangeMarkersDialog (PublicEditor& editor) +ExportRangeMarkersDialog::ExportRangeMarkersDialog (PublicEditor& editor) : ExportDialog(editor) -{ +{ set_title (_("ardour: export ranges")); file_frame.set_label (_("Export to Directory")); do_not_allow_export_cd_markers(); - + total_duration = 0; current_range_marker_index = 0; } @@ -52,8 +52,8 @@ ExportRangeMarkersDialog::browse_action () const { return Gtk::FILE_CHOOSER_ACTION_CREATE_FOLDER; } - -void + +void ExportRangeMarkersDialog::export_data () { getSession().locations()->apply(*this, &ExportRangeMarkersDialog::process_range_markers_export); @@ -75,14 +75,14 @@ ExportRangeMarkersDialog::process_range_markers_export(Locations::LocationList& get_selected_file_name(), currentLocation->name(), sndfile_file_ending_from_string(get_selected_header_format())); - + initSpec(filepath); - + spec.start_frame = currentLocation->start(); spec.end_frame = currentLocation->end(); if (getSession().start_export(spec)){ - // if export fails + // if export fails return; } @@ -96,13 +96,13 @@ ExportRangeMarkersDialog::process_range_markers_export(Locations::LocationList& usleep(10000); } } - + current_range_marker_index++; - + getSession().stop_export (spec); } } - + spec.running = false; } @@ -117,17 +117,17 @@ ExportRangeMarkersDialog::get_target_filepath(string path, string filename, stri string target_filepath = target_path + filename + postfix; struct stat statbuf; - + for(int counter=1; (stat (target_filepath.c_str(), &statbuf) == 0); counter++){ - // while file exists + // while file exists ostringstream scounter; scounter.flush(); scounter << counter; - - target_filepath = + + target_filepath = target_path + filename + "_" + scounter.str() + postfix; } - + return target_filepath; } @@ -136,7 +136,7 @@ ExportRangeMarkersDialog::is_filepath_valid(string &filepath) { // sanity check file name first struct stat statbuf; - + if (filepath.empty()) { // warning dialog string txt = _("Please enter a valid target directory."); @@ -144,15 +144,15 @@ ExportRangeMarkersDialog::is_filepath_valid(string &filepath) msg.run(); return false; } - - if ( (stat (filepath.c_str(), &statbuf) != 0) || + + if ( (stat (filepath.c_str(), &statbuf) != 0) || (!S_ISDIR (statbuf.st_mode)) ) { string txt = _("Please select an existing target directory. Files are not allowed!"); MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true); msg.run(); return false; } - + // directory needs to exist and be writable string dirpath = Glib::path_get_dirname (filepath); if (::access (dirpath.c_str(), W_OK) != 0) { @@ -161,7 +161,7 @@ ExportRangeMarkersDialog::is_filepath_valid(string &filepath) msg.run(); return false; } - + return true; } @@ -170,24 +170,24 @@ ExportRangeMarkersDialog::init_progress_computing(Locations::LocationList& locat { // flush vector range_markers_durations_aggregated.resize(0); - + nframes_t duration_before_current_location = 0; Locations::LocationList::iterator locationIter; - + for (locationIter = locations.begin(); locationIter != locations.end(); ++locationIter) { Location *currentLocation = (*locationIter); - + if(currentLocation->is_range_marker()){ range_markers_durations_aggregated.push_back (duration_before_current_location); - + nframes_t duration = currentLocation->end() - currentLocation->start(); - + range_markers_durations.push_back (duration); - duration_before_current_location += duration; + duration_before_current_location += duration; } } - total_duration = duration_before_current_location; + total_duration = duration_before_current_location; } @@ -203,7 +203,7 @@ ExportRangeMarkersDialog::progress_timeout () (spec.progress * (double) range_markers_durations[current_range_marker_index])) / (double) total_duration; } - + set_progress_fraction( progress ); return TRUE; } diff --git a/gtk2_ardour/export_range_markers_dialog.h b/gtk2_ardour/export_range_markers_dialog.h index a3a20836b1..b0a29b5dc2 100644 --- a/gtk2_ardour/export_range_markers_dialog.h +++ b/gtk2_ardour/export_range_markers_dialog.h @@ -25,11 +25,11 @@ #include "export_dialog.h" -class ExportRangeMarkersDialog : public ExportDialog +class ExportRangeMarkersDialog : public ExportDialog { public: ExportRangeMarkersDialog (PublicEditor&); - + Gtk::FileChooserAction browse_action() const; protected: @@ -38,7 +38,7 @@ class ExportRangeMarkersDialog : public ExportDialog void export_data(); bool wants_dir() { return true; } - + private: // keeps the duration of all range_markers before the current vector<nframes_t> range_markers_durations_aggregated; @@ -47,15 +47,15 @@ class ExportRangeMarkersDialog : public ExportDialog nframes_t total_duration; // index of range marker, that get's exported right now unsigned int current_range_marker_index; - + // sets value of progress bar virtual gint progress_timeout (); - + // initializes range_markers_durations_aggregated, range_markers_durations // and total_duration void init_progress_computing(ARDOUR::Locations::LocationList& locations); - // searches for a filename like "<filename><nr>.<postfix>" in path, that + // searches for a filename like "<filename><nr>.<postfix>" in path, that // does not exist string get_target_filepath(string path, string filename, string postfix); diff --git a/gtk2_ardour/export_timespan_selector.cc b/gtk2_ardour/export_timespan_selector.cc index e716e47be1..b11169b214 100644 --- a/gtk2_ardour/export_timespan_selector.cc +++ b/gtk2_ardour/export_timespan_selector.cc @@ -48,45 +48,45 @@ ExportTimespanSelector::ExportTimespanSelector (ARDOUR::Session * session, Profi option_hbox.pack_start (time_format_label, false, false, 0); option_hbox.pack_start (time_format_combo, false, false, 6); - + range_scroller.add (range_view); - + pack_start (option_hbox, false, false, 0); pack_start (range_scroller, true, true, 6); - + /*** Combo boxes ***/ - + Gtk::TreeModel::iterator iter; Gtk::TreeModel::Row row; - + /* Time format combo */ - + time_format_list = Gtk::ListStore::create (time_format_cols); time_format_combo.set_model (time_format_list); time_format_combo.set_name ("PaddedButton"); - + iter = time_format_list->append(); row = *iter; row[time_format_cols.format] = ExportProfileManager::SMPTE; row[time_format_cols.label] = X_("Timecode"); - + iter = time_format_list->append(); row = *iter; row[time_format_cols.format] = ExportProfileManager::MinSec; row[time_format_cols.label] = _("Minutes:Seconds"); - + iter = time_format_list->append(); row = *iter; row[time_format_cols.format] = ExportProfileManager::BBT; row[time_format_cols.label] = _("Bars:Beats"); - + time_format_combo.pack_start (time_format_cols.label); time_format_combo.set_active (0); - + time_format_combo.signal_changed().connect (sigc::mem_fun (*this, &ExportTimespanSelector::change_time_format)); - + /* Range view */ - + range_list = Gtk::ListStore::create (range_cols); range_view.set_model (range_list); range_view.set_headers_visible (false); @@ -101,7 +101,7 @@ void ExportTimespanSelector::add_range_to_selection (ARDOUR::Location const * loc) { TimespanPtr span = session->get_export_handler()->add_timespan(); - + Glib::ustring id; if (loc == state->session_range.get()) { id = "session"; @@ -110,7 +110,7 @@ ExportTimespanSelector::add_range_to_selection (ARDOUR::Location const * loc) } else { id = loc->id().to_s(); } - + span->set_range (loc->start(), loc->end()); span->set_name (loc->name()); span->set_range_id (id); @@ -153,47 +153,47 @@ ExportTimespanSelector::construct_label (ARDOUR::Location const * location) cons Glib::ustring label; Glib::ustring start; Glib::ustring end; - + nframes_t start_frame = location->start(); nframes_t end_frame = location->end(); - + switch (state->time_format) { case AudioClock::BBT: start = bbt_str (start_frame); end = bbt_str (end_frame); break; - + case AudioClock::SMPTE: start = smpte_str (start_frame); end = smpte_str (end_frame); break; - + case AudioClock::MinSec: start = ms_str (start_frame); end = ms_str (end_frame); break; - + case AudioClock::Frames: start = to_string (start_frame, std::dec); end = to_string (end_frame, std::dec); break; - + case AudioClock::Off: break; } - + // label += _("from "); - + // label += "<span color=\"#7fff7f\">"; label += start; // label += "</span>"; - + label += _(" to "); - + // label += "<span color=\"#7fff7f\">"; label += end; // label += "</span>"; - + return label; } @@ -204,12 +204,12 @@ ExportTimespanSelector::bbt_str (nframes_t frames) const if (!session) { return "Error!"; } - + std::ostringstream oss; BBT_Time time; - + session->bbt_time (frames, time); - + oss << std::setfill('0') << std::right << std::setw(3) << time.bars << "|" << @@ -217,7 +217,7 @@ ExportTimespanSelector::bbt_str (nframes_t frames) const time.beats << "|" << std::setw(4) << time.ticks; - + return oss.str(); } @@ -227,12 +227,12 @@ ExportTimespanSelector::smpte_str (nframes_t frames) const if (!session) { return "Error!"; } - + std::ostringstream oss; SMPTE::Time time; - + session->smpte_time (frames, time); - + oss << std::setfill('0') << std::right << std::setw(2) << time.hours << ":" << @@ -242,7 +242,7 @@ ExportTimespanSelector::smpte_str (nframes_t frames) const time.seconds << ":" << std::setw(2) << time.frames; - + return oss.str(); } @@ -252,14 +252,14 @@ ExportTimespanSelector::ms_str (nframes_t frames) const if (!session) { return "Error!"; } - + std::ostringstream oss; nframes_t left; int hrs; int mins; int secs; int sec_promilles; - + left = frames; hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f)); left -= (nframes_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f); @@ -268,7 +268,7 @@ ExportTimespanSelector::ms_str (nframes_t frames) const secs = (int) floor (left / (float) session->frame_rate()); left -= (nframes_t) floor (secs * session->frame_rate()); sec_promilles = (int) (left * 1000 / (float) session->frame_rate() + 0.5); - + oss << std::setfill('0') << std::right << std::setw(2) << hrs << ":" << @@ -278,7 +278,7 @@ ExportTimespanSelector::ms_str (nframes_t frames) const secs << "." << std::setw(3) << sec_promilles; - + return oss.str(); } @@ -287,7 +287,7 @@ ExportTimespanSelector::update_range_name (Glib::ustring const & path, Glib::ust { Gtk::TreeStore::iterator it = range_list->get_iter (path); it->get_value (range_cols.location)->set_name (new_text); - + CriticalSelectionChanged(); } @@ -299,17 +299,17 @@ ExportTimespanSelectorSingle::ExportTimespanSelectorSingle (ARDOUR::Session * se { range_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_NEVER); range_view.append_column_editable ("", range_cols.name); - + // Adjust selector height int x_offset, y_offset, width, height; Gtk::CellRenderer * renderer = *range_view.get_column(0)->get_cell_renderers().begin(); renderer->get_size (range_view, x_offset, y_offset, width, height); range_scroller.set_size_request (-1, height); - + if (Gtk::CellRendererText * renderer = dynamic_cast<Gtk::CellRendererText *> (range_view.get_column_cell_renderer (0))) { renderer->signal_edited().connect (sigc::mem_fun (*this, &ExportTimespanSelectorSingle::update_range_name)); } - + Gtk::CellRendererText * label_render = Gtk::manage (new Gtk::CellRendererText()); Gtk::TreeView::Column * label_col = Gtk::manage (new Gtk::TreeView::Column ("", *label_render)); label_col->add_attribute (label_render->property_markup(), range_cols.label); @@ -321,7 +321,7 @@ void ExportTimespanSelectorSingle::fill_range_list () { if (!state) { return; } - + Glib::ustring id; if (!range_id.compare (X_("session"))) { id = state->session_range->id().to_s(); @@ -337,22 +337,22 @@ ExportTimespanSelectorSingle::fill_range_list () Gtk::TreeModel::iterator iter; Gtk::TreeModel::Row row; for (LocationList::const_iterator it = state->ranges->begin(); it != state->ranges->end(); ++it) { - + if (!(*it)->id().to_s().compare (id)) { iter = range_list->append(); row = *iter; - + row[range_cols.location] = *it; row[range_cols.selected] = true; row[range_cols.name] = (*it)->name(); row[range_cols.label] = construct_label (*it); - + add_range_to_selection (*it); - + break; } } - + set_time_format_from_state(); } @@ -364,14 +364,14 @@ ExportTimespanSelectorMultiple::ExportTimespanSelectorMultiple (ARDOUR::Session range_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); range_view.append_column_editable ("", range_cols.selected); range_view.append_column_editable ("", range_cols.name); - + if (Gtk::CellRendererToggle * renderer = dynamic_cast<Gtk::CellRendererToggle *> (range_view.get_column_cell_renderer (0))) { renderer->signal_toggled().connect (sigc::hide (sigc::mem_fun (*this, &ExportTimespanSelectorMultiple::update_selection))); } if (Gtk::CellRendererText * renderer = dynamic_cast<Gtk::CellRendererText *> (range_view.get_column_cell_renderer (1))) { renderer->signal_edited().connect (sigc::mem_fun (*this, &ExportTimespanSelectorMultiple::update_range_name)); } - + Gtk::CellRendererText * label_render = Gtk::manage (new Gtk::CellRendererText()); Gtk::TreeView::Column * label_col = Gtk::manage (new Gtk::TreeView::Column ("", *label_render)); label_col->add_attribute (label_render->property_markup(), range_cols.label); @@ -389,16 +389,16 @@ ExportTimespanSelectorMultiple::fill_range_list () Gtk::TreeModel::iterator iter; Gtk::TreeModel::Row row; for (LocationList::const_iterator it = state->ranges->begin(); it != state->ranges->end(); ++it) { - + iter = range_list->append(); row = *iter; - + row[range_cols.location] = *it; row[range_cols.selected] = false; row[range_cols.name] = (*it)->name(); row[range_cols.label] = construct_label (*it); } - + set_selection_from_state (); } @@ -406,12 +406,12 @@ void ExportTimespanSelectorMultiple::set_selection_from_state () { Gtk::TreeModel::Children::iterator tree_it; - + for (TimespanList::iterator it = state->timespans->begin(); it != state->timespans->end(); ++it) { ustring id = (*it)->range_id(); for (tree_it = range_list->children().begin(); tree_it != range_list->children().end(); ++tree_it) { Location * loc = tree_it->get_value (range_cols.location); - + if ((!id.compare ("session") && loc == state->session_range.get()) || (!id.compare ("selection") && loc == state->selection_range.get()) || (!id.compare (loc->id().to_s()))) { @@ -419,7 +419,7 @@ ExportTimespanSelectorMultiple::set_selection_from_state () } } } - + set_time_format_from_state(); } @@ -434,7 +434,7 @@ void ExportTimespanSelectorMultiple::update_timespans () { state->timespans->clear(); - + for (Gtk::TreeStore::Children::iterator it = range_list->children().begin(); it != range_list->children().end(); ++it) { if (it->get_value (range_cols.selected)) { add_range_to_selection (it->get_value (range_cols.location)); diff --git a/gtk2_ardour/export_timespan_selector.h b/gtk2_ardour/export_timespan_selector.h index e2291faf5a..72d5990422 100644 --- a/gtk2_ardour/export_timespan_selector.h +++ b/gtk2_ardour/export_timespan_selector.h @@ -56,11 +56,11 @@ class ExportTimespanSelector : public Gtk::VBox { public: ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager); - + virtual ~ExportTimespanSelector (); void sync_with_manager (); - + sigc::signal<void> CriticalSelectionChanged; protected: @@ -70,12 +70,12 @@ class ExportTimespanSelector : public Gtk::VBox { TimespanStatePtr state; virtual void fill_range_list () = 0; - + void add_range_to_selection (ARDOUR::Location const * loc); void set_time_format_from_state (); - + void change_time_format (); - + Glib::ustring construct_label (ARDOUR::Location const * location) const; Glib::ustring bbt_str (nframes_t frames) const; Glib::ustring smpte_str (nframes_t frames) const; @@ -84,28 +84,28 @@ class ExportTimespanSelector : public Gtk::VBox { void update_range_name (Glib::ustring const & path, Glib::ustring const & new_text); /*** GUI components ***/ - + Gtk::HBox option_hbox; Gtk::Label time_format_label; - + /* Time format */ - + typedef ARDOUR::ExportProfileManager::TimeFormat TimeFormat; - + struct TimeFormatCols : public Gtk::TreeModelColumnRecord { public: Gtk::TreeModelColumn<TimeFormat> format; Gtk::TreeModelColumn<Glib::ustring> label; - + TimeFormatCols () { add(format); add(label); } }; TimeFormatCols time_format_cols; Glib::RefPtr<Gtk::ListStore> time_format_list; Gtk::ComboBox time_format_combo; - + /* View */ - + struct RangeCols : public Gtk::TreeModelColumnRecord { public: @@ -113,14 +113,14 @@ class ExportTimespanSelector : public Gtk::VBox { Gtk::TreeModelColumn<Glib::ustring> label; Gtk::TreeModelColumn<bool> selected; Gtk::TreeModelColumn<Glib::ustring> name; - + RangeCols () { add (location); add(label); add(selected); add(name); } }; RangeCols range_cols; - + Glib::RefPtr<Gtk::ListStore> range_list; Gtk::TreeView range_view; - + Gtk::ScrolledWindow range_scroller; }; @@ -148,7 +148,7 @@ class ExportTimespanSelectorSingle : public ExportTimespanSelector private: virtual void fill_range_list (); - + Glib::ustring range_id; }; diff --git a/gtk2_ardour/fft.cc b/gtk2_ardour/fft.cc index f78a1e94ad..d4841dd573 100644 --- a/gtk2_ardour/fft.cc +++ b/gtk2_ardour/fft.cc @@ -46,7 +46,7 @@ FFT::reset() { memset(_power_at_bin, 0, sizeof(float) * _data_size); memset(_phase_at_bin, 0, sizeof(float) * _data_size); - + _iterations = 0; } @@ -74,11 +74,11 @@ FFT::analyze(ARDOUR::Sample *input, WindowingType windowing_type) #define Re (_fftOutput[i]) #define Im (_fftOutput[_window_size-i]) - for (uint32_t i=1; i < _data_size - 1; i++) { + for (uint32_t i=1; i < _data_size - 1; i++) { power = (Re * Re) + (Im * Im); phase = atanf(Im / Re); - + if (Re < 0.0 && Im > 0.0) { phase += M_PI; } else if (Re < 0.0 && Im < 0.0) { @@ -96,7 +96,7 @@ void FFT::calculate() { if (_iterations > 1) { - for (uint32_t i=0; i < _data_size - 1; i++) { + for (uint32_t i=0; i < _data_size - 1; i++) { _power_at_bin[i] /= (float)_iterations; _phase_at_bin[i] /= (float)_iterations; } @@ -114,14 +114,14 @@ FFT::get_hann_window() _hann_window = (float *) malloc(sizeof(float) * _window_size); double sum = 0.0; - + for (uint32_t i=0; i < _window_size; i++) { _hann_window[i]=0.81f * ( 0.5f - (0.5f * (float) cos(2.0f * M_PI * (float)i / (float)(_window_size)))); sum += _hann_window[i]; } double isum = 1.0 / sum; - + for (uint32_t i=0; i < _window_size; i++) { _hann_window[i] *= isum; } diff --git a/gtk2_ardour/fft_graph.cc b/gtk2_ardour/fft_graph.cc index 99f752c236..c0171ce57b 100644 --- a/gtk2_ardour/fft_graph.cc +++ b/gtk2_ardour/fft_graph.cc @@ -43,7 +43,7 @@ using namespace Gdk; FFTGraph::FFTGraph(int windowSize) { _logScale = 0; - + _in = 0; _out = 0; _hanning = 0; @@ -75,7 +75,7 @@ FFTGraph::setWindowSize_internal(int windowSize) if (_a_window) { _a_window->clear_tracklist(); } - + _windowSize = windowSize; _dataSize = windowSize / 2; if (_in != 0) { @@ -83,12 +83,12 @@ FFTGraph::setWindowSize_internal(int windowSize) free(_in); _in = 0; } - + if (_out != 0) { free(_out); _out = 0; } - + if (_hanning != 0) { free(_hanning); _hanning = 0; @@ -113,18 +113,18 @@ FFTGraph::setWindowSize_internal(int windowSize) // normalize the window double sum = 0.0; - + for (int i=0; i < _windowSize; i++) { _hanning[i]=0.81f * ( 0.5f - (0.5f * (float) cos(2.0f * M_PI * (float)i / (float)(_windowSize)))); sum += _hanning[i]; } double isum = 1.0 / sum; - + for (int i=0; i < _windowSize; i++) { _hanning[i] *= isum; } - + _logScale = (int *) malloc(sizeof(int) * _dataSize); //float count = 0; for (int i = 0; i < _dataSize; i++) { @@ -164,13 +164,13 @@ FFTGraph::set_analysis_window(AnalysisWindow *a_window) void FFTGraph::draw_scales(Glib::RefPtr<Gdk::Window> window) { - + Glib::RefPtr<Gtk::Style> style = get_style(); Glib::RefPtr<Gdk::GC> black = style->get_black_gc(); Glib::RefPtr<Gdk::GC> white = style->get_white_gc(); - + window->draw_rectangle(black, true, 0, 0, width, height); - + /** * 4 5 * _ _ @@ -192,7 +192,7 @@ FFTGraph::draw_scales(Glib::RefPtr<Gdk::Window> window) #define DB_METRIC_LENGTH 8 // Line 4 window->draw_line(white, h_margin - DB_METRIC_LENGTH, v_margin, h_margin, v_margin ); - + // Line 5 window->draw_line(white, width - h_margin + 1, v_margin, width - h_margin + DB_METRIC_LENGTH, v_margin ); @@ -205,7 +205,7 @@ FFTGraph::draw_scales(Glib::RefPtr<Gdk::Window> window) Color grey; grey.set_rgb_p(0.2, 0.2, 0.2); - + graph_gc->set_rgb_fg_color( grey ); if (layout == 0) { @@ -222,7 +222,7 @@ FFTGraph::draw_scales(Glib::RefPtr<Gdk::Window> window) float scale_points[10] = { 55.0, 110.0, 220.0, 440.0, 880.0, 1760.0, 3520.0, 7040.0, 14080.0, 28160.0 }; for (int x = 0; x < 10; x++) { - + // i = 0.. _dataSize-1 float freq_at_bin = (SR/2.0) * ((double)i / (double)_dataSize); @@ -237,13 +237,13 @@ FFTGraph::draw_scales(Glib::RefPtr<Gdk::Window> window) while (_logScale[logscale_pos] < position_on_scale) logscale_pos++; - + int coord = (int)(v_margin + 1.0 + position_on_scale); - + int SR = 44100; int rate_at_pos = (int)((double)(SR/2) * (double)logscale_pos / (double)_dataSize); - + char buf[32]; if (rate_at_pos < 1000) snprintf(buf,32,"%dHz",rate_at_pos); @@ -251,28 +251,28 @@ FFTGraph::draw_scales(Glib::RefPtr<Gdk::Window> window) snprintf(buf,32,"%dk",(int)floor( (float)rate_at_pos/(float)1000) ); std::string label = buf; - + layout->set_text(label); - + window->draw_line(graph_gc, coord, v_margin, coord, height - v_margin - 1); int width, height; layout->get_pixel_size (width, height); - + window->draw_layout(white, coord - width / 2, v_margin / 2, layout); - + } } void FFTGraph::redraw() -{ +{ Glib::Mutex::Lock lm (_a_window->track_list_lock); draw_scales(get_window()); - + if (_a_window == 0) return; @@ -284,16 +284,16 @@ FFTGraph::redraw() cairo_set_line_width(cr, 1.5); cairo_translate(cr, (float)v_margin + 1.0, (float)h_margin); - - + + // Find "session wide" min & max float min = 1000000000000.0; float max = -1000000000000.0; - + TreeNodeChildren track_rows = _a_window->track_list.get_model()->children(); - + for (TreeIter i = track_rows.begin(); i != track_rows.end(); i++) { - + TreeModel::Row row = *i; FFTResult *res = row[_a_window->tlcols.graph]; @@ -301,7 +301,7 @@ FFTGraph::redraw() if (res->minimum() == res->maximum()) { continue; } - + if ( res->minimum() < min) { min = res->minimum(); } @@ -315,11 +315,11 @@ FFTGraph::redraw() min = -150.0f; max = 0.0f; } - + //int graph_height = height - 2 * h_margin; - - + + float fft_pane_size_w = (float)(width - 2*v_margin) - 1.0; float fft_pane_size_h = (float)(height - 2*h_margin); @@ -329,23 +329,23 @@ FFTGraph::redraw() cairo_clip(cr); for (TreeIter i = track_rows.begin(); i != track_rows.end(); i++) { - + TreeModel::Row row = *i; // don't show graphs for tracks which are deselected if (!row[_a_window->tlcols.visible]) { continue; } - + FFTResult *res = row[_a_window->tlcols.graph]; // don't show graphs for empty signals if (res->minimum() == res->maximum()) { continue; } - + float mpp; - + if (_show_minmax) { mpp = -1000000.0; @@ -408,15 +408,15 @@ FFTGraph::redraw() mpp = -1000000.0; cairo_move_to(cr, 0.5, fft_pane_size_h-0.5); - + for (int x = 0; x < res->length(); x++) { - + if (res->avgAt(x) > mpp) mpp = res->avgAt(x); mpp = fmax(mpp, min); mpp = fmin(mpp, max); - + // If the next point on the log scale is at the same location, // don't draw yet if (x + 1 < res->length() && _logScale[x] == _logScale[x + 1]) { @@ -451,7 +451,7 @@ FFTGraph::on_size_allocate(Gtk::Allocation & alloc) { width = alloc.get_width(); height = alloc.get_height(); - + update_size(); DrawingArea::on_size_allocate (alloc); @@ -461,7 +461,7 @@ void FFTGraph::update_size() { currentScaleWidth = width - h_margin*2; - currentScaleHeight = height - 2 - v_margin*2; + currentScaleHeight = height - 2 - v_margin*2; float SR = 44100; float FFT_START = SR/(double)_dataSize; diff --git a/gtk2_ardour/fft_graph.h b/gtk2_ardour/fft_graph.h index 50a2df1fda..c91adec8b7 100644 --- a/gtk2_ardour/fft_graph.h +++ b/gtk2_ardour/fft_graph.h @@ -38,22 +38,22 @@ class AnalysisWindow; class FFTGraph : public Gtk::DrawingArea { public: - + FFTGraph(int windowSize); ~FFTGraph(); void set_analysis_window(AnalysisWindow *a_window); - + int windowSize() const { return _windowSize; } void setWindowSize(int windowSize); void redraw(); bool on_expose_event (GdkEventExpose* event); - + void on_size_request(Gtk::Requisition* requisition); void on_size_allocate(Gtk::Allocation & alloc); FFTResult *prepareResult(Gdk::Color color, std::string trackname); - + void set_show_minmax (bool v) { _show_minmax = v; redraw(); } void set_show_normalized (bool v) { _show_normalized = v; redraw(); } @@ -64,7 +64,7 @@ class FFTGraph : public Gtk::DrawingArea void setWindowSize_internal(int windowSize); void draw_scales(Glib::RefPtr<Gdk::Window> window); - + static const int minScaleWidth = 512; static const int minScaleHeight = 420; @@ -77,7 +77,7 @@ class FFTGraph : public Gtk::DrawingArea int width; int height; - + int _windowSize; int _dataSize; diff --git a/gtk2_ardour/fft_result.cc b/gtk2_ardour/fft_result.cc index a9858542a3..37c045b7b0 100644 --- a/gtk2_ardour/fft_result.cc +++ b/gtk2_ardour/fft_result.cc @@ -32,7 +32,7 @@ using namespace std; FFTResult::FFTResult(FFTGraph *graph, Gdk::Color color, string trackname) { _graph = graph; - + _windowSize = _graph->windowSize(); _dataSize = _windowSize / 2; @@ -73,12 +73,12 @@ FFTResult::analyzeWindow(float *window) _data_avg[0] += b; if (b < _data_min[0]) _data_min[0] = b; if (b > _data_max[0]) _data_max[0] = b; - + for (i=1; i < _dataSize - 1; i++) { // TODO: check with Jesse whether this is really correct b = (_out[i] * _out[i]); _data_avg[i] += b; // + (_out[_windowSize-i] * _out[_windowSize-i]);, TODO: thanks to Stefan Kost - + if (_data_min[i] > b) _data_min[i] = b; if (_data_max[i] < b ) _data_max[i] = b; } @@ -99,18 +99,18 @@ FFTResult::finalize() // Average & scale for (int i = 0; i < _dataSize; i++) { _data_avg[i] /= _averages; - _data_avg[i] = 10.0f * log10f(_data_avg[i]); + _data_avg[i] = 10.0f * log10f(_data_avg[i]); - _data_min[i] = 10.0f * log10f(_data_min[i]); + _data_min[i] = 10.0f * log10f(_data_min[i]); if (_data_min[i] < -10000.0f) { _data_min[i] = -10000.0f; } - _data_max[i] = 10.0f * log10f(_data_max[i]); + _data_max[i] = 10.0f * log10f(_data_max[i]); } // find min & max _minimum = _maximum = _data_avg[0]; - + for (int i = 1; i < _dataSize; i++) { if (_data_avg[i] < _minimum && !isinf(_data_avg[i])) { _minimum = _data_avg[i]; diff --git a/gtk2_ardour/fft_result.h b/gtk2_ardour/fft_result.h index 2042b2d042..2873138dfd 100644 --- a/gtk2_ardour/fft_result.h +++ b/gtk2_ardour/fft_result.h @@ -33,7 +33,7 @@ class FFTGraph; class FFTResult { public: - + ~FFTResult(); void analyzeWindow(float *window); @@ -44,15 +44,15 @@ class FFTResult float avgAt(int x); float maxAt(int x); float minAt(int x); - + float minimum() const { return _minimum; } float maximum() const { return _maximum; } - + Gdk::Color get_color() const { return _color; } - + private: FFTResult(FFTGraph *graph, Gdk::Color color, std::string trackname); - + int _averages; float* _data_avg; @@ -68,10 +68,10 @@ class FFTResult float _maximum; FFTGraph *_graph; - + Gdk::Color _color; std::string _trackname; - + friend class FFTGraph; }; diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 425929c9d2..1b251ba318 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -74,7 +74,7 @@ GainMeter::setup_slider_pix () } } -GainMeterBase::GainMeterBase (Session& s, +GainMeterBase::GainMeterBase (Session& s, const Glib::RefPtr<Gdk::Pixbuf>& pix, bool horizontal) : _session (s) @@ -84,7 +84,7 @@ GainMeterBase::GainMeterBase (Session& s, , gain_automation_state_button ("") , dpi_changed (false) , _is_midi (false) - + { using namespace Menu_Helpers; @@ -136,10 +136,10 @@ GainMeterBase::GainMeterBase (Session& s, gain_automation_state_button.set_size_request(15, 15); gain_automation_style_button.set_size_request(15, 15); - + gain_astyle_menu.items().push_back (MenuElem (_("Trim"))); gain_astyle_menu.items().push_back (MenuElem (_("Abs"))); - + gain_astate_menu.set_name ("ArdourContextMenu"); gain_astyle_menu.set_name ("ArdourContextMenu"); @@ -163,7 +163,7 @@ GainMeterBase::~GainMeterBase () void GainMeterBase::set_controls (boost::shared_ptr<Route> r, - boost::shared_ptr<PeakMeter> pm, + boost::shared_ptr<PeakMeter> pm, boost::shared_ptr<Amp> amp) { connections.clear (); @@ -175,7 +175,7 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r, _amp.reset (); _route.reset (); return; - } + } _meter = pm; _amp = amp; @@ -183,7 +183,7 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r, level_meter->set_meter (pm.get()); gain_slider->set_controllable (amp->gain_control()); - + if (!_route || _route->output()->n_ports().n_midi() == 0) { _is_midi = false; gain_adjustment.set_lower (0.0); @@ -197,14 +197,14 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r, gain_adjustment.set_step_increment (0.05); gain_adjustment.set_page_increment (0.1); } - + if (!_route || !_route->is_hidden()) { - + using namespace Menu_Helpers; - + gain_astate_menu.items().clear (); - - gain_astate_menu.items().push_back (MenuElem (_("Manual"), + + gain_astate_menu.items().push_back (MenuElem (_("Manual"), bind (mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state), Evoral::Parameter(GainAutomation), (AutoState) Off))); gain_astate_menu.items().push_back (MenuElem (_("Play"), @@ -216,7 +216,7 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r, gain_astate_menu.items().push_back (MenuElem (_("Touch"), bind (mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state), Evoral::Parameter(GainAutomation), (AutoState) Touch))); - + connections.push_back (gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &GainMeterBase::gain_automation_style_button_event), false)); connections.push_back (gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &GainMeterBase::gain_automation_state_button_event), false)); @@ -224,7 +224,7 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r, connections.push_back (gc->alist()->automation_state_changed.connect (mem_fun(*this, &GainMeter::gain_automation_state_changed))); connections.push_back (gc->alist()->automation_style_changed.connect (mem_fun(*this, &GainMeter::gain_automation_style_changed))); - + gain_automation_state_changed (); } @@ -261,7 +261,7 @@ GainMeterBase::setup_meters (int len) level_meter->setup_meters(len, 5); } -void +void GainMeter::setup_meters (int len) { if (!meter_metric_area.get_parent()) { @@ -419,13 +419,13 @@ GainMeterBase::effective_gain_display () } else { value = _amp->gain (); } - + //cerr << this << " for " << _io->name() << " EGAIN = " << value // << " AGAIN = " << gain_adjustment.get_value () << endl; // stacktrace (cerr, 20); if (gain_adjustment.get_value() != value) { - ignore_toggle = true; + ignore_toggle = true; gain_adjustment.set_value (value); ignore_toggle = false; } @@ -463,11 +463,11 @@ next_meter_point (MeterPoint mp) case MeterInput: return MeterPreFader; break; - + case MeterPreFader: return MeterPostFader; break; - + case MeterPostFader: return MeterInput; break; @@ -480,7 +480,7 @@ gint GainMeterBase::meter_press(GdkEventButton* ev) { wait_for_release = false; - + if (!_route) { return FALSE; } @@ -488,7 +488,7 @@ GainMeterBase::meter_press(GdkEventButton* ev) if (!ignore_toggle) { if (Keyboard::is_context_menu_event (ev)) { - + // no menu at this time. } else { @@ -497,7 +497,7 @@ GainMeterBase::meter_press(GdkEventButton* ev) // Primary-button2 click is the midi binding click // button2-click is "momentary" - + if (!Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier))) { wait_for_release = true; old_meter_point = _route->meter_point (); @@ -507,7 +507,7 @@ GainMeterBase::meter_press(GdkEventButton* ev) if (_route && (ev->button == 1 || Keyboard::is_button2_event (ev))) { if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { - + /* Primary+Tertiary-click applies change to all routes */ _session.begin_reversible_command (_("meter point change")); @@ -516,14 +516,14 @@ GainMeterBase::meter_press(GdkEventButton* ev) cmd->mark(); _session.add_command (cmd); _session.commit_reversible_command (); - - + + } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { /* Primary-click: solo mix group. NOTE: Primary-button2 is MIDI learn. */ - + if (ev->button == 1) { _session.begin_reversible_command (_("meter point change")); Session::GlobalMeteringStateCommand *cmd = new Session::GlobalMeteringStateCommand (_session, this); @@ -532,13 +532,13 @@ GainMeterBase::meter_press(GdkEventButton* ev) _session.add_command (cmd); _session.commit_reversible_command (); } - + } else { - + /* click: change just this route */ // XXX no undo yet - + _route->set_meter_point (next_meter_point (_route->meter_point()), this); } } @@ -555,7 +555,7 @@ GainMeterBase::meter_release(GdkEventButton*) if(!ignore_toggle){ if (wait_for_release){ wait_for_release = false; - + if (_route) { set_meter_point (*_route, old_meter_point); } @@ -611,7 +611,7 @@ GainMeterBase::gain_automation_state_button_event (GdkEventButton *ev) if (ev->type == GDK_BUTTON_RELEASE) { return TRUE; } - + switch (ev->button) { case 1: gain_astate_menu.popup (1, ev->time); @@ -716,7 +716,7 @@ void GainMeterBase::gain_automation_state_changed () { ENSURE_GUI_THREAD(mem_fun(*this, &GainMeterBase::gain_automation_state_changed)); - + bool x; switch (_width) { @@ -729,7 +729,7 @@ GainMeterBase::gain_automation_state_changed () } x = (_amp->gain_control()->alist()->automation_state() != Off); - + if (gain_automation_state_button.get_active() != x) { ignore_toggle = true; gain_automation_state_button.set_active (x); @@ -737,9 +737,9 @@ GainMeterBase::gain_automation_state_changed () } update_gain_sensitive (); - + /* start watching automation so that things move */ - + gain_watching.disconnect(); if (x) { @@ -829,7 +829,7 @@ GainMeter::GainMeter (Session& s) meter_metric_area.signal_expose_event().connect (mem_fun(*this, &GainMeter::meter_metrics_expose)); } -void +void GainMeter::set_controls (boost::shared_ptr<Route> r, boost::shared_ptr<PeakMeter> meter, boost::shared_ptr<Amp> amp) @@ -848,14 +848,14 @@ GainMeter::set_controls (boost::shared_ptr<Route> r, GainMeterBase::set_controls (r, meter, amp); - /* - if we have a non-hidden route (ie. we're not the click or the auditioner), + /* + if we have a non-hidden route (ie. we're not the click or the auditioner), pack some route-dependent stuff. */ - + gain_display_box.pack_end (peak_display, true, true); hbox.pack_end (*level_meter, true, true); - + if (!r->is_hidden()) { fader_vbox->pack_start (gain_automation_state_button, false, false, 0); } @@ -883,7 +883,7 @@ GainMeter::render_metrics (Gtk::Widget& w) char buf[32]; win->get_size (width, height); - + Glib::RefPtr<Gdk::Pixmap> pixmap = Gdk::Pixmap::create (win, width, height); metric_pixmaps[w.get_name()] = pixmap; @@ -927,7 +927,7 @@ GainMeter::meter_metrics_expose (GdkEventExpose *ev) gint width, height; win->get_size (width, height); - + base_rect.width = width; base_rect.height = height; base_rect.x = 0; diff --git a/gtk2_ardour/gain_meter.h b/gtk2_ardour/gain_meter.h index b1a6ba557d..c0c5d9faff 100644 --- a/gtk2_ardour/gain_meter.h +++ b/gtk2_ardour/gain_meter.h @@ -134,20 +134,20 @@ class GainMeterBase : virtual public sigc::trackable bool gain_focused (GdkEventFocus*); float max_peak; - + void gain_adjusted (); void gain_changed (); - + void meter_point_clicked (); void gain_unit_changed (); - + virtual void hide_all_meters (); gint meter_button_press (GdkEventButton*, uint32_t); bool peak_button_release (GdkEventButton*); bool gain_key_press (GdkEventKey*); - + Gtk::Menu* meter_menu; void popup_meter_menu (GdkEventButton*); diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 5666f25810..b843120f8c 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -89,7 +89,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol latency_button.add (latency_label); latency_button.signal_clicked().connect (mem_fun (*this, &PlugUIBase::latency_button_clicked)); set_latency_label (); - + smaller_hbox->pack_start (latency_button, false, false, 10); smaller_hbox->pack_start (preset_combo, false, false); smaller_hbox->pack_start (save_button, false, false); @@ -97,7 +97,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol constraint_hbox->set_spacing (5); constraint_hbox->set_homogeneous (false); - + VBox* v1_box = manage (new VBox); VBox* v2_box = manage (new VBox); pack_end(plugin_analysis_expander); @@ -111,14 +111,14 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol constraint_hbox->pack_end (*v1_box, false, false); main_contents.pack_start (*constraint_hbox, false, false); - + if ( is_scrollable ) { scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scroller.set_name ("PluginEditor"); scroller_view.set_name("PluginEditor"); scroller_view.add (hpacker); scroller.add (scroller_view); - + main_contents.pack_start (scroller, true, true); } @@ -128,7 +128,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol pi->ActiveChanged.connect (bind(mem_fun(*this, &GenericPluginUI::processor_active_changed), boost::weak_ptr<Processor>(pi))); - + bypass_button.set_active (!pi->active()); build (); @@ -198,7 +198,7 @@ GenericPluginUI::build () for (i = 0; i < plugin->parameter_count(); ++i) { if (plugin->parameter_is_control (i)) { - + /* Don't show latency control ports */ if (plugin->describe_parameter (Evoral::Parameter(PluginAutomation, 0, i)) == X_("latency")) { @@ -206,7 +206,7 @@ GenericPluginUI::build () } ControlUI* cui; - + /* if we are scrollable, just use one long column */ if (!is_scrollable) { @@ -214,7 +214,7 @@ GenericPluginUI::build () frame = manage (new Frame); frame->set_name ("BaseFrame"); box = manage (new VBox); - + box->set_border_width (5); box->set_spacing (1); @@ -233,7 +233,7 @@ GenericPluginUI::build () error << string_compose(_("Plugin Editor: could not build control element for port %1"), i) << endmsg; continue; } - + if (cui->controller || cui->clickbox || cui->combo) { box->pack_start (*cui, false, false); @@ -248,25 +248,25 @@ GenericPluginUI::build () } } - button_table.attach (*cui, button_col, button_col + 1, button_row, button_row+1, + button_table.attach (*cui, button_col, button_col + 1, button_row, button_row+1, FILL|EXPAND, FILL); button_row++; } else if (cui->display) { - output_table.attach (*cui, output_col, output_col + 1, output_row, output_row+1, + output_table.attach (*cui, output_col, output_col + 1, output_row, output_row+1, FILL|EXPAND, FILL); - - // TODO: The meters should be divided into multiple rows - + + // TODO: The meters should be divided into multiple rows + if (++output_col == output_cols) { output_cols ++; output_table.resize (output_rows, output_cols); } - + /* old code, which divides meters into * columns first, rows later. New code divides into one row - + if (output_row == output_rows) { output_row = 0; if (++output_col == output_cols) { @@ -274,22 +274,22 @@ GenericPluginUI::build () output_table.resize (output_rows, output_cols); } } - - output_table.attach (*cui, output_col, output_col + 1, output_row, output_row+1, + + output_table.attach (*cui, output_col, output_col + 1, output_row, output_row+1, FILL|EXPAND, FILL); - + output_row++; */ } - + /* HACK: ideally the preferred height would be queried from the complete hpacker, but I can't seem to get that - information in time, so this is an estimation + information in time, so this is an estimation */ prefheight += 30; - } + } } if (box->children().empty()) { @@ -314,7 +314,7 @@ GenericPluginUI::build () } GenericPluginUI::ControlUI::ControlUI () - : automate_button (X_("")) // force creation of a label + : automate_button (X_("")) // force creation of a label { automate_button.set_name ("PluginAutomateButton"); ARDOUR_UI::instance()->tooltips().set_tip (automate_button, _("Automation control")); @@ -333,7 +333,7 @@ GenericPluginUI::ControlUI::ControlUI () meterinfo = 0; } -GenericPluginUI::ControlUI::~ControlUI() +GenericPluginUI::ControlUI::~ControlUI() { if (meterinfo) { delete meterinfo->meter; @@ -411,13 +411,13 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat boost::shared_ptr<LV2Plugin> lv2p; #endif if ((lp = boost::dynamic_pointer_cast<LadspaPlugin>(plugin)) != 0) { - + // FIXME: not all plugins have a numeric unique ID uint32_t id = atol (lp->unique_id().c_str()); lrdf_defaults* defaults = lrdf_get_scale_values(id, port_index); - + if (defaults && defaults->count > 0) { - + control_ui->combo = new Gtk::ComboBoxText; //control_ui->combo->set_value_in_list(true, false); set_popdown_strings (*control_ui->combo, setup_scale_values(port_index, control_ui)); @@ -425,9 +425,9 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat mcontrol->Changed.connect (bind (mem_fun (*this, &GenericPluginUI::parameter_changed), control_ui)); control_ui->pack_start(control_ui->label, true, true); control_ui->pack_start(*control_ui->combo, false, true); - + update_control_display(control_ui); - + lrdf_free_setting_values(defaults); return control_ui; } @@ -446,19 +446,19 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat mcontrol->Changed.connect (bind (mem_fun (*this, &GenericPluginUI::parameter_changed), control_ui)); control_ui->pack_start(control_ui->label, true, true); control_ui->pack_start(*control_ui->combo, false, true); - + update_control_display(control_ui); - + slv2_scale_points_free(points); return control_ui; } #endif } - + if (desc.toggled) { /* Build a button */ - + control_ui->button = manage (new ToggleButton ()); control_ui->button->set_name ("PluginEditorButton"); control_ui->button->set_size_request (20, 20); @@ -469,11 +469,11 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat control_ui->button->signal_clicked().connect (bind (mem_fun(*this, &GenericPluginUI::control_port_toggled), control_ui)); mcontrol->Changed.connect (bind (mem_fun (*this, &GenericPluginUI::toggle_parameter_changed), control_ui)); - + if (plugin->get_parameter (port_index) > 0.5){ control_ui->button->set_active(true); } - + return control_ui; } @@ -498,8 +498,8 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat control_ui->controller->adjustment()->set_upper (log(control_ui->controller->adjustment()->get_upper())); control_ui->controller->adjustment()->set_lower (log(control_ui->controller->adjustment()->get_lower())); }*/ - - + + control_ui->controller->adjustment()->set_step_increment (desc.step); control_ui->controller->adjustment()->set_page_increment (desc.largestep); //#endif @@ -518,7 +518,7 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat control_ui->controller->StartGesture.connect (bind (mem_fun(*this, &GenericPluginUI::start_touch), control_ui)); control_ui->controller->StopGesture.connect (bind (mem_fun(*this, &GenericPluginUI::stop_touch), control_ui)); - + } if (control_ui->logarithmic) { @@ -545,7 +545,7 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat automation_state_changed (control_ui); mcontrol->Changed.connect (bind (mem_fun (*this, &GenericPluginUI::parameter_changed), control_ui)); - mcontrol->alist()->automation_state_changed.connect + mcontrol->alist()->automation_state_changed.connect (bind (mem_fun(*this, &GenericPluginUI::automation_state_changed), control_ui)); } else if (plugin->parameter_is_output (port_index)) { @@ -567,7 +567,7 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat MeterInfo * info = new MeterInfo(port_index); control_ui->meterinfo = info; - + info->meter = new FastMeter (5, 5, FastMeter::Vertical); info->min_unbound = desc.min_unbound; @@ -578,25 +578,25 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat control_ui->vbox = manage (new VBox); control_ui->hbox = manage (new HBox); - + control_ui->label.set_angle(90); control_ui->hbox->pack_start (control_ui->label, false, false); control_ui->hbox->pack_start (*info->meter, false, false); control_ui->vbox->pack_start (*control_ui->hbox, false, false); - + control_ui->vbox->pack_start (*control_ui->display, false, false); control_ui->pack_start (*control_ui->vbox); control_ui->meterinfo->meter->show_all(); control_ui->meterinfo->packed = true; - + output_controls.push_back (control_ui); } - + mcontrol->Changed.connect (bind (mem_fun (*this, &GenericPluginUI::parameter_changed), control_ui)); - + return control_ui; } @@ -620,12 +620,12 @@ GenericPluginUI::astate_clicked (ControlUI* cui, uint32_t /*port*/) if (automation_menu == 0) { automation_menu = manage (new Menu); automation_menu->set_name ("ArdourContextMenu"); - } + } MenuList& items (automation_menu->items()); items.clear (); - items.push_back (MenuElem (_("Manual"), + items.push_back (MenuElem (_("Manual"), bind (mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Off, cui))); items.push_back (MenuElem (_("Play"), bind (mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Play, cui))); @@ -647,7 +647,7 @@ void GenericPluginUI::toggle_parameter_changed (ControlUI* cui) { float val = cui->control->get_value(); - + if (!cui->ignore_change) { if (val > 0.5) { cui->button->set_active (true); @@ -667,10 +667,10 @@ GenericPluginUI::parameter_changed (ControlUI* cui) } void -GenericPluginUI::update_control_display (ControlUI* cui) +GenericPluginUI::update_control_display (ControlUI* cui) { /* XXX how do we handle logarithmic stuff here ? */ - + cui->update_pending = false; float val = cui->control->get_value(); @@ -732,7 +732,7 @@ void GenericPluginUI::processor_active_changed (boost::weak_ptr<Processor> weak_processor) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &GenericPluginUI::processor_active_changed), weak_processor)); - + boost::shared_ptr<Processor> processor = weak_processor.lock(); bypass_button.set_active (!processor || !processor->active()); @@ -743,7 +743,7 @@ GenericPluginUI::start_updating (GdkEventAny*) { if (output_controls.size() > 0 ) { screen_update_connection.disconnect(); - screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect + screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (mem_fun(*this, &GenericPluginUI::output_update)); } return false; @@ -769,7 +769,7 @@ GenericPluginUI::output_update () /* autoscaling for the meter */ if ((*i)->meterinfo && (*i)->meterinfo->packed) { - + if (val < (*i)->meterinfo->min) { if ((*i)->meterinfo->min_unbound) (*i)->meterinfo->min = val; @@ -783,7 +783,7 @@ GenericPluginUI::output_update () else val = (*i)->meterinfo->max; } - + if ((*i)->meterinfo->max > (*i)->meterinfo->min ) { float lval = (val - (*i)->meterinfo->min) / ((*i)->meterinfo->max - (*i)->meterinfo->min) ; (*i)->meterinfo->meter->set (lval ); @@ -792,7 +792,7 @@ GenericPluginUI::output_update () } } -vector<string> +vector<string> GenericPluginUI::setup_scale_values(guint32 port_index, ControlUI* cui) { vector<string> enums; @@ -825,7 +825,7 @@ GenericPluginUI::setup_scale_values(guint32 port_index, ControlUI* cui) SLV2Port port = lv2p->slv2_port(port_index); SLV2ScalePoints points = slv2_port_get_scale_points(lv2p->slv2_plugin(), port); cui->combo_map = new std::map<string, float>; - + for (unsigned i=0; i < slv2_scale_points_size(points); ++i) { SLV2ScalePoint p = slv2_scale_points_get_at(points, i); SLV2Value label = slv2_scale_point_get_label(p); @@ -842,7 +842,7 @@ GenericPluginUI::setup_scale_values(guint32 port_index, ControlUI* cui) slv2_scale_points_free(points); #endif } - + return enums; } diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc index 9d3d81eb00..9fb0deb98a 100644 --- a/gtk2_ardour/ghostregion.cc +++ b/gtk2_ardour/ghostregion.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -111,7 +111,7 @@ AudioGhostRegion::set_samples_per_unit (double spu) { for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) { (*i)->property_samples_per_unit() = spu; - } + } } void @@ -124,7 +124,7 @@ AudioGhostRegion::set_height () GhostRegion::set_height(); ht = ((trackview.current_height()) / (double) waves.size()); - + for (n = 0, i = waves.begin(); i != waves.end(); ++i, ++n) { gdouble yoff = n * ht; (*i)->property_height() = ht; @@ -168,7 +168,7 @@ MidiGhostRegion::MidiGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, doub MidiGhostRegion::MidiGhostRegion(MidiStreamView& msv, TimeAxisView& source_tv, double initial_unit_pos) : GhostRegion(msv.midi_underlay_group, msv.trackview(), source_tv, initial_unit_pos) { - base_rect->lower_to_bottom(); + base_rect->lower_to_bottom(); } MidiGhostRegion::~MidiGhostRegion() @@ -267,7 +267,7 @@ MidiGhostRegion::update_range() MidiGhostRegion::Note* note; uint8_t note_num; double y; - + for (EventList::iterator it = events.begin(); it != events.end(); ++it) { if ((note = dynamic_cast<MidiGhostRegion::Note*>(*it)) != 0) { note_num = note->event->note()->note(); diff --git a/gtk2_ardour/ghostregion.h b/gtk2_ardour/ghostregion.h index 8b9f0d1093..b28607e6f2 100644 --- a/gtk2_ardour/ghostregion.h +++ b/gtk2_ardour/ghostregion.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ namespace Gnome { class MidiStreamView; class TimeAxisView; -class GhostRegion : public sigc::trackable +class GhostRegion : public sigc::trackable { public: GhostRegion(ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos); @@ -99,7 +99,7 @@ public: void x_changed(); ArdourCanvas::Diamond* diamond; }; - + MidiGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos); MidiGhostRegion(MidiStreamView& msv, TimeAxisView& source_tv, double initial_unit_pos); ~MidiGhostRegion(); diff --git a/gtk2_ardour/global_port_matrix.cc b/gtk2_ardour/global_port_matrix.cc index be809e44bd..72a2a6b6d7 100644 --- a/gtk2_ardour/global_port_matrix.cc +++ b/gtk2_ardour/global_port_matrix.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -86,7 +86,7 @@ GlobalPortMatrix::get_state (ARDOUR::BundleChannel c[2]) const so nothing to connect */ return PortMatrixNode::UNKNOWN; } - + for (ARDOUR::Bundle::PortList::const_iterator i = in_ports.begin(); i != in_ports.end(); ++i) { for (ARDOUR::Bundle::PortList::const_iterator j = out_ports.begin(); j != out_ports.end(); ++j) { diff --git a/gtk2_ardour/global_port_matrix.h b/gtk2_ardour/global_port_matrix.h index 5aa20f9503..508376a9d1 100644 --- a/gtk2_ardour/global_port_matrix.h +++ b/gtk2_ardour/global_port_matrix.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ public: GlobalPortMatrix (Gtk::Window*, ARDOUR::Session&, ARDOUR::DataType); void setup_ports (int); - + void set_state (ARDOUR::BundleChannel c[2], bool); PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const; @@ -43,7 +43,7 @@ public: std::string channel_noun () const { return _("port"); } - + bool list_is_global (int) const { return true; } @@ -64,7 +64,7 @@ public: private: void on_show (); - + GlobalPortMatrix _port_matrix; Gtk::Button _rescan_button; Gtk::CheckButton _show_ports_button; diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc index 995d41dfef..60b32520fe 100644 --- a/gtk2_ardour/group_tabs.cc +++ b/gtk2_ardour/group_tabs.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -91,7 +91,7 @@ GroupTabs::on_button_press_event (GdkEventButton* ev) if (m) { m->popup (ev->button, ev->time); } - + } return true; @@ -106,13 +106,13 @@ GroupTabs::on_motion_notify_event (GdkEventMotion* ev) } double const p = primary_coordinate (ev->x, ev->y); - + if (p != _drag_last) { _drag_moved = true; } if (_drag_from) { - + double f = _dragging->from + p - _drag_last; if (f < _drag_limit) { @@ -125,11 +125,11 @@ GroupTabs::on_motion_notify_event (GdkEventMotion* ev) /* limit drag in the `too small' direction */ f = t; } - + _dragging->from = f; - + } else { - + double t = _dragging->to + p - _drag_last; if (t > _drag_limit) { @@ -142,7 +142,7 @@ GroupTabs::on_motion_notify_event (GdkEventMotion* ev) /* limit drag in the `too small' direction */ t = f; } - + _dragging->to = t; } @@ -150,7 +150,7 @@ GroupTabs::on_motion_notify_event (GdkEventMotion* ev) queue_draw (); _drag_last = p; - + return true; } @@ -171,13 +171,13 @@ GroupTabs::on_button_release_event (GdkEventButton* ev) d.do_run (); } else { - + /* toggle active state */ _dragging->group->set_active (!_dragging->group->is_active (), this); _dragging = 0; - + } - + } else { /* finish drag */ _dragging = 0; @@ -197,7 +197,7 @@ GroupTabs::render (cairo_t* cr) } /* background */ - + cairo_set_source_rgb (cr, 0, 0, 0); cairo_rectangle (cr, 0, 0, _width, _height); cairo_fill (cr); @@ -206,7 +206,7 @@ GroupTabs::render (cairo_t* cr) for (list<Tab>::const_iterator i = _tabs.begin(); i != _tabs.end(); ++i) { draw_tab (cr, *i); - } + } } @@ -216,12 +216,12 @@ GroupTabs::render (cairo_t* cr) * @param next Filled in with the next tab after the click, or 0. * @return Tab under the click, or 0. */ - + GroupTabs::Tab * GroupTabs::click_to_tab (double c, Tab** prev, Tab** next) { *prev = 0; - + list<Tab>::iterator i = _tabs.begin (); while (i != _tabs.end() && (c < i->from || c > i->to)) { *prev = &(*i); diff --git a/gtk2_ardour/group_tabs.h b/gtk2_ardour/group_tabs.h index 2cff160426..3036cfcb39 100644 --- a/gtk2_ardour/group_tabs.h +++ b/gtk2_ardour/group_tabs.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/gtk-custom-hruler.c b/gtk2_ardour/gtk-custom-hruler.c index 1446fb487f..61a34a7c41 100644 --- a/gtk2_ardour/gtk-custom-hruler.c +++ b/gtk2_ardour/gtk-custom-hruler.c @@ -21,7 +21,7 @@ * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ /* modified by andreas meyer <hexx3000@gmx.de> */ @@ -47,7 +47,7 @@ static void gtk_custom_hruler_draw_pos (GtkCustomRuler * ruler); GType gtk_custom_hruler_get_type (void) { static GType hruler_type = 0; - + if (!hruler_type) { static const GTypeInfo hruler_info = { @@ -62,11 +62,11 @@ GType gtk_custom_hruler_get_type (void) (GInstanceInitFunc) gtk_custom_hruler_init, NULL /* value_table */ }; - + hruler_type = g_type_register_static (gtk_custom_ruler_get_type(), "GtkCustomHRuler", &hruler_info, 0); } - + return hruler_type; } @@ -153,7 +153,7 @@ gtk_custom_hruler_draw_ticks (GtkCustomRuler * ruler) gc = widget->style->fg_gc[GTK_STATE_NORMAL]; bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL]; - + layout = gtk_widget_create_pango_layout (widget, "012456789"); pango_layout_get_extents (layout, &ink_rect, &logical_rect); @@ -166,13 +166,13 @@ gtk_custom_hruler_draw_ticks (GtkCustomRuler * ruler) GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, widget, "custom_hruler", 0, 0, widget->allocation.width, widget->allocation.height); - gdk_draw_line (ruler->backing_store, gc, 0, widget->allocation.height - 1, + gdk_draw_line (ruler->backing_store, gc, 0, widget->allocation.height - 1, widget->allocation.width, widget->allocation.height - 1); if ((ruler->upper - ruler->lower) == 0) { return; } - + /* we have to assume a fixed width font here */ max_chars = widget->allocation.width / 12; // XXX FIX ME: pixel with of the char `8' @@ -197,10 +197,10 @@ gtk_custom_hruler_draw_ticks (GtkCustomRuler * ruler) gdk_draw_line (ruler->backing_store, gc, pos, height, pos, height - 3); break; } - + pango_layout_set_text (layout, marks[i].label, -1); pango_layout_get_extents (layout, &logical_rect, NULL); - + gtk_paint_layout (widget->style, ruler->backing_store, GTK_WIDGET_STATE (widget), @@ -210,14 +210,14 @@ gtk_custom_hruler_draw_ticks (GtkCustomRuler * ruler) "hruler", pos + 2, ythickness + PANGO_PIXELS (logical_rect.y - digit_offset), layout); - + g_free (marks[i].label); } - + if (nmarks) { g_free (marks); } - + g_object_unref (layout); } @@ -254,7 +254,7 @@ gtk_custom_hruler_draw_pos (GtkCustomRuler * ruler) gdk_draw_pixmap (ruler->widget.window, ruler->non_gr_exp_gc, ruler->backing_store, ruler->xsrc, ruler->ysrc, ruler->xsrc, ruler->ysrc, bs_width, bs_height); - + increment = (gfloat) width / (ruler->upper - ruler->lower); x = ROUND ((ruler->position - ruler->lower) * increment) + (xthickness - bs_width) / 2 - 1; y = (height + bs_height) / 2 + ythickness; diff --git a/gtk2_ardour/gtk-custom-hruler.h b/gtk2_ardour/gtk-custom-hruler.h index fd3656f5ca..5213e3030c 100644 --- a/gtk2_ardour/gtk-custom-hruler.h +++ b/gtk2_ardour/gtk-custom-hruler.h @@ -21,7 +21,7 @@ * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ /* modified by andreas meyer <hexx3000@gmx.de> */ diff --git a/gtk2_ardour/gtk-custom-ruler.c b/gtk2_ardour/gtk-custom-ruler.c index 4c937f8618..b66dd68bd3 100644 --- a/gtk2_ardour/gtk-custom-ruler.c +++ b/gtk2_ardour/gtk-custom-ruler.c @@ -21,7 +21,7 @@ * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ /* modified by andreas meyer <hexx3000@gmx.de> */ @@ -66,7 +66,7 @@ default_metric_get_marks (GtkCustomRulerMark **marks, gdouble lower, gdouble upp (void) lower; (void) upper; (void) maxchars; - + return 0; } @@ -80,7 +80,7 @@ static GtkWidgetClass *parent_class; GType gtk_custom_ruler_get_type (void) { static GType ruler_type = 0; - + if (!ruler_type) { static const GTypeInfo ruler_info = @@ -96,11 +96,11 @@ GType gtk_custom_ruler_get_type (void) (GInstanceInitFunc) gtk_custom_ruler_init, NULL /* value_table */ }; - + ruler_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkCustomRuler", &ruler_info, 0); } - + return ruler_type; } @@ -109,15 +109,15 @@ gtk_custom_ruler_class_init (GtkCustomRulerClass * class) { GObjectClass *gobject_class; GtkWidgetClass *widget_class; - + gobject_class = (GObjectClass *) class; widget_class = (GtkWidgetClass*) class; - + parent_class = g_type_class_peek_parent (class); - + gobject_class->set_property = gtk_custom_ruler_set_property; gobject_class->get_property = gtk_custom_ruler_get_property; - + widget_class->realize = gtk_custom_ruler_realize; widget_class->unrealize = gtk_custom_ruler_unrealize; widget_class->size_allocate = gtk_custom_ruler_size_allocate; @@ -134,8 +134,8 @@ gtk_custom_ruler_class_init (GtkCustomRulerClass * class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_UPPER, g_param_spec_double ("upper", @@ -144,8 +144,8 @@ gtk_custom_ruler_class_init (GtkCustomRulerClass * class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_POSITION, g_param_spec_double ("position", @@ -154,8 +154,8 @@ gtk_custom_ruler_class_init (GtkCustomRulerClass * class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_MAX_SIZE, g_param_spec_double ("max_size", @@ -164,7 +164,7 @@ gtk_custom_ruler_class_init (GtkCustomRulerClass * class) -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_SHOW_POSITION, @@ -172,7 +172,7 @@ gtk_custom_ruler_class_init (GtkCustomRulerClass * class) _("Show Position"), _("Draw current ruler position"), TRUE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); } static void @@ -199,7 +199,7 @@ gtk_custom_ruler_set_property (GObject *object, GParamSpec *pspec) { (void) pspec; - + GtkCustomRuler *ruler = GTK_CUSTOM_RULER (object); switch (prop_id) @@ -233,7 +233,7 @@ gtk_custom_ruler_get_property (GObject *object, GParamSpec *pspec) { GtkCustomRuler *ruler = GTK_CUSTOM_RULER (object); - + switch (prop_id) { case PROP_LOWER: @@ -346,14 +346,14 @@ gtk_custom_ruler_draw_ticks (GtkCustomRuler * ruler) if (GTK_CUSTOM_RULER_GET_CLASS (ruler)->draw_ticks) GTK_CUSTOM_RULER_GET_CLASS (ruler)->draw_ticks (ruler); - + } void gtk_custom_ruler_draw_pos (GtkCustomRuler * ruler) { g_return_if_fail (GTK_IS_CUSTOM_RULER (ruler)); - + if (GTK_CUSTOM_RULER_GET_CLASS (ruler)->draw_pos && ruler->show_position) GTK_CUSTOM_RULER_GET_CLASS (ruler)->draw_pos (ruler); } @@ -445,7 +445,7 @@ gtk_custom_ruler_expose (GtkWidget * widget, GdkEventExpose * event) gdk_draw_pixmap (widget->window, ruler->non_gr_exp_gc, ruler->backing_store, 0, 0, 0, 0, widget->allocation.width, widget->allocation.height); - + gtk_custom_ruler_draw_pos (ruler); } diff --git a/gtk2_ardour/gtk-custom-ruler.h b/gtk2_ardour/gtk-custom-ruler.h index 3d0b512481..bcb3423160 100644 --- a/gtk2_ardour/gtk-custom-ruler.h +++ b/gtk2_ardour/gtk-custom-ruler.h @@ -21,7 +21,7 @@ * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ /* modified by andreas meyer <hexx3000@gmx.de> */ @@ -56,7 +56,7 @@ struct _GtkCustomRuler { gint xsrc, ysrc; gint slider_size; gboolean show_position; - + /* The upper limit of the ruler (in points) */ gdouble lower; /* The lower limit of the ruler */ diff --git a/gtk2_ardour/gui_thread.h b/gtk2_ardour/gui_thread.h index 12071c5558..388902fa28 100644 --- a/gtk2_ardour/gui_thread.h +++ b/gtk2_ardour/gui_thread.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/i18n.h b/gtk2_ardour/i18n.h index 8dc13404aa..d9c2a44541 100644 --- a/gtk2_ardour/i18n.h +++ b/gtk2_ardour/i18n.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/imageframe.cc b/gtk2_ardour/imageframe.cc index 7ff05ee9e9..ac30511864 100644 --- a/gtk2_ardour/imageframe.cc +++ b/gtk2_ardour/imageframe.cc @@ -174,7 +174,7 @@ Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_height() const { return Glib::PropertyProxy_ReadOnly<double> (this, "height"); } -Glib::PropertyProxy<Gtk::AnchorType> ImageFrame::property_anchor() +Glib::PropertyProxy<Gtk::AnchorType> ImageFrame::property_anchor() { return Glib::PropertyProxy<Gtk::AnchorType>(this, "anchor"); } diff --git a/gtk2_ardour/imageframe.h b/gtk2_ardour/imageframe.h index 76787f8b88..466d0804f5 100644 --- a/gtk2_ardour/imageframe.h +++ b/gtk2_ardour/imageframe.h @@ -6,7 +6,7 @@ /* rect.h - * + * * Copyright (C) 1998 EMC Capital Management Inc. * Developed by Havoc Pennington <hp@pobox.com> * diff --git a/gtk2_ardour/imageframe_p.h b/gtk2_ardour/imageframe_p.h index 6b0b2bffca..e37a6eaa64 100644 --- a/gtk2_ardour/imageframe_p.h +++ b/gtk2_ardour/imageframe_p.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/imageframe_socket_handler.cc b/gtk2_ardour/imageframe_socket_handler.cc index 2838be6f66..51ff6732c6 100644 --- a/gtk2_ardour/imageframe_socket_handler.cc +++ b/gtk2_ardour/imageframe_socket_handler.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,7 +63,7 @@ ImageFrameSocketHandler* ImageFrameSocketHandler::_instance = 0 ; */ ImageFrameSocketHandler::ImageFrameSocketHandler(PublicEditor& ed) : thePublicEditor(ed), theArdourToCompositorSocket(-1) { - + } /** @@ -82,7 +82,7 @@ ImageFrameSocketHandler::~ImageFrameSocketHandler() * * @return the instance of the ImageFrameSocketHandler */ -ImageFrameSocketHandler* +ImageFrameSocketHandler* ImageFrameSocketHandler::get_instance() { return(_instance) ; @@ -125,7 +125,7 @@ ImageFrameSocketHandler::image_socket_callback(void *arg, int32_t fd, GdkInputCo { //end-of-file, other end closed or shutdown? ARDOUR_UI::instance()->popup_error(_("Image Compositor Socket has been shutdown/closed")); - + // assume socket has been shutdown, tell, someone interested, // and remove the socket from the event loop ImageFrameSocketHandler* ifsh = ImageFrameSocketHandler::get_instance() ; @@ -137,7 +137,7 @@ ImageFrameSocketHandler::image_socket_callback(void *arg, int32_t fd, GdkInputCo { //std::cout << "Received Msg [" << buf << "]\n" ; ImageFrameSocketHandler* ifsh = ImageFrameSocketHandler::get_instance() ; - + std::string mType = ifsh->get_message_part(0,2,buf) ; if(mType == ardourvis::INSERT_ITEM) @@ -170,10 +170,10 @@ ImageFrameSocketHandler::image_socket_callback(void *arg, int32_t fd, GdkInputCo } else { - std::string errMsg = "Unknown Message type : " ; + std::string errMsg = "Unknown Message type : " ; errMsg.append(mType) ; ifsh->send_return_failure(errMsg) ; - } + } } } @@ -193,29 +193,29 @@ ImageFrameSocketHandler::connect(const char * hostIp, int32_t port) //already connected... return(true) ; } - + theArdourToCompositorSocket = socket(AF_INET, SOCK_STREAM, 0) ; if(theArdourToCompositorSocket == -1) { return(false) ; } - + int on = 1 ; setsockopt(theArdourToCompositorSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on)) ; - + sockaddr_in m_addr ; m_addr.sin_family = AF_INET ; m_addr.sin_port = htons(port) ; m_addr.sin_addr.s_addr = inet_addr(hostIp) ; - + int status = ::connect(theArdourToCompositorSocket, (sockaddr *) &m_addr, sizeof(m_addr)) ; - + if(status == -1) { - theArdourToCompositorSocket = -1 ; + theArdourToCompositorSocket = -1 ; return(false) ; } - + return(true) ; } @@ -284,7 +284,7 @@ ImageFrameSocketHandler::get_socket_descriptor() //---------------------------------------------------------------------------------------// // Handle Sending messages to the Image Compositor - + //---------------------------- // ImageFrameTimeAxis Messages @@ -302,25 +302,25 @@ ImageFrameSocketHandler::send_imageframe_time_axis_removed(const string & track_ // ie the change originated from us, then dont send any message back return ; } - + // create a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::REMOVE_ITEM << ardourvis::IMAGEFRAME_TIME_AXIS ; - + // add the id length, and the id msgBuffer << std::setw(3) << track_id.length() ; msgBuffer << track_id ; - + send_message(msgBuffer.str()) ; // XXX should do something with the return std::string retmsg ; read_message(retmsg) ; } - + /** * Sends a message indicating that an ImageFrameTimeAxis has been renamed * @@ -333,28 +333,28 @@ void ImageFrameSocketHandler::send_imageframe_time_axis_renamed(const string & new_id, const string & old_id, void* src, ImageFrameTimeAxis* time_axis) { // ENSURE_GUI_THREAD(SigC::bind (mem_fun(*this, &ImageFrameSocketHandler::send_imageframe_time_axis_renamed), new_id, old_id, src, time_axis)); - + if(this == src || src == 0) { // ie the change originated from us, then dont send any message back return ; } - + // create a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::RENAME_ITEM << ardourvis::IMAGEFRAME_TIME_AXIS ; - + // add the old id and length msgBuffer << std::setw(3) << old_id.length() ; msgBuffer << old_id ; - + // add the new id and length msgBuffer << std::setw(3) << new_id.length() ; msgBuffer << new_id ; - + send_message(msgBuffer.str()) ; // XXX should do something with the return @@ -364,7 +364,7 @@ ImageFrameSocketHandler::send_imageframe_time_axis_renamed(const string & new_id //------------------------ // MarkerTimeAxis Messages - + /** * Sends a message stating that the named marker time axis has been removed * @@ -379,25 +379,25 @@ ImageFrameSocketHandler::send_marker_time_axis_removed(const string & track_id, // ie the change originated from us, then dont send any message back return ; } - + // create a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::REMOVE_ITEM << ardourvis::MARKER_TIME_AXIS ; - + // add the id length, and the id msgBuffer << std::setw(3) << track_id.length() ; msgBuffer << track_id ; - + send_message(msgBuffer.str()) ; // XXX should do something with the return std::string retmsg ; read_message(retmsg) ; } - + /** * Sends a message indicating that an MarkerTimeAxis has been renamed * @@ -410,30 +410,30 @@ void ImageFrameSocketHandler::send_marker_time_axis_renamed(const string & new_id, const string & old_id, void* src, MarkerTimeAxis* time_axis) { // ENSURE_GUI_THREAD(bind (mem_fun(*this, &ImageFrameSocketHandler::send_marker_time_axis_renamed), new_id, old_id, src, time_axis)); - + if(this == src || src == 0) { // ie the change originated from us, then dont send any message back return ; } - + // ctreate a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::RENAME_ITEM << ardourvis::MARKER_TIME_AXIS ; - + // add the old id and length msgBuffer << std::setw(3) << old_id.length() ; msgBuffer << old_id ; - + // add the new id and length msgBuffer << std::setw(3) << new_id.length() ; msgBuffer << new_id ; - + send_message(msgBuffer.str()) ; - + // XXX should do something with the return std::string retmsg ; read_message(retmsg) ; @@ -457,23 +457,23 @@ ImageFrameSocketHandler::send_imageframe_time_axis_group_removed(const string & // ie the change originated from us, then dont send any message back return ; } - + // create a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::REMOVE_ITEM << ardourvis::IMAGEFRAME_GROUP ; - + // add the id length, and the id of the parent image time axis std::string track_id = group->get_view().trackview().name() ; msgBuffer << std::setw(3) << track_id.length() ; msgBuffer << track_id ; - + // add the group id and length msgBuffer << std::setw(3) << group_id.length() ; msgBuffer << group_id ; - + send_message(msgBuffer.str()) ; // XXX should do something with the return @@ -493,34 +493,34 @@ void ImageFrameSocketHandler::send_imageframe_time_axis_group_renamed(const string & new_id, const string & old_id, void* src, ImageFrameTimeAxisGroup* group) { // ENSURE_GUI_THREAD(bind (mem_fun(*this, &ImageFrameSocketHandler::send_imageframe_time_axis_group_renamed), new_id, old_id, src, group)); - + if(this == src || src == 0) { // ie the change originated from us, then dont send any message back return ; } - + // ctreate a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::RENAME_ITEM << ardourvis::IMAGEFRAME_GROUP ; - + // add the track this group is upon std::string track_id = group->get_view().trackview().name() ; - msgBuffer << std::setw(3) << track_id.length() << track_id ; - + msgBuffer << std::setw(3) << track_id.length() << track_id ; + // add the old id and length msgBuffer << std::setw(3) << old_id.length() ; msgBuffer << old_id ; - + // add the new id and length msgBuffer << std::setw(3) << new_id.length() ; msgBuffer << new_id ; - + send_message(msgBuffer.str()) ; - + // XXX should do something with the return std::string retmsg ; read_message(retmsg) ; @@ -529,7 +529,7 @@ ImageFrameSocketHandler::send_imageframe_time_axis_group_renamed(const string & //--------------------------------- // ImageFrameView Messages - + /** * Send an Image Frame View Item position changed message * @@ -541,31 +541,31 @@ void ImageFrameSocketHandler::send_imageframe_view_position_change(nframes_t pos, void* src, ImageFrameView* item) { // ENSURE_GUI_THREAD(bind (mem_fun(*this, &ImageFrameSocketHandler::send_imageframe_view_position_change), pos, src, item)); - + if(this == src || src == 0) { return ; } - + // create a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::ITEM_UPDATE << ardourvis::IMAGEFRAME_ITEM << ardourvis::POSITION_CHANGE ; - + // add the item description this->compose_imageframe_item_desc(item, msgBuffer) ; msgBuffer << std::setw(ardourvis::TIME_VALUE_CHARS) << pos ; - + send_message(msgBuffer.str()) ; - + // XXX should do something with the return std::string retmsg ; read_message(retmsg) ; } - + /** * Send a Image Frame View item duration changed message * @@ -577,30 +577,30 @@ void ImageFrameSocketHandler::send_imageframe_view_duration_change(nframes_t dur, void* src, ImageFrameView* item) { // ENSURE_GUI_THREAD(bind (mem_fun(*this, &ImageFrameSocketHandler::send_imageframe_view_duration_change), dur, src, item)); - + if(this == src || src == 0) { return ; } - + // create a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::ITEM_UPDATE << ardourvis::IMAGEFRAME_ITEM << ardourvis::DURATION_CHANGE ; - + this->compose_imageframe_item_desc(item, msgBuffer) ; msgBuffer << std::setw(ardourvis::TIME_VALUE_CHARS) << dur ; - + send_message(msgBuffer.str()) ; - + // XXX should do something with the return std::string retmsg ; read_message(retmsg) ; } - + /** * Send a message indicating that an ImageFrameView has been renamed * @@ -616,27 +616,27 @@ ImageFrameSocketHandler::send_imageframe_view_renamed(const string & new_id, con // ie the change originated from us, then dont send any message back return ; } - + // ctreate a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::RENAME_ITEM << ardourvis::IMAGEFRAME_ITEM ; - + this->compose_imageframe_item_desc(item, msgBuffer) ; - + // add the old id and length msgBuffer << std::setw(3) << old_id.length() ; msgBuffer << old_id ; - + send_message(msgBuffer.str()) ; - + // XXX should do something with the return std::string retmsg ; read_message(retmsg) ; } - + /** * Send a message indicating that an ImageFrameView item has been removed message * @@ -651,14 +651,14 @@ ImageFrameSocketHandler::send_imageframe_view_removed(const string & item_id, vo // ie the change originated from us, then dont send any message back return ; } - + // create a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::REMOVE_ITEM << ardourvis::IMAGEFRAME_ITEM ; - + // add the id length, and the id ImageFrameTimeAxisGroup* parentGroup = item->get_time_axis_group() ; std::string group_id = parentGroup->get_group_name() ; @@ -666,7 +666,7 @@ ImageFrameSocketHandler::send_imageframe_view_removed(const string & item_id, vo msgBuffer << std::setw(3) << track_id.length() << track_id ; msgBuffer << std::setw(3) << group_id.length() << group_id ; msgBuffer << std::setw(3) << item_id.length() << item_id ; - + send_message(msgBuffer.str()) ; // XXX should do something with the return @@ -679,7 +679,7 @@ ImageFrameSocketHandler::send_imageframe_view_removed(const string & item_id, vo //--------------------------------- // MarkerView Messages - + /** * Send a Marker View Item position changed message * @@ -694,26 +694,26 @@ ImageFrameSocketHandler::send_marker_view_position_change(nframes_t pos, void* s { return ; } - + // create a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::ITEM_UPDATE << ardourvis::MARKER_ITEM << ardourvis::POSITION_CHANGE ; - + // add the item description this->compose_marker_item_desc(item, msgBuffer) ; msgBuffer << std::setw(ardourvis::TIME_VALUE_CHARS) << pos ; - + send_message(msgBuffer.str()) ; // XXX should do something with the return std::string retmsg ; read_message(retmsg) ; } - + /** * Send a Marker View item duration changed message * @@ -728,26 +728,26 @@ ImageFrameSocketHandler::send_marker_view_duration_change(nframes_t dur, void* s { return ; } - + // create a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::ITEM_UPDATE << ardourvis::MARKER_ITEM << ardourvis::DURATION_CHANGE ; - + this->compose_marker_item_desc(item, msgBuffer) ; msgBuffer << std::setw(ardourvis::TIME_VALUE_CHARS) << dur ; - + send_message(msgBuffer.str()) ; // XXX should do something with the return std::string retmsg ; read_message(retmsg) ; -} +} + - /** * Send a message indicating that a MarkerView has been renamed * @@ -764,27 +764,27 @@ ImageFrameSocketHandler::send_marker_view_renamed(const string & new_id, const s // ie the change originated from us, then dont send any message back return ; } - + // ctreate a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::RENAME_ITEM << ardourvis::MARKER_ITEM ; - + this->compose_marker_item_desc(item, msgBuffer) ; - + // add the old id and length msgBuffer << std::setw(3) << old_id.length() ; msgBuffer << old_id ; - + send_message(msgBuffer.str()) ; - + // XXX should do something with the return std::string retmsg ; read_message(retmsg) ; } - + /** * Send a message indicating that a MarkerView item has been removed message * @@ -793,26 +793,26 @@ ImageFrameSocketHandler::send_marker_view_renamed(const string & new_id, const s * @param item the MarkerView which has been removed */ void -ImageFrameSocketHandler::send_marker_view_removed(const string & item_id, void* src, MarkerView* item) +ImageFrameSocketHandler::send_marker_view_removed(const string & item_id, void* src, MarkerView* item) { if(this == src || src == 0) { // ie the change originated from us, then dont send any message back return ; } - + // create a message buffer std::ostringstream msgBuffer ; msgBuffer << std::setfill('0') ; - + // add the msg type msgBuffer << ardourvis::REMOVE_ITEM << ardourvis::MARKER_ITEM ; - + // add the id length, and the id std::string track_id = item->get_time_axis_view().name() ; msgBuffer << std::setw(3) << track_id.length() << track_id ; msgBuffer << std::setw(3) << item_id.length() << item_id ; - + send_message(msgBuffer.str()) ; // XXX should do something with the return @@ -834,7 +834,7 @@ ImageFrameSocketHandler::send_marker_view_removed(const string & item_id, void* //---------------------------------------------------------------------------------------// //---------------------------------------------------------------------------------------// // Message breakdown ie avoid a big if...then...else - + /** * Handle insert item requests @@ -846,7 +846,7 @@ ImageFrameSocketHandler::handle_insert_message(const char* msg) { // handle the insert item message // determine the object type to insert based upon characters 2-3 - + std::string oType = get_message_part(2,2,msg) ; if(oType == ardourvis::IMAGEFRAME_TIME_AXIS) @@ -871,7 +871,7 @@ ImageFrameSocketHandler::handle_insert_message(const char* msg) } else { - std::string errMsg = "Unknown Object type during insert: " ; + std::string errMsg = "Unknown Object type during insert: " ; errMsg.append(oType) ; send_return_failure(errMsg) ; } @@ -887,7 +887,7 @@ ImageFrameSocketHandler::handle_remove_message(const char* msg) { // handle the removal of an item message // determine the object type to remove based upon characters 2-3 - + std::string oType = get_message_part(2,2,msg) ; if(oType == ardourvis::IMAGEFRAME_TIME_AXIS) @@ -908,7 +908,7 @@ ImageFrameSocketHandler::handle_remove_message(const char* msg) } else { - std::string errMsg = "Unknown Object type during Remove: " ; + std::string errMsg = "Unknown Object type during Remove: " ; errMsg.append(oType) ; send_return_failure(errMsg) ; } @@ -924,9 +924,9 @@ ImageFrameSocketHandler::handle_rename_message(const char* msg) { // handle the renaming of an item message // determine the object type to rename based upon characters 2-3 - + std::string oType = get_message_part(2,2,msg) ; - + if(oType == ardourvis::IMAGEFRAME_TIME_AXIS) { this->handle_rename_imageframe_time_axis(msg) ; @@ -945,7 +945,7 @@ ImageFrameSocketHandler::handle_rename_message(const char* msg) } else { - std::string errMsg = "Unknown Object type during Rename: " ; + std::string errMsg = "Unknown Object type during Rename: " ; errMsg.append(oType) ; send_return_failure(errMsg) ; } @@ -961,7 +961,7 @@ ImageFrameSocketHandler::handle_request_data(const char* msg) { // determine the request type std::string reqType = get_message_part(2,2,msg) ; - + if(reqType == ardourvis::SESSION_NAME) { handle_session_name_request(msg) ; @@ -973,15 +973,15 @@ ImageFrameSocketHandler::handle_request_data(const char* msg) * * @param msg the received message */ -void +void ImageFrameSocketHandler::handle_item_update_message(const char* msg) { // determin the object that requires updating, characters 2-3 std::string oType = get_message_part(2,2,msg) ; - + // What needs updating? chars 4-5 std::string attr = get_message_part(4,2,msg) ; - + if(oType == ardourvis::IMAGEFRAME_ITEM) { if(attr == ardourvis::POSITION_CHANGE) @@ -1014,7 +1014,7 @@ ImageFrameSocketHandler::handle_item_update_message(const char* msg) } else { - std::string errMsg = "Unknown Attribute during Item Update: " ; + std::string errMsg = "Unknown Attribute during Item Update: " ; errMsg.append(oType) ; send_return_failure(errMsg) ; } @@ -1031,14 +1031,14 @@ ImageFrameSocketHandler::handle_item_update_message(const char* msg) } else { - std::string errMsg = "Unknown Attribute during Item Update: " ; + std::string errMsg = "Unknown Attribute during Item Update: " ; errMsg.append(oType) ; send_return_failure(errMsg) ; } } else { - std::string errMsg = "Unknown Object type during Item Update: " ; + std::string errMsg = "Unknown Object type during Item Update: " ; errMsg.append(oType) ; send_return_failure(errMsg) ; } @@ -1054,23 +1054,23 @@ ImageFrameSocketHandler::handle_item_selected(const char* msg) { // determine the object that requires updating, characters 2-3 std::string oType = get_message_part(2,2,msg) ; - + if(oType == std::string(ardourvis::IMAGEFRAME_ITEM)) { int position = 4 ; // message type chars - + std::string track_id ; std::string scene_id ; std::string item_id ; int track_id_size ; int scene_id_size ; int item_id_size ; - + this->decompose_imageframe_item_desc(msg, position, track_id, track_id_size, scene_id, scene_id_size, item_id, item_id_size) ; - + // get the named time axis ImageFrameTimeAxis* ifta = dynamic_cast<ImageFrameTimeAxis*>(thePublicEditor.get_named_time_axis(track_id)) ; - + if(!ifta) { send_return_failure(std::string("No parent Image Track found : ").append(track_id)) ; @@ -1112,7 +1112,7 @@ void ImageFrameSocketHandler::handle_session_action(const char* msg) { std::string actionType = get_message_part(2,2,msg) ; - + if(actionType == ardourvis::OPEN_SESSION) { this->handle_open_session(msg) ; @@ -1129,7 +1129,7 @@ ImageFrameSocketHandler::handle_session_action(const char* msg) //---------------------------------------------------------------------------------------// // handlers for specific insert procedures - + /** * Handle the insertion of a new ImaegFrameTimeAxis * @@ -1139,15 +1139,15 @@ void ImageFrameSocketHandler::handle_insert_imageframe_time_axis(const char* msg) { int position = 4 ; // message type chars - + // get the ImageFrameTrack name size int track_name_size = atoi(get_message_part(position, ardourvis::TEXT_SIZE_CHARS, msg).c_str()) ; position += ardourvis::TEXT_SIZE_CHARS ; - + // get the image frame track name std::string track_name = get_message_part(position, track_name_size, msg) ; position += track_name_size ; - + // check we dont already have an time axis with that name TimeAxisView* tav = thePublicEditor.get_named_time_axis(track_name) ; if(tav) @@ -1160,19 +1160,19 @@ ImageFrameSocketHandler::handle_insert_imageframe_time_axis(const char* msg) { thePublicEditor.add_imageframe_time_axis(track_name, this) ; TimeAxisView* new_tav = thePublicEditor.get_named_time_axis(track_name) ; - + if(new_tav) { ImageFrameTimeAxis* ifta = (ImageFrameTimeAxis*)new_tav ; ifta->VisualTimeAxisRemoved.connect(sigc::mem_fun(*this, &ImageFrameSocketHandler::send_imageframe_time_axis_removed)) ; ifta->NameChanged.connect(sigc::bind(sigc::mem_fun(*this, &ImageFrameSocketHandler::send_imageframe_time_axis_renamed), ifta)) ; - + send_return_success() ; } else { std::string msg("Addition Failed: ") ; - msg.append(track_name) ; + msg.append(track_name) ; send_return_failure(msg) ; } } @@ -1188,20 +1188,20 @@ void ImageFrameSocketHandler::handle_insert_marker_time_axis(const char* msg) { int position = 4 ; // message type chars - + // get the ImageFrameTrack name size int track_name_size = atoi(get_message_part(position, ardourvis::TEXT_SIZE_CHARS, msg).c_str()) ; position += ardourvis::TEXT_SIZE_CHARS ; - + // get the image frame track name std::string track_name = get_message_part(position, track_name_size, msg) ; position += track_name_size ; - + // get the size of the name of the associated track int assoc_track_name_size = atoi(get_message_part(position, ardourvis::TEXT_SIZE_CHARS, msg).c_str()) ; position += ardourvis::TEXT_SIZE_CHARS ; - - // get the name of the track we associate the marker track with + + // get the name of the track we associate the marker track with std::string assoc_track_name = get_message_part(position, assoc_track_name_size, msg) ; position += assoc_track_name_size ; @@ -1221,9 +1221,9 @@ ImageFrameSocketHandler::handle_insert_marker_time_axis(const char* msg) { thePublicEditor.add_imageframe_marker_time_axis(track_name, assoc_tav, this) ; TimeAxisView* new_tav = thePublicEditor.get_named_time_axis(track_name) ; - + bool added = false ; - + if(new_tav) { MarkerTimeAxis* mta = dynamic_cast<MarkerTimeAxis*>(new_tav) ; @@ -1234,11 +1234,11 @@ ImageFrameSocketHandler::handle_insert_marker_time_axis(const char* msg) mta->NameChanged.connect(sigc::bind(sigc::mem_fun(*this, &ImageFrameSocketHandler::send_marker_time_axis_renamed), mta)) ; } } - + if(added) { std::string msg("Addition Failed: ") ; - msg.append(track_name) ; + msg.append(track_name) ; send_return_failure(msg) ; } } @@ -1260,34 +1260,34 @@ void ImageFrameSocketHandler::handle_insert_imageframe_group(const char* msg) { int position = 4 ; // message type chars - + // get the ImageFrameTrack name size int track_name_size = atoi(get_message_part(position, ardourvis::TEXT_SIZE_CHARS, msg).c_str()) ; position += ardourvis::TEXT_SIZE_CHARS ; - + // get the image frame track name std::string track_name = get_message_part(position, track_name_size, msg) ; position += track_name_size ; - + // get the scene id size int scene_id_size = atoi(get_message_part(position, ardourvis::TEXT_SIZE_CHARS, msg).c_str()) ; position += ardourvis::TEXT_SIZE_CHARS ; - + // get the scene id std::string scene_id = get_message_part(position, scene_id_size, msg) ; position += scene_id_size ; - - + + // get the named ImageFrameTrack ImageFrameTimeAxis* ifta = dynamic_cast<ImageFrameTimeAxis*>(thePublicEditor.get_named_time_axis(track_name)) ; - + // check we got a valid ImageFrameTimeAxis if(!ifta) { send_return_failure(std::string("No Image Frame Time Axis Found: ").append(track_name)) ; return ; } - + ImageFrameTimeAxisGroup* iftag = ifta->get_view()->add_imageframe_group(scene_id, this) ; if(!iftag) { @@ -1311,35 +1311,35 @@ void ImageFrameSocketHandler::handle_insert_imageframe_view(const char* msg) { int position = 4 ; // message type chars - + // get the ImageFrameTrack name size int track_name_size = atoi(get_message_part(position,3,msg).c_str()) ; position += 3 ; - + // get the ImageFrameTrack Name std::string imageframe_track_name = get_message_part(position,track_name_size,msg) ; position += track_name_size ; - + // get the scene name size int scene_size = atoi(get_message_part(position,3,msg).c_str()) ; position += 3 ; - + // get the scene Name std::string scene_name = get_message_part(position,scene_size,msg) ; position += scene_size ; - + // get the image frame_id size int image_id_size = atoi(get_message_part(position,3,msg).c_str()) ; position += 3 ; - + // get the image frame_id std::string image_id = get_message_part(position,image_id_size,msg) ; position += image_id_size ; - + // get the start frame value nframes_t start = strtoul((get_message_part(position,10,msg).c_str()),0,10) ; position += 10 ; - + // get the duration value nframes_t duration = strtoul((get_message_part(position,10,msg).c_str()),0,10) ; position += 10 ; @@ -1347,23 +1347,23 @@ ImageFrameSocketHandler::handle_insert_imageframe_view(const char* msg) //get the named time axis view we about to add an image to TimeAxisView* tav = thePublicEditor.get_named_time_axis(imageframe_track_name) ; ImageFrameTimeAxis* ifta = 0 ; - + if(tav) { ifta = dynamic_cast<ImageFrameTimeAxis*>(tav) ; } - + if(!ifta) { std::string errmsg("No Parent Image Track Found: ") ; errmsg.append(imageframe_track_name) ; send_return_failure(errmsg) ; - + // dont really like all these returns mid-way // but this is goinf to get awfully if..then nested if not return ; } - + // check the parent group exists ImageFrameTimeAxisGroup* iftag = ifta->get_view()->get_named_imageframe_group(scene_name) ; if(!iftag) @@ -1373,36 +1373,36 @@ ImageFrameSocketHandler::handle_insert_imageframe_view(const char* msg) send_return_failure(errmsg) ; return ; } - + // ok, so we have the parent group and track, now we need dome image data - - + + // // request the image data from the image compositor // - + // ctreate a message buffer std::ostringstream reqBuffer ; reqBuffer << std::setfill('0') ; - + // add the msg type reqBuffer << REQUEST_DATA << IMAGE_RGB_DATA ; - + // add the image track and size reqBuffer << std::setw(ardourvis::TEXT_SIZE_CHARS) << track_name_size ; reqBuffer << imageframe_track_name ; - + // add the scene id and size reqBuffer << std::setw(ardourvis::TEXT_SIZE_CHARS) << scene_size ; reqBuffer << scene_name ; - + // add the image id and size reqBuffer << std::setw(ardourvis::TEXT_SIZE_CHARS) << image_id_size ; reqBuffer << image_id ; - + // add the preferred image height reqBuffer << std::setw(ardourvis::TEXT_SIZE_CHARS) << ifta->get_image_display_height() ; - + // send the request message send_message(reqBuffer.str()) ; @@ -1413,13 +1413,13 @@ ImageFrameSocketHandler::handle_insert_imageframe_view(const char* msg) std::string init_image_data_msg ; read_message(init_image_data_msg) ; int init_msg_pos = 4 ; - + int imgWidth = atoi(init_image_data_msg.substr(init_msg_pos, ardourvis::IMAGE_SIZE_CHARS).c_str()) ; init_msg_pos += ardourvis::IMAGE_SIZE_CHARS ; int imgHeight = atoi(init_image_data_msg.substr(init_msg_pos, ardourvis::IMAGE_SIZE_CHARS).c_str()) ; init_msg_pos += ardourvis::IMAGE_SIZE_CHARS ; int imgChannels = atoi(init_image_data_msg.substr(init_msg_pos, ardourvis::IMAGE_SIZE_CHARS).c_str()) ; - init_msg_pos += ardourvis::IMAGE_SIZE_CHARS ; + init_msg_pos += ardourvis::IMAGE_SIZE_CHARS ; int imgSize = atoi(init_image_data_msg.substr(init_msg_pos, ardourvis::IMAGE_DATA_MESSAGE_SIZE_CHARS).c_str()) ; // send a success msg @@ -1444,7 +1444,7 @@ ImageFrameSocketHandler::handle_insert_imageframe_view(const char* msg) ifv->PositionChanged.connect(sigc::bind(sigc::mem_fun(*this, &ImageFrameSocketHandler::send_imageframe_view_position_change), ifv)) ; ifv->DurationChanged.connect(sigc::bind(sigc::mem_fun(*this, &ImageFrameSocketHandler::send_imageframe_view_duration_change), ifv)) ; ifv->ItemRemoved.connect(sigc::bind(sigc::mem_fun(*this, &ImageFrameSocketHandler::send_imageframe_view_removed), ifv)) ; - + send_return_success() ; } else @@ -1465,8 +1465,8 @@ ImageFrameSocketHandler::handle_insert_imageframe_view(const char* msg) void ImageFrameSocketHandler::handle_insert_marker_view(const char* msg) {} - - + + //---------------------------------------------------------------------------------------// // handlers for specific removal procedures @@ -1479,7 +1479,7 @@ ImageFrameSocketHandler::handle_insert_marker_view(const char* msg) void ImageFrameSocketHandler::handle_remove_imageframe_time_axis(const char* msg) {} - + /** * Handle the removal of an MarkerTimeAxis * @@ -1488,7 +1488,7 @@ ImageFrameSocketHandler::handle_remove_imageframe_time_axis(const char* msg) void ImageFrameSocketHandler::handle_remove_marker_time_axis(const char* msg) {} - + /** * Handle the removal of an ImageFrameTimeAxisGroup * @@ -1497,7 +1497,7 @@ ImageFrameSocketHandler::handle_remove_marker_time_axis(const char* msg) void ImageFrameSocketHandler::handle_remove_imageframe_time_axis_group(const char* msg) {} - + /** * Handle the removal of an ImageFrameItem * @@ -1506,7 +1506,7 @@ ImageFrameSocketHandler::handle_remove_imageframe_time_axis_group(const char* ms void ImageFrameSocketHandler::handle_remove_imageframe_view(const char* msg) {} - + /** * Handle the removal of an MarkerItem * @@ -1517,12 +1517,12 @@ ImageFrameSocketHandler::handle_remove_marker_view(const char* msg) {} - - + + //---------------------------------------------------------------------------------------// -// handlers for the specific rename procedures - +// handlers for the specific rename procedures + /** * Handle the renaming of an ImageTimeAxis * @@ -1532,25 +1532,25 @@ void ImageFrameSocketHandler::handle_rename_imageframe_time_axis(const char* msg) { // msg [MVIT][oldSize][oldId][newSize][newId] - + int position = 4 ; // message type chars // get the old Id size int old_id_size = atoi(get_message_part(position,3,msg).c_str()) ; position += 3 ; - + // get the old id std::string old_id = get_message_part(position,old_id_size,msg) ; position += old_id_size ; - + //get the new Id size int new_id_size = atoi(get_message_part(position,3,msg).c_str()) ; position += 3 ; - + // get the new Id std::string new_id = get_message_part(position,new_id_size,msg) ; position += new_id_size ; - + // get the Named time axis TimeAxisView* tav = thePublicEditor.get_named_time_axis(old_id) ; if(dynamic_cast<ImageFrameTimeAxis*>(tav)) @@ -1566,7 +1566,7 @@ ImageFrameSocketHandler::handle_rename_imageframe_time_axis(const char* msg) send_return_failure(msg) ; } } - + /** * Handle the renaming of an MarkerTimeAxis * @@ -1575,7 +1575,7 @@ ImageFrameSocketHandler::handle_rename_imageframe_time_axis(const char* msg) void ImageFrameSocketHandler::handle_rename_marker_time_axis(const char* msg) {} - + /** * Handle the renaming of an ImageFrameItem * @@ -1584,7 +1584,7 @@ ImageFrameSocketHandler::handle_rename_marker_time_axis(const char* msg) void ImageFrameSocketHandler::handle_rename_imageframe_time_axis_group(const char* msg) {} - + /** * Handle the renaming of an ImageFrameItem * @@ -1593,7 +1593,7 @@ ImageFrameSocketHandler::handle_rename_imageframe_time_axis_group(const char* ms void ImageFrameSocketHandler::handle_rename_imageframe_view(const char* msg) {} - + /** * Handle the renaming of an Marker * @@ -1602,13 +1602,13 @@ ImageFrameSocketHandler::handle_rename_imageframe_view(const char* msg) void ImageFrameSocketHandler::handle_rename_marker_view(const char* msg) {} - - - + + + //---------------------------------------------------------------------------------------// // handlers for data request - + /** * Handle a request for the sessnio naem fo the current session * We return a failure state if no session is open @@ -1619,7 +1619,7 @@ void ImageFrameSocketHandler::handle_session_name_request(const char* msg) { ARDOUR::Session* currentSession = thePublicEditor.current_session() ; - + if(currentSession == 0) { // no current session, return failure @@ -1630,14 +1630,14 @@ ImageFrameSocketHandler::handle_session_name_request(const char* msg) { std::string sessionName = currentSession->name() ; std::string sessionPath = currentSession->path() ; - + if(sessionPath[sessionPath.length() -1] != '/') { sessionPath.append("/") ; } - + sessionPath.append(sessionName) ; - + std::ostringstream msgBuf ; msgBuf << ardourvis::RETURN_DATA << ardourvis::SESSION_NAME ; msgBuf << std::setfill('0') ; @@ -1646,14 +1646,14 @@ ImageFrameSocketHandler::handle_session_name_request(const char* msg) send_message(msgBuf.str()) ; } } - - + + //---------------------------------------------------------------------------------------// // handlers for specific item update changes - + /** * Handle ImageFrameView positional changes * @@ -1663,28 +1663,28 @@ void ImageFrameSocketHandler::handle_imageframe_view_position_update(const char* msg) { int position = 6 ; // message type chars - + std::string track_id ; std::string scene_id ; std::string item_id ; int track_id_size ; int scene_id_size ; int item_id_size ; - + this->decompose_imageframe_item_desc(msg, position, track_id, track_id_size, scene_id, scene_id_size, item_id, item_id_size) ; - + nframes_t start_frame = strtoul(get_message_part(position, ardourvis::TIME_VALUE_CHARS, msg).c_str(), 0, 10) ; position += ardourvis::TIME_VALUE_CHARS ; - + // get the named time axis ImageFrameTimeAxis* ifta = dynamic_cast<ImageFrameTimeAxis*>(thePublicEditor.get_named_time_axis(track_id)) ; - + if(!ifta) { send_return_failure(std::string("No parent Image Track found: ").append(track_id)) ; return ; } - + // get the parent scene ImageFrameTimeAxisGroup* iftag = ifta->get_view()->get_named_imageframe_group(scene_id) ; if(!iftag) @@ -1692,20 +1692,20 @@ ImageFrameSocketHandler::handle_imageframe_view_position_update(const char* msg) send_return_failure(std::string("No parent Scene found: ").append(scene_id)) ; return ; } - + ImageFrameView* ifv = iftag->get_named_imageframe_item(item_id) ; - + if(!ifv) { send_return_failure(std::string("No Image Frame Item found: ").append(item_id)) ; return ; } - + ifv->set_position(start_frame, this) ; send_return_success() ; } - + /** * Handle ImageFrameView Duration changes * @@ -1715,28 +1715,28 @@ void ImageFrameSocketHandler::handle_imageframe_view_duration_update(const char* msg) { int position = 6 ; // message type chars - + std::string track_id ; std::string scene_id ; std::string item_id ; int track_id_size ; int scene_id_size ; int item_id_size ; - + this->decompose_imageframe_item_desc(msg, position, track_id, track_id_size, scene_id, scene_id_size, item_id, item_id_size) ; - + nframes_t duration = strtoul(get_message_part(position,ardourvis::TIME_VALUE_CHARS,msg).c_str(),0,10) ; position += ardourvis::TIME_VALUE_CHARS ; - + // get the named time axis ImageFrameTimeAxis* ifta = dynamic_cast<ImageFrameTimeAxis*>(thePublicEditor.get_named_time_axis(track_id)) ; - + if(!ifta) { send_return_failure(std::string("No parent Image Track found : ").append(track_id)) ; return ; } - + // get the parent scene ImageFrameTimeAxisGroup* iftag = ifta->get_view()->get_named_imageframe_group(scene_id) ; if(!iftag) @@ -1744,15 +1744,15 @@ ImageFrameSocketHandler::handle_imageframe_view_duration_update(const char* msg) send_return_failure(std::string("No parent Scene found : ").append(scene_id)) ; return ; } - + ImageFrameView* ifv = iftag->get_named_imageframe_item(item_id) ; - + if(!ifv) { send_return_failure(std::string("No Image Frame Item found : ").append(item_id)) ; return ; } - + ifv->set_duration(duration, this) ; send_return_success() ; } @@ -1766,19 +1766,19 @@ void ImageFrameSocketHandler::handle_imageframe_position_lock_update(const char* msg) { int position = 6 ; // message type chars - + std::string track_id ; std::string group_id ; std::string item_id ; int track_id_size ; int group_id_size ; int item_id_size ; - + this->decompose_imageframe_item_desc(msg, position, track_id, track_id_size, group_id, group_id_size, item_id, item_id_size) ; - + std::string pos_lock = get_message_part(position,1,msg) ; bool pos_lock_active = false ; - + if(pos_lock == "0") { pos_lock_active = false ; @@ -1792,9 +1792,9 @@ ImageFrameSocketHandler::handle_imageframe_position_lock_update(const char* msg) send_return_failure(std::string("Unknown Value used during Position Loack: ").append(pos_lock)) ; return ; } - + position += 1 ; - + int errcode ; std::string errmsg ; ImageFrameView* ifv = get_imageframe_view_from_desc(track_id, group_id, item_id, errcode, errmsg) ; @@ -1808,7 +1808,7 @@ ImageFrameSocketHandler::handle_imageframe_position_lock_update(const char* msg) send_return_failure(errmsg) ; } } - + /** * Handle ImageFrameView Maximum Duration changes * @@ -1818,19 +1818,19 @@ void ImageFrameSocketHandler::handle_imageframe_view_max_duration_update(const char* msg) { int position = 6 ; // message type chars - + std::string track_id ; std::string group_id ; std::string item_id ; int track_id_size ; int group_id_size ; int item_id_size ; - + this->decompose_imageframe_item_desc(msg, position, track_id, track_id_size, group_id, group_id_size, item_id, item_id_size) ; - + nframes_t max_duration = strtoul(get_message_part(position,ardourvis::TIME_VALUE_CHARS,msg).c_str(),0,10) ; position += ardourvis::TIME_VALUE_CHARS ; - + int errcode ; std::string errmsg ; ImageFrameView* ifv = get_imageframe_view_from_desc(track_id, group_id, item_id, errcode, errmsg) ; @@ -1844,7 +1844,7 @@ ImageFrameSocketHandler::handle_imageframe_view_max_duration_update(const char* send_return_failure(errmsg) ; } } - + /** * Handle image frame max duration enable constraint changes * @@ -1854,19 +1854,19 @@ void ImageFrameSocketHandler::handle_imageframe_view_max_duration_enable_update(const char* msg) { int position = 6 ; // message type chars - + std::string track_id ; std::string group_id ; std::string item_id ; int track_id_size ; int group_id_size ; int item_id_size ; - + this->decompose_imageframe_item_desc(msg, position, track_id, track_id_size, group_id, group_id_size, item_id, item_id_size) ; - + std::string active = get_message_part(position,1,msg) ; bool max_duration_active = false ; - + if(active == "0") { max_duration_active = false ; @@ -1880,9 +1880,9 @@ ImageFrameSocketHandler::handle_imageframe_view_max_duration_enable_update(const send_return_failure(std::string("Unknown Value used during enable max duration: ").append(active)) ; return ; } - + position += 1 ; - + int errcode ; std::string errmsg ; ImageFrameView* ifv = get_imageframe_view_from_desc(track_id, group_id, item_id, errcode, errmsg) ; @@ -1896,7 +1896,7 @@ ImageFrameSocketHandler::handle_imageframe_view_max_duration_enable_update(const send_return_failure(errmsg) ; } } - + /** * Handle ImageFrameView Minimum Duration changes * @@ -1906,19 +1906,19 @@ void ImageFrameSocketHandler::handle_imageframe_view_min_duration_update(const char* msg) { int position = 6 ; // message type chars - + std::string track_id ; std::string group_id ; std::string item_id ; int track_id_size ; int group_id_size ; int item_id_size ; - + this->decompose_imageframe_item_desc(msg, position, track_id, track_id_size, group_id, group_id_size, item_id, item_id_size) ; - + nframes_t min_duration = strtoul(get_message_part(position,ardourvis::TIME_VALUE_CHARS,msg).c_str(),0,10) ; position += ardourvis::TIME_VALUE_CHARS ; - + int errcode ; std::string errmsg ; ImageFrameView* ifv = get_imageframe_view_from_desc(track_id, group_id, item_id, errcode, errmsg) ; @@ -1932,7 +1932,7 @@ ImageFrameSocketHandler::handle_imageframe_view_min_duration_update(const char* send_return_failure(errmsg) ; } } - + /** * Handle image frame min duration enable constraint changes * @@ -1942,19 +1942,19 @@ void ImageFrameSocketHandler::handle_imageframe_view_min_duration_enable_update(const char* msg) { int position = 6 ; // message type chars - + std::string track_id ; std::string group_id ; std::string item_id ; int track_id_size ; int group_id_size ; int item_id_size ; - + this->decompose_imageframe_item_desc(msg, position, track_id, track_id_size, group_id, group_id_size, item_id, item_id_size) ; - + std::string active = get_message_part(position,1,msg) ; bool min_duration_active = false ; - + if(active == "0") { min_duration_active = false ; @@ -1968,9 +1968,9 @@ ImageFrameSocketHandler::handle_imageframe_view_min_duration_enable_update(const send_return_failure(std::string("Unknown Value used during enable max duration: ").append(active)) ; return ; } - + position += 1 ; - + int errcode ; std::string errmsg ; ImageFrameView* ifv = get_imageframe_view_from_desc(track_id, group_id, item_id, errcode, errmsg) ; @@ -1984,7 +1984,7 @@ ImageFrameSocketHandler::handle_imageframe_view_min_duration_enable_update(const send_return_failure(errmsg) ; } } - + /** * Handle MarkerView position changes * @@ -1993,7 +1993,7 @@ ImageFrameSocketHandler::handle_imageframe_view_min_duration_enable_update(const void ImageFrameSocketHandler::handle_marker_view_position_update(const char* msg) {} - + /** * Handle MarkerView duration changes * @@ -2012,7 +2012,7 @@ void ImageFrameSocketHandler::handle_marker_view_position_lock_update(const char* msg) { } - + /** * Handle MarkerView maximum duration changes * @@ -2021,7 +2021,7 @@ ImageFrameSocketHandler::handle_marker_view_position_lock_update(const char* msg void ImageFrameSocketHandler::handle_marker_view_max_duration_update(const char* msg) {} - + /** * Handle MarkerView minimum duration changes * @@ -2037,7 +2037,7 @@ ImageFrameSocketHandler::handle_marker_view_min_duration_update(const char* msg) //---------------------------------------------------------------------------------------// // handlers for Session Actions - + /** * Handle the opening of a named audio session * @@ -2047,19 +2047,19 @@ void ImageFrameSocketHandler::handle_open_session(const char* msg) { // msg [SAOS][sessionSize][sessionPath] - + int position = 4 ; // message type chars // get the session name size int session_name_size = atoi(get_message_part(position,3,msg).c_str()) ; position += 3 ; - + // get the session name std::string session_name = get_message_part(position,session_name_size,msg) ; position += session_name_size ; - - - // open the session + + + // open the session std::string path, name ; bool isnew; @@ -2076,7 +2076,7 @@ ImageFrameSocketHandler::handle_open_session(const char* msg) } } - + /** * Handle the closing of a named audio session * @@ -2085,10 +2085,10 @@ ImageFrameSocketHandler::handle_open_session(const char* msg) void ImageFrameSocketHandler::handle_closed_session(const char* msg) {} - + //---------------------------------------------------------------------------------------// // handlers for the shutdown of the Image Compositor - + /** * Handle the shutdown message from the image compositor * @@ -2107,11 +2107,11 @@ ImageFrameSocketHandler::handle_shutdown(const char* msg) - - + + //---------------------------------------------------------------------------------------// // convenince methods to break up messages - + /** * Returns part of the received message as a std::string * @@ -2127,7 +2127,7 @@ ImageFrameSocketHandler::get_message_part(int start, int32_t num_chars, const ch strncpy(buf,msg+start,num_chars) ; buf[num_chars] = '\0' ; std::string s(buf) ; - + return(s) ; } @@ -2152,23 +2152,23 @@ ImageFrameSocketHandler::decompose_imageframe_item_desc(const char* msg, int& po // get the track Id size track_id_size = atoi(get_message_part(position,ardourvis::TEXT_SIZE_CHARS,msg).c_str()) ; position += ardourvis::TEXT_SIZE_CHARS ; - + // get the track id track_id = get_message_part(position,track_id_size,msg) ; position += track_id_size ; - + // get the track Id size scene_id_size = atoi(get_message_part(position,ardourvis::TEXT_SIZE_CHARS,msg).c_str()) ; position += ardourvis::TEXT_SIZE_CHARS ; - + // get the scene id scene_id = get_message_part(position,scene_id_size,msg) ; position += scene_id_size ; - + // get the item id size item_id_size = atoi(get_message_part(position,ardourvis::TEXT_SIZE_CHARS,msg).c_str()) ; position += ardourvis::TEXT_SIZE_CHARS ; - + // get the item id item_id = get_message_part(position,item_id_size,msg) ; position += item_id_size ; @@ -2187,11 +2187,11 @@ ImageFrameSocketHandler::compose_imageframe_item_desc(ImageFrameView* ifv, std:: { buffer << std::setw(3) << ifv->get_time_axis_group()->get_view().trackview().name().length() ; buffer << ifv->get_time_axis_group()->get_view().trackview().name() ; - + // add the parent scene buffer << std::setw(3) << ifv->get_time_axis_group()->get_group_name().length() ; buffer << ifv->get_time_axis_group()->get_group_name() ; - + // add the ImageFrameItem id length and Id buffer << setw(3) << ifv->get_item_name().length() ; buffer << ifv->get_item_name() ; @@ -2209,17 +2209,17 @@ void ImageFrameSocketHandler::compose_marker_item_desc(MarkerView* mv, std::ostringstream& buffer) { MarkerTimeAxis* mta = dynamic_cast<MarkerTimeAxis*>(&mv->get_time_axis_view()) ; - + if(!mta) { return ; } - + buffer << std::setw(3) << mta->name().length() ; buffer << mta->name() ; - + buffer << std::setw(3) << mv->get_item_name().length() ; - buffer << mv->get_item_name() ; + buffer << mv->get_item_name() ; } @@ -2243,10 +2243,10 @@ ImageFrameView* ImageFrameSocketHandler::get_imageframe_view_from_desc(const string & track_id, const string & group_id, const string & item_id, int& errcode, std::string& errmsg) { ImageFrameView* item = 0 ; - + // get the named time axis ImageFrameTimeAxis* ifta = dynamic_cast<ImageFrameTimeAxis*>(thePublicEditor.get_named_time_axis(track_id)) ; - + if(!ifta) { errcode = 1 ; @@ -2277,7 +2277,7 @@ ImageFrameSocketHandler::get_imageframe_view_from_desc(const string & track_id, } } } - + return(item) ; } @@ -2299,10 +2299,10 @@ ImageFrameSocketHandler::send_message(const string & msg) { //std::cout << "Sending Message [" << msg << "]\n" ; int retcode = ::send(theArdourToCompositorSocket, msg.c_str(), msg.length(), MSG_NOSIGNAL) ; - + return(retcode) ; } - + /** * Reads a message from the Socket * @@ -2314,13 +2314,13 @@ ImageFrameSocketHandler::read_message(std::string& msg) { char buf[ardourvis::MAX_MSG_SIZE + 1] ; memset(buf, 0, (ardourvis::MAX_MSG_SIZE + 1)) ; - + msg = "" ; int retcode = ::recv(theArdourToCompositorSocket, buf, ardourvis::MAX_MSG_SIZE, 0) ; - + msg = buf ; //std::cout << "Received Message [" << msg << "]\n" ; - + return(retcode) ; } @@ -2348,6 +2348,6 @@ ImageFrameSocketHandler::send_return_failure(const std::string& msg) buf << ardourvis::RETURN_FALSE ; buf << std::setw(3) << msg.length(); ; buf << msg ; - + send_message(buf.str()) ; } diff --git a/gtk2_ardour/imageframe_socket_handler.h b/gtk2_ardour/imageframe_socket_handler.h index 739a718c86..d12b8285ef 100644 --- a/gtk2_ardour/imageframe_socket_handler.h +++ b/gtk2_ardour/imageframe_socket_handler.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @param ed the PublicEditor */ ImageFrameSocketHandler(PublicEditor& ed) ; - + /** * Descructor * this will shutdown the socket if open @@ -59,7 +59,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @return the instance of the ImageFrameSocketHandler */ static ImageFrameSocketHandler* get_instance() ; - + /** * call back to handle doing the processing work * This method is added to the gdk main loop and called when there is data @@ -67,7 +67,7 @@ class ImageFrameSocketHandler : public sigc::trackable * */ static void image_socket_callback(void *arg, int32_t fd, GdkInputCondition cond) ; - + /** * Attempt to connect to the image compositor on the specified host and port * @@ -77,19 +77,19 @@ class ImageFrameSocketHandler : public sigc::trackable * false otherwise */ bool connect(const char * hostIp, int32_t port) ; - + /** * Closes the connection to th Image Compositor * */ - void close_connection() ; + void close_connection() ; /** * Returns true if this ImagFrameSocketHandler is currently connected to rthe image compositor * * @return true if connected to the image compositor */ bool is_connected() ; - + /** * Sets the tag used to describe this input within gtk * this is returned when gdk_input_add is called and is required to remove the input @@ -97,7 +97,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @param tag the gdk input tag of this input */ void set_gdk_input_tag(int tag) ; - + /** * Returns the gdk input tag of this input * @@ -105,22 +105,22 @@ class ImageFrameSocketHandler : public sigc::trackable * @see setGdkInputTag */ int get_gdk_input_tag() ; - - + + /** * Returns the socket file descriptor * * @return the Sockt file descriptor */ int get_socket_descriptor() ; - - + + //---------------------------------------------------------------------------------------// // Handle Sending messages to the Image Compositor - + //---------------------------- // ImageFrameTimeAxis Messages - + /** * Sends a message stating that the named image frame time axis has been removed * @@ -128,7 +128,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @param src the identity of the object that initiated the change */ void send_imageframe_time_axis_removed(const std::string & track_id, void* src) ; - + /** * Sends a message indicating that an ImageFrameTimeAxis has been renamed * @@ -138,10 +138,10 @@ class ImageFrameSocketHandler : public sigc::trackable * @param time_axis the time axis that has changed */ void send_imageframe_time_axis_renamed(const std::string & new_id, const std::string & old_id, void* src, ImageFrameTimeAxis* time_axis) ; - + //------------------------ // MarkerTimeAxis Messages - + /** * Sends a message stating that the named marker time axis has been removed * @@ -149,7 +149,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @param src the identity of the object that initiated the change */ void send_marker_time_axis_removed(const std::string & track_id, void* src) ; - + /** * Sends a message indicating that an MarkerTimeAxis has been renamed * @@ -159,11 +159,11 @@ class ImageFrameSocketHandler : public sigc::trackable * @param time_axis the time axis that has changed */ void send_marker_time_axis_renamed(const std::string & new_id, const std::string & old_id, void* src, MarkerTimeAxis* time_axis) ; - - + + //--------------------------------- // ImageFrameTimeAxisGroup Messages - + /** * Sends a message stating that the group has been removed * @@ -172,7 +172,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @param group the group that has changed */ void send_imageframe_time_axis_group_removed(const std::string & group_id, void* src, ImageFrameTimeAxisGroup* group) ; - + /** * Send a message indicating that an ImageFrameTimeAxisGroup has been renamed * @@ -186,7 +186,7 @@ class ImageFrameSocketHandler : public sigc::trackable //--------------------------------- // ImageFrameView Messages - + /** * Send an Image Frame View Item position changed message * @@ -195,7 +195,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @param item the time axis item whos position has changed */ void send_imageframe_view_position_change(nframes_t pos, void* src, ImageFrameView* item) ; - + /** * Send a Image Frame View item duration changed message * @@ -204,7 +204,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @param item the item which has had a duration change */ void send_imageframe_view_duration_change(nframes_t dur, void* src, ImageFrameView* item) ; - + /** * Send a message indicating that an ImageFrameView has been renamed * @@ -213,7 +213,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @param item the renamed item */ void send_imageframe_view_renamed(const std::string & new_id, const std::string & old_id, void* src, ImageFrameView* item) ; - + /** * Send a message indicating that an ImageFrameView item has been removed message * @@ -222,10 +222,10 @@ class ImageFrameSocketHandler : public sigc::trackable * @param item the removed item */ void send_imageframe_view_removed(const std::string & item_id, void* src, ImageFrameView* item) ; - + //--------------------------------- // MarkerView Messages - + /** * Send a Marker View Item position changed message * @@ -234,7 +234,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @param item the time axis item whos position has changed */ void send_marker_view_position_change(nframes_t pos, void* src, MarkerView* item) ; - + /** * Send a Marker View item duration changed message * @@ -243,7 +243,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @param item the time axis item whos position has changed */ void send_marker_view_duration_change(nframes_t dur, void* src, MarkerView* item) ; - + /** * Send a message indicating that a MarkerView has been renamed * @@ -253,7 +253,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @param item the MarkerView which has been renamed */ void send_marker_view_renamed(const std::string & new_id, const std::string & old_id, void* src, MarkerView* item) ; - + /** * Send a message indicating that a MarkerView item has been removed message * @@ -263,200 +263,200 @@ class ImageFrameSocketHandler : public sigc::trackable */ void send_marker_view_removed(const std::string & item_id, void* src, MarkerView* item) ; - + //---------------------------------------------------------------------------------------// // Emitted Signals - + /** Emitted if the socket connection is shutdown at the other end */ sigc::signal<void> CompositorSocketShutdown ; - + /** Emitted as a generic error is captured from the socket connection to the animatic compositor */ sigc::signal<void> CompositorSocketError ; - - + + protected: - - + + private: /* I dont like friends :-( */ friend class Editor; - + /** * Create an new instance of the ImageFrameSocketHandler, if one does not already exist * * @param ed the Ardour PublicEditor */ static ImageFrameSocketHandler* create_instance(PublicEditor& ed) ; - + //---------------------------------------------------------------------------------------// // Message breakdown ie avoid a big if...then...else - + /** * Handle insert item requests * * @param msg the received message */ void handle_insert_message(const char* msg) ; - + /** * Handle remove item requests * * @param msg the received message */ void handle_remove_message(const char* msg) ; - + /** * Handle rename item requests * * @param msg the received message */ void handle_rename_message(const char* msg) ; - + /** * Handle a request for session information * * @param msg the received message */ void handle_request_data(const char* msg) ; - + /** * Handle the update of a particular item * * @param msg the received message */ void handle_item_update_message(const char* msg) ; - + /** * Handle the selection of an Item * * @param msg the received message */ void handle_item_selected(const char* msg) ; - + /** * Handle s session action message * * @param msg the received message */ void handle_session_action(const char* msg) ; - + //---------------------------------------------------------------------------------------// // handlers for specific insert procedures - + /** * Handle the insertion of a new ImaegFrameTimeAxis * * @param msg the received message */ void handle_insert_imageframe_time_axis(const char* msg) ; - + /** * Handle the insertion of a new MarkerTimeAxis * * @param msg the received message */ void handle_insert_marker_time_axis(const char* msg) ; - + /** * Handle the insertion of a time axis group (a scene) * * @param msg the received message */ void handle_insert_imageframe_group(const char* msg) ; - + /** * Handle the insertion of a new ImageFrameItem * * @param msg the received message */ void handle_insert_imageframe_view(const char* msg) ; - + /** * Handle the insertion of a new MarkerItem * * @param msg the received message */ void handle_insert_marker_view(const char* msg) ; - + //---------------------------------------------------------------------------------------// // handlers for specific removal procedures - + /** * Handle the removal of an ImageTimeAxis * * @param msg the received message */ void handle_remove_imageframe_time_axis(const char* msg) ; - + /** * Handle the removal of an MarkerTimeAxis * * @param msg the received message */ void handle_remove_marker_time_axis(const char* msg) ; - + /** * Handle the removal of an ImageFrameTimeAxisGroup * * @param msg the received message */ void handle_remove_imageframe_time_axis_group(const char* msg) ; - + /** * Handle the removal of an ImageFrameItem * * @param msg the received message */ void handle_remove_imageframe_view(const char* msg) ; - + /** * Handle the removal of an MarkerItem * * @param msg the received message */ void handle_remove_marker_view(const char* msg) ; - + //---------------------------------------------------------------------------------------// // handlers for the specific rename procedures - + /** * Handle the renaming of an ImageTimeAxis * * @param msg the received message */ void handle_rename_imageframe_time_axis(const char* msg) ; - + /** * Handle the renaming of an MarkerTimeAxis * * @param msg the received message */ void handle_rename_marker_time_axis(const char* msg) ; - + /** * Handle the renaming of an ImageFrameItem * * @param msg the received message */ void handle_rename_imageframe_time_axis_group(const char* msg) ; - + /** * Handle the renaming of an ImageFrameItem * * @param msg the received message */ void handle_rename_imageframe_view(const char* msg) ; - + /** * Handle the renaming of an Marker * * @param msg the received message */ void handle_rename_marker_view(const char* msg) ; - + //---------------------------------------------------------------------------------------// // handlers for data request - + /** * Handle a request for the sessnio naem fo the current session * We return a failure state if no session is open @@ -464,129 +464,129 @@ class ImageFrameSocketHandler : public sigc::trackable * @param msg the received message */ void handle_session_name_request(const char* msg) ; - - + + //---------------------------------------------------------------------------------------// // handlers for specific item update changes - + /** * Handle ImageFrameView positional changes * * @param msg the received message */ void handle_imageframe_view_position_update(const char* msg) ; - + /** * Handle ImageFrameView Duration changes * * @param msg the received message */ void handle_imageframe_view_duration_update(const char* msg) ; - + /** * Handle ImageFrameView Position Lock Constraint changes * * @param msg the received message */ void handle_imageframe_position_lock_update(const char* msg) ; - + /** * Handle ImageFrameView Maximum Duration changes * * @param msg the received message */ void handle_imageframe_view_max_duration_update(const char* msg) ; - + /** * Handle image frame max duration enable constraint changes * * @param msg the received message */ void handle_imageframe_view_max_duration_enable_update(const char* msg) ; - + /** * Handle ImageFrameView Minimum Duration changes * * @param msg the received message */ void handle_imageframe_view_min_duration_update(const char* msg) ; - + /** * Handle image frame min duration enable constraint changes * * @param msg the received message */ void handle_imageframe_view_min_duration_enable_update(const char* msg) ; - - + + /** * Handle MarkerView position changes * * @param msg the received message */ void handle_marker_view_position_update(const char* msg) ; - + /** * Handle MarkerView duration changes * * @param msg the received message */ void handle_marker_view_duration_update(const char* msg) ; - + /** * Handle MarkerView Position Lock Constraint changes * * @param msg the received message */ void handle_marker_view_position_lock_update(const char* msg) ; - + /** * Handle MarkerView maximum duration changes * * @param msg the received message */ void handle_marker_view_max_duration_update(const char* msg) ; - + /** * Handle MarkerView minimum duration changes * * @param msg the received message */ void handle_marker_view_min_duration_update(const char* msg) ; - - + + //---------------------------------------------------------------------------------------// // handlers for Session Actions - + /** * Handle the opening of a named audio session * * @param msg the received message */ void handle_open_session(const char* msg) ; - + /** * Handle the closing of a named audio session * * @param msg the received message */ void handle_closed_session(const char* msg) ; - + //---------------------------------------------------------------------------------------// // handlers for the shutdown of the Image Compositor - + /** * Handle the shutdown message from the image compositor * * @param msg the received message */ void handle_shutdown(const char* msg) ; - - + + //---------------------------------------------------------------------------------------// // convenince methods to break up messages - + /** * Returns part of the received message as a std::string * @@ -596,8 +596,8 @@ class ImageFrameSocketHandler : public sigc::trackable * @return the sub std::string of the message */ std::string get_message_part(int start, int32_t num_chars, const char* msg) ; - - + + /** * break up am image item description message * we break the mesage up into the parent Image Track id and size, @@ -611,7 +611,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @param item_id_size */ void decompose_imageframe_item_desc(const char* msg, int& position, std::string& track_id, int& track_id_size, std::string& scene_id, int& scene_id_size, std::string& item_id, int& item_id_size) ; - + /** * Compose a description of the specified image frame view * The description consists of the parent track name size and name, @@ -631,8 +631,8 @@ class ImageFrameSocketHandler : public sigc::trackable * @param buffer the buffer to write the description */ void compose_marker_item_desc(MarkerView* mv, std::ostringstream& buffer) ; - - + + /** * Returns the ImageFrameView from the specified description * The errcode parameter is used to indicate the item which caused @@ -650,10 +650,10 @@ class ImageFrameSocketHandler : public sigc::trackable * @return the described item on success, 0 otherwise */ ImageFrameView* get_imageframe_view_from_desc(const std::string & track_id, const std::string & group_ud, const std::string & item_id, int& errcode, std::string& errmsg) ; - + //---------------------------------------------------------------------------------------// // Convenince Message Send Methods - + /** * Sends a message throught the socket * @@ -661,7 +661,7 @@ class ImageFrameSocketHandler : public sigc::trackable * @return the return value of the socket call */ int send_message(const std::string & msg) ; - + /** * Reads a message from the Socket * @@ -669,32 +669,32 @@ class ImageFrameSocketHandler : public sigc::trackable * @return the return value from the socket call */ int read_message(std::string& msg) ; - + /** * Convenience method to compose and send a success messasge back to the Image Compositor * */ void send_return_success() ; - + /** * Convenience method to compose and send a failure messasge back to the Image Compositor * * @param msg the failure message */ void send_return_failure(const std::string& msg) ; - + //---------------------------------------------------------------------------------------// // Memebr Data - + /** Our instance of the socket handler, singleton */ static ImageFrameSocketHandler* _instance ; - + /** The Ardour PublicEditor */ PublicEditor& thePublicEditor ; - + /** the socket file descriptor */ int theArdourToCompositorSocket ; - + /** This stores the 'tag' returned from gdk_input_add, which is required for removing the input */ int theGdkInputTag ; diff --git a/gtk2_ardour/imageframe_time_axis.cc b/gtk2_ardour/imageframe_time_axis.cc index 2f421a1132..866b677608 100644 --- a/gtk2_ardour/imageframe_time_axis.cc +++ b/gtk2_ardour/imageframe_time_axis.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,7 +63,7 @@ ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed VisualTimeAxis(track_id, ed, sess, canvas) { _color = unique_random_color() ; - + selection_group = new ArdourCanvas::Group (*canvas_display); selection_group->hide(); @@ -73,13 +73,13 @@ ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed /* create our new image frame view */ view = new ImageFrameTimeAxisView(*this) ; - + /* create the Image Frame Edit Menu */ create_imageframe_menu() ; - + // set the initial time axis text label label_view() ; - + // set the initial height of this time axis set_height(hNormal) ; } @@ -91,28 +91,28 @@ ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed ImageFrameTimeAxis::~ImageFrameTimeAxis () { GoingAway() ; /* EMIT_SIGNAL */ - + // Destroy all the marker views we may have associaited with this TimeAxis for(MarkerTimeAxisList::iterator iter = marker_time_axis_list.begin(); iter != marker_time_axis_list.end(); ++iter) { MarkerTimeAxis* mta = *iter ; MarkerTimeAxisList::iterator next = iter ; next++ ; - + marker_time_axis_list.erase(iter) ; delete mta ; mta = 0 ; - + iter = next ; } - + delete image_action_menu ; image_action_menu = 0 ; - + delete selection_group; selection_group = 0 ; - + // Destroy our Axis View helper delete view ; view = 0 ; @@ -124,19 +124,19 @@ ImageFrameTimeAxis::~ImageFrameTimeAxis () /** * Sets the height of this TrackView to one of ths TrackHeghts * - * @param h + * @param h */ void ImageFrameTimeAxis::set_height (uint32_t h) { VisualTimeAxis::set_height(h) ; - + // tell out view helper of the change too if(view != 0) { view->set_height((double) height) ; } - + // tell those interested that we have had our height changed gui_changed("track_height",(void*)0); /* EMIT_SIGNAL */ } @@ -194,7 +194,7 @@ ImageFrameTimeAxis::popup_imageframe_edit_menu(int button, int32_t time, ImageFr { imageframe_item_menu->set_sensitive(false) ; } - + imageframe_menu->popup(button,time) ; } @@ -240,7 +240,7 @@ ImageFrameTimeAxis::build_display_menu() image_action_menu = new Menu() ; image_action_menu->set_name ("ArdourContextMenu"); MenuList image_items = image_action_menu->items() ; - + items.push_back (SeparatorElem()); items.push_back (MenuElem (_("Height"), *size_menu)); items.push_back (MenuElem (_("Color"), mem_fun(*this, &ImageFrameTimeAxis::select_track_color))); @@ -261,7 +261,7 @@ ImageFrameTimeAxis::create_imageframe_menu() imageframe_menu = manage(new Menu) ; imageframe_menu->set_name ("ArdourContextMenu"); MenuList& items = imageframe_menu->items(); - + imageframe_item_menu = manage(new Menu) ; imageframe_item_menu->set_name ("ArdourContextMenu"); MenuList& imageframe_sub_items = imageframe_item_menu->items() ; @@ -290,7 +290,7 @@ ImageFrameTimeAxis::create_imageframe_menu() { imageframe_sub_items.push_back(MenuElem (_("Remove Frame"), bind(mem_fun (view, &ImageFrameTimeAxisView::remove_selected_imageframe_item), (void*)this))) ; } - + items.push_back(MenuElem(_("Image Frame"), *imageframe_item_menu)) ; items.push_back(MenuElem (_("Rename Track"), mem_fun(*this,&ImageFrameTimeAxis::start_time_axis_rename))) ; @@ -315,7 +315,7 @@ bool ImageFrameTimeAxis::add_marker_time_axis(MarkerTimeAxis* marker_track, void* src) { bool ret = false ; - + if(get_named_marker_time_axis(marker_track->name()) != 0) { ret = false ; @@ -324,11 +324,11 @@ ImageFrameTimeAxis::add_marker_time_axis(MarkerTimeAxis* marker_track, void* src { marker_time_axis_list.push_back(marker_track) ; marker_track->GoingAway.connect(bind(mem_fun(*this, &ImageFrameTimeAxis::remove_time_axis_view), marker_track, (void*)this)); - + MarkerTimeAxisAdded(marker_track, src) ; /* EMIT_SIGNAL */ ret = true ; } - + return(ret) ; } @@ -342,7 +342,7 @@ MarkerTimeAxis* ImageFrameTimeAxis::get_named_marker_time_axis(const string & track_id) { MarkerTimeAxis* mta = 0 ; - + for (MarkerTimeAxisList::iterator i = marker_time_axis_list.begin(); i != marker_time_axis_list.end(); ++i) { if (((MarkerTimeAxis*)*i)->name() == track_id) @@ -365,21 +365,21 @@ MarkerTimeAxis* ImageFrameTimeAxis::remove_named_marker_time_axis(const string & track_id, void* src) { MarkerTimeAxis* mta = 0 ; - + for(MarkerTimeAxisList::iterator i = marker_time_axis_list.begin(); i != marker_time_axis_list.end(); ++i) { if (((MarkerTimeAxis*)*i)->name() == track_id) { mta = ((MarkerTimeAxis*)*i) ; - + // the iterator is invalid after this call, so we can no longer use it as is. marker_time_axis_list.erase(i) ; - + MarkerTimeAxisRemoved(mta->name(), src) ; /* EMIT_SIGNAL */ break ; } } - + return(mta) ; } @@ -394,7 +394,7 @@ void ImageFrameTimeAxis::remove_time_axis_view(MarkerTimeAxis* mta, void* src) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &ImageFrameTimeAxis::remove_time_axis_view), mta, src)); - + MarkerTimeAxisList::iterator i; if((i = find (marker_time_axis_list.begin(), marker_time_axis_list.end(), mta)) != marker_time_axis_list.end()) { diff --git a/gtk2_ardour/imageframe_time_axis.h b/gtk2_ardour/imageframe_time_axis.h index f34472a295..21db88e3e4 100644 --- a/gtk2_ardour/imageframe_time_axis.h +++ b/gtk2_ardour/imageframe_time_axis.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ class ImageFrameTimeAxis : public VisualTimeAxis public: //---------------------------------------------------------------------------------------// // Constructor / Desctructor - + /** * Constructs a new ImageFrameTimeAxis. * @@ -63,13 +63,13 @@ class ImageFrameTimeAxis : public VisualTimeAxis * @param canvas the parent canvas item */ ImageFrameTimeAxis(const std::string & track_id, PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas) ; - + /** * Destructor * Responsible for destroying any child image items that may have been added to thie time axis */ virtual ~ImageFrameTimeAxis() ; - + //---------------------------------------------------------------------------------------// // ui methods & data @@ -77,9 +77,9 @@ class ImageFrameTimeAxis : public VisualTimeAxis * Sets the height of this TrackView to one of ths TrackHeghts * * @param h the number of pixels to set the height too - */ + */ virtual void set_height(uint32_t h) ; - + /** * Sets the number of samples per unit that are used. * This is used to determine the siezes of items upon this time axis @@ -87,15 +87,15 @@ class ImageFrameTimeAxis : public VisualTimeAxis * @param spu the number of samples per unit */ virtual void set_samples_per_unit(double spu) ; - + /** * Returns the available height for images to be drawn onto * * @return the available height for an image item to be drawn onto */ int get_image_display_height() ; - - + + /** * Show the popup edit menu * @@ -105,11 +105,11 @@ class ImageFrameTimeAxis : public VisualTimeAxis * @param with_item true if an item has been selected upon the time axis, used to set context menu */ void popup_imageframe_edit_menu(int button, int32_t time, ImageFrameView* clicked_imageframe, bool with_item) ; - - + + //---------------------------------------------------------------------------------------// // Marker Time Axis Methods - + /** * Add a MarkerTimeAxis to the ilst of MarkerTimeAxis' associated with this ImageFrameTimeAxis * @@ -119,7 +119,7 @@ class ImageFrameTimeAxis : public VisualTimeAxis * false otherwise */ bool add_marker_time_axis(MarkerTimeAxis* marker_track, void* src) ; - + /** * Returns the named MarkerTimeAxis associated with this ImageFrameTimeAxis * @@ -127,7 +127,7 @@ class ImageFrameTimeAxis : public VisualTimeAxis * @return the named markerTimeAxis, or 0 if the named MarkerTimeAxis is not associated with this ImageFrameTimeAxis */ MarkerTimeAxis* get_named_marker_time_axis(const std::string & track_id) ; - + /** * Removes the named markerTimeAxis from those associated with this ImageFrameTimeAxis * @@ -136,7 +136,7 @@ class ImageFrameTimeAxis : public VisualTimeAxis * @return the removed MarkerTimeAxis */ MarkerTimeAxis* remove_named_marker_time_axis(const std::string & track_id, void* src) ; - + /** * Removes tav from the list of MarkerTimaAxis associated with this ImageFrameTimeAxis * @@ -145,10 +145,10 @@ class ImageFrameTimeAxis : public VisualTimeAxis */ void remove_time_axis_view(MarkerTimeAxis* tav, void* src) ; - + //---------------------------------------------------------------------------------------// // Parent/Child helper object accessors - + /** * Returns the view helper of this TimeAxis * @@ -156,16 +156,16 @@ class ImageFrameTimeAxis : public VisualTimeAxis */ ImageFrameTimeAxisView* get_view() ; - + //---------------------------------------------------------------------------------// // Emitted Signals - + /** Emitted when a Marker Time Axis is Added, or associated with, this time axis */ sigc::signal<void,MarkerTimeAxis*,void*> MarkerTimeAxisAdded ; - + /** Emitted when a Marker Time Axis is removed, from this time axis */ sigc::signal<void,std::string,void*> MarkerTimeAxisRemoved ; - + protected: private: @@ -174,7 +174,7 @@ class ImageFrameTimeAxis : public VisualTimeAxis * */ void select_track_color() ; - + /** * Handles the building of the popup menu */ @@ -184,14 +184,14 @@ class ImageFrameTimeAxis : public VisualTimeAxis * handles the building of the ImageFrameView sub menu */ void create_imageframe_menu() ; - + /* We may have multiple marker views, but each marker view should only be associated with one timeaxisview */ typedef std::list<MarkerTimeAxis*> MarkerTimeAxisList ; MarkerTimeAxisList marker_time_axis_list; - + /* the TimeAxis view helper */ ImageFrameTimeAxisView *view ; - + // popup menu widgets Gtk::Menu *image_action_menu ; Gtk::Menu *imageframe_menu ; diff --git a/gtk2_ardour/imageframe_time_axis_group.cc b/gtk2_ardour/imageframe_time_axis_group.cc index 5dc76978b0..49f7d3a6a8 100644 --- a/gtk2_ardour/imageframe_time_axis_group.cc +++ b/gtk2_ardour/imageframe_time_axis_group.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ using namespace ARDOUR ; //---------------------------------------------------------------------------------------// // Constructor / Desctructor - + /** * Constructs a new ImageFrameTimeAxisGroup. * @@ -62,25 +62,25 @@ ImageFrameTimeAxisGroup::~ImageFrameTimeAxisGroup() for(ImageFrameViewList::iterator iter = imageframe_views.begin(); iter != imageframe_views.end(); ++iter) { ImageFrameView* ifv = *iter ; - + ImageFrameViewList::iterator next = iter ; next++ ; - + imageframe_views.erase(iter) ; delete ifv ; ifv = 0 ; - + iter = next ; } - + GoingAway() ; /* EMIT_SIGNAL */ } //---------------------------------------------------------------------------------------// // Name/Id Accessors/Mutators - + /** * Set the name/Id of this group. * @@ -140,10 +140,10 @@ ImageFrameTimeAxisGroup::set_item_heights(gdouble h) /** * Sets the current samples per unit. * this method tells each item upon the time axis of the change - * + * * @param spu the new samples per canvas unit value */ -int +int ImageFrameTimeAxisGroup::set_item_samples_per_units(gdouble spp) { if(spp < 1.0) @@ -155,7 +155,7 @@ ImageFrameTimeAxisGroup::set_item_samples_per_units(gdouble spp) { (*citer)->set_samples_per_unit(spp) ; } - + return(0) ; } @@ -197,7 +197,7 @@ ImageFrameView* ImageFrameTimeAxisGroup::add_imageframe_item(const string & frame_id, nframes_t start, nframes_t duration, unsigned char* rgb_data, uint32_t width, uint32_t height, uint32_t num_channels, void* src) { ImageFrameView* ifv = 0 ; - + //check that there is not already an imageframe with that id if(get_named_imageframe_item(frame_id) == 0) { @@ -215,9 +215,9 @@ ImageFrameTimeAxisGroup::add_imageframe_item(const string & frame_id, nframes_t num_channels) ; imageframe_views.push_front(ifv) ; - + ifv->GoingAway.connect(bind(mem_fun(*this,&ImageFrameTimeAxisGroup::remove_imageframe_item), (void*)this)) ; - + ImageFrameAdded(ifv, src) ; /* EMIT_SIGNAL */ } @@ -235,7 +235,7 @@ ImageFrameView* ImageFrameTimeAxisGroup::get_named_imageframe_item(const string & frame_id) { ImageFrameView* ifv = 0 ; - + for (ImageFrameViewList::const_iterator i = imageframe_views.begin(); i != imageframe_views.end(); ++i) { if (((ImageFrameView*)*i)->get_item_name() == frame_id) @@ -246,7 +246,7 @@ ImageFrameTimeAxisGroup::get_named_imageframe_item(const string & frame_id) } return(ifv) ; } - + /** * Removes the currently selected ImageFrameView * @@ -259,20 +259,20 @@ void ImageFrameTimeAxisGroup::remove_selected_imageframe_item(void* src) { std::string frame_id ; - + if(selected_imageframe_item) { ImageFrameViewList::iterator i ; - + if((i = find(imageframe_views.begin(), imageframe_views.end(), selected_imageframe_item)) != imageframe_views.end()) { imageframe_views.erase(i) ; frame_id = selected_imageframe_item->get_item_name() ; - + // note that we delete the item here delete(selected_imageframe_item) ; selected_imageframe_item = 0 ; - + std::string track_id = _view_helper.trackview().name() ; ImageFrameRemoved(track_id, _group_id, frame_id, src) ; /* EMIT_SIGNAL */ } @@ -283,7 +283,7 @@ ImageFrameTimeAxisGroup::remove_selected_imageframe_item(void* src) } } - + /** * Removes and returns the named ImageFrameView from the list of ImageFrameViews held by this view helper * @@ -295,29 +295,29 @@ ImageFrameView* ImageFrameTimeAxisGroup::remove_named_imageframe_item(const string & frame_id, void* src) { ImageFrameView* removed = 0 ; - + for(ImageFrameViewList::iterator iter = imageframe_views.begin(); iter != imageframe_views.end(); ++iter) { ImageFrameView* tempItem = *iter ; if(tempItem->get_item_name() == frame_id) { - removed = tempItem ; + removed = tempItem ; imageframe_views.erase(iter) ; - + if (removed == selected_imageframe_item) { selected_imageframe_item = 0 ; } - + std::string track_id = _view_helper.trackview().name() ; ImageFrameRemoved(track_id, _group_id, frame_id, src) ; /* EMIT_SIGNAL */ - + // break from the for loop break ; } iter++ ; } - + return(removed) ; } @@ -331,12 +331,12 @@ void ImageFrameTimeAxisGroup::remove_imageframe_item(ImageFrameView* ifv, void* src) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &ImageFrameTimeAxisGroup::remove_imageframe_item), ifv, src)); - + ImageFrameViewList::iterator i; if((i = find (imageframe_views.begin(), imageframe_views.end(), ifv)) != imageframe_views.end()) { imageframe_views.erase(i) ; - + std::string frame_id = ifv->get_item_name() ; std::string track_id = _view_helper.trackview().name() ; ImageFrameRemoved(track_id, _group_id, frame_id, src) ; /* EMIT_SIGNAL */ @@ -358,9 +358,9 @@ ImageFrameTimeAxisGroup::remove_imageframe_item(ImageFrameView* ifv, void* src) // { // selected_imageframe_item->set_selected(false, this) ; // } -// +// // selected_imageframe_item = ifv ; -// +// // if(!ifv->get_selected()) // { // selected_imageframe_item->set_selected(true, this) ; diff --git a/gtk2_ardour/imageframe_time_axis_group.h b/gtk2_ardour/imageframe_time_axis_group.h index e189b71e0b..714d8515f7 100644 --- a/gtk2_ardour/imageframe_time_axis_group.h +++ b/gtk2_ardour/imageframe_time_axis_group.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ class ImageFrameTimeAxisGroup : public sigc::trackable public: //---------------------------------------------------------------------------------------// // Constructor / Desctructor - + /** * Constructs a new ImageFrameTimeAxisGroup. * @@ -54,18 +54,18 @@ class ImageFrameTimeAxisGroup : public sigc::trackable * @param group_id the unique name/id of this group */ ImageFrameTimeAxisGroup(ImageFrameTimeAxisView& iftav, const std::string & group_id) ; - + /** * Destructor * Responsible for destroying any Items that may have been added to this group * */ virtual ~ImageFrameTimeAxisGroup() ; - - + + //---------------------------------------------------------------------------------------// // Name/Id Accessors/Mutators - + /** * Set the name/Id of this group. * @@ -81,49 +81,49 @@ class ImageFrameTimeAxisGroup : public sigc::trackable * @return the id of this group */ std::string get_group_name() const ; - - + + //---------------------------------------------------------------------------------------// // Parent/Child helper object accessors - + /** * Returns the TimeAxisView thatt his object is acting as a helper for * * @return the TimeAxisView that this object is acting as a view helper for */ ImageFrameTimeAxisView& get_view() const { return _view_helper ; } - - - + + + //---------------------------------------------------------------------------------------// // ui methods & data - + /** * Sets the height of the time axis view and the item upon it * * @param height the new height */ int set_item_heights(gdouble) ; - + /** * Sets the current samples per unit. * this method tells each item upon the time axis of the change - * + * * @param spu the new samples per canvas unit value */ int set_item_samples_per_units(gdouble spu) ; - + /** * Sets the color of the items contained uopn this view helper * * @param color the new base color */ void apply_item_color(Gdk::Color&) ; - - + + //---------------------------------------------------------------------------------------// // child ImageFrameView methods - + /** * Adds an ImageFrameView to the list of items upon this time axis view helper * the new ImageFrameView is returned @@ -139,7 +139,7 @@ class ImageFrameTimeAxisGroup : public sigc::trackable * @param src the identity of the object that initiated the change */ ImageFrameView* add_imageframe_item(const std::string & item_id, nframes_t start, nframes_t duration, unsigned char* rgb_data, uint32_t width, uint32_t height, uint32_t num_channels, void* src) ; - + /** * Returns the named ImageFrameView or 0 if the named view does not exist on this view helper * @@ -147,7 +147,7 @@ class ImageFrameTimeAxisGroup : public sigc::trackable * @return the named ImageFrameView, or 0 if it is not held upon this view */ ImageFrameView* get_named_imageframe_item(const std::string & item_id) ; - + /** * Removes the currently selected ImageFrameView * @@ -155,7 +155,7 @@ class ImageFrameTimeAxisGroup : public sigc::trackable * @see add_imageframe_view */ void remove_selected_imageframe_item(void* src) ; - + /** * Removes and returns the named ImageFrameView from the list of ImageFrameViews held by this view helper * @@ -164,7 +164,7 @@ class ImageFrameTimeAxisGroup : public sigc::trackable * @see add_imageframe_view */ ImageFrameView* remove_named_imageframe_item(const std::string & item_id, void* src) ; - + /** * Removes ifv from the list of ImageFrameViews upon this TimeAxis. * if ifv is not upon this TimeAxis, this method takes no action @@ -172,23 +172,23 @@ class ImageFrameTimeAxisGroup : public sigc::trackable * @param ifv the ImageFrameView to remove */ void remove_imageframe_item(ImageFrameView*, void* src) ; - - + + //---------------------------------------------------------------------------------------// // Selected group methods - + // removed in favour of a track level selectewd item // this is simply easier to manage a singularly selected item, rather than // a selected item within each group - + /** * Sets the currently selected item upon this time axis * * @param ifv the item to set selected */ //void set_selected_imageframe_item(ImageFrameView* ifv) ; - + /** * Sets the currently selected item upon this time axis to the named item * @@ -200,26 +200,26 @@ class ImageFrameTimeAxisGroup : public sigc::trackable * Returns the currently selected item upon this time axis * * @return the currently selected item pon this time axis - */ + */ //ImageFrameView* get_selected_imageframe_item() ; - + /** * Returns whether this grou pis currently selected * * @returns true if this group is currently selected */ bool get_selected() const ; - + /** * Sets he selected state of this group * * @param yn set true if this group is selected, false otherwise */ void set_selected(bool yn) ; - + //---------------------------------------------------------------------------------------// // Handle group removal - + /** * Handles the Removal of this VisualTimeAxis * This _needs_ to be called to alert others of the removal properly, ie where the source @@ -234,9 +234,9 @@ class ImageFrameTimeAxisGroup : public sigc::trackable //---------------------------------------------------------------------------------// // Emitted Signals - + sigc::signal<void> GoingAway ; - + /** * Emitted when this Group has been removed * This is different to the GoingAway signal in that this signal @@ -245,16 +245,16 @@ class ImageFrameTimeAxisGroup : public sigc::trackable * event */ sigc::signal<void,std::string,void*> GroupRemoved ; - + /** Emitted when we have changed the name of this TimeAxis */ sigc::signal<void,std::string,std::string,void*> NameChanged ; - + /** Emitted when an ImageFrameView is added to this group */ sigc::signal<void, ImageFrameView*, void*> ImageFrameAdded ; - + /** Emitted when an ImageFrameView is removed from this group */ sigc::signal<void, const std::string &, const std::string &, const std::string &, void*> ImageFrameRemoved ; - + protected: @@ -264,7 +264,7 @@ class ImageFrameTimeAxisGroup : public sigc::trackable * */ void reset_samples_per_unit() ; - + /** * Callback used to remove this group during the gtk idle loop * This is used to avoid deleting the obejct while inside the remove_this_group @@ -274,27 +274,27 @@ class ImageFrameTimeAxisGroup : public sigc::trackable * @param src the identity of the object that initiated the change */ static gint idle_remove_this_group(ImageFrameTimeAxisGroup* group, void* src) ; - + /** The list of ImageFrameViews held by this view helper */ typedef std::list<ImageFrameView *> ImageFrameViewList ; ImageFrameViewList imageframe_views ; - + /** the currently selected time axis item upon this time axis */ ImageFrameView* selected_imageframe_item ; - + /** the view helper that this object is acting as a container upon on */ ImageFrameTimeAxisView& _view_helper ; - - /** the is of this group */ + + /** the is of this group */ std::string _group_id ; - + /* XXX why are these different? */ Gdk::Color region_color ; uint32_t stream_base_color ; - + /** indicates if this group is currently selected */ bool is_selected ; - + } ; /* class ImageFrameTimeAxisGroup */ #endif /* __ardour_imageframe_time_axis_group_h__ */ diff --git a/gtk2_ardour/imageframe_time_axis_view.cc b/gtk2_ardour/imageframe_time_axis_view.cc index a57db60a38..60bb6c3e03 100644 --- a/gtk2_ardour/imageframe_time_axis_view.cc +++ b/gtk2_ardour/imageframe_time_axis_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ using namespace Editing; //---------------------------------------------------------------------------------------// // Constructor / Desctructor - + /** * Constructs a new ImageFrameTimeAxisView. * @@ -69,17 +69,17 @@ ImageFrameTimeAxisView::ImageFrameTimeAxisView (ImageFrameTimeAxis& tv) } /** - * Destructor + * Destructor * Responsible for destroying all items tat may have been added to this time axis */ ImageFrameTimeAxisView::~ImageFrameTimeAxisView() { // Destroy all the ImageFrameGroups that we have - + for(ImageFrameGroupList::iterator iter = imageframe_groups.begin(); iter != imageframe_groups.end(); ++iter) { ImageFrameTimeAxisGroup* iftag = (*iter) ; - + ImageFrameGroupList::iterator next = iter ; next++ ; @@ -88,16 +88,16 @@ ImageFrameTimeAxisView::~ImageFrameTimeAxisView() delete iftag ; iftag = 0 ; - + iter = next ; } - + } //---------------------------------------------------------------------------------------// // ui methods & data - + /** * Sets the height of the time axis view and the item upon it * @@ -110,7 +110,7 @@ ImageFrameTimeAxisView::set_height (gdouble h) if (h < 10.0 || h > 1000.0) { return(-1) ; } - + canvas_rect.property_y2() = h ; @@ -121,7 +121,7 @@ ImageFrameTimeAxisView::set_height (gdouble h) return(0) ; } - + /** * Sets the position of this view helper on the canvas * @@ -141,10 +141,10 @@ ImageFrameTimeAxisView::set_position (gdouble x, gdouble y) /** * Sets the current samples per unit. * this method tells each item upon the time axis of the change - * + * * @param spu the new samples per canvas unit value */ -int +int ImageFrameTimeAxisView::set_samples_per_unit (gdouble spp) { if (spp < 1.0) { @@ -152,12 +152,12 @@ ImageFrameTimeAxisView::set_samples_per_unit (gdouble spp) } _samples_per_unit = spp; - + for(ImageFrameGroupList::const_iterator citer = imageframe_groups.begin(); citer != imageframe_groups.end(); ++citer) { (*citer)->set_item_samples_per_units(spp) ; } - + return(0) ; } @@ -190,7 +190,7 @@ ImageFrameTimeAxisView::reset_samples_per_unit () //---------------------------------------------------------------------------------------// // Child ImageFrameTimeAxisGroup Accessors/Mutators - + /** * Adds an ImageFrameTimeAxisGroup to the list of items upon this time axis view helper * the new ImageFrameTimeAxisGroup is returned @@ -202,7 +202,7 @@ ImageFrameTimeAxisGroup* ImageFrameTimeAxisView::add_imageframe_group(std::string group_id, void* src) { ImageFrameTimeAxisGroup* iftag = 0 ; - + //check that there is not already a group with that id if(get_named_imageframe_group(group_id) != 0) { @@ -213,9 +213,9 @@ ImageFrameTimeAxisView::add_imageframe_group(std::string group_id, void* src) iftag = new ImageFrameTimeAxisGroup(*this, group_id) ; imageframe_groups.push_front(iftag) ; - + iftag->GoingAway.connect(bind(mem_fun(*this,&ImageFrameTimeAxisView::remove_imageframe_group), iftag, (void*)this)) ; - + ImageFrameGroupAdded(iftag, src) ; /* EMIT_SIGNAL */ } @@ -232,7 +232,7 @@ ImageFrameTimeAxisGroup* ImageFrameTimeAxisView::get_named_imageframe_group(std::string group_id) { ImageFrameTimeAxisGroup* iftag = 0 ; - + for(ImageFrameGroupList::iterator i = imageframe_groups.begin(); i != imageframe_groups.end(); ++i) { if (((ImageFrameTimeAxisGroup*)*i)->get_group_name() == group_id) @@ -241,7 +241,7 @@ ImageFrameTimeAxisView::get_named_imageframe_group(std::string group_id) break ; } } - + return(iftag) ; } @@ -257,27 +257,27 @@ ImageFrameTimeAxisGroup* ImageFrameTimeAxisView::remove_named_imageframe_group(std::string group_id, void* src) { ImageFrameTimeAxisGroup* removed = 0 ; - + for(ImageFrameGroupList::iterator iter = imageframe_groups.begin(); iter != imageframe_groups.end(); ++iter) { if(((ImageFrameTimeAxisGroup*)*iter)->get_group_name() == group_id) { removed = (*iter) ; imageframe_groups.erase(iter) ; - + if(removed == selected_imageframe_group) { selected_imageframe_group = 0 ; } - + ImageFrameGroupRemoved(removed->get_group_name(), src) ; /* EMIT_SIGNAL */ - + // break from the for loop break ; } iter++ ; } - + return(removed) ; } @@ -296,7 +296,7 @@ ImageFrameTimeAxisView::remove_imageframe_group(ImageFrameTimeAxisGroup* iftag, if((i = find (imageframe_groups.begin(), imageframe_groups.end(), iftag)) != imageframe_groups.end()) { imageframe_groups.erase(i) ; - + ImageFrameGroupRemoved(iftag->get_group_name(), src) ; /* EMIT_SIGNAL */ } } @@ -306,7 +306,7 @@ ImageFrameTimeAxisView::remove_imageframe_group(ImageFrameTimeAxisGroup* iftag, //---------------------------------------------------------------------------------------// // Selected group methods - + /** * Sets the currently selected group upon this time axis * @@ -319,7 +319,7 @@ ImageFrameTimeAxisView::set_selected_imageframe_group(ImageFrameTimeAxisGroup* i { selected_imageframe_group->set_selected(false) ; } - + selected_imageframe_group = iftag ; selected_imageframe_group->set_selected(true) ; } @@ -337,7 +337,7 @@ ImageFrameTimeAxisView::clear_selected_imageframe_group() } selected_imageframe_group = 0 ; } - + /** * Returns the currently selected group upon this time axis * @@ -351,7 +351,7 @@ ImageFrameTimeAxisView::get_selected_imageframe_group() const //---------------------------------------------------------------------------------------// // Selected item methods - + /** * Sets the currently selected imag frame view item * @@ -362,12 +362,12 @@ void ImageFrameTimeAxisView::set_selected_imageframe_view(ImageFrameTimeAxisGroup* iftag, ImageFrameView* ifv) { set_selected_imageframe_group(iftag) ; - + if(selected_imageframe_view) { selected_imageframe_view->set_selected(false) ; } - + selected_imageframe_view = ifv ; selected_imageframe_view->set_selected(true) ; } @@ -383,14 +383,14 @@ ImageFrameTimeAxisView::clear_selected_imageframe_item(bool clear_group) { clear_selected_imageframe_group() ; } - + if(selected_imageframe_view) { selected_imageframe_view->set_selected(false) ; } selected_imageframe_view = 0 ; } - + /** * Returns the currently selected image frame view item upon this time axis * @@ -404,7 +404,7 @@ ImageFrameTimeAxisView::get_selected_imageframe_view() const - + void ImageFrameTimeAxisView::set_imageframe_duration_sec(double sec) { @@ -429,7 +429,7 @@ ImageFrameTimeAxisView::remove_selected_imageframe_item(void* src) { ImageFrameView* temp_item = selected_imageframe_view ; selected_imageframe_group->remove_imageframe_item(temp_item, src) ; - + // XXX although we have removed the item from the group, we need the group id still set within the // item as the remove method requires this data when telling others about the deletion // to fully specify the item we need the track, group and item id diff --git a/gtk2_ardour/imageframe_time_axis_view.h b/gtk2_ardour/imageframe_time_axis_view.h index 45725038d1..1191068c1d 100644 --- a/gtk2_ardour/imageframe_time_axis_view.h +++ b/gtk2_ardour/imageframe_time_axis_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,20 +48,20 @@ class ImageFrameTimeAxisView : public sigc::trackable public: //---------------------------------------------------------------------------------------// // Constructor / Desctructor - + /** * Constructs a new ImageFrameTimeAxisView. * * @param ifta the parent ImageFrameTimeAxis of this view helper */ ImageFrameTimeAxisView(ImageFrameTimeAxis& ifta) ; - + /** - * Destructor + * Destructor * Responsible for destroying all items tat may have been added to this time axis */ ~ImageFrameTimeAxisView () ; - + //---------------------------------------------------------------------------------------// // Parent/Child helper object accessors @@ -71,23 +71,23 @@ class ImageFrameTimeAxisView : public sigc::trackable * @return the TimeAxisView that this object is acting as a view helper for */ ImageFrameTimeAxis& trackview() { return _trackview; } - + /** * */ ArdourCanvas::Group * canvas_item() { return &canvas_group; } - - + + //---------------------------------------------------------------------------------------// // ui methods & data - + /** * Sets the height of the time axis view and the item upon it * * @param height the new height */ int set_height(gdouble) ; - + /** * Sets the position of this view helper on the canvas * @@ -95,32 +95,32 @@ class ImageFrameTimeAxisView : public sigc::trackable * @param y the y position upon the canvas */ int set_position(gdouble x, gdouble y) ; - + /** * Sets the current samples per unit. * this method tells each item upon the time axis of the change - * + * * @param spu the new samples per canvas unit value */ int set_samples_per_unit(gdouble spu) ; - + /** * Returns the current samples per unit of this time axis view helper * * @return the current samples per unit of this time axis view helper */ gdouble get_samples_per_unit() { return _samples_per_unit; } - + /** * Sets the color of the items contained uopn this view helper * * @param color the new base color */ void apply_color (Gdk::Color&) ; - + //---------------------------------------------------------------------------------------// // Child ImageFrameTimeAxisGroup Accessors/Mutators - + /** * Adds an ImageFrameTimeAxisGroup to the list of items upon this time axis view helper * the new ImageFrameTimeAxisGroup is returned @@ -129,7 +129,7 @@ class ImageFrameTimeAxisView : public sigc::trackable * @param src the identity of the object that initiated the change */ ImageFrameTimeAxisGroup* add_imageframe_group(std::string group_id, void* src) ; - + /** * Returns the named ImageFrameTimeAxisGroup or 0 if the named group does not exist on this view helper * @@ -137,7 +137,7 @@ class ImageFrameTimeAxisView : public sigc::trackable * @return the named ImageFrameTimeAxisGroup, or 0 if it is not held upon this view */ ImageFrameTimeAxisGroup* get_named_imageframe_group(std::string group_id) ; - + /** * Removes and returns the named ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroup held by this view helper * @@ -146,38 +146,38 @@ class ImageFrameTimeAxisView : public sigc::trackable * @see add_imageframe_group */ ImageFrameTimeAxisGroup* remove_named_imageframe_group(std::string group_id, void* src) ; - + /** * Removes the specified ImageFrameTimeAxisGroup from the list of ImageFrameTimeAxisGroups upon this TimeAxis. * * @param iftag the ImageFrameView to remove */ void remove_imageframe_group(ImageFrameTimeAxisGroup* iftag, void* src) ; - - + + //---------------------------------------------------------------------------------------// // Selected group methods - + /** * Sets the currently selected group upon this time axis * * @param ifv the item to set selected */ void set_selected_imageframe_group(ImageFrameTimeAxisGroup* iftag) ; - + /** * Clears the currently selected image frame group unpo this time axis * */ void clear_selected_imageframe_group() ; - + /** * Returns the currently selected group upon this time axis * * @return the currently selected group upon this time axis - */ + */ ImageFrameTimeAxisGroup* get_selected_imageframe_group() const ; - + /** * Sets the duration of the selected ImageFrameView to the specified number of seconds @@ -185,10 +185,10 @@ class ImageFrameTimeAxisView : public sigc::trackable * @param sec the duration to set the ImageFrameView to, in seconds */ void set_imageframe_duration_sec(double sec) ; - + //---------------------------------------------------------------------------------------// // Selected item methods - + /** * Sets the currently selected image frame view item * @@ -196,23 +196,23 @@ class ImageFrameTimeAxisView : public sigc::trackable * @param ifv the selected item */ void set_selected_imageframe_view(ImageFrameTimeAxisGroup* iftag, ImageFrameView* ifv) ; - + /** * Clears the currently selected image frame view item * * @param clear_group set true if the selected parent group of the item should be cleared also */ void clear_selected_imageframe_item(bool clear_group) ; - + /** * Returns the currently selected image frame view item upon this time axis * * @return the currently selected image frame view item */ ImageFrameView* get_selected_imageframe_view() const ; - - + + /** * Removes the currently selected ImageFrameTimeAxisGroup * @@ -221,16 +221,16 @@ class ImageFrameTimeAxisView : public sigc::trackable */ void remove_selected_imageframe_item(void* src) ; - + //---------------------------------------------------------------------------------// // Emitted Signals - + /** Emitted when and ImageFrameGroup is added to this time axis */ sigc::signal<void,ImageFrameTimeAxisGroup*,void*> ImageFrameGroupAdded ; - + /** Emitted when an ImageFrameGroup is removed from this time axis */ sigc::signal<void,std::string,void*> ImageFrameGroupRemoved ; - + protected: @@ -240,36 +240,36 @@ class ImageFrameTimeAxisView : public sigc::trackable * */ void reset_samples_per_unit() ; - + /** * The list of ImageFrameViews held by this view helper */ typedef std::list<ImageFrameTimeAxisGroup *> ImageFrameGroupList ; ImageFrameGroupList imageframe_groups ; - + /** the currently selected time axis item upon this time axis */ ImageFrameTimeAxisGroup* selected_imageframe_group ; - + /** * thecurrently selected image frame view * we keep this here so that we only have one per view, not one per group */ ImageFrameView* selected_imageframe_view ; - - - + + + /* the TimeAxisView that this object is acting as the view helper for */ ImageFrameTimeAxis& _trackview ; - + ArdourCanvas::Group canvas_group ; ArdourCanvas::SimpleRect canvas_rect; /* frame around the whole thing */ - + /** the current samples per unit */ double _samples_per_unit ; - + /* XXX why are these different? */ Gdk::Color region_color ; uint32_t stream_base_color ; - + } ; /* class ImageFrameTimeAxisView */ #endif /* __ardour_imageframe_time_axis_view_h__ */ diff --git a/gtk2_ardour/imageframe_view.cc b/gtk2_ardour/imageframe_view.cc index 0b3b01dcba..5ce4c4577b 100644 --- a/gtk2_ardour/imageframe_view.cc +++ b/gtk2_ardour/imageframe_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -76,11 +76,11 @@ ImageFrameView::ImageFrameView(const string & item_id, { the_parent_group = item_group ; set_name_text(item_id) ; - + image_data_width = width ; image_data_height = height ; image_data_num_channels = num_channels ; - + //This should be art_free'd once the ArtPixBuf is destroyed - this should happen when we destroy the imageframe canvas item unsigned char* the_rgb_data = (unsigned char*) art_alloc(width*height*num_channels) ; memcpy(the_rgb_data, rgb_data, (width*height*num_channels)) ; @@ -88,11 +88,11 @@ ImageFrameView::ImageFrameView(const string & item_id, ArtPixBuf* pbuf ; pbuf = art_pixbuf_new_rgba(the_rgb_data, width, height, (num_channels * width)); imageframe = 0 ; - + //calculate our image width based on the track height double im_ratio = (double)width/(double)height ; double im_width = ((double)(trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE) * im_ratio) ; - + imageframe = new ImageFrame (*group, pbuf, 1.0, 1.0, ANCHOR_NW, im_width, (trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE)); frame_handle_start->signal_event().connect (bind (mem_fun (trackview.editor, &PublicEditor::canvas_imageframe_start_handle_event), frame_handle_start, this)); @@ -101,7 +101,7 @@ ImageFrameView::ImageFrameView(const string & item_id, frame_handle_start->raise_to_top(); frame_handle_end->raise_to_top(); - + set_position(start, this) ; set_duration(duration, this) ; } @@ -115,11 +115,11 @@ ImageFrameView::~ImageFrameView() GoingAway (this); // destroy any marker items we have associated with this item - + for(MarkerViewList::iterator iter = marker_view_list.begin(); iter != marker_view_list.end(); ++iter) { MarkerView* mv = (*iter) ; - + MarkerViewList::iterator next = iter ; next++ ; @@ -138,11 +138,11 @@ ImageFrameView::~ImageFrameView() mv->set_marked_item(0) ; delete mv ; mv = 0 ; - - // set our iterator to next, as we have invalided the current iterator with the call to erase + + // set our iterator to next, as we have invalided the current iterator with the call to erase iter = next ; } - + // if we are the currently selected item withi the parent track, we need to se-select if(the_parent_group) { @@ -171,7 +171,7 @@ bool ImageFrameView::set_position(nframes64_t pos, void* src, double* delta) { nframes64_t old_pos = frame_position ; - + // do the standard stuff bool ret = TimeAxisViewItem::set_position(pos, src, delta) ; @@ -183,14 +183,14 @@ ImageFrameView::set_position(nframes64_t pos, void* src, double* delta) // calculate the offset of the marker MarkerView* mv = (MarkerView*)*i ; nframes64_t marker_old_pos = mv->get_position() ; - + mv->set_position(pos + (marker_old_pos - old_pos), src) ; } } - + return(ret) ; } - + /** * Sets the duration of this item * @@ -203,20 +203,20 @@ ImageFrameView::set_duration(nframes64_t dur, void* src) { /* do the standard stuff */ bool ret = TimeAxisViewItem::set_duration(dur, src) ; - + // eveything went ok with the standard stuff? if(ret) { /* handle setting the sizes of our canvas itesm based on the new duration */ imageframe->property_drawwidth() = trackview.editor.frame_to_pixel(get_duration()); } - + return(ret) ; } //---------------------------------------------------------------------------------------// // Parent Component Methods - + /** * Sets the parent ImageFrameTimeAxisGroup of thie item * each Item must be part of exactly one group (or 'scene') upon the timeline @@ -228,7 +228,7 @@ ImageFrameView::set_time_axis_group(ImageFrameTimeAxisGroup* group) { the_parent_group = group ; } - + /** * Returns the parent group of this item * @@ -243,7 +243,7 @@ ImageFrameView::get_time_axis_group() //---------------------------------------------------------------------------------------// // ui methods - + /** * Set the height of this item * @@ -265,7 +265,7 @@ ImageFrameView::set_height (gdouble h) name_pixbuf->raise_to_top(); frame_handle_start->raise_to_top(); frame_handle_end->raise_to_top(); - + name_pixbuf->property_y() = h - TimeAxisViewItem::NAME_Y_OFFSET; frame->property_y2() = h; @@ -287,12 +287,12 @@ void ImageFrameView::add_marker_view_item(MarkerView* item, void* src) { marker_view_list.push_back(item) ; - + item->GoingAway.connect(bind(mem_fun(*this, &ImageFrameView::remove_marker_view_item), (void*)this)); - + MarkerViewAdded(item, src) ; /* EMIT_SIGNAL */ } - + /** * Removes the named marker view from the list of marker view associated with this item * The Marker view is not destroyed on removal, so the caller must handle the item themself @@ -306,7 +306,7 @@ ImageFrameView::remove_named_marker_view_item(const string & markerId, void* src { MarkerView* mv = 0 ; MarkerViewList::iterator i = marker_view_list.begin() ; - + while(i != marker_view_list.end()) { if (((MarkerView*)*i)->get_item_name() == markerId) @@ -314,9 +314,9 @@ ImageFrameView::remove_named_marker_view_item(const string & markerId, void* src mv = (*i) ; marker_view_list.erase(i) ; - + MarkerViewRemoved(mv,src) ; /* EMIT_SIGNAL */ - + // iterator is now invalid, but since we should only ever have // one item with the specified name, things are ok, and we can // break from the while loop @@ -324,10 +324,10 @@ ImageFrameView::remove_named_marker_view_item(const string & markerId, void* src } i++ ; } - + return(mv) ; } - + /** * Removes item from the list of marker views assocaited with this item * This method will do nothing if item if not assiciated with this item @@ -341,13 +341,13 @@ ImageFrameView::remove_marker_view_item(MarkerView* mv, void* src) ENSURE_GUI_THREAD(bind (mem_fun(*this, &ImageFrameView::remove_marker_view_item), mv, src)); MarkerViewList::iterator i ; - + if((i = find (marker_view_list.begin(), marker_view_list.end(), mv)) != marker_view_list.end()) { marker_view_list.erase(i) ; MarkerViewRemoved (mv, src) ; /* EMIT_SIGNAL */ } } - + /** * Determines if the named marker is one of those associated with this item * @@ -357,17 +357,17 @@ bool ImageFrameView::has_marker_view_item(const string & mname) { bool result = false ; - + for (MarkerViewList::const_iterator ci = marker_view_list.begin(); ci != marker_view_list.end(); ++ci) { if (((MarkerView*)*ci)->get_item_name() == mname) { result = true ; - + // found the item, so we can break the for loop break ; } } - + return(result) ; } diff --git a/gtk2_ardour/imageframe_view.h b/gtk2_ardour/imageframe_view.h index 2026853654..281e09ebb8 100644 --- a/gtk2_ardour/imageframe_view.h +++ b/gtk2_ardour/imageframe_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,7 +43,7 @@ class ImageFrameView : public TimeAxisViewItem public: //---------------------------------------------------------------------------------------// // Constructor / Desctructor - + /** * Constructs a new ImageFrameView upon the canvas * @@ -77,12 +77,12 @@ class ImageFrameView : public TimeAxisViewItem * Reposible for removing and destroying all marker items associated with this item */ ~ImageFrameView() ; - + static sigc::signal<void,ImageFrameView*> GoingAway; - + //---------------------------------------------------------------------------------------// // Position and duration Accessors/Mutators - + /** * Set the position of this item to the specified value * @@ -91,7 +91,7 @@ class ImageFrameView : public TimeAxisViewItem * @return true if the position change was a success, false otherwise */ virtual bool set_position(nframes64_t pos, void* src, double* delta = 0) ; - + /** * Sets the duration of this item * @@ -100,10 +100,10 @@ class ImageFrameView : public TimeAxisViewItem * @return true if the duration change was succesful, false otherwise */ virtual bool set_duration(nframes64_t dur, void* src) ; - + //---------------------------------------------------------------------------------------// // Parent Component Methods - + /** * Sets the parent ImageFrameTimeAxisGroup of thie item * each Item must be part of exactly one group (or 'scene') upon the timeline @@ -111,25 +111,25 @@ class ImageFrameView : public TimeAxisViewItem * @param group the new parent group */ void set_time_axis_group(ImageFrameTimeAxisGroup* group) ; - + /** * Returns the parent group of this item * * @return the parent group of this item */ ImageFrameTimeAxisGroup* get_time_axis_group() ; - + //---------------------------------------------------------------------------------------// // ui methods - + /** * Set the height of this item * * @param h the new height */ virtual void set_height(gdouble h) ; - - + + //---------------------------------------------------------------------------------------// // MarkerView methods @@ -140,7 +140,7 @@ class ImageFrameView : public TimeAxisViewItem * @param src the identity of the object that initiated the change */ void add_marker_view_item(MarkerView* item, void* src) ; - + /** * Removes the named marker view from the list of marker view associated with this item * The Marker view is not destroyed on removal, so the caller must handle the item themself @@ -150,7 +150,7 @@ class ImageFrameView : public TimeAxisViewItem * @return the removed marker item */ MarkerView* remove_named_marker_view_item(const std::string & markId, void* src) ; - + /** * Removes item from the list of marker views assocaited with this item * This method will do nothing if item if not assiciated with this item @@ -160,7 +160,7 @@ class ImageFrameView : public TimeAxisViewItem * @param src the identity of the object that initiated the change */ void remove_marker_view_item(MarkerView* item, void* src) ; - + /** * Determines if the named marker is one of those associated with this item * @@ -168,13 +168,13 @@ class ImageFrameView : public TimeAxisViewItem */ bool has_marker_view_item(const std::string & markId) ; - + //---------------------------------------------------------------------------------// // Emitted Signals - + /** Emitted when a marker Item is added to this Item */ sigc::signal<void,MarkerView*,void*> MarkerViewAdded ; - + /** Emitted when a Marker Item is added to this Item */ sigc::signal<void,MarkerView*,void*> MarkerViewRemoved ; @@ -182,31 +182,31 @@ class ImageFrameView : public TimeAxisViewItem /** the list of MarkerViews associated with this item */ typedef std::list<MarkerView*> MarkerViewList ; MarkerViewList marker_view_list ; - - + + /** The parent group that this item is a member of */ ImageFrameTimeAxisGroup* the_parent_group ; - + // ------- Image data ----------- - + /** the image data that we display */ //unsigned char* the_rgb_data ; - + /** The width of the image contained within the_rgb_data */ uint32_t image_data_width ; - + /** The height of the image contained within the_rgb_data */ uint32_t image_data_height ; - + /** the number of channels contained in the_rgb_data */ uint32_t image_data_num_channels ; - - + + // ------- Our canvas element ----------- - + /** the CanvasImageFrame to display the image */ ArdourCanvas::ImageFrame* imageframe ; - + } ; /* class ImageFrameView */ #endif /* __gtk_ardour_imageframe_view_h__ */ diff --git a/gtk2_ardour/interactive-item.h b/gtk2_ardour/interactive-item.h index 25406bd766..a37b3be3dc 100644 --- a/gtk2_ardour/interactive-item.h +++ b/gtk2_ardour/interactive-item.h @@ -41,16 +41,16 @@ public: */ class InteractiveText : public Text, public InteractiveItem { public: - InteractiveText(Group& parent, InteractiveItem* parent_item, double x, double y, const Glib::ustring& text) - : Text(parent, x, y, text) + InteractiveText(Group& parent, InteractiveItem* parent_item, double x, double y, const Glib::ustring& text) + : Text(parent, x, y, text) , _parent_item(parent_item) {} - + InteractiveText(Group& parent, InteractiveItem* parent_item) : Text(parent) , _parent_item(parent_item) {} - + bool on_event(GdkEvent* ev) { if(_parent_item) { return _parent_item->on_event(ev); @@ -58,7 +58,7 @@ public: return false; } } - + protected: InteractiveItem* _parent_item; }; @@ -67,11 +67,11 @@ class InteractiveRect: public SimpleRect, public InteractiveItem { public: InteractiveRect(Group& parent, InteractiveItem* parent_item, - double x1, double y1, double x2, double y2) - : SimpleRect(parent, x1, y1, x2, y2) + double x1, double y1, double x2, double y2) + : SimpleRect(parent, x1, y1, x2, y2) , _parent_item(parent_item) {} - + bool on_event(GdkEvent* ev) { if (_parent_item) { return _parent_item->on_event(ev); diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index 430714f1ae..519445f12a 100644 --- a/gtk2_ardour/io_selector.cc +++ b/gtk2_ardour/io_selector.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2007 Paul Davis + Copyright (C) 2002-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -59,7 +59,7 @@ IOSelector::IOSelector (Gtk::Window* p, ARDOUR::Session& session, boost::shared_ _port_group.reset (new PortGroup ("")); _ports[_ours].add_group (_port_group); - + setup_all_ports (); } @@ -71,7 +71,7 @@ IOSelector::setup_ports (int dim) if (dim == _other) { _ports[_other].gather (_session, _find_inputs_for_io_outputs); - + } else { _port_group->clear (); @@ -124,7 +124,7 @@ IOSelector::get_state (ARDOUR::BundleChannel c[2]) const /* since we are talking about an IO, our ports should all have an associated Port *, so the above call should never fail */ assert (f); - + if (!f->connected_to (*j)) { /* if any one thing is not connected, all bets are off */ return PortMatrixNode::NOT_ASSOCIATED; @@ -190,13 +190,13 @@ IOSelectorWindow::on_show () Gtk::Window::on_show (); pair<uint32_t, uint32_t> const pm_max = _selector.max_size (); resize_window_to_proportion_of_monitor (this, pm_max.first, pm_max.second); -} +} void IOSelectorWindow::io_name_changed (void* src) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &IOSelectorWindow::io_name_changed), src)); - + string title; if (!_selector.find_inputs_for_io_outputs()) { @@ -214,7 +214,7 @@ PortInsertUI::PortInsertUI (Gtk::Window* parent, ARDOUR::Session& sess, boost::s { output_selector.set_min_height_divisor (2); input_selector.set_min_height_divisor (2); - + pack_start (output_selector, true, true); pack_start (input_selector, true, true); } @@ -245,7 +245,7 @@ PortInsertWindow::PortInsertWindow (ARDOUR::Session& sess, boost::shared_ptr<ARD string title = _("ardour: "); title += pi->name(); set_title (title); - + ok_button.set_name ("IOSelectorButton"); if (!can_cancel) { ok_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::CLOSE, Gtk::ICON_SIZE_BUTTON))); @@ -266,7 +266,7 @@ PortInsertWindow::PortInsertWindow (ARDOUR::Session& sess, boost::shared_ptr<ARD cancel_button.signal_clicked().connect (mem_fun (*this, &PortInsertWindow::cancel)); signal_delete_event().connect (mem_fun (*this, &PortInsertWindow::wm_delete), false); - + going_away_connection = pi->GoingAway.connect (mem_fun (*this, &PortInsertWindow::plugin_going_away)); } @@ -281,7 +281,7 @@ void PortInsertWindow::plugin_going_away () { ENSURE_GUI_THREAD (mem_fun (*this, &PortInsertWindow::plugin_going_away)); - + going_away_connection.disconnect (); delete_when_idle (this); } diff --git a/gtk2_ardour/io_selector.h b/gtk2_ardour/io_selector.h index 02a09a5196..f8822cf1af 100644 --- a/gtk2_ardour/io_selector.h +++ b/gtk2_ardour/io_selector.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2007 Paul Davis + Copyright (C) 2002-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,7 +43,7 @@ class IOSelector : public PortMatrix std::string channel_noun () const { return _("port"); } - + uint32_t n_io_ports () const; boost::shared_ptr<ARDOUR::IO> const io () { return _io; } void setup_ports (int); @@ -80,10 +80,10 @@ class IOSelectorWindow : public Gtk::Window protected: void on_map (); void on_show (); - + private: IOSelector _selector; - + void io_name_changed (void *src); bool wm_delete (GdkEventAny*); }; @@ -91,9 +91,9 @@ class IOSelectorWindow : public Gtk::Window class PortInsertUI : public Gtk::VBox { - public: + public: PortInsertUI (Gtk::Window*, ARDOUR::Session&, boost::shared_ptr<ARDOUR::PortInsert>); - + void redisplay (); void finished (IOSelector::Result); @@ -104,20 +104,20 @@ class PortInsertUI : public Gtk::VBox class PortInsertWindow : public ArdourDialog { - public: + public: PortInsertWindow (ARDOUR::Session&, boost::shared_ptr<ARDOUR::PortInsert>, bool can_cancel = false); - + protected: void on_map (); - + private: PortInsertUI _portinsertui; Gtk::VBox vbox; - + Gtk::Button ok_button; Gtk::Button cancel_button; Gtk::Frame button_frame; - + void cancel (); void accept (); diff --git a/gtk2_ardour/itest.cc b/gtk2_ardour/itest.cc index 97c8937f39..29d15aee98 100644 --- a/gtk2_ardour/itest.cc +++ b/gtk2_ardour/itest.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ using namespace Gtkmm2ext; using namespace Glib; struct ModelColumns : public TreeModel::ColumnRecord { - ModelColumns() { + ModelColumns() { add (used); add (text); add (port); @@ -60,12 +60,12 @@ fill_it (RefPtr<TreeStore> model, TreeView* display, ModelColumns* columns) display->set_model (RefPtr<TreeStore>(0)); model->clear (); - + const char ** ports; typedef map<string,vector<pair<string,string> > > PortMap; PortMap portmap; PortMap::iterator i; - + ports = jack_get_ports (jack, "", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput); if (ports == 0) { @@ -73,7 +73,7 @@ fill_it (RefPtr<TreeStore> model, TreeView* display, ModelColumns* columns) } /* find all the client names and group their ports into a list-by-client */ - + for (int n = 0; ports[n]; ++n) { pair<string,vector<pair<string,string> > > newpair; @@ -86,10 +86,10 @@ fill_it (RefPtr<TreeStore> model, TreeView* display, ModelColumns* columns) pos = str.find (':'); - newpair.first = str.substr (0, pos); + newpair.first = str.substr (0, pos); portname = str.substr (pos+1); - /* this may or may not succeed at actually inserting. + /* this may or may not succeed at actually inserting. we don't care, however: we just want an iterator that gives us either the inserted element or the existing one with the same name. @@ -117,7 +117,7 @@ fill_it (RefPtr<TreeStore> model, TreeView* display, ModelColumns* columns) for (vector<pair<string,string> >::iterator s = i->second.begin(); s != i->second.end(); ++s) { /* s->first is a port name */ - + TreeModel::Row row = *(model->append (parent.children())); row[columns->used] = ((random()%2) == 1); @@ -172,14 +172,14 @@ main (int argc, char* argv[]) RefPtr<TreeStore> modelA = TreeStore::create (columns); RefPtr<TreeStore> modelB = TreeStore::create (columns); - + displayA.set_model (modelA); displayA.append_column ("Use", columns.used); displayA.append_column ("Source/Port", columns.text); displayA.set_reorderable (true); displayA.add_object_drag (columns.port.index(), "ports"); displayA.signal_object_drop.connect (ptr_fun (object_drop)); - + displayA.get_selection()->set_mode (SELECTION_MULTIPLE); displayA.get_selection()->set_select_function (bind (ptr_fun (selection_filter), &columns)); displayA.get_selection()->signal_changed().connect (bind (ptr_fun (selection_changed), modelA, &displayA, &columns)); @@ -203,14 +203,14 @@ main (int argc, char* argv[]) vpacker.pack_start (hpacker); vpacker.pack_start (rescan, false, false); - + win.add (vpacker); win.set_size_request (500, 400); win.show_all (); - + rescan.signal_clicked().connect (bind (ptr_fun (fill_it), modelA, &displayA, &columns)); rescan.signal_clicked().connect (bind (ptr_fun (fill_it), modelB, &displayB, &columns)); - + fill_it (modelA, &displayA, &columns); fill_it (modelB, &displayB, &columns); diff --git a/gtk2_ardour/keyboard.cc b/gtk2_ardour/keyboard.cc index 1cbe6bee0f..a368b6a8de 100644 --- a/gtk2_ardour/keyboard.cc +++ b/gtk2_ardour/keyboard.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,15 +63,15 @@ guint Keyboard::SecondaryModifier = GDK_MOD1_MASK; // Alt/Option guint Keyboard::TertiaryModifier = GDK_SHIFT_MASK; // Shift guint Keyboard::Level4Modifier = GDK_CONTROL_MASK; // Control guint Keyboard::CopyModifier = GDK_MOD1_MASK; // Alt/Option -guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK; +guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK; guint Keyboard::button2_modifiers = Keyboard::SecondaryModifier|Keyboard::Level4Modifier; #else guint Keyboard::PrimaryModifier = GDK_CONTROL_MASK; // Control guint Keyboard::SecondaryModifier = GDK_MOD1_MASK; // Alt/Option guint Keyboard::TertiaryModifier = GDK_SHIFT_MASK; // Shift guint Keyboard::Level4Modifier = GDK_MOD4_MASK; // Mod4/Windows -guint Keyboard::CopyModifier = GDK_CONTROL_MASK; -guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK; +guint Keyboard::CopyModifier = GDK_CONTROL_MASK; +guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK; guint Keyboard::button2_modifiers = 0; /* not used */ #endif @@ -92,7 +92,7 @@ map<AccelKey,pair<string,string>,Keyboard::AccelKeyLess> Keyboard::release_keys; GdkModifierType Keyboard::RelevantModifierKeyMask; void -Keyboard::magic_widget_grab_focus () +Keyboard::magic_widget_grab_focus () { _some_magic_widget_has_focus = true; } @@ -137,7 +137,7 @@ Keyboard::~Keyboard () gtk_key_snooper_remove (snooper_id); } -XMLNode& +XMLNode& Keyboard::get_state (void) { XMLNode* node = new XMLNode ("Keyboard"); @@ -157,30 +157,30 @@ Keyboard::get_state (void) return *node; } -int +int Keyboard::set_state (const XMLNode& node) { const XMLProperty* prop; if ((prop = node.property ("edit-button")) != 0) { sscanf (prop->value().c_str(), "%d", &edit_but); - } + } if ((prop = node.property ("edit-modifier")) != 0) { sscanf (prop->value().c_str(), "%d", &edit_mod); - } + } if ((prop = node.property ("delete-button")) != 0) { sscanf (prop->value().c_str(), "%d", &delete_but); - } + } if ((prop = node.property ("delete-modifier")) != 0) { sscanf (prop->value().c_str(), "%d", &delete_mod); - } + } if ((prop = node.property ("snap-modifier")) != 0) { sscanf (prop->value().c_str(), "%d", &snap_mod); - } + } return 0; } @@ -198,14 +198,14 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event) bool ret = false; #if 0 - cerr << "snoop widget " << widget << " key " << event->keyval << " type: " << event->type + cerr << "snoop widget " << widget << " key " << event->keyval << " type: " << event->type << " state " << std::hex << event->state << std::dec << endl; #endif #if KBD_DEBUG if (debug_keyboard) { - cerr << "snoop widget " << widget << " key " << event->keyval << " type: " << event->type + cerr << "snoop widget " << widget << " key " << event->keyval << " type: " << event->type << endl; } #endif @@ -219,7 +219,7 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event) } else { keyval = event->keyval; } - + if (event->type == GDK_KEY_PRESS) { if (find (state.begin(), state.end(), keyval) == state.end()) { @@ -235,7 +235,7 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event) for (map<AccelKey,two_strings,AccelKeyLess>::iterator k = release_keys.begin(); k != release_keys.end(); ++k) { const AccelKey& ak (k->first); - + if (keyval == ak.get_key() && (Gdk::ModifierType)((event->state & Keyboard::RelevantModifierKeyMask) | Gdk::RELEASE_MASK) == ak.get_mod()) { cerr << "Suppress auto repeat\n"; ret = true; @@ -247,11 +247,11 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event) } else if (event->type == GDK_KEY_RELEASE) { State::iterator i; - + if ((i = find (state.begin(), state.end(), keyval)) != state.end()) { state.erase (i); sort (state.begin(), state.end()); - } + } for (map<AccelKey,two_strings,AccelKeyLess>::iterator k = release_keys.begin(); k != release_keys.end(); ++k) { @@ -313,13 +313,13 @@ Keyboard::leave_window (GdkEventCrossing *ev, Gtk::Window* /*win*/) cerr << "INFERIOR crossing ... out\n"; } break; - + case GDK_NOTIFY_VIRTUAL: if (debug_keyboard) { cerr << "VIRTUAL crossing ... out\n"; } /* fallthru */ - + default: if (debug_keyboard) { cerr << "REAL CROSSING ... out\n"; @@ -382,8 +382,8 @@ Keyboard::set_snap_modifier (guint mod) bool Keyboard::is_edit_event (GdkEventButton *ev) { - return (ev->type == GDK_BUTTON_PRESS || ev->type == GDK_BUTTON_RELEASE) && - (ev->button == Keyboard::edit_button()) && + return (ev->type == GDK_BUTTON_PRESS || ev->type == GDK_BUTTON_RELEASE) && + (ev->button == Keyboard::edit_button()) && ((ev->state & RelevantModifierKeyMask) == Keyboard::edit_modifier()); } @@ -391,31 +391,31 @@ bool Keyboard::is_button2_event (GdkEventButton* ev) { #ifdef GTKOSX - return (ev->button == 2) || - ((ev->button == 1) && + return (ev->button == 2) || + ((ev->button == 1) && ((ev->state & Keyboard::button2_modifiers) == Keyboard::button2_modifiers)); #else return ev->button == 2; -#endif +#endif } bool Keyboard::is_delete_event (GdkEventButton *ev) { - return (ev->type == GDK_BUTTON_PRESS || ev->type == GDK_BUTTON_RELEASE) && - (ev->button == Keyboard::delete_button()) && + return (ev->type == GDK_BUTTON_PRESS || ev->type == GDK_BUTTON_RELEASE) && + (ev->button == Keyboard::delete_button()) && ((ev->state & RelevantModifierKeyMask) == Keyboard::delete_modifier()); } bool Keyboard::is_context_menu_event (GdkEventButton *ev) { - return (ev->type == GDK_BUTTON_PRESS || ev->type == GDK_BUTTON_RELEASE) && - (ev->button == 3) && + return (ev->type == GDK_BUTTON_PRESS || ev->type == GDK_BUTTON_RELEASE) && + (ev->button == 3) && ((ev->state & RelevantModifierKeyMask) == 0); } -bool +bool Keyboard::no_modifiers_active (guint state) { return (state & RelevantModifierKeyMask) == 0; @@ -448,7 +448,7 @@ Keyboard::selection_type (guint state) } -static void +static void accel_map_changed (GtkAccelMap* /*map*/, gchar* /*path*/, guint /*key*/, @@ -479,7 +479,7 @@ Keyboard::save_keybindings () { if (can_save_keybindings && bindings_changed_after_save_became_legal) { Gtk::AccelMap::save (user_keybindings_path); - } + } } void @@ -494,7 +494,7 @@ Keyboard::setup_keybindings () ARDOUR::find_bindings_files (binding_files); /* set up the per-user bindings path */ - + strs.push_back (Glib::get_home_dir()); strs.push_back (".ardour3"); strs.push_back ("ardour.bindings"); @@ -513,16 +513,16 @@ Keyboard::setup_keybindings () */ if (!keybindings_path.empty() && keybindings_path.find (".bindings") == string::npos) { - + // just a style name - allow user to - // specify the layout type. - + // specify the layout type. + char* layout; - + if ((layout = getenv ("ARDOUR_KEYBOARD_LAYOUT")) != 0 && layout[0] != '\0') { - + /* user-specified keyboard layout */ - + keybindings_path += '-'; keybindings_path += layout; @@ -532,23 +532,23 @@ Keyboard::setup_keybindings () keybindings_path += "-us"; } - + keybindings_path += ".bindings"; - } + } if (keybindings_path.empty()) { /* no path or binding name given: check the user one first */ if (!Glib::file_test (user_keybindings_path, Glib::FILE_TEST_EXISTS)) { - + keybindings_path = ""; } else { - + keybindings_path = user_keybindings_path; } - } + } /* if we still don't have a path at this point, use the default */ @@ -559,19 +559,19 @@ Keyboard::setup_keybindings () while (true) { if (!Glib::path_is_absolute (keybindings_path)) { - + /* not absolute - look in the usual places */ sys::path keybindings_file; SearchPath spath = ardour_search_path() + user_config_directory() + system_config_search_path(); if ( ! find_file_in_search_path (spath, keybindings_path, keybindings_file)) { - + if (keybindings_path == default_bindings) { error << _("Default keybindings not found - Ardour will be hard to use!") << endmsg; return; } else { - warning << string_compose (_("Key bindings file \"%1\" not found. Default bindings used instead"), + warning << string_compose (_("Key bindings file \"%1\" not found. Default bindings used instead"), keybindings_path) << endmsg; keybindings_path = default_bindings; @@ -583,11 +583,11 @@ Keyboard::setup_keybindings () keybindings_path = keybindings_file.to_string(); break; - + } } else { - + /* path is absolute already */ if (!Glib::file_test (keybindings_path, Glib::FILE_TEST_EXISTS)) { @@ -595,7 +595,7 @@ Keyboard::setup_keybindings () error << _("Default keybindings not found - Ardour will be hard to use!") << endmsg; return; } else { - warning << string_compose (_("Key bindings file \"%1\" not found. Default bindings used instead"), + warning << string_compose (_("Key bindings file \"%1\" not found. Default bindings used instead"), keybindings_path) << endmsg; keybindings_path = default_bindings; @@ -644,9 +644,9 @@ Keyboard::load_keybindings (string path) vector<string> groups; vector<string> names; vector<AccelKey> bindings; - + ActionManager::get_all_actions (groups, names, bindings); - + vector<string>::iterator g; vector<AccelKey>::iterator b; vector<string>::iterator n; @@ -654,19 +654,19 @@ Keyboard::load_keybindings (string path) release_keys.clear (); bool show_bindings = (getenv ("ARDOUR_SHOW_BINDINGS") != 0); - + for (n = names.begin(), b = bindings.begin(), g = groups.begin(); n != names.end(); ++n, ++b, ++g) { - + if (show_bindings) { - + cerr << "Action: " << (*n) << " Group: " << (*g) << " binding = "; - + if ((*b).get_key() != GDK_VoidSymbol) { cerr << (*b).get_key() << " w/mod = " << hex << (*b).get_mod() << dec << " = " << (*b).get_abbrev(); } else { cerr << "unbound"; } - + cerr << endl; } } diff --git a/gtk2_ardour/keyboard.h b/gtk2_ardour/keyboard.h index cff45b11f2..db55b08b5e 100644 --- a/gtk2_ardour/keyboard.h +++ b/gtk2_ardour/keyboard.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/keyeditor.cc b/gtk2_ardour/keyeditor.cc index 4a7d861297..6b1aec7f4e 100644 --- a/gtk2_ardour/keyeditor.cc +++ b/gtk2_ardour/keyeditor.cc @@ -29,7 +29,7 @@ KeyEditor::KeyEditor () : ArdourDialog (_("Shortcut Editor"), false) , unbind_button (_("Remove shortcut")) , unbind_box (BUTTONBOX_END) - + { can_bind = false; last_state = 0; @@ -46,9 +46,9 @@ KeyEditor::KeyEditor () view.set_enable_search (false); view.set_rules_hint (true); view.set_name (X_("KeyEditorTree")); - + view.get_selection()->signal_changed().connect (mem_fun (*this, &KeyEditor::action_selected)); - + scroller.add (view); scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); @@ -68,7 +68,7 @@ KeyEditor::KeyEditor () get_vbox()->pack_start (unbind_box, false, false); unbind_box.show (); unbind_button.show (); - + } get_vbox()->set_border_width (12); @@ -83,15 +83,15 @@ void KeyEditor::unbind () { TreeModel::iterator i = view.get_selection()->get_selected(); - + unbind_button.set_sensitive (false); if (i != model->children().end()) { string path = (*i)[columns.path]; - + if (!(*i)[columns.bindable]) { return; - } + } bool result = AccelMap::change_entry (path, 0, @@ -125,16 +125,16 @@ KeyEditor::action_selected () } TreeModel::iterator i = view.get_selection()->get_selected(); - + unbind_button.set_sensitive (false); if (i != model->children().end()) { string path = (*i)[columns.path]; - + if (!(*i)[columns.bindable]) { return; - } + } string binding = (*i)[columns.binding]; @@ -163,10 +163,10 @@ KeyEditor::on_key_release_event (GdkEventKey* ev) if (i != model->children().end()) { string path = (*i)[columns.path]; - + if (!(*i)[columns.bindable]) { goto out; - } + } possibly_translate_keyval_to_make_legal_accelerator (ev->keyval); @@ -180,7 +180,7 @@ KeyEditor::on_key_release_event (GdkEventKey* ev) AccelKey key; known = ActionManager::lookup_entry (path, key); - + if (known) { (*i)[columns.binding] = ActionManager::ui_manager->get_accel_group()->name (key.get_key(), Gdk::ModifierType (key.get_mod())); } else { @@ -204,9 +204,9 @@ KeyEditor::populate () typedef std::map<string,TreeIter> NodeMap; NodeMap nodes; NodeMap::iterator r; - + ActionManager::get_all_actions (labels, paths, keys, bindings); - + vector<string>::iterator k; vector<string>::iterator p; vector<string>::iterator l; @@ -217,11 +217,11 @@ KeyEditor::populate () TreeModel::Row row; vector<string> parts; - + parts.clear (); split (*p, parts, '/'); - + if (parts.empty()) { continue; } @@ -241,17 +241,17 @@ KeyEditor::populate () row = *(model->append (parent.children())); } else { - + row = *(model->append ((*r->second)->children())); } - + /* add this action */ row[columns.action] = (*l); row[columns.path] = (*p); row[columns.bindable] = true; - + if (*k == ActionManager::unbound_string) { row[columns.binding] = string(); } else { @@ -261,7 +261,7 @@ KeyEditor::populate () /* Gtk/Quartz maps: NSAlternate/NSOption key to Mod1 - NSCommand key to Meta + NSCommand key to Meta */ replace_all (label, "<Meta>", _("Command-")); @@ -269,7 +269,7 @@ KeyEditor::populate () replace_all (label, "<Shift>", _("Shift-")); replace_all (label, "<Control>", _("Control-")); row[columns.binding] = label; -#else +#else row[columns.binding] = (*k); #endif } diff --git a/gtk2_ardour/keyeditor.h b/gtk2_ardour/keyeditor.h index 085bfbb6d9..e7d2a3e9f7 100644 --- a/gtk2_ardour/keyeditor.h +++ b/gtk2_ardour/keyeditor.h @@ -15,7 +15,7 @@ class KeyEditor : public ArdourDialog { public: KeyEditor (); - + protected: void on_show (); void on_unmap (); diff --git a/gtk2_ardour/latency_gui.cc b/gtk2_ardour/latency_gui.cc index 08c59dc64d..6ff189e35f 100644 --- a/gtk2_ardour/latency_gui.cc +++ b/gtk2_ardour/latency_gui.cc @@ -36,7 +36,7 @@ LatencyBarController::get_label (int&) } else { s << std::fixed << std::setprecision (2) << (nframes / (_latency_gui->sample_rate / 1000.0)) << " msecs"; } - + return s.str (); } @@ -57,7 +57,7 @@ LatencyGUI::LatencyGUI (Latent& l, nframes64_t sr, nframes64_t psz) unit_strings = I18N (_unit_strings); } - set_popdown_strings (units_combo, unit_strings); + set_popdown_strings (units_combo, unit_strings); units_combo.set_active_text (unit_strings.front()); w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON)); @@ -144,14 +144,14 @@ LatencyDialog::LatencyDialog (const Glib::ustring& title, Latent& l, nframes64_t : ArdourDialog (title, false, true), lwidget (l, sr, psz) { - + get_vbox()->pack_start (lwidget); add_button (Stock::CANCEL, RESPONSE_CANCEL); add_button (Stock::APPLY, RESPONSE_REJECT); add_button (Stock::OK, RESPONSE_ACCEPT); show_all (); - + while (true) { int ret = run (); diff --git a/gtk2_ardour/latency_gui.h b/gtk2_ardour/latency_gui.h index 9d36103ed7..9844bfaf8f 100644 --- a/gtk2_ardour/latency_gui.h +++ b/gtk2_ardour/latency_gui.h @@ -28,12 +28,12 @@ public: LatencyBarController (Gtk::Adjustment& adj, LatencyGUI* g) : BarController (adj, boost::shared_ptr<PBD::IgnorableControllable> (new PBD::IgnorableControllable ())), _latency_gui (g) {} - + private: LatencyGUI* _latency_gui; - + std::string get_label (int&); -}; +}; class LatencyGUI : public Gtk::VBox { diff --git a/gtk2_ardour/level_meter.cc b/gtk2_ardour/level_meter.cc index e0a8f8fb51..392aec20bf 100644 --- a/gtk2_ardour/level_meter.cc +++ b/gtk2_ardour/level_meter.cc @@ -100,7 +100,7 @@ LevelMeter::update_meters () if (!_meter) { return 0.0f; } - + for (n = 0, i = meters.begin(); i != meters.end(); ++i, ++n) { if ((*i).packed) { peak = _meter->peak_power (n); @@ -123,12 +123,12 @@ LevelMeter::parameter_changed (string p) ENSURE_GUI_THREAD (bind (mem_fun(*this, &LevelMeter::parameter_changed), p)); if (p == "meter-hold") { - + vector<MeterInfo>::iterator i; uint32_t n; - + for (n = 0, i = meters.begin(); i != meters.end(); ++i, ++n) { - + (*i).meter->set_hold_count ((uint32_t) floor(Config->get_meter_hold())); } } @@ -160,7 +160,7 @@ LevelMeter::setup_meters (int len, int initial_width) if (!_meter) { return; /* do it later or never */ } - + int32_t nmidi = _meter->input_streams().n_midi(); uint32_t nmeters = _meter->input_streams().n_total(); regular_meter_width = initial_width; @@ -223,7 +223,7 @@ LevelMeter::meter_button_release (GdkEventButton* ev, uint32_t /*which*/) } return true; } - + void LevelMeter::clear_meters () { diff --git a/gtk2_ardour/level_meter.h b/gtk2_ardour/level_meter.h index a2bbd5f4a1..bf0e081cce 100644 --- a/gtk2_ardour/level_meter.h +++ b/gtk2_ardour/level_meter.h @@ -74,10 +74,10 @@ class LevelMeter : public Gtk::HBox struct MeterInfo { Gtkmm2ext::FastMeter *meter; gint16 width; - int length; + int length; bool packed; - - MeterInfo() { + + MeterInfo() { meter = 0; width = 0; length = 0; @@ -92,7 +92,7 @@ class LevelMeter : public Gtk::HBox float max_peak; sigc::connection _configuration_connection; - + void hide_all_meters (); gint meter_button_release (GdkEventButton*, uint32_t); diff --git a/gtk2_ardour/lineset.cc b/gtk2_ardour/lineset.cc index 772824a533..835c82920c 100644 --- a/gtk2_ardour/lineset.cc +++ b/gtk2_ardour/lineset.cc @@ -179,7 +179,7 @@ LineSet::add_line(double coord, double width, uint32_t color) Line l(coord, width, color); Lines::iterator it = std::lower_bound(lines.begin(), lines.end(), l, line_compare); - + /* overlap checking */ if (it != lines.end()) { if (l.coord + l.width > it->coord) { @@ -195,7 +195,7 @@ LineSet::add_line(double coord, double width, uint32_t color) } ++it; } - + lines.insert(it, l); region_needs_update(coord, coord + width); } @@ -228,13 +228,13 @@ LineSet::remove_until(double coord) { if (!lines.empty()) { double first = lines.front().coord; - + // code region_needs_update(first, coord); } } - + void LineSet::remove_from(double coord) { @@ -253,7 +253,7 @@ LineSet::clear() if (!lines.empty()) { double coord1 = lines.front().coord; double coord2 = lines.back().coord + lines.back().width; - + lines.clear(); region_needs_update(coord1, coord2); } @@ -300,10 +300,10 @@ LineSet::line_at(double coord) Line dummy(coord); cached_pos = lower_bound(lines.begin(), lines.end(), dummy, line_compare); - + /* The iterator found should point to the element after the one we want. */ --cached_pos; - + if (cached_pos != lines.end()) { if (cached_pos->coord <= coord) { if (cached_pos->coord + cached_pos->width >= coord) { @@ -356,7 +356,7 @@ LineSet::update_lines(bool need_redraw) LineSet::bounds_vfunc(&redraw.x0, &redraw.y0, &redraw.x1, &redraw.y1); i2w(redraw.x0, redraw.y0); i2w(redraw.x1, redraw.y1); - + if (orientation == Vertical) { redraw.x1 = redraw.x0 + update_region2; redraw.x0 += update_region1; @@ -401,7 +401,7 @@ LineSet::update_bounds() item->y1 = new_b.y0; item->x2 = new_b.x1; item->y2 = new_b.y1; - + /* Update bounding box used in rendering function */ cv.w2c(new_b.x0, new_b.y0, bbox.x0, bbox.y0); cv.w2c(new_b.x1, new_b.y1, bbox.x1, bbox.y1); @@ -428,7 +428,7 @@ LineSet::update_bounds() redraw.y1 = max(old_b.y1, new_b.y1); redraw_request(redraw); } - + if (new_b.x1 > old_b.x1) { // we have a larger area ==> possibly more lines request_lines(old_b.x1, new_b.x1); @@ -470,7 +470,7 @@ LineSet::update_bounds() redraw.x1 = max(old_b.x1, new_b.x1); redraw_request(redraw); } - + if (new_b.y1 > old_b.y1) { // we have a larger area ==> possibly more lines request_lines(old_b.y1, new_b.y1); @@ -604,7 +604,7 @@ LineSet::render_vfunc(GnomeCanvasBuf* buf) /** * The first and the last line in this render have to be handled separately from those in between, because those lines - * may be cut off at the ends. + * may be cut off at the ends. */ if (orientation == Vertical) { @@ -633,7 +633,7 @@ LineSet::render_vfunc(GnomeCanvasBuf* buf) for (; it != end; ++it) { pos0 = ((int) floor(it->coord)) + offset; pos1 = pos0 + ((int) floor(it->width)); - + if (pos1 > rect.x0) { pos0 = max(pos0, rect.x0); paint_vert(buf, *it, pos0, rect.y0, pos1, rect.y1); @@ -641,7 +641,7 @@ LineSet::render_vfunc(GnomeCanvasBuf* buf) break; } } - + // render what's between the first and last lines for (; it != end; ++it) { pos0 = ((int) floor(it->coord)) + offset; @@ -675,7 +675,7 @@ LineSet::render_vfunc(GnomeCanvasBuf* buf) for (; it != end; ++it) { pos0 = ((int) floor(it->coord)) + offset; pos1 = pos0 + ((int) floor(it->width)); - + if (pos1 > rect.y0) { pos0 = max(pos0, rect.y0); paint_horiz(buf, *it, rect.x0, pos0, rect.x1, pos1); @@ -683,7 +683,7 @@ LineSet::render_vfunc(GnomeCanvasBuf* buf) break; } } - + // render what's between the first and last lines for (; it != end; ++it) { pos0 = ((int) floor(it->coord)) + offset; @@ -775,7 +775,7 @@ LineSet::region_needs_update(double coord1, double coord2) * Don't know why this happens */ bool LineSet::on_event(GdkEvent* /*p1*/) -{ +{ return false; } diff --git a/gtk2_ardour/lineset.h b/gtk2_ardour/lineset.h index 08b3371121..e4f836717f 100644 --- a/gtk2_ardour/lineset.h +++ b/gtk2_ardour/lineset.h @@ -82,7 +82,7 @@ public: /** Remove the line at coord */ void remove_line(double coord); - + /** Remove all lines in a coordinate range */ void remove_lines(double c1, double c2); @@ -90,7 +90,7 @@ public: /** Remove all lines with a coordinate lower than coord */ void remove_until(double coord); - + /** Remove all lines with a coordinate equal to or higher than coord. */ void remove_from(double coord); @@ -127,7 +127,7 @@ public: /* debug */ void print_lines(); - + protected: struct Line { Line(double c, double w, uint32_t color); diff --git a/gtk2_ardour/location_ui.cc b/gtk2_ardour/location_ui.cc index 7aeb8b3301..b04d179c59 100644 --- a/gtk2_ardour/location_ui.cc +++ b/gtk2_ardour/location_ui.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -61,7 +61,7 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num) preemph_check_button (_("Pre-Emphasis")) { - + i_am_the_modifier = 0; number_label.set_name ("LocationEditNumberLabel"); @@ -85,7 +85,7 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num) ARDOUR_UI::instance()->tooltips().set_tip(start_set_button, _("Set value to Playhead")); ARDOUR_UI::instance()->tooltips().set_tip(end_set_button, _("Set value to Playhead")); - + isrc_label.set_text ("ISRC: "); isrc_label.set_size_request (30, -1); performer_label.set_text ("Performer: "); @@ -112,7 +112,7 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num) cd_track_details_hbox.pack_start (composer_label, false, false); cd_track_details_hbox.pack_start (composer_entry, true, true); - isrc_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::isrc_entry_changed)); + isrc_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::isrc_entry_changed)); performer_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::performer_entry_changed)); composer_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::composer_entry_changed)); scms_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::scms_toggled)); @@ -123,31 +123,31 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num) item_table.attach (number_label, 0, 1, 0, 1, FILL, FILL, 3, 0); - + start_hbox.pack_start (start_go_button, false, false); start_hbox.pack_start (start_clock, false, false); start_hbox.pack_start (start_set_button, false, false); item_table.attach (start_hbox, 2, 3, 0, 1, FILL, FILL, 4, 0); - + start_set_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::set_button_pressed), LocStart)); start_go_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::go_button_pressed), LocStart)); start_clock.ValueChanged.connect (bind (mem_fun (*this, &LocationEditRow::clock_changed), LocStart)); start_clock.ChangeAborted.connect (bind (mem_fun (*this, &LocationEditRow::change_aborted), LocStart)); - + end_hbox.pack_start (end_go_button, false, false); end_hbox.pack_start (end_clock, false, false); end_hbox.pack_start (end_set_button, false, false); - + //item_table.attach (end_hbox, 2, 3, 0, 1, 0, 0, 4, 0); - + end_set_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::set_button_pressed), LocEnd)); end_go_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::go_button_pressed), LocEnd)); end_clock.ValueChanged.connect (bind (mem_fun (*this, &LocationEditRow::clock_changed), LocEnd)); end_clock.ChangeAborted.connect (bind (mem_fun (*this, &LocationEditRow::change_aborted), LocEnd)); - + // item_table.attach (length_clock, 3, 4, 0, 1, 0, 0, 4, 0); length_clock.ValueChanged.connect (bind ( mem_fun(*this, &LocationEditRow::clock_changed), LocLength)); length_clock.ChangeAborted.connect (bind (mem_fun (*this, &LocationEditRow::change_aborted), LocLength)); @@ -155,10 +155,10 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num) // item_table.attach (cd_check_button, 4, 5, 0, 1, 0, Gtk::FILL, 4, 0); // item_table.attach (hide_check_button, 5, 6, 0, 1, 0, Gtk::FILL, 4, 0); // item_table.attach (remove_button, 7, 8, 0, 1, 0, Gtk::FILL, 4, 0); - + cd_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::cd_toggled)); hide_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::hide_toggled)); - + remove_button.signal_clicked().connect(mem_fun(*this, &LocationEditRow::remove_button_pressed)); pack_start(item_table, true, true); @@ -187,8 +187,8 @@ LocationEditRow::set_session (Session *sess) start_clock.set_session (session); end_clock.set_session (session); - length_clock.set_session (session); - + length_clock.set_session (session); + } void @@ -220,7 +220,7 @@ LocationEditRow::set_location (Location *loc) item_table.attach (hide_check_button, 6, 7, 0, 1, FILL, Gtk::FILL, 4, 0); } hide_check_button.set_active (location->is_hidden()); - + if (location->is_auto_loop() || location-> is_auto_punch()) { // use label instead of entry @@ -230,7 +230,7 @@ LocationEditRow::set_location (Location *loc) if (!name_label.get_parent()) { item_table.attach (name_label, 1, 2, 0, 1, FILL, FILL, 4, 0); } - + name_label.show(); } else { @@ -238,7 +238,7 @@ LocationEditRow::set_location (Location *loc) name_entry.set_text (location->name()); name_entry.set_size_request (100, -1); name_entry.set_editable (true); - name_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::name_entry_changed)); + name_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::name_entry_changed)); if (!name_entry.get_parent()) { item_table.attach (name_entry, 1, 2, 0, 1, FILL | EXPAND, FILL, 4, 0); @@ -252,7 +252,7 @@ LocationEditRow::set_location (Location *loc) item_table.attach (remove_button, 7, 8, 0, 1, FILL, FILL, 4, 0); } - /* XXX i can't find a way to hide the button without messing up + /* XXX i can't find a way to hide the button without messing up the row spacing, so make it insensitive (paul). */ @@ -325,13 +325,13 @@ void LocationEditRow::isrc_entry_changed () { ENSURE_GUI_THREAD(mem_fun(*this, &LocationEditRow::isrc_entry_changed)); - + if (i_am_the_modifier || !location) return; if (isrc_entry.get_text() != "" ) { location->cd_info["isrc"] = isrc_entry.get_text(); - + } else { location->cd_info.erase("isrc"); } @@ -341,7 +341,7 @@ void LocationEditRow::performer_entry_changed () { ENSURE_GUI_THREAD(mem_fun(*this, &LocationEditRow::performer_entry_changed)); - + if (i_am_the_modifier || !location) return; if (performer_entry.get_text() != "") { @@ -355,7 +355,7 @@ void LocationEditRow::composer_entry_changed () { ENSURE_GUI_THREAD(mem_fun(*this, &LocationEditRow::composer_entry_changed)); - + if (i_am_the_modifier || !location) return; if (composer_entry.get_text() != "") { @@ -370,7 +370,7 @@ void LocationEditRow::set_button_pressed (LocationPart part) { if (!location) return; - + switch (part) { case LocStart: location->set_start (session->transport_frame ()); @@ -404,7 +404,7 @@ void LocationEditRow::clock_changed (LocationPart part) { if (i_am_the_modifier || !location) return; - + switch (part) { case LocStart: location->set_start (start_clock.current_time()); @@ -424,7 +424,7 @@ void LocationEditRow::change_aborted (LocationPart /*part*/) { if (i_am_the_modifier || !location) return; - + set_location(location); } @@ -434,7 +434,7 @@ LocationEditRow::cd_toggled () if (i_am_the_modifier || !location) { return; } - + //if (cd_check_button.get_active() == location->is_cd_marker()) { // return; //} @@ -466,16 +466,16 @@ LocationEditRow::cd_toggled () if (location->cd_info.find("preemph") != location->cd_info.end()) { preemph_check_button.set_active(true); } - + if (!cd_track_details_hbox.get_parent()) { item_table.attach (cd_track_details_hbox, 1, 8, 1, 2, FILL | EXPAND, FILL, 4, 0); } // item_table.resize(2, 7); cd_track_details_hbox.show_all(); - + } else if (cd_track_details_hbox.get_parent()){ - - item_table.remove (cd_track_details_hbox); + + item_table.remove (cd_track_details_hbox); // item_table.resize(1, 7); redraw_ranges(); /* EMIT_SIGNAL */ } @@ -509,7 +509,7 @@ LocationEditRow::scms_toggled () } else { location->cd_info.erase("scms"); } - + } void @@ -530,13 +530,13 @@ LocationEditRow::end_changed (ARDOUR::Location *loc) ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationEditRow::end_changed), loc)); if (!location) return; - + // update end and length i_am_the_modifier++; end_clock.set (location->end()); length_clock.set (location->length()); - + i_am_the_modifier--; } @@ -546,7 +546,7 @@ LocationEditRow::start_changed (ARDOUR::Location *loc) ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationEditRow::start_changed), loc)); if (!location) return; - + // update end and length i_am_the_modifier++; @@ -557,7 +557,7 @@ LocationEditRow::start_changed (ARDOUR::Location *loc) } else { cd_check_button.set_sensitive (true); } - + i_am_the_modifier--; } @@ -565,7 +565,7 @@ void LocationEditRow::name_changed (ARDOUR::Location *loc) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationEditRow::name_changed), loc)); - + if (!location) return; // update end and length @@ -580,9 +580,9 @@ LocationEditRow::name_changed (ARDOUR::Location *loc) void LocationEditRow::location_changed (ARDOUR::Location *loc) -{ +{ ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationEditRow::location_changed), loc)); - + if (!location) return; i_am_the_modifier++; @@ -603,7 +603,7 @@ void LocationEditRow::flags_changed (ARDOUR::Location *loc, void *src) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationEditRow::flags_changed), loc, src)); - + if (!location) return; i_am_the_modifier++; @@ -626,7 +626,7 @@ LocationUI::LocationUI () add_range_button (_("Add New Range")) { i_am_the_modifier = 0; - + WindowTitle title(Glib::get_application_name()); title += _("Locations"); @@ -647,13 +647,13 @@ LocationUI::LocationUI () location_rows_scroller.set_name ("LocationLocRowsScroller"); location_rows_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); location_rows_scroller.set_size_request (-1, 130); - + newest_location = 0; loc_frame_box.set_spacing (5); loc_frame_box.set_border_width (5); loc_frame_box.set_name("LocationFrameBox"); - + loc_frame_box.pack_start (location_rows_scroller, true, true); add_location_button.set_name ("LocationAddLocationButton"); @@ -664,13 +664,13 @@ LocationUI::LocationUI () loc_frame.add (loc_frame_box); loc_range_panes.pack1(loc_frame, true, false); - + range_rows.set_name("LocationRangeRows"); range_rows_scroller.add (range_rows); range_rows_scroller.set_name ("LocationRangeRowsScroller"); range_rows_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); range_rows_scroller.set_size_request (-1, 130); - + range_frame_box.set_spacing (5); range_frame_box.set_name("LocationFrameBox"); range_frame_box.set_border_width (5); @@ -684,15 +684,15 @@ LocationUI::LocationUI () range_frame.add (range_frame_box); loc_range_panes.pack2(range_frame, true, false); location_vpacker.pack_start (loc_range_panes, true, true); - + location_hpacker.pack_start (location_vpacker, true, true); add_location_button.signal_clicked().connect (mem_fun(*this, &LocationUI::add_new_location)); add_range_button.signal_clicked().connect (mem_fun(*this, &LocationUI::add_new_range)); - + //add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_RELEASE_MASK); - + } LocationUI::~LocationUI() @@ -731,7 +731,7 @@ void LocationUI::location_remove_requested (ARDOUR::Location *loc) { // must do this to prevent problems when destroying // the effective sender of this event - + Glib::signal_idle().connect (bind (mem_fun(*this, &LocationUI::do_location_remove), loc)); } @@ -749,7 +749,7 @@ void LocationUI::location_added (Location* location) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationUI::location_added), location)); - + if (location->is_auto_punch()) { punch_edit_row.set_location(location); } @@ -765,7 +765,7 @@ void LocationUI::location_removed (Location* location) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationUI::location_removed), location)); - + if (location->is_auto_punch()) { punch_edit_row.set_location(0); } @@ -788,7 +788,7 @@ LocationUI::map_locations (Locations::LocationList& locations) { Locations::LocationList::iterator i; Location* location; - gint n; + gint n; int mark_n = 0; Locations::LocationList temp = locations; LocationSortByStart cmp; @@ -799,7 +799,7 @@ LocationUI::map_locations (Locations::LocationList& locations) Box_Helpers::BoxList & loc_children = location_rows.children(); Box_Helpers::BoxList & range_children = range_rows.children(); LocationEditRow * erow; - + for (n = 0, i = locations.begin(); i != locations.end(); ++n, ++i) { location = *i; @@ -846,7 +846,7 @@ LocationUI::add_new_location() session->locations()->next_available_name(markername,"mark"); Location *location = new Location (where, where, markername, Location::IsMark); if (Config->get_name_new_markers()) { - newest_location = location; + newest_location = location; } session->begin_reversible_command (_("add marker")); XMLNode &before = session->locations()->get_state(); @@ -855,7 +855,7 @@ LocationUI::add_new_location() session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after)); session->commit_reversible_command (); } - + } void @@ -881,7 +881,7 @@ void LocationUI::refresh_location_list_s (Change ignored) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationUI::refresh_location_list_s), ignored)); - + refresh_location_list (); } @@ -903,7 +903,7 @@ LocationUI::refresh_location_list () if (session) { session->locations()->apply (*this, &LocationUI::map_locations); } - + } void @@ -925,7 +925,7 @@ void LocationUI::session_gone() { ENSURE_GUI_THREAD(mem_fun(*this, &LocationUI::session_gone)); - + hide_all(); using namespace Box_Helpers; diff --git a/gtk2_ardour/location_ui.h b/gtk2_ardour/location_ui.h index dabd945f95..87977c80ba 100644 --- a/gtk2_ardour/location_ui.h +++ b/gtk2_ardour/location_ui.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1999-2002 Paul Davis + Copyright (C) 1999-2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,9 +51,9 @@ class LocationEditRow : public Gtk::HBox void set_number (int); void focus_name(); - - sigc::signal<void,ARDOUR::Location*> remove_requested; - sigc::signal<void> redraw_ranges; + + sigc::signal<void,ARDOUR::Location*> remove_requested; + sigc::signal<void> redraw_ranges; protected: @@ -66,14 +66,14 @@ class LocationEditRow : public Gtk::HBox ARDOUR::Location *location; ARDOUR::Session *session; - - + + Gtk::Table item_table; - + Gtk::Entry name_entry; Gtk::Label name_label; Gtk::Label number_label; - + Gtk::HBox start_hbox; Gtk::Button start_set_button; Gtk::Button start_go_button; @@ -105,12 +105,12 @@ class LocationEditRow : public Gtk::HBox guint32 i_am_the_modifier; int number; - + void name_entry_changed (); void isrc_entry_changed (); void performer_entry_changed (); void composer_entry_changed (); - + void set_button_pressed (LocationPart part); void go_button_pressed (LocationPart part); @@ -129,13 +129,13 @@ class LocationEditRow : public Gtk::HBox void name_changed (ARDOUR::Location *); void location_changed (ARDOUR::Location *); void flags_changed (ARDOUR::Location *, void *src); - + sigc::connection start_changed_connection; sigc::connection end_changed_connection; sigc::connection name_changed_connection; sigc::connection changed_connection; sigc::connection flags_changed_connection; - + }; @@ -152,7 +152,7 @@ class LocationUI : public ArdourDialog private: ARDOUR::LocationStack* locations; ARDOUR::Location *newest_location; - + void session_gone(); Gtk::VBox location_vpacker; @@ -160,9 +160,9 @@ class LocationUI : public ArdourDialog LocationEditRow loop_edit_row; LocationEditRow punch_edit_row; - + Gtk::VPaned loc_range_panes; - + Gtk::Frame loc_frame; Gtk::VBox loc_frame_box; Gtk::Button add_location_button; @@ -186,12 +186,12 @@ class LocationUI : public ArdourDialog void location_redraw_ranges (); gint do_location_remove (ARDOUR::Location *); - + guint32 i_am_the_modifier; void add_new_location(); void add_new_range(); - + void refresh_location_list (); void refresh_location_list_s (ARDOUR::Change); void location_removed (ARDOUR::Location *); diff --git a/gtk2_ardour/logmeter.h b/gtk2_ardour/logmeter.h index 0bbce787b2..d861509080 100644 --- a/gtk2_ardour/logmeter.h +++ b/gtk2_ardour/logmeter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,7 +38,7 @@ inline float log_meter (float db) { gfloat def = 0.0f; /* Meter deflection %age */ - + if (db < -70.0f) { def = 0.0f; } else if (db < -60.0f) { @@ -56,8 +56,8 @@ log_meter (float db) } else { def = 115.0f; } - - /* 115 is the deflection %age that would be + + /* 115 is the deflection %age that would be when db=6.0. this is an arbitrary endpoint for our scaling. */ diff --git a/gtk2_ardour/lv2_plugin_ui.cc b/gtk2_ardour/lv2_plugin_ui.cc index 94cf0e61f3..f6718940b3 100644 --- a/gtk2_ardour/lv2_plugin_ui.cc +++ b/gtk2_ardour/lv2_plugin_ui.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -106,7 +106,7 @@ LV2PluginUI::start_updating(GdkEventAny*) { if (!_output_ports.empty()) { _screen_update_connection.disconnect(); - _screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect + _screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (mem_fun(*this, &LV2PluginUI::output_update)); } return false; @@ -138,7 +138,7 @@ LV2PluginUI::output_update() uint32_t index = _output_ports[i]; parameter_changed(index, _lv2->get_parameter(index)); } - + } LV2PluginUI::LV2PluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<LV2Plugin> lv2p) @@ -194,7 +194,7 @@ LV2PluginUI::lv2ui_instantiate(const Glib::ustring& title) if (is_external_ui) { free(features_dst); } - + uint32_t num_ports = slv2_plugin_get_num_ports(_lv2->slv2_plugin()); for (uint32_t i = 0; i < num_ports; ++i) { if (_lv2->parameter_is_output(i) && _lv2->parameter_is_control(i) && is_update_wanted(i)) { @@ -214,7 +214,7 @@ LV2PluginUI::lv2ui_instantiate(const Glib::ustring& title) g_external_uis.push_back(_external_ui_ptr); } } - + _values = new float[num_ports]; for (uint32_t i = 0; i < num_ports; ++i) { bool ok; @@ -226,7 +226,7 @@ LV2PluginUI::lv2ui_instantiate(const Glib::ustring& title) } } } - + _lv2->ParameterChanged.connect(mem_fun(*this, &LV2PluginUI::parameter_changed)); } @@ -300,7 +300,7 @@ LV2PluginUI::on_window_show(const Glib::ustring& title) LV2_EXTERNAL_UI_SHOW(_external_ui_ptr); _screen_update_connection.disconnect(); - _screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect + _screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (mem_fun(*this, &LV2PluginUI::output_update)); return false; } diff --git a/gtk2_ardour/lv2_plugin_ui.h b/gtk2_ardour/lv2_plugin_ui.h index 011b70e44b..0a10693de2 100644 --- a/gtk2_ardour/lv2_plugin_ui.h +++ b/gtk2_ardour/lv2_plugin_ui.h @@ -62,7 +62,7 @@ class LV2PluginUI : public PlugUIBase, public Gtk::VBox boost::shared_ptr<ARDOUR::LV2Plugin> _lv2; std::vector<int> _output_ports; sigc::connection _screen_update_connection; - + Gtk::Widget* _gui_widget; SLV2UIInstance _inst; float* _values; @@ -73,14 +73,14 @@ class LV2PluginUI : public PlugUIBase, public Gtk::VBox Gtk::Window* _win_ptr; static void on_external_ui_closed(LV2UI_Controller controller); - + static void lv2_ui_write( LV2UI_Controller controller, uint32_t port_index, uint32_t buffer_size, uint32_t format, const void* buffer); - + void lv2ui_instantiate(const Glib::ustring& title); void parameter_changed(uint32_t, float); diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index 2afb40ab3e..0923ff39d0 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -1,6 +1,6 @@ /* Copyright (C) 2001-2007 Paul Davis - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -81,7 +81,7 @@ Please consider the possibilities, and perhaps (re)start JACK.")); win.add_button (Stock::QUIT, RESPONSE_CLOSE); win.set_default_response (RESPONSE_CLOSE); - + win.show_all (); win.set_position (Gtk::WIN_POS_CENTER); @@ -165,7 +165,7 @@ fixup_bundle_environment () } path += dir_path; path += "/../Plugins"; - + setenv ("LADSPA_PATH", path.c_str(), 1); cstr = getenv ("VAMP_PATH"); @@ -177,7 +177,7 @@ fixup_bundle_environment () } path += dir_path; path += "/../Frameworks"; - + setenv ("VAMP_PATH", path.c_str(), 1); cstr = getenv ("ARDOUR_CONTROL_SURFACE_PATH"); @@ -189,7 +189,7 @@ fixup_bundle_environment () } path += dir_path; path += "/../Surfaces"; - + setenv ("ARDOUR_CONTROL_SURFACE_PATH", path.c_str(), 1); cstr = getenv ("LV2_PATH"); @@ -201,7 +201,7 @@ fixup_bundle_environment () } path += dir_path; path += "/../Plugins"; - + setenv ("LV2_PATH", path.c_str(), 1); path = dir_path; @@ -211,12 +211,12 @@ fixup_bundle_environment () path = dir_path; path += "/../Resources/locale"; - + localedir = strdup (path.c_str()); /* write a pango.rc file and tell pango to use it. we'd love to put this into the Ardour.app bundle and leave it there, - but the user may not have write permission. so ... + but the user may not have write permission. so ... we also have to make sure that the user ardour directory actually exists ... @@ -228,7 +228,7 @@ fixup_bundle_environment () catch (const sys::filesystem_error& ex) { error << _("Could not create user configuration directory") << endmsg; } - + sys::path pangopath = user_config_directory(); pangopath /= "pango.rc"; path = pangopath.to_string(); @@ -244,7 +244,7 @@ fixup_bundle_environment () pangopath /= ".."; pangopath /= "Resources"; pangopath /= "pango.modules"; - + pangorc << pangopath.to_string() << endl; pangorc.close (); @@ -257,7 +257,7 @@ fixup_bundle_environment () setenv ("CHARSETALIASDIR", path.c_str(), 1); // font config - + path = dir_path; path += "/../Resources/fonts.conf"; @@ -272,10 +272,10 @@ fixup_bundle_environment () if (getenv ("ARDOUR_WITH_JACK")) { // JACK driver dir - + path = dir_path; path += "/../Frameworks"; - + setenv ("JACK_DRIVER_DIR", path.c_str(), 1); } } @@ -307,7 +307,7 @@ int main (int argc, char *argv[]) #endif { vector<Glib::ustring> null_file_list; - + #ifdef __APPLE__ fixup_bundle_environment (); #endif @@ -346,17 +346,17 @@ int main (int argc, char *argv[]) if (curvetest_file) { return curvetest (curvetest_file); } - - cout << _("Ardour/GTK ") + + cout << _("Ardour/GTK ") << VERSIONSTRING << _(" (built using ") << svn_revision #ifdef __GNUC__ - << _(" and GCC version ") << __VERSION__ + << _(" and GCC version ") << __VERSION__ #endif << ')' << endl; - + if (just_version) { exit (0); } @@ -380,7 +380,7 @@ int main (int argc, char *argv[]) cerr << _("Cannot install SIGPIPE error handler") << endl; } - try { + try { ui = new ARDOUR_UI (&argc, &argv); } catch (failed_constructor& err) { error << _("could not create ARDOUR GUI") << endmsg; diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index bc97128102..3df253b4ac 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ using namespace std; using namespace ARDOUR; -Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, const string& annotation, +Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, const string& annotation, Type type, nframes_t frame, bool handle_events) : editor (ed), _parent(&parent), _type(type) @@ -55,7 +55,7 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con ^ | | V (0,5) (6,5) - \ / + \ / (3,10) @@ -72,17 +72,17 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con Start: - 0,0\ - | \ + 0,0\ + | \ | \ 6,6 | / | / - 0,12 + 0,12 End: /12,0 - / | + / | / | 6,6 | \ | @@ -90,15 +90,15 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con \ | 12,12 - + TransportStart: 0,0 - | \ - | \ - | \ + | \ + | \ + | \ | \ - | \ + | \ 0,13 --- 13,13 TransportEnd: @@ -110,7 +110,7 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con / | / | 0,13 ------ 13,13 - + PunchIn: @@ -118,23 +118,23 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con | / | / | / - | / - | / - | / + | / + | / + | / 0,13 PunchOut 0,0 -->-13,0 - \ | + \ | \ | \ | \ | \ | \ | 13,13 - - + + */ switch (type) { @@ -144,10 +144,10 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con points->push_back (Gnome::Art::Point (0.0, 0.0)); points->push_back (Gnome::Art::Point (6.0, 0.0)); points->push_back (Gnome::Art::Point (6.0, 5.0)); - points->push_back (Gnome::Art::Point (3.0, 10.0)); - points->push_back (Gnome::Art::Point (0.0, 5.0)); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - + points->push_back (Gnome::Art::Point (3.0, 10.0)); + points->push_back (Gnome::Art::Point (0.0, 5.0)); + points->push_back (Gnome::Art::Point (0.0, 0.0)); + shift = 3; label_offset = 8.0; break; @@ -157,11 +157,11 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con points = new ArdourCanvas::Points (); points->push_back (Gnome::Art::Point (3.0, 0.0)); - points->push_back (Gnome::Art::Point (6.0, 5.0)); - points->push_back (Gnome::Art::Point (6.0, 10.0)); - points->push_back (Gnome::Art::Point (0.0, 10.0)); - points->push_back (Gnome::Art::Point (0.0, 5.0)); - points->push_back (Gnome::Art::Point (3.0, 0.0)); + points->push_back (Gnome::Art::Point (6.0, 5.0)); + points->push_back (Gnome::Art::Point (6.0, 10.0)); + points->push_back (Gnome::Art::Point (0.0, 10.0)); + points->push_back (Gnome::Art::Point (0.0, 5.0)); + points->push_back (Gnome::Art::Point (3.0, 0.0)); shift = 3; label_offset = 8.0; @@ -169,10 +169,10 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con case Start: points = new ArdourCanvas::Points (); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - points->push_back (Gnome::Art::Point (6.5, 6.5)); - points->push_back (Gnome::Art::Point (0.0, 13.0)); - points->push_back (Gnome::Art::Point (0.0, 0.0)); + points->push_back (Gnome::Art::Point (0.0, 0.0)); + points->push_back (Gnome::Art::Point (6.5, 6.5)); + points->push_back (Gnome::Art::Point (0.0, 13.0)); + points->push_back (Gnome::Art::Point (0.0, 0.0)); shift = 0; label_offset = 13.0; @@ -181,21 +181,21 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con case End: points = new ArdourCanvas::Points (); points->push_back (Gnome::Art::Point (6.5, 6.5)); - points->push_back (Gnome::Art::Point (13.0, 0.0)); - points->push_back (Gnome::Art::Point (13.0, 13.0)); - points->push_back (Gnome::Art::Point (6.5, 6.5)); - + points->push_back (Gnome::Art::Point (13.0, 0.0)); + points->push_back (Gnome::Art::Point (13.0, 13.0)); + points->push_back (Gnome::Art::Point (6.5, 6.5)); + shift = 13; label_offset = 6.0; break; case LoopStart: points = new ArdourCanvas::Points (); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - points->push_back (Gnome::Art::Point (13.0, 13.0)); - points->push_back (Gnome::Art::Point (0.0, 13.0)); - points->push_back (Gnome::Art::Point (0.0, 0.0)); - + points->push_back (Gnome::Art::Point (0.0, 0.0)); + points->push_back (Gnome::Art::Point (13.0, 13.0)); + points->push_back (Gnome::Art::Point (0.0, 13.0)); + points->push_back (Gnome::Art::Point (0.0, 0.0)); + shift = 0; label_offset = 12.0; break; @@ -203,10 +203,10 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con case LoopEnd: points = new ArdourCanvas::Points (); points->push_back (Gnome::Art::Point (13.0, 0.0)); - points->push_back (Gnome::Art::Point (13.0, 13.0)); - points->push_back (Gnome::Art::Point (0.0, 13.0)); + points->push_back (Gnome::Art::Point (13.0, 13.0)); + points->push_back (Gnome::Art::Point (0.0, 13.0)); points->push_back (Gnome::Art::Point (13.0, 0.0)); - + shift = 13; label_offset = 0.0; break; @@ -214,25 +214,25 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con case PunchIn: points = new ArdourCanvas::Points (); points->push_back (Gnome::Art::Point (0.0, 0.0)); - points->push_back (Gnome::Art::Point (13.0, 0.0)); - points->push_back (Gnome::Art::Point (0.0, 13.0)); - points->push_back (Gnome::Art::Point (0.0, 0.0)); + points->push_back (Gnome::Art::Point (13.0, 0.0)); + points->push_back (Gnome::Art::Point (0.0, 13.0)); + points->push_back (Gnome::Art::Point (0.0, 0.0)); shift = 0; label_offset = 13.0; break; - + case PunchOut: points = new ArdourCanvas::Points (); points->push_back (Gnome::Art::Point (0.0, 0.0)); - points->push_back (Gnome::Art::Point (12.0, 0.0)); - points->push_back (Gnome::Art::Point (12.0, 12.0)); - points->push_back (Gnome::Art::Point (0.0, 0.0)); + points->push_back (Gnome::Art::Point (12.0, 0.0)); + points->push_back (Gnome::Art::Point (12.0, 12.0)); + points->push_back (Gnome::Art::Point (0.0, 0.0)); shift = 13; label_offset = 0.0; break; - + } frame_position = frame; @@ -252,24 +252,24 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con /* setup name pixbuf sizes */ name_font = get_font_for_style (N_("MarkerText")); - + Gtk::Window win; Gtk::Label foo; win.add (foo); - + Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */ int width; int height; - + layout->set_font_description (*name_font); Gtkmm2ext::get_ink_pixel_size (layout, width, height); name_height = height + 6; - + name_pixbuf = new ArdourCanvas::Pixbuf(*group); name_pixbuf->property_x() = label_offset; - + set_name (annotation.c_str()); - + editor.ZoomChanged.connect (mem_fun (*this, &Marker::reposition)); mark->set_data ("marker", this); @@ -339,7 +339,7 @@ Marker::show_line () } } -void +void Marker::hide_line () { if (line) { @@ -358,12 +358,12 @@ Marker::set_name (const string& new_name) { uint32_t pb_width; double font_size; - + font_size = name_font->get_size() / Pango::SCALE; pb_width = new_name.length() * font_size; - + Glib::RefPtr<Gdk::Pixbuf> buf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, pb_width, name_height); - + cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, pb_width, name_height); cairo_t *cr = cairo_create (surface); cairo_text_extents_t te; @@ -372,21 +372,21 @@ Marker::set_name (const string& new_name) CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size (cr, font_size); cairo_text_extents (cr, new_name.c_str(), &te); - + cairo_move_to (cr, 0.5, 0.5 - te.height / 2 - te.y_bearing + name_height / 2); cairo_show_text (cr, new_name.c_str()); - + unsigned char* src = cairo_image_surface_get_data (surface); convert_bgra_to_rgba(src, buf->get_pixels(), pb_width, name_height); - + cairo_destroy(cr); name_pixbuf->property_pixbuf() = buf; - + if (_type == End || _type == LoopEnd || _type == PunchOut) { name_pixbuf->property_x() = -(te.width); } - + } void @@ -408,7 +408,7 @@ void Marker::reposition () { set_position (frame_position); -} +} void Marker::show () @@ -431,7 +431,7 @@ Marker::set_color_rgba (uint32_t color) /***********************************************************************/ -TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text, +TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text, ARDOUR::TempoSection& temp) : Marker (editor, parent, rgba, text, Tempo, 0, false), _tempo (temp) @@ -446,8 +446,8 @@ TempoMarker::~TempoMarker () /***********************************************************************/ -MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text, - ARDOUR::MeterSection& m) +MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text, + ARDOUR::MeterSection& m) : Marker (editor, parent, rgba, text, Meter, 0, false), _meter (m) { diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h index a379f010c9..3802348567 100644 --- a/gtk2_ardour/marker.h +++ b/gtk2_ardour/marker.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ class Marker : public PBD::Destructible }; - Marker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const std::string& text, Type, + Marker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const std::string& text, Type, nframes_t frame = 0, bool handle_events = true); virtual ~Marker (); @@ -68,12 +68,12 @@ class Marker : public PBD::Destructible void set_position (nframes64_t); void set_name (const std::string&); void set_color_rgba (uint32_t rgba); - + nframes64_t position() const { return frame_position; } ArdourCanvas::Group * get_parent() { return _parent; } void reparent (ArdourCanvas::Group & parent); - + void hide (); void show (); @@ -97,7 +97,7 @@ class Marker : public PBD::Destructible unsigned char shift; /* should be double, but its always small and integral */ Type _type; int name_height; - + void reposition (); }; diff --git a/gtk2_ardour/marker_selection.h b/gtk2_ardour/marker_selection.h index ae6417f6c6..d2aacceacf 100644 --- a/gtk2_ardour/marker_selection.h +++ b/gtk2_ardour/marker_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ #include "marker.h" -struct MarkerSelection : public std::list<Marker*> +struct MarkerSelection : public std::list<Marker*> { void range (nframes64_t& start, nframes64_t& end); }; diff --git a/gtk2_ardour/marker_time_axis.cc b/gtk2_ardour/marker_time_axis.cc index f7867e49b0..d3517bd673 100644 --- a/gtk2_ardour/marker_time_axis.cc +++ b/gtk2_ardour/marker_time_axis.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,7 +63,7 @@ MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas& { /* the TimeAxisView these markers are associated with */ marked_time_axis = tav ; - + _color = unique_random_color() ; time_axis_name = name ; @@ -80,7 +80,7 @@ MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas& // set the initial time axis text label label_view() ; - + // set the initial height of this time axis set_height(hSmall) ; } @@ -105,18 +105,18 @@ MarkerTimeAxis::~MarkerTimeAxis() //---------------------------------------------------------------------------------------// // ui methods & data - + void MarkerTimeAxis::set_height (uint32_t h) { VisualTimeAxis::set_height(h) ; - + // tell out view helper of the change too if (view != 0) { view->set_height((double) height) ; } - + // tell those interested that we have had our height changed gui_changed("track_height",(void*)0) ; /* EMIT_SIGNAL */ } @@ -161,7 +161,7 @@ MarkerTimeAxis::popup_marker_time_axis_edit_menu(int button, int32_t time, Marke { marker_item_menu->set_sensitive(false) ; } - + marker_menu->popup(button,time) ; } @@ -205,7 +205,7 @@ MarkerTimeAxis::build_display_menu() items.push_back(MenuElem (_("Height"), *size_menu)); items.push_back(MenuElem (_("Color"), mem_fun(*this, &MarkerTimeAxis::select_track_color))); items.push_back(SeparatorElem()) ; - + items.push_back(MenuElem (_("Remove"), bind(mem_fun(*this, &MarkerTimeAxis::remove_this_time_axis), (void*)this))); } @@ -221,7 +221,7 @@ MarkerTimeAxis::build_marker_menu() marker_menu = manage(new Menu) ; marker_menu->set_name ("ArdourContextMenu"); MenuList& items = marker_menu->items(); - + marker_item_menu = manage(new Menu) ; marker_item_menu->set_name ("ArdourContextMenu"); MenuList& marker_sub_items = marker_item_menu->items() ; @@ -230,7 +230,7 @@ MarkerTimeAxis::build_marker_menu() Menu* duration_menu = manage(new Menu) ; duration_menu->set_name ("ArdourContextMenu"); MenuList& duration_items = duration_menu->items() ; - + if(view) { duration_items.push_back(MenuElem (_("1 seconds"), bind (mem_fun (view, &MarkerTimeAxisView::set_marker_duration_sec), 1.0))) ; @@ -246,7 +246,7 @@ MarkerTimeAxis::build_marker_menu() marker_sub_items.push_back(SeparatorElem()) ; marker_sub_items.push_back(MenuElem (_("Remove Marker"), bind(mem_fun(view, &MarkerTimeAxisView::remove_selected_marker_view),(void*)this))) ; - + items.push_back(MenuElem(_("Marker"), *marker_item_menu)) ; items.push_back(MenuElem (_("Rename Track"), mem_fun(*this,&MarkerTimeAxis::start_time_axis_rename))) ; diff --git a/gtk2_ardour/marker_time_axis.h b/gtk2_ardour/marker_time_axis.h index 5c66b56c16..05b95bddaa 100644 --- a/gtk2_ardour/marker_time_axis.h +++ b/gtk2_ardour/marker_time_axis.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,7 +55,7 @@ class MarkerTimeAxis : public VisualTimeAxis public: //---------------------------------------------------------------------------------------// // Constructor / Desctructor - + /** * Constructs a new MarkerTimeAxis * @@ -66,24 +66,24 @@ class MarkerTimeAxis : public VisualTimeAxis * @param tav the associated track view that this MarkerTimeAxis is marking up */ MarkerTimeAxis(PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas, const std::string & name, TimeAxisView* tav) ; - + /** * Destructor * Responsible for destroying any marker items upon this time axis */ virtual ~MarkerTimeAxis() ; - - + + //---------------------------------------------------------------------------------------// // ui methods & data - + /** * Sets the height of this TrackView to one of the defined TrackHeights * * @param h the number of pixels to set the height to */ virtual void set_height(uint32_t h) ; - + /** * Sets the number of samples per unit that are used. * This is used to determine the sizes of items upon this time axis @@ -91,8 +91,8 @@ class MarkerTimeAxis : public VisualTimeAxis * @param spu the number of samples per unit */ virtual void set_samples_per_unit(double spu) ; - - + + /** * Show the popup edit menu * @@ -102,8 +102,8 @@ class MarkerTimeAxis : public VisualTimeAxis * @param with_item true if an item has been selected upon the time axis, used to set context menu */ void popup_marker_time_axis_edit_menu(int button, int32_t time, MarkerView* clicked_mv, bool with_item) ; - - + + //---------------------------------------------------------------------------------------// // Parent/Child helper object accessors @@ -113,7 +113,7 @@ class MarkerTimeAxis : public VisualTimeAxis * @return the view helper of this TimeAxis */ MarkerTimeAxisView* get_view() ; - + /** * Returns the TimeAxisView that this markerTimeAxis is marking up * @@ -123,18 +123,18 @@ class MarkerTimeAxis : public VisualTimeAxis private: - + /** * convenience method to select a new track color and apply it to the view and view items * */ void select_track_color() ; - + /** * Handles the building of the popup menu */ virtual void build_display_menu() ; - + /** * handles the building of the MarkerView sub menu */ @@ -142,17 +142,17 @@ class MarkerTimeAxis : public VisualTimeAxis /** The associated TimeAxis that this MarkerTimeAxis is marking up */ TimeAxisView* marked_time_axis ; - + /** Our time axis view helper */ MarkerTimeAxisView *view ; - /** the popup menu available by clicking upon this time axis */ + /** the popup menu available by clicking upon this time axis */ Gtk::Menu *marker_menu ; - + /** specialized sub menu available when clicking upon and item upon this time axis */ Gtk::Menu *marker_item_menu ; - - + + } ; /* class MarkerTimeAxis */ #endif /* __ardour_imageframe_time_axis_h__ */ diff --git a/gtk2_ardour/marker_time_axis_view.cc b/gtk2_ardour/marker_time_axis_view.cc index e9a15fb5a5..417ac5c8dc 100644 --- a/gtk2_ardour/marker_time_axis_view.cc +++ b/gtk2_ardour/marker_time_axis_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ using namespace Editing; //---------------------------------------------------------------------------------------// // Constructor / Desctructor - + /** * Construct a new MarkerTimeAxisView helper time axis helper * @@ -61,7 +61,7 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv) canvas_rect->property_y2() = (double)20; canvas_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerTrack.get(); canvas_rect->property_fill_color_rgba() = stream_base_color; - + canvas_rect->signal_event().connect (bind (mem_fun (_trackview.editor, &PublicEditor::canvas_marker_time_axis_view_event), canvas_rect, &_trackview)); _samples_per_unit = _trackview.editor.get_current_zoom() ; @@ -80,17 +80,17 @@ MarkerTimeAxisView::~MarkerTimeAxisView() for(MarkerViewList::iterator iter = marker_view_list.begin(); iter != marker_view_list.end(); ++iter) { MarkerView* mv = (*iter) ; - + MarkerViewList::iterator next = iter ; next++ ; marker_view_list.erase(iter) ; delete mv ; mv = 0 ; - + iter = next ; } - + delete canvas_rect; canvas_rect = 0 ; @@ -113,7 +113,7 @@ MarkerTimeAxisView::set_height(gdouble h) if (h < 10.0 || h > 1000.0) { return -1; } - + canvas_rect->property_y2() = h; for (MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i) { @@ -140,7 +140,7 @@ MarkerTimeAxisView::set_position(gdouble x, gdouble y) /** * Sets the current samples per unit. * this method tells each item upon the time axis of the change - * + * * @param spu the new samples per canvas unit value */ int @@ -149,7 +149,7 @@ MarkerTimeAxisView::set_samples_per_unit(gdouble spp) if(spp < 1.0) { return -1 ; } - + _samples_per_unit = spp ; for(MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i) @@ -178,7 +178,7 @@ MarkerTimeAxisView::apply_color(Gdk::Color& color) //---------------------------------------------------------------------------------------// // Child MarkerView Accessors/Mutators - + /** * Adds a marker view to the list of items upon this time axis view helper * the new MarkerView is returned @@ -189,7 +189,7 @@ MarkerTimeAxisView::apply_color(Gdk::Color& color) * @param start the position the new item should be placed upon the time line * @param duration the duration the new item should be placed upon the timeline * @param src the identity of the object that initiated the change - */ + */ MarkerView* MarkerTimeAxisView::add_marker_view(ImageFrameView* ifv, std::string mark_type, std::string mark_id, nframes_t start, nframes_t dur, void* src) { @@ -197,7 +197,7 @@ MarkerTimeAxisView::add_marker_view(ImageFrameView* ifv, std::string mark_type, { return(0) ; } - + MarkerView* mv = new MarkerView(canvas_group, &_trackview, ifv, @@ -207,14 +207,14 @@ MarkerTimeAxisView::add_marker_view(ImageFrameView* ifv, std::string mark_type, mark_id, start, dur) ; - + ifv->add_marker_view_item(mv, src) ; marker_view_list.push_front(mv) ; - + mv->GoingAway.connect(bind (mem_fun(*this,&MarkerTimeAxisView::remove_marker_view), (void*)this)) ; - + MarkerViewAdded(mv,src) ; /* EMIT_SIGNAL */ - + return(mv) ; } @@ -228,7 +228,7 @@ MarkerView* MarkerTimeAxisView::get_named_marker_view(std::string item_id) { MarkerView* mv = 0 ; - + for(MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i) { if(((MarkerView*)*i)->get_item_name() == item_id) @@ -252,14 +252,14 @@ void MarkerTimeAxisView::remove_selected_marker_view(void* src) { std::string removed ; - + if (selected_time_axis_item) { MarkerViewList::iterator i ; if((i = find (marker_view_list.begin(), marker_view_list.end(), selected_time_axis_item)) != marker_view_list.end()) { marker_view_list.erase(i) ; - + MarkerViewRemoved(selected_time_axis_item->get_item_name(),src) ; /* EMIT_SIGNAL */ delete(selected_time_axis_item) ; @@ -283,24 +283,24 @@ MarkerView* MarkerTimeAxisView::remove_named_marker_view(std::string item_id, void* src) { MarkerView* mv = 0 ; - + MarkerViewList::iterator i = marker_view_list.begin() ; - + for(MarkerViewList::iterator iter = marker_view_list.begin(); iter != marker_view_list.end(); ++iter) { if(((MarkerView*)*i)->get_item_name() == item_id) { mv = ((MarkerView*)*i) ; marker_view_list.erase(i) ; - + MarkerViewRemoved(mv->get_item_name(), src) ; /* EMIT_SIGNAL */ - + // break from the for loop break; } i++ ; } - + return(mv) ; } @@ -314,12 +314,12 @@ void MarkerTimeAxisView::remove_marker_view(MarkerView* mv, void* src) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &MarkerTimeAxisView::remove_marker_view), mv, src)); - + MarkerViewList::iterator i; if((i = find (marker_view_list.begin(), marker_view_list.end(), mv)) != marker_view_list.end()) { marker_view_list.erase(i) ; - + // Assume this remove happened locally, else use remove_named_marker_time_axis // let listeners know that the named MarkerTimeAxis has been removed MarkerViewRemoved(mv->get_item_name(), src) ; /* EMIT_SIGNAL */ @@ -365,7 +365,7 @@ MarkerTimeAxisView::clear_selected_time_axis_item() { selected_time_axis_item = 0 ; } - + /** * Returnsthe currently selected item upon this time axis * diff --git a/gtk2_ardour/marker_time_axis_view.h b/gtk2_ardour/marker_time_axis_view.h index ae7cddfd59..caf022178b 100644 --- a/gtk2_ardour/marker_time_axis_view.h +++ b/gtk2_ardour/marker_time_axis_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,44 +38,44 @@ class TimeAxisViewItem ; /** * A view helper for handling MarkerView objects. * This object is responsible for the time axis canvas view, and - * maintains the list of items that have been added to it + * maintains the list of items that have been added to it */ class MarkerTimeAxisView : public sigc::trackable { public: //---------------------------------------------------------------------------------------// // Constructor / Desctructor - + /** * Construct a new MarkerTimeAxisView helper time axis helper * * @param mta the TimeAxsiView that this objbect is the helper for */ MarkerTimeAxisView(MarkerTimeAxis& mta) ; - + /** * Destructor * Reposinsibly for destroying all marker items that may have been added to this time axis view * */ ~MarkerTimeAxisView () ; - + //---------------------------------------------------------------------------------------// // Parent/Child helper object accessors - + /** * Returns the TimeAxisView thatt his object is acting as a helper for * * @return the TimeAxisView that this object is acting as a view helper for */ MarkerTimeAxis& trackview() { return _trackview; } - + /** * */ ArdourCanvas::Item *canvas_item() { return canvas_group; } - - + + //---------------------------------------------------------------------------------------// // ui methods & data @@ -85,7 +85,7 @@ class MarkerTimeAxisView : public sigc::trackable * @param height the new height */ int set_height(gdouble height) ; - + /** * Sets the position of this view helper on the canvas * @@ -93,22 +93,22 @@ class MarkerTimeAxisView : public sigc::trackable * @param y the y position upon the canvas */ int set_position(gdouble x, gdouble y) ; - + /** * Sets the current samples per unit. * this method tells each item upon the time axis of the change - * + * * @param spu the new samples per canvas unit value */ int set_samples_per_unit(gdouble spu) ; - + /** * Returns the current samples per unit of this time axis view helper * * @return the current samples per unit of this time axis view helper */ gdouble get_samples_per_unit() { return _samples_per_unit; } - + /** * Sets the color of the items contained upon this view helper * @@ -118,7 +118,7 @@ class MarkerTimeAxisView : public sigc::trackable //---------------------------------------------------------------------------------------// // Child MarkerView Accessors/Mutators - + /** * Adds a marker view to the list of items upon this time axis view helper * the new MarkerView is returned @@ -131,7 +131,7 @@ class MarkerTimeAxisView : public sigc::trackable * @param src the identity of the object that initiated the change */ MarkerView* add_marker_view(ImageFrameView* ifv, std::string mark_type, std::string mark_id, nframes_t start, nframes_t dur, void* src) ; - + /** * Returns the named MarkerView or 0 if the named marker does not exist * @@ -139,7 +139,7 @@ class MarkerTimeAxisView : public sigc::trackable * @return the named MarkerView, or 0 if it is not held upon this view */ MarkerView* get_named_marker_view(std::string item_id) ; - + /** * Removes the currently selected MarverView * Note that this method actually destroys the MarkerView too. @@ -149,7 +149,7 @@ class MarkerTimeAxisView : public sigc::trackable * @see add_marker_view */ void remove_selected_marker_view(void* src) ; - + /** * Removes and returns the named MarkerView from the list of MarkerView held by this view helper * @@ -158,7 +158,7 @@ class MarkerTimeAxisView : public sigc::trackable * @see add_marker_view */ MarkerView* remove_named_marker_view(std::string item_id, void* src) ; - + /** * Removes mv from the list of MarkerView upon this TimeAxis * @@ -166,7 +166,7 @@ class MarkerTimeAxisView : public sigc::trackable * @param src the identity of the object that initiated the change */ void remove_marker_view(MarkerView* item, void* src) ; - + //---------------------------------------------------------------------------------------// // Selected item methods @@ -176,21 +176,21 @@ class MarkerTimeAxisView : public sigc::trackable * @param mv the item to set selected */ void set_selected_time_axis_item(MarkerView* mv) ; - + /** * Clears any selected item upon this time axis * */ void clear_selected_time_axis_item() ; - + /** * Returnsthe currently selected item upon this time axis * * @return the currently selected item pon this time axis */ MarkerView* get_selected_time_axis_item() ; - - + + /** * Sets the duration of the selected MarkerView to the specified number of seconds * @@ -200,30 +200,30 @@ class MarkerTimeAxisView : public sigc::trackable //---------------------------------------------------------------------------------// // Emitted Signals - + /** Emitted when a MarkerView is Added */ sigc::signal<void,MarkerView*,void*> MarkerViewAdded ; - + /** Emitted when a MarkerView Item is removed */ sigc::signal<void,std::string,void*> MarkerViewRemoved ; - + private: /** * convenience method to re-get the samples per unit and tell items upon this view * */ void reset_samples_per_unit() ; - + /** The list of items held by this time axis view helper */ typedef std::list<MarkerView *> MarkerViewList ; MarkerViewList marker_view_list; - + /** the currently selected time axis item upon this time axis */ MarkerView* selected_time_axis_item ; - + /* the TimeAxisView that this object is acting as the view helper for */ MarkerTimeAxis& _trackview ; - + ArdourCanvas::Group *canvas_group ; ArdourCanvas::SimpleRect *canvas_rect ; /* frame around the whole thing */ @@ -233,7 +233,7 @@ class MarkerTimeAxisView : public sigc::trackable /* XXX why are these different? */ Gdk::Color region_color; uint32_t stream_base_color; - + }; /* class MarkerTimeAxisView */ #endif /* __ardour_marker_time_axis_view_h__ */ diff --git a/gtk2_ardour/marker_view.cc b/gtk2_ardour/marker_view.cc index d82554f891..e3875cf2fb 100644 --- a/gtk2_ardour/marker_view.cc +++ b/gtk2_ardour/marker_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,11 +35,11 @@ sigc::signal<void,MarkerView*> MarkerView::GoingAway; /** * Constructs a new MarkerView - * + * * @param parent the parent canvas item * @param tv the parent TimeAxisView of this item * @param tavi the TimeAxisViewItem that this item is to be assciated (marking) with - * @param spu the current samples per unit + * @param spu the current samples per unit * @param base_color * @param mark_type the marker type/name text, eg fade out, pan up etc. * @param mark_id unique name/id of this item @@ -68,7 +68,7 @@ MarkerView::MarkerView(ArdourCanvas::Group *parent, frame_handle_start->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_start_handle_event), frame_handle_start, this)); frame_handle_end->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_end_handle_event), frame_handle_end, this)); group->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_markerview_item_view_event), group, this)); - + set_position(start, this) ; set_duration(duration, this) ; } @@ -86,12 +86,12 @@ MarkerView::~MarkerView() } } - + //---------------------------------------------------------------------------------------// // Marker Type Methods /** - * Sets the marker Type text of this this MarkerItem, eg fade_out, pan up etc. + * Sets the marker Type text of this this MarkerItem, eg fade_out, pan up etc. * * @param type_text the marker type text of this item */ @@ -101,9 +101,9 @@ MarkerView::set_mark_type_text(std::string type_text) mark_type_text = type_text ; MarkTypeChanged(mark_type_text, this) ; /* EMIT_SIGNAL */ } - + /** - * Returns the marker Type of this this MarkerItem, eg fade_out, pan up etc. + * Returns the marker Type of this this MarkerItem, eg fade_out, pan up etc. * * @return the marker type text of this item */ @@ -122,7 +122,7 @@ MarkerView::set_marked_item(ImageFrameView* item) { ImageFrameView* temp = marked_item ; marked_item = item ; - + MarkedItemChanged(marked_item, this) ; /* EMIT_SIGNAL */ return(temp) ; } diff --git a/gtk2_ardour/marker_view.h b/gtk2_ardour/marker_view.h index 6c49a4dc0f..80ab8e60a7 100644 --- a/gtk2_ardour/marker_view.h +++ b/gtk2_ardour/marker_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,21 +36,21 @@ class ImageFrameView ; * MarkerView defines a marker item that may be placed upon a MarkerTimeAxis. * * The aim of the MarkerView is to provide additional timing details for visual based time axis. - * The MarkerView item is associated with one other TimeAxisViewItem and has a start and a duration. + * The MarkerView item is associated with one other TimeAxisViewItem and has a start and a duration. */ class MarkerView : public TimeAxisViewItem { public: //---------------------------------------------------------------------------------------// // Constructor / Desctructor - + /** * Constructs a new MarkerView - * + * * @param parent the parent canvas item * @param tv the parent TimeAxisView of this item * @param marked the Item that this item is to be assciated (marking) with - * @param spu the current samples per unit + * @param spu the current samples per unit * @param base_color * @param mark_type the marker type/name text, eg fade out, pan up etc. * @param mark_id unique name/id of this item @@ -72,27 +72,27 @@ class MarkerView : public TimeAxisViewItem * Destroys this Marker Item and removes the association between itself and the item it is marking. */ ~MarkerView() ; - + static sigc::signal<void,MarkerView*> GoingAway; - + //---------------------------------------------------------------------------------------// // Marker Type Methods - + /** - * Sets the marker Type text of this this MarkerItem, eg fade_out, pan up etc. + * Sets the marker Type text of this this MarkerItem, eg fade_out, pan up etc. * * @param type_text the marker type text of this item */ void set_mark_type_text(std::string type_text) ; - + /** - * Returns the marker Type of this this MarkerItem, eg fade_out, pan up etc. + * Returns the marker Type of this this MarkerItem, eg fade_out, pan up etc. * * @return the marker type text of this item */ std::string get_mark_type_text() const ; - + //---------------------------------------------------------------------------------------// // Marked Item Methods @@ -102,7 +102,7 @@ class MarkerView : public TimeAxisViewItem * @return the time axis item being marked by this item */ ImageFrameView* get_marked_item() ; - + /** * Sets the time axis item being marker by this item * @@ -110,17 +110,17 @@ class MarkerView : public TimeAxisViewItem * @return the previously marked item, or 0 if no previous marked item exists */ ImageFrameView* set_marked_item(ImageFrameView* item) ; - + //---------------------------------------------------------------------------------// // Emitted Signals - + /** Emitted when the mark type text is changed */ sigc::signal<void,std::string,void*> MarkTypeChanged ; - + /** Emitted when the Marked Item is changed */ sigc::signal<void,ImageFrameView*,void*> MarkedItemChanged ; - + protected: private: @@ -129,7 +129,7 @@ class MarkerView : public TimeAxisViewItem /* a pointer to the time axis item this marker is assoiated(marking up) with */ ImageFrameView* marked_item ; - + } ; /* class MarkerView */ diff --git a/gtk2_ardour/midi_channel_selector.cc b/gtk2_ardour/midi_channel_selector.cc index 4119b7ce05..03f0630eb9 100644 --- a/gtk2_ardour/midi_channel_selector.cc +++ b/gtk2_ardour/midi_channel_selector.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis Author: Hans Baier This program is free software; you can redistribute it and/or modify @@ -31,15 +31,15 @@ using namespace ARDOUR; MidiChannelSelector::MidiChannelSelector(int n_rows, int n_columns, int start_row, int start_column) : Table(n_rows, n_columns, true) , _recursion_counter(0) -{ +{ assert(n_rows >= 4); assert(n_rows >= start_row + 4); assert(n_columns >=4); assert(n_columns >= start_column + 4); - + property_column_spacing() = 0; property_row_spacing() = 0; - + uint8_t channel_nr = 0; for (int row = 0; row < 4; ++row) { for (int column = 0; column < 4; ++column) { @@ -103,10 +103,10 @@ SingleMidiChannelSelector::SingleMidiChannelSelector(uint8_t active_channel) void SingleMidiChannelSelector::button_toggled(ToggleButton* button, uint8_t channel) -{ +{ ++_recursion_counter; if (_recursion_counter == 1) { - // if the current button is active it must + // if the current button is active it must // be different from the first one if (button->get_active()) { if (_last_active_button) { @@ -131,15 +131,15 @@ MidiMultipleChannelSelector::MidiMultipleChannelSelector(ChannelMode mode, uint1 _select_all.add(*manage(new Label(_("All")))); _select_all.signal_clicked().connect( bind(mem_fun(this, &MidiMultipleChannelSelector::select_all), true)); - + _select_none.add(*manage(new Label(_("None")))); _select_none.signal_clicked().connect( bind(mem_fun(this, &MidiMultipleChannelSelector::select_all), false)); - + _invert_selection.add(*manage(new Label(_("Invert")))); _invert_selection.signal_clicked().connect( mem_fun(this, &MidiMultipleChannelSelector::invert_selection)); - + _force_channel.add(*manage(new Label(_("Force")))); _force_channel.signal_toggled().connect( mem_fun(this, &MidiMultipleChannelSelector::force_channels_button_toggled)); @@ -151,7 +151,7 @@ MidiMultipleChannelSelector::MidiMultipleChannelSelector(ChannelMode mode, uint1 attach(_select_none, 5, 6, 1, 2); attach(_invert_selection, 5, 6, 2, 3); attach(_force_channel, 5, 6, 3, 4); - + set_selected_channels(mask); } @@ -181,21 +181,21 @@ MidiMultipleChannelSelector::set_channel_mode(ChannelMode mode, uint16_t mask) } } -uint16_t -MidiMultipleChannelSelector::get_selected_channels() const -{ +uint16_t +MidiMultipleChannelSelector::get_selected_channels() const +{ uint16_t selected_channels = 0; for (uint16_t i = 0; i < 16; i++) { const ToggleButton* button = &_buttons[i / 4][i % 4]; if (button->get_active()) { selected_channels |= (1L << i); - } + } } - - return selected_channels; + + return selected_channels; } -void +void MidiMultipleChannelSelector::set_selected_channels(uint16_t selected_channels) { for (uint16_t i = 0; i < 16; i++) { @@ -223,7 +223,7 @@ MidiMultipleChannelSelector::button_toggled(ToggleButton */*button*/, uint8_t ch --_recursion_counter; } -void +void MidiMultipleChannelSelector::force_channels_button_toggled() { if (_force_channel.get_active()) { @@ -242,13 +242,13 @@ MidiMultipleChannelSelector::force_channels_button_toggled() found_first_active = true; active_channel = i; } - } + } } - + if (!found_first_active) { _buttons[0][0].set_active(true); } - + _select_all.set_sensitive(false); _select_none.set_sensitive(false); _invert_selection.set_sensitive(false); @@ -262,7 +262,7 @@ MidiMultipleChannelSelector::force_channels_button_toggled() } } -void +void MidiMultipleChannelSelector::select_all(bool on) { if (_channel_mode == ForceChannel) @@ -277,7 +277,7 @@ MidiMultipleChannelSelector::select_all(bool on) mode_changed.emit(_channel_mode, get_selected_channels()); } -void +void MidiMultipleChannelSelector::invert_selection(void) { if (_channel_mode == ForceChannel) diff --git a/gtk2_ardour/midi_channel_selector.h b/gtk2_ardour/midi_channel_selector.h index f604d0ccd3..42c3d55045 100644 --- a/gtk2_ardour/midi_channel_selector.h +++ b/gtk2_ardour/midi_channel_selector.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis Author: Hans Baier This program is free software; you can redistribute it and/or modify @@ -35,12 +35,12 @@ class MidiChannelSelector : public Gtk::Table public: MidiChannelSelector(int n_rows = 4, int n_columns = 4, int start_row = 0, int start_column = 0); virtual ~MidiChannelSelector() = 0; - + sigc::signal<void, ARDOUR::ChannelMode, uint16_t> mode_changed; - + void set_channel_colors(const uint32_t new_channel_colors[16]); void set_default_channel_color(); - + protected: virtual void button_toggled(Gtk::ToggleButton* button, uint8_t button_nr) = 0; Gtk::Label _button_labels[4][4]; @@ -52,11 +52,11 @@ class SingleMidiChannelSelector : public MidiChannelSelector { public: SingleMidiChannelSelector(uint8_t active_channel = 0); - + uint8_t get_active_channel() const { return _active_channel; } - + sigc::signal<void, uint8_t> channel_selected; - + protected: virtual void button_toggled(Gtk::ToggleButton* button, uint8_t button_nr); @@ -69,29 +69,29 @@ class MidiMultipleChannelSelector : public MidiChannelSelector public: MidiMultipleChannelSelector(ARDOUR::ChannelMode mode = ARDOUR::FilterChannels, uint16_t initial_selection = 0xFFFF); - + virtual ~MidiMultipleChannelSelector(); - + void set_channel_mode(ARDOUR::ChannelMode mode, uint16_t mask); /** - * @return each bit in the returned word represents a midi channel, eg. + * @return each bit in the returned word represents a midi channel, eg. * bit 0 represents channel 0 and bit 15 represents channel 15 - * + * */ uint16_t get_selected_channels() const; void set_selected_channels(uint16_t selected_channels); - + protected: ARDOUR::ChannelMode _channel_mode; ARDOUR::NoteMode _note_mode; - + virtual void button_toggled(Gtk::ToggleButton* button, uint8_t button_nr); void force_channels_button_toggled(); - + void select_all(bool on); void invert_selection(void); - + Gtk::Button _select_all; Gtk::Button _select_none; Gtk::Button _invert_selection; diff --git a/gtk2_ardour/midi_cut_buffer.h b/gtk2_ardour/midi_cut_buffer.h index 279d34d244..4281b962bc 100644 --- a/gtk2_ardour/midi_cut_buffer.h +++ b/gtk2_ardour/midi_cut_buffer.h @@ -25,7 +25,7 @@ namespace ARDOUR { class Session; } -class MidiCutBuffer : public ARDOUR::AutomatableSequence<ARDOUR::MidiModel::TimeType> +class MidiCutBuffer : public ARDOUR::AutomatableSequence<ARDOUR::MidiModel::TimeType> { public: typedef ARDOUR::MidiModel::TimeType TimeType; @@ -35,7 +35,7 @@ class MidiCutBuffer : public ARDOUR::AutomatableSequence<ARDOUR::MidiModel::Time TimeType origin() const { return _origin; } void set_origin (TimeType); - + void set (const Evoral::Sequence<TimeType>::Notes&); private: diff --git a/gtk2_ardour/midi_list_editor.cc b/gtk2_ardour/midi_list_editor.cc index d4a751192a..44a44dfb11 100644 --- a/gtk2_ardour/midi_list_editor.cc +++ b/gtk2_ardour/midi_list_editor.cc @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify @@ -55,7 +55,7 @@ MidiListEditor::MidiListEditor (Session& s, boost::shared_ptr<MidiRegion> r) renderer->property_editable() = true; renderer->signal_edited().connect (mem_fun (*this, &MidiListEditor::edited)); } - + scroller.add (view); scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC); @@ -109,7 +109,7 @@ MidiListEditor::redisplay_model () BBT_Time bbt; BBT_Time dur; stringstream ss; - + session.tempo_map().bbt_time (region->position(), bbt); dur.bars = 0; @@ -117,7 +117,7 @@ MidiListEditor::redisplay_model () dur.ticks = 0; session.tempo_map().bbt_duration_at (region->position(), dur, 0); - + ss << bbt; row[columns.start] = ss.str(); ss << dur; @@ -125,7 +125,7 @@ MidiListEditor::redisplay_model () session.tempo_map().bbt_time (region->position(), bbt); /* XXX get end point */ - + ss << bbt; row[columns.end] = ss.str(); @@ -133,4 +133,4 @@ MidiListEditor::redisplay_model () } view.set_model (model); -} +} diff --git a/gtk2_ardour/midi_list_editor.h b/gtk2_ardour/midi_list_editor.h index d52c1d83ac..96a04ada7c 100644 --- a/gtk2_ardour/midi_list_editor.h +++ b/gtk2_ardour/midi_list_editor.h @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify @@ -44,7 +44,7 @@ class MidiListEditor : public ArdourDialog private: struct MidiListModelColumns : public Gtk::TreeModel::ColumnRecord { - MidiListModelColumns() { + MidiListModelColumns() { add (channel); add (note); add (note_name); @@ -63,7 +63,7 @@ class MidiListEditor : public ArdourDialog Gtk::TreeModelColumn<std::string> end; Gtk::TreeModelColumn<boost::shared_ptr<NoteType> > _note; }; - + ARDOUR::Session& session; MidiListModelColumns columns; Glib::RefPtr<Gtk::ListStore> model; diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 3e2fd5470d..d76c173af1 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -109,7 +109,7 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView & , _pressed_button(0) , _sort_needed (true) , _optimization_iterator (_events.end()) - + { _note_group->raise_to_top(); } @@ -137,7 +137,7 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other) UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a); c.set_rgb_p (r/255.0, g/255.0, b/255.0); - + init (c, false); } @@ -186,7 +186,7 @@ MidiRegionView::init (Gdk::Color const & basic_color, bool wfd) region_sync_changed (); region_resized (BoundsChanged); region_locked (); - + reset_width_dependent_items (_pixel_width); set_colors (); @@ -203,7 +203,7 @@ MidiRegionView::init (Gdk::Color const & basic_color, bool wfd) midi_view()->signal_channel_mode_changed().connect( mem_fun(this, &MidiRegionView::midi_channel_mode_changed)); - + midi_view()->signal_midi_patch_settings_changed().connect( mem_fun(this, &MidiRegionView::midi_patch_settings_changed)); } @@ -232,7 +232,7 @@ MidiRegionView::canvas_event(GdkEvent* ev) switch (ev->type) { case GDK_SCROLL: fine = Keyboard::modifier_state_equals (ev->scroll.state, Keyboard::Level4Modifier); - + if (ev->scroll.direction == GDK_SCROLL_UP) { change_velocities (true, fine, false); return true; @@ -265,7 +265,7 @@ MidiRegionView::canvas_event(GdkEvent* ev) bool end = (ev->key.keyval == GDK_period); bool shorter = Keyboard::modifier_state_contains (ev->key.state, Keyboard::PrimaryModifier); fine = Keyboard::modifier_state_contains (ev->key.state, Keyboard::SecondaryModifier); - + change_note_lengths (fine, shorter, start, end); return true; @@ -297,10 +297,10 @@ MidiRegionView::canvas_event(GdkEvent* ev) return true; } else if (ev->key.keyval == GDK_Down) { - + bool allow_smush = Keyboard::modifier_state_contains (ev->key.state, Keyboard::SecondaryModifier); fine = Keyboard::modifier_state_contains (ev->key.state, Keyboard::TertiaryModifier); - + if (Keyboard::modifier_state_contains (ev->key.state, Keyboard::PrimaryModifier)) { change_velocities (false, fine, allow_smush); } else { @@ -309,7 +309,7 @@ MidiRegionView::canvas_event(GdkEvent* ev) return true; } else if (ev->key.keyval == GDK_Left) { - + nudge_notes (false); return true; @@ -471,7 +471,7 @@ MidiRegionView::canvas_event(GdkEvent* ev) } else if (_pressed_button != 1) { return false; } - + switch (_mouse_state) { case Pressed: // Clicked switch (editor.current_mouse_mode()) { @@ -482,7 +482,7 @@ MidiRegionView::canvas_event(GdkEvent* ev) case MouseRange: create_note_at(event_x, event_y, _default_note_length); break; - default: + default: break; } _mouse_state = None; @@ -498,7 +498,7 @@ MidiRegionView::canvas_event(GdkEvent* ev) const double x = drag_rect->property_x1(); const double length = trackview.editor().pixel_to_frame( drag_rect->property_x2() - drag_rect->property_x1()); - + create_note_at(x, drag_rect->property_y1(), frames_to_beats(length)); } @@ -506,7 +506,7 @@ MidiRegionView::canvas_event(GdkEvent* ev) drag_rect = 0; default: break; } - + default: break; } @@ -591,8 +591,8 @@ MidiRegionView::display_model(boost::shared_ptr<MidiModel> model) redisplay_model(); } } - - + + void MidiRegionView::start_delta_command(string name) { @@ -632,7 +632,7 @@ MidiRegionView::delta_remove_note(ArdourCanvas::CanvasNoteEvent* ev) } void -MidiRegionView::diff_add_change (ArdourCanvas::CanvasNoteEvent* ev, +MidiRegionView::diff_add_change (ArdourCanvas::CanvasNoteEvent* ev, MidiModel::DiffCommand::Property property, uint8_t val) { @@ -642,7 +642,7 @@ MidiRegionView::diff_add_change (ArdourCanvas::CanvasNoteEvent* ev, } void -MidiRegionView::diff_add_change (ArdourCanvas::CanvasNoteEvent* ev, +MidiRegionView::diff_add_change (ArdourCanvas::CanvasNoteEvent* ev, MidiModel::DiffCommand::Property property, Evoral::MusicalTime val) { @@ -650,7 +650,7 @@ MidiRegionView::diff_add_change (ArdourCanvas::CanvasNoteEvent* ev, _diff_command->change (ev->note(), property, val); } } - + void MidiRegionView::apply_delta() { @@ -662,9 +662,9 @@ MidiRegionView::apply_delta() for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) { _marked_for_selection.insert((*i)->note()); } - + _model->apply_command(trackview.session(), _delta_command); - _delta_command = 0; + _delta_command = 0; midi_view()->midi_track()->diskstream()->playlist_modified(); _marked_for_selection.clear(); @@ -679,7 +679,7 @@ MidiRegionView::apply_diff () } _model->apply_command(trackview.session(), _diff_command); - _diff_command = 0; + _diff_command = 0; midi_view()->midi_track()->diskstream()->playlist_modified(); _marked_for_velocity.clear(); @@ -696,9 +696,9 @@ MidiRegionView::apply_delta_as_subcommand() for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) { _marked_for_selection.insert((*i)->note()); } - + _model->apply_command_as_subcommand(trackview.session(), _delta_command); - _delta_command = 0; + _delta_command = 0; midi_view()->midi_track()->diskstream()->playlist_modified(); _marked_for_selection.clear(); @@ -716,9 +716,9 @@ MidiRegionView::apply_diff_as_subcommand() for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) { _marked_for_selection.insert((*i)->note()); } - + _model->apply_command_as_subcommand(trackview.session(), _diff_command); - _diff_command = 0; + _diff_command = 0; midi_view()->midi_track()->diskstream()->playlist_modified(); _marked_for_selection.clear(); @@ -741,10 +741,10 @@ MidiRegionView::find_canvas_note (boost::shared_ptr<NoteType> note) if (_optimization_iterator != _events.end()) { ++_optimization_iterator; } - + if (_optimization_iterator != _events.end() && (*_optimization_iterator)->note() == note) { return *_optimization_iterator; - } + } for (_optimization_iterator = _events.begin(); _optimization_iterator != _events.end(); ++_optimization_iterator) { if ((*_optimization_iterator)->note() == note) { @@ -771,12 +771,12 @@ MidiRegionView::redisplay_model() for (Events::iterator i = _events.begin(); i != _events.end(); ++i) { (*i)->invalidate (); } - + _model->read_lock(); - + MidiModel::Notes& notes (_model->notes()); _optimization_iterator = _events.begin(); - + for (MidiModel::Notes::iterator n = notes.begin(); n != notes.end(); ++n) { boost::shared_ptr<NoteType> note (*n); @@ -784,14 +784,14 @@ MidiRegionView::redisplay_model() bool visible; if (note_in_region_range (note, visible)) { - + if ((cne = find_canvas_note (note)) != 0) { - + cne->validate (); - + CanvasNote* cn; CanvasHit* ch; - + if ((cn = dynamic_cast<CanvasNote*>(cne)) != 0) { update_note (cn); } else if ((ch = dynamic_cast<CanvasHit*>(cne)) != 0) { @@ -803,23 +803,23 @@ MidiRegionView::redisplay_model() } else { cne->hide (); } - + } else { - + add_note (note, visible); } - + } else { - + if ((cne = find_canvas_note (note)) != 0) { cne->validate (); cne->hide (); } } } - + /* remove note items that are no longer valid */ - + for (Events::iterator i = _events.begin(); i != _events.end(); ) { if (!(*i)->valid ()) { delete *i; @@ -828,12 +828,12 @@ MidiRegionView::redisplay_model() ++i; } } - + display_sysexes(); display_program_changes(); - + _model->read_unlock(); - + _marked_for_selection.clear (); _marked_for_velocity.clear (); @@ -880,7 +880,7 @@ MidiRegionView::display_program_changes() MIDI::Name::PatchPrimaryKey patch_key(msb, lsb, program_number); - boost::shared_ptr<MIDI::Name::Patch> patch = + boost::shared_ptr<MIDI::Name::Patch> patch = MIDI::Name::MidiPatchManager::instance().find_patch( _model_name, _custom_device_mode, channel, patch_key); @@ -896,13 +896,13 @@ MidiRegionView::display_program_changes() } } -void +void MidiRegionView::display_sysexes() { for (MidiModel::SysExes::const_iterator i = _model->sysexes().begin(); i != _model->sysexes().end(); ++i) { Evoral::MusicalTime time = (*i)->time(); assert(time >= 0); - + ostringstream str; str << hex; for (uint32_t b = 0; b < (*i)->size(); ++b) { @@ -912,23 +912,23 @@ MidiRegionView::display_sysexes() } } string text = str.str(); - + ArdourCanvas::Group* const group = (ArdourCanvas::Group*)get_canvas_group(); const double x = trackview.editor().frame_to_pixel(beats_to_frames(time)); - + double height = midi_stream_view()->contents_height(); - + boost::shared_ptr<CanvasSysEx> sysex = boost::shared_ptr<CanvasSysEx>( new CanvasSysEx(*this, *group, text, height, x, 1.0)); - + // Show unless program change is beyond the region bounds if (time - _region->start() >= _region->length() || time < _region->start()) { sysex->hide(); } else { sysex->show(); } - + _sys_exes.push_back(sysex); } } @@ -954,13 +954,13 @@ void MidiRegionView::region_resized (Change what_changed) { RegionView::region_resized(what_changed); - + if (what_changed & ARDOUR::PositionChanged) { set_duration(_region->length(), 0); if (_enable_display) { redisplay_model(); } - } + } } void @@ -981,11 +981,11 @@ MidiRegionView::set_height (double height) const double old_height = _height; RegionView::set_height(height); _height = height - FUDGE; - + apply_note_range(midi_stream_view()->lowest_note(), midi_stream_view()->highest_note(), height != old_height + FUDGE); - + if (name_pixbuf) { name_pixbuf->raise_to_top(); } @@ -1013,18 +1013,18 @@ MidiRegionView::apply_note_range (uint8_t min, uint8_t max, bool force) CanvasNoteEvent* event = *i; boost::shared_ptr<NoteType> note (event->note()); - if (note->note() < _current_range_min || + if (note->note() < _current_range_min || note->note() > _current_range_max) { event->hide(); } else { event->show(); } - + if (CanvasNote* cnote = dynamic_cast<CanvasNote*>(event)) { const double y1 = midi_stream_view()->note_to_y(note->note()); const double y2 = y1 + floor(midi_stream_view()->note_height()); - + cnote->property_y1() = y1; cnote->property_y2() = y2; @@ -1033,9 +1033,9 @@ MidiRegionView::apply_note_range (uint8_t min, uint8_t max, bool force) double x = trackview.editor().frame_to_pixel( beats_to_frames(note->time()) - _region->start()); const double diamond_size = midi_stream_view()->note_height() / 2.0; - double y = midi_stream_view()->note_to_y(event->note()->note()) + double y = midi_stream_view()->note_to_y(event->note()->note()) + ((diamond_size-2.0) / 4.0); - + chit->set_height (diamond_size); chit->move (x - chit->x1(), y - chit->y1()); chit->show (); @@ -1136,7 +1136,7 @@ MidiRegionView::extend_active_notes() } } -void +void MidiRegionView::play_midi_note(boost::shared_ptr<NoteType> note) { if (!trackview.editor().sound_notes()) { @@ -1145,10 +1145,10 @@ MidiRegionView::play_midi_note(boost::shared_ptr<NoteType> note) RouteUI* route_ui = dynamic_cast<RouteUI*> (&trackview); assert(route_ui); - + route_ui->midi_track()->write_immediate_event( note->on_event().size(), note->on_event().buffer()); - + const double note_length_beats = (note->off_event().time() - note->on_event().time()); nframes_t note_length_ms = beats_to_frames(note_length_beats) * (1000 / (double)route_ui->session().nominal_frame_rate()); @@ -1161,7 +1161,7 @@ MidiRegionView::play_midi_note_off(boost::shared_ptr<NoteType> note) { RouteUI* route_ui = dynamic_cast<RouteUI*> (&trackview); assert(route_ui); - + route_ui->midi_track()->write_immediate_event( note->off_event().size(), note->off_event().buffer()); @@ -1173,7 +1173,7 @@ MidiRegionView::note_in_region_range(const boost::shared_ptr<NoteType> note, boo { const nframes64_t note_start_frames = beats_to_frames(note->time()); - bool outside = (note_start_frames - _region->start() >= _region->length()) || + bool outside = (note_start_frames - _region->start() >= _region->length()) || (note_start_frames < _region->start()); visible = (note->note() >= midi_stream_view()->lowest_note()) && @@ -1192,7 +1192,7 @@ MidiRegionView::update_note (CanvasNote* ev) const double x = trackview.editor().frame_to_pixel(note_start_frames - _region->start()); const double y1 = midi_stream_view()->note_to_y(note->note()); - const double note_endpixel = + const double note_endpixel = trackview.editor().frame_to_pixel(note_end_frames - _region->start()); ev->property_x1() = x; @@ -1203,7 +1203,7 @@ MidiRegionView::update_note (CanvasNote* ev) ev->property_x2() = trackview.editor().frame_to_pixel(_region->length()); } ev->property_y2() = y1 + floor(midi_stream_view()->note_height()); - + if (note->length() == 0) { if (_active_notes) { assert(note->note() < 128); @@ -1248,14 +1248,14 @@ void MidiRegionView::add_note(const boost::shared_ptr<NoteType> note, bool visible) { CanvasNoteEvent* event = 0; - + assert(note->time() >= 0); assert(midi_view()->note_mode() == Sustained || midi_view()->note_mode() == Percussive); ArdourCanvas::Group* const group = (ArdourCanvas::Group*)get_canvas_group(); if (midi_view()->note_mode() == Sustained) { - + CanvasNote* ev_rect = new CanvasNote(*this, *group, note); update_note (ev_rect); @@ -1287,7 +1287,7 @@ MidiRegionView::add_note(const boost::shared_ptr<NoteType> note, bool visible) if (event) { if (_marked_for_selection.find(note) != _marked_for_selection.end()) { note_selected(event, true); - } + } if (_marked_for_velocity.find(note) != _marked_for_velocity.end()) { event->show_velocity(); @@ -1304,11 +1304,11 @@ MidiRegionView::add_note(const boost::shared_ptr<NoteType> note, bool visible) } void -MidiRegionView::add_note (uint8_t channel, uint8_t number, uint8_t velocity, +MidiRegionView::add_note (uint8_t channel, uint8_t number, uint8_t velocity, Evoral::MusicalTime pos, Evoral::MusicalTime len) { boost::shared_ptr<NoteType> new_note (new NoteType (channel, pos, len, number, velocity)); - + start_delta_command (_("step add")); delta_add_note (new_note, true, false); apply_delta(); @@ -1329,28 +1329,28 @@ void MidiRegionView::add_pgm_change(PCEvent& program, const string& displaytext) { assert(program.time >= 0); - + ArdourCanvas::Group* const group = (ArdourCanvas::Group*)get_canvas_group(); const double x = trackview.editor().frame_to_pixel(beats_to_frames(program.time)); - + double height = midi_stream_view()->contents_height(); - + boost::shared_ptr<CanvasProgramChange> pgm_change = boost::shared_ptr<CanvasProgramChange>( new CanvasProgramChange(*this, *group, - displaytext, - height, - x, 1.0, - _model_name, - _custom_device_mode, + displaytext, + height, + x, 1.0, + _model_name, + _custom_device_mode, program.time, program.channel, program.value)); - + // Show unless program change is beyond the region bounds if (program.time - _region->start() >= _region->length() || program.time < _region->start()) { pgm_change->hide(); } else { pgm_change->show(); } - + _pgm_changes.push_back(pgm_change); } @@ -1373,7 +1373,7 @@ MidiRegionView::get_patch_key_at(double time, uint8_t channel, MIDI::Name::Patch lsb = lsb_control->get_float(true, time); cerr << " got lsb " << lsb; } - + Evoral::Parameter program_change(MidiPgmChangeAutomation, channel, 0); boost::shared_ptr<Evoral::Control> program_control = _model->control(program_change); float program_number = -1.0; @@ -1381,7 +1381,7 @@ MidiRegionView::get_patch_key_at(double time, uint8_t channel, MIDI::Name::Patch program_number = program_control->get_float(true, time); cerr << " got program " << program_number << endl; } - + key.msb = (int) floor(msb + 0.5); key.lsb = (int) floor(lsb + 0.5); key.program_number = (int) floor(program_number + 0.5); @@ -1389,7 +1389,7 @@ MidiRegionView::get_patch_key_at(double time, uint8_t channel, MIDI::Name::Patch } -void +void MidiRegionView::alter_program_change(PCEvent& old_program, const MIDI::Name::PatchPrimaryKey& new_patch) { // TODO: Get the real event here and alter them at the original times @@ -1405,13 +1405,13 @@ MidiRegionView::alter_program_change(PCEvent& old_program, const MIDI::Name::Pat if (lsb_control != 0) { lsb_control->set_float(float(new_patch.lsb), true, old_program.time); } - + Evoral::Parameter program_change(MidiPgmChangeAutomation, old_program.channel, 0); boost::shared_ptr<Evoral::Control> program_control = _model->control(program_change); - + assert(program_control != 0); program_control->set_float(float(new_patch.program_number), true, old_program.time); - + redisplay_model(); } @@ -1422,37 +1422,37 @@ MidiRegionView::program_selected(CanvasProgramChange& program, const MIDI::Name: alter_program_change(program_change_event, new_patch); } -void +void MidiRegionView::previous_program(CanvasProgramChange& program) { MIDI::Name::PatchPrimaryKey key; get_patch_key_at(program.event_time(), program.channel(), key); - - boost::shared_ptr<MIDI::Name::Patch> patch = + + boost::shared_ptr<MIDI::Name::Patch> patch = MIDI::Name::MidiPatchManager::instance().previous_patch( _model_name, - _custom_device_mode, - program.channel(), + _custom_device_mode, + program.channel(), key); - + PCEvent program_change_event(program.event_time(), program.program(), program.channel()); if (patch) { alter_program_change(program_change_event, patch->patch_primary_key()); } } -void +void MidiRegionView::next_program(CanvasProgramChange& program) { MIDI::Name::PatchPrimaryKey key; get_patch_key_at(program.event_time(), program.channel(), key); - - boost::shared_ptr<MIDI::Name::Patch> patch = + + boost::shared_ptr<MIDI::Name::Patch> patch = MIDI::Name::MidiPatchManager::instance().next_patch( _model_name, - _custom_device_mode, - program.channel(), - key); + _custom_device_mode, + program.channel(), + key); PCEvent program_change_event(program.event_time(), program.program(), program.channel()); if (patch) { @@ -1544,7 +1544,7 @@ MidiRegionView::note_selected(ArdourCanvas::CanvasNoteEvent* ev, bool add, bool for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) { if ((*i)->note()->end_time() > latest) { latest = (*i)->note()->end_time(); - } + } if ((*i)->note()->time() < earliest) { earliest = (*i)->note()->time(); } @@ -1557,21 +1557,21 @@ MidiRegionView::note_selected(ArdourCanvas::CanvasNoteEvent* ev, bool add, bool if (ev->note()->time() < earliest) { earliest = ev->note()->time(); } - - for (Events::iterator i = _events.begin(); i != _events.end(); ++i) { - + + for (Events::iterator i = _events.begin(); i != _events.end(); ++i) { + /* find notes entirely within OR spanning the earliest..latest range */ - + if (((*i)->note()->time() >= earliest && (*i)->note()->end_time() <= latest) || ((*i)->note()->time() <= earliest && (*i)->note()->end_time() >= latest)) { add_to_selection (*i); - } + } #if 0 /* if events were guaranteed to be time sorted, we could do this. but as of sept 10th 2009, they no longer are. */ - + if ((*i)->note()->time() > latest) { break; } @@ -1604,7 +1604,7 @@ MidiRegionView::update_drag_selection(double x1, double x2, double y1, double y2 for (Events::iterator i = _events.begin(); i != _events.end(); ++i) { /* check if any corner of the note is inside the rect - + Notes: 1) this is computing "touched by", not "contained by" the rect. 2) this does not require that events be sorted in time. @@ -1642,7 +1642,7 @@ MidiRegionView::remove_from_selection (CanvasNoteEvent* ev) ev->selected (false); ev->hide_velocity (); - + if (_selection.empty()) { PublicEditor& editor (trackview.editor()); editor.get_selection().remove (this); @@ -1696,9 +1696,9 @@ MidiRegionView::note_dropped(CanvasNoteEvent *, double dt, int8_t dnote) /* cerr << "dnote: " << (int) dnote << endl; - cerr << "lowest note (streamview): " << int(midi_stream_view()->lowest_note()) + cerr << "lowest note (streamview): " << int(midi_stream_view()->lowest_note()) << " highest note (streamview): " << int(midi_stream_view()->highest_note()) << endl; - cerr << "lowest note (selection): " << int(lowest_note_in_selection) << " highest note(selection): " + cerr << "lowest note (selection): " << int(lowest_note_in_selection) << " highest note(selection): " << int(highest_note_in_selection) << endl; cerr << "selection size: " << _selection.size() << endl; cerr << "Highest note in selection: " << (int) highest_note_in_selection << endl; @@ -1708,7 +1708,7 @@ MidiRegionView::note_dropped(CanvasNoteEvent *, double dt, int8_t dnote) if (highest_note_in_selection + dnote > 127) { highest_note_difference = highest_note_in_selection - 127; } - + start_diff_command(_("move notes")); for (Selection::iterator i = _selection.begin(); i != _selection.end() ; ++i) { @@ -1734,7 +1734,7 @@ MidiRegionView::note_dropped(CanvasNoteEvent *, double dt, int8_t dnote) // keep notes in standard midi range clamp_to_0_127(new_pitch); - + // keep original pitch if note is dragged outside valid midi range if ((original_pitch != 0 && new_pitch == 0) || (original_pitch != 127 && new_pitch == 127)) { @@ -1748,7 +1748,7 @@ MidiRegionView::note_dropped(CanvasNoteEvent *, double dt, int8_t dnote) } apply_diff(); - + // care about notes being moved beyond the upper/lower bounds on the canvas if (lowest_note_in_selection < midi_stream_view()->lowest_note() || highest_note_in_selection > midi_stream_view()->highest_note()) { @@ -1871,7 +1871,7 @@ MidiRegionView::update_resizing (bool at_front, double delta_x, bool relative) current_x = delta_x - get_end_position_pixels (); } } - + if (at_front) { resize_rect->property_x1() = snap_to_pixel(current_x); resize_rect->property_x2() = canvas_note->x2(); @@ -1908,7 +1908,7 @@ MidiRegionView::commit_resizing (bool at_front, double delta_x, bool relative) current_x = region_start + delta_x; } } - + current_x = snap_pixel_to_frame (current_x); current_x = frames_to_beats (current_x); @@ -2008,11 +2008,11 @@ MidiRegionView::trim_note (CanvasNoteEvent* event, Evoral::MusicalTime front_del } else { Evoral::MusicalTime new_pos = event->note()->time() + front_delta; - + if (new_pos < event->note()->end_time()) { new_start = event->note()->time() + front_delta; /* start moved toward the end, so move the end point back to where it used to be */ - new_length = event->note()->length() - front_delta; + new_length = event->note()->length() - front_delta; change_start = true; change_length = true; } @@ -2026,7 +2026,7 @@ MidiRegionView::trim_note (CanvasNoteEvent* event, Evoral::MusicalTime front_del if (event->note()->length() < -end_delta) { can_change = false; } - } + } if (can_change) { new_length = event->note()->length() + end_delta; @@ -2054,7 +2054,7 @@ MidiRegionView::change_note_time (CanvasNoteEvent* event, Evoral::MusicalTime de new_time = 0; } else { new_time = event->note()->time() + delta; - } + } } else { new_time = event->note()->time() + delta; } @@ -2093,14 +2093,14 @@ MidiRegionView::change_velocities (bool up, bool fine, bool allow_smush) } start_diff_command(_("change velocities")); - + for (Selection::iterator i = _selection.begin(); i != _selection.end();) { Selection::iterator next = i; ++next; change_note_velocity (*i, delta, true); i = next; } - + apply_diff(); } @@ -2113,7 +2113,7 @@ MidiRegionView::transpose (bool up, bool fine, bool allow_smush) } int8_t delta; - + if (fine) { delta = 1; } else { @@ -2171,13 +2171,13 @@ MidiRegionView::change_note_lengths (bool fine, bool shorter, bool start, bool e if (shorter) { delta = -delta; } - + start_diff_command (_("change note lengths")); for (Selection::iterator i = _selection.begin(); i != _selection.end(); ) { Selection::iterator next = i; ++next; - + /* note the negation of the delta for start */ trim_note (*i, (start ? -delta : 0), (end ? delta : 0)); @@ -2195,8 +2195,8 @@ MidiRegionView::nudge_notes (bool forward) return; } - /* pick a note as the point along the timeline to get the nudge distance. - its not necessarily the earliest note, so we may want to pull the notes out + /* pick a note as the point along the timeline to get the nudge distance. + its not necessarily the earliest note, so we may want to pull the notes out into a vector and sort before using the first one. */ @@ -2209,23 +2209,23 @@ MidiRegionView::nudge_notes (bool forward) /* no nudge distance set - use grid */ nframes64_t next_pos = ref_point; - + if (forward) { /* XXX need check on max_frames, but that needs max_frames64 or something */ next_pos += 1; - } else { + } else { if (next_pos == 0) { return; } next_pos -= 1; } - + cerr << "ref point was " << ref_point << " next was " << next_pos; trackview.editor().snap_to (next_pos, (forward ? 1 : -1), false); distance = ref_point - next_pos; cerr << " final is " << next_pos << " distance = " << distance << endl; - } - + } + if (distance == 0) { return; } @@ -2279,7 +2279,7 @@ MidiRegionView::note_left (ArdourCanvas::CanvasNoteEvent*) PublicEditor& editor (trackview.editor()); editor.hide_verbose_canvas_cursor (); } - + void MidiRegionView::switch_source(boost::shared_ptr<Source> src) @@ -2301,7 +2301,7 @@ MidiRegionView::set_frame_color() } } -void +void MidiRegionView::midi_channel_mode_changed(ChannelMode mode, uint16_t mask) { switch (mode) { @@ -2322,7 +2322,7 @@ MidiRegionView::midi_channel_mode_changed(ChannelMode mode, uint16_t mask) _last_channel_selection = mask; } -void +void MidiRegionView::midi_patch_settings_changed(std::string model, std::string custom_device_mode) { _model_name = model; @@ -2347,7 +2347,7 @@ MidiRegionView::cut_copy_clear (Editing::CutCopyOp op) default: break; } - + start_delta_command(); for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) { @@ -2381,7 +2381,7 @@ MidiRegionView::selection_as_cut_buffer () const MidiCutBuffer* cb = new MidiCutBuffer (trackview.session()); cb->set (notes); - + return cb; } @@ -2409,7 +2409,7 @@ MidiRegionView::paste (nframes64_t pos, float times, const MidiCutBuffer& mcb) for (int n = 0; n < (int) times; ++n) { for (NoteList::const_iterator i = mcb.notes().begin(); i != mcb.notes().end(); ++i) { - + boost::shared_ptr<NoteType> copied_note (new NoteType (*((*i).get()))); copied_note->set_time (paste_pos_beats + copied_note->time() - beat_delta); @@ -2435,7 +2435,7 @@ MidiRegionView::paste (nframes64_t pos, float times, const MidiCutBuffer& mcb) _region->set_length (end_frame, this); trackview.session().add_command (new MementoCommand<Region>(*_region, &before, &_region->get_state())); } - + apply_delta (); } @@ -2484,7 +2484,7 @@ MidiRegionView::goto_next_note () /* use the first one */ unique_select (_events.front()); - + } void @@ -2516,7 +2516,7 @@ MidiRegionView::goto_previous_note () } void -MidiRegionView::selection_as_notelist (NoteList& selected) +MidiRegionView::selection_as_notelist (NoteList& selected) { time_sort_events (); diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index a2c56a2473..36b7c99f54 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -72,7 +72,7 @@ class MidiRegionView : public RegionView boost::shared_ptr<ARDOUR::MidiRegion>, double initial_samples_per_unit, Gdk::Color const & basic_color); - + MidiRegionView (const MidiRegionView& other); MidiRegionView (const MidiRegionView& other, boost::shared_ptr<ARDOUR::MidiRegion>); @@ -89,14 +89,14 @@ class MidiRegionView : public RegionView inline MidiStreamView* midi_stream_view() const { return midi_view()->midi_view(); } - void add_note (uint8_t channel, uint8_t number, uint8_t velocity, + void add_note (uint8_t channel, uint8_t number, uint8_t velocity, Evoral::MusicalTime pos, Evoral::MusicalTime len); void set_height (double); void apply_note_range(uint8_t lowest, uint8_t highest, bool force=false); inline ARDOUR::ColorMode color_mode() const { return midi_view()->color_mode(); } - + void set_frame_color(); void redisplay_model(); @@ -110,41 +110,41 @@ class MidiRegionView : public RegionView void paste (nframes64_t pos, float times, const MidiCutBuffer&); struct PCEvent { - PCEvent(double a_time, uint8_t a_value, uint8_t a_channel) + PCEvent(double a_time, uint8_t a_value, uint8_t a_channel) : time(a_time), value(a_value), channel(a_channel) {} double time; uint8_t value; uint8_t channel; }; - + /** Add a new program change flag to the canvas. * @param program the MidiRegionView::PCEvent to add * @param the text to display in the flag */ void add_pgm_change(PCEvent& program, const std::string& displaytext); - + /** Look up the given time and channel in the 'automation' and set keys accordingly. * @param time the time of the program change event * @param channel the MIDI channel of the event - * @key a reference to an instance of MIDI::Name::PatchPrimaryKey whose fields will + * @key a reference to an instance of MIDI::Name::PatchPrimaryKey whose fields will * will be set according to the result of the lookup */ void get_patch_key_at(double time, uint8_t channel, MIDI::Name::PatchPrimaryKey& key); - + /** Change the 'automation' data of old_program to new values which correspond to new_patch. * @param old_program the program change event which is to be altered * @param new_patch the new lsb, msb and program number which are to be set */ void alter_program_change(PCEvent& old_program, const MIDI::Name::PatchPrimaryKey& new_patch); - + /** Alter a given program to the new given one. * (Called on context menu select on CanvasProgramChange) */ void program_selected( - ArdourCanvas::CanvasProgramChange& program, + ArdourCanvas::CanvasProgramChange& program, const MIDI::Name::PatchPrimaryKey& new_patch); - + /** Alter a given program to be its predecessor in the MIDNAM file. */ void previous_program(ArdourCanvas::CanvasProgramChange& program); @@ -152,11 +152,11 @@ class MidiRegionView : public RegionView /** Alters a given program to be its successor in the MIDNAM file. */ void next_program(ArdourCanvas::CanvasProgramChange& program); - + /** Displays all program change events in the region as flags on the canvas. */ void display_program_changes(); - + /** Displays all system exclusive events in the region as flags on the canvas. */ void display_sysexes(); @@ -190,7 +190,7 @@ class MidiRegionView : public RegionView void note_deselected(ArdourCanvas::CanvasNoteEvent* ev); void delete_selection(); size_t selection_size() { return _selection.size(); } - + void move_selection(double dx, double dy); void note_dropped(ArdourCanvas::CanvasNoteEvent* ev, double d_pixels, int8_t d_note); @@ -231,7 +231,7 @@ class MidiRegionView : public RegionView * @param relative whether velocity is relative or absolute */ void change_velocity(ArdourCanvas::CanvasNoteEvent* ev, int8_t velocity, bool relative=false); - + /** Change the channel of the selection. * @param channel - the channel number of the new channel, zero-based */ @@ -251,7 +251,7 @@ class MidiRegionView : public RegionView ArdourCanvas::CanvasNote *canvas_note; ArdourCanvas::SimpleRect *resize_rect; }; - + /** Snap a region relative pixel coordinate to pixel units. * @param x a pixel coordinate relative to region start * @return the snapped pixel coordinate relative to region start @@ -269,10 +269,10 @@ class MidiRegionView : public RegionView * @return the snapped nframes64_t coordinate relative to region start */ nframes64_t snap_frame_to_frame(nframes64_t x); - + /** Convert a timestamp in beats to frames (both relative to region start) */ nframes64_t beats_to_frames(double beats) const; - + /** Convert a timestamp in frames to beats (both relative to region start) */ double frames_to_beats(nframes64_t beats) const; @@ -297,12 +297,12 @@ class MidiRegionView : public RegionView double samples_per_unit, Gdk::Color& basic_color, TimeAxisViewItem::Visibility); - + void region_resized (ARDOUR::Change); - + void set_flags (XMLNode *); void store_flags (); - + void reset_width_dependent_items (double pixel_width); private: @@ -310,7 +310,7 @@ class MidiRegionView : public RegionView * and schedule the playback of the corresponding NoteOff event. */ void play_midi_note(boost::shared_ptr<NoteType> note); - + /** Play the NoteOff-Event of the given note immediately * (scheduled by @ref play_midi_note()). */ @@ -321,10 +321,10 @@ class MidiRegionView : public RegionView bool canvas_event(GdkEvent* ev); bool note_canvas_event(GdkEvent* ev); - + void midi_channel_mode_changed(ARDOUR::ChannelMode mode, uint16_t mask); void midi_patch_settings_changed(std::string model, std::string custom_device_mode); - + void change_note_velocity(ArdourCanvas::CanvasNoteEvent* ev, int8_t vel, bool relative=false); void change_note_note(ArdourCanvas::CanvasNoteEvent* ev, int8_t note, bool relative=false); void change_note_time(ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::TimeType, bool relative=false); @@ -343,17 +343,17 @@ class MidiRegionView : public RegionView double _default_note_length; uint8_t _current_range_min; uint8_t _current_range_max; - + /// MIDNAM information of the current track: Model name of MIDNAM file std::string _model_name; - + /// MIDNAM information of the current track: CustomDeviceMode - std::string _custom_device_mode; + std::string _custom_device_mode; typedef std::list<ArdourCanvas::CanvasNoteEvent*> Events; typedef std::vector< boost::shared_ptr<ArdourCanvas::CanvasProgramChange> > PgmChanges; typedef std::vector< boost::shared_ptr<ArdourCanvas::CanvasSysEx> > SysExes; - + boost::shared_ptr<ARDOUR::MidiModel> _model; Events _events; PgmChanges _pgm_changes; @@ -378,7 +378,7 @@ class MidiRegionView : public RegionView /** New notes (created in the current command) which should be selected * when they appear after the command is applied. */ std::set< boost::shared_ptr<NoteType> > _marked_for_selection; - + /** New notes (created in the current command) which should have visible velocity * when they appear after the command is applied. */ std::set< boost::shared_ptr<NoteType> > _marked_for_velocity; @@ -393,8 +393,8 @@ class MidiRegionView : public RegionView void update_note (ArdourCanvas::CanvasNote*); void update_hit (ArdourCanvas::CanvasHit*); - -}; + +}; #endif /* __gtk_ardour_midi_region_view_h__ */ diff --git a/gtk2_ardour/midi_scroomer.cc b/gtk2_ardour/midi_scroomer.cc index 0299e8d2d5..cccc03c507 100644 --- a/gtk2_ardour/midi_scroomer.cc +++ b/gtk2_ardour/midi_scroomer.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -85,7 +85,7 @@ MidiScroomer::on_expose_event(GdkEventExpose* ev) for (int note = lnote; note < hnote + 1; ++note) { double y = height - note * note2y; bool draw = false; - + switch (note % 12) { case 1: case 6: @@ -103,7 +103,7 @@ MidiScroomer::on_expose_event(GdkEventExpose* ev) default: break; } - + if(draw) { cc->set_line_width(1.4 * note2y); cc->move_to(0, y); diff --git a/gtk2_ardour/midi_scroomer.h b/gtk2_ardour/midi_scroomer.h index a0021de926..30f77b79e1 100644 --- a/gtk2_ardour/midi_scroomer.h +++ b/gtk2_ardour/midi_scroomer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/midi_selection.h b/gtk2_ardour/midi_selection.h index bd6851870e..de99392127 100644 --- a/gtk2_ardour/midi_selection.h +++ b/gtk2_ardour/midi_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index 09abaeb749..01297abf89 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001-2007 Paul Davis + Copyright (C) 2001-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -75,7 +75,7 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv) midi_underlay_group = new ArdourCanvas::Group (*canvas_group); midi_underlay_group->lower_to_bottom(); - /* put the note lines in the timeaxisview's group, so it + /* put the note lines in the timeaxisview's group, so it can be put below ghost regions from MIDI underlays*/ _note_lines = new ArdourCanvas::LineSet(*canvas_group, ArdourCanvas::LineSet::Horizontal); @@ -91,10 +91,10 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv) _note_lines->lower_to_bottom(); ColorsChanged.connect(mem_fun(*this, &MidiStreamView::draw_note_lines)); - + note_range_adjustment.set_page_size(_highest_note - _lowest_note); note_range_adjustment.set_value(_lowest_note); - + note_range_adjustment.signal_value_changed().connect( mem_fun(*this, &MidiStreamView::note_range_adjustment_changed)); } @@ -109,7 +109,7 @@ veto_note_range(uint8_t& min, uint8_t& max) /* Legal notes, thanks */ clamp_to_0_127(min); clamp_to_0_127(max); - + /* Always display at least one octave in [0, 127] */ if (max == 127) { if (min > (127 - 11)) { @@ -138,11 +138,11 @@ MidiStreamView::create_region_view (boost::shared_ptr<Region> r, bool /*wfd*/, b return 0; } - RegionView* region_view = new MidiRegionView (canvas_group, _trackview, region, + RegionView* region_view = new MidiRegionView (canvas_group, _trackview, region, _samples_per_unit, region_color); - + region_view->init (region_color, false); - + return region_view; } @@ -157,11 +157,11 @@ MidiStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wfd, for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) { if ((*i)->region() == r) { - + /* great. we already have a MidiRegionView for this Region. use it again. */ (*i)->set_valid (true); - + display_region(dynamic_cast<MidiRegionView*>(*i), wfd); return 0; @@ -172,15 +172,15 @@ MidiStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wfd, if (region_view == 0) { return 0; } - + region_views.push_front (region_view); - + /* display events and find note range */ display_region (region_view, wfd); /* catch regionview going away */ region->GoingAway.connect (bind (mem_fun (*this, &MidiStreamView::remove_region_view), region)); - + RegionViewAdded (region_view); return region_view; @@ -216,7 +216,7 @@ MidiStreamView::display_diskstream (boost::shared_ptr<Diskstream> ds) draw_note_lines(); NoteRangeChanged(); } - + void MidiStreamView::update_contents_metrics(boost::shared_ptr<Region> r) { @@ -266,13 +266,13 @@ MidiStreamView::redisplay_diskstream () _data_note_min = 60; _data_note_max = 71; } - + // Extend visible range to show newly recorded data, if necessary _lowest_note = std::min(_lowest_note, _data_note_min); _highest_note = std::max(_highest_note, _data_note_max); - + veto_note_range(_lowest_note, _highest_note); - + // Flag region views as invalid and disable drawing for (i = region_views.begin(); i != region_views.end(); ++i) { (*i)->set_valid(false); @@ -299,7 +299,7 @@ MidiStreamView::update_contents_height () _note_lines->property_y2() = height; draw_note_lines(); } - + void MidiStreamView::draw_note_lines() { @@ -311,7 +311,7 @@ MidiStreamView::draw_note_lines() for (int i = lowest_note(); i <= highest_note(); ++i) { y = floor(note_to_y(i)); - + _note_lines->add_line(prev_y, 1.0, ARDOUR_UI::config()->canvasvar_PianoRollBlackOutline.get()); switch (i % 12) { @@ -359,7 +359,7 @@ MidiStreamView::apply_note_range(uint8_t lowest, uint8_t highest, bool to_region note_range_adjustment.set_page_size(_highest_note - _lowest_note); note_range_adjustment.set_value(_lowest_note); draw_note_lines(); - + if (to_region_views) { for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) { ((MidiRegionView*)(*i))->apply_note_range(lowest, highest); @@ -369,14 +369,14 @@ MidiStreamView::apply_note_range(uint8_t lowest, uint8_t highest, bool to_region NoteRangeChanged(); } -void +void MidiStreamView::update_note_range(uint8_t note_num) { assert(note_num <= 127); _data_note_min = min(_data_note_min, note_num); _data_note_max = max(_data_note_max, note_num); } - + void MidiStreamView::setup_rec_box () { @@ -384,8 +384,8 @@ MidiStreamView::setup_rec_box () if (_trackview.session().transport_rolling()) { - if (!rec_active && - _trackview.session().record_status() == Session::Recording && + if (!rec_active && + _trackview.session().record_status() == Session::Recording && _trackview.get_diskstream()->record_enabled()) { if (use_rec_regions && rec_regions.size() == rec_rects.size()) { @@ -393,7 +393,7 @@ MidiStreamView::setup_rec_box () /* add a new region, but don't bother if they set use_rec_regions mid-record */ MidiRegion::SourceList sources; - + for (list<sigc::connection>::iterator prc = rec_data_ready_connections.begin(); prc != rec_data_ready_connections.end(); ++prc) { (*prc).disconnect(); } @@ -404,28 +404,28 @@ MidiStreamView::setup_rec_box () assert(mds); sources.push_back(mds->write_source()); - - rec_data_ready_connections.push_back (mds->write_source()->ViewDataRangeReady.connect (bind (mem_fun (*this, &MidiStreamView::rec_data_range_ready), boost::weak_ptr<Source>(mds->write_source())))); + + rec_data_ready_connections.push_back (mds->write_source()->ViewDataRangeReady.connect (bind (mem_fun (*this, &MidiStreamView::rec_data_range_ready), boost::weak_ptr<Source>(mds->write_source())))); // handle multi - + jack_nframes_t start = 0; if (rec_regions.size() > 0) { start = rec_regions.back().first->position() + _trackview.get_diskstream()->get_captured_frames(rec_regions.size()-1); } - + boost::shared_ptr<MidiRegion> region (boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (sources, start, 1 , "", 0, Region::DefaultFlags, false))); assert(region); region->block_property_changes (); region->set_position (_trackview.session().transport_frame(), this); rec_regions.push_back (make_pair(region, (RegionView*)0)); - + // rec regions are destroyed in setup_rec_box /* we add the region later */ } - + /* start a new rec box */ boost::shared_ptr<MidiTrack> mt = _trackview.midi_track(); /* we know what it is already */ @@ -436,10 +436,10 @@ MidiStreamView::setup_rec_box () uint32_t fill_color; assert(_trackview.midi_track()->mode() == Normal); - + xend = xstart; fill_color = ARDOUR_UI::config()->canvasvar_RecordingRect.get(); - + ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*canvas_group); rec_rect->property_x1() = xstart; rec_rect->property_y1() = 1.0; @@ -448,16 +448,16 @@ MidiStreamView::setup_rec_box () rec_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RecordingRect.get(); rec_rect->property_fill_color_rgba() = fill_color; rec_rect->lower_to_bottom(); - + RecBoxInfo recbox; recbox.rectangle = rec_rect; recbox.start = _trackview.session().transport_frame(); recbox.length = 0; - + rec_rects.push_back (recbox); - + screen_update_connection.disconnect(); - screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun (*this, &MidiStreamView::update_rec_box)); + screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun (*this, &MidiStreamView::update_rec_box)); rec_updating = true; rec_active = true; @@ -470,7 +470,7 @@ MidiStreamView::setup_rec_box () rec_updating = false; } - + } else { // cerr << "\tNOT rolling, rec_rects = " << rec_rects.size() << " rec_regions = " << rec_regions.size() << endl; @@ -487,12 +487,12 @@ MidiStreamView::setup_rec_box () rec_updating = false; rec_active = false; - + /* remove temp regions */ - + for (list<pair<boost::shared_ptr<Region>,RegionView*> >::iterator iter = rec_regions.begin(); iter != rec_regions.end();) { list<pair<boost::shared_ptr<Region>,RegionView*> >::iterator tmp; - + tmp = iter; ++tmp; @@ -500,7 +500,7 @@ MidiStreamView::setup_rec_box () iter = tmp; } - + rec_regions.clear(); // cerr << "\tclear " << rec_rects.size() << " rec rects\n"; @@ -510,9 +510,9 @@ MidiStreamView::setup_rec_box () RecBoxInfo &rect = (*iter); delete rect.rectangle; } - + rec_rects.clear(); - + } } } @@ -533,34 +533,34 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t tmp = iter; ++tmp; - + boost::shared_ptr<MidiRegion> region = boost::dynamic_pointer_cast<MidiRegion>(iter->first); if (!region || !iter->second) { iter = tmp; continue; } - + if (!canvas_item_visible (rec_rects[n].rectangle)) { /* rect already hidden, this region is done */ iter = tmp; continue; } - + nframes_t origlen = region->length(); - + if (region == rec_regions.back().first && rec_active) { if (start >= region->midi_source(0)->timeline_position()) { - + nframes_t nlen = start + dur - region->position(); if (nlen != region->length()) { - + region->freeze (); region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this); region->set_length (start + dur - region->position(), this); region->thaw ("updated"); - + if (origlen == 1) { /* our special initial length */ iter->second = add_region_view_internal (region, false); @@ -579,7 +579,7 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t // FIXME: slooooooooow! const boost::shared_ptr<MidiRegionView::NoteType> note = data->note_at(i); - + if (note->length() > 0 && note->end_time() + region->position() > start) mrv->resolve_note(note->note(), note->end_time()); @@ -600,13 +600,13 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t mrv->add_note (note, !update_range); } - + mrv->extend_active_notes(); } } } else { - + nframes_t nlen = _trackview.get_diskstream()->get_captured_frames(n); if (nlen != region->length()) { @@ -617,12 +617,12 @@ MidiStreamView::update_rec_regions (boost::shared_ptr<MidiModel> data, nframes_t region->set_position (_trackview.get_diskstream()->get_capture_start_frame(n), this); region->set_length (nlen, this); region->thaw ("updated"); - + if (origlen == 1) { /* our special initial length */ iter->second = add_region_view_internal (region, false); } - + /* also hide rect */ ArdourCanvas::Item * rect = rec_rects[n].rectangle; rect->hide(); @@ -643,11 +643,11 @@ void MidiStreamView::rec_data_range_ready (jack_nframes_t start, jack_nframes_t dur, boost::weak_ptr<Source> weak_src) { // this is called from the butler thread for now - + ENSURE_GUI_THREAD(bind (mem_fun (*this, &MidiStreamView::rec_data_range_ready), start, dur, weak_src)); - + boost::shared_ptr<SMFSource> src (boost::dynamic_pointer_cast<SMFSource>(weak_src.lock())); - + this->update_rec_regions (src->model(), start, dur); } @@ -657,7 +657,7 @@ MidiStreamView::color_handler () //case cMidiTrackBase: if (_trackview.is_midi_track()) { //canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MidiTrackBase.get(); - } + } //case cMidiBusBase: if (!_trackview.is_midi_track()) { diff --git a/gtk2_ardour/midi_streamview.h b/gtk2_ardour/midi_streamview.h index 2b7a7b02fa..87fc003283 100644 --- a/gtk2_ardour/midi_streamview.h +++ b/gtk2_ardour/midi_streamview.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001, 2006 Paul Davis + Copyright (C) 2001, 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -73,29 +73,29 @@ class MidiStreamView : public StreamView inline uint8_t lowest_note() const { return _lowest_note; } inline uint8_t highest_note() const { return _highest_note; } - + void update_note_range(uint8_t note_num); - + void redisplay_diskstream (); - + inline double contents_height() const { return (_trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2); } - + inline double note_to_y(uint8_t note) const { return contents_height() - (note + 1 - lowest_note()) * note_height() + 1; } - + inline uint8_t y_to_note(double y) const { return (uint8_t)((contents_height() - y - 1) / contents_height() * (double)contents_note_range()) + lowest_note(); } - + inline double note_height() const { return contents_height() / (double)contents_note_range(); } - + inline uint8_t contents_note_range() const { return highest_note() - lowest_note() + 1; } - + sigc::signal<void> NoteRangeChanged; RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool); @@ -106,13 +106,13 @@ class MidiStreamView : public StreamView void rec_data_range_ready ( jack_nframes_t start, jack_nframes_t dur, - boost::weak_ptr<ARDOUR::Source> src); + boost::weak_ptr<ARDOUR::Source> src); void update_rec_regions ( boost::shared_ptr<ARDOUR::MidiModel> data, jack_nframes_t start, jack_nframes_t dur); - + RegionView* add_region_view_internal ( boost::shared_ptr<ARDOUR::Region>, bool wait_for_waves, @@ -120,7 +120,7 @@ class MidiStreamView : public StreamView void display_region(MidiRegionView* region_view, bool load_model); void display_diskstream (boost::shared_ptr<ARDOUR::Diskstream> ds); - + void update_contents_height (); void draw_note_lines(); void apply_note_range(uint8_t lowest, uint8_t highest, bool to_region_views); diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index b281ba0529..8460b6ab37 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -89,7 +89,7 @@ using namespace PBD; using namespace Gtk; using namespace sigc; using namespace Editing; - + // Minimum height at which a control is displayed static const uint32_t MIDI_CONTROLS_BOX_MIN_HEIGHT = 162; static const uint32_t KEYBOARD_MIN_HEIGHT = 140; @@ -98,7 +98,7 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas) : AxisView(sess) // virtually inherited , RouteTimeAxisView(ed, sess, rt, canvas) - , _ignore_signals(false) + , _ignore_signals(false) , _range_scroomer(0) , _piano_roll_header(0) , _note_mode(Sustained) @@ -122,7 +122,7 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, solo_button->set_active (false); step_edit_insert_position = 0; - + if (is_midi_track()) { controls_ebox.set_name ("MidiTimeAxisViewControlsBaseUnselected"); _note_mode = midi_track()->note_mode(); @@ -137,7 +137,7 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, ensure_xml_node (); set_state (*xml_node); - + _route->processors_changed.connect (mem_fun(*this, &MidiTimeAxisView::processors_changed)); if (is_track()) { @@ -157,21 +157,21 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, _view->RegionViewAdded.connect (mem_fun(*this, &MidiTimeAxisView::region_view_added)); _view->attach (); } - + HBox* midi_controls_hbox = manage(new HBox()); - + MIDI::Name::MidiPatchManager& patch_manager = MIDI::Name::MidiPatchManager::instance(); MIDI::Name::MasterDeviceNames::Models::const_iterator m = patch_manager.all_models().begin(); for (; m != patch_manager.all_models().end(); ++m) { _model_selector.append_text(m->c_str()); } - + _model_selector.signal_changed().connect(mem_fun(*this, &MidiTimeAxisView::model_changed)); - + _custom_device_mode_selector.signal_changed().connect( mem_fun(*this, &MidiTimeAxisView::custom_device_mode_changed)); - + // TODO: persist the choice // this initializes the comboboxes and sends out the signal _model_selector.set_active(0); @@ -181,11 +181,11 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, _midi_controls_box.pack_start(_model_selector, true, false); _midi_controls_box.pack_start(_custom_device_mode_selector, true, false); } - + _midi_controls_box.pack_start(*midi_controls_hbox, true, true); - + controls_vbox.pack_start(_midi_controls_box, false, false); - + boost::shared_ptr<MidiDiskstream> diskstream = midi_track()->midi_diskstream(); // restore channel selector settings @@ -223,9 +223,9 @@ void MidiTimeAxisView::model_changed() { std::list<std::string> device_modes = MIDI::Name::MidiPatchManager::instance() .custom_device_mode_names_by_model(_model_selector.get_active_text()); - + _custom_device_mode_selector.clear_items(); - + for (std::list<std::string>::const_iterator i = device_modes.begin(); i != device_modes.end(); ++i) { cerr << "found custom device mode " << *i << " thread_id: " << pthread_self() << endl; @@ -238,7 +238,7 @@ void MidiTimeAxisView::model_changed() void MidiTimeAxisView::custom_device_mode_changed() { _midi_patch_settings_changed.emit(_model_selector.get_active_text(), - _custom_device_mode_selector.get_active_text()); + _custom_device_mode_selector.get_active_text()); } MidiStreamView* @@ -252,7 +252,7 @@ MidiTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent) { ensure_xml_node (); xml_node->add_property ("shown-editor", "yes"); - + guint32 ret = TimeAxisView::show_at (y, nth, parent); return ret; } @@ -276,7 +276,7 @@ MidiTimeAxisView::set_height (uint32_t h) } else { _midi_controls_box.hide(); } - + if (height >= KEYBOARD_MIN_HEIGHT) { if (is_track() && _range_scroomer) _range_scroomer->show(); @@ -301,11 +301,11 @@ MidiTimeAxisView::append_extra_display_menu_items () Menu *range_menu = manage(new Menu); MenuList& range_items = range_menu->items(); range_menu->set_name ("ArdourContextMenu"); - + range_items.push_back (MenuElem (_("Show Full Range"), bind ( mem_fun(*this, &MidiTimeAxisView::set_note_range), MidiStreamView::FullRange))); - + range_items.push_back (MenuElem (_("Fit Contents"), bind ( mem_fun(*this, &MidiTimeAxisView::set_note_range), MidiStreamView::ContentsRange))); @@ -322,20 +322,20 @@ Gtk::Menu* MidiTimeAxisView::build_def_channel_menu () { using namespace Menu_Helpers; - + if (default_channel_menu == 0) { default_channel_menu = manage (new Menu ()); - } - + } + uint8_t defchn = midi_track()->default_channel(); MenuList& def_channel_items = default_channel_menu->items(); RadioMenuItem* item; RadioMenuItem::Group dc_group; - + for (int i = 0; i < 16; ++i) { char buf[4]; snprintf (buf, sizeof (buf), "%d", i+1); - + def_channel_items.push_back (RadioMenuElem (dc_group, buf, bind (mem_fun (*this, &MidiTimeAxisView::set_default_channel), i))); item = dynamic_cast<RadioMenuItem*>(&def_channel_items.back()); @@ -372,17 +372,17 @@ MidiTimeAxisView::build_automation_action_menu () RouteTimeAxisView::build_automation_action_menu (); MenuList& automation_items = automation_action_menu->items(); - + automation_items.push_back (SeparatorElem()); - automation_items.push_back (MenuElem (_("Controller..."), + automation_items.push_back (MenuElem (_("Controller..."), mem_fun(*this, &MidiTimeAxisView::add_cc_track))); - automation_items.push_back (MenuElem (_("Program Change"), + automation_items.push_back (MenuElem (_("Program Change"), sigc::bind(mem_fun(*this, &MidiTimeAxisView::add_parameter_track), - Evoral::Parameter(MidiPgmChangeAutomation)))); - automation_items.push_back (MenuElem (_("Bender"), + Evoral::Parameter(MidiPgmChangeAutomation)))); + automation_items.push_back (MenuElem (_("Bender"), sigc::bind(mem_fun(*this, &MidiTimeAxisView::add_parameter_track), Evoral::Parameter(MidiPitchBenderAutomation)))); - automation_items.push_back (MenuElem (_("Pressure"), + automation_items.push_back (MenuElem (_("Pressure"), sigc::bind(mem_fun(*this, &MidiTimeAxisView::add_parameter_track), Evoral::Parameter(MidiChannelPressureAutomation)))); } @@ -429,15 +429,15 @@ MidiTimeAxisView::build_color_mode_menu() bind (mem_fun (*this, &MidiTimeAxisView::set_color_mode), ChannelColors))); _channel_color_mode_item = dynamic_cast<RadioMenuItem*>(&items.back()); _channel_color_mode_item->set_active(_color_mode == ChannelColors); - + items.push_back (RadioMenuElem (mode_group, _("Track Color"), bind (mem_fun (*this, &MidiTimeAxisView::set_color_mode), TrackColor))); _channel_color_mode_item = dynamic_cast<RadioMenuItem*>(&items.back()); _channel_color_mode_item->set_active(_color_mode == TrackColor); - + return mode_menu; } - + void MidiTimeAxisView::set_note_mode(NoteMode mode) { @@ -527,7 +527,7 @@ MidiTimeAxisView::add_cc_track() AddMidiCCTrackDialog dialog; dialog.set_transient_for (_editor); response = dialog.run(); - + if (response == Gtk::RESPONSE_ACCEPT) param = dialog.parameter(); } @@ -546,11 +546,11 @@ MidiTimeAxisView::add_parameter_track(const Evoral::Parameter& param) error << "MidiTimeAxisView: unknown automation child " << ARDOUR::EventTypeMap::instance().to_symbol(param) << endmsg; return; - } + } // create the parameter lane for each selected channel uint16_t selected_channels = _channel_selector.get_selected_channels(); - + for (uint8_t i = 0; i < 16; i++) { if (selected_channels & (0x0001 << i)) { Evoral::Parameter param_with_channel(param.type(), i, param.id()); @@ -575,7 +575,7 @@ MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool return; boost::shared_ptr<AutomationControl> c = _route->get_control (param); - + assert(c); boost::shared_ptr<AutomationTimeAxisView> track(new AutomationTimeAxisView (_session, @@ -585,7 +585,7 @@ MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool true, parent_canvas, _route->describe_parameter(param))); - + add_automation_child(param, track, show); } @@ -608,7 +608,7 @@ MidiTimeAxisView::route_active_changed () } else { throw; // wha? - + if (_route->active()) { controls_ebox.set_name ("BusControlsBaseUnselected"); controls_base_selected_name = "BusControlsBaseSelected"; @@ -660,7 +660,7 @@ MidiTimeAxisView::check_step_edit () uint32_t size; incoming.read_prefix (&time, &type, &size); - + if (size > bufsize) { delete [] buf; bufsize = size; @@ -668,7 +668,7 @@ MidiTimeAxisView::check_step_edit () } incoming.read_contents (size, buf); - + if ((buf[0] & 0xf0) == MIDI_CMD_NOTE_ON) { if (step_edit_region == 0) { @@ -682,22 +682,22 @@ MidiTimeAxisView::check_step_edit () fatal << X_("programming error: no view found for new MIDI region") << endmsg; /*NOTREACHED*/ } - } + } if (step_edit_region_view) { bool success; Evoral::MusicalTime beats = _editor.get_grid_type_as_beats (success, step_edit_insert_position); - + if (!success) { continue; } - + step_edit_region_view->add_note (buf[0] & 0xf, buf[1], buf[2], step_edit_beat_pos, beats); step_edit_beat_pos += beats; } } - + } } @@ -716,7 +716,7 @@ MidiTimeAxisView::add_region (nframes64_t pos) real_editor->begin_reversible_command (_("create region")); XMLNode &before = playlist()->get_state(); - + nframes64_t start = pos; real_editor->snap_to (start, -1); const Meter& m = _session.tempo_map().meter_at(start); @@ -725,10 +725,10 @@ MidiTimeAxisView::add_region (nframes64_t pos) const boost::shared_ptr<MidiDiskstream> diskstream = boost::dynamic_pointer_cast<MidiDiskstream>(view()->trackview().track()->diskstream()); - + boost::shared_ptr<Source> src = _session.create_midi_source_for_session (*diskstream.get()); - - boost::shared_ptr<Region> region = (RegionFactory::create (src, 0, (nframes_t) length, + + boost::shared_ptr<Region> region = (RegionFactory::create (src, 0, (nframes_t) length, PBD::basename_nosuffix(src->name()))); playlist()->add_region (region, start); @@ -738,4 +738,4 @@ MidiTimeAxisView::add_region (nframes64_t pos) real_editor->commit_reversible_command(); return region; -} +} diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index d71c156f48..85dcd2b9ea 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -79,15 +79,15 @@ class MidiTimeAxisView : public RouteTimeAxisView ARDOUR::ColorMode color_mode() const { return _color_mode; } void update_range(); - - sigc::signal<void, ARDOUR::ChannelMode, uint16_t>& signal_channel_mode_changed() { - return _channel_selector.mode_changed; + + sigc::signal<void, ARDOUR::ChannelMode, uint16_t>& signal_channel_mode_changed() { + return _channel_selector.mode_changed; } - + sigc::signal<void, std::string, std::string>& signal_midi_patch_settings_changed() { return _midi_patch_settings_changed; } - + void start_step_editing (); void stop_step_editing (); void check_step_edit (); @@ -95,10 +95,10 @@ class MidiTimeAxisView : public RouteTimeAxisView private: sigc::signal<void, std::string, std::string> _midi_patch_settings_changed; - + void model_changed(); void custom_device_mode_changed(); - + void append_extra_display_menu_items (); void build_automation_action_menu (); Gtk::Menu* build_note_mode_menu(); @@ -111,7 +111,7 @@ class MidiTimeAxisView : public RouteTimeAxisView void route_active_changed (); void add_insert_to_subplugin_menu (ARDOUR::Processor *); - + bool _ignore_signals; Gtk::Menu _subplugin_menu; MidiScroomer* _range_scroomer; diff --git a/gtk2_ardour/midi_util.h b/gtk2_ardour/midi_util.h index 0dedbc14ce..2c158b1767 100644 --- a/gtk2_ardour/midi_util.h +++ b/gtk2_ardour/midi_util.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -26,7 +26,7 @@ inline static void clamp_to_0_127(uint8_t &val) val = 127; } else if ((192 <= val) && (val < 255)) { val = 0; - } + } } #endif /* __gtk_ardour_midi_util_h__ */ diff --git a/gtk2_ardour/mixer_group_tabs.cc b/gtk2_ardour/mixer_group_tabs.cc index aaaefae17d..f466381d2b 100644 --- a/gtk2_ardour/mixer_group_tabs.cc +++ b/gtk2_ardour/mixer_group_tabs.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ MixerGroupTabs::MixerGroupTabs (Mixer_UI* m) _mixer (m), _menu (0) { - + } @@ -43,7 +43,7 @@ list<GroupTabs::Tab> MixerGroupTabs::compute_tabs () const { list<Tab> tabs; - + Tab tab; tab.from = 0; tab.group = 0; @@ -94,7 +94,7 @@ MixerGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const } else { cairo_set_source_rgba (cr, 1, 1, 1, 0.2); } - + cairo_arc (cr, tab.from + arc_radius, _height, arc_radius, M_PI, 3 * M_PI / 2); cairo_line_to (cr, tab.to - arc_radius, 0); cairo_arc (cr, tab.to - arc_radius, _height, arc_radius, 3 * M_PI / 2, 2 * M_PI); @@ -123,37 +123,37 @@ void MixerGroupTabs::reflect_tabs (list<Tab> const & tabs) { list<Tab>::const_iterator j = tabs.begin (); - + int32_t x = 0; TreeModel::Children rows = _mixer->track_model->children (); for (TreeModel::Children::iterator i = rows.begin(); i != rows.end(); ++i) { MixerStrip* s = (*i)[_mixer->track_columns.strip]; - + if (s->route()->is_master() || s->route()->is_control() || !s->marked_for_display()) { continue; } - + if (j == tabs.end()) { - + /* already run out of tabs, so no edit group */ s->route()->set_route_group (0, this); - + } else { - + if (x >= j->to) { /* this tab finishes before this track starts, so onto the next tab */ ++j; } - + double const h = x + s->get_width() / 2; - + if (j->from < h && j->to > h) { s->route()->set_route_group (j->group, this); } else { s->route()->set_route_group (0, this); } - + } x += s->get_width (); @@ -166,12 +166,12 @@ MixerGroupTabs::get_menu (RouteGroup* g) if (g == 0) { return 0; } - + using namespace Menu_Helpers; - + delete _menu; _menu = new Menu; - + MenuList& items = _menu->items (); items.push_back (MenuElem (_("Edit..."), bind (mem_fun (*this, &MixerGroupTabs::edit_group), g))); items.push_back (MenuElem (_("Subgroup"), bind (mem_fun (*this, &MixerGroupTabs::make_subgroup), g))); diff --git a/gtk2_ardour/mixer_group_tabs.h b/gtk2_ardour/mixer_group_tabs.h index 6f92c834e8..eb604e3c92 100644 --- a/gtk2_ardour/mixer_group_tabs.h +++ b/gtk2_ardour/mixer_group_tabs.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 4b3cb3649f..17761798c2 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -86,15 +86,15 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer) , bottom_button_table (1, 2) , meter_point_label (_("pre")) , comment_button (_("Comments")) - + { init (); - + if (!_mixer_owned) { /* the editor mixer strip: don't destroy it every time the underlying route goes away. */ - + self_destruct = false; } } @@ -112,7 +112,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt , bottom_button_table (1, 2) , meter_point_label (_("pre")) , comment_button (_("Comments")) - + { init (); set_button_names (); @@ -164,14 +164,14 @@ MixerStrip::init () meter_point_button.add (meter_point_label); meter_point_button.set_name ("MixerStripMeterPreButton"); meter_point_label.set_name ("MixerStripMeterPreButton"); - + /* TRANSLATORS: this string should be longest of the strings used to describe meter points. In english, it's "input". */ set_size_request_to_display_given_text (meter_point_button, _("tupni"), 5, 5); - + bottom_button_table.attach (meter_point_button, 1, 2, 0, 1); - + meter_point_button.signal_button_press_event().connect (mem_fun (gpm, &GainMeter::meter_press), false); meter_point_button.signal_button_release_event().connect (mem_fun (gpm, &GainMeter::meter_release), false); @@ -194,7 +194,7 @@ MixerStrip::init () bottom_button_table.set_col_spacings (0); bottom_button_table.set_homogeneous (true); bottom_button_table.attach (group_button, 0, 1, 0, 1); - + name_button.add (name_label); name_button.set_name ("MixerNameButton"); Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2); @@ -208,7 +208,7 @@ MixerStrip::init () comment_button.set_name ("MixerCommentButton"); comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked)); - + global_vpacker.set_border_width (0); global_vpacker.set_spacing (0); @@ -302,7 +302,7 @@ MixerStrip::init () Gdk::KEY_RELEASE_MASK); set_flags (get_flags() | Gtk::CAN_FOCUS); - + SwitchIO.connect (mem_fun (*this, &MixerStrip::switch_io)); } @@ -350,7 +350,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) } if (_mixer_owned && (route()->is_master() || route()->is_control())) { - + if (scrollbar_height == 0) { HScrollbar scrollbar; Gtk::Requisition requisition(scrollbar.size_request ()); @@ -391,11 +391,11 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) case MeterInput: meter_point_label.set_text (_("input")); break; - + case MeterPreFader: meter_point_label.set_text (_("pre")); break; - + case MeterPostFader: meter_point_label.set_text (_("post")); break; @@ -403,7 +403,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) delete route_ops_menu; route_ops_menu = 0; - + ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment().empty() ? _("Click to Add/Edit Comments"): _route->comment()); @@ -532,7 +532,7 @@ MixerStrip::set_width_enum (Width w, void* owner) _width_owner = owner; ensure_xml_node (); - + _width = w; if (_width_owner == this) { @@ -588,7 +588,7 @@ MixerStrip::set_width_enum (Width w, void* owner) gpm.short_astyle_string(gain_automation->automation_style())); ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text ( gpm.short_astate_string(gain_automation->automation_state())); - + if (_route->panner()) { ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text ( panners.short_astyle_string(_route->panner()->automation_style())); @@ -638,12 +638,12 @@ MixerStrip::output_press (GdkEventButton *ev) case 1: edit_output_configuration (); break; - + case 3: { output_menu.set_name ("ArdourContextMenu"); citems.clear(); - + citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output))); citems.push_back (SeparatorElem()); @@ -679,7 +679,7 @@ MixerStrip::edit_output_configuration () { if (output_selector == 0) { output_selector = new IOSelectorWindow (_session, _route->output()); - } + } if (output_selector->is_visible()) { output_selector->get_toplevel()->get_window()->raise(); @@ -693,7 +693,7 @@ MixerStrip::edit_input_configuration () { if (input_selector == 0) { input_selector = new IOSelectorWindow (_session, _route->input()); - } + } if (input_selector->is_visible()) { input_selector->get_toplevel()->get_window()->raise(); @@ -710,7 +710,7 @@ MixerStrip::input_press (GdkEventButton *ev) MenuList& citems = input_menu.items(); input_menu.set_name ("ArdourContextMenu"); citems.clear(); - + if (!_session.engine().connected()) { MessageDialog msg (_("Not connected to JACK - no I/O changes are possible")); msg.run (); @@ -794,17 +794,17 @@ MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR: if (b->ports_are_outputs() == false || route()->input()->default_type() != b->type() || b->nchannels() != _route->n_inputs().get (b->type ())) { - + return; } MenuList& citems = input_menu.items(); - + std::string n = b->name (); replace_all (n, "_", " "); - + citems.push_back (CheckMenuElem (n, bind (mem_fun(*this, &MixerStrip::bundle_input_toggled), b))); - + if (std::find (current.begin(), current.end(), b) != current.end()) { ignore_toggle = true; dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true); @@ -820,17 +820,17 @@ MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR if (b->ports_are_inputs() == false || route()->output()->default_type() != b->type() || b->nchannels() != _route->n_outputs().get (b->type ())) { - + return; } MenuList& citems = output_menu.items(); - + std::string n = b->name (); replace_all (n, "_", " "); - + citems.push_back (CheckMenuElem (n, bind (mem_fun(*this, &MixerStrip::bundle_output_toggled), b))); - + if (std::find (current.begin(), current.end(), b) != current.end()) { ignore_toggle = true; dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true); @@ -883,7 +883,7 @@ MixerStrip::connect_to_pan () /* * Output port labelling * ===================== - * + * * Case 1: Each output has one connection, all connections are to system:playback_%i * out 1 -> system:playback_1 * out 2 -> system:playback_2 @@ -894,7 +894,7 @@ MixerStrip::connect_to_pan () * out 1 -> ardour:track_x/in 1 * out 2 -> ardour:track_x/in 2 * Display as: track_x - * + * * Case 3: Each output has one connection, all connections are to Jack client "program x" * out 1 -> program x:foo * out 2 -> program x:foo @@ -902,7 +902,7 @@ MixerStrip::connect_to_pan () * * Case 4: No connections (Disconnected) * Display as: - - * + * * Default case (unusual routing): * Display as: *number of connections* * @@ -926,13 +926,13 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt uint32_t io_index; Port *port; vector<string> connections; - + uint32_t total_connection_count = 0; uint32_t io_connection_count = 0; uint32_t ardour_connection_count = 0; uint32_t system_connection_count = 0; uint32_t other_connection_count = 0; - + ostringstream label; string label_string; char * label_cstr; @@ -945,25 +945,25 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt string other_connection_type; string system_ports; string system_port; - + ostringstream tooltip; char * tooltip_cstr; - + tooltip << route->name(); if (for_input) { io_count = route->n_inputs().n_total(); } else { io_count = route->n_outputs().n_total(); - } - + } + for (io_index = 0; io_index < io_count; ++io_index) { if (for_input) { port = route->input()->nth (io_index); } else { port = route->output()->nth (io_index); } - + port->get_connections(connections); io_connection_count = 0; @@ -976,7 +976,7 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt } else { tooltip << ", " << connection_name; } - + if (connection_name.find("ardour:") == 0) { if (ardour_track_name.empty()) { // "ardour:Master/in 1" -> "ardour:Master/" @@ -985,7 +985,7 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt ardour_track_name = connection_name.substr(0, slash + 1); } } - + if (connection_name.find(ardour_track_name) == 0) { ++ardour_connection_count; } @@ -997,48 +997,48 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt // "system:playback_123" -> "123" system_port = connection_name.substr(16); } - + if (system_ports.empty()) { system_ports += system_port; } else { system_ports += "/" + system_port; } - + ++system_connection_count; } else { if (other_connection_type.empty()) { // "jamin:in 1" -> "jamin:" other_connection_type = connection_name.substr(0, connection_name.find(":") + 1); } - + if (connection_name.find(other_connection_type) == 0) { ++other_connection_count; } } - + ++total_connection_count; ++io_connection_count; } - } - + } + if (io_connection_count != 1) { each_io_has_one_connection = false; } } - + if (total_connection_count == 0) { tooltip << endl << _("Disconnected"); } - + tooltip_cstr = new char[tooltip.str().size() + 1]; strcpy(tooltip_cstr, tooltip.str().c_str()); - + if (for_input) { ARDOUR_UI::instance()->set_tip (&input_button, tooltip_cstr, ""); } else { ARDOUR_UI::instance()->set_tip (&output_button, tooltip_cstr, ""); - } - + } + if (each_io_has_one_connection) { if ((total_connection_count == ardour_connection_count)) { // all connections are to the same track in ardour @@ -1061,7 +1061,7 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt have_label = true; } } - + if (!have_label) { if (total_connection_count == 0) { // Disconnected @@ -1071,7 +1071,7 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt label << "*" << total_connection_count << "*"; } } - + switch (width) { case Wide: label_string = label.str().substr(0, 6); @@ -1080,10 +1080,10 @@ MixerStrip::update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width widt label_string = label.str().substr(0, 3); break; } - + label_cstr = new char[label_string.size() + 1]; strcpy(label_cstr, label_string.c_str()); - + if (for_input) { input_label.set_text (label_cstr); } else { @@ -1116,7 +1116,7 @@ void MixerStrip::diskstream_changed () { Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_diskstream_display)); -} +} void MixerStrip::input_changed (IOChange /*change*/, void */*src*/) @@ -1133,15 +1133,15 @@ MixerStrip::output_changed (IOChange /*change*/, void */*src*/) } -void -MixerStrip::comment_editor_done_editing() +void +MixerStrip::comment_editor_done_editing() { string str = comment_area->get_buffer()->get_text(); if (_route->comment() != str) { _route->set_comment (str, this); switch (_width) { - + case Wide: if (! str.empty()) { comment_button.modify_bg (STATE_NORMAL, color()); @@ -1151,7 +1151,7 @@ MixerStrip::comment_editor_done_editing() ((Gtk::Label*)comment_button.get_child())->set_text (_("Comments")); } break; - + case Narrow: if (! str.empty()) { comment_button.modify_bg (STATE_NORMAL, color()); @@ -1159,11 +1159,11 @@ MixerStrip::comment_editor_done_editing() } else { comment_button.unset_bg (STATE_NORMAL); ((Gtk::Label*)comment_button.get_child())->set_text (_("Cmt")); - } + } break; } - - ARDOUR_UI::instance()->tooltips().set_tip (comment_button, + + ARDOUR_UI::instance()->tooltips().set_tip (comment_button, str.empty() ? _("Click to Add/Edit Comments") : str); } @@ -1186,8 +1186,8 @@ MixerStrip::comment_button_clicked () comment_window->get_size (cw_width, cw_height); comment_window->get_position(x, y); comment_window->move(x, y - (cw_height / 2) - 45); - /* - half the dialog height minus the comments button height + /* + half the dialog height minus the comments button height with some window decoration fudge thrown in. */ @@ -1223,7 +1223,7 @@ void MixerStrip::comment_changed (void *src) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::comment_changed), src)); - + if (src != this) { ignore_comment_edit = true; if (comment_area) { @@ -1247,26 +1247,26 @@ MixerStrip::select_route_group (GdkEventButton *ev) if (ev->button == 1) { if (group_menu == 0) { - + group_menu = new RouteGroupMenu ( _session, (RouteGroup::Property) (RouteGroup::Gain | RouteGroup::Mute | RouteGroup::Solo) ); - + group_menu->GroupSelected.connect (mem_fun (*this, &MixerStrip::set_route_group)); } group_menu->popup (1, ev->time); } - + return true; -} +} void MixerStrip::route_group_changed (void *ignored) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_group_changed), ignored)); - + RouteGroup *rg = _route->route_group(); if (rg) { @@ -1289,11 +1289,11 @@ MixerStrip::route_group_changed (void *ignored) } -void +void MixerStrip::route_gui_changed (string what_changed, void* ignored) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::route_gui_changed), what_changed, ignored)); - + if (what_changed == "color") { if (set_color_from_route () == 0) { show_route_color (); @@ -1422,13 +1422,13 @@ MixerStrip::hide_clicked () { // LAME fix to reset the button status for when it is redisplayed (part 1) hide_button.set_sensitive(false); - + if (_embedded) { Hiding(); /* EMIT_SIGNAL */ } else { _mixer.hide_strip (this); } - + // (part 2) hide_button.set_sensitive(true); } @@ -1457,7 +1457,7 @@ MixerStrip::map_frozen () break; } } - + hide_redirect_editors (); } @@ -1474,9 +1474,9 @@ MixerStrip::hide_processor_editor (boost::weak_ptr<Processor> p) if (!processor) { return; } - + void* gui = processor->get_gui (); - + if (gui) { static_cast<Gtk::Widget*>(gui)->hide (); } @@ -1514,7 +1514,7 @@ MixerStrip::route_active_changed () gpm.set_meter_strip_name ("AudioBusMetricsInactive"); } gpm.set_fader_name ("AudioBusFader"); - + /* (no MIDI busses yet) */ } } @@ -1548,7 +1548,7 @@ MixerStrip::meter_changed (void *src) case MeterPreFader: meter_point_label.set_text (_("pre")); break; - + case MeterPostFader: meter_point_label.set_text (_("post")); break; @@ -1580,16 +1580,16 @@ MixerStrip::switch_io (boost::shared_ptr<Route> target) revert_to_default_display (); return; } - + boost::shared_ptr<Send> send; if (_current_delivery && (send = boost::dynamic_pointer_cast<Send>(_current_delivery))) { send->set_metering (false); } - + _current_delivery = _route->internal_send_for (target); - cerr << "internal send from " << _route->name() << " to " << target->name() << " = " + cerr << "internal send from " << _route->name() << " to " << target->name() << " = " << _current_delivery << endl; if (_current_delivery) { @@ -1604,7 +1604,7 @@ MixerStrip::switch_io (boost::shared_ptr<Route> target) gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->amp()); panner_ui().set_panner (_route->main_outs()->panner()); } - + gain_meter().setup_meters (); panner_ui().setup_pan (); } @@ -1614,13 +1614,13 @@ void MixerStrip::revert_to_default_display () { show_sends_button->set_active (false); - + boost::shared_ptr<Send> send; if (_current_delivery && (send = boost::dynamic_pointer_cast<Send>(_current_delivery))) { send->set_metering (false); } - + _current_delivery = _route->main_outs(); gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->amp()); @@ -1666,7 +1666,7 @@ MixerStrip::set_button_names () } } break; - + } } @@ -1683,22 +1683,22 @@ MixerStrip::on_key_press_event (GdkEventKey* ev) mute_press (&fake); return true; break; - + case GDK_s: solo_press (&fake); return true; break; - + case GDK_r: rec_enable_press (&fake); return true; break; - + case GDK_e: show_sends_press (&fake); return true; - break; - + break; + case GDK_g: if (ev->state & Keyboard::PrimaryModifier) { step_gain_down (); @@ -1713,7 +1713,7 @@ MixerStrip::on_key_press_event (GdkEventKey* ev) _route->set_gain (1.0, this); } return true; - + default: break; } @@ -1735,26 +1735,26 @@ MixerStrip::on_key_release_event (GdkEventKey* ev) mute_release (&fake); return true; break; - + case GDK_s: solo_release (&fake); return true; break; - + case GDK_r: rec_enable_release (&fake); return true; break; - + case GDK_e: show_sends_release (&fake); return true; - break; - + break; + case GDK_g: return true; break; - + default: break; } diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index d1ab3c398e..afacd4a328 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -92,7 +92,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void fast_update (); void set_embedded (bool); - + ARDOUR::RouteGroup* route_group() const; void set_route (boost::shared_ptr<ARDOUR::Route>); void set_button_names (); @@ -142,7 +142,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox ProcessorBox processor_box; GainMeter gpm; PannerUI panners; - + Gtk::Table button_table; Gtk::Table middle_button_table; Gtk::Table bottom_button_table; @@ -163,10 +163,10 @@ class MixerStrip : public RouteUI, public Gtk::EventBox Gtk::Label output_label; sigc::connection newplug_connection; - + gint mark_update_safe (); guint32 mode_switch_in_progress; - + Gtk::Button name_button; ArdourDialog* comment_window; @@ -189,7 +189,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox Gtk::Menu output_menu; void maybe_add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &); - + void bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle>); void bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle>); @@ -259,7 +259,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void revert_to_default_display (); static int scrollbar_height; - + void update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width width, bool input_button); }; diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index aa4c4119c6..51578ad2b4 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2004 Paul Davis + Copyright (C) 2000-2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -199,16 +199,16 @@ Mixer_UI::Mixer_UI () list_hpane.add1(list_vpacker); list_hpane.add2(global_hpacker); - rhs_pane1.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler), + rhs_pane1.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler), static_cast<Gtk::Paned*> (&rhs_pane1))); - list_hpane.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler), + list_hpane.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler), static_cast<Gtk::Paned*> (&list_hpane))); - + global_vpacker.pack_start (list_hpane, true, true); add (global_vpacker); set_name ("MixerWindow"); - + WindowTitle title(Glib::get_application_name()); title += _("Mixer"); set_title (title.get_string()); @@ -273,10 +273,10 @@ Mixer_UI::show_window () /* now reset each strips width so the right widgets are shown */ MixerStrip* ms; - + TreeModel::Children rows = track_model->children(); TreeModel::Children::iterator ri; - + for (ri = rows.begin(); ri != rows.end(); ++ri) { ms = (*ri)[track_columns.strip]; ms->set_width_enum (ms->get_width_enum (), ms->width_owner()); @@ -299,7 +299,7 @@ void Mixer_UI::add_strip (RouteList& routes) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::add_strip), routes)); - + MixerStrip* strip; no_track_list_redisplay = true; @@ -314,7 +314,7 @@ Mixer_UI::add_strip (RouteList& routes) strip = new MixerStrip (*this, *session, route); strips.push_back (strip); - + Config->get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide; if (strip->width_owner() != strip) { @@ -322,7 +322,7 @@ Mixer_UI::add_strip (RouteList& routes) } show_strip (strip); - + TreeModel::Row row = *(track_model->append()); row[track_columns.text] = route->name(); row[track_columns.visible] = strip->marked_for_display(); @@ -332,7 +332,7 @@ Mixer_UI::add_strip (RouteList& routes) if (route->order_key (N_("signal")) == -1) { route->set_order_key (N_("signal"), track_model->children().size()-1); } - + route->NameChanged.connect (bind (mem_fun(*this, &Mixer_UI::strip_name_changed), strip)); strip->GoingAway.connect (bind (mem_fun(*this, &Mixer_UI::remove_strip), strip)); @@ -343,7 +343,7 @@ Mixer_UI::add_strip (RouteList& routes) no_track_list_redisplay = false; redisplay_track_list (); - + strip_redisplay_does_not_sync_order_keys = false; } @@ -427,7 +427,7 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) editing. XXX it needs improving so that we don't select the strip at the same time. */ - + if (_selection.selected (strip->route())) { _selection.remove (strip->route()); } else { @@ -465,7 +465,7 @@ Mixer_UI::connect_to_session (Session* sess) session->config.ParameterChanged.connect (mem_fun (*this, &Mixer_UI::parameter_changed)); route_groups_changed (); - + _plugin_selector->set_session (session); if (_visible) { @@ -481,14 +481,14 @@ void Mixer_UI::disconnect_from_session () { ENSURE_GUI_THREAD(mem_fun(*this, &Mixer_UI::disconnect_from_session)); - + group_model->clear (); _selection.clear (); WindowTitle title(Glib::get_application_name()); title += _("Mixer"); set_title (title.get_string()); - + stop_updating (); } @@ -497,9 +497,9 @@ Mixer_UI::show_strip (MixerStrip* ms) { TreeModel::Children rows = track_model->children(); TreeModel::Children::iterator i; - + for (i = rows.begin(); i != rows.end(); ++i) { - + MixerStrip* strip = (*i)[track_columns.strip]; if (strip == ms) { (*i)[track_columns.visible] = true; @@ -513,9 +513,9 @@ Mixer_UI::hide_strip (MixerStrip* ms) { TreeModel::Children rows = track_model->children(); TreeModel::Children::iterator i; - + for (i = rows.begin(); i != rows.end(); ++i) { - + MixerStrip* strip = (*i)[track_columns.strip]; if (strip == ms) { (*i)[track_columns.visible] = false; @@ -560,11 +560,11 @@ Mixer_UI::set_all_strips_visibility (bool yn) TreeModel::Row row = (*i); MixerStrip* strip = row[track_columns.strip]; - + if (strip == 0) { continue; } - + if (strip->route()->is_master() || strip->route()->is_control()) { continue; } @@ -578,7 +578,7 @@ Mixer_UI::set_all_strips_visibility (bool yn) void -Mixer_UI::set_all_audio_visibility (int tracks, bool yn) +Mixer_UI::set_all_audio_visibility (int tracks, bool yn) { TreeModel::Children rows = track_model->children(); TreeModel::Children::iterator i; @@ -603,13 +603,13 @@ Mixer_UI::set_all_audio_visibility (int tracks, bool yn) case 0: (*i)[track_columns.visible] = yn; break; - + case 1: if (at) { /* track */ (*i)[track_columns.visible] = yn; } break; - + case 2: if (!at) { /* bus */ (*i)[track_columns.visible] = yn; @@ -669,7 +669,7 @@ void Mixer_UI::track_list_change (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&) { // never reset order keys because of a property change - strip_redisplay_does_not_reset_order_keys = true; + strip_redisplay_does_not_reset_order_keys = true; session->set_remote_control_ids(); redisplay_track_list (); strip_redisplay_does_not_reset_order_keys = false; @@ -710,7 +710,7 @@ Mixer_UI::redisplay_track_list () if (!strip_redisplay_does_not_reset_order_keys) { strip->route()->set_order_key (N_("signal"), order); - } + } if (strip->packed()) { @@ -745,13 +745,13 @@ Mixer_UI::redisplay_track_list () } } } - + if (!strip_redisplay_does_not_reset_order_keys && !strip_redisplay_does_not_sync_order_keys) { session->sync_order_keys (N_("signal")); } // Rebind all of the midi controls automatically - + if (auto_rebinding) auto_rebind_midi_controls (); @@ -762,7 +762,7 @@ void Mixer_UI::strip_width_changed () { _group_tabs->set_dirty (); - + #ifdef GTKOSX TreeModel::Children rows = track_model->children(); TreeModel::Children::iterator i; @@ -776,13 +776,13 @@ Mixer_UI::strip_width_changed () } bool visible = (*i)[track_columns.visible]; - + if (visible) { strip->queue_draw(); } } #endif - + } void @@ -800,14 +800,14 @@ Mixer_UI::set_auto_rebinding( bool val ) } } -void -Mixer_UI::toggle_auto_rebinding() +void +Mixer_UI::toggle_auto_rebinding() { if (auto_rebinding) { set_auto_rebinding( FALSE ); } - + else { set_auto_rebinding( TRUE ); @@ -816,8 +816,8 @@ Mixer_UI::toggle_auto_rebinding() auto_rebind_midi_controls(); } -void -Mixer_UI::auto_rebind_midi_controls () +void +Mixer_UI::auto_rebind_midi_controls () { TreeModel::Children rows = track_model->children(); TreeModel::Children::iterator i; @@ -827,7 +827,7 @@ Mixer_UI::auto_rebind_midi_controls () pos = 1; // 0 is reserved for the master strip for (i = rows.begin(); i != rows.end(); ++i) { MixerStrip* strip = (*i)[track_columns.strip]; - + if ( (*i)[track_columns.visible] == true ) { // add bindings for // make the actual binding //cout<<"Auto Binding: Visible Strip Found: "<<strip->name()<<endl; @@ -864,7 +864,7 @@ Mixer_UI::auto_rebind_midi_controls () } } // for - + } struct SignalOrderRouteSorter { @@ -882,7 +882,7 @@ Mixer_UI::initial_track_display () SignalOrderRouteSorter sorter; copy.sort (sorter); - + no_track_list_redisplay = true; track_model->clear (); @@ -917,7 +917,7 @@ Mixer_UI::track_display_button_press (GdkEventButton* ev) TreeViewColumn* column; int cellx; int celly; - + if (!track_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { return false; } @@ -961,7 +961,7 @@ Mixer_UI::build_track_menu () track_menu = new Menu; track_menu->set_name ("ArdourContextMenu"); MenuList& items = track_menu->items(); - + items.push_back (MenuElem (_("Show All"), mem_fun(*this, &Mixer_UI::show_all_routes))); items.push_back (MenuElem (_("Hide All"), mem_fun(*this, &Mixer_UI::hide_all_routes))); items.push_back (MenuElem (_("Show All Audio Tracks"), mem_fun(*this, &Mixer_UI::show_all_audiotracks))); @@ -975,16 +975,16 @@ void Mixer_UI::strip_name_changed (MixerStrip* mx) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::strip_name_changed), mx)); - + TreeModel::Children rows = track_model->children(); TreeModel::Children::iterator i; - + for (i = rows.begin(); i != rows.end(); ++i) { if ((*i)[track_columns.strip] == mx) { (*i)[track_columns.text] = mx->route()->name(); return; } - } + } error << _("track display list item for renamed strip not found!") << endmsg; } @@ -1003,7 +1003,7 @@ Mixer_UI::build_route_group_context_menu () items.push_back (MenuElem (_("Disable All"), mem_fun(*this, &Mixer_UI::disable_all_route_groups))); items.push_back (SeparatorElem()); items.push_back (MenuElem (_("Add group"), mem_fun(*this, &Mixer_UI::new_route_group))); - + } bool @@ -1041,8 +1041,8 @@ Mixer_UI::group_display_button_press (GdkEventButton* ev) return true; } } - - } + + } break; case 1: @@ -1059,7 +1059,7 @@ Mixer_UI::group_display_button_press (GdkEventButton* ev) default: break; } - + return false; } @@ -1113,7 +1113,7 @@ Mixer_UI::remove_selected_route_group () TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); TreeIter iter; - + /* selection mode is single, so rows.begin() is it */ if ((iter = group_model->get_iter (*i))) { @@ -1136,7 +1136,7 @@ Mixer_UI::group_flags_changed (void* src, RouteGroup* group) ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::group_flags_changed), src, group)); /* force an update of any mixer strips that are using this group, - otherwise mix group names don't change in mixer strips + otherwise mix group names don't change in mixer strips */ for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) { @@ -1144,13 +1144,13 @@ Mixer_UI::group_flags_changed (void* src, RouteGroup* group) (*i)->route_group_changed(0); } } - + TreeModel::iterator i; TreeModel::Children rows = group_model->children(); Glib::RefPtr<TreeSelection> selection = group_display.get_selection(); in_group_row_change = true; - + for (i = rows.begin(); i != rows.end(); ++i) { if ((*i)[group_columns.group] == group) { (*i)[group_columns.visible] = !group->is_hidden (); @@ -1171,18 +1171,18 @@ Mixer_UI::route_group_name_edit (const Glib::ustring& path, const Glib::ustring& TreeIter iter; if ((iter = group_model->get_iter (path))) { - + if ((group = (*iter)[group_columns.group]) == 0) { return; } - + if (new_text != group->name()) { group->set_name (new_text); } } } -void +void Mixer_UI::route_group_row_change (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) { RouteGroup* group; @@ -1207,7 +1207,7 @@ Mixer_UI::route_group_row_change (const Gtk::TreeModel::Path&, const Gtk::TreeMo hide_strip (*i); } } - } + } Glib::ustring name = (*iter)[group_columns.text]; @@ -1236,7 +1236,7 @@ Mixer_UI::add_route_group (RouteGroup* group) } group->FlagsChanged.connect (bind (mem_fun(*this, &Mixer_UI::group_flags_changed), group)); - + if (focus) { TreeViewColumn* col = group_display.get_column (0); CellRendererText* name_cell = dynamic_cast<CellRendererText*>(group_display.get_column_cell_renderer (0)); @@ -1288,12 +1288,12 @@ Mixer_UI::set_state (const XMLNode& node) { const XMLProperty* prop; XMLNode* geometry; - + m_width = default_width; m_height = default_height; m_root_x = 1; m_root_y = 1; - + if ((geometry = find_named_node (node, "geometry")) != 0) { XMLProperty* prop; @@ -1316,7 +1316,7 @@ Mixer_UI::set_state (const XMLNode& node) } if (prop) { m_root_x = atoi (prop->value()); - + } if ((prop = geometry->property ("y_pos")) == 0) { prop = geometry->property ("y-pos"); @@ -1352,7 +1352,7 @@ Mixer_UI::get_state (void) if (is_realized()) { Glib::RefPtr<Gdk::Window> win = get_window(); - + get_window_pos_and_size (); XMLNode* geometry = new XMLNode ("geometry"); @@ -1365,7 +1365,7 @@ Mixer_UI::get_state (void) geometry->add_property(X_("x_pos"), string(buf)); snprintf(buf, sizeof(buf), "%d", m_root_y); geometry->add_property(X_("y_pos"), string(buf)); - + // written only for compatibility, they are not used. snprintf(buf, sizeof(buf), "%d", 0); geometry->add_property(X_("x_off"), string(buf)); @@ -1388,7 +1388,7 @@ Mixer_UI::get_state (void) } -void +void Mixer_UI::pane_allocation_handler (Allocation&, Gtk::Paned* which) { int pos; @@ -1480,10 +1480,10 @@ Mixer_UI::parameter_changed (string const & p) } } } - + void Mixer_UI::set_route_group_activation (RouteGroup* g, bool a) { g->set_active (a, this); } - + diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 41609e8de2..c7378404ef 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ class Mixer_UI : public Gtk::Window ~Mixer_UI(); void connect_to_session (ARDOUR::Session *); - + PluginSelector& plugin_selector() { return *_plugin_selector; } void set_strip_width (Width); @@ -84,7 +84,7 @@ class Mixer_UI : public Gtk::Window ARDOUR::Session *session; bool _visible; - + Gtk::HBox global_hpacker; Gtk::VBox global_vpacker; Gtk::ScrolledWindow scroller; @@ -108,7 +108,7 @@ class Mixer_UI : public Gtk::Window // for restoring window geometry. int m_root_x, m_root_y, m_width, m_height; - + void set_window_pos_and_size (); void get_window_pos_and_size (); @@ -116,7 +116,7 @@ class Mixer_UI : public Gtk::Window bool on_key_release_event (GdkEventKey*); void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*); - + std::list<MixerStrip *> strips; bool strip_scroller_button_release (GdkEventButton*); @@ -144,7 +144,7 @@ class Mixer_UI : public Gtk::Window gint stop_updating (); void disconnect_from_session (); - + sigc::connection fast_screen_update_connection; void fast_update_strips (); @@ -154,7 +154,7 @@ class Mixer_UI : public Gtk::Window bool no_track_list_redisplay; bool track_display_button_press (GdkEventButton*); void strip_width_changed (); - + void track_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&); void track_list_delete (const Gtk::TreeModel::Path&); void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order); @@ -164,7 +164,7 @@ class Mixer_UI : public Gtk::Window void set_all_strips_visibility (bool yn); void set_all_audio_visibility (int tracks, bool yn); - + void hide_all_routes (); void show_all_routes (); void show_all_audiobus (); @@ -199,7 +199,7 @@ class Mixer_UI : public Gtk::Window void group_flags_changed (void *src, ARDOUR::RouteGroup *); /* various treeviews */ - + struct TrackDisplayModelColumns : public Gtk::TreeModel::ColumnRecord { TrackDisplayModelColumns () { add (text); @@ -214,7 +214,7 @@ class Mixer_UI : public Gtk::Window }; struct GroupDisplayModelColumns : public Gtk::TreeModel::ColumnRecord { - GroupDisplayModelColumns() { + GroupDisplayModelColumns() { add (visible); add (text); add (group); diff --git a/gtk2_ardour/mtest.cc b/gtk2_ardour/mtest.cc index e3f3855010..1f9442e966 100644 --- a/gtk2_ardour/mtest.cc +++ b/gtk2_ardour/mtest.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ make_action (Glib::RefPtr<ActionGroup> group, string name, string label, RefPtr< act->set_accel_group (accels); cerr << "action " << name << " has path " << act->get_accel_path() << endl; - + return act; } @@ -64,12 +64,12 @@ make_action (Glib::RefPtr<ActionGroup> group, string name, string label) return act; } -bool +bool lookup_entry (const ustring accel_path, Gtk::AccelKey& key) { GtkAccelKey gkey; bool known = gtk_accel_map_lookup_entry (accel_path.c_str(), &gkey); - + if (known) { key = AccelKey (gkey.accel_key, Gdk::ModifierType (gkey.accel_mods)); } else { @@ -83,9 +83,9 @@ RefPtr<ActionGroup> copy_actions (const RefPtr<ActionGroup> src) { RefPtr<ActionGroup> grp = ActionGroup::create (src->get_name()); - + ListHandle<RefPtr<Action> > group_actions = src->get_actions(); - + for (ListHandle<RefPtr<Action> >::iterator a = group_actions.begin(); a != group_actions.end(); ++a) { RefPtr<Action> act = Action::create ((*a)->get_name(), (*a)->property_label()); grp->add (act); @@ -129,7 +129,7 @@ main (int argc, char* argv[]) uimanager->add_ui_from_file ("mtest.menus"); other_uimanager->add_ui_from_file ("mtest_other.menus"); - + // AccelMap::load ("mtest.bindings"); RefPtr<AccelGroup> accels = hidden.get_accel_group(); @@ -142,7 +142,7 @@ main (int argc, char* argv[]) make_action (shared_actions, "Bar", "bar", accels, bind (sigc::ptr_fun (printit), "barshared"), GDK_p, Gdk::CONTROL_MASK); RefPtr<Action> act = make_action (shared_actions, "Baz", "baz", accels, bind (sigc::ptr_fun (printit), "baz-shared"), GDK_p, Gdk::SHIFT_MASK); - + act->connect_proxy (button); act->connect_proxy (other_button); diff --git a/gtk2_ardour/nag.cc b/gtk2_ardour/nag.cc index c8f6c35c17..7ae1b6e809 100644 --- a/gtk2_ardour/nag.cc +++ b/gtk2_ardour/nag.cc @@ -40,13 +40,13 @@ its development with either a one-time donation or subscription. Nothing\n\ will happen if you choose not to do so. However Ardour's continuing development\n\ relies on a stable, sustainable income stream. Thanks for using Ardour!")); } - + button_box.pack_start (donate_button); button_box.pack_start (subscribe_button); button_box.pack_start (existing_button); button_box.pack_start (next_time_button); button_box.pack_start (never_again_button); - + get_vbox()->set_spacing (12); get_vbox()->pack_start (message); get_vbox()->pack_start (button_box); @@ -100,7 +100,7 @@ NagScreen::maybe_nag (std::string why) } maybe_subscribed = is_subscribed (really_subscribed); - + if (really_subscribed) { return 0; } @@ -114,7 +114,7 @@ NagScreen::mark_never_again () Glib::ustring path; path = Glib::build_filename (user_config_directory().to_string(), ".nevernag"); - + ofstream nagfile (path.c_str()); } @@ -124,7 +124,7 @@ NagScreen::mark_subscriber () Glib::ustring path; path = Glib::build_filename (user_config_directory().to_string(), ".askedaboutsub"); - + ofstream subsfile (path.c_str()); } @@ -134,7 +134,7 @@ NagScreen::mark_affirmed_subscriber () Glib::ustring path; path = Glib::build_filename (user_config_directory().to_string(), ".isubscribe"); - + ofstream subsfile (path.c_str()); } @@ -145,7 +145,7 @@ NagScreen::is_subscribed (bool& really) really = false; - /* what we'd really like here is a way to query paypal + /* what we'd really like here is a way to query paypal for someone's subscription status. thats a bit complicated so for now, just see if they ever told us they were subscribed. we try to trust our users :) diff --git a/gtk2_ardour/nag.h b/gtk2_ardour/nag.h index 5872e28f3b..664cff76fe 100644 --- a/gtk2_ardour/nag.h +++ b/gtk2_ardour/nag.h @@ -11,7 +11,7 @@ class NagScreen : public ArdourDialog { public: ~NagScreen(); - + static NagScreen* maybe_nag (std::string context); void nag (); diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index 37ae91d0cb..f5509c760c 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -99,13 +99,13 @@ public: void add_to_page (OptionEditorPage *); protected: - + Gtk::VBox* _box; ///< constituent box for subclasses to add widgets to }; /** Base class for components which provide UI to change an option */ class Option : public OptionEditorComponent { - + public: /** Construct an Option. * @param i Option id (e.g. "plugins-stop-with-transport") @@ -124,16 +124,16 @@ public: set_state_from_config (); } } - + virtual void set_state_from_config () = 0; virtual void add_to_page (OptionEditorPage*) = 0; std::string id () const { return _id; } - + private: - + std::string _id; std::string _name; }; @@ -142,15 +142,15 @@ private: class BoolOption : public Option { public: - + BoolOption (std::string const &, std::string const &, sigc::slot<bool>, sigc::slot<bool, bool>); void set_state_from_config (); void add_to_page (OptionEditorPage*); - + private: void toggled (); - + sigc::slot<bool> _get; ///< slot to get the configuration variable's value sigc::slot<bool, bool> _set; ///< slot to set the configuration variable's value Gtk::CheckButton* _button; ///< UI button @@ -164,24 +164,24 @@ public: EntryOption (std::string const &, std::string const &, sigc::slot<std::string>, sigc::slot<bool, std::string>); void set_state_from_config (); void add_to_page (OptionEditorPage*); - + private: void activated (); - + sigc::slot<std::string> _get; ///< slot to get the configuration variable's value sigc::slot<bool, std::string> _set; ///< slot to set the configuration variable's value Gtk::Label* _label; ///< UI label Gtk::Entry* _entry; ///< UI entry }; - + /** Component which provides the UI to handle an enumerated option using a GTK CheckButton. * The template parameter is the enumeration. */ template <class T> class ComboOption : public Option { - + public: /** Construct an ComboOption. @@ -211,7 +211,7 @@ public: while (r < _options.size() && _get () != _options[r]) { ++r; } - + if (r < _options.size()) { _combo->set_active (r); } @@ -230,7 +230,7 @@ public: _options.push_back (e); _combo->append_text (o); } - + void changed () { uint32_t const r = _combo->get_active_row_number (); if (r < _options.size()) { @@ -239,7 +239,7 @@ public: } private: - + sigc::slot<T> _get; sigc::slot<bool, T> _set; Gtk::Label* _label; @@ -288,14 +288,14 @@ public: _spin = manage (new Gtk::SpinButton); _spin->set_range (min, max); _spin->set_increments (step, page); - + _box = manage (new Gtk::HBox); _box->pack_start (*_spin, true, true); _box->set_spacing (4); if (unit.length()) { _box->pack_start (*manage (new Gtk::Label (unit)), false, false); } - + _spin->signal_value_changed().connect (sigc::mem_fun (*this, &SpinOption::changed)); } @@ -308,12 +308,12 @@ public: { add_widgets_to_page (p, _label, _box); } - + void changed () { _set (static_cast<T> (_spin->get_value ()) * _scale); } - + private: sigc::slot<T> _get; sigc::slot<bool, T> _set; @@ -347,9 +347,9 @@ public: void add_option (std::string const &, OptionEditorComponent *); protected: - + ARDOUR::Configuration* _config; - + private: void parameter_changed (std::string const &); diff --git a/gtk2_ardour/opts.cc b/gtk2_ardour/opts.cc index 4437a9d224..4f702f6486 100644 --- a/gtk2_ardour/opts.cc +++ b/gtk2_ardour/opts.cc @@ -1,6 +1,6 @@ /* Copyright (C) 2001 Paul Davis - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -54,8 +54,8 @@ print_help (const char *execname) << _(" -c, --name name Use a specific jack client name, default is ardour\n") << _(" -d, --disable-plugins Disable all plugins in an existing session\n") << _(" -n, --show-splash Show splash screen\n") - << _(" -m, --menus file Use \"file\" for Ardour menus\n") - << _(" -N, --new session-name Create a new session from the command line\n") + << _(" -m, --menus file Use \"file\" for Ardour menus\n") + << _(" -N, --new session-name Create a new session from the command line\n") << _(" -O, --no-hw-optimizations Disable h/w specific optimizations\n") << _(" -S, --sync Draw the gui synchronously \n") #ifdef VST_SUPPORT @@ -115,7 +115,7 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[]) switch (c) { case 0: break; - + case 'v': just_version = true; break; @@ -127,7 +127,7 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[]) case 'b': show_key_actions = true; break; - + case 'd': ARDOUR::Session::set_disable_all_loaded_plugins (true); break; @@ -144,7 +144,7 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[]) //undocumented OS X finder -psn_XXXXX argument finder_invoked_ardour = true; break; - + case 'S': // ; just pass this through to gtk it will figure it out break; @@ -157,7 +157,7 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[]) case 'O': try_hw_optimization = false; break; - + case 'V': #ifdef VST_SUPPORT use_vst = false; diff --git a/gtk2_ardour/opts.h b/gtk2_ardour/opts.h index 71cd687b8b..3b3f08816f 100644 --- a/gtk2_ardour/opts.h +++ b/gtk2_ardour/opts.h @@ -1,6 +1,6 @@ /* Copyright (C) 2001 Paul Davis - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or diff --git a/gtk2_ardour/panner.cc b/gtk2_ardour/panner.cc index 80b401acfe..8c5524b414 100644 --- a/gtk2_ardour/panner.cc +++ b/gtk2_ardour/panner.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,13 +52,13 @@ PannerBar::expose (GdkEventExpose* ev) GdkPoint points[3]; // left - + points[0].x = 0; points[0].y = 0; points[1].x = triangle_size; points[1].y = 0; - + points[2].x = 0; points[2].y = triangle_size; @@ -71,11 +71,11 @@ PannerBar::expose (GdkEventExpose* ev) points[1].x = (darea.get_width()/2 + triangle_size); points[1].y = 0; - + points[2].x = darea.get_width()/2; points[2].y = triangle_size - 1; - gdk_draw_polygon (win->gobj(), gc->gobj(), true, points, 3); + gdk_draw_polygon (win->gobj(), gc->gobj(), true, points, 3); // right @@ -84,7 +84,7 @@ PannerBar::expose (GdkEventExpose* ev) points[1].x = darea.get_width(); points[1].y = 0; - + points[2].x = darea.get_width(); points[2].y = triangle_size; @@ -198,7 +198,7 @@ PannerBar::get_label (int& x) if (ARDOUR::Panner::equivalent (value, 0.5)) { /* centre: only display text during a drag */ - + if (!grabbed) { return ""; } @@ -206,19 +206,19 @@ PannerBar::get_label (int& x) } else { /* non-centre: display text on the side of the panner which has more space */ - + Glib::RefPtr<Pango::Context> p = get_pango_context (); Glib::RefPtr<Pango::Layout> l = Pango::Layout::create (p); l->set_text (value_as_string (value)); Pango::Rectangle const ext = l->get_ink_extents (); - + if (value < 0.5) { x = (darea.get_width() - 4 - ext.get_width() / Pango::SCALE); } else { x = 4; } } - + return value_as_string (value); } diff --git a/gtk2_ardour/panner.h b/gtk2_ardour/panner.h index a553e97f30..61d63dd762 100644 --- a/gtk2_ardour/panner.h +++ b/gtk2_ardour/panner.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/panner2d.cc b/gtk2_ardour/panner2d.cc index b6c601cdef..7917604b62 100644 --- a/gtk2_ardour/panner2d.cc +++ b/gtk2_ardour/panner2d.cc @@ -50,7 +50,7 @@ Panner2d::Target::Target (float xa, float ya, const char *txt) } Panner2d::Target::~Target () -{ +{ if (text) { free (text); } @@ -74,7 +74,7 @@ Panner2d::Panner2d (boost::shared_ptr<Panner> p, int32_t h) panner->StateChanged.connect (mem_fun(*this, &Panner2d::handle_state_change)); panner->Changed.connect (mem_fun(*this, &Panner2d::handle_position_change)); - + drag_target = 0; set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK); } @@ -96,7 +96,7 @@ Panner2d::reset (uint32_t n_inputs) while (pucks.size() < n_inputs) { add_puck ("", 0.0, 0.0); } - + while (pucks.size() > n_inputs) { pucks.erase (pucks.begin()); } @@ -108,14 +108,14 @@ Panner2d::reset (uint32_t n_inputs) switch (n_inputs) { case 0: break; - + case 1: pucks[0]->set_text (""); pucks[0]->x.set_value (0.0); pucks[0]->y.set_value (0.5); pucks[0]->visible = true; break; - + case 2: pucks[0]->set_text ("R"); pucks[0]->visible = true; @@ -126,13 +126,13 @@ Panner2d::reset (uint32_t n_inputs) } pucks[1]->visible = true; break; - + default: for (uint32_t i = 0; i < n_inputs; ++i) { char buf[64]; snprintf (buf, sizeof (buf), "%" PRIu32, i); pucks[i]->set_text (buf); - + if (existing_pucks < i) { float x, y; panner->streampanner (i).get_position (x, y); @@ -144,13 +144,13 @@ Panner2d::reset (uint32_t n_inputs) } break; } - + /* add all outputs */ - + while (targets.size() < panner->nouts()) { add_target (0.0, 0.0); } - + while (targets.size() > panner->nouts()) { targets.erase (targets.begin()); } @@ -168,7 +168,7 @@ Panner2d::reset (uint32_t n_inputs) targets[n]->y.set_value (panner->output(n).y); targets[n]->visible = true; } - + allow_x_motion (true); allow_y_motion (true); allow_target_motion (true); @@ -208,7 +208,7 @@ Panner2d::add_puck (const char* text, float x, float y) pucks.insert (newpair); puck->visible = true; - + return 0; } @@ -257,7 +257,7 @@ Panner2d::remove_target (int which) targets.erase (i); queue_draw (); } -} +} void Panner2d::handle_state_change () @@ -302,10 +302,10 @@ Panner2d::move_target (int which, float x, float y) target = i->second; target->x.set_value (x); target->y.set_value (y); - + queue_draw (); } -} +} void Panner2d::move_puck (int which, float x, float y) @@ -317,10 +317,10 @@ Panner2d::move_puck (int which, float x, float y) target = i->second; target->x.set_value (x); target->y.set_value (y); - + queue_draw (); } -} +} void Panner2d::show_puck (int which) @@ -422,9 +422,9 @@ Panner2d::find_closest_object (gdouble x, gdouble y, int& which, bool& is_puck) which = pwhich; } } - + return closest; -} +} bool Panner2d::on_motion_notify_event (GdkEventMotion *ev) @@ -497,28 +497,28 @@ Panner2d::on_expose_event (GdkEventExpose *event) if (puck->visible) { /* redraw puck */ - + fx = min (puck->x.get_value(), 1.0); fx = max (fx, -1.0f); x = (gint) floor (width * fx - 4); - + fy = min (puck->y.get_value(), 1.0); fy = max (fy, -1.0f); y = (gint) floor (height * fy - 4); - + cairo_arc (cr, x, y, arc_radius, 0, 2.0 * M_PI); cairo_set_source_rgb (cr, 0.8, 0.2, 0.1); cairo_close_path (cr); cairo_fill (cr); /* arrow */ - + if (height > 100.0f) { float endx, endy; endx = x; endy = y; - + cairo_save (cr); cairo_translate (cr, x, y); cairo_rotate (cr, puck->azimuth.get_value()); @@ -533,9 +533,9 @@ Panner2d::on_expose_event (GdkEventExpose *event) cairo_move_to (cr, 0.0, 0.0); cairo_line_to (cr, endx, endy); cairo_stroke (cr); - + /* arrow head */ - + cairo_move_to (cr, endx - 10.0, endy + 10.0); cairo_line_to (cr, endx, endy); cairo_line_to (cr, endx - 10.0, endy - 10.0); @@ -551,7 +551,7 @@ Panner2d::on_expose_event (GdkEventExpose *event) } /* redraw any visible targets */ - + int n = 0; for (Targets::iterator i = targets.begin(); i != targets.end(); ++i) { @@ -560,11 +560,11 @@ Panner2d::on_expose_event (GdkEventExpose *event) ++n; if (target->visible) { - + fx = min (target->x.get_value(), 1.0); fx = max (fx, -1.0f); x = (gint) floor (width * fx); - + fy = min (target->y.get_value(), 1.0); fy = max (fy, -1.0f); y = (gint) floor (height * fy); @@ -608,7 +608,7 @@ Panner2d::on_button_press_event (GdkEventButton *ev) default: break; } - + return FALSE; } @@ -641,7 +641,7 @@ Panner2d::on_button_release_event (GdkEventButton *ev) } else { ret = handle_motion (x, y, state); } - + drag_target = 0; break; @@ -656,7 +656,7 @@ Panner2d::on_button_release_event (GdkEventButton *ev) } else { ret = handle_motion (x, y, state); } - + drag_target = 0; break; @@ -699,7 +699,7 @@ Panner2d::handle_motion (gint evx, gint evy, GdkModifierType state) need_move = true; } } - + if (allow_y || drag_is_puck) { float new_y; y = min (evy, height - 1); @@ -710,22 +710,22 @@ Panner2d::handle_motion (gint evx, gint evy, GdkModifierType state) need_move = true; } } - + if (need_move) { - + if (drag_is_puck) { - + panner->streampanner(drag_index).set_position ( drag_target->x.get_value(), drag_target->y.get_value(), false); - + } else { - + TargetMoved (drag_index); } queue_draw (); } - + } else if ((state & GDK_BUTTON2_MASK) && !(state & GDK_BUTTON1_MASK)) { @@ -735,7 +735,7 @@ Panner2d::handle_motion (gint evx, gint evy, GdkModifierType state) int xdelta = drag_x - evx; int ydelta = drag_x - evy; - + drag_target->azimuth.set_value (drag_target->azimuth.get_value() + (2 * M_PI) * ((float)ydelta)/height * ((float) -xdelta)/height); queue_draw (); } @@ -777,7 +777,7 @@ Panner2dWindow::Panner2dWindow (boost::shared_ptr<Panner> p, int32_t h, uint32_t set_title (_("Panner")); widget.set_size_request (h, h); - + button_box.set_spacing (6); button_box.pack_start (reset_button, false, false); button_box.pack_start (bypass_button, false, false); @@ -801,7 +801,7 @@ Panner2dWindow::Panner2dWindow (boost::shared_ptr<Panner> p, int32_t h, uint32_t hpacker.pack_start (widget, false, false); hpacker.pack_start (left_side, false, false); hpacker.show (); - + add (hpacker); reset (inputs); widget.show (); diff --git a/gtk2_ardour/panner2d.h b/gtk2_ardour/panner2d.h index e70f9faea5..91f4851746 100644 --- a/gtk2_ardour/panner2d.h +++ b/gtk2_ardour/panner2d.h @@ -52,7 +52,7 @@ class Panner2d : public Gtk::DrawingArea public: Panner2d (boost::shared_ptr<ARDOUR::Panner>, int32_t height); ~Panner2d (); - + void allow_x_motion(bool); void allow_y_motion(bool); void allow_target_motion (bool); @@ -73,7 +73,7 @@ class Panner2d : public Gtk::DrawingArea Gtk::Adjustment& azimuth (uint32_t which); boost::shared_ptr<ARDOUR::Panner> get_panner() const { return panner; } - + sigc::signal<void,int> PuckMoved; sigc::signal<void,int> TargetMoved; @@ -117,7 +117,7 @@ class Panner2d : public Gtk::DrawingArea int height; bool bypassflag; - + gint compute_x (float); gint compute_y (float); @@ -134,7 +134,7 @@ class Panner2dWindow : public Gtk::Window { public: Panner2dWindow (boost::shared_ptr<ARDOUR::Panner>, int32_t height, uint32_t inputs); - + void reset (uint32_t n_inputs); private: diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index cb1ee82508..ca10dd4300 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -131,18 +131,18 @@ PannerUI::PannerUI (Session& s) set_width(Narrow); } - + void PannerUI::set_panner (boost::shared_ptr<Panner> p) { connections.clear (); - + delete pan_astyle_menu; pan_astyle_menu = 0; delete pan_astate_menu; pan_astate_menu = 0; - + _panner = p; delete panner; @@ -151,7 +151,7 @@ PannerUI::set_panner (boost::shared_ptr<Panner> p) if (!_panner) { return; } - + connections.push_back (_panner->Changed.connect (mem_fun(*this, &PannerUI::panner_changed))); connections.push_back (_panner->LinkStateChanged.connect (mem_fun(*this, &PannerUI::update_pan_linkage))); connections.push_back (_panner->StateChanged.connect (mem_fun(*this, &PannerUI::update_pan_state))); @@ -163,7 +163,7 @@ PannerUI::set_panner (boost::shared_ptr<Panner> p) update_pan_linkage (); pan_automation_state_changed (); -#if WHERE_DOES_THIS_LIVE +#if WHERE_DOES_THIS_LIVE pan_bar_packer.show(); panning_viewport.show(); panning_up.show(); @@ -224,8 +224,8 @@ PannerUI::build_astyle_menu () } boost::shared_ptr<PBD::Controllable> -PannerUI::get_controllable() -{ +PannerUI::get_controllable() +{ return pan_bars[0]->get_controllable(); } @@ -261,12 +261,12 @@ void PannerUI::update_pan_linkage () { ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::update_pan_linkage)); - + bool x = _panner->linked(); bool bx = panning_link_button.get_active(); if (x != bx) { - + ignore_toggle = true; panning_link_button.set_active (x); ignore_toggle = false; @@ -305,7 +305,7 @@ PannerUI::~PannerUI () for (vector<Adjustment*>::iterator i = pan_adjustments.begin(); i != pan_adjustments.end(); ++i) { delete (*i); } - + for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) { delete (*i); } @@ -408,12 +408,12 @@ PannerUI::setup_pan () _panner->pan_control( asz )->Changed.connect (bind (mem_fun(*this, &PannerUI::pan_value_changed), (uint32_t) asz)); - + bc->set_name ("PanSlider"); bc->set_shadow_type (Gtk::SHADOW_NONE); - + boost::shared_ptr<AutomationControl> ac = _panner->pan_control (asz); - + if (asz) { bc->StartGesture.connect (mem_fun (*ac, &AutomationControl::start_touch)); bc->StopGesture.connect (mem_fun (*ac, &AutomationControl::stop_touch)); @@ -449,11 +449,11 @@ PannerUI::setup_pan () panner = new Panner2d (_panner, 61); panner->set_name ("MixerPanZone"); panner->show (); - + panner->signal_button_press_event().connect (bind (mem_fun(*this, &PannerUI::pan_button_event), (uint32_t) 0), false); } - + update_pan_sensitive (); panner->reset (nouts); if (big_window) { @@ -508,7 +508,7 @@ PannerUI::build_pan_menu (uint32_t which) items.clear (); items.push_back (CheckMenuElem (_("Mute"))); - + /* set state first, connect second */ (dynamic_cast<CheckMenuItem*> (&items.back()))->set_active (_panner->streampanner(which).muted()); @@ -563,7 +563,7 @@ PannerUI::effective_pan_display () } switch (_panner->nouts()) { - case 0: + case 0: case 1: /* relax */ break; @@ -628,9 +628,9 @@ PannerUI::pan_adjustment_changed (uint32_t which) xpos = _panner->pan_control( which )->get_value(); /* add a kinda-sorta detent for the middle */ - + if (val != 0.5 && Panner::equivalent (val, 0.5)) { - /* this is going to be reentrant, so just + /* this is going to be reentrant, so just return after it. */ @@ -639,11 +639,11 @@ PannerUI::pan_adjustment_changed (uint32_t which) in_pan_update = false; return; } - + if (!Panner::equivalent (val, xpos)) { _panner->streampanner(which).set_position (val); - /* XXX + /* XXX the panner objects have no access to the session, so do this here. ick. */ @@ -656,7 +656,7 @@ void PannerUI::pan_value_changed (uint32_t which) { ENSURE_GUI_THREAD (bind (mem_fun(*this, &PannerUI::pan_value_changed), which)); - + if (_panner->npanners() > 1 && which < _panner->npanners()) { float xpos; float val = pan_adjustments[which]->get_value (); @@ -669,7 +669,7 @@ PannerUI::pan_value_changed (uint32_t which) in_pan_update = false; } } -} +} void PannerUI::update_pan_bars (bool only_if_aplay) @@ -688,7 +688,7 @@ PannerUI::update_pan_bars (bool only_if_aplay) if (only_if_aplay) { boost::shared_ptr<AutomationList> alist (_panner->streampanner(n).pan_control()->alist()); - + if (!alist->automation_playback()) { continue; } @@ -696,7 +696,7 @@ PannerUI::update_pan_bars (bool only_if_aplay) _panner->streampanner(n).get_effective_position (xpos); val = (*i)->get_value (); - + if (!Panner::equivalent (val, xpos)) { (*i)->set_value (xpos); } @@ -706,7 +706,7 @@ PannerUI::update_pan_bars (bool only_if_aplay) } void -PannerUI::update_pan_sensitive () +PannerUI::update_pan_sensitive () { bool sensitive = !(_panner->automation_state() & Play); @@ -777,7 +777,7 @@ void PannerUI::pan_automation_style_changed () { ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::pan_automation_style_changed)); - + switch (_width) { case Wide: pan_automation_style_button.set_label (astyle_string(_panner->automation_style())); @@ -792,7 +792,7 @@ void PannerUI::pan_automation_state_changed () { ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::pan_automation_state_changed)); - + bool x; switch (_width) { diff --git a/gtk2_ardour/panner_ui.h b/gtk2_ardour/panner_ui.h index 119dda208c..ce4781fe11 100644 --- a/gtk2_ardour/panner_ui.h +++ b/gtk2_ardour/panner_ui.h @@ -128,7 +128,7 @@ class PannerUI : public Gtk::HBox void build_astyle_menu (); void panner_changed (); - + void hide_pans (); void panner_moved (int which); diff --git a/gtk2_ardour/piano_roll_header.cc b/gtk2_ardour/piano_roll_header.cc index c6784bf853..cfdf2bcd67 100644 --- a/gtk2_ardour/piano_roll_header.cc +++ b/gtk2_ardour/piano_roll_header.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,8 +60,8 @@ PianoRollHeader::Color::set(const PianoRollHeader::Color& c) b = c.b; } -PianoRollHeader::PianoRollHeader(MidiStreamView& v) - : _view(v) +PianoRollHeader::PianoRollHeader(MidiStreamView& v) + : _view(v) , _highlighted_note(no_note) , _clicked_note(no_note) , _dragging(false) @@ -90,7 +90,7 @@ create_path(Cairo::RefPtr<Cairo::Context> cr, double x[], double y[], int start, } } -inline void +inline void render_rect(Cairo::RefPtr<Cairo::Context> cr, int /*note*/, double x[], double y[], PianoRollHeader::Color& bg, PianoRollHeader::Color& tl_shadow, PianoRollHeader::Color& br_shadow) { @@ -441,10 +441,10 @@ PianoRollHeader::on_expose_event (GdkEventExpose* ev) std::stringstream s; double y = floor(_view.note_to_y(i)) - 0.5f; double note_height = floor(_view.note_to_y(i - 1)) - y; - + int cn = i / 12; s << "C" << cn; - + //cr->get_text_extents(s.str(), te); cr->set_source_rgb(0.30f, 0.30f, 0.30f); cr->move_to(2.0f, y + note_height - 1.0f - (note_height - font_size) / 2.0f); @@ -501,7 +501,7 @@ PianoRollHeader::on_button_press_event (GdkEventButton* ev) _active_notes[note] = true; _clicked_note = note; send_note_on(note); - + invalidate_note_range(note, note); } else { _clicked_note = no_note; @@ -524,7 +524,7 @@ PianoRollHeader::on_button_release_event (GdkEventButton* ev) _active_notes[note] = false; _clicked_note = no_note; send_note_off(note); - + invalidate_note_range(note, note); } } @@ -545,7 +545,7 @@ bool PianoRollHeader::on_leave_notify_event (GdkEventCrossing*) { invalidate_note_range(_highlighted_note, _highlighted_note); - + if (_clicked_note != no_note) { _active_notes[_clicked_note] = false; send_note_off(_clicked_note); @@ -639,7 +639,7 @@ void PianoRollHeader::on_size_allocate(Gtk::Allocation& a) { DrawingArea::on_size_allocate(a); - + _black_note_width = floor(0.7 * get_width()) + 0.5f; } diff --git a/gtk2_ardour/piano_roll_header.h b/gtk2_ardour/piano_roll_header.h index f005538d4a..7369303e5d 100644 --- a/gtk2_ardour/piano_roll_header.h +++ b/gtk2_ardour/piano_roll_header.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,7 +51,7 @@ public: Color(); Color(double _r, double _g, double _b); inline void set(const Color& c); - + double r; double g; double b; @@ -97,7 +97,7 @@ private: uint8_t _clicked_note; double _grab_y; bool _dragging; - + double _note_height; double _black_note_width; }; diff --git a/gtk2_ardour/playlist_selection.h b/gtk2_ardour/playlist_selection.h index a29be49793..4fcf1c64c8 100644 --- a/gtk2_ardour/playlist_selection.h +++ b/gtk2_ardour/playlist_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/playlist_selector.cc b/gtk2_ardour/playlist_selector.cc index dd62240e44..b4f884a0a7 100644 --- a/gtk2_ardour/playlist_selector.cc +++ b/gtk2_ardour/playlist_selector.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ PlaylistSelector::PlaylistSelector () : ArdourDialog ("playlist selector") { rui = 0; - + set_position (WIN_POS_MOUSE); set_name ("PlaylistSelectorWindow"); set_modal(true); @@ -116,7 +116,7 @@ PlaylistSelector::show_for (RouteUI* ruix) select_connection.disconnect (); model->clear (); - + session->foreach_playlist (this, &PlaylistSelector::add_playlist_to_map); this_ds = rui->get_diskstream(); @@ -126,7 +126,7 @@ PlaylistSelector::show_for (RouteUI* ruix) others[columns.text] = _("Other tracks"); boost::shared_ptr<Playlist> proxy = others[columns.playlist]; proxy.reset (); - + for (DSPL_Map::iterator x = dspl_map.begin(); x != dspl_map.end(); ++x) { boost::shared_ptr<Diskstream> ds = session->diskstream_by_id (x->first); @@ -144,7 +144,7 @@ PlaylistSelector::show_for (RouteUI* ruix) } else { nodename = ds->name().c_str(); } - + TreeModel::Row row; TreeModel::Row* selected_row = 0; TreePath this_path; @@ -162,9 +162,9 @@ PlaylistSelector::show_for (RouteUI* ruix) } /* Now insert all the playlists for this diskstream/track in a subtree */ - + list<boost::shared_ptr<Playlist> > *pls = x->second; - + for (list<boost::shared_ptr<Playlist> >::iterator p = pls->begin(); p != pls->end(); ++p) { TreeModel::Row child_row; @@ -175,9 +175,9 @@ PlaylistSelector::show_for (RouteUI* ruix) if (*p == this_ds->playlist()) { selected_row = &child_row; - } + } } - + if (selected_row != 0) { tree.get_selection()->select (*selected_row); } @@ -224,7 +224,7 @@ PlaylistSelector::add_playlist_to_map (boost::shared_ptr<Playlist> pl) if (pl->frozen()) { return; } - + if ((apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl)) == 0) { return; } @@ -234,7 +234,7 @@ PlaylistSelector::add_playlist_to_map (boost::shared_ptr<Playlist> pl) if ((x = dspl_map.find (apl->get_orig_diskstream_id())) == dspl_map.end()) { pair<PBD::ID,list<boost::shared_ptr<Playlist> >*> newp (apl->get_orig_diskstream_id(), new list<boost::shared_ptr<Playlist> >); - + x = dspl_map.insert (dspl_map.end(), newp); } @@ -273,24 +273,24 @@ PlaylistSelector::selection_changed () } if ((playlist = ((*iter)[columns.playlist])) != 0) { - + boost::shared_ptr<AudioTrack> at; boost::shared_ptr<AudioPlaylist> apl; - + if ((at = rui->audio_track()) == 0) { /* eh? */ return; } - + if ((apl = boost::dynamic_pointer_cast<AudioPlaylist> (playlist)) == 0) { /* eh? */ return; } - + at->diskstream()->use_playlist (apl); hide (); } } - + diff --git a/gtk2_ardour/playlist_selector.h b/gtk2_ardour/playlist_selector.h index 757e7fc523..828607284f 100644 --- a/gtk2_ardour/playlist_selector.h +++ b/gtk2_ardour/playlist_selector.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,7 +38,7 @@ namespace ARDOUR { class RouteUI; -class PlaylistSelector : public ArdourDialog +class PlaylistSelector : public ArdourDialog { public: PlaylistSelector (); diff --git a/gtk2_ardour/plugin_eq_gui.cc b/gtk2_ardour/plugin_eq_gui.cc index dd5e024ddf..ae8d4946fb 100644 --- a/gtk2_ardour/plugin_eq_gui.cc +++ b/gtk2_ardour/plugin_eq_gui.cc @@ -52,7 +52,7 @@ PluginEqGui::PluginEqGui(boost::shared_ptr<ARDOUR::PluginInsert> pluginInsert) set_buffer_size(4096, 16384); //set_buffer_size(4096, 4096); - _log_coeff = (1.0 - 2.0 * (1000.0/(_samplerate/2.0))) / powf(1000.0/(_samplerate/2.0), 2.0); + _log_coeff = (1.0 - 2.0 * (1000.0/(_samplerate/2.0))) / powf(1000.0/(_samplerate/2.0), 2.0); _log_max = log10f(1 + _log_coeff); @@ -66,7 +66,7 @@ PluginEqGui::PluginEqGui(boost::shared_ptr<ARDOUR::PluginInsert> pluginInsert) _analysis_area->signal_expose_event().connect( sigc::mem_fun (*this, &PluginEqGui::expose_analysis_area)); _analysis_area->signal_size_allocate().connect( sigc::mem_fun (*this, &PluginEqGui::resize_analysis_area)); - + // dB selection dBScaleModel = Gtk::ListStore::create(dBColumns); @@ -96,12 +96,12 @@ PluginEqGui::PluginEqGui(boost::shared_ptr<ARDOUR::PluginInsert> pluginInsert) dBScaleCombo -> signal_changed().connect( sigc::mem_fun(*this, &PluginEqGui::change_dB_scale) ); - Gtk::Label *dBComboLabel = new Gtk::Label("dB scale"); + Gtk::Label *dBComboLabel = new Gtk::Label("dB scale"); Gtk::HBox *dBSelectBin = new Gtk::HBox(false, 5); dBSelectBin->add( *manage(dBComboLabel)); dBSelectBin->add( *manage(dBScaleCombo)); - + // Phase checkbutton _phase_button = new Gtk::CheckButton("Show phase"); _phase_button->set_active(true); @@ -128,7 +128,7 @@ PluginEqGui::~PluginEqGui() delete _signal_output_fft; _plugin->deactivate(); - + // all gui objects are *manage'd by the inherited Table object } @@ -189,7 +189,7 @@ PluginEqGui::change_dB_scale() _min_dB = row[dBColumns.dBMin]; _max_dB = row[dBColumns.dBMax]; _step_dB = row[dBColumns.dBStep]; - + redraw_scales(); } @@ -204,7 +204,7 @@ PluginEqGui::redraw_scales() _analysis_scale_surface = 0; } - _analysis_area->queue_draw(); + _analysis_area->queue_draw(); // TODO: Add graph legend! } @@ -221,9 +221,9 @@ PluginEqGui::set_buffer_size(uint32_t size, uint32_t signal_size) FFT *tmp3 = _signal_output_fft; try { - _impulse_fft = new FFT(size); - _signal_input_fft = new FFT(signal_size); - _signal_output_fft = new FFT(signal_size); + _impulse_fft = new FFT(size); + _signal_input_fft = new FFT(signal_size); + _signal_output_fft = new FFT(signal_size); } catch( ... ) { // Don't care about lost memory, we're screwed anyhow _impulse_fft = tmp1; @@ -235,7 +235,7 @@ PluginEqGui::set_buffer_size(uint32_t size, uint32_t signal_size) delete tmp1; delete tmp2; delete tmp3; - + _buffer_size = size; _signal_buffer_size = signal_size; @@ -254,7 +254,7 @@ PluginEqGui::set_buffer_size(uint32_t size, uint32_t signal_size) _collect_bufferset.set_count(chanCount); } -void +void PluginEqGui::resize_analysis_area(Gtk::Allocation& size) { _analysis_width = (float)size.get_width(); @@ -289,7 +289,7 @@ PluginEqGui::signal_collect_callback(ARDOUR::BufferSet *in, ARDOUR::BufferSet *o for (uint32_t i = 0; i < _plugin_insert->input_streams().n_audio(); ++i) { _signal_input_fft ->analyze(in ->get_audio(i).data(), FFT::HANN); } - + for (uint32_t i = 0; i < _plugin_insert->output_streams().n_audio(); ++i) { _signal_output_fft->analyze(out->get_audio(i).data(), FFT::HANN); } @@ -300,7 +300,7 @@ PluginEqGui::signal_collect_callback(ARDOUR::BufferSet *in, ARDOUR::BufferSet *o _signal_analysis_running = false; // This signals calls expose_analysis_area() - _analysis_area->queue_draw(); + _analysis_area->queue_draw(); } void @@ -326,7 +326,7 @@ PluginEqGui::run_impulse_analysis() // Gather all output, taking latency into account. _impulse_fft->reset(); - + // Silence collect buffers to copy data to, can't use silence() because consecutive calls won't work for (uint32_t i = 0; i < outputs; ++i) { ARDOUR::AudioBuffer &buf = _collect_bufferset.get_audio(i); @@ -361,7 +361,7 @@ PluginEqGui::run_impulse_analysis() //std::cerr << (++C) << ": copying " << length << " frames to _collect_bufferset.get_audio(i)+" << target_offset << " from bufferset at offset " << f << std::endl; for (uint32_t i = 0; i < outputs; ++i) { memcpy(_collect_bufferset.get_audio(i).data(target_offset), - _bufferset.get_audio(i).data() + f, + _bufferset.get_audio(i).data() + f, length * sizeof(float)); } @@ -394,7 +394,7 @@ PluginEqGui::run_impulse_analysis() _impulse_fft->calculate(); // This signals calls expose_analysis_area() - _analysis_area->queue_draw(); + _analysis_area->queue_draw(); } bool @@ -409,8 +409,8 @@ void PluginEqGui::draw_analysis_scales(cairo_t *ref_cr) { // TODO: check whether we need rounding - _analysis_scale_surface = cairo_surface_create_similar(cairo_get_target(ref_cr), - CAIRO_CONTENT_COLOR, + _analysis_scale_surface = cairo_surface_create_similar(cairo_get_target(ref_cr), + CAIRO_CONTENT_COLOR, _analysis_width, _analysis_height); @@ -425,9 +425,9 @@ PluginEqGui::draw_analysis_scales(cairo_t *ref_cr) if (_phase_button->get_active()) { draw_scales_phase(_analysis_area, cr); } - + cairo_destroy(cr); - + } void @@ -440,7 +440,7 @@ PluginEqGui::redraw_analysis_area() if (_analysis_scale_surface == 0) { draw_analysis_scales(cr); } - + cairo_copy_page(cr); @@ -462,7 +462,7 @@ PluginEqGui::redraw_analysis_area() #define PHASE_PROPORTION 0.5 -void +void PluginEqGui::draw_scales_phase(Gtk::Widget */*w*/, cairo_t *cr) { float y; @@ -485,16 +485,16 @@ PluginEqGui::draw_scales_phase(Gtk::Widget */*w*/, cairo_t *cr) cairo_text_extents(cr, buf, &t_ext); cairo_move_to(cr, _analysis_width - t_ext.width - t_ext.x_bearing - 2.0, y - extents.descent); cairo_show_text(cr, buf); - + if (i == 0) continue; - + cairo_set_source_rgba(cr, .8, .9, 0.2, 0.6/(float)i); cairo_move_to(cr, 0.0, y); cairo_line_to(cr, _analysis_width, y); - + y = _analysis_height/2.0 + (float)i*(_analysis_height/8.0)*PHASE_PROPORTION; // label @@ -514,7 +514,7 @@ PluginEqGui::draw_scales_phase(Gtk::Widget */*w*/, cairo_t *cr) } } -void +void PluginEqGui::plot_impulse_phase(Gtk::Widget *w, cairo_t *cr) { float x,y; @@ -533,7 +533,7 @@ PluginEqGui::plot_impulse_phase(Gtk::Widget *w, cairo_t *cr) x *= _analysis_width; y = _analysis_height/2.0 - (_impulse_fft->phase_at_bin(i)/M_PI)*(_analysis_height/2.0)*PHASE_PROPORTION; - + if ( i == 0 ) { cairo_move_to(cr, x, y); @@ -548,8 +548,8 @@ PluginEqGui::plot_impulse_phase(Gtk::Widget *w, cairo_t *cr) avgY = 0; avgNum = 0; - - } + + } prevX = rint(x); avgY += y; @@ -564,7 +564,7 @@ void PluginEqGui::draw_scales_power(Gtk::Widget */*w*/, cairo_t *cr) { static float scales[] = { 30.0, 70.0, 125.0, 250.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0, 15000.0, 20000.0, -1.0 }; - + float divisor = _samplerate / 2.0 / _impulse_fft->bins(); float x; @@ -634,8 +634,8 @@ PluginEqGui::draw_scales_power(Gtk::Widget */*w*/, cairo_t *cr) } } - - + + for (float dB = - _step_dB; dB > _min_dB; dB -= _step_dB ) { snprintf(buf, 256, "%0.0f", dB ); @@ -663,7 +663,7 @@ power_to_dB(float a) return 10.0 * log10f(a); } -void +void PluginEqGui::plot_impulse_amplitude(Gtk::Widget *w, cairo_t *cr) { float x,y; @@ -701,7 +701,7 @@ PluginEqGui::plot_impulse_amplitude(Gtk::Widget *w, cairo_t *cr) avgY = 0; avgNum = 0; - + } prevX = rint(x); @@ -735,7 +735,7 @@ PluginEqGui::plot_signal_amplitude_difference(Gtk::Widget *w, cairo_t *cr) float power_out = power_to_dB(_signal_output_fft->power_at_bin(i)); float power_in = power_to_dB(_signal_input_fft ->power_at_bin(i)); float power = power_out - power_in; - + // for SaBer /* double p = 10.0 * log10( 1.0 + (double)_signal_output_fft->power_at_bin(i) - (double) @@ -775,7 +775,7 @@ PluginEqGui::plot_signal_amplitude_difference(Gtk::Widget *w, cairo_t *cr) avgY = 0; avgNum = 0; - + } prevX = rint(x); @@ -785,5 +785,5 @@ PluginEqGui::plot_signal_amplitude_difference(Gtk::Widget *w, cairo_t *cr) cairo_stroke(cr); - + } diff --git a/gtk2_ardour/plugin_eq_gui.h b/gtk2_ardour/plugin_eq_gui.h index 6b17735250..462cae7aa8 100644 --- a/gtk2_ardour/plugin_eq_gui.h +++ b/gtk2_ardour/plugin_eq_gui.h @@ -37,8 +37,8 @@ class PluginEqGui : public Gtk::Table public: PluginEqGui(boost::shared_ptr<ARDOUR::PluginInsert>); ~PluginEqGui(); - - + + private: // Setup @@ -92,7 +92,7 @@ class PluginEqGui : public Gtk::Table nframes_t _buffer_size; nframes_t _signal_buffer_size; - // buffers + // buffers ARDOUR::BufferSet _bufferset; ARDOUR::BufferSet _collect_bufferset; diff --git a/gtk2_ardour/plugin_interest.h b/gtk2_ardour/plugin_interest.h index 9f6b293325..047fe708c0 100644 --- a/gtk2_ardour/plugin_interest.h +++ b/gtk2_ardour/plugin_interest.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index 7ebe778ecb..50176d8d07 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -152,7 +152,7 @@ PluginSelector::PluginSelector (PluginManager *mgr) table->attach (*filter_box, 0, 7, 5, 6, FILL|EXPAND, FILL, 5, 5); - table->attach(*btn_add, 1, 2, 6, 7, FILL, FILL, 5, 5); + table->attach(*btn_add, 1, 2, 6, 7, FILL, FILL, 5, 5); table->attach(*btn_remove, 3, 4, 6, 7, FILL, FILL, 5, 5); table->attach(*btn_update, 5, 6, 6, 7, FILL, FILL, 5, 5); @@ -172,7 +172,7 @@ PluginSelector::PluginSelector (PluginManager *mgr) plugin_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked)); plugin_display.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::display_selection_changed)); plugin_display.grab_focus(); - + btn_update->signal_clicked().connect (mem_fun(*this, &PluginSelector::btn_update_clicked)); btn_add->signal_clicked().connect(mem_fun(*this, &PluginSelector::btn_add_clicked)); btn_remove->signal_clicked().connect(mem_fun(*this, &PluginSelector::btn_remove_clicked)); @@ -192,7 +192,7 @@ void PluginSelector::set_session (Session* s) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &PluginSelector::set_session), s)); - + session = s; if (session) { @@ -211,7 +211,7 @@ PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& } if (!filterstr.empty()) { - + if (mode == _("Name contains")) { compstr = info->name; } else if (mode == _("Category contains")) { @@ -237,7 +237,7 @@ PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& compstr = info->creator; } else if (mode == _("Library contains")) { compstr = info->path; - } + } if (compstr.empty()) { return false; @@ -260,7 +260,7 @@ PluginSelector::setup_filter_string (string& filterstr) { filterstr = filter_entry.get_text (); transform (filterstr.begin(), filterstr.end(), filterstr.begin(), ::toupper); -} +} void PluginSelector::refill () @@ -310,15 +310,15 @@ PluginSelector::refiller (const PluginInfoList& plugs, const::std::string& filte newrow[plugin_columns.audio_ins] = buf; snprintf (buf, sizeof(buf), "%d", (*i)->n_inputs.n_midi()); newrow[plugin_columns.midi_ins] = buf; - - snprintf (buf, sizeof(buf), "%d", (*i)->n_outputs.n_audio()); + + snprintf (buf, sizeof(buf), "%d", (*i)->n_outputs.n_audio()); newrow[plugin_columns.audio_outs] = buf; - snprintf (buf, sizeof(buf), "%d", (*i)->n_outputs.n_midi()); + snprintf (buf, sizeof(buf), "%d", (*i)->n_outputs.n_midi()); newrow[plugin_columns.midi_outs] = buf; newrow[plugin_columns.plugin] = *i; } - } + } } void @@ -352,7 +352,7 @@ void PluginSelector::au_refiller (const std::string& filterstr) #else PluginSelector::au_refiller (const std::string&) -#endif +#endif { #ifdef HAVE_AUDIOUNITS refiller (manager->au_plugin_info(), filterstr, "AU"); @@ -393,7 +393,7 @@ void PluginSelector::btn_remove_clicked() { TreeModel::iterator iter = added_list.get_selection()->get_selected(); - + amodel->erase(iter); if (amodel->children().empty()) { set_response_sensitive (RESPONSE_APPLY, false); @@ -448,7 +448,7 @@ PluginSelector::run () if (interested_object && !plugins.empty()) { interested_object->use_plugins (plugins); } - + break; default: @@ -474,7 +474,7 @@ PluginSelector::filter_entry_changed () refill (); } -void +void PluginSelector::filter_mode_changed () { std::string mode = filter_mode.get_active_text (); @@ -507,7 +507,7 @@ struct PluginMenuCompare { /* same creator ... compare names */ if (strcasecmp (a->name.c_str(), b->name.c_str()) < 0) { return true; - } + } } return false; } @@ -524,7 +524,7 @@ PluginSelector::plugin_menu() if (!_menu) { _menu = new Menu(); _menu->set_name("ArdourContextMenu"); - } + } MenuList& items = _menu->items(); Menu* favs = new Menu(); @@ -561,9 +561,9 @@ PluginSelector::plugin_menu() if (manager->is_a_favorite_plugin (*i)) { favs->items().push_back (MenuElem ((*i)->name, (bind (mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)))); } - + /* stupid LADSPA creator strings */ - + while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos; creator = creator.substr (0, pos); @@ -575,10 +575,10 @@ PluginSelector::plugin_menu() submenu_map.insert (pair<Glib::ustring,Menu*> (creator, submenu)); submenu->set_name("ArdourContextMenu"); } - + submenu->items().push_back (MenuElem ((*i)->name, (bind (mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)))); } - + return *_menu; } @@ -596,7 +596,7 @@ PluginSelector::plugin_chosen_from_menu (const PluginInfoPtr& pi) interested_object = 0; } -void +void PluginSelector::favorite_changed (const Glib::ustring& path) { PluginInfoPtr pi; @@ -606,9 +606,9 @@ PluginSelector::favorite_changed (const Glib::ustring& path) } in_row_change = true; - + TreeModel::iterator iter = plugin_model->get_iter (path); - + if (iter) { bool favorite = !(*iter)[plugin_columns.favorite]; @@ -620,13 +620,13 @@ PluginSelector::favorite_changed (const Glib::ustring& path) /* save new favorites list */ pi = (*iter)[plugin_columns.plugin]; - + if (favorite) { manager->add_favorite (pi->type, pi->unique_id); } else { manager->remove_favorite (pi->type, pi->unique_id); } - + manager->save_favorites (); } in_row_change = false; diff --git a/gtk2_ardour/plugin_selector.h b/gtk2_ardour/plugin_selector.h index bd9bd12008..dc09c30645 100644 --- a/gtk2_ardour/plugin_selector.h +++ b/gtk2_ardour/plugin_selector.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ class PluginSelector : public ArdourDialog PluginSelector (ARDOUR::PluginManager *); void set_interested_object (PluginInterestedObject&); - + int run (); // XXX should we try not to overload the non-virtual Gtk::Dialog::run() ? void set_session (ARDOUR::Session*); @@ -62,7 +62,7 @@ class PluginSelector : public ArdourDialog void filter_button_clicked (); void filter_entry_changed (); void filter_mode_changed (); - + struct PluginColumns : public Gtk::TreeModel::ColumnRecord { PluginColumns () { add (favorite); diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index 43c98b0ef2..5af2c1ad0d 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -93,7 +93,7 @@ PluginUIWindow::PluginUIWindow (Gtk::Window* win, boost::shared_ptr<PluginInsert case ARDOUR::AudioUnit: have_gui = create_audiounit_editor (insert); break; - + case ARDOUR::LADSPA: error << _("Eh? LADSPA plugins don't have editors!") << endmsg; break; @@ -113,12 +113,12 @@ PluginUIWindow::PluginUIWindow (Gtk::Window* win, boost::shared_ptr<PluginInsert throw failed_constructor (); } - } + } if (!have_gui) { GenericPluginUI* pu = new GenericPluginUI (insert, scrollable); - + _pluginui = pu; add( *pu ); @@ -127,7 +127,7 @@ PluginUIWindow::PluginUIWindow (Gtk::Window* win, boost::shared_ptr<PluginInsert hbox->pack_start( *pu); // TODO: this should be nicer hbox->pack_start( eqgui_bin ); - + add (*manage(hbox)); */ @@ -143,7 +143,7 @@ PluginUIWindow::PluginUIWindow (Gtk::Window* win, boost::shared_ptr<PluginInsert signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window*> (this)), false); death_connection = insert->GoingAway.connect (mem_fun(*this, &PluginUIWindow::plugin_going_away)); - + gint h = _pluginui->get_preferred_height (); gint w = _pluginui->get_preferred_width (); @@ -156,7 +156,7 @@ PluginUIWindow::PluginUIWindow (Gtk::Window* win, boost::shared_ptr<PluginInsert } } - set_default_size (w, h); + set_default_size (w, h); } PluginUIWindow::~PluginUIWindow () @@ -250,7 +250,7 @@ bool PluginUIWindow::create_vst_editor(boost::shared_ptr<PluginInsert> insert) #else PluginUIWindow::create_vst_editor(boost::shared_ptr<PluginInsert>) -#endif +#endif { #ifndef VST_SUPPORT return false; @@ -264,7 +264,7 @@ PluginUIWindow::create_vst_editor(boost::shared_ptr<PluginInsert>) throw failed_constructor (); } else { VSTPluginUI* vpu = new VSTPluginUI (insert, vp); - + _pluginui = vpu; add (*vpu); vpu->package (*this); @@ -280,7 +280,7 @@ bool PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PluginInsert> insert) #else PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PluginInsert>) -#endif +#endif { #if !defined(HAVE_AUDIOUNITS) || !defined(GTKOSX) return false; @@ -302,7 +302,7 @@ void PluginUIWindow::app_activated (bool yn) #else PluginUIWindow::app_activated (bool) -#endif +#endif { #if defined (HAVE_AUDIOUNITS) && defined(GTKOSX) cerr << "APP activated ? " << yn << endl; @@ -318,7 +318,7 @@ PluginUIWindow::app_activated (bool) hide (); _pluginui->deactivate (); } - } + } #endif } @@ -330,7 +330,7 @@ PluginUIWindow::create_lv2_editor(boost::shared_ptr<PluginInsert> insert) #else boost::shared_ptr<LV2Plugin> vp; - + if ((vp = boost::dynamic_pointer_cast<LV2Plugin> (insert->plugin())) == 0) { error << _("create_lv2_editor called on non-LV2 plugin") << endmsg; throw failed_constructor (); @@ -362,7 +362,7 @@ void PluginUIWindow::plugin_going_away () { ENSURE_GUI_THREAD(mem_fun(*this, &PluginUIWindow::plugin_going_away)); - + if (_pluginui) { _pluginui->stop_updating(0); } @@ -406,7 +406,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi) focus_out_image = new Image (get_icon (X_("computer_keyboard"))); focus_in_image = new Image (get_icon (X_("computer_keyboard_active"))); - + focus_button.add (*focus_out_image); ARDOUR_UI::instance()->set_tip (&focus_button, _("Click to allow the plugin to receive keyboard events that Ardour would normally use as a shortcut"), ""); @@ -547,17 +547,17 @@ PlugUIBase::focus_toggled (GdkEventButton*) void PlugUIBase::toggle_plugin_analysis() { - if (plugin_analysis_expander.get_expanded() && + if (plugin_analysis_expander.get_expanded() && !plugin_analysis_expander.get_child()) { // Create the GUI PluginEqGui *foo = new PluginEqGui(insert); plugin_analysis_expander.add( *foo ); plugin_analysis_expander.show_all(); - } - + } + Gtk::Widget *gui; - if (!plugin_analysis_expander.get_expanded() && + if (!plugin_analysis_expander.get_expanded() && (gui = plugin_analysis_expander.get_child())) { // Hide & remove gui->hide(); diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 91e93dcae0..a80a3971df 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -82,7 +82,7 @@ class PlugUIBase : public virtual sigc::trackable virtual gint get_preferred_width () = 0; virtual bool start_updating(GdkEventAny*) = 0; virtual bool stop_updating(GdkEventAny*) = 0; - + virtual void activate () {} virtual void deactivate () {} @@ -127,10 +127,10 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox public: GenericPluginUI (boost::shared_ptr<ARDOUR::PluginInsert> plug, bool scrollable=false); ~GenericPluginUI (); - + gint get_preferred_height () { return prefheight; } gint get_preferred_width () { return -1; } - + bool start_updating(GdkEventAny*); bool stop_updating(GdkEventAny*); @@ -139,7 +139,7 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox Gtk::HBox settings_box; Gtk::HBox hpacker; - + Gtk::Table button_table; Gtk::Table output_table; @@ -160,8 +160,8 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox bool min_unbound; bool max_unbound; bool packed; - - MeterInfo (int /*i*/) { + + MeterInfo (int /*i*/) { meter = 0; packed = false; min = 1.0e10; @@ -170,7 +170,7 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox max_unbound = false; } }; - + static const int32_t initial_button_rows = 6; static const int32_t initial_button_cols = 1; static const int32_t initial_output_rows = 1; @@ -182,9 +182,9 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox boost::shared_ptr<ARDOUR::AutomationControl> control; Evoral::Parameter parameter() { return control->parameter(); } - + /* input */ - + Gtk::ComboBoxText* combo; std::map<std::string, float>* combo_map; Gtk::ToggleButton* button; @@ -195,7 +195,7 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox bool update_pending; char ignore_change; Gtk::Button automate_button; - + /* output */ Gtk::EventBox *display; @@ -206,13 +206,13 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox MeterInfo * meterinfo; ControlUI (); - ~ControlUI(); + ~ControlUI(); }; - + std::vector<ControlUI*> output_controls; sigc::connection screen_update_connection; void output_update(); - + void build (); ControlUI* build_control_ui (guint32 port_index, boost::shared_ptr<ARDOUR::AutomationControl>); std::vector<std::string> setup_scale_values(guint32 port_index, ControlUI* cui); @@ -292,7 +292,7 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox Gtk::Socket socket; Gtk::HBox preset_box; Gtk::VBox vpacker; - + bool configure_handler (GdkEventConfigure*, Gtk::Socket*); void save_plugin_setting (); }; diff --git a/gtk2_ardour/point_selection.h b/gtk2_ardour/point_selection.h index 342a6505d8..0b89f34454 100644 --- a/gtk2_ardour/point_selection.h +++ b/gtk2_ardour/point_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ #include "automation_selectable.h" -struct PointSelection : public std::list<AutomationSelectable> +struct PointSelection : public std::list<AutomationSelectable> { }; diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc index 94bb2c49e7..1537ea88ee 100644 --- a/gtk2_ardour/port_group.cc +++ b/gtk2_ardour/port_group.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ using namespace ARDOUR; PortGroup::PortGroup (std::string const & n) : name (n), _visible (true) { - + } void @@ -112,7 +112,7 @@ PortGroup::remove_bundle (boost::shared_ptr<Bundle> b) i->changed_connection.disconnect (); _bundles.erase (i); - + Changed (); } @@ -186,7 +186,7 @@ PortGroup::io_from_bundle (boost::shared_ptr<ARDOUR::Bundle> b) const PortGroupList::PortGroupList () : _type (DataType::AUDIO), _signals_suspended (false), _pending_change (false) { - + } void @@ -206,11 +206,11 @@ PortGroupList::maybe_add_processor_to_bundle (boost::weak_ptr<Processor> wp, boo } boost::shared_ptr<IOProcessor> iop = boost::dynamic_pointer_cast<IOProcessor> (p); - + if (iop) { boost::shared_ptr<IO> io = inputs ? iop->input() : iop->output(); - + if (io && used_io.find (io) == used_io.end()) { rb->add_processor_bundle (io->bundle ()); used_io.insert (io); @@ -241,11 +241,11 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs) /* keep track of IOs that we have taken bundles from, so that maybe_add_processor... below can avoid taking the same IO from both Route::output() and the main_outs Delivery */ - + set<boost::shared_ptr<IO> > used_io; boost::shared_ptr<IO> io = inputs ? (*i)->input() : (*i)->output(); used_io.insert (io); - + boost::shared_ptr<RouteBundle> rb (new RouteBundle (io->bundle())); (*i)->foreach_processor (bind (mem_fun (*this, &PortGroupList::maybe_add_processor_to_bundle), rb, inputs, used_io)); @@ -258,7 +258,7 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs) g = track; } else if (!boost::dynamic_pointer_cast<MidiTrack>(*i)) { g = bus; - } + } } else if (_type == DataType::MIDI) { @@ -268,8 +268,8 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs) } /* No MIDI busses yet */ - } - + } + if (g) { TimeAxisView* tv = PublicEditor::instance().axis_view_from_route (i->get()); @@ -283,7 +283,7 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs) /* Bundles owned by the session. We only add the mono ones and the User ones otherwise there is duplication of the same ports within the matrix */ - + boost::shared_ptr<BundleList> b = session.bundles (); for (BundleList::iterator i = b->begin(); i != b->end(); ++i) { if ((*i)->ports_are_inputs() == inputs && (*i)->type() == _type) { @@ -291,7 +291,7 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs) if ((*i)->nchannels() == 1 || boost::dynamic_pointer_cast<UserBundle> (*i)) { system->add_bundle (*i); } - + } } @@ -307,7 +307,7 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs) std::vector<std::string> extra_system; std::vector<std::string> extra_other; - const char **ports = session.engine().get_ports ("", _type.to_jack_type(), inputs ? + const char **ports = session.engine().get_ports ("", _type.to_jack_type(), inputs ? JackPortIsInput : JackPortIsOutput); if (ports) { @@ -318,11 +318,11 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs) client_matching_string += ':'; while (ports[n]) { - + std::string const p = ports[n]; if (!system->has_port(p) && !bus->has_port(p) && !track->has_port(p) && !ardour->has_port(p) && !other->has_port(p)) { - + if (port_has_prefix (p, "system:") || port_has_prefix (p, "alsa_pcm") || port_has_prefix (p, "ardour:")) { @@ -331,7 +331,7 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs) extra_other.push_back (p); } } - + ++n; } @@ -405,7 +405,7 @@ PortGroupList::common_prefix_before (std::vector<std::string> const & p, std::st return fp; } - + std::string PortGroupList::common_prefix (std::vector<std::string> const & p) const @@ -443,11 +443,11 @@ PortGroup::BundleList const & PortGroupList::bundles () const { _bundles.clear (); - + for (PortGroupList::List::const_iterator i = begin (); i != end (); ++i) { std::copy ((*i)->bundles().begin(), (*i)->bundles().end(), std::back_inserter (_bundles)); } - + return _bundles; } @@ -455,7 +455,7 @@ uint32_t PortGroupList::total_visible_channels () const { uint32_t n = 0; - + for (PortGroupList::List::const_iterator i = begin(); i != end(); ++i) { if ((*i)->visible()) { n += (*i)->total_channels (); @@ -470,9 +470,9 @@ void PortGroupList::add_group (boost::shared_ptr<PortGroup> g) { _groups.push_back (g); - + g->Changed.connect (sigc::mem_fun (*this, &PortGroupList::emit_changed)); - + _bundle_changed_connections.push_back ( g->BundleChanged.connect (sigc::hide (sigc::mem_fun (*this, &PortGroupList::emit_changed))) ); @@ -499,7 +499,7 @@ PortGroupList::emit_changed () Changed (); } } - + void PortGroupList::suspend_signals () { @@ -544,7 +544,7 @@ void RouteBundle::reread_component_bundles () { suspend_signals (); - + remove_channels (); set_name (_route->name()); @@ -556,7 +556,7 @@ RouteBundle::reread_component_bundles () add_port_to_channel (i, pl[j]); } } - + for (std::vector<boost::shared_ptr<Bundle> >::iterator i = _processor.begin(); i != _processor.end(); ++i) { add_channels_from_bundle (*i); } @@ -569,7 +569,7 @@ RouteBundle::add_processor_bundle (boost::shared_ptr<Bundle> p) { p->Changed.connect (sigc::hide (sigc::mem_fun (*this, &RouteBundle::reread_component_bundles))); _processor.push_back (p); - + reread_component_bundles (); } - + diff --git a/gtk2_ardour/port_group.h b/gtk2_ardour/port_group.h index dbdcfc06ca..cf6fba8e53 100644 --- a/gtk2_ardour/port_group.h +++ b/gtk2_ardour/port_group.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,8 +17,8 @@ */ -#ifndef __gtk_ardour_port_group_h__ -#define __gtk_ardour_port_group_h__ +#ifndef __gtk_ardour_port_group_h__ +#define __gtk_ardour_port_group_h__ #include <vector> #include <string> @@ -87,7 +87,7 @@ public: BundleList const & bundles () const { return _bundles; } - + private: void bundle_changed (ARDOUR::Bundle::Change); @@ -154,7 +154,7 @@ public: private: void reread_component_bundles (); - + boost::shared_ptr<ARDOUR::Bundle> _route; std::vector<boost::shared_ptr<ARDOUR::Bundle> > _processor; }; diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc index 0e35427a28..b8fe7d3333 100644 --- a/gtk2_ardour/port_matrix.cc +++ b/gtk2_ardour/port_matrix.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -62,7 +62,7 @@ PortMatrix::PortMatrix (Window* parent, Session& session, DataType type) for (int i = 0; i < 2; ++i) { _ports[i].set_type (type); - + /* watch for the content of _ports[] changing */ _ports[i].Changed.connect (mem_fun (*this, &PortMatrix::setup)); } @@ -78,13 +78,13 @@ PortMatrix::PortMatrix (Window* parent, Session& session, DataType type) /* and also ports */ _session.engine().PortRegisteredOrUnregistered.connect (mem_fun (*this, &PortMatrix::setup_all_ports)); - + reconnect_to_routes (); attach (*_body, 0, 1, 0, 1); attach (_vscroll, 1, 2, 0, 1, SHRINK); attach (_hscroll, 0, 1, 1, 2, FILL | EXPAND, SHRINK); - + show_all (); } @@ -140,7 +140,7 @@ PortMatrix::set_type (DataType t) _type = t; _ports[0].set_type (_type); _ports[1].set_type (_type); - + setup_all_ports (); } @@ -185,7 +185,7 @@ PortMatrix::disassociate_all () for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) { for (PortGroup::BundleList::iterator k = b.begin(); k != b.end(); ++k) { for (uint32_t l = 0; l < k->bundle->nchannels(); ++l) { - + BundleChannel c[2] = { BundleChannel (i->bundle, j), BundleChannel (k->bundle, l) @@ -217,7 +217,7 @@ PortMatrix::select_arrangement () maintain notional `signal flow' vaguely from left to right. Subclasses should choose where to put ports based on signal flowing from _ports[0] to _ports[1] */ - + if (N[0] > N[1]) { _row_index = 0; @@ -254,12 +254,12 @@ PortMatrix::popup_menu ( ) { using namespace Menu_Helpers; - + delete _menu; _menu = new Menu; _menu->set_name ("ArdourContextMenu"); - + MenuList& items = _menu->items (); boost::shared_ptr<PortGroup> pg[2]; @@ -286,8 +286,8 @@ PortMatrix::popup_menu ( snprintf (buf, sizeof (buf), _("Add %s"), channel_noun().c_str()); sub.push_back (MenuElem (buf, bind (mem_fun (*this, &PortMatrix::add_channel_proxy), w))); } - - + + if (can_rename_channels (bc[dim].bundle)) { snprintf (buf, sizeof (buf), _("Rename '%s'..."), bc[dim].bundle->channel_name (bc[dim].channel).c_str()); sub.push_back ( @@ -299,7 +299,7 @@ PortMatrix::popup_menu ( } sub.push_back (SeparatorElem ()); - + if (can_remove_channels (bc[dim].bundle)) { snprintf (buf, sizeof (buf), _("Remove '%s'"), bc[dim].bundle->channel_name (bc[dim].channel).c_str()); sub.push_back ( @@ -308,7 +308,7 @@ PortMatrix::popup_menu ( bind (mem_fun (*this, &PortMatrix::remove_channel_proxy), w, bc[dim].channel) ) ); - } + } if (_show_only_bundles) { snprintf (buf, sizeof (buf), _("%s all"), disassociation_verb().c_str()); @@ -319,7 +319,7 @@ PortMatrix::popup_menu ( bc[dim].bundle->channel_name (bc[dim].channel).c_str() ); } - + sub.push_back ( MenuElem (buf, bind (mem_fun (*this, &PortMatrix::disassociate_all_on_channel), w, bc[dim].channel, dim)) ); @@ -335,13 +335,13 @@ PortMatrix::popup_menu ( } need_separator = false; - + for (int dim = 0; dim < 2; ++dim) { if (pg[dim]) { boost::weak_ptr<PortGroup> wp (pg[dim]); - + if (pg[dim]->visible()) { if (dim == 0) { if (pg[dim]->name.empty()) { @@ -389,7 +389,7 @@ PortMatrix::popup_menu ( _inhibit_toggle_show_only_bundles = true; i->set_active (!_show_only_bundles); _inhibit_toggle_show_only_bundles = false; - + _menu->popup (1, t); } @@ -456,7 +456,7 @@ void PortMatrix::setup_all_ports () { ENSURE_GUI_THREAD (mem_fun (*this, &PortMatrix::setup_all_ports)); - + setup_ports (0); setup_ports (1); } @@ -467,7 +467,7 @@ PortMatrix::toggle_show_only_bundles () if (_inhibit_toggle_show_only_bundles) { return; } - + _show_only_bundles = !_show_only_bundles; _body->setup (); setup_scrollbars (); @@ -512,7 +512,7 @@ PortMatrix::on_scroll_event (GdkEventScroll* ev) { double const h = _hscroll.get_value (); double const v = _vscroll.get_value (); - + switch (ev->direction) { case GDK_SCROLL_UP: _vscroll.set_value (v - PortMatrixComponent::grid_spacing ()); diff --git a/gtk2_ardour/port_matrix.h b/gtk2_ardour/port_matrix.h index b3d94055eb..a4366897c6 100644 --- a/gtk2_ardour/port_matrix.h +++ b/gtk2_ardour/port_matrix.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -58,7 +58,7 @@ public: ARDOUR::DataType type () const { return _type; } - + void disassociate_all (); void setup_scrollbars (); void popup_menu ( @@ -105,7 +105,7 @@ public: PortGroupList const * ports (int d) const { return &_ports[d]; } - + void setup (); virtual void setup_ports (int) = 0; void setup_all_ports (); @@ -133,7 +133,7 @@ public: virtual void rename_channel (ARDOUR::BundleChannel) {} virtual std::string disassociation_verb () const = 0; virtual std::string channel_noun () const { return _("channel"); } - + enum Result { Cancelled, Accepted @@ -151,7 +151,7 @@ protected: inputs and outputs should put outputs in list 0 and inputs in list 1. */ PortGroupList _ports[2]; ARDOUR::Session& _session; - + private: void hscroll_changed (); diff --git a/gtk2_ardour/port_matrix_body.cc b/gtk2_ardour/port_matrix_body.cc index 08849ee165..b3398d850f 100644 --- a/gtk2_ardour/port_matrix_body.cc +++ b/gtk2_ardour/port_matrix_body.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ PortMatrixBody::PortMatrixBody (PortMatrix* p) _column_labels = new PortMatrixColumnLabels (p, this); _row_labels = new PortMatrixRowLabels (p, this); _grid = new PortMatrixGrid (p, this); - + add_events (Gdk::LEAVE_NOTIFY_MASK | Gdk::POINTER_MOTION_MASK); } @@ -57,7 +57,7 @@ PortMatrixBody::on_expose_event (GdkEventExpose* event) ); bool intersects; - + Gdk::Rectangle r = exposure; /* the get_pixmap call may cause things to be rerendered and sizes to change, so fetch the pixmap before calculating where to put it */ @@ -131,7 +131,7 @@ PortMatrixBody::on_expose_event (GdkEventExpose* event) set_cairo_clip (cr, _column_labels->parent_rectangle ()); _column_labels->draw_extra (cr); cairo_restore (cr); - + cairo_destroy (cr); return true; @@ -205,7 +205,7 @@ PortMatrixBody::compute_rectangles () grid_rect.set_width (x); row_rect.set_x (x); row_rect.set_width (_alloc_width - x); - + } else if (_matrix->arrangement() == PortMatrix::LEFT_TO_BOTTOM) { @@ -224,7 +224,7 @@ PortMatrixBody::compute_rectangles () col_rect.set_width (grid_rect.get_width () + col_overhang); col_rect.set_x (row_rect.get_width() + grid_rect.get_width() - col_rect.get_width()); col_rect.set_y (row_rect.get_height()); - + } _row_labels->set_parent_rectangle (row_rect); @@ -236,21 +236,21 @@ void PortMatrixBody::setup () { /* Discard any old connections to bundles */ - + for (list<sigc::connection>::iterator i = _bundle_connections.begin(); i != _bundle_connections.end(); ++i) { i->disconnect (); } _bundle_connections.clear (); /* Connect to bundles so that we find out when their names change */ - + PortGroup::BundleList r = _matrix->rows()->bundles (); for (PortGroup::BundleList::iterator i = r.begin(); i != r.end(); ++i) { - + _bundle_connections.push_back ( i->bundle->Changed.connect (sigc::hide (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_row_labels))) ); - + } PortGroup::BundleList c = _matrix->columns()->bundles (); @@ -259,7 +259,7 @@ PortMatrixBody::setup () i->bundle->Changed.connect (sigc::hide (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_column_labels))) ); } - + _column_labels->setup (); _row_labels->setup (); _grid->setup (); @@ -325,7 +325,7 @@ PortMatrixBody::on_button_press_event (GdkEventButton* ev) _row_labels->parent_to_component_y (ev->y), ev->button, ev->time ); - + } else if (Gdk::Region (_column_labels->parent_rectangle()).point_in (ev->x, ev->y)) { _column_labels->button_press ( @@ -346,7 +346,7 @@ PortMatrixBody::on_button_release_event (GdkEventButton* ev) _row_labels->clear_channel_highlights (); _column_labels->clear_channel_highlights (); - + } else if (Gdk::Region (_grid->parent_rectangle()).point_in (ev->x, ev->y)) { _grid->button_release ( @@ -395,14 +395,14 @@ bool PortMatrixBody::on_motion_notify_event (GdkEventMotion* ev) { if (Gdk::Region (_grid->parent_rectangle()).point_in (ev->x, ev->y)) { - + _grid->motion ( _grid->parent_to_component_x (ev->x), _grid->parent_to_component_y (ev->y) ); - + _mouse_over_grid = true; - + } else { if (_mouse_over_grid) { set_mouseover (PortMatrixNode ()); @@ -422,7 +422,7 @@ PortMatrixBody::set_mouseover (PortMatrixNode const & n) PortMatrixNode old = _mouseover; _mouseover = n; - + _grid->mouseover_changed (old); _row_labels->mouseover_changed (old); _column_labels->mouseover_changed (old); @@ -480,6 +480,6 @@ PortMatrixBody::max_size () const pair<uint32_t, uint32_t> const col = _column_labels->dimensions (); pair<uint32_t, uint32_t> const row = _row_labels->dimensions (); pair<uint32_t, uint32_t> const grid = _grid->dimensions (); - + return make_pair (std::max (row.first, _column_labels->overhang()) + grid.first, col.second + grid.second); } diff --git a/gtk2_ardour/port_matrix_body.h b/gtk2_ardour/port_matrix_body.h index bbc72ddc7e..9195608d28 100644 --- a/gtk2_ardour/port_matrix_body.h +++ b/gtk2_ardour/port_matrix_body.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,7 +55,7 @@ public: void set_yoffset (uint32_t); void rebuild_and_draw_grid (); - + void set_mouseover (PortMatrixNode const &); PortMatrixNode mouseover () const { return _mouseover; @@ -73,7 +73,7 @@ protected: bool on_button_release_event (GdkEventButton *); bool on_leave_notify_event (GdkEventCrossing *); bool on_motion_notify_event (GdkEventMotion *); - + private: void compute_rectangles (); void rebuild_and_draw_column_labels (); diff --git a/gtk2_ardour/port_matrix_column_labels.cc b/gtk2_ardour/port_matrix_column_labels.cc index 6dec2524d0..fa3d3dd030 100644 --- a/gtk2_ardour/port_matrix_column_labels.cc +++ b/gtk2_ardour/port_matrix_column_labels.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,13 +54,13 @@ PortMatrixColumnLabels::compute_dimensions () for (PortGroupList::List::const_iterator i = _matrix->columns()->begin(); i != _matrix->columns()->end(); ++i) { PortGroup::BundleList const c = _matrix->columns()->bundles(); for (PortGroup::BundleList::const_iterator j = c.begin (); j != c.end(); ++j) { - + cairo_text_extents_t ext; cairo_text_extents (cr, j->bundle->name().c_str(), &ext); if (ext.width > _longest_bundle_name) { _longest_bundle_name = ext.width; } - + if (ext.height > _highest_text) { _highest_text = ext.height; } @@ -76,7 +76,7 @@ PortMatrixColumnLabels::compute_dimensions () if (ext.width > _longest_channel_name) { _longest_channel_name = ext.width; } - + if (ext.height > _highest_text) { _highest_text = ext.height; } @@ -127,10 +127,10 @@ PortMatrixColumnLabels::render (cairo_t* cr) cairo_fill (cr); /* PORT GROUP NAME */ - + double x = 0; double y = 0; - + if (_matrix->arrangement() == PortMatrix::TOP_TO_RIGHT) { x = slanted_height() / tan (angle()); y = _highest_group_name + name_pad(); @@ -157,7 +157,7 @@ PortMatrixColumnLabels::render (cairo_t* cr) if (w == 0) { continue; } - + /* rectangle */ set_source_rgb (cr, get_a_group_colour (g)); double const rh = _highest_group_name + 2 * name_pad(); @@ -167,18 +167,18 @@ PortMatrixColumnLabels::render (cairo_t* cr) cairo_rectangle (cr, x, _height - rh, w, rh); } cairo_fill (cr); - + string const upper = Glib::ustring ((*i)->name).uppercase (); pair<string, double> const display = fit_to_pixels (cr, upper, w); - + /* plot it */ set_source_rgb (cr, text_colour()); cairo_move_to (cr, x + (w - display.second) / 2, y); cairo_show_text (cr, display.first.c_str()); - + x += w; ++g; - + } /* BUNDLE PARALLELOGRAM-TYPE-THING AND NAME */ @@ -189,13 +189,13 @@ PortMatrixColumnLabels::render (cairo_t* cr) for (PortGroupList::List::const_iterator i = _matrix->columns()->begin(); i != _matrix->columns()->end(); ++i) { if ((*i)->visible ()) { - + PortGroup::BundleList const & bundles = (*i)->bundles (); for (PortGroup::BundleList::const_iterator j = bundles.begin (); j != bundles.end(); ++j) { Gdk::Color c = j->has_colour ? j->colour : get_a_bundle_colour (N); render_bundle_name (cr, background_colour (), c, x, 0, j->bundle); - + if (_matrix->show_only_bundles()) { x += grid_spacing(); } else { @@ -211,7 +211,7 @@ PortMatrixColumnLabels::render (cairo_t* cr) } } - + /* PORT NAMES */ @@ -221,16 +221,16 @@ PortMatrixColumnLabels::render (cairo_t* cr) for (PortGroupList::List::const_iterator i = _matrix->columns()->begin(); i != _matrix->columns()->end(); ++i) { if ((*i)->visible ()) { - + PortGroup::BundleList const & bundles = (*i)->bundles (); for (PortGroup::BundleList::const_iterator j = bundles.begin (); j != bundles.end(); ++j) { - + for (uint32_t k = 0; k < j->bundle->nchannels(); ++k) { Gdk::Color c = j->has_colour ? j->colour : get_a_bundle_colour (N); render_channel_name (cr, background_colour (), c, x, 0, ARDOUR::BundleChannel (j->bundle, k)); x += grid_spacing(); } - + ++N; } @@ -280,10 +280,10 @@ vector<pair<double, double> > PortMatrixColumnLabels::port_name_shape (double xoff, double yoff) const { vector<pair<double, double> > shape; - + double const lc = _longest_channel_name + name_pad(); double const w = grid_spacing(); - + if (_matrix->arrangement() == PortMatrix::LEFT_TO_BOTTOM) { double x_ = xoff + slanted_height() / tan (angle()) + w; @@ -297,9 +297,9 @@ PortMatrixColumnLabels::port_name_shape (double xoff, double yoff) const x_ += w * pow (sin (angle()), 2); y_ += w * sin (angle()) * cos (angle()); shape.push_back (make_pair (x_, y_)); - + } else { - + double x_ = xoff; double y_ = yoff + _height; shape.push_back (make_pair (x_, y_)); @@ -329,7 +329,7 @@ PortMatrixColumnLabels::render_bundle_name ( } else { w = b->nchannels() * grid_spacing(); } - + double x_ = xoff; uint32_t y = yoff; @@ -355,7 +355,7 @@ PortMatrixColumnLabels::render_bundle_name ( cairo_stroke (cr); set_source_rgb (cr, text_colour()); - + if (_matrix->arrangement() == PortMatrix::TOP_TO_RIGHT) { double rl = 0; @@ -369,16 +369,16 @@ PortMatrixColumnLabels::render_bundle_name ( xoff + basic_text_x_pos (0) + rl * cos (angle()), yoff + _height - rl * sin (angle()) ); - + } else { - + cairo_move_to ( cr, xoff + basic_text_x_pos (0), yoff + slanted_height() - name_pad() * sin (angle()) ); } - + cairo_save (cr); cairo_rotate (cr, -angle()); cairo_show_text (cr, b->name().c_str()); @@ -397,15 +397,15 @@ PortMatrixColumnLabels::render_channel_name ( cairo_line_to (cr, shape[i].first, shape[i].second); } cairo_line_to (cr, shape[0].first, shape[0].second); - + set_source_rgb (cr, bg_colour); cairo_fill_preserve (cr); set_source_rgb (cr, fg_colour); cairo_set_line_width (cr, label_border_width()); cairo_stroke (cr); - + set_source_rgb (cr, text_colour()); - + if (_matrix->arrangement() == PortMatrix::TOP_TO_RIGHT) { cairo_move_to ( @@ -413,8 +413,8 @@ PortMatrixColumnLabels::render_channel_name ( xoff + basic_text_x_pos(bc.channel), yoff + _height - name_pad() * sin (angle()) ); - - } else { + + } else { double const rl = 3 * name_pad() + _longest_bundle_name; cairo_move_to ( @@ -423,15 +423,15 @@ PortMatrixColumnLabels::render_channel_name ( yoff + slanted_height() - rl * sin (angle()) ); } - + cairo_save (cr); cairo_rotate (cr, -angle()); - + cairo_show_text ( cr, bc.bundle->channel_name(bc.channel).c_str() ); - + cairo_restore (cr); } @@ -462,13 +462,13 @@ PortMatrixColumnLabels::queue_draw_for (ARDOUR::BundleChannel const & bc) grid_spacing() + _height * tan (angle()) + 2, _height + 2 ); - + } else { - + double const x = channel_x (bc); double const lc = _longest_channel_name + name_pad(); double const h = lc * sin (angle ()) + grid_spacing() * sin (angle()) * cos (angle()); - + if (_matrix->arrangement() == PortMatrix::TOP_TO_RIGHT) { _body->queue_draw_area ( @@ -477,20 +477,20 @@ PortMatrixColumnLabels::queue_draw_for (ARDOUR::BundleChannel const & bc) grid_spacing() + lc * cos (angle()) + 2, h + 2 ); - + } else if (_matrix->arrangement() == PortMatrix::LEFT_TO_BOTTOM) { - + double const x_ = x + slanted_height() / tan (angle()) - lc * cos (angle()); - + _body->queue_draw_area ( component_to_parent_x (x_) - 1, component_to_parent_y (0) - 1, grid_spacing() + lc * cos (angle()) + 2, h + 2 ); - + } - + } } @@ -518,7 +518,7 @@ PortMatrixColumnLabels::button_press (double x, double y, int b, uint32_t t) } pair<boost::shared_ptr<PortGroup>, ARDOUR::BundleChannel> gc = position_to_group_and_channel (cx / grid_spacing(), _matrix->columns()); - + if (b == 1) { if (group_name && gc.first) { @@ -526,7 +526,7 @@ PortMatrixColumnLabels::button_press (double x, double y, int b, uint32_t t) } else if (gc.second.bundle) { _body->highlight_associated_channels (_matrix->column_index(), gc.second); } - + } else if (b == 3) { _matrix->popup_menu ( diff --git a/gtk2_ardour/port_matrix_column_labels.h b/gtk2_ardour/port_matrix_column_labels.h index 8dba7801be..3b1c5a128c 100644 --- a/gtk2_ardour/port_matrix_column_labels.h +++ b/gtk2_ardour/port_matrix_column_labels.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ public: PortMatrixColumnLabels (PortMatrix *, PortMatrixBody *); void button_press (double, double, int, uint32_t); - + double component_to_parent_x (double x) const; double parent_to_component_x (double x) const; double component_to_parent_y (double y) const; @@ -47,14 +47,14 @@ public: uint32_t overhang () const { return _overhang; } - + private: void render_bundle_name (cairo_t *, Gdk::Color, Gdk::Color, double, double, boost::shared_ptr<ARDOUR::Bundle>); void render_channel_name (cairo_t *, Gdk::Color, Gdk::Color, double, double, ARDOUR::BundleChannel const &); double channel_x (ARDOUR::BundleChannel const &) const; double channel_y (ARDOUR::BundleChannel const &) const; void queue_draw_for (ARDOUR::BundleChannel const &); - + void render (cairo_t *); void compute_dimensions (); double basic_text_x_pos (int) const; diff --git a/gtk2_ardour/port_matrix_component.cc b/gtk2_ardour/port_matrix_component.cc index 2f5a498d41..7b83e5d10f 100644 --- a/gtk2_ardour/port_matrix_component.cc +++ b/gtk2_ardour/port_matrix_component.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,7 +33,7 @@ PortMatrixComponent::PortMatrixComponent (PortMatrix* m, PortMatrixBody* b) _render_required (true), _dimension_computation_required (true) { - + } /** Destructor */ @@ -125,7 +125,7 @@ uint32_t PortMatrixComponent::group_size (boost::shared_ptr<const PortGroup> g) const { uint32_t s = 0; - + if (g->visible()) { PortGroup::BundleList const & bundles = g->bundles (); if (_matrix->show_only_bundles()) { @@ -160,7 +160,7 @@ PortMatrixComponent::channel_to_position (ARDOUR::BundleChannel bc, PortGroupLis if (j->bundle == bc.bundle) { /* found the bundle */ - + if (_matrix->show_only_bundles() || !(*i)->visible()) { return p; } else { @@ -212,13 +212,13 @@ PortMatrixComponent::position_to_group_and_channel (uint32_t p, PortGroupList co for (PortGroup::BundleList::const_iterator j = bundles.begin(); j != bundles.end(); ++j) { if (_matrix->show_only_bundles()) { - + if (p == 0) { return make_pair (*i, ARDOUR::BundleChannel (j->bundle, 0)); } else { p -= 1; } - + } else { uint32_t const s = j->bundle->nchannels (); diff --git a/gtk2_ardour/port_matrix_component.h b/gtk2_ardour/port_matrix_component.h index 7e5ed3d8a2..d4cc8619b6 100644 --- a/gtk2_ardour/port_matrix_component.h +++ b/gtk2_ardour/port_matrix_component.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -58,7 +58,7 @@ public: void require_render () { _render_required = true; } - + void require_rebuild () { _dimension_computation_required = true; _render_required = true; @@ -165,7 +165,7 @@ protected: return Gdk::Color ("#444444"); } } - + void set_source_rgb (cairo_t *, Gdk::Color const &); void set_source_rgba (cairo_t *, Gdk::Color const &, double); uint32_t group_size (boost::shared_ptr<const PortGroup>) const; @@ -185,7 +185,7 @@ protected: uint32_t _height; ///< full height of the contents Gdk::Rectangle _parent_rectangle; -private: +private: GdkPixmap* _pixmap; ///< pixmap bool _render_required; ///< true if the rendered pixmap is out of date bool _dimension_computation_required; ///< true if the dimensions are out of date diff --git a/gtk2_ardour/port_matrix_grid.cc b/gtk2_ardour/port_matrix_grid.cc index 8e2f379add..543efa91ca 100644 --- a/gtk2_ardour/port_matrix_grid.cc +++ b/gtk2_ardour/port_matrix_grid.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,7 +33,7 @@ PortMatrixGrid::PortMatrixGrid (PortMatrix* m, PortMatrixBody* b) _drag_valid (false), _moved (false) { - + } void @@ -84,21 +84,21 @@ PortMatrixGrid::render_group_pair (cairo_t* cr, boost::shared_ptr<const PortGrou /* unfortunately we need to compute the height of the row group here */ uint32_t height = group_size (row) * grid_spacing (); - + uint32_t tx = x; /* VERTICAL GRID LINES */ - + set_source_rgb (cr, grid_colour()); uint32_t N = 0; - + for (PortGroup::BundleList::const_iterator i = column_bundles.begin(); i != column_bundles.end(); ++i) { cairo_set_line_width (cr, thick_grid_line_width()); cairo_move_to (cr, tx, y); cairo_line_to (cr, tx, y + height); cairo_stroke (cr); - + if (!_matrix->show_only_bundles()) { cairo_set_line_width (cr, thin_grid_line_width()); for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) { @@ -107,30 +107,30 @@ PortMatrixGrid::render_group_pair (cairo_t* cr, boost::shared_ptr<const PortGrou cairo_line_to (cr, tx, y + height); cairo_stroke (cr); } - + } else { - + tx += grid_spacing (); - + } - + ++N; } uint32_t const width = tx - x; uint32_t ty = y; - + /* HORIZONTAL GRID LINES */ - + N = 0; for (PortGroup::BundleList::const_iterator i = row_bundles.begin(); i != row_bundles.end(); ++i) { - + cairo_set_line_width (cr, thick_grid_line_width()); cairo_move_to (cr, x, ty); cairo_line_to (cr, x + width, ty); cairo_stroke (cr); - + if (!_matrix->show_only_bundles()) { cairo_set_line_width (cr, thin_grid_line_width()); for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) { @@ -145,10 +145,10 @@ PortMatrixGrid::render_group_pair (cairo_t* cr, boost::shared_ptr<const PortGrou ty += grid_spacing (); } - + ++N; } - + /* ASSOCIATION INDICATORS */ uint32_t bx = x; @@ -158,9 +158,9 @@ PortMatrixGrid::render_group_pair (cairo_t* cr, boost::shared_ptr<const PortGrou for (PortGroup::BundleList::const_iterator i = column_bundles.begin(); i != column_bundles.end(); ++i) { by = y; - + for (PortGroup::BundleList::const_iterator j = row_bundles.begin(); j != row_bundles.end(); ++j) { - + PortMatrixNode::State s = get_association (PortMatrixNode ( ARDOUR::BundleChannel (i->bundle, 0), ARDOUR::BundleChannel (j->bundle, 0) @@ -178,58 +178,58 @@ PortMatrixGrid::render_group_pair (cairo_t* cr, boost::shared_ptr<const PortGrou default: break; } - + by += grid_spacing(); } - + bx += grid_spacing(); - + } } else { for (PortGroup::BundleList::const_iterator i = column_bundles.begin(); i != column_bundles.end(); ++i) { by = y; - + for (PortGroup::BundleList::const_iterator j = row_bundles.begin(); j != row_bundles.end(); ++j) { - + tx = bx; for (uint32_t k = 0; k < i->bundle->nchannels (); ++k) { - + ty = by; for (uint32_t l = 0; l < j->bundle->nchannels (); ++l) { - + ARDOUR::BundleChannel c[2]; c[_matrix->column_index()] = ARDOUR::BundleChannel (i->bundle, k); c[_matrix->row_index()] = ARDOUR::BundleChannel (j->bundle, l); - + PortMatrixNode::State const s = _matrix->get_state (c); - + switch (s) { case PortMatrixNode::ASSOCIATED: draw_association_indicator (cr, tx, ty); break; - + case PortMatrixNode::UNKNOWN: draw_unknown_indicator (cr, tx, ty); break; - + case PortMatrixNode::NOT_ASSOCIATED: break; - + default: break; } - + ty += grid_spacing(); } - + tx += grid_spacing(); } - + by += j->bundle->nchannels () * grid_spacing(); } - + bx += i->bundle->nchannels () * grid_spacing(); } } @@ -248,7 +248,7 @@ PortMatrixGrid::draw_association_indicator (cairo_t* cr, uint32_t x, uint32_t y, 0, p * 2 * M_PI ); - + cairo_fill (cr); } @@ -294,12 +294,12 @@ PortMatrixGrid::button_press (double x, double y, int b, uint32_t t) { pair<boost::shared_ptr<PortGroup>, ARDOUR::BundleChannel> px = position_to_group_and_channel (x / grid_spacing(), _matrix->columns()); pair<boost::shared_ptr<PortGroup>, ARDOUR::BundleChannel> py = position_to_group_and_channel (y / grid_spacing(), _matrix->rows()); - + if (b == 1) { _dragging = true; _drag_valid = (px.second.bundle && py.second.bundle); - + _moved = false; _drag_start_x = x / grid_spacing (); _drag_start_y = y / grid_spacing (); @@ -307,7 +307,7 @@ PortMatrixGrid::button_press (double x, double y, int b, uint32_t t) } else if (b == 3) { _matrix->popup_menu (px, py, t); - + } } @@ -320,17 +320,17 @@ PortMatrixGrid::get_association (PortMatrixNode node) const bool have_off_diagonal_association = false; bool have_diagonal_association = false; bool have_diagonal_not_association = false; - + for (uint32_t i = 0; i < node.row.bundle->nchannels (); ++i) { - + for (uint32_t j = 0; j < node.column.bundle->nchannels (); ++j) { - + ARDOUR::BundleChannel c[2]; c[_matrix->column_index()] = ARDOUR::BundleChannel (node.row.bundle, i); c[_matrix->row_index()] = ARDOUR::BundleChannel (node.column.bundle, j); - + PortMatrixNode::State const s = _matrix->get_state (c); - + switch (s) { case PortMatrixNode::ASSOCIATED: if (i == j) { @@ -339,23 +339,23 @@ PortMatrixGrid::get_association (PortMatrixNode node) const have_off_diagonal_association = true; } break; - + case PortMatrixNode::UNKNOWN: have_unknown = true; break; - + case PortMatrixNode::NOT_ASSOCIATED: if (i == j) { have_diagonal_not_association = true; } break; - + default: break; } } } - + if (have_unknown) { return PortMatrixNode::UNKNOWN; } else if (have_diagonal_association && !have_off_diagonal_association && !have_diagonal_not_association) { @@ -363,7 +363,7 @@ PortMatrixGrid::get_association (PortMatrixNode node) const } else if (!have_diagonal_association && !have_off_diagonal_association) { return PortMatrixNode::NOT_ASSOCIATED; } - + return PortMatrixNode::PARTIAL; } else { @@ -382,21 +382,21 @@ void PortMatrixGrid::set_association (PortMatrixNode node, bool s) { if (_matrix->show_only_bundles()) { - + for (uint32_t i = 0; i < node.column.bundle->nchannels(); ++i) { for (uint32_t j = 0; j < node.row.bundle->nchannels(); ++j) { - + ARDOUR::BundleChannel c[2]; c[_matrix->column_index()] = ARDOUR::BundleChannel (node.column.bundle, i); c[_matrix->row_index()] = ARDOUR::BundleChannel (node.row.bundle, j); _matrix->set_state (c, s && (i == j)); } } - + } else { - + if (node.row.bundle && node.column.bundle) { - + ARDOUR::BundleChannel c[2]; c[_matrix->row_index()] = node.row; c[_matrix->column_index()] = node.column; @@ -414,7 +414,7 @@ PortMatrixGrid::button_release (double x, double y, int b, uint32_t /*t*/) if (_drag_valid) { list<PortMatrixNode> const p = nodes_on_line (_drag_start_x, _drag_start_y, _drag_x, _drag_y); - + if (!p.empty()) { PortMatrixNode::State const s = get_association (p.front()); for (list<PortMatrixNode>::const_iterator i = p.begin(); i != p.end(); ++i) { @@ -491,8 +491,8 @@ PortMatrixGrid::draw_extra (cairo_t* cr) ); } } - } - + } + set_source_rgba (cr, association_colour (), 0.3); cairo_move_to ( @@ -500,13 +500,13 @@ PortMatrixGrid::draw_extra (cairo_t* cr) component_to_parent_x (_drag_start_x * grid_spacing() + grid_spacing() / 2), component_to_parent_y (_drag_start_y * grid_spacing() + grid_spacing() / 2) ); - + cairo_line_to ( cr, component_to_parent_x (_drag_x * grid_spacing() + grid_spacing() / 2), component_to_parent_y (_drag_y * grid_spacing() + grid_spacing() / 2) ); - + cairo_stroke (cr); } @@ -555,7 +555,7 @@ PortMatrixGrid::queue_draw_for (PortMatrixNode const &n) if (n.column.bundle) { double const x = channel_to_position (n.column, _matrix->columns()) * grid_spacing (); - + _body->queue_draw_area ( component_to_parent_x (x), _parent_rectangle.get_y(), @@ -617,7 +617,7 @@ PortMatrixGrid::nodes_on_line (int x0, int y0, int x1, int y1) const int dx = x1 - x0; int dy = abs (y1 - y0); - + double err = 0; double derr = double (dy) / dx; diff --git a/gtk2_ardour/port_matrix_grid.h b/gtk2_ardour/port_matrix_grid.h index a8834dbdd4..7172b82699 100644 --- a/gtk2_ardour/port_matrix_grid.h +++ b/gtk2_ardour/port_matrix_grid.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,8 +17,8 @@ */ -#ifndef __gtk_ardour_port_matrix_grid_h__ -#define __gtk_ardour_port_matrix_grid_h__ +#ifndef __gtk_ardour_port_matrix_grid_h__ +#define __gtk_ardour_port_matrix_grid_h__ #include <string> #include <vector> @@ -53,7 +53,7 @@ public: void draw_extra (cairo_t *); private: - + void compute_dimensions (); void render (cairo_t *); void render_group_pair (cairo_t *, boost::shared_ptr<const PortGroup>, boost::shared_ptr<const PortGroup>, uint32_t, uint32_t); diff --git a/gtk2_ardour/port_matrix_labels.cc b/gtk2_ardour/port_matrix_labels.cc index 82909a5d05..e2fe306726 100644 --- a/gtk2_ardour/port_matrix_labels.cc +++ b/gtk2_ardour/port_matrix_labels.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/port_matrix_labels.h b/gtk2_ardour/port_matrix_labels.h index f543166031..a977662e80 100644 --- a/gtk2_ardour/port_matrix_labels.h +++ b/gtk2_ardour/port_matrix_labels.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/port_matrix_row_labels.cc b/gtk2_ardour/port_matrix_row_labels.cc index fb6ab951dd..47c791afb3 100644 --- a/gtk2_ardour/port_matrix_row_labels.cc +++ b/gtk2_ardour/port_matrix_row_labels.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ using namespace std; PortMatrixRowLabels::PortMatrixRowLabels (PortMatrix* m, PortMatrixBody* b) : PortMatrixLabels (m, b) { - + } void @@ -41,17 +41,17 @@ PortMatrixRowLabels::compute_dimensions () GdkPixmap* pm = gdk_pixmap_new (NULL, 1, 1, 24); gdk_drawable_set_colormap (pm, gdk_colormap_get_system()); cairo_t* cr = gdk_cairo_create (pm); - + _longest_port_name = 0; _longest_bundle_name = 0; _height = 0; _highest_group_name = 0; for (PortGroupList::List::const_iterator i = _matrix->rows()->begin(); i != _matrix->rows()->end(); ++i) { - + PortGroup::BundleList const r = (*i)->bundles (); for (PortGroup::BundleList::const_iterator j = r.begin(); j != r.end(); ++j) { - + for (uint32_t k = 0; k < j->bundle->nchannels(); ++k) { cairo_text_extents_t ext; cairo_text_extents (cr, j->bundle->channel_name(k).c_str(), &ext); @@ -68,7 +68,7 @@ PortMatrixRowLabels::compute_dimensions () } _height += group_size (*i) * grid_spacing (); - + cairo_text_extents_t ext; cairo_text_extents (cr, (*i)->name.c_str(), &ext); if (ext.height > _highest_group_name) { @@ -94,7 +94,7 @@ void PortMatrixRowLabels::render (cairo_t* cr) { /* BACKGROUND */ - + set_source_rgb (cr, background_colour()); cairo_rectangle (cr, 0, 0, _width, _height); cairo_fill (cr); @@ -127,17 +127,17 @@ PortMatrixRowLabels::render (cairo_t* cr) if (h == 0) { continue; } - + /* rectangle */ set_source_rgb (cr, get_a_group_colour (g)); double const rw = _highest_group_name + 2 * name_pad(); cairo_rectangle (cr, x, y, rw, h); cairo_fill (cr); - + /* hence what abbreviation (or not) we need for the group name */ string const upper = Glib::ustring ((*i)->name).uppercase (); pair<string, double> display = fit_to_pixels (cr, upper, h); - + /* plot it */ set_source_rgb (cr, text_colour()); cairo_move_to (cr, x + rw - name_pad(), y + (h + display.second) / 2); @@ -145,7 +145,7 @@ PortMatrixRowLabels::render (cairo_t* cr) cairo_rotate (cr, - M_PI / 2); cairo_show_text (cr, display.first.c_str()); cairo_restore (cr); - + y += h; ++g; } @@ -158,7 +158,7 @@ PortMatrixRowLabels::render (cairo_t* cr) for (PortGroupList::List::const_iterator i = _matrix->rows()->begin(); i != _matrix->rows()->end(); ++i) { if ((*i)->visible ()) { - + PortGroup::BundleList const & bundles = (*i)->bundles (); for (PortGroup::BundleList::const_iterator j = bundles.begin(); j != bundles.end(); ++j) { render_bundle_name (cr, background_colour (), j->has_colour ? j->colour : get_a_bundle_colour (N), 0, y, j->bundle); @@ -173,10 +173,10 @@ PortMatrixRowLabels::render (cairo_t* cr) } else { y += grid_spacing(); } - + ++N; } - + } else { y += grid_spacing (); @@ -198,7 +198,7 @@ PortMatrixRowLabels::button_press (double x, double y, int b, uint32_t t) w.second.bundle.reset (); } - + if (b == 1) { if (w.second.bundle) { @@ -248,7 +248,7 @@ double PortMatrixRowLabels::bundle_name_x () const { double x = 0; - + if (_matrix->arrangement() == PortMatrix::LEFT_TO_BOTTOM) { x = _highest_group_name + 2 * name_pad(); } else { @@ -280,7 +280,7 @@ PortMatrixRowLabels::render_bundle_name ( ) { double const x = bundle_name_x (); - + int const n = _matrix->show_only_bundles() ? 1 : b->nchannels(); set_source_rgb (cr, bg_colour); cairo_rectangle (cr, xoff + x, yoff, _longest_bundle_name + name_pad() * 2, grid_spacing() * n); @@ -314,11 +314,11 @@ PortMatrixRowLabels::render_channel_name ( set_source_rgb (cr, fg_colour); cairo_set_line_width (cr, label_border_width ()); cairo_stroke (cr); - + cairo_text_extents_t ext; cairo_text_extents (cr, bc.bundle->channel_name(bc.channel).c_str(), &ext); double const off = (grid_spacing() - ext.height) / 2; - + set_source_rgb (cr, text_colour()); cairo_move_to (cr, port_name_x() + xoff + name_pad(), yoff + name_pad() + off); cairo_show_text (cr, bc.bundle->channel_name(bc.channel).c_str()); @@ -350,7 +350,7 @@ PortMatrixRowLabels::queue_draw_for (ARDOUR::BundleChannel const & bc) ); } else { _body->queue_draw_area ( - component_to_parent_x (port_name_x()) - 1, + component_to_parent_x (port_name_x()) - 1, component_to_parent_y (channel_y (bc)) - 1, _longest_port_name + name_pad() * 2 + 2, grid_spacing() + 2 diff --git a/gtk2_ardour/port_matrix_row_labels.h b/gtk2_ardour/port_matrix_row_labels.h index 9fcb1ca831..508d45d943 100644 --- a/gtk2_ardour/port_matrix_row_labels.h +++ b/gtk2_ardour/port_matrix_row_labels.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ public: PortMatrixRowLabels (PortMatrix *, PortMatrixBody *); void button_press (double, double, int, uint32_t); - + double component_to_parent_x (double x) const; double parent_to_component_x (double x) const; double component_to_parent_y (double y) const; @@ -56,7 +56,7 @@ private: void render_bundle_name (cairo_t *, Gdk::Color, Gdk::Color, double, double, boost::shared_ptr<ARDOUR::Bundle>); double channel_x (ARDOUR::BundleChannel const &) const; double channel_y (ARDOUR::BundleChannel const &) const; - + void render (cairo_t *); void compute_dimensions (); void remove_channel_proxy (boost::weak_ptr<ARDOUR::Bundle>, uint32_t); diff --git a/gtk2_ardour/port_matrix_types.h b/gtk2_ardour/port_matrix_types.h index cdc458061f..f36821cd90 100644 --- a/gtk2_ardour/port_matrix_types.h +++ b/gtk2_ardour/port_matrix_types.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,14 +26,14 @@ struct PortMatrixNode { PortMatrixNode () {} PortMatrixNode (ARDOUR::BundleChannel r, ARDOUR::BundleChannel c) : row (r), column (c) {} - + bool operator== (PortMatrixNode const& other) const { return row == other.row && column == other.column; } bool operator!= (PortMatrixNode const& other) const { return row != other.row || column != other.column; } - + ARDOUR::BundleChannel row; ARDOUR::BundleChannel column; diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index b1baf30bf7..67ad782ed5 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -125,7 +125,7 @@ ProcessorBox::ProcessorBox (Session& sess, PluginSelector &plugsel, RefPtr<TreeSelection> selection = processor_display.get_selection(); selection->set_mode (Gtk::SELECTION_MULTIPLE); selection->signal_changed().connect (mem_fun (*this, &ProcessorBox::selection_changed)); - + processor_display.set_data ("processorbox", this); processor_display.set_model (model); processor_display.append_column (X_("notshown"), columns.text); @@ -211,7 +211,7 @@ ProcessorBox::object_drop (const list<boost::shared_ptr<Processor> >& procs, Gtk if (processor_display.get_path_at_pos (x, y, path, column, cellx, celly)) { if ((iter = model->get_iter (path))) { p = (*iter)[columns.processor]; - } + } } for (list<boost::shared_ptr<Processor> >::const_iterator i = procs.begin(); i != procs.end(); ++i) { @@ -221,7 +221,7 @@ ProcessorBox::object_drop (const list<boost::shared_ptr<Processor> >& procs, Gtk paste_processor_state (nlist, p); delete &state; } - + /* since the treeview doesn't take care of this properly, we have to delete the originals ourselves. */ @@ -376,17 +376,17 @@ ProcessorBox::processor_key_release_event (GdkEventKey *ev) TreeViewColumn* column; int cellx; int celly; - + processor_display.get_pointer (x, y); - + if (processor_display.get_path_at_pos (x, y, path, column, cellx, celly)) { if ((iter = model->get_iter (path))) { targets.push_back ((*iter)[columns.processor]); } } } - - + + switch (ev->keyval) { case GDK_c: if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { @@ -426,7 +426,7 @@ ProcessorBox::processor_key_release_event (GdkEventKey *ev) } ret = true; break; - + default: break; } @@ -516,7 +516,7 @@ ProcessorBox::processor_button_release_event (GdkEventButton *ev) } else { _placement = PostFader; } - + show_processor_menu (ev->time); ret = true; @@ -674,7 +674,7 @@ ProcessorBox::choose_send () return; } - /* let the user adjust the IO setup before creation. + /* let the user adjust the IO setup before creation. Note: this dialog is NOT modal - we just leave it to run and it will return when its Finished signal is emitted - typically when the window @@ -685,7 +685,7 @@ ProcessorBox::choose_send () ios->show_all (); /* keep a reference to the send so it doesn't get deleted while - the IOSelectorWindow is doing its stuff + the IOSelectorWindow is doing its stuff */ _processor_being_created = send; @@ -843,7 +843,7 @@ ProcessorBox::processor_name (boost::weak_ptr<Processor> weak_processor) name_display = " ("; } - if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0 && + if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0 && !boost::dynamic_pointer_cast<InternalSend>(processor)) { name_display += '>'; @@ -853,7 +853,7 @@ ProcessorBox::processor_name (boost::weak_ptr<Processor> weak_processor) string::size_type lbracket, rbracket; lbracket = send->name().find ('['); rbracket = send->name().find (']'); - + switch (_width) { case Wide: name_display += send->name().substr (lbracket+1, lbracket-rbracket-1); @@ -1036,7 +1036,7 @@ ProcessorBox::cut_processors (const ProcSelection& to_be_removed) to_cut.push_back (*i); } } - + if (_route->remove_processors (to_cut) != 0) { delete node; no_processor_redisplay = false; @@ -1123,7 +1123,7 @@ ProcessorBox::delete_dragged_processors (const list<boost::shared_ptr<Processor> if (gui) { static_cast<Gtk::Widget*>(gui)->hide (); } - + _route->remove_processor(*x); } @@ -1216,7 +1216,7 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr boost::shared_ptr<Processor> p; try { - if (type->value() == "meter" || + if (type->value() == "meter" || type->value() == "main-outs" || type->value() == "amp" || type->value() == "intsend" || type->value() == "intreturn") { @@ -1224,7 +1224,7 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr continue; } else if (type->value() == "send") { - + XMLNode n (**niter); Send::make_unique (n, _session); p.reset (new Send (_session, _route->mute_master(), n)); @@ -1234,7 +1234,7 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr XMLNode n (**niter); Return::make_unique (n, _session); p.reset (new Return (_session, **niter)); - + } else { /* XXX its a bit limiting to assume that everything else is a plugin. @@ -1320,7 +1320,7 @@ ProcessorBox::clear_processors () prompt = string_compose (_("Do you really want to remove all processors from %1?\n" "(this cannot be undone)"), _route->name()); - + choices.push_back (_("Cancel")); choices.push_back (_("Yes, remove them all")); @@ -1401,7 +1401,7 @@ ProcessorBox::edit_processor (boost::shared_ptr<Processor> processor) _parent_strip->panner_ui().set_panner (send->panner()); } #endif - + } else if ((retrn = boost::dynamic_pointer_cast<Return> (processor)) != 0) { if (!_session.engine().connected()) { diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index 5dfbce7789..6a80549132 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -82,10 +82,10 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject void select_all_plugins (); void select_all_inserts (); void select_all_sends (); - + sigc::signal<void,boost::shared_ptr<ARDOUR::Processor> > ProcessorSelected; sigc::signal<void,boost::shared_ptr<ARDOUR::Processor> > ProcessorUnselected; - + static void register_actions(); private: @@ -118,13 +118,13 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject ModelColumns columns; Glib::RefPtr<Gtk::ListStore> model; - + void selection_changed (); static bool get_colors; static Gdk::Color* active_processor_color; static Gdk::Color* inactive_processor_color; - + Gtk::EventBox processor_eventbox; Gtk::HBox processor_hpacker; Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Processor> > processor_display; @@ -134,7 +134,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject int x, int y, Glib::RefPtr<Gdk::DragContext>& context); Width _width; - + Gtk::Menu *send_action_menu; void build_send_action_menu (); @@ -177,7 +177,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject void compute_processor_sort_keys (); std::vector<sigc::connection> processor_active_connections; std::vector<sigc::connection> processor_name_connections; - + bool processor_drag_in_progress; void processor_drag_begin (GdkDragContext*); void processor_drag_end (GdkDragContext*); @@ -206,7 +206,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject static Glib::RefPtr<Gtk::Action> paste_action; void paste_processor_state (const XMLNodeList&, boost::shared_ptr<ARDOUR::Processor>); - + void activate_processor (boost::shared_ptr<ARDOUR::Processor>); void deactivate_processor (boost::shared_ptr<ARDOUR::Processor>); void edit_processor (boost::shared_ptr<ARDOUR::Processor>); @@ -239,7 +239,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject static void rb_deactivate_all (); static void rb_ab_plugins (); static void rb_edit (); - + void route_name_changed (); std::string generate_processor_title (boost::shared_ptr<ARDOUR::PluginInsert> pi); }; diff --git a/gtk2_ardour/processor_selection.h b/gtk2_ardour/processor_selection.h index a7d10894e9..d371493b41 100644 --- a/gtk2_ardour/processor_selection.h +++ b/gtk2_ardour/processor_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,15 +41,15 @@ class ProcessorSelection { node->add_child_nocopy (*newchild); } - void clear () { - if (node) { + void clear () { + if (node) { delete node; node = 0; } } bool empty () const { return node == 0 || node->children().empty(); } - + const XMLNode& get_node() const { return *node; } private: diff --git a/gtk2_ardour/prompter.cc b/gtk2_ardour/prompter.cc index 0e1732b237..16428eef19 100644 --- a/gtk2_ardour/prompter.cc +++ b/gtk2_ardour/prompter.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/prompter.h b/gtk2_ardour/prompter.h index 4e97e64e6f..0af5fdee7b 100644 --- a/gtk2_ardour/prompter.h +++ b/gtk2_ardour/prompter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/public_editor.cc b/gtk2_ardour/public_editor.cc index 399c71caa9..3955083c70 100644 --- a/gtk2_ardour/public_editor.cc +++ b/gtk2_ardour/public_editor.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index d7df0e8d2f..d0d63e060b 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ #include "evoral/types.hpp" #include "ardour/route_group.h" -#include "pbd/statefuldestructible.h" +#include "pbd/statefuldestructible.h" #include "editing.h" #include "canvas.h" @@ -118,10 +118,10 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway * @param t Snap threshold in `units'. */ virtual void set_snap_threshold (double t) = 0; - + /** Snap a value according to the current snap setting. */ virtual void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false) = 0; - + /** Undo some transactions. * @param n Number of transactions to undo. */ @@ -154,7 +154,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway rather than regions as black-box objects. For Ardour3, this is aimed at editing MIDI regions but may expand in the future to other types of regions. */ - + virtual void set_internal_edit (bool yn) = 0; /** @return Whether editing is currently in "internal" mode or not @@ -187,7 +187,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway virtual void transition_to_rolling (bool fwd) = 0; virtual nframes64_t unit_to_frame (double unit) const = 0; // XXX remove me when libardour goes nframes64_t - double frame_to_unit (nframes_t frame) const { + double frame_to_unit (nframes_t frame) const { return frame_to_unit ((nframes64_t) frame); } virtual double frame_to_unit (nframes64_t frame) const = 0; @@ -204,10 +204,10 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway /** Open main export dialog */ virtual void export_audio () = 0; - + /** Open export dialog with current selection pre-selected */ virtual void export_selection () = 0; - + /** Open export dialog with current range pre-selected */ virtual void export_range () = 0; diff --git a/gtk2_ardour/quantize_dialog.cc b/gtk2_ardour/quantize_dialog.cc index e8ec314133..5ed867c4c3 100644 --- a/gtk2_ardour/quantize_dialog.cc +++ b/gtk2_ardour/quantize_dialog.cc @@ -1,20 +1,20 @@ -/* +/* Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - + */ #include "gtkmm2ext/utils.h" @@ -195,11 +195,11 @@ QuantizeDialog::grid_size_to_musical_time (const string& txt) const } else if (txt == _("Beats")) { return 1.0; } - + return 1.0; } -float +float QuantizeDialog::swing () const { if (!swing_button.get_active()) { @@ -209,13 +209,13 @@ QuantizeDialog::swing () const return swing_adjustment.get_value (); } -float +float QuantizeDialog::strength () const { return strength_adjustment.get_value (); } -float +float QuantizeDialog::threshold () const { return threshold_adjustment.get_value (); diff --git a/gtk2_ardour/quantize_dialog.h b/gtk2_ardour/quantize_dialog.h index 71d8eaacff..97cb82c86e 100644 --- a/gtk2_ardour/quantize_dialog.h +++ b/gtk2_ardour/quantize_dialog.h @@ -1,16 +1,16 @@ -/* +/* Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 06908ca0c1..8c164c75cf 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -60,7 +60,7 @@ public: t->attach (*l, 0, 1, n, n + 1, EXPAND | FILL, FILL); t->attach (_mtc_combo, 1, 2, n, n + 1, EXPAND | FILL, EXPAND | FILL); ++n; - + l = manage (new Label (_("MIDI clock:"))); l->set_alignment (1, 0.5); t->attach (*l, 0, 1, n, n + 1, FILL, FILL); @@ -102,7 +102,7 @@ public: _mpc_combo.set_active_text (_rc_config->get_midi_port_name()); } else if (p == "midi-clock-port-name") { _midi_clock_combo.set_active_text (_rc_config->get_midi_clock_port_name()); - } + } } void set_state_from_config () @@ -132,7 +132,7 @@ public: { _rc_config->set_midi_clock_port_name (_midi_clock_combo.get_active_text()); } - + private: void model_changed (TreeModel::Path const &, TreeModel::iterator const & i) @@ -145,7 +145,7 @@ private: } if (port->input()) { - + if (r[_model.online] == port->input()->offline()) { port->input()->set_offline (!r[_model.online]); } @@ -160,11 +160,11 @@ private: if (r[_model.trace_output] != port->output()->tracing()) { port->output()->trace (r[_model.trace_output], &cerr, string (port->name()) + _(" output: ")); } - + } - - + + } void setup_ports_combo (ComboBoxText& c) @@ -228,7 +228,7 @@ private: dialog.set_position (WIN_POS_MOUSE); dialog.show (); - + int const r = dialog.run (); switch (r) { @@ -251,17 +251,17 @@ private: } XMLNode node (X_("MIDI-port")); - + node.add_property ("tag", dialog.port_name.get_text()); node.add_property ("device", X_("ardour")); // XXX this can't be right for all types node.add_property ("type", MIDI::PortFactory::default_port_type()); node.add_property ("mode", smod); - + if (MIDI::Manager::instance()->add_port (node) != 0) { ports_changed (); } } - + class MIDIModelColumns : public TreeModelColumnRecord { public: @@ -321,7 +321,7 @@ public: _box->pack_start (*t, false, false); } - + void parameter_changed (string const & p) { if (p == "click-sound") { @@ -337,7 +337,7 @@ public: parameter_changed ("click-emphasis-sound"); } -private: +private: void click_browse_clicked () { @@ -345,7 +345,7 @@ private: sfdb.show_all (); sfdb.present (); - + if (sfdb.run () == RESPONSE_OK) { click_chosen (sfdb.get_filename()); } @@ -363,7 +363,7 @@ private: sfdb.show_all (); sfdb.present (); - + if (sfdb.run () == RESPONSE_OK) { click_emphasis_chosen (sfdb.get_filename()); } @@ -463,7 +463,7 @@ public: { _rc_config->set_saved_history_depth (_save_undo_spin.get_value_as_int ()); } - + private: RCConfiguration* _rc_config; CheckButton _limit_undo_button; @@ -519,7 +519,7 @@ public: _delete_button_spin (_delete_button_adjustment), _edit_button_adjustment (3, 1, 5), _edit_button_spin (_edit_button_adjustment) - + { /* internationalize and prepare for use with combos */ @@ -639,7 +639,7 @@ private: string const txt = _keyboard_layout_selector.get_active_text(); /* XXX: config...? for all this keyboard stuff */ - + for (map<string,string>::iterator i = Keyboard::binding_files.begin(); i != Keyboard::binding_files.end(); ++i) { if (txt == i->first) { if (Keyboard::load_keybindings (i->second)) { @@ -652,7 +652,7 @@ private: void edit_modifier_chosen () { string const txt = _edit_modifier_combo.get_active_text(); - + for (int i = 0; modifiers[i].name; ++i) { if (txt == _(modifiers[i].name)) { Keyboard::set_edit_modifier (modifiers[i].modifier); @@ -664,7 +664,7 @@ private: void delete_modifier_chosen () { string const txt = _delete_modifier_combo.get_active_text(); - + for (int i = 0; modifiers[i].name; ++i) { if (txt == _(modifiers[i].name)) { Keyboard::set_delete_modifier (modifiers[i].modifier); @@ -672,11 +672,11 @@ private: } } } - + void snap_modifier_chosen () { string const txt = _snap_modifier_combo.get_active_text(); - + for (int i = 0; modifiers[i].name; ++i) { if (txt == _(modifiers[i].name)) { Keyboard::set_snap_modifier (modifiers[i].modifier); @@ -694,7 +694,7 @@ private: { Keyboard::set_edit_button (_edit_button_spin.get_value_as_int()); } - + ComboBoxText _keyboard_layout_selector; ComboBoxText _edit_modifier_combo; ComboBoxText _delete_modifier_combo; @@ -740,9 +740,9 @@ public: { parameter_changed ("font-scale"); } - + private: - + void dpi_changed () { _rc_config->set_font_scale ((long) floor (_dpi_adjustment.get_value() * 1024)); @@ -774,7 +774,7 @@ public: parameter_changed ("solo-mute-gain"); - + Label* l = manage (new Label (_("Solo mute cut (dB):"))); l->set_name ("OptionsLabel"); @@ -785,7 +785,7 @@ public: h->pack_start (_db_display, false, false); set_size_request_to_display_given_text (_db_display, "-99.0", 12, 12); - + _box->pack_start (*h, false, false); _db_adjustment.signal_value_changed().connect (mem_fun (*this, &SoloMuteOptions::db_changed)); @@ -814,9 +814,9 @@ public: { parameter_changed ("solo-mute-gain"); } - + private: - + void db_changed () { _rc_config->set_solo_mute_gain (slider_position_to_gain (_db_adjustment.get_value())); @@ -856,7 +856,7 @@ public: void set_state_from_config () { _store->clear (); - + ControlProtocolManager& m = ControlProtocolManager::instance (); for (list<ControlProtocolInfo*>::iterator i = m.control_protocol_info.begin(); i != m.control_protocol_info.end(); ++i) { @@ -903,7 +903,7 @@ private: class ControlSurfacesModelColumns : public TreeModelColumnRecord { public: - + ControlSurfacesModelColumns () { add (name); @@ -931,7 +931,7 @@ RCOptionEditor::RCOptionEditor () /* MISC */ add_option (_("Misc"), new OptionEditorHeading (_("Metering"))); - + ComboOption<float>* mht = new ComboOption<float> ( "meter-hold", _("Meter hold time"), @@ -943,7 +943,7 @@ RCOptionEditor::RCOptionEditor () mht->add (MeterHoldShort, _("short")); mht->add (MeterHoldMedium, _("medium")); mht->add (MeterHoldLong, _("long")); - + add_option (_("Misc"), mht); ComboOption<float>* mfo = new ComboOption<float> ( @@ -964,15 +964,15 @@ RCOptionEditor::RCOptionEditor () add_option (_("Misc"), mfo); add_option (_("Misc"), new OptionEditorHeading (_("Undo"))); - + add_option (_("Misc"), new UndoOptions (_rc_config)); add_option (_("Misc"), new OptionEditorHeading (_("Misc"))); - + #ifndef GTKOSX /* font scaling does nothing with GDK/Quartz */ add_option (_("Misc"), new FontScalingOptions (_rc_config)); -#endif +#endif add_option (_("Misc"), new BoolOption ( @@ -981,7 +981,7 @@ RCOptionEditor::RCOptionEditor () mem_fun (*_rc_config, &RCConfiguration::get_verify_remove_last_capture), mem_fun (*_rc_config, &RCConfiguration::set_verify_remove_last_capture) )); - + add_option (_("Misc"), new BoolOption ( "periodic-safety-backups", @@ -1141,7 +1141,7 @@ RCOptionEditor::RCOptionEditor () wfs->add (Logarithmic, _("logarithmic")); add_option (_("Editor"), wfs); - + ComboOption<WaveformShape>* wfsh = new ComboOption<WaveformShape> ( "waveform-shape", _("Waveform shape"), @@ -1159,7 +1159,7 @@ RCOptionEditor::RCOptionEditor () add_option (_("Audio"), new OptionEditorHeading (_("Solo"))); - add_option (_("Audio"), + add_option (_("Audio"), new BoolOption ( "solo-control-is-listen-control", _("Solo controls are Listen controls"), @@ -1278,23 +1278,23 @@ RCOptionEditor::RCOptionEditor () mem_fun (*_rc_config, &RCConfiguration::get_denormal_model), mem_fun (*_rc_config, &RCConfiguration::set_denormal_model) ); - + dm->add (DenormalNone, _("no processor handling")); - + FPU fpu; - + if (fpu.has_flush_to_zero()) { dm->add (DenormalFTZ, _("use FlushToZero")); } - + if (fpu.has_denormals_are_zero()) { dm->add (DenormalDAZ, _("use DenormalsAreZero")); } - + if (fpu.has_flush_to_zero() && fpu.has_denormals_are_zero()) { dm->add (DenormalFTZDAZ, _("use FlushToZero and DenormalsAreZerO")); } - + add_option (_("Audio"), dm); add_option (_("Audio"), new OptionEditorHeading (_("Plugins"))); diff --git a/gtk2_ardour/region_editor.h b/gtk2_ardour/region_editor.h index 394ad6bcfb..596bd44140 100644 --- a/gtk2_ardour/region_editor.h +++ b/gtk2_ardour/region_editor.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/region_gain_line.cc b/gtk2_ardour/region_gain_line.cc index 48bc7e7f4b..b08be91590 100644 --- a/gtk2_ardour/region_gain_line.cc +++ b/gtk2_ardour/region_gain_line.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,13 +50,13 @@ AudioRegionGainLine::AudioRegionGainLine (const string & name, Session& s, Audio } void -AudioRegionGainLine::start_drag (ControlPoint* cp, nframes_t x, float fraction) +AudioRegionGainLine::start_drag (ControlPoint* cp, nframes_t x, float fraction) { AutomationLine::start_drag (cp, x, fraction); if (!rv.audio_region()->envelope_active()) { trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), &rv.audio_region()->get_state(), 0)); rv.audio_region()->set_envelope_active(false); - } + } } // This is an extended copy from AutomationList @@ -75,8 +75,8 @@ AudioRegionGainLine::remove_point (ControlPoint& cp) rv.audio_region()->set_envelope_active(true); XMLNode ®ion_after = rv.audio_region()->get_state(); trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), ®ion_before, ®ion_after)); - } - + } + alist->erase (mr.start, mr.end); trackview.editor().current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state())); @@ -85,12 +85,12 @@ AudioRegionGainLine::remove_point (ControlPoint& cp) } void -AudioRegionGainLine::end_drag (ControlPoint* cp) +AudioRegionGainLine::end_drag (ControlPoint* cp) { if (!rv.audio_region()->envelope_active()) { rv.audio_region()->set_envelope_active(true); trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), 0, &rv.audio_region()->get_state())); - } + } AutomationLine::end_drag(cp); } diff --git a/gtk2_ardour/region_gain_line.h b/gtk2_ardour/region_gain_line.h index 7950c9b0e7..7033c65604 100644 --- a/gtk2_ardour/region_gain_line.h +++ b/gtk2_ardour/region_gain_line.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ class AudioRegionGainLine : public AutomationLine { public: AudioRegionGainLine (const std::string & name, ARDOUR::Session&, AudioRegionView&, ArdourCanvas::Group& parent, boost::shared_ptr<ARDOUR::AutomationList>); - + void start_drag (ControlPoint*, nframes_t x, float fraction); void end_drag (ControlPoint*); diff --git a/gtk2_ardour/region_selection.cc b/gtk2_ardour/region_selection.cc index 59d74d933f..20dd8c1d24 100644 --- a/gtk2_ardour/region_selection.cc +++ b/gtk2_ardour/region_selection.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ RegionSelection::RegionSelection (const RegionSelection& other) _current_start = other._current_start; _current_end = other._current_end; - + for (RegionSelection::const_iterator i = other.begin(); i != other.end(); ++i) { add (*i); } @@ -65,10 +65,10 @@ RegionSelection::operator= (const RegionSelection& other) if (this != &other) { clear_all(); - + _current_start = other._current_start; _current_end = other._current_end; - + for (RegionSelection::const_iterator i = other.begin(); i != other.end(); ++i) { add (*i); } @@ -112,11 +112,11 @@ RegionSelection::add (RegionView* rv) if (rv->region()->first_frame() < _current_start || empty()) { _current_start = rv->region()->first_frame(); } - + if (rv->region()->last_frame() > _current_end || empty()) { _current_end = rv->region()->last_frame(); } - + push_back (rv); /* add to layer sorted list */ @@ -148,7 +148,7 @@ RegionSelection::remove (RegionView* rv) // remove from layer sorted list _bylayer.remove (rv); - + if (size() == 1) { /* this is the last one, so when we delete it @@ -159,37 +159,37 @@ RegionSelection::remove (RegionView* rv) _current_end = 0; } else { - + boost::shared_ptr<Region> region ((*r)->region()); - + if (region->first_frame() == _current_start) { - + /* reset current start */ - + nframes_t ref = max_frames; - + for (RegionSelection::iterator i = begin (); i != end(); ++i) { if (region->first_frame() < ref) { ref = region->first_frame(); } } - + _current_start = ref; - + } - + if (region->last_frame() == _current_end) { /* reset current end */ - + nframes_t ref = 0; - + for (RegionSelection::iterator i = begin (); i != end(); ++i) { if (region->first_frame() > ref) { ref = region->first_frame(); } } - + _current_end = ref; } } @@ -251,7 +251,7 @@ RegionSelection::by_position (list<RegionView*>& foo) const struct RegionSortByTrack { bool operator() (const RegionView* a, const RegionView* b) const { - + /* really, track and position */ if (a->get_trackview().order() == b->get_trackview().order()) { diff --git a/gtk2_ardour/region_selection.h b/gtk2_ardour/region_selection.h index 305fc69afd..f89eef9eb8 100644 --- a/gtk2_ardour/region_selection.h +++ b/gtk2_ardour/region_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,26 +45,26 @@ class RegionSelection : public std::list<RegionView*>, public sigc::trackable bool involves (const TimeAxisView&) const; void clear_all(); - + nframes_t start () const { return _current_start; } /* "end" collides with list<>::end */ - nframes_t end_frame () const { + nframes_t end_frame () const { return _current_end; } const std::list<RegionView *>& by_layer() const { return _bylayer; } void by_position (std::list<RegionView*>&) const; void by_track (std::list<RegionView*>&) const; - + private: void remove_it (RegionView*); void add_to_layer (RegionView *); - + nframes_t _current_start; ///< start position for the selection nframes_t _current_end; ///< end position for the selection diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index c3d48d4aa2..bb5240f871 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001-2006 Paul Davis + Copyright (C) 2001-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,7 +60,7 @@ static const int32_t sync_mark_width = 9; sigc::signal<void,RegionView*> RegionView::RegionViewGoingAway; -RegionView::RegionView (ArdourCanvas::Group* parent, +RegionView::RegionView (ArdourCanvas::Group* parent, TimeAxisView& tv, boost::shared_ptr<ARDOUR::Region> r, double spu, @@ -101,7 +101,7 @@ RegionView::RegionView (const RegionView& other, boost::shared_ptr<Region> other , TimeAxisViewItem (other) , _time_converter(other._time_converter) { - /* this is a pseudo-copy constructor used when dragging regions + /* this is a pseudo-copy constructor used when dragging regions around on the canvas. */ @@ -114,7 +114,7 @@ RegionView::RegionView (const RegionView& other, boost::shared_ptr<Region> other _height = other._height; } -RegionView::RegionView (ArdourCanvas::Group* parent, +RegionView::RegionView (ArdourCanvas::Group* parent, TimeAxisView& tv, boost::shared_ptr<ARDOUR::Region> r, double spu, @@ -154,7 +154,7 @@ RegionView::init (Gdk::Color const & basic_color, bool wfd) if (name_highlight) { name_highlight->set_data ("regionview", this); name_highlight->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), name_highlight, this)); - + frame_handle_start->set_data ("regionview", this); frame_handle_start->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_frame_handle_event), frame_handle_start, this)); @@ -210,7 +210,7 @@ RegionView::_lock_toggle (ArdourCanvas::Item*, GdkEvent* ev, void* arg) break; default: break; - } + } return FALSE; } @@ -268,7 +268,7 @@ RegionView::region_resized (Change what_changed) set_duration (_region->length(), 0); unit_length = _region->length() / samples_per_unit; - + for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { (*i)->set_duration (unit_length); @@ -351,7 +351,7 @@ RegionView::set_duration (nframes64_t frames, void *src) if (!TimeAxisViewItem::set_duration (frames, src)) { return false; } - + for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { (*i)->set_duration (_region->length() / samples_per_unit); } @@ -363,7 +363,7 @@ void RegionView::set_colors () { TimeAxisViewItem::set_colors (); - + if (sync_mark) { sync_mark->property_fill_color_rgba() = fill_color; sync_line->property_fill_color_rgba() = fill_color; @@ -390,7 +390,7 @@ RegionView::fake_set_opaque (bool yn) } else { fill_opacity = 60; } - + set_frame_color (); } @@ -458,7 +458,7 @@ RegionView::region_sync_changed () if (!sync_mark) { /* points set below */ - + sync_mark = new ArdourCanvas::Polygon (*group); sync_mark->property_fill_color_rgba() = fill_color; @@ -474,13 +474,13 @@ RegionView::region_sync_changed () if (sync_offset == 0) { /* no sync mark - its the start of the region */ - + sync_mark->hide(); sync_line->hide (); } else { - if ((sync_dir < 0) || ((sync_dir > 0) && (sync_offset > _region->length()))) { + if ((sync_dir < 0) || ((sync_dir > 0) && (sync_offset > _region->length()))) { /* no sync mark - its out of the bounds of the region */ @@ -492,14 +492,14 @@ RegionView::region_sync_changed () /* lets do it */ Points points; - + //points = sync_mark->property_points().get_value(); - + double offset = sync_offset / samples_per_unit; points.push_back (Gnome::Art::Point (offset - ((sync_mark_width-1)/2), 1)); points.push_back (Gnome::Art::Point (offset + ((sync_mark_width-1)/2), 1)); points.push_back (Gnome::Art::Point (offset, sync_mark_width - 1)); - points.push_back (Gnome::Art::Point (offset - ((sync_mark_width-1)/2), 1)); + points.push_back (Gnome::Art::Point (offset - ((sync_mark_width-1)/2), 1)); sync_mark->property_points().set_value (points); sync_mark->show (); @@ -614,7 +614,7 @@ RegionView::update_coverage_frames (LayerDisplay d) uint32_t const color = frame->property_fill_color_rgba (); uint32_t const base_alpha = UINT_RGBA_A (color); - + while (t < end) { t++; diff --git a/gtk2_ardour/region_view.h b/gtk2_ardour/region_view.h index 3f2f71eda4..288969616f 100644 --- a/gtk2_ardour/region_view.h +++ b/gtk2_ardour/region_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001-2006 Paul Davis + Copyright (C) 2001-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ class AutomationRegionView; class RegionView : public TimeAxisViewItem { public: - RegionView (ArdourCanvas::Group* parent, + RegionView (ArdourCanvas::Group* parent, TimeAxisView& time_view, boost::shared_ptr<ARDOUR::Region> region, double samples_per_unit, @@ -51,36 +51,36 @@ class RegionView : public TimeAxisViewItem RegionView (const RegionView& other, boost::shared_ptr<ARDOUR::Region> other_region); ~RegionView (); - + virtual void init (Gdk::Color const & base_color, bool wait_for_data); - + boost::shared_ptr<ARDOUR::Region> region() const { return _region; } - + bool is_valid() const { return valid; } void set_valid (bool yn) { valid = yn; } - + virtual void set_height (double); virtual void set_samples_per_unit (double); virtual bool set_duration (nframes64_t, void*); - + void move (double xdelta, double ydelta); - + void raise_to_top (); void lower_to_bottom (); bool set_position(nframes64_t pos, void* src, double* delta = 0); void fake_set_opaque (bool yn); - + virtual void show_region_editor () {} virtual void hide_region_editor(); - + virtual void region_changed (ARDOUR::Change); - + virtual GhostRegion* add_ghost (TimeAxisView&) = 0; void remove_ghost_in (TimeAxisView&); void remove_ghost (GhostRegion*); - + uint32_t get_fill_color (); virtual void entered () {} @@ -88,22 +88,22 @@ class RegionView : public TimeAxisViewItem void enable_display(bool yn) { _enable_display = yn; } virtual void update_coverage_frames (LayerDisplay); - + static sigc::signal<void,RegionView*> RegionViewGoingAway; - + protected: - + /** Allows derived types to specify their visibility requirements * to the TimeAxisViewItem parent class */ - RegionView (ArdourCanvas::Group *, + RegionView (ArdourCanvas::Group *, TimeAxisView&, boost::shared_ptr<ARDOUR::Region>, double samples_per_unit, Gdk::Color const & basic_color, bool recording, TimeAxisViewItem::Visibility); - + virtual void region_resized (ARDOUR::Change); virtual void region_muted (); void region_locked (); @@ -121,26 +121,26 @@ class RegionView : public TimeAxisViewItem virtual void reset_width_dependent_items (double pixel_width); virtual void color_handler () {} - + boost::shared_ptr<ARDOUR::Region> _region; - - ArdourCanvas::Polygon* sync_mark; ///< polgyon for sync position - ArdourCanvas::Line* sync_line; ///< polgyon for sync position + + ArdourCanvas::Polygon* sync_mark; ///< polgyon for sync position + ArdourCanvas::Line* sync_line; ///< polgyon for sync position RegionEditor* editor; std::vector<ControlPoint *> control_points; double current_visible_sync_position; - bool valid; ///< see StreamView::redisplay_diskstream() - bool _enable_display; ///< see StreamView::redisplay_diskstream() + bool valid; ///< see StreamView::redisplay_diskstream() + bool _enable_display; ///< see StreamView::redisplay_diskstream() double _pixel_width; double _height; bool in_destructor; - + bool wait_for_data; sigc::connection data_ready_connection; - + std::vector<GhostRegion*> ghosts; /** a list of rectangles which are used in stacked display mode to colour diff --git a/gtk2_ardour/return_ui.cc b/gtk2_ardour/return_ui.cc index d671e582db..d5e367d8d9 100644 --- a/gtk2_ardour/return_ui.cc +++ b/gtk2_ardour/return_ui.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,14 +42,14 @@ ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session& s _hbox.pack_start (_gpm, true, true); set_name ("ReturnUIFrame"); - + _vbox.set_spacing (5); _vbox.set_border_width (5); _vbox.pack_start (_hbox, false, false, false); io = manage (new IOSelector (parent, se, r->output())); - + pack_start (_vbox, false, false); pack_start (*io, true, true); @@ -58,10 +58,10 @@ ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session& s _return->set_metering (true); _return->input()->changed.connect (mem_fun (*this, &ReturnUI::ins_changed)); - + _gpm.setup_meters (); _gpm.set_fader_name ("ReturnUIFrame"); - + // screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (mem_fun (*this, &ReturnUI::update)); fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun (*this, &ReturnUI::fast_update)); } @@ -97,7 +97,7 @@ ReturnUI::fast_update () _gpm.update_meters (); } } - + ReturnUIWindow::ReturnUIWindow (boost::shared_ptr<Return> s, Session& ss) : ArdourDialog (string("Ardour: return ") + s->name()) { @@ -109,7 +109,7 @@ ReturnUIWindow::ReturnUIWindow (boost::shared_ptr<Return> s, Session& ss) get_vbox()->pack_start (hpacker); set_name ("ReturnUIWindow"); - + going_away_connection = s->GoingAway.connect (mem_fun (*this, &ReturnUIWindow::return_going_away)); signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window *> (this))); } diff --git a/gtk2_ardour/return_ui.h b/gtk2_ardour/return_ui.h index 5dca1b9e29..3a5e3c8f3f 100644 --- a/gtk2_ardour/return_ui.h +++ b/gtk2_ardour/return_ui.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ class ReturnUI : public Gtk::HBox sigc::connection screen_update_connection; sigc::connection fast_screen_update_connection; - + void ins_changed (ARDOUR::IOChange, void*); }; diff --git a/gtk2_ardour/rgb_macros.h b/gtk2_ardour/rgb_macros.h index 5660e90ee6..d5b5722687 100644 --- a/gtk2_ardour/rgb_macros.h +++ b/gtk2_ardour/rgb_macros.h @@ -1,9 +1,9 @@ /* Copyright (C) 2000 EMC Capital Management, Inc. - + Developed by Jon Trowbridge <trow@gnu.org> and Havoc Pennington <hp@pobox.com>. - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or diff --git a/gtk2_ardour/rhythm_ferret.cc b/gtk2_ardour/rhythm_ferret.cc index aeaff98a54..44c3d8a9bb 100644 --- a/gtk2_ardour/rhythm_ferret.cc +++ b/gtk2_ardour/rhythm_ferret.cc @@ -92,7 +92,7 @@ RhythmFerret::RhythmFerret (PublicEditor& e) ferret_packer.set_spacing (6); ferret_packer.set_border_width (6); - + vector<string> strings; analysis_mode_strings = I18N (_analysis_mode_strings); @@ -102,7 +102,7 @@ RhythmFerret::RhythmFerret (PublicEditor& e) onset_function_strings = I18N (_onset_function_strings); Gtkmm2ext::set_popdown_strings (onset_detection_function_selector, onset_function_strings); - /* Onset plugin uses complex domain as default function + /* Onset plugin uses complex domain as default function XXX there should be a non-hacky way to set this */ onset_detection_function_selector.set_active_text (onset_function_strings[3]); @@ -124,13 +124,13 @@ RhythmFerret::RhythmFerret (PublicEditor& e) ferret_packer.pack_start (analyze_button, false, false); analyze_button.signal_clicked().connect (mem_fun (*this, &RhythmFerret::run_analysis)); - + box = manage (new HBox); box->set_spacing (6); box->pack_start (detection_threshold_label, false, false); box->pack_start (detection_threshold_scale, true, true); perc_onset_packer.pack_start (*box, false, false); - + box = manage (new HBox); box->set_spacing (6); box->pack_start (sensitivity_label, false, false); @@ -142,13 +142,13 @@ RhythmFerret::RhythmFerret (PublicEditor& e) box->pack_start (onset_function_label, false, false); box->pack_start (onset_detection_function_selector, true, true); note_onset_packer.pack_start (*box, false, false); - + box = manage (new HBox); box->set_spacing (6); box->pack_start (peak_picker_label, false, false); box->pack_start (peak_picker_threshold_scale, true, true); note_onset_packer.pack_start (*box, false, false); - + box = manage (new HBox); box->set_spacing (6); box->pack_start (silence_label, false, false); @@ -158,7 +158,7 @@ RhythmFerret::RhythmFerret (PublicEditor& e) analysis_mode_changed (); ferret_frame.add (ferret_packer); - + logo = manage (new Gtk::Image (::get_icon (X_("ferret_02")))); if (logo) { @@ -171,7 +171,7 @@ RhythmFerret::RhythmFerret (PublicEditor& e) lower_hpacker.set_spacing (6); action_button.signal_clicked().connect (mem_fun (*this, &RhythmFerret::do_action)); - + get_vbox()->set_border_width (6); get_vbox()->set_spacing (6); get_vbox()->pack_start (upper_hpacker, true, true); @@ -210,7 +210,7 @@ RhythmFerret::get_analysis_mode () const if (str == analysis_mode_strings[(int) NoteOnset]) { return NoteOnset; - } + } return PercussionOnset; } @@ -289,7 +289,7 @@ RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readabl } /* merge */ - + results.insert (results.end(), these_results.begin(), these_results.end()); these_results.clear (); } @@ -323,29 +323,29 @@ RhythmFerret::run_note_onset_analysis (boost::shared_ptr<Readable> readable, nfr { try { OnsetDetector t (session->frame_rate()); - + for (uint32_t i = 0; i < readable->n_channels(); ++i) { - + AnalysisFeatureList these_results; - + t.reset (); - + t.set_function (get_note_onset_function()); t.set_silence_threshold (silence_threshold_adjustment.get_value()); t.set_peak_threshold (peak_picker_threshold_adjustment.get_value()); - + if (t.run ("", readable.get(), i, these_results)) { continue; } - + /* translate all transients to give absolute position */ - + for (AnalysisFeatureList::iterator x = these_results.begin(); x != these_results.end(); ++x) { (*x) += offset; } - + /* merge */ - + results.insert (results.end(), these_results.begin(), these_results.end()); these_results.clear (); } @@ -407,7 +407,7 @@ RhythmFerret::do_split_action () i = tmp; } - + session->commit_reversible_command (); } diff --git a/gtk2_ardour/rhythm_ferret.h b/gtk2_ardour/rhythm_ferret.h index 91c10695ad..68d3d5f9e4 100644 --- a/gtk2_ardour/rhythm_ferret.h +++ b/gtk2_ardour/rhythm_ferret.h @@ -36,7 +36,7 @@ class RhythmFerret : public ArdourDialog { DefineTempoMap, ConformRegion }; - + RhythmFerret (PublicEditor&); ~RhythmFerret (); @@ -44,7 +44,7 @@ class RhythmFerret : public ArdourDialog { protected: void on_hide (); - + private: PublicEditor& editor; diff --git a/gtk2_ardour/route_group_dialog.cc b/gtk2_ardour/route_group_dialog.cc index 83a36d083f..4bcc26a35a 100644 --- a/gtk2_ardour/route_group_dialog.cc +++ b/gtk2_ardour/route_group_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,12 +63,12 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, StockID const & s) HBox* hbox = manage (new HBox); hbox->set_spacing (6); l = manage (new Label (_("Name:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false )); - + hbox->pack_start (*l, false, true); hbox->pack_start (_name, true, true); vbox->pack_start (*hbox, false, true); - + VBox* options_box = manage (new VBox); options_box->set_spacing (6); @@ -88,7 +88,7 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, StockID const & s) _edit.set_active (_group->property (RouteGroup::Edit)); gain_toggled (); - + Table* table = manage (new Table (8, 3, false)); table->set_row_spacings (6); diff --git a/gtk2_ardour/route_group_dialog.h b/gtk2_ardour/route_group_dialog.h index e35a42f648..35080ba21f 100644 --- a/gtk2_ardour/route_group_dialog.h +++ b/gtk2_ardour/route_group_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,7 +33,7 @@ public: int do_run (); -private: +private: ARDOUR::RouteGroup* _group; Gtk::Entry _name; diff --git a/gtk2_ardour/route_group_menu.cc b/gtk2_ardour/route_group_menu.cc index cdb264aa9c..6c3e9db73d 100644 --- a/gtk2_ardour/route_group_menu.cc +++ b/gtk2_ardour/route_group_menu.cc @@ -39,7 +39,7 @@ void RouteGroupMenu::rebuild (RouteGroup* curr) { using namespace Menu_Helpers; - + items().clear (); items().push_back (MenuElem (_("New group..."), mem_fun (*this, &RouteGroupMenu::new_group))); @@ -51,7 +51,7 @@ RouteGroupMenu::rebuild (RouteGroup* curr) if (curr == 0) { static_cast<RadioMenuItem*> (&items().back())->set_active (); } - + _session.foreach_route_group (bind (mem_fun (*this, &RouteGroupMenu::add_item), curr, &group)); } @@ -61,10 +61,10 @@ RouteGroupMenu::add_item (RouteGroup* rg, RouteGroup* curr, RadioMenuItem::Group using namespace Menu_Helpers; items().push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &RouteGroupMenu::set_group), rg))); - + if (rg == curr) { static_cast<RadioMenuItem*> (&items().back())->set_active (); - } + } } void diff --git a/gtk2_ardour/route_group_menu.h b/gtk2_ardour/route_group_menu.h index 7827179acb..ba955f64a2 100644 --- a/gtk2_ardour/route_group_menu.h +++ b/gtk2_ardour/route_group_menu.h @@ -31,12 +31,12 @@ public: void rebuild (ARDOUR::RouteGroup *); sigc::signal<void, ARDOUR::RouteGroup*> GroupSelected; - + private: void add_item (ARDOUR::RouteGroup *, ARDOUR::RouteGroup *, Gtk::RadioMenuItem::Group*); void new_group (); void set_group (ARDOUR::RouteGroup *); - + ARDOUR::Session& _session; ARDOUR::RouteGroup::Property _default_properties; }; diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index fe3d59d837..fc7c7bb7ce 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -64,7 +64,7 @@ RouteParams_UI::RouteParams_UI () : ArdourDialog ("track/bus inspector"), latency_apply_button (Stock::APPLY), track_menu(0) - + { insert_box = 0; _input_iosel = 0; @@ -103,17 +103,17 @@ RouteParams_UI::RouteParams_UI () route_select_frame.add(route_select_scroller); list_vpacker.pack_start (route_select_frame, true, true); - + notebook.pages().push_back (TabElem (input_frame, _("Inputs"))); notebook.pages().push_back (TabElem (output_frame, _("Outputs"))); notebook.pages().push_back (TabElem (redir_hpane, _("Plugins, Inserts & Sends"))); notebook.pages().push_back (TabElem (latency_frame, _("Latency"))); notebook.set_name ("InspectorNotebook"); - + title_label.set_name ("RouteParamsTitleLabel"); update_title(); - + latency_packer.set_spacing (18); latency_button_box.pack_start (latency_apply_button); delay_label.set_alignment (0, 0.5); @@ -121,32 +121,32 @@ RouteParams_UI::RouteParams_UI () // changeable area route_param_frame.set_name("RouteParamsBaseFrame"); route_param_frame.set_shadow_type (Gtk::SHADOW_IN); - - + + route_hpacker.pack_start (notebook, true, true); - + route_vpacker.pack_start (title_label, false, false); route_vpacker.pack_start (route_hpacker, true, true); - + list_hpane.pack1 (list_vpacker); list_hpane.add2 (route_vpacker); list_hpane.set_position(110); redir_hpane.set_position(110); - + //global_vpacker.pack_start (list_hpane, true, true); //get_vbox()->pack_start (global_vpacker); get_vbox()->pack_start (list_hpane); - - + + set_name ("RouteParamsWindow"); set_default_size (620,370); set_wmclass (X_("ardour_route_parameters"), "Ardour"); WindowTitle title(Glib::get_application_name()); - title += _("Track/Bus Inspector"); + title += _("Track/Bus Inspector"); set_title (title.get_string()); @@ -155,9 +155,9 @@ RouteParams_UI::RouteParams_UI () route_display.get_column(0)->signal_clicked().connect(mem_fun(*this, &RouteParams_UI::show_track_menu)); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_RELEASE_MASK); - + _plugin_selector = new PluginSelector (PluginManager::the_manager()); - _plugin_selector->signal_delete_event().connect (bind (ptr_fun (just_hide_it), + _plugin_selector->signal_delete_event().connect (bind (ptr_fun (just_hide_it), static_cast<Window *> (_plugin_selector))); @@ -172,20 +172,20 @@ void RouteParams_UI::add_routes (RouteList& routes) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::add_routes), routes)); - + for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) { boost::shared_ptr<Route> route = (*x); if (route->is_hidden()) { return; } - + TreeModel::Row row = *(route_display_model->append()); row[route_display_columns.text] = route->name(); row[route_display_columns.route] = route; - + //route_select_list.rows().back().select (); - + route->NameChanged.connect (bind (mem_fun(*this, &RouteParams_UI::route_name_changed), route)); route->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::route_removed), route)); } @@ -225,7 +225,7 @@ RouteParams_UI::setup_processor_boxes() // just in case... shouldn't need this cleanup_processor_boxes(); - + // construct new redirect boxes insert_box = new ProcessorBox(*session, *_plugin_selector, _rr_selection, 0); insert_box->set_route (_route); @@ -293,7 +293,7 @@ RouteParams_UI::setup_latency_frame () latency_apply_conn = latency_apply_button.signal_clicked().connect (mem_fun (*latency_widget, &LatencyGUI::finish)); latency_conn = _route->signal_latency_changed.connect (mem_fun (*this, &RouteParams_UI::refresh_latency)); delay_conn = _route->initial_delay_changed.connect (mem_fun (*this, &RouteParams_UI::refresh_latency)); - + latency_frame.add (latency_packer); latency_frame.show_all (); } @@ -302,13 +302,13 @@ void RouteParams_UI::setup_io_frames() { cleanup_io_frames(); - + // input _input_iosel = new IOSelector (this, *session, _route->input()); _input_iosel->setup (); input_frame.add (*_input_iosel); input_frame.show_all(); - + // output _output_iosel = new IOSelector (this, *session, _route->output()); _output_iosel->setup (); @@ -340,7 +340,7 @@ RouteParams_UI::cleanup_view (bool stopupdate) { if (_active_view) { GenericPluginUI * plugui = 0; - + if (stopupdate && (plugui = dynamic_cast<GenericPluginUI*>(_active_view)) != 0) { plugui->stop_updating (0); } @@ -373,7 +373,7 @@ RouteParams_UI::route_removed (boost::shared_ptr<Route> route) cleanup_io_frames(); cleanup_view(); cleanup_processor_boxes(); - + _route.reset ((Route*) 0); _processor.reset ((Processor*) 0); update_title(); @@ -400,7 +400,7 @@ RouteParams_UI::set_session (Session *sess) //route_select_list.thaw (); _plugin_selector->set_session (session); -} +} void @@ -487,7 +487,7 @@ RouteParams_UI::processors_changed () { ENSURE_GUI_THREAD(mem_fun(*this, &RouteParams_UI::processors_changed)); cleanup_view(); - + _processor.reset ((Processor*) 0); //update_title(); @@ -497,12 +497,12 @@ void RouteParams_UI::show_track_menu() { using namespace Menu_Helpers; - + if (track_menu == 0) { track_menu = new Menu; track_menu->set_name ("ArdourContextMenu"); - track_menu->items().push_back - (MenuElem (_("Add Track/Bus"), + track_menu->items().push_back + (MenuElem (_("Add Track/Bus"), bind (mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::add_route), (Gtk::Window*) 0))); } track_menu->popup (1, gtk_get_current_event_time()); @@ -515,7 +515,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> insert) boost::shared_ptr<Return> retrn; boost::shared_ptr<PluginInsert> plugin_insert; boost::shared_ptr<PortInsert> port_insert; - + if ((send = boost::dynamic_pointer_cast<Send> (insert)) != 0) { SendUI *send_ui = new SendUI (this, send, *session); @@ -524,7 +524,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> insert) _plugin_conn = send->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::redirect_going_away), insert)); _active_view = send_ui; - + redir_hpane.add2 (*_active_view); redir_hpane.show_all(); @@ -536,11 +536,11 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> insert) _plugin_conn = retrn->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::redirect_going_away), insert)); _active_view = return_ui; - + redir_hpane.add2 (*_active_view); redir_hpane.show_all(); - } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (insert)) != 0) { + } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (insert)) != 0) { GenericPluginUI *plugin_ui = new GenericPluginUI (plugin_insert, true); @@ -555,7 +555,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> insert) } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (insert)) != 0) { PortInsertUI *portinsert_ui = new PortInsertUI (this, *session, port_insert); - + cleanup_view(); _plugin_conn = port_insert->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::redirect_going_away), insert)); @@ -564,18 +564,18 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> insert) portinsert_ui->redisplay(); redir_hpane.show_all(); } - + _processor = insert; - + update_title(); - + } void RouteParams_UI::plugin_going_away (Placement place) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::plugin_going_away), place)); - + // delete the current view without calling finish if (place == PreFader) { @@ -589,13 +589,13 @@ RouteParams_UI::redirect_going_away (boost::shared_ptr<ARDOUR::Processor> insert { ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::redirect_going_away), insert)); - + printf ("redirect going away\n"); // delete the current view without calling finish if (insert == _processor) { cleanup_view (false); _processor.reset ((Processor*) 0); - } + } } void @@ -628,13 +628,13 @@ RouteParams_UI::update_title () title_label.set_text(_("No Route Selected")); title += _("No Route Selected"); set_title(title.get_string()); - } + } } void RouteParams_UI::start_updating () { - update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect + update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (mem_fun(*this, &RouteParams_UI::update_views)); } @@ -649,7 +649,7 @@ RouteParams_UI::update_views () { SendUI *sui; // TODO: only do it if correct tab is showing - + if ((sui = dynamic_cast<SendUI*> (_active_view)) != 0) { sui->update (); } diff --git a/gtk2_ardour/route_params_ui.h b/gtk2_ardour/route_params_ui.h index 5fd7487bc1..75c0ef731d 100644 --- a/gtk2_ardour/route_params_ui.h +++ b/gtk2_ardour/route_params_ui.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -88,17 +88,17 @@ class RouteParams_UI : public ArdourDialog Gtk::VBox route_vpacker; ProcessorBox* insert_box; - + Gtk::HPaned list_hpane; Gtk::HPaned right_hpane; - + Gtk::Frame route_choice_frame; Gtk::Frame route_param_frame; Gtk::VBox choice_vpacker; - + Gtk::Frame latency_frame; Gtk::VBox latency_packer; Gtk::HButtonBox latency_button_box; @@ -110,17 +110,17 @@ class RouteParams_UI : public ArdourDialog sigc::connection latency_apply_conn; void refresh_latency (); - + Gtk::ToggleButton input_button; Gtk::ToggleButton output_button; Gtk::Label track_input_label; - + Gtk::Label title_label; - + Gtk::Container * _active_view; IOSelector * _input_iosel; IOSelector * _output_iosel; - + PluginSelector *_plugin_selector; RouteRedirectSelection _rr_selection; @@ -131,16 +131,16 @@ class RouteParams_UI : public ArdourDialog boost::shared_ptr<ARDOUR::Processor> _processor; sigc::connection _plugin_conn; - + enum ConfigView { NO_CONFIG_VIEW = 0, INPUT_CONFIG_VIEW, OUTPUT_CONFIG_VIEW, - PLUGIN_CONFIG_VIEW, + PLUGIN_CONFIG_VIEW, PORTINSERT_CONFIG_VIEW, SEND_CONFIG_VIEW }; - + ConfigView _current_view; @@ -158,7 +158,7 @@ class RouteParams_UI : public ArdourDialog Gtk::TreeView route_display; Glib::RefPtr<Gtk::ListStore> route_display_model; - + void add_routes (ARDOUR::RouteList&); void route_name_changed (boost::shared_ptr<ARDOUR::Route> route); @@ -173,25 +173,25 @@ class RouteParams_UI : public ArdourDialog void cleanup_view(bool stopupdate = true); void cleanup_latency_frame (); void setup_latency_frame (); - + void processors_changed (); - + void setup_processor_boxes(); void cleanup_processor_boxes(); void redirect_selected (boost::shared_ptr<ARDOUR::Processor>); - + void plugin_going_away (ARDOUR::Placement); void redirect_going_away (boost::shared_ptr<ARDOUR::Processor>); gint edit_input_configuration (GdkEventButton *ev); gint edit_output_configuration (GdkEventButton *ev); - + void update_routeinfo (ARDOUR::Route * route); - + Gtk::Menu *track_menu; void show_track_menu(); - + void update_title (); //void unselect_all_redirects (); diff --git a/gtk2_ardour/route_processor_selection.cc b/gtk2_ardour/route_processor_selection.cc index 243a32b0c5..dfc345f63e 100644 --- a/gtk2_ardour/route_processor_selection.cc +++ b/gtk2_ardour/route_processor_selection.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -130,4 +130,4 @@ RouteRedirectSelection::empty () { return processors.empty () && routes.empty (); } - + diff --git a/gtk2_ardour/route_processor_selection.h b/gtk2_ardour/route_processor_selection.h index bb0e6701e1..83bdbc2d8b 100644 --- a/gtk2_ardour/route_processor_selection.h +++ b/gtk2_ardour/route_processor_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ #include "processor_selection.h" #include "route_selection.h" -class RouteRedirectSelection : public sigc::trackable +class RouteRedirectSelection : public sigc::trackable { public: ProcessorSelection processors; diff --git a/gtk2_ardour/route_selection.h b/gtk2_ardour/route_selection.h index 311641b4ae..c11feabc13 100644 --- a/gtk2_ardour/route_selection.h +++ b/gtk2_ardour/route_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 9a3a6a3124..954841a163 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -210,7 +210,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh ARDOUR_UI::instance()->tooltips().set_tip(automation_button, _("Automation")); ARDOUR_UI::instance()->tooltips().set_tip(visual_button, _("Visual options")); ARDOUR_UI::instance()->tooltips().set_tip(hide_button, _("Hide this track")); - + label_view (); if (0) { @@ -259,7 +259,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh _session, (RouteGroup::Property) (RouteGroup::Mute | RouteGroup::Solo | RouteGroup::Edit) ); - + route_group_menu->GroupSelected.connect (mem_fun (*this, &RouteTimeAxisView::set_route_group_from_menu)); gm.get_gain_slider().signal_scroll_event().connect(mem_fun(*this, &RouteTimeAxisView::controls_ebox_scroll), false); @@ -276,7 +276,7 @@ RouteTimeAxisView::~RouteTimeAxisView () delete playlist_menu; playlist_menu = 0; - + delete playlist_action_menu; playlist_action_menu = 0; @@ -286,7 +286,7 @@ RouteTimeAxisView::~RouteTimeAxisView () for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) { delete i->second; } - + _automation_tracks.clear (); delete route_group_menu; @@ -362,12 +362,12 @@ void RouteTimeAxisView::playlist_click () { // always build a new action menu - + delete playlist_action_menu; playlist_action_menu = new Menu; playlist_action_menu->set_name ("ArdourContextMenu"); - + build_playlist_menu (playlist_action_menu); conditionally_add_to_selection (); @@ -394,7 +394,7 @@ RouteTimeAxisView::set_state (const XMLNode& node) if (_view && (prop = node.property ("layer-display"))) { set_layer_display (LayerDisplay (string_2_enum (prop->value(), _view->layer_display ()))); } - + for (iter = kids.begin(); iter != kids.end(); ++iter) { if ((*iter)->name() == AutomationTimeAxisView::state_node_name) { if ((prop = (*iter)->property ("automation-id")) != 0) { @@ -419,7 +419,7 @@ RouteTimeAxisView::build_automation_action_menu () automation_action_menu = manage (new Menu); MenuList& automation_items = automation_action_menu->items(); automation_action_menu->set_name ("ArdourContextMenu"); - + automation_items.push_back (MenuElem (_("Show all automation"), mem_fun(*this, &RouteTimeAxisView::show_all_automation))); @@ -434,7 +434,7 @@ RouteTimeAxisView::build_automation_action_menu () automation_items.push_back (MenuElem (_("Plugins"), subplugin_menu)); automation_items.back().set_sensitive (!subplugin_menu.items().empty()); - + map<Evoral::Parameter, RouteAutomationNode*>::iterator i; for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) { @@ -442,7 +442,7 @@ RouteTimeAxisView::build_automation_action_menu () delete i->second->menu_item; - automation_items.push_back(CheckMenuElem (_route->describe_parameter(i->second->param), + automation_items.push_back(CheckMenuElem (_route->describe_parameter(i->second->param), bind (mem_fun(*this, &RouteTimeAxisView::toggle_automation_track), i->second->param))); i->second->menu_item = static_cast<Gtk::CheckMenuItem*>(&automation_items.back()); @@ -469,7 +469,7 @@ RouteTimeAxisView::build_display_menu () MenuList& items = display_menu->items(); display_menu->set_name ("ArdourContextMenu"); - + items.push_back (MenuElem (_("Height"), *size_menu)); items.push_back (MenuElem (_("Color"), mem_fun(*this, &RouteTimeAxisView::select_track_color))); @@ -486,7 +486,7 @@ RouteTimeAxisView::build_display_menu () // Hook for derived classes to add type specific stuff append_extra_display_menu_items (); items.push_back (SeparatorElem()); - + if (is_track()) { Menu *layers_menu = manage(new Menu); @@ -524,7 +524,7 @@ RouteTimeAxisView::build_display_menu () items.push_back (MenuElem (_("Alignment"), *alignment_menu)); get_diskstream()->AlignmentStyleChanged.connect ( mem_fun(*this, &RouteTimeAxisView::align_style_changed)); - + RadioMenuItem::Group mode_group; items.push_back (RadioMenuElem (mode_group, _("Normal mode"), bind ( mem_fun (*this, &RouteTimeAxisView::set_track_mode), @@ -539,9 +539,9 @@ RouteTimeAxisView::build_display_menu () items.push_back (RadioMenuElem (mode_group, _("No layering mode"), bind (mem_fun (*this, &RouteTimeAxisView::set_track_mode), ARDOUR::NonLayered))); non_layered_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back()); - - + + switch (track()->mode()) { case ARDOUR::Destructive: destructive_track_mode_item->set_active (); @@ -561,11 +561,11 @@ RouteTimeAxisView::build_display_menu () mode_menu = build_mode_menu(); if (mode_menu) items.push_back (MenuElem (_("Mode"), *mode_menu)); - + color_mode_menu = build_color_mode_menu(); if (color_mode_menu) items.push_back (MenuElem (_("Color Mode"), *color_mode_menu)); - + items.push_back (SeparatorElem()); } @@ -618,7 +618,7 @@ RouteTimeAxisView::set_track_mode (TrackMode mode) /*NOTREACHED*/ return; } - + if (item && other_item && other_item_2 && item->get_active() && track()->mode() != mode) { _set_track_mode (track().get(), mode, other_item, other_item_2); } @@ -662,7 +662,7 @@ void RouteTimeAxisView::track_mode_changed () { RadioMenuItem* item; - + switch (track()->mode()) { case ARDOUR::Normal: item = normal_track_mode_item; @@ -688,12 +688,12 @@ RouteTimeAxisView::show_timestretch (nframes_t start, nframes_t end) double x1; double x2; double y2; - + TimeAxisView::show_timestretch (start, end); hide_timestretch (); -#if 0 +#if 0 if (ts.empty()) { return; } @@ -709,7 +709,7 @@ RouteTimeAxisView::show_timestretch (nframes_t start, nframes_t end) } /* ignore it if our edit group is not active */ - + if ((ts.track != this) && _route->route_group() && !_route->route_group()->is_active()) { return; } @@ -731,7 +731,7 @@ RouteTimeAxisView::show_timestretch (nframes_t start, nframes_t end) x1 = start / _editor.get_current_zoom(); x2 = (end - 1) / _editor.get_current_zoom(); y2 = current_height() - 2; - + timestretch_rect->property_x1() = x1; timestretch_rect->property_y1() = 1.0; timestretch_rect->property_x2() = x2; @@ -807,7 +807,7 @@ RouteTimeAxisView::set_height (uint32_t h) visual_button.show(); size_button.show(); automation_button.show(); - + if (is_track() && track()->mode() == ARDOUR::Normal) { playlist_button.show(); } @@ -833,7 +833,7 @@ RouteTimeAxisView::set_height (uint32_t h) visual_button.hide (); size_button.hide (); automation_button.hide (); - + if (is_track() && track()->mode() == ARDOUR::Normal) { playlist_button.hide (); } @@ -854,7 +854,7 @@ RouteTimeAxisView::set_height (uint32_t h) hide_name_entry (); show_name_label (); - + gm.get_gain_slider().hide(); mute_button->hide(); solo_button->hide(); @@ -901,7 +901,7 @@ RouteTimeAxisView::set_samples_per_unit (double spu) if (get_diskstream() != 0) { speed = get_diskstream()->speed(); } - + if (_view) { _view->set_samples_per_unit (spu * speed); } @@ -981,7 +981,7 @@ RouteTimeAxisView::rename_current_playlist () } } -std::string +std::string RouteTimeAxisView::resolve_new_group_playlist_name(std::string &basename, vector<boost::shared_ptr<Playlist> > const & playlists) { std::string ret (basename); @@ -993,7 +993,7 @@ RouteTimeAxisView::resolve_new_group_playlist_name(std::string &basename, vector for (vector<boost::shared_ptr<Playlist> >::const_iterator i = playlists.begin(); i != playlists.end(); ++i) { std::string tmp = (*i)->name(); - std::string::size_type idx = tmp.find(group_string); + std::string::size_type idx = tmp.find(group_string); // find those which belong to this group if (idx != string::npos) { tmp = tmp.substr(idx + group_string.length()); @@ -1010,7 +1010,7 @@ RouteTimeAxisView::resolve_new_group_playlist_name(std::string &basename, vector char buf[32]; snprintf (buf, sizeof(buf), "%d", maxnumber); - + ret = this->name() + "." + route_group()->name () + "." + buf; return ret; @@ -1020,7 +1020,7 @@ void RouteTimeAxisView::use_copy_playlist (bool prompt, vector<boost::shared_ptr<Playlist> > const & playlists_before_op) { string name; - + boost::shared_ptr<Diskstream> ds = get_diskstream(); if (!ds || ds->destructive()) return; @@ -1030,7 +1030,7 @@ RouteTimeAxisView::use_copy_playlist (bool prompt, vector<boost::shared_ptr<Play return; name = pl->name(); - + if (route_group() && route_group()->is_active()) { name = resolve_new_group_playlist_name(name, playlists_before_op); } @@ -1045,18 +1045,18 @@ RouteTimeAxisView::use_copy_playlist (bool prompt, vector<boost::shared_ptr<Play if (prompt) { ArdourPrompter prompter (true); - + prompter.set_prompt (_("Name for Playlist")); prompter.set_initial_text (name); prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT); prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, true); prompter.show_all (); - + switch (prompter.run ()) { case Gtk::RESPONSE_ACCEPT: prompter.get_result (name); break; - + default: return; } @@ -1072,7 +1072,7 @@ void RouteTimeAxisView::use_new_playlist (bool prompt, vector<boost::shared_ptr<Playlist> > const & playlists_before_op) { string name; - + boost::shared_ptr<Diskstream> ds = get_diskstream(); if (!ds || ds->destructive()) return; @@ -1082,7 +1082,7 @@ RouteTimeAxisView::use_new_playlist (bool prompt, vector<boost::shared_ptr<Playl return; name = pl->name(); - + if (route_group() && route_group()->is_active()) { name = resolve_new_group_playlist_name(name,playlists_before_op); } @@ -1093,9 +1093,9 @@ RouteTimeAxisView::use_new_playlist (bool prompt, vector<boost::shared_ptr<Playl if (prompt) { - + ArdourPrompter prompter (true); - + prompter.set_prompt (_("Name for Playlist")); prompter.set_initial_text (name); prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT); @@ -1105,7 +1105,7 @@ RouteTimeAxisView::use_new_playlist (bool prompt, vector<boost::shared_ptr<Playl case Gtk::RESPONSE_ACCEPT: prompter.get_result (name); break; - + default: return; } @@ -1141,7 +1141,7 @@ void RouteTimeAxisView::diskstream_changed () { Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &RouteTimeAxisView::update_diskstream_display)); -} +} void RouteTimeAxisView::update_diskstream_display () @@ -1150,7 +1150,7 @@ RouteTimeAxisView::update_diskstream_display () return; map_frozen (); -} +} void RouteTimeAxisView::selection_click (GdkEventButton* ev) @@ -1165,7 +1165,7 @@ RouteTimeAxisView::selection_click (GdkEventButton* ev) } return; - } + } PublicEditor::TrackViewList* tracks = _editor.get_valid_views (this, _route->route_group()); @@ -1173,7 +1173,7 @@ RouteTimeAxisView::selection_click (GdkEventButton* ev) case Selection::Toggle: _editor.get_selection().toggle (*tracks); break; - + case Selection::Set: _editor.get_selection().set (*tracks); break; @@ -1219,11 +1219,11 @@ void RouteTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& results) { double speed = 1.0; - + if (get_diskstream() != 0) { speed = get_diskstream()->speed(); } - + nframes_t start_adjusted = session_frame_to_track_frame(start, speed); nframes_t end_adjusted = session_frame_to_track_frame(end, speed); @@ -1232,7 +1232,7 @@ RouteTimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, } /* pick up visible automation tracks */ - + for (Children::iterator i = children.begin(); i != children.end(); ++i) { if (!(*i)->hidden()) { (*i)->get_selectables (start_adjusted, end_adjusted, top, bot, results); @@ -1277,7 +1277,7 @@ RouteTimeAxisView::automation_track (Evoral::Parameter param) } /** Shorthand for GainAutomation, etc. - */ + */ RouteTimeAxisView::RouteAutomationNode* RouteTimeAxisView::automation_track (AutomationType type) { @@ -1297,12 +1297,12 @@ RouteTimeAxisView::name() const } boost::shared_ptr<Playlist> -RouteTimeAxisView::playlist () const +RouteTimeAxisView::playlist () const { boost::shared_ptr<Diskstream> ds; if ((ds = get_diskstream()) != 0) { - return ds->playlist(); + return ds->playlist(); } else { return boost::shared_ptr<Playlist> (); } @@ -1314,7 +1314,7 @@ RouteTimeAxisView::name_entry_changed () string x; x = name_entry.get_text (); - + if (x == _route->name()) { return; } @@ -1348,9 +1348,9 @@ RouteTimeAxisView::hide_click () { // LAME fix for hide_button refresh fix hide_button.set_sensitive(false); - + _editor.hide_track_in_display (*this); - + hide_button.set_sensitive(true); } @@ -1367,7 +1367,7 @@ RouteTimeAxisView::find_next_region (nframes_t pos, RegionPoint point, int32_t d return boost::shared_ptr<Region> (); } -nframes64_t +nframes64_t RouteTimeAxisView::find_next_region_boundary (nframes64_t pos, int32_t dir) { boost::shared_ptr<Diskstream> stream; @@ -1403,7 +1403,7 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) (*i).end = session_frame_to_track_frame((*i).end, speed); } } - + XMLNode &before = playlist->get_state(); switch (op) { case Cut: @@ -1440,7 +1440,7 @@ RouteTimeAxisView::paste (nframes_t pos, float times, Selection& selection, size boost::shared_ptr<Playlist> playlist = get_diskstream()->playlist(); PlaylistSelection::iterator p; - + for (p = selection.playlists.begin(); p != selection.playlists.end() && nth; ++p, --nth) {} if (p == selection.playlists.end()) { @@ -1450,7 +1450,7 @@ RouteTimeAxisView::paste (nframes_t pos, float times, Selection& selection, size if (get_diskstream()->speed() != 1.0f) { pos = session_frame_to_track_frame(pos, get_diskstream()->speed() ); } - + XMLNode &before = playlist->get_state(); playlist->paste (*p, pos, times); _session.add_command( new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state())); @@ -1463,7 +1463,7 @@ TimeAxisView::Children RouteTimeAxisView::get_child_list() { TimeAxisView::Children redirect_children; - + for (Children::iterator i = children.begin(); i != children.end(); ++i) { if (!(*i)->hidden()) { redirect_children.push_back(*i); @@ -1496,7 +1496,7 @@ RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu) RadioMenuItem::Group playlist_group; _session.get_playlists (playlists); - + for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) { if ((*i)->get_orig_diskstream_id() == ds->id()) { @@ -1507,10 +1507,10 @@ RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu) static_cast<RadioMenuItem*>(&playlist_items.back())->set_active(); } } else if (ds->playlist()->id() == (*i)->id()) { - playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name(), bind (mem_fun (*this, &RouteTimeAxisView::use_playlist), + playlist_items.push_back (RadioMenuElem (playlist_group, (*i)->name(), bind (mem_fun (*this, &RouteTimeAxisView::use_playlist), boost::weak_ptr<Playlist>(*i)))); static_cast<RadioMenuItem*>(&playlist_items.back())->set_active(); - + } } @@ -1526,7 +1526,7 @@ RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu) // Use a label which tells the user what is happening playlist_items.push_back (MenuElem (_("New Take"), bind(mem_fun(_editor, &PublicEditor::new_playlists), this))); playlist_items.push_back (MenuElem (_("Copy Take"), bind(mem_fun(_editor, &PublicEditor::copy_playlists), this))); - + } playlist_items.push_back (SeparatorElem()); @@ -1548,10 +1548,10 @@ RouteTimeAxisView::use_playlist (boost::weak_ptr<Playlist> wpl) } boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl); - + if (apl) { if (get_diskstream()->playlist() == apl) { - // radio button cotnrols mean this function is called for both the + // radio button cotnrols mean this function is called for both the // old and new playlist return; } @@ -1569,12 +1569,12 @@ RouteTimeAxisView::use_playlist (boost::weak_ptr<Playlist> wpl) return; take_name = take_name.substr(idx + group_string.length()); // find the bit containing the take number / name - + for (list<Route*>::const_iterator i = route_group()->route_list().begin(); i != route_group()->route_list().end(); ++i) { if ( (*i) == this->route().get()) { continue; } - + std::string playlist_name = (*i)->name()+group_string+take_name; Track *track = dynamic_cast<Track *>(*i); @@ -1591,7 +1591,7 @@ RouteTimeAxisView::use_playlist (boost::weak_ptr<Playlist> wpl) } else { track->diskstream()->use_playlist(ipl); } - + //(*i)->get_dis } } @@ -1662,7 +1662,7 @@ RouteTimeAxisView::toggle_automation_track (Evoral::Parameter param) } /* now trigger a redisplay */ - + if (!no_redraw) { _route->gui_changed (X_("track_height"), (void *) 0); /* EMIT_SIGNAL */ } @@ -1676,7 +1676,7 @@ RouteTimeAxisView::automation_track_hidden (Evoral::Parameter param) if (!ran) { return; } - + // if Evoral::Parameter::operator< doesn't obey strict weak ordering, we may crash here.... _show_automation.erase(param); ran->track->get_state_node()->add_property (X_("shown"), X_("no")); @@ -1693,7 +1693,7 @@ void RouteTimeAxisView::show_all_automation () { no_redraw = true; - + /* Show our automation */ map<Evoral::Parameter, RouteAutomationNode*>::iterator i; @@ -1711,7 +1711,7 @@ RouteTimeAxisView::show_all_automation () for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) { if ((*ii)->view == 0) { add_processor_automation_curve ((*i)->processor, (*ii)->what); - } + } (*ii)->menu_item->set_active (true); } @@ -1728,7 +1728,7 @@ void RouteTimeAxisView::show_existing_automation () { no_redraw = true; - + /* Show our automation */ map<Evoral::Parameter, RouteAutomationNode*>::iterator i; @@ -1753,7 +1753,7 @@ RouteTimeAxisView::show_existing_automation () } no_redraw = false; - + _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */ } @@ -1793,7 +1793,7 @@ RouteTimeAxisView::region_view_added (RegionView* rv) if(is_audio_track()) { for (Children::iterator i = children.begin(); i != children.end(); ++i) { boost::shared_ptr<AutomationTimeAxisView> atv; - + if ((atv = boost::dynamic_pointer_cast<AutomationTimeAxisView> (*i)) != 0) { atv->add_ghost(rv); } @@ -1844,7 +1844,7 @@ RouteTimeAxisView::find_processor_automation_node (boost::shared_ptr<Processor> return 0; } -static string +static string legalize_for_xml_node (string str) { string::size_type pos; @@ -1934,14 +1934,14 @@ RouteTimeAxisView::add_existing_processor_automation_curves (boost::weak_ptr<Pro if (!processor) { return; } - + set<Evoral::Parameter> s; boost::shared_ptr<AutomationLine> al; processor->what_has_visible_data (s); for (set<Evoral::Parameter>::iterator i = s.begin(); i != s.end(); ++i) { - + if ((al = find_processor_automation_curve (processor, *i)) != 0) { al->queue_reset (); } else { @@ -1969,7 +1969,7 @@ RouteTimeAxisView::add_automation_child(Evoral::Parameter param, boost::shared_p if (string_is_affirmative (prop->value())) { hideit = false; } - } + } } _automation_tracks.insert(std::make_pair(param, new RouteAutomationNode(param, NULL, track))); @@ -2000,11 +2000,11 @@ RouteTimeAxisView::add_processor_to_subplugin_menu (boost::weak_ptr<Processor> p if (!processor->visible ()) { return; } - + using namespace Menu_Helpers; ProcessorAutomationInfo *rai; list<ProcessorAutomationInfo*>::iterator x; - + const std::set<Evoral::Parameter>& automatable = processor->what_can_be_automated (); std::set<Evoral::Parameter> has_visible_automation; @@ -2045,9 +2045,9 @@ RouteTimeAxisView::add_processor_to_subplugin_menu (boost::weak_ptr<Processor> p ProcessorAutomationNode* pan; CheckMenuItem* mitem; - + string name = processor->describe_parameter (*i); - + items.push_back (CheckMenuElem (name)); mitem = dynamic_cast<CheckMenuItem*> (&items.back()); @@ -2058,9 +2058,9 @@ RouteTimeAxisView::add_processor_to_subplugin_menu (boost::weak_ptr<Processor> p if ((pan = find_processor_automation_node (processor, *i)) == 0) { /* new item */ - + pan = new ProcessorAutomationNode (*i, mitem, *this); - + rai->lines.push_back (pan); } else { @@ -2113,7 +2113,7 @@ RouteTimeAxisView::processor_menu_item_toggled (RouteTimeAxisView::ProcessorAuto if (redraw && !no_redraw) { /* now trigger a redisplay */ - + _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */ } @@ -2123,7 +2123,7 @@ void RouteTimeAxisView::processors_changed () { using namespace Menu_Helpers; - + for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { (*i)->valid = false; } @@ -2145,7 +2145,7 @@ RouteTimeAxisView::processors_changed () delete *i; processor_automation.erase (i); - } + } i = tmp; } @@ -2163,7 +2163,7 @@ RouteTimeAxisView::find_processor_automation_curve (boost::shared_ptr<Processor> if ((pan = find_processor_automation_node (processor, what)) != 0) { if (pan->view) { pan->view->line(); - } + } } return boost::shared_ptr<AutomationLine>(); @@ -2183,7 +2183,7 @@ RouteTimeAxisView::update_rec_display () RouteUI::update_rec_display (); name_entry.set_sensitive (!_route->record_enabled()); } - + void RouteTimeAxisView::set_layer_display (LayerDisplay d) { @@ -2206,7 +2206,7 @@ RouteTimeAxisView::layer_display () const return Overlaid; } - + boost::shared_ptr<AutomationTimeAxisView> RouteTimeAxisView::automation_child(Evoral::Parameter param) @@ -2275,9 +2275,9 @@ RouteTimeAxisView::build_underlay_menu(Gtk::Menu* parent_menu) { Menu* gs_menu = manage (new Menu); gs_menu->set_name ("ArdourContextMenu"); MenuList& gs_items = gs_menu->items(); - + parent_items.push_back (MenuElem (_("Underlays"), *gs_menu)); - + for(UnderlayList::iterator it = _underlay_streams.begin(); it != _underlay_streams.end(); ++it) { gs_items.push_back(MenuElem(string_compose(_("Remove \"%1\""), (*it)->trackview().name()), bind(mem_fun(*this, &RouteTimeAxisView::remove_underlay), *it))); @@ -2286,7 +2286,7 @@ RouteTimeAxisView::build_underlay_menu(Gtk::Menu* parent_menu) { } bool -RouteTimeAxisView::set_underlay_state() +RouteTimeAxisView::set_underlay_state() { if(!underlay_xml_node) { return false; @@ -2295,7 +2295,7 @@ RouteTimeAxisView::set_underlay_state() XMLNodeList nlist = underlay_xml_node->children(); XMLNodeConstIterator niter; XMLNode *child_node; - + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { child_node = *niter; @@ -2319,7 +2319,7 @@ RouteTimeAxisView::set_underlay_state() } void -RouteTimeAxisView::add_underlay(StreamView* v, bool update_xml) +RouteTimeAxisView::add_underlay(StreamView* v, bool update_xml) { if(!v) { return; @@ -2352,7 +2352,7 @@ RouteTimeAxisView::add_underlay(StreamView* v, bool update_xml) } void -RouteTimeAxisView::remove_underlay(StreamView* v) +RouteTimeAxisView::remove_underlay(StreamView* v) { if(!v) { return; diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index 95cbfa8c76..5970c31226 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -89,7 +89,7 @@ public: bool show_automation(Evoral::Parameter param); void set_layer_display (LayerDisplay d); LayerDisplay layer_display () const; - + boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t pos, ARDOUR::RegionPoint, int32_t dir); nframes64_t find_next_region_boundary (nframes64_t pos, int32_t dir); @@ -107,36 +107,36 @@ public: /* group playlist name resolving */ std::string resolve_new_group_playlist_name(std::string &, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &); - + void build_playlist_menu (Gtk::Menu *); void add_underlay (StreamView*, bool update_xml = true); void remove_underlay (StreamView*); void build_underlay_menu(Gtk::Menu*); - + int set_state (const XMLNode&); - + /* This is a bit nasty to expose :/ */ struct RouteAutomationNode { Evoral::Parameter param; Gtk::CheckMenuItem* menu_item; boost::shared_ptr<AutomationTimeAxisView> track; - + RouteAutomationNode (Evoral::Parameter par, Gtk::CheckMenuItem* mi, boost::shared_ptr<AutomationTimeAxisView> tr) : param (par), menu_item (mi), track (tr) {} }; virtual void create_automation_child (const Evoral::Parameter& param, bool show) = 0; - + /* make sure we get the right version of this */ XMLNode* get_automation_child_xml_node (Evoral::Parameter param) { return RouteUI::get_automation_child_xml_node (param); } - + typedef std::map<Evoral::Parameter, RouteAutomationNode*> AutomationTracks; AutomationTracks automation_tracks() { return _automation_tracks; } boost::shared_ptr<AutomationTimeAxisView> automation_child(Evoral::Parameter param); - + std::string name() const; StreamView* view() const { return _view; } ARDOUR::RouteGroup* route_group() const; @@ -174,29 +174,29 @@ protected: Gtk::Menu* menu; std::vector<ProcessorAutomationNode*> lines; - ProcessorAutomationInfo (boost::shared_ptr<ARDOUR::Processor> i) + ProcessorAutomationInfo (boost::shared_ptr<ARDOUR::Processor> i) : processor (i), valid (true), menu (0) {} ~ProcessorAutomationInfo (); }; - + void diskstream_changed (); void update_diskstream_display (); - + gint edit_click (GdkEventButton *); void processors_changed (); - + void add_processor_to_subplugin_menu (boost::weak_ptr<ARDOUR::Processor>); void remove_processor_automation_node (ProcessorAutomationNode* pan); void processor_menu_item_toggled (RouteTimeAxisView::ProcessorAutomationInfo*, RouteTimeAxisView::ProcessorAutomationNode*); - + void processor_automation_track_hidden (ProcessorAutomationNode*, boost::shared_ptr<ARDOUR::Processor>); - + void automation_track_hidden (Evoral::Parameter param); RouteAutomationNode* automation_track(Evoral::Parameter param); @@ -204,7 +204,7 @@ protected: ProcessorAutomationNode* find_processor_automation_node (boost::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter); - + boost::shared_ptr<AutomationLine> find_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter); @@ -212,7 +212,7 @@ protected: void add_existing_processor_automation_curves (boost::weak_ptr<ARDOUR::Processor>); void add_automation_child(Evoral::Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show=true); - + void reset_processor_automation_curves (); void take_name_changed (void *src); @@ -222,26 +222,26 @@ protected: void update_rec_display (); virtual void label_view (); - + void set_route_group_from_menu (ARDOUR::RouteGroup *); void reset_samples_per_unit (); void select_track_color(); - + virtual void build_automation_action_menu (); virtual void append_extra_display_menu_items () {} void build_display_menu (); - + void align_style_changed (); void set_align_style (ARDOUR::AlignStyle); - + void playlist_click (); void show_playlist_selector (); void playlist_changed (); void rename_current_playlist (); - + void automation_click (); void toggle_automation_track (Evoral::Parameter param); virtual void show_all_automation (); @@ -254,7 +254,7 @@ protected: void hide_click (); void speed_changed (); - + void map_frozen (); void color_handler (); @@ -264,7 +264,7 @@ protected: StreamView* _view; ArdourCanvas::Canvas& parent_canvas; bool no_redraw; - + Gtk::HBox other_button_hbox; Gtk::Table button_table; Gtk::Button processor_button; @@ -274,7 +274,7 @@ protected: Gtk::Button automation_button; Gtk::Button hide_button; Gtk::Button visual_button; - + Gtk::Menu subplugin_menu; Gtk::Menu* automation_action_menu; RouteGroupMenu* route_group_menu; @@ -304,14 +304,14 @@ protected: typedef std::vector<boost::shared_ptr<AutomationLine> > ProcessorAutomationCurves; ProcessorAutomationCurves processor_automation_curves; - + // Set from XML so context menu automation buttons can be correctly initialized std::set<Evoral::Parameter> _show_automation; AutomationTracks _automation_tracks; void post_construct (); - + GainMeterBase gm; static Glib::RefPtr<Gdk::Pixbuf> slider; diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 703857bc6b..45f2b80a1a 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2006 Paul Davis + Copyright (C) 2002-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -81,7 +81,7 @@ RouteUI::~RouteUI() /* derived classes should emit GoingAway so that they receive the signal when the object is still a legal derived instance. */ - + delete solo_menu; delete mute_menu; delete sends_menu; @@ -151,7 +151,7 @@ RouteUI::reset () delete mute_menu; mute_menu = 0; - + if (xml_node) { /* do not delete the node - its owned by the route */ xml_node = 0; @@ -183,13 +183,13 @@ RouteUI::set_route (boost::shared_ptr<Route> rp) mute_button->set_controllable (_route->mute_control()); solo_button->set_controllable (_route->solo_control()); - + connections.push_back (_route->active_changed.connect (mem_fun (*this, &RouteUI::route_active_changed))); connections.push_back (_route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed))); connections.push_back (_route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed))); connections.push_back (_route->listen_changed.connect (mem_fun(*this, &RouteUI::listen_changed))); connections.push_back (_route->solo_isolated_changed.connect (mem_fun(*this, &RouteUI::solo_changed))); - + if (_session.writable() && is_track()) { boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route); @@ -200,11 +200,11 @@ RouteUI::set_route (boost::shared_ptr<Route> rp) rec_enable_button->set_controllable (t->rec_enable_control()); update_rec_display (); - } + } mute_button->unset_flags (Gtk::CAN_FOCUS); solo_button->unset_flags (Gtk::CAN_FOCUS); - + mute_button->show(); if (_route->is_control()) { @@ -243,7 +243,7 @@ RouteUI::mute_press(GdkEventButton* ev) if (Keyboard::is_button2_event (ev)) { // Primary-button2 click is the midi binding click // button2-click is "momentary" - + if (!Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier))) { wait_for_release = true; } else { @@ -274,7 +274,7 @@ RouteUI::mute_press(GdkEventButton* ev) if (ev->button == 1) { set_route_group_mute (_route, !_route->muted()); } - + } else { /* plain click applies change to this route */ @@ -328,41 +328,41 @@ RouteUI::solo_press(GdkEventButton* ev) multiple_solo_change = false; if (!ignore_toggle) { - + if (Keyboard::is_context_menu_event (ev)) { - + if (solo_menu == 0) { build_solo_menu (); } - + solo_menu->popup (1, ev->time); - + } else { - + if (Keyboard::is_button2_event (ev)) { - + // Primary-button2 click is the midi binding click // button2-click is "momentary" - + if (!Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier))) { wait_for_release = true; } else { return false; } } - + if (ev->button == 1 || Keyboard::is_button2_event (ev)) { - + if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { - + /* Primary-Tertiary-click applies change to all routes */ bool was_not_latched = false; if (!Config->get_solo_latched ()) { was_not_latched = true; /* - XXX it makes no sense to solo all tracks if we're - not in latched mode, but doing nothing feels like a bug, - so do it anyway + XXX it makes no sense to solo all tracks if we're + not in latched mode, but doing nothing feels like a bug, + so do it anyway */ Config->set_solo_latched (true); } @@ -376,9 +376,9 @@ RouteUI::solo_press(GdkEventButton* ev) if (was_not_latched) { Config->set_solo_latched (false); } - + } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) { - + // Primary-Secondary-click: exclusively solo this track, not a toggle */ _session.begin_reversible_command (_("solo change")); @@ -499,7 +499,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev) set_route_group_rec_enable (_route, !_route->record_enabled()); } else if (Keyboard::is_context_menu_event (ev)) { - + /* do this on release */ } else { @@ -521,11 +521,11 @@ void RouteUI::build_sends_menu () { using namespace Menu_Helpers; - + sends_menu = new Menu; sends_menu->set_name ("ArdourContextMenu"); MenuList& items = sends_menu->items(); - + items.push_back (MenuElem(_("Assign all tracks (prefader)"), bind (mem_fun (*this, &RouteUI::create_sends), PreFader))); items.push_back (MenuElem(_("Assign all tracks (postfader)"), bind (mem_fun (*this, &RouteUI::create_sends), PostFader))); items.push_back (MenuElem(_("Copy track gains to sends"), mem_fun (*this, &RouteUI::set_sends_gain_from_track))); @@ -616,7 +616,7 @@ RouteUI::send_blink (bool onoff) if (!show_sends_button) { return; } - + if (onoff) { show_sends_button->set_state (STATE_ACTIVE); } else { @@ -663,8 +663,8 @@ RouteUI::update_solo_display () ignore_toggle = true; solo_button->set_active (x); ignore_toggle = false; - } - + } + if (_route->solo_isolated()) { solo_button->set_visual_state (2); } else if (x) { @@ -704,7 +704,7 @@ RouteUI::update_mute_display () } /* now attend to visual state */ - + if (Config->get_show_solo_mutes()) { if (_route->muted()) { mute_button->set_visual_state (2); @@ -753,7 +753,7 @@ RouteUI::update_rec_display () else { return; } - + /* now make sure its color state is correct */ if (model) { @@ -779,7 +779,7 @@ void RouteUI::build_solo_menu (void) { using namespace Menu_Helpers; - + solo_menu = new Menu; solo_menu->set_name ("ArdourContextMenu"); MenuList& items = solo_menu->items(); @@ -794,18 +794,18 @@ RouteUI::build_solo_menu (void) //items.push_back (SeparatorElem()); // items.push_back (MenuElem (_("MIDI Bind"), mem_fun (*mute_button, &BindableToggleButton::midi_learn))); - + } void RouteUI::build_mute_menu(void) { using namespace Menu_Helpers; - + mute_menu = new Menu; mute_menu->set_name ("ArdourContextMenu"); -#if FIX_ME_IN_3_0 +#if FIX_ME_IN_3_0 MenuList& items = mute_menu->items(); CheckMenuItem* check; @@ -822,7 +822,7 @@ RouteUI::build_mute_menu(void) _route->post_fader_changed.connect(bind (mem_fun (*this, &RouteUI::post_fader_toggle), check)); items.push_back (CheckMenuElem(*check)); check->show_all(); - + check = new CheckMenuItem(_("Control Outs")); init_mute_menu(CONTROL_OUTS, check); check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), CONTROL_OUTS, check)); @@ -952,9 +952,9 @@ void RouteUI::set_color (const Gdk::Color & c) { char buf[64]; - + _color = c; - + ensure_xml_node (); snprintf (buf, sizeof (buf), "%d:%d:%d", c.get_red(), c.get_green(), c.get_blue()); xml_node->add_property ("color", buf); @@ -978,7 +978,7 @@ XMLNode* RouteUI::get_automation_child_xml_node (Evoral::Parameter param) { ensure_xml_node (); - + XMLNodeList kids = xml_node->children(); XMLNodeConstIterator iter; @@ -1004,7 +1004,7 @@ int RouteUI::set_color_from_route () { XMLProperty *prop; - + RouteUI::ensure_xml_node (); if ((prop = xml_node->property ("color")) != 0) { @@ -1014,7 +1014,7 @@ RouteUI::set_color_from_route () _color.set_green(g); _color.set_blue(b); return 0; - } + } return 1; } @@ -1064,12 +1064,12 @@ RouteUI::route_rename () name_prompter.get_result (result); if (result.length()) { _route->set_name (result); - } + } break; } return; - + } void @@ -1108,7 +1108,7 @@ RouteUI::toggle_polarity () bool x; ENSURE_GUI_THREAD(mem_fun (*this, &RouteUI::toggle_polarity)); - + if ((x = polarity_menu_item->get_active()) != _route->phase_invert()) { _route->set_phase_invert (x); if (x) { @@ -1138,7 +1138,7 @@ RouteUI::toggle_denormal_protection () bool x; ENSURE_GUI_THREAD(mem_fun (*this, &RouteUI::toggle_denormal_protection)); - + if ((x = denormal_menu_item->get_active()) != _route->denormal_protection()) { _route->set_denormal_protection (x); } @@ -1168,7 +1168,7 @@ void RouteUI::pre_fader_toggle(void* src, Gtk::CheckMenuItem* check) { ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::pre_fader_toggle), src, check)); - + bool yn = _route->get_mute_config(PRE_FADER); if (check->get_active() != yn) { check->set_active (yn); @@ -1179,7 +1179,7 @@ void RouteUI::post_fader_toggle(void* src, Gtk::CheckMenuItem* check) { ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::post_fader_toggle), src, check)); - + bool yn = _route->get_mute_config(POST_FADER); if (check->get_active() != yn) { check->set_active (yn); @@ -1190,7 +1190,7 @@ void RouteUI::control_outs_toggle(void* src, Gtk::CheckMenuItem* check) { ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::control_outs_toggle), src, check)); - + bool yn = _route->get_mute_config(CONTROL_OUTS); if (check->get_active() != yn) { check->set_active (yn); @@ -1201,7 +1201,7 @@ void RouteUI::main_outs_toggle(void* src, Gtk::CheckMenuItem* check) { ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::main_outs_toggle), src, check)); - + bool yn = _route->get_mute_config(MAIN_OUTS); if (check->get_active() != yn) { check->set_active (yn); @@ -1306,16 +1306,16 @@ RouteUI::save_as_template () sys::path path; Glib::ustring safe_name; string name; - + path = ARDOUR::user_route_template_directory (); - + if (g_mkdir_with_parents (path.to_string().c_str(), 0755)) { error << string_compose (_("Cannot create route template directory %1"), path.to_string()) << endmsg; return; } - + Prompter p (true); // modal - + p.set_prompt (_("Template name:")); switch (p.run()) { case RESPONSE_ACCEPT: @@ -1323,15 +1323,15 @@ RouteUI::save_as_template () default: return; } - + p.hide (); p.get_result (name, true); - + safe_name = legalize_for_path (name); safe_name += template_suffix; - + path /= safe_name; - + _route->save_as_template (path.to_string(), name); } @@ -1349,7 +1349,7 @@ void RouteUI::parameter_changed (string const & p) { ENSURE_GUI_THREAD (bind (mem_fun (*this, &RouteUI::parameter_changed), p)); - + if (p == "disable-disarm-during-roll") { check_rec_enable_sensitivity (); } else if (p == "solo-control-is-listen-control") { diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 1ac87a0404..3b611d23a0 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -59,11 +59,11 @@ class RouteUI : public virtual AxisView bool is_midi_track() const; boost::shared_ptr<ARDOUR::Route> route() const { return _route; } - + boost::shared_ptr<ARDOUR::Track> track() const; boost::shared_ptr<ARDOUR::AudioTrack> audio_track() const; boost::shared_ptr<ARDOUR::MidiTrack> midi_track() const; - + boost::shared_ptr<ARDOUR::Diskstream> get_diskstream() const; std::string name() const; @@ -71,7 +71,7 @@ class RouteUI : public virtual AxisView // protected: XXX sigh this should be here boost::shared_ptr<ARDOUR::Route> _route; - + void set_color (const Gdk::Color & c); bool choose_color (); @@ -91,10 +91,10 @@ class RouteUI : public virtual AxisView void send_blink (bool); sigc::connection send_blink_connection; - + virtual std::string solo_button_name () const { return "SoloButton"; } virtual std::string safe_solo_button_name () const { return "SafeSoloButton"; } - + Gtk::Menu* mute_menu; Gtk::Menu* solo_menu; Gtk::Menu* sends_menu; @@ -103,7 +103,7 @@ class RouteUI : public virtual AxisView void ensure_xml_node (); virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter param); - + bool mute_press(GdkEventButton*); bool mute_release(GdkEventButton*); bool solo_press(GdkEventButton*); @@ -145,7 +145,7 @@ class RouteUI : public virtual AxisView void build_mute_menu(void); void init_mute_menu(ARDOUR::MuteMaster::MutePoint, Gtk::CheckMenuItem*); - + void set_route_group_solo (boost::shared_ptr<ARDOUR::Route>, bool); void set_route_group_mute (boost::shared_ptr<ARDOUR::Route>, bool); void set_route_group_rec_enable (boost::shared_ptr<ARDOUR::Route>, bool); @@ -156,7 +156,7 @@ class RouteUI : public virtual AxisView static gint idle_remove_this_route (RouteUI *); void route_rename(); - + virtual void name_changed (); void route_removed (); @@ -188,7 +188,7 @@ class RouteUI : public virtual AxisView void adjust_latency (); void save_as_template (); void open_remote_control_id_dialog (); - + protected: std::vector<sigc::connection> connections; bool self_destruct; diff --git a/gtk2_ardour/selectable.h b/gtk2_ardour/selectable.h index ca316c6450..2d31dbf62b 100644 --- a/gtk2_ardour/selectable.h +++ b/gtk2_ardour/selectable.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 66d1075557..c16c913658 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -66,7 +66,7 @@ operator== (const Selection& a, const Selection& b) return a.regions == b.regions && a.tracks == b.tracks && a.time.track == b.time.track && - a.time.group == b.time.group && + a.time.group == b.time.group && a.time == b.time && a.lines == b.lines && a.playlists == b.playlists && @@ -209,7 +209,7 @@ void Selection::toggle (TimeAxisView* track) { TrackSelection::iterator i; - + if ((i = find (tracks.begin(), tracks.end(), track)) == tracks.end()) { void (Selection::*pmf)(TimeAxisView*) = &Selection::remove; track->GoingAway.connect (sigc::bind (mem_fun (*this, pmf), track)); @@ -233,7 +233,7 @@ void Selection::toggle (MidiCutBuffer* midi) { MidiNoteSelection::iterator i; - + if ((i = find (midi_notes.begin(), midi_notes.end(), midi)) == midi_notes.end()) { midi_notes.push_back (midi); } else { @@ -241,7 +241,7 @@ Selection::toggle (MidiCutBuffer* midi) delete *i; midi_notes.erase (i); } - + MidiNotesChanged(); } @@ -300,7 +300,7 @@ Selection::toggle (nframes_t start, nframes_t end) time.push_back (AudioRange (start, end, next_time_id++)); time.consolidate (); time.sort (cmp); - + TimeChanged (); return next_time_id - 1; @@ -328,7 +328,7 @@ Selection::add (const list<boost::shared_ptr<Playlist> >& pllist) changed = true; } } - + if (changed) { PlaylistsChanged (); } @@ -343,7 +343,7 @@ Selection::add (const list<TimeAxisView*>& track_list) void (Selection::*pmf)(TimeAxisView*) = &Selection::remove; (*i)->GoingAway.connect (sigc::bind (mem_fun (*this, pmf), (*i))); } - + if (!added.empty()) { TracksChanged (); } @@ -390,7 +390,7 @@ Selection::add (vector<RegionView*>& v) */ bool changed = false; - + for (vector<RegionView*>::iterator i = v.begin(); i != v.end(); ++i) { if (find (regions.begin(), regions.end(), (*i)) == regions.end()) { changed = regions.add ((*i)); @@ -412,7 +412,7 @@ Selection::add (const RegionSelection& rs) */ bool changed = false; - + for (RegionSelection::const_iterator i = rs.begin(); i != rs.end(); ++i) { if (find (regions.begin(), regions.end(), (*i)) == regions.end()) { changed = regions.add ((*i)); @@ -421,7 +421,7 @@ Selection::add (const RegionSelection& rs) } } } - + if (changed) { RegionsChanged (); } @@ -464,7 +464,7 @@ Selection::add (nframes_t start, nframes_t end) time.push_back (AudioRange (start, end, next_time_id++)); time.consolidate (); time.sort (cmp); - + TimeChanged (); return next_time_id - 1; @@ -560,7 +560,7 @@ void Selection::remove (MidiCutBuffer* midi) { MidiNoteSelection::iterator x; - + if ((x = find (midi_notes.begin(), midi_notes.end(), midi)) != midi_notes.end()) { /* remember that we own the MCB */ delete *x; @@ -640,7 +640,7 @@ Selection::remove (uint32_t selection_id) for (list<AudioRange>::iterator i = time.begin(); i != time.end(); ++i) { if ((*i).id == selection_id) { time.erase (i); - + TimeChanged (); break; } @@ -706,7 +706,7 @@ Selection::set (const RegionSelection& rs) } void -Selection::set (MidiRegionView* mrv) +Selection::set (MidiRegionView* mrv) { clear_midi_regions (); add (mrv); @@ -798,8 +798,8 @@ Selection::empty (bool internal_selection) { bool object_level_empty = regions.empty () && tracks.empty () && - points.empty () && - playlists.empty () && + points.empty () && + playlists.empty () && lines.empty () && time.empty () && playlists.empty () && @@ -857,11 +857,11 @@ Selection::toggle (list<Selectable*>& selectables) if (!rvs.empty()) { toggle (rvs); - } + } if (!autos.empty()) { toggle (autos); - } + } } void @@ -896,11 +896,11 @@ Selection::add (list<Selectable*>& selectables) if (!rvs.empty()) { add (rvs); - } + } if (!autos.empty()) { add (autos); - } + } } void @@ -933,7 +933,7 @@ void Selection::toggle (Marker* m) { MarkerSelection::iterator i; - + if ((i = find (markers.begin(), markers.end(), m)) == markers.end()) { add (m); } else { @@ -958,7 +958,7 @@ Selection::add (Marker* m) if (find (markers.begin(), markers.end(), m) == markers.end()) { /* disambiguate which remove() for the compiler */ - + void (Selection::*pmf)(Marker*) = &Selection::remove; m->GoingAway.connect (bind (mem_fun (*this, pmf), m)); @@ -985,7 +985,7 @@ MarkerSelection::range (nframes64_t& s, nframes64_t& e) if ((*i)->position() < s) { s = (*i)->position(); - } + } if ((*i)->position() > e) { e = (*i)->position(); diff --git a/gtk2_ardour/selection.h b/gtk2_ardour/selection.h index a898705d23..4e5f684af9 100644 --- a/gtk2_ardour/selection.h +++ b/gtk2_ardour/selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2003 Paul Davis + Copyright (C) 2000-2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ namespace Evoral { /** The Selection class holds lists of selected items (tracks, regions, etc. etc.). */ -class Selection : public sigc::trackable +class Selection : public sigc::trackable { public: enum SelectionType { @@ -110,7 +110,7 @@ class Selection : public sigc::trackable void set (std::list<Selectable*>&); void add (std::list<Selectable*>&); void toggle (std::list<Selectable*>&); - + void set (TimeAxisView*); void set (const std::list<TimeAxisView*>&); void set (const MidiNoteSelection&); @@ -168,7 +168,7 @@ class Selection : public sigc::trackable void remove (Marker*); void replace (uint32_t time_index, nframes_t start, nframes_t end); - + void clear_regions(); void clear_tracks (); void clear_time(); diff --git a/gtk2_ardour/selection_templates.h b/gtk2_ardour/selection_templates.h index cc2585c17e..0dce2f903b 100644 --- a/gtk2_ardour/selection_templates.h +++ b/gtk2_ardour/selection_templates.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2003 Paul Davis + Copyright (C) 2000-2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ #define __ardour_gtk_selection_templates_h__ /* these inlines require knowledge of Region and Route classes, - and so they are in a separate header file from selection.h to + and so they are in a separate header file from selection.h to avoid multiplying dependencies. */ @@ -56,7 +56,7 @@ Selection::foreach_midi_regionview (void (MidiRegionView::*method)(void)) { } } -template<class A> inline void +template<class A> inline void Selection::foreach_region (void (ARDOUR::Region::*method)(A), A arg) { for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) { ARDOUR::Region* region = (*i)->region().get(); diff --git a/gtk2_ardour/send_ui.cc b/gtk2_ardour/send_ui.cc index 6ec9002222..7dab778054 100644 --- a/gtk2_ardour/send_ui.cc +++ b/gtk2_ardour/send_ui.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se) _hbox.pack_start (_gpm, true, true); set_name ("SendUIFrame"); - + _vbox.set_spacing (5); _vbox.set_border_width (5); @@ -52,7 +52,7 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se) _vbox.pack_start (_panners, false,false); io = manage (new IOSelector (parent, se, s->output())); - + pack_start (_vbox, false, false); pack_start (*io, true, true); @@ -63,7 +63,7 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se) _send->input()->changed.connect (mem_fun (*this, &SendUI::ins_changed)); _send->output()->changed.connect (mem_fun (*this, &SendUI::outs_changed)); - + _panners.set_width (Wide); _panners.setup_pan (); @@ -117,7 +117,7 @@ SendUI::fast_update () _gpm.update_meters (); } } - + SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss) : ArdourDialog (string("Ardour: send ") + s->name()) { @@ -129,7 +129,7 @@ SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss) get_vbox()->pack_start (hpacker); set_name ("SendUIWindow"); - + going_away_connection = s->GoingAway.connect ( mem_fun (*this, &SendUIWindow::send_going_away)); diff --git a/gtk2_ardour/send_ui.h b/gtk2_ardour/send_ui.h index 5fe785b156..df5a8a216e 100644 --- a/gtk2_ardour/send_ui.h +++ b/gtk2_ardour/send_ui.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,7 +55,7 @@ class SendUI : public Gtk::HBox sigc::connection screen_update_connection; sigc::connection fast_screen_update_connection; - + void ins_changed (ARDOUR::IOChange, void*); void outs_changed (ARDOUR::IOChange, void*); }; diff --git a/gtk2_ardour/session_import_dialog.cc b/gtk2_ardour/session_import_dialog.cc index 89f50c5893..500ca3ea09 100644 --- a/gtk2_ardour/session_import_dialog.cc +++ b/gtk2_ardour/session_import_dialog.cc @@ -46,20 +46,20 @@ SessionImportDialog::SessionImportDialog (ARDOUR::Session & target) : file_entry.set_name ("ImportFileNameEntry"); file_entry.set_text ("/"); Gtkmm2ext::set_size_request_to_display_given_text (file_entry, X_("Kg/quite/a/reasonable/size/for/files/i/think"), 5, 8); - + file_browse_button.set_name ("EditorGTKButton"); file_browse_button.signal_clicked().connect (mem_fun(*this, &SessionImportDialog::browse)); - + file_hbox.set_spacing (5); file_hbox.set_border_width (5); file_hbox.pack_start (file_entry, true, true); file_hbox.pack_start (file_browse_button, false, false); - + file_frame.add (file_hbox); file_frame.set_border_width (5); file_frame.set_name ("ImportFrom"); file_frame.set_label (_("Import from Session")); - + get_vbox()->pack_start (file_frame, false, false); // Session browser @@ -73,28 +73,28 @@ SessionImportDialog::SessionImportDialog (ARDOUR::Session & target) : session_browser.get_column(0)->set_min_width (180); session_browser.get_column(1)->set_min_width (40); session_browser.get_column(1)->set_sizing (Gtk::TREE_VIEW_COLUMN_AUTOSIZE); - + session_scroll.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); session_scroll.add (session_browser); session_scroll.set_size_request (220, 400); - + // Connect signals Gtk::CellRendererToggle *toggle = dynamic_cast<Gtk::CellRendererToggle *> (session_browser.get_column_cell_renderer (1)); toggle->signal_toggled().connect(mem_fun (*this, &SessionImportDialog::update)); session_browser.signal_row_activated().connect(mem_fun (*this, &SessionImportDialog::show_info)); - + get_vbox()->pack_start (session_scroll, false, false); - + // Buttons cancel_button = add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); cancel_button->signal_clicked().connect (mem_fun (*this, &SessionImportDialog::end_dialog)); ok_button = add_button (_("Import"), Gtk::RESPONSE_ACCEPT); ok_button->signal_clicked().connect (mem_fun (*this, &SessionImportDialog::do_merge)); - + // prompt signals ElementImporter::Rename.connect (mem_fun (*this, &SessionImportDialog::open_rename_dialog)); ElementImporter::Prompt.connect (mem_fun (*this, &SessionImportDialog::open_prompt_dialog)); - + // Finalize show_all(); } @@ -105,16 +105,16 @@ SessionImportDialog::load_session (const string& filename) tree.read (filename); boost::shared_ptr<AudioRegionImportHandler> region_handler (new AudioRegionImportHandler (tree, target)); boost::shared_ptr<AudioPlaylistImportHandler> pl_handler (new AudioPlaylistImportHandler (tree, target, *region_handler)); - + handlers.push_back (boost::static_pointer_cast<ElementImportHandler> (region_handler)); handlers.push_back (boost::static_pointer_cast<ElementImportHandler> (pl_handler)); handlers.push_back (HandlerPtr(new UnusedAudioPlaylistImportHandler (tree, target, *region_handler))); handlers.push_back (HandlerPtr(new AudioTrackImportHandler (tree, target, *pl_handler))); handlers.push_back (HandlerPtr(new LocationImportHandler (tree, target))); handlers.push_back (HandlerPtr(new TempoMapImportHandler (tree, target))); - + fill_list(); - + if (ElementImportHandler::dirty()) { // Warn user string txt = _("Some elements had errors in them. Please see the log for details"); @@ -127,7 +127,7 @@ void SessionImportDialog::fill_list () { session_tree->clear(); - + // Loop through element types for (HandlerList::iterator handler = handlers.begin(); handler != handlers.end(); ++handler) { Gtk::TreeModel::iterator iter = session_tree->append(); @@ -135,7 +135,7 @@ SessionImportDialog::fill_list () row[sb_cols.name] = (*handler)->get_info(); row[sb_cols.queued] = false; row[sb_cols.element] = ElementPtr(); // "Null" pointer - + // Loop through elements ElementList &elements = (*handler)->elements; for (ElementList::iterator element = elements.begin(); element != elements.end(); ++element) { @@ -158,12 +158,12 @@ SessionImportDialog::browse () dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); - + int result = dialog.run(); if (result == Gtk::RESPONSE_OK) { string filename = dialog.get_filename(); - + if (filename.length()) { file_entry.set_text (filename); load_session (filename); @@ -174,7 +174,7 @@ SessionImportDialog::browse () void SessionImportDialog::do_merge () { - + // element types Gtk::TreeModel::Children types = session_browser.get_model()->children(); Gtk::TreeModel::Children::iterator ti; @@ -189,9 +189,9 @@ SessionImportDialog::do_merge () } } } - + end_dialog(); - + if (ElementImportHandler::errors()) { // Warn user string txt = _("Some elements had errors in them. Please see the log for details"); @@ -205,7 +205,7 @@ void SessionImportDialog::update (string path) { Gtk::TreeModel::iterator cell = session_browser.get_model()->get_iter (path); - + // Select all elements if element type is selected if (path.size() == 1) { { @@ -217,7 +217,7 @@ SessionImportDialog::update (string path) return; } } - + Gtk::TreeModel::Children elements = cell->children(); Gtk::TreeModel::Children::iterator ei; for (ei = elements.begin(); ei != elements.end(); ++ei) { @@ -230,7 +230,7 @@ SessionImportDialog::update (string path) } return; } - + ElementPtr element = (*cell)[sb_cols.element]; if ((*cell)[sb_cols.queued]) { if (!element->prepare_move()) { @@ -247,10 +247,10 @@ SessionImportDialog::show_info(const Gtk::TreeModel::Path& path, Gtk::TreeViewCo if (path.size() == 1) { return; } - + Gtk::TreeModel::iterator cell = session_browser.get_model()->get_iter (path); string info = (*cell)[sb_cols.info]; - + Gtk::MessageDialog msg (info, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); msg.run(); } @@ -274,7 +274,7 @@ SessionImportDialog::open_rename_dialog (string text, string name) prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); prompter.set_prompt (text); prompter.set_initial_text (name); - + if (prompter.run() == Gtk::RESPONSE_ACCEPT) { prompter.get_result (new_name); if (new_name.length()) { diff --git a/gtk2_ardour/session_import_dialog.h b/gtk2_ardour/session_import_dialog.h index 74da13855a..4144d07c88 100644 --- a/gtk2_ardour/session_import_dialog.h +++ b/gtk2_ardour/session_import_dialog.h @@ -43,15 +43,15 @@ class SessionImportDialog : public ArdourDialog private: typedef boost::shared_ptr<ARDOUR::ElementImportHandler> HandlerPtr; typedef std::list<HandlerPtr> HandlerList; - + typedef boost::shared_ptr<ARDOUR::ElementImporter> ElementPtr; typedef std::list<ElementPtr> ElementList; public: SessionImportDialog (ARDOUR::Session & target); - + virtual Gtk::FileChooserAction browse_action() const { return Gtk::FILE_CHOOSER_ACTION_OPEN; } - + private: void load_session (const std::string& filename); @@ -61,7 +61,7 @@ class SessionImportDialog : public ArdourDialog void end_dialog (); void update (std::string path); void show_info(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column); - + std::pair<bool, std::string> open_rename_dialog (std::string text, std::string name); bool open_prompt_dialog (std::string text); @@ -75,7 +75,7 @@ class SessionImportDialog : public ArdourDialog Gtk::HBox file_hbox; Gtk::Entry file_entry; Gtk::Button file_browse_button; - + struct SessionBrowserColumns : public Gtk::TreeModel::ColumnRecord { public: @@ -86,12 +86,12 @@ class SessionImportDialog : public ArdourDialog SessionBrowserColumns() { add (name); add (queued); add (element); add (info); } }; - + SessionBrowserColumns sb_cols; Glib::RefPtr<Gtk::TreeStore> session_tree; Gtk::TreeView session_browser; Gtk::ScrolledWindow session_scroll; - + Gtk::Button* ok_button; Gtk::Button* cancel_button; }; diff --git a/gtk2_ardour/session_metadata_dialog.cc b/gtk2_ardour/session_metadata_dialog.cc index fefabf143d..be2e6fe012 100644 --- a/gtk2_ardour/session_metadata_dialog.cc +++ b/gtk2_ardour/session_metadata_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis Author: Sakari Bergen This program is free software; you can redistribute it and/or modify it @@ -97,11 +97,11 @@ Gtk::Widget & TextMetadataField::edit_widget () { entry = Gtk::manage (new Gtk::Entry()); - + entry->set_text (_value); entry->set_width_chars (width); entry->signal_changed().connect (sigc::mem_fun(*this, &TextMetadataField::update_value)); - + return *entry; } @@ -175,12 +175,12 @@ Gtk::Widget & NumberMetadataField::edit_widget () { entry = Gtk::manage (new Gtk::Entry()); - + entry->set_text (_value); entry->set_width_chars (width); entry->set_max_length (numbers); entry->signal_changed().connect (sigc::mem_fun(*this, &NumberMetadataField::update_value)); - + return *entry; } @@ -204,7 +204,7 @@ NumberMetadataField::str_to_uint (ustring const & str) const while ((i = tmp.find_first_not_of("1234567890")) != ustring::npos) { tmp.erase (i, 1); } - + std::istringstream iss(tmp); uint32_t result = 0; iss >> result; @@ -249,9 +249,9 @@ void SessionMetadataSetEditable::set_session (ARDOUR::Session * s) { session = s; - + ARDOUR::SessionMetadata const & data = session->metadata(); - + table.resize (list.size(), 2); uint32_t row = 0; MetadataPtr field; @@ -281,27 +281,27 @@ SessionMetadataSetImportable::SessionMetadataSetImportable (ustring const & name { tree = Gtk::ListStore::create (tree_cols); tree_view.set_model (tree); - + Gtk::TreeView::Column * viewcol; - + // Add import column Gtk::CellRendererToggle * import_render = Gtk::manage(new Gtk::CellRendererToggle()); import_render->signal_toggled().connect (sigc::mem_fun(*this, &SessionMetadataSetImportable::selection_changed)); viewcol = Gtk::manage(new Gtk::TreeView::Column (_("Import"), *import_render)); viewcol->add_attribute (import_render->property_active(), tree_cols.import); tree_view.append_column (*viewcol); - + // Add field name column tree_view.append_column(_("Field"), tree_cols.field); - + // Add values column with pango markup Gtk::CellRendererText * values_render = Gtk::manage(new Gtk::CellRendererText()); viewcol = Gtk::manage(new Gtk::TreeView::Column (_("Values (current value on top)"), *values_render)); viewcol->add_attribute (values_render->property_markup(), tree_cols.values); tree_view.append_column (*viewcol); - + select_all_check.signal_toggled().connect (sigc::mem_fun(*this, &SessionMetadataSetImportable::select_all)); - + session = 0; } @@ -326,14 +326,14 @@ SessionMetadataSetImportable::load_extra_data (ARDOUR::SessionMetadata const & d std::cerr << "Programming error: no session set for SessionMetaDataSetImportable (in load_data)!" << std::endl; return; } - + ARDOUR::SessionMetadata & session_data = session->metadata(); - + MetadataPtr session_field; MetadataPtr import_field; DataList::iterator session_it; DataList::iterator import_it; - + // Copy list and load data to import for (session_it = session_list.begin(); session_it != session_list.end(); ++session_it) { session_field = *session_it; @@ -347,13 +347,13 @@ SessionMetadataSetImportable::load_extra_data (ARDOUR::SessionMetadata const & d while (session_it != session_list.end() && import_it != import_list.end()) { // _should_ be the same... session_field = *session_it; import_field = *import_it; - + import_field->load_data(data); // hasn't been done yet - + // Make string for values TODO get color from somewhere? ustring values = "<span weight=\"ultralight\" color=\"#777\">" + session_field->value() + "</span>\n" + "<span weight=\"bold\">" + import_field->value() + "</span>"; - + Gtk::TreeModel::iterator row_iter = tree->append(); Gtk::TreeModel::Row row = *row_iter; @@ -361,7 +361,7 @@ SessionMetadataSetImportable::load_extra_data (ARDOUR::SessionMetadata const & d row[tree_cols.values] = values; row[tree_cols.import] = false; row[tree_cols.data] = import_field; - + ++session_it; ++import_it; } @@ -392,7 +392,7 @@ SessionMetadataSetImportable::select_all () { select_all_check.set_inconsistent (false); bool state = select_all_check.get_active(); - + Gtk::TreeModel::Children fields = tree->children(); Gtk::TreeModel::Children::iterator it; for (it = fields.begin(); it != fields.end(); ++it) { @@ -404,7 +404,7 @@ void SessionMetadataSetImportable::selection_changed (ustring const & path) { select_all_check.set_inconsistent (true); - + Gtk::TreeModel::iterator iter = tree->get_iter (path); bool value((*iter)[tree_cols.import]); (*iter)[tree_cols.import] = !value; @@ -430,14 +430,14 @@ SessionMetadataDialog<DataSet>::init_data () std::cerr << "Programming error: no session set for SessionMetaDataDialog (in init_data)!" << std::endl; return; } - + init_track_data (); init_album_data (); init_people_data (); - + for (DataSetList::iterator it = data_list.begin(); it != data_list.end(); ++it) { (*it)->set_session (session); - + notebook.append_page ((*it)->get_widget(), (*it)->get_tab_widget()); } } @@ -493,7 +493,7 @@ SessionMetadataDialog<DataSet>::get_custom_widgets (WidgetFunc f) DataSet * set = dynamic_cast<DataSet *> (it->get()); list->push_back (& CALL_MEMBER_FN (*set, f) ()); } - + return list; } @@ -512,28 +512,28 @@ SessionMetadataDialog<DataSet>::init_track_data () data_list.push_back (data_set); MetadataPtr ptr; - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::title, &ARDOUR::SessionMetadata::set_title, _("Title"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new NumberMetadataField (&ARDOUR::SessionMetadata::track_number, &ARDOUR::SessionMetadata::set_track_number, _("Track Number"), 3)); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::subtitle, &ARDOUR::SessionMetadata::set_subtitle, _("Subtitle"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::grouping, &ARDOUR::SessionMetadata::set_grouping, _("Grouping"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::artist, &ARDOUR::SessionMetadata::set_artist, _("Artist"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::genre, &ARDOUR::SessionMetadata::set_genre, _("Genre"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::comment, &ARDOUR::SessionMetadata::set_comment, _("Comment"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::copyright, &ARDOUR::SessionMetadata::set_copyright, _("Copyright"))); data_set->add_data_field (ptr); } @@ -544,33 +544,33 @@ SessionMetadataDialog<DataSet>::init_album_data () { DataSetPtr data_set (new DataSet (_("Album"))); data_list.push_back (data_set); - + MetadataPtr ptr; - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::album, &ARDOUR::SessionMetadata::set_album, _("Album"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new NumberMetadataField (&ARDOUR::SessionMetadata::year, &ARDOUR::SessionMetadata::set_year, _("Year"), 4)); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::album_artist, &ARDOUR::SessionMetadata::set_album_artist, _("Album Artist"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new NumberMetadataField (&ARDOUR::SessionMetadata::total_tracks, &ARDOUR::SessionMetadata::set_total_tracks, _("Total Tracks"), 3)); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::disc_subtitle, &ARDOUR::SessionMetadata::set_disc_subtitle, _("Disc Subtitle"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new NumberMetadataField (&ARDOUR::SessionMetadata::disc_number, &ARDOUR::SessionMetadata::set_disc_number, _("Disc Number"), 2)); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new NumberMetadataField (&ARDOUR::SessionMetadata::total_discs, &ARDOUR::SessionMetadata::set_total_discs, _("Total Discs"), 2)); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::compilation, &ARDOUR::SessionMetadata::set_compilation, _("Compilation"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::isrc, &ARDOUR::SessionMetadata::set_isrc, _("ISRC"))); data_set->add_data_field (ptr); } @@ -583,31 +583,31 @@ SessionMetadataDialog<DataSet>::init_people_data () data_list.push_back (data_set); MetadataPtr ptr; - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::lyricist, &ARDOUR::SessionMetadata::set_lyricist, _("Lyricist"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::composer, &ARDOUR::SessionMetadata::set_composer, _("Composer"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::conductor, &ARDOUR::SessionMetadata::set_conductor, _("Conductor"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::remixer, &ARDOUR::SessionMetadata::set_remixer, _("Remixer"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::arranger, &ARDOUR::SessionMetadata::set_arranger, _("Arranger"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::engineer, &ARDOUR::SessionMetadata::set_engineer, _("Engineer"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::producer, &ARDOUR::SessionMetadata::set_producer, _("Producer"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::dj_mixer, &ARDOUR::SessionMetadata::set_dj_mixer, _("DJ Mixer"))); data_set->add_data_field (ptr); - + ptr = MetadataPtr (new TextMetadataField (&ARDOUR::SessionMetadata::mixer, &ARDOUR::SessionMetadata::set_mixer, _("Mixer"))); data_set->add_data_field (ptr); } @@ -628,10 +628,10 @@ SessionMetadataEditor::~SessionMetadataEditor () void SessionMetadataEditor::run () -{ +{ init_data (); init_gui(); - + ArdourDialog::run(); } @@ -639,7 +639,7 @@ void SessionMetadataEditor::init_gui () { add_widget (notebook); - + show_all(); } @@ -659,14 +659,14 @@ SessionMetadataImporter::~SessionMetadataImporter () void SessionMetadataImporter::run () -{ +{ if (!session) { std::cerr << "Programming error: no session set for SessionMetaDataImporter (in run)!" << std::endl; return; } /* Open session file selector */ - + Gtk::FileChooserDialog session_selector(_("Choose session to import metadata from"), Gtk::FILE_CHOOSER_ACTION_OPEN); session_selector.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); session_selector.add_button (Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT); @@ -699,30 +699,30 @@ SessionMetadataImporter::run () } else { return; } - + /* We have a session: load the data and run dialog */ - + string filename = Glib::build_filename (path, name + ".ardour"); XMLTree session_tree; if (!session_tree.read (filename)) { warn_user (_("A proper ardour session file was not selected!")); return; } - + XMLNode * node = session_tree.root()->child ("Metadata"); - + if (!node) { warn_user (_("The session file didn't contain metadata!\nMaybe this is an old session format?")); return; } - + ARDOUR::SessionMetadata data; data.set_state (*node); - + init_data (); load_extra_data (data); init_gui(); - + ArdourDialog::run(); } @@ -733,13 +733,13 @@ SessionMetadataImporter::init_gui () add_widget (selection_hbox); selection_label.set_text (_("Import all from:")); selection_hbox.pack_start (selection_label, false, false); - + WidgetListPtr list = get_custom_widgets (&SessionMetadataSetImportable::get_select_all_widget); for (WidgetList::iterator it = list->begin(); it != list->end(); ++it) { selection_hbox.pack_start (**it, false, false, 6); } add_widget (notebook); - + show_all(); } diff --git a/gtk2_ardour/session_metadata_dialog.h b/gtk2_ardour/session_metadata_dialog.h index cb2c12daa2..3e618c079f 100644 --- a/gtk2_ardour/session_metadata_dialog.h +++ b/gtk2_ardour/session_metadata_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis Author: Sakari Bergen This program is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ #include "ardour/session_metadata.h" class MetadataField; -typedef boost::shared_ptr<MetadataField> MetadataPtr; +typedef boost::shared_ptr<MetadataField> MetadataPtr; /// Wraps a metadata field to be used in a GUI class MetadataField { @@ -39,13 +39,13 @@ class MetadataField { MetadataField (Glib::ustring const & field_name); virtual ~MetadataField(); virtual MetadataPtr copy () = 0; - + virtual void save_data (ARDOUR::SessionMetadata & data) const = 0; virtual void load_data (ARDOUR::SessionMetadata const & data) = 0; - + virtual Glib::ustring name() { return _name; } virtual Glib::ustring value() { return _value; } - + /// Get widget containing name of field virtual Gtk::Widget & name_widget () = 0; /// Get label containing value of field @@ -65,23 +65,23 @@ class TextMetadataField : public MetadataField { public: TextMetadataField (Getter getter, Setter setter, Glib::ustring const & field_name, guint width = 50); MetadataPtr copy (); - + void save_data (ARDOUR::SessionMetadata & data) const; void load_data (ARDOUR::SessionMetadata const & data); - + Gtk::Widget & name_widget (); Gtk::Widget & value_widget (); Gtk::Widget & edit_widget (); private: void update_value (); - + Getter getter; Setter setter; - + Gtk::Label* label; Gtk::Label* value_label; Gtk::Entry* entry; - + uint width; }; @@ -93,10 +93,10 @@ class NumberMetadataField : public MetadataField { public: NumberMetadataField (Getter getter, Setter setter, Glib::ustring const & field_name, guint numbers, guint width = 50); MetadataPtr copy (); - + void save_data (ARDOUR::SessionMetadata & data) const; void load_data (ARDOUR::SessionMetadata const & data); - + Gtk::Widget & name_widget (); Gtk::Widget & value_widget (); Gtk::Widget & edit_widget (); @@ -104,14 +104,14 @@ class NumberMetadataField : public MetadataField { void update_value (); Glib::ustring uint_to_str (uint32_t i) const; uint32_t str_to_uint (Glib::ustring const & str) const; - + Getter getter; Setter setter; - + Gtk::Label* label; Gtk::Label* value_label; Gtk::Entry* entry; - + guint numbers; guint width; }; @@ -121,19 +121,19 @@ class SessionMetadataSet { public: SessionMetadataSet (Glib::ustring const & name); virtual ~SessionMetadataSet () {}; - + void add_data_field (MetadataPtr field); - + /// Sets session, into which the data is eventually saved virtual void set_session (ARDOUR::Session * s) { session = s; } /// allows loading extra data into data sets (for importing etc.) virtual void load_extra_data (ARDOUR::SessionMetadata const & /*data*/) { } /// Saves data to session virtual void save_data () = 0; - + virtual Gtk::Widget & get_widget () = 0; virtual Gtk::Widget & get_tab_widget () = 0; - + protected: typedef std::list<MetadataPtr> DataList; DataList list; @@ -145,15 +145,15 @@ class SessionMetadataSet { class SessionMetadataSetEditable : public SessionMetadataSet { public: SessionMetadataSetEditable (Glib::ustring const & name); - + Gtk::Widget & get_widget () { return vbox; } Gtk::Widget & get_tab_widget (); - + /// Sets session and loads data void set_session (ARDOUR::Session * s); /// Saves from MetadataFields into data void save_data (); - + private: Gtk::VBox vbox; Gtk::Table table; @@ -164,20 +164,20 @@ class SessionMetadataSetEditable : public SessionMetadataSet { class SessionMetadataSetImportable : public SessionMetadataSet { public: SessionMetadataSetImportable (Glib::ustring const & name); - + Gtk::Widget & get_widget () { return tree_view; } Gtk::Widget & get_tab_widget (); Gtk::Widget & get_select_all_widget (); - + /// Loads importable data from data void load_extra_data (ARDOUR::SessionMetadata const & data); /// Saves from importable data (see load_data) to session_data void save_data (); - + private: DataList & session_list; // References MetadataSet::list DataList import_list; - + struct Columns : public Gtk::TreeModel::ColumnRecord { public: @@ -185,17 +185,17 @@ class SessionMetadataSetImportable : public SessionMetadataSet { Gtk::TreeModelColumn<Glib::ustring> values; Gtk::TreeModelColumn<bool> import; Gtk::TreeModelColumn<MetadataPtr> data; - + Columns() { add (field); add (values); add (import); add (data); } }; - + Glib::RefPtr<Gtk::ListStore> tree; Columns tree_cols; Gtk::TreeView tree_view; - - Gtk::Label tab_widget; + + Gtk::Label tab_widget; Gtk::CheckButton select_all_check; - + void select_all (); void selection_changed (Glib::ustring const & path); }; @@ -215,20 +215,20 @@ class SessionMetadataDialog : public ArdourDialog void init_data (); void load_extra_data (ARDOUR::SessionMetadata const & data); void save_data (); - + virtual void init_gui () = 0; virtual void save_and_close (); virtual void end_dialog (); - + void warn_user (Glib::ustring const & string); - + typedef std::list<Gtk::Widget *> WidgetList; typedef boost::shared_ptr<WidgetList> WidgetListPtr; typedef Gtk::Widget & (DataSet::*WidgetFunc) (); - + /// Returns list of widgets gathered by calling f for each data set WidgetListPtr get_custom_widgets (WidgetFunc f); - + /// Adds a widget to the table (vertical stacking) with automatic spacing void add_widget (Gtk::Widget & widget); @@ -242,7 +242,7 @@ class SessionMetadataDialog : public ArdourDialog typedef boost::shared_ptr<SessionMetadataSet> DataSetPtr; typedef std::list<DataSetPtr> DataSetList; DataSetList data_list; - + Gtk::Button * save_button; Gtk::Button * cancel_button; }; @@ -264,11 +264,11 @@ class SessionMetadataImporter : public SessionMetadataDialog<SessionMetadataSetI private: void init_gui (); - + // Select all from -widget Gtk::HBox selection_hbox; Gtk::Label selection_label; - + }; #endif diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc index edb596c6cc..29051fe09a 100644 --- a/gtk2_ardour/session_option_editor.cc +++ b/gtk2_ardour/session_option_editor.cc @@ -19,14 +19,14 @@ public: { _port_group.reset (new PortGroup ("")); _ports[OURS].add_group (_port_group); - + setup_all_ports (); } void setup_ports (int dim) { cerr << _session.the_auditioner()->output()->n_ports() << "\n"; - + if (dim == OURS) { _port_group->clear (); _port_group->add_bundle (_session.click_io()->bundle()); @@ -40,7 +40,7 @@ public: { Bundle::PortList const & our_ports = c[OURS].bundle->channel_ports (c[OURS].channel); Bundle::PortList const & other_ports = c[OTHER].bundle->channel_ports (c[OTHER].channel); - + if (c[OURS].bundle == _session.click_io()->bundle()) { for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) { @@ -48,7 +48,7 @@ public: Port* f = _session.engine().get_port_by_name (*i); assert (f); - + if (s) { _session.click_io()->connect (f, *j, 0); } else { @@ -63,14 +63,14 @@ public: { Bundle::PortList const & our_ports = c[OURS].bundle->channel_ports (c[OURS].channel); Bundle::PortList const & other_ports = c[OTHER].bundle->channel_ports (c[OTHER].channel); - + if (c[OURS].bundle == _session.click_io()->bundle()) { - + for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) { for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) { Port* f = _session.engine().get_port_by_name (*i); assert (f); - + if (f->connected_to (*j)) { return PortMatrixNode::ASSOCIATED; } else { @@ -95,13 +95,13 @@ public: bool can_remove_channels (boost::shared_ptr<Bundle>) const { return false; } - + void remove_channel (ARDOUR::BundleChannel) {} - + std::string disassociation_verb () const { return _("Disassociate"); } - + private: /* see PortMatrix: signal flow from 0 to 1 (out to in) */ enum { @@ -241,7 +241,7 @@ SessionOptionEditor::SessionOptionEditor (Session* s) smf->add (smpte_60, _("60")); add_option (_("Sync"), smf); - + add_option (_("Sync"), new BoolOption ( "timecode-source-is-synced", _("Timecode source is synced"), @@ -265,9 +265,9 @@ SessionOptionEditor::SessionOptionEditor (Session* s) vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%")); vpu->add (-4.1667, _("-4.1667")); vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%")); - + add_option (_("Sync"), vpu); - + /* MISC */ add_option (_("Misc"), new OptionEditorHeading (_("Audio file format"))); @@ -313,9 +313,9 @@ SessionOptionEditor::SessionOptionEditor (Session* s) lm->add (AddHigher, _("most recently added is higher")); add_option (_("Misc"), lm); - + add_option (_("Misc"), new OptionEditorHeading (_("Broadcast WAVE metadata"))); - + add_option (_("Misc"), new EntryOption ( "bwf-country-code", _("Country code"), diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 41758d493d..7a7fad030f 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -91,7 +91,7 @@ string2importmode (string str) } warning << string_compose (_("programming error: unknown import mode string %1"), str) << endmsg; - + return ImportAsTrack; } @@ -119,7 +119,7 @@ SoundFileBox::SoundFileBox (bool persistent) timecode_clock ("sfboxTimecodeClock", !persistent, "EditCursorClock", false, false, false), main_box (false, 6), autoplay_btn (_("Auto-play")) - + { set_name (X_("SoundFileBox")); set_size_request (300, -1); @@ -179,13 +179,13 @@ SoundFileBox::SoundFileBox (bool persistent) main_box.pack_start (tags_entry, true, true); main_box.pack_start (bottom_box, false, false); - + play_btn.set_image (*(manage (new Image (Stock::MEDIA_PLAY, ICON_SIZE_BUTTON)))); play_btn.set_label (_("Play")); stop_btn.set_image (*(manage (new Image (Stock::MEDIA_STOP, ICON_SIZE_BUTTON)))); stop_btn.set_label (_("Stop")); - + bottom_box.set_homogeneous (false); bottom_box.set_spacing (6); bottom_box.pack_start(play_btn, true, true); @@ -207,7 +207,7 @@ SoundFileBox::set_session(Session* s) if (!_session) { play_btn.set_sensitive (false); stop_btn.set_sensitive (false); - } + } length_clock.set_session (s); @@ -215,7 +215,7 @@ SoundFileBox::set_session(Session* s) } bool -SoundFileBox::setup_labels (const ustring& filename) +SoundFileBox::setup_labels (const ustring& filename) { if (!path.empty()) { // save existing tags @@ -236,10 +236,10 @@ SoundFileBox::setup_labels (const ustring& filename) length_clock.set (0); timecode_clock.set (0); - + tags_entry.set_sensitive (false); play_btn.set_sensitive (false); - + return false; } @@ -272,7 +272,7 @@ SoundFileBox::setup_labels (const ustring& filename) // this is a hack that is fixed in trunk, i think (august 26th, 2007) vector<string> tags = Library->get_tags (string ("//") + filename); - + stringstream tag_string; for (vector<string>::iterator i = tags.begin(); i != tags.end(); ++i) { if (i != tags.begin()) { @@ -281,12 +281,12 @@ SoundFileBox::setup_labels (const ustring& filename) tag_string << *i; } tags_entry.get_buffer()->set_text (tag_string.str()); - + tags_entry.set_sensitive (true); if (_session) { play_btn.set_sensitive (true); } - + return true; } @@ -309,7 +309,7 @@ SoundFileBox::audition () if (!_session) { return; } - + _session->cancel_audition(); if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) { @@ -331,9 +331,9 @@ SoundFileBox::audition () afs = boost::dynamic_pointer_cast<AudioFileSource> ( SourceFactory::createReadable (DataType::AUDIO, *_session, path, false, n, Source::Flag (0), false)); - + srclist.push_back(afs); - + } catch (failed_constructor& err) { error << _("Could not access soundfile: ") << path << endmsg; AudioSource::set_build_peakfiles (old_sbp); @@ -342,11 +342,11 @@ SoundFileBox::audition () } AudioSource::set_build_peakfiles (old_sbp); - + if (srclist.empty()) { return; } - + afs = boost::dynamic_pointer_cast<AudioFileSource> (srclist[0]); string rname = region_name_from_path (afs->path(), false); r = boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (srclist, 0, @@ -418,7 +418,7 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S chooser.add_shortcut_folder_uri("file:///Library/GarageBand/Apple Loops"); chooser.add_shortcut_folder_uri("file:///Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files"); } - + //add the file chooser { @@ -426,10 +426,10 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S audio_filter.add_custom (FILE_FILTER_FILENAME, mem_fun(*this, &SoundFileBrowser::on_audio_filter)); audio_filter.set_name (_("Audio files")); - + midi_filter.add_custom (FILE_FILTER_FILENAME, mem_fun(*this, &SoundFileBrowser::on_midi_filter)); midi_filter.set_name (_("MIDI files")); - + matchall_filter.add_pattern ("*.*"); matchall_filter.set_name (_("All files")); @@ -445,13 +445,13 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S } notebook.append_page (chooser, _("Browse Files")); } - + hpacker.set_spacing (6); hpacker.pack_start (notebook, true, true); hpacker.pack_start (preview, false, false); - + get_vbox()->pack_start (hpacker, true, true); - + //add tag search { VBox* vbox; @@ -461,7 +461,7 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S hbox = manage(new HBox); hbox->pack_start (found_entry); hbox->pack_start (found_search_btn); - + Gtk::ScrolledWindow *scroll = manage(new ScrolledWindow); scroll->add(found_list_view); scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); @@ -469,11 +469,11 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S vbox = manage(new VBox); vbox->pack_start (*hbox, PACK_SHRINK); vbox->pack_start (*scroll); - + found_list_view.append_column(_("Paths"), found_list_columns.pathname); found_list_view.get_selection()->signal_changed().connect(mem_fun(*this, &SoundFileBrowser::found_list_view_selected)); - + found_list_view.signal_row_activated().connect (mem_fun (*this, &SoundFileBrowser::found_list_view_activated)); found_search_btn.signal_clicked().connect(mem_fun(*this, &SoundFileBrowser::found_search_clicked)); @@ -506,7 +506,7 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S passbox->pack_start (*label, false, false); passbox->pack_start (freesound_entry, false, false); passbox->pack_start (freesound_search_btn, false, false); - + Gtk::ScrolledWindow *scroll = manage(new ScrolledWindow); scroll->add(freesound_list_view); scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); @@ -514,12 +514,12 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S vbox = manage(new VBox); vbox->pack_start (*passbox, PACK_SHRINK); vbox->pack_start(*scroll); - + //vbox->pack_start (freesound_list_view); freesound_list_view.append_column(_("Paths"), freesound_list_columns.pathname); freesound_list_view.get_selection()->signal_changed().connect(mem_fun(*this, &SoundFileBrowser::freesound_list_view_selected)); - + //freesound_list_view.get_selection()->set_mode (SELECTION_MULTIPLE); freesound_list_view.signal_row_activated().connect (mem_fun (*this, &SoundFileBrowser::freesound_list_view_activated)); freesound_search_btn.signal_clicked().connect(mem_fun(*this, &SoundFileBrowser::freesound_search_clicked)); @@ -527,7 +527,7 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S notebook.append_page (*vbox, _("Search Freesound")); } #endif - + notebook.set_size_request (500, -1); @@ -536,7 +536,7 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S add_button (Stock::CANCEL, RESPONSE_CANCEL); add_button (Stock::APPLY, RESPONSE_APPLY); add_button (Stock::OK, RESPONSE_OK); - + } SoundFileBrowser::~SoundFileBrowser () @@ -669,7 +669,7 @@ SoundFileBrowser::found_list_view_selected () ustring file; TreeView::Selection::ListHandle_Path rows = found_list_view.get_selection()->get_selected_rows (); - + if (!rows.empty()) { TreeIter iter = found_list->get_iter(*rows.begin()); file = (*iter)[found_list_columns.pathname]; @@ -678,7 +678,7 @@ SoundFileBrowser::found_list_view_selected () } else { set_response_sensitive (RESPONSE_OK, false); } - + preview.setup_labels (file); } } @@ -692,7 +692,7 @@ SoundFileBrowser::freesound_list_view_selected () ustring file; TreeView::Selection::ListHandle_Path rows = freesound_list_view.get_selection()->get_selected_rows (); - + if (!rows.empty()) { TreeIter iter = freesound_list->get_iter(*rows.begin()); file = (*iter)[freesound_list_columns.pathname]; @@ -701,7 +701,7 @@ SoundFileBrowser::freesound_list_view_selected () } else { set_response_sensitive (RESPONSE_OK, false); } - + preview.setup_labels (file); } } @@ -717,10 +717,10 @@ SoundFileBrowser::found_search_clicked () warning << _("SoundFileBrowser: Could not tokenize string: ") << tag_string << endmsg; return; } - + vector<string> results; Library->search_members_and (results, tags); - + found_list->clear(); for (vector<string>::iterator i = results.begin(); i != results.end(); ++i) { TreeModel::iterator new_row = found_list->append(); @@ -736,7 +736,7 @@ freesound_search_thread_entry (void* arg) PBD::notify_gui_about_thread_creation (pthread_self(), X_("Freesound Search")); static_cast<SoundFileBrowser*>(arg)->freesound_search_thread (); - + return 0; } @@ -748,7 +748,7 @@ SoundFileBrowser::freesound_search_clicked () { if (canceling) //already canceling, button does nothing return; - + if ( searching ) { freesound_search_btn.set_label(_("Cancelling..")); canceling = true; @@ -770,7 +770,7 @@ SoundFileBrowser::freesound_search_thread() path = Glib::get_home_dir(); path += "/Freesound/"; Mootcher theMootcher(path.c_str()); - + string name_string = freesound_name_entry.get_text (); string pass_string = freesound_pass_entry.get_text (); string search_string = freesound_entry.get_text (); @@ -799,7 +799,7 @@ SoundFileBrowser::freesound_search_thread() TreeModel::iterator new_row = freesound_list->append(); TreeModel::Row row = *new_row; string path = Glib::filename_from_uri (string ("file:") + filename); - row[freesound_list_columns.pathname] = path; + row[freesound_list_columns.pathname] = path; } } } @@ -816,9 +816,9 @@ vector<ustring> SoundFileBrowser::get_paths () { vector<ustring> results; - + int n = notebook.get_current_page (); - + if (n == 0) { vector<ustring> filenames = chooser.get_filenames(); vector<ustring>::iterator i; @@ -829,27 +829,27 @@ SoundFileBrowser::get_paths () results.push_back (*i); } } - + } else if (n==1){ - + typedef TreeView::Selection::ListHandle_Path ListPath; - + ListPath rows = found_list_view.get_selection()->get_selected_rows (); for (ListPath::iterator i = rows.begin() ; i != rows.end(); ++i) { TreeIter iter = found_list->get_iter(*i); ustring str = (*iter)[found_list_columns.pathname]; - + results.push_back (str); } } else { - + typedef TreeView::Selection::ListHandle_Path ListPath; - + ListPath rows = freesound_list_view.get_selection()->get_selected_rows (); for (ListPath::iterator i = rows.begin() ; i != rows.end(); ++i) { TreeIter iter = freesound_list->get_iter(*i); ustring str = (*iter)[freesound_list_columns.pathname]; - + results.push_back (str); } } @@ -914,26 +914,26 @@ SoundFileOmega::reset_options () if (selected_track_cnt > 0) { if (channel_combo.get_active_text().length()) { ImportDisposition id = get_channel_disposition(); - + switch (id) { case Editing::ImportDistinctFiles: if (selected_track_cnt == paths.size()) { action_strings.push_back (importmode2string (ImportToTrack)); } break; - + case Editing::ImportDistinctChannels: /* XXX it would be nice to allow channel-per-selected track - but its too hard we don't want to deal with all the + but its too hard we don't want to deal with all the different per-file + per-track channel configurations. */ break; - + default: action_strings.push_back (importmode2string (ImportToTrack)); break; } - } + } } action_strings.push_back (importmode2string (ImportAsTrack)); @@ -973,7 +973,7 @@ SoundFileOmega::reset_options () } vector<string> channel_strings; - + if (mode == ImportAsTrack || mode == ImportAsTapeTrack || mode == ImportToTrack) { channel_strings.push_back (_("one track per file")); @@ -991,7 +991,7 @@ SoundFileOmega::reset_options () if (same_size) { channel_strings.push_back (_("all files in one region")); } - + } } else { @@ -1034,7 +1034,7 @@ SoundFileOmega::reset_options () } else { src_combo.set_sensitive (false); } - + if (Config->get_only_copy_imported_files()) { if (selection_can_be_embedded_with_links) { @@ -1047,15 +1047,15 @@ SoundFileOmega::reset_options () copy_files_btn.set_sensitive (true); } - + return true; -} +} bool SoundFileOmega::bad_file_message() { - MessageDialog msg (*this, + MessageDialog msg (*this, _("One or more of the selected files\ncannot be used by Ardour"), true, Gtk::MESSAGE_INFO, @@ -1106,7 +1106,7 @@ SoundFileOmega::check_info (const vector<ustring>& paths, bool& same_size, bool& multichannel = true; // "channel" == track here... } - /* XXX we need err = true handling here in case + /* XXX we need err = true handling here in case we can't check the file */ @@ -1131,7 +1131,7 @@ SoundFileOmega::check_link_status (const Session& s, const vector<ustring>& path return false; } } - + for (vector<ustring>::const_iterator i = paths.begin(); i != paths.end(); ++i) { char tmpc[MAXPATHLEN+1]; @@ -1143,7 +1143,7 @@ SoundFileOmega::check_link_status (const Session& s, const vector<ustring>& path if (link ((*i).c_str(), tmpc)) { goto out; } - + unlink (tmpc); } @@ -1183,7 +1183,7 @@ SoundFileChooser::get_filename () if (paths.empty()) { return ustring (); } - + if (!Glib::file_test (paths.front(), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { return ustring(); } @@ -1202,11 +1202,11 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi vector<string> str; set_size_request (-1, 450); - + block_two.set_border_width (12); block_three.set_border_width (12); block_four.set_border_width (12); - + options.set_spacing (12); str.clear (); @@ -1219,7 +1219,7 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi Label* l = manage (new Label); l->set_text (_("Add files:")); - + hbox = manage (new HBox); hbox->set_border_width (12); hbox->set_spacing (6); @@ -1229,7 +1229,7 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi vbox->pack_start (*hbox, false, false); options.pack_start (*vbox, false, false); - /* dummy entry for action combo so that it doesn't look odd if we + /* dummy entry for action combo so that it doesn't look odd if we come up with no tracks selected. */ @@ -1296,7 +1296,7 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi reset_options (); action_combo.signal_changed().connect (mem_fun (*this, &SoundFileOmega::reset_options_noret)); - + copy_files_btn.set_active (true); block_four.pack_start (copy_files_btn, false, false); @@ -1417,7 +1417,7 @@ SoundFileOmega::reset (int selected_tracks) { selected_track_cnt = selected_tracks; reset_options (); -} +} void SoundFileOmega::file_selection_changed () diff --git a/gtk2_ardour/sfdb_ui.h b/gtk2_ardour/sfdb_ui.h index d9d0322532..740667fc0f 100644 --- a/gtk2_ardour/sfdb_ui.h +++ b/gtk2_ardour/sfdb_ui.h @@ -56,7 +56,7 @@ class SoundFileBox : public Gtk::VBox public: SoundFileBox (bool persistent); virtual ~SoundFileBox () {}; - + void set_session (ARDOUR::Session* s); bool setup_labels (const Glib::ustring& filename); @@ -67,11 +67,11 @@ class SoundFileBox : public Gtk::VBox protected: ARDOUR::Session* _session; Glib::ustring path; - + ARDOUR::SoundFileInfo sf_info; - + Gtk::Table table; - + Gtk::Label length; Gtk::Label format; Gtk::Label channels; @@ -80,7 +80,7 @@ class SoundFileBox : public Gtk::VBox Gtk::Label channels_value; Gtk::Label samplerate_value; - + Gtk::Label format_text; AudioClock length_clock; AudioClock timecode_clock; @@ -89,11 +89,11 @@ class SoundFileBox : public Gtk::VBox Gtk::Label preview_label; Gtk::TextView tags_entry; - + Gtk::VBox main_box; Gtk::VBox path_box; Gtk::HBox bottom_box; - + Gtk::Button play_btn; Gtk::Button stop_btn; Gtk::CheckButton autoplay_btn; @@ -112,10 +112,10 @@ class SoundFileBrowser : public ArdourDialog { public: Gtk::TreeModelColumn<Glib::ustring> pathname; - + FoundTagColumns() { add(pathname); } }; - + FoundTagColumns found_list_columns; Glib::RefPtr<Gtk::ListStore> found_list; @@ -125,10 +125,10 @@ class SoundFileBrowser : public ArdourDialog public: SoundFileBrowser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s, bool persistent); virtual ~SoundFileBrowser (); - + virtual void set_session (ARDOUR::Session*); std::vector<Glib::ustring> get_paths (); - + void clear_selection (); Gtk::FileChooserWidget chooser; @@ -149,7 +149,7 @@ class SoundFileBrowser : public ArdourDialog protected: bool resetting_ourselves; - + Gtk::FileFilter audio_filter; Gtk::FileFilter midi_filter; Gtk::FileFilter custom_filter; @@ -178,9 +178,9 @@ class SoundFileBrowser : public ArdourDialog void freesound_list_view_selected (); void freesound_list_view_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn*); void freesound_search_clicked (); - + void chooser_file_activated (); - + bool on_audio_filter (const Gtk::FileFilter::Info& filter_info); bool on_midi_filter (const Gtk::FileFilter::Info& filter_info); @@ -196,7 +196,7 @@ class SoundFileChooser : public SoundFileBrowser public: SoundFileChooser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s = 0); virtual ~SoundFileChooser () {}; - + Glib::ustring get_filename (); protected: @@ -207,11 +207,11 @@ class SoundFileOmega : public SoundFileBrowser { public: - SoundFileOmega (Gtk::Window& parent, std::string title, ARDOUR::Session* _s, int selected_tracks, bool persistent, + SoundFileOmega (Gtk::Window& parent, std::string title, ARDOUR::Session* _s, int selected_tracks, bool persistent, Editing::ImportMode mode_hint = Editing::ImportAsTrack); - + void reset (int selected_tracks); - + Gtk::ComboBoxText action_combo; Gtk::ComboBoxText where_combo; Gtk::ComboBoxText channel_combo; @@ -239,7 +239,7 @@ class SoundFileOmega : public SoundFileBrowser Gtk::VBox block_three; Gtk::VBox block_four; - bool check_info (const std::vector<Glib::ustring>& paths, + bool check_info (const std::vector<Glib::ustring>& paths, bool& same_size, bool& src_needed, bool& multichannel); static bool check_link_status (const ARDOUR::Session&, const std::vector<Glib::ustring>& paths); diff --git a/gtk2_ardour/simpleline.cc b/gtk2_ardour/simpleline.cc index b1fecba840..6c8c4ceb10 100644 --- a/gtk2_ardour/simpleline.cc +++ b/gtk2_ardour/simpleline.cc @@ -134,7 +134,7 @@ GType SimpleLine::get_base_type() return gnome_canvas_line_get_type(); } -Glib::PropertyProxy<guint> SimpleLine::property_color_rgba() +Glib::PropertyProxy<guint> SimpleLine::property_color_rgba() { return Glib::PropertyProxy<guint>(this, "color_rgba"); } @@ -144,7 +144,7 @@ Glib::PropertyProxy_ReadOnly<guint> SimpleLine::property_color_rgba() const return Glib::PropertyProxy_ReadOnly<guint>(this, "color_rgba"); } -Glib::PropertyProxy<double> SimpleLine::property_x1() +Glib::PropertyProxy<double> SimpleLine::property_x1() { return Glib::PropertyProxy<double>(this, "x1"); } @@ -154,7 +154,7 @@ Glib::PropertyProxy_ReadOnly<double> SimpleLine::property_x1() const return Glib::PropertyProxy_ReadOnly<double>(this, "x1"); } -Glib::PropertyProxy<double> SimpleLine::property_x2() +Glib::PropertyProxy<double> SimpleLine::property_x2() { return Glib::PropertyProxy<double>(this, "x2"); } @@ -164,7 +164,7 @@ Glib::PropertyProxy_ReadOnly<double> SimpleLine::property_x2() const return Glib::PropertyProxy_ReadOnly<double>(this, "x2"); } -Glib::PropertyProxy<double> SimpleLine::property_y1() +Glib::PropertyProxy<double> SimpleLine::property_y1() { return Glib::PropertyProxy<double>(this, "y1"); } @@ -174,7 +174,7 @@ Glib::PropertyProxy_ReadOnly<double> SimpleLine::property_y1() const return Glib::PropertyProxy_ReadOnly<double>(this, "y1"); } -Glib::PropertyProxy<double> SimpleLine::property_y2() +Glib::PropertyProxy<double> SimpleLine::property_y2() { return Glib::PropertyProxy<double>(this, "y2"); } diff --git a/gtk2_ardour/simpleline.h b/gtk2_ardour/simpleline.h index 3e23ace83b..3aea5a4aa4 100644 --- a/gtk2_ardour/simpleline.h +++ b/gtk2_ardour/simpleline.h @@ -6,7 +6,7 @@ /* line.h - * + * * Copyright (C) 1998 EMC Capital Management Inc. * Developed by Havoc Pennington <hp@pobox.com> * @@ -109,7 +109,7 @@ public: explicit SimpleLine(Group& parent); SimpleLine(Group& parent, double x1, double y1, double x2, double y2); - /** + /** * * You rarely need to use properties because there are get_ and set_ methods for almost all of them. * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when @@ -117,7 +117,7 @@ public: */ Glib::PropertyProxy<double> property_x1() ; -/** +/** * * You rarely need to use properties because there are get_ and set_ methods for almost all of them. * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when @@ -125,7 +125,7 @@ public: */ Glib::PropertyProxy_ReadOnly<double> property_x1() const; - /** + /** * * You rarely need to use properties because there are get_ and set_ methods for almost all of them. * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when @@ -133,7 +133,7 @@ public: */ Glib::PropertyProxy<double> property_x2() ; -/** +/** * * You rarely need to use properties because there are get_ and set_ methods for almost all of them. * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when @@ -142,7 +142,7 @@ public: Glib::PropertyProxy_ReadOnly<double> property_x2() const; - /** + /** * * You rarely need to use properties because there are get_ and set_ methods for almost all of them. * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when @@ -150,7 +150,7 @@ public: */ Glib::PropertyProxy<double> property_y1() ; -/** +/** * * You rarely need to use properties because there are get_ and set_ methods for almost all of them. * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when @@ -158,7 +158,7 @@ public: */ Glib::PropertyProxy_ReadOnly<double> property_y1() const; - /** + /** * * You rarely need to use properties because there are get_ and set_ methods for almost all of them. * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when @@ -166,7 +166,7 @@ public: */ Glib::PropertyProxy<double> property_y2() ; -/** +/** * * You rarely need to use properties because there are get_ and set_ methods for almost all of them. * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when @@ -174,7 +174,7 @@ public: */ Glib::PropertyProxy_ReadOnly<double> property_y2() const; - /** + /** * * You rarely need to use properties because there are get_ and set_ methods for almost all of them. * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when @@ -182,7 +182,7 @@ public: */ Glib::PropertyProxy<guint> property_color_rgba() ; -/** +/** * * You rarely need to use properties because there are get_ and set_ methods for almost all of them. * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when diff --git a/gtk2_ardour/simpleline_p.h b/gtk2_ardour/simpleline_p.h index 59a624ea06..0a2e3061fd 100644 --- a/gtk2_ardour/simpleline_p.h +++ b/gtk2_ardour/simpleline_p.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/simplerect.h b/gtk2_ardour/simplerect.h index 299b27a868..d102d91792 100644 --- a/gtk2_ardour/simplerect.h +++ b/gtk2_ardour/simplerect.h @@ -6,7 +6,7 @@ /* rect.h - * + * * Copyright (C) 1998 EMC Capital Management Inc. * Developed by Havoc Pennington <hp@pobox.com> * diff --git a/gtk2_ardour/simplerect_p.h b/gtk2_ardour/simplerect_p.h index ed30fb9ce6..4338d1029d 100644 --- a/gtk2_ardour/simplerect_p.h +++ b/gtk2_ardour/simplerect_p.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/splash.cc b/gtk2_ardour/splash.cc index 3fa96704e3..bba754dc10 100644 --- a/gtk2_ardour/splash.cc +++ b/gtk2_ardour/splash.cc @@ -33,7 +33,7 @@ Splash::Splash () catch (...) { throw failed_constructor(); } - + darea.set_size_request (pixbuf->get_width(), pixbuf->get_height()); set_keep_above (true); set_position (WIN_POS_CENTER); @@ -93,10 +93,10 @@ Splash::expose (GdkEventExpose* ev) window->draw_pixbuf (get_style()->get_bg_gc (STATE_NORMAL), pixbuf, ev->area.x, ev->area.y, ev->area.x, ev->area.y, - min ((pixbuf->get_width() - ev->area.x), ev->area.width), + min ((pixbuf->get_width() - ev->area.x), ev->area.width), min ((pixbuf->get_height() - ev->area.y), ev->area.height), Gdk::RGB_DITHER_NONE, 0, 0); - + Glib::RefPtr<Gtk::Style> style = darea.get_style(); Glib::RefPtr<Gdk::GC> white = style->get_white_gc(); diff --git a/gtk2_ardour/splash.h b/gtk2_ardour/splash.h index a034ddad86..1c645d31cb 100644 --- a/gtk2_ardour/splash.h +++ b/gtk2_ardour/splash.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,9 +41,9 @@ class Splash : public Gtk::Window bool expose (GdkEventExpose*); bool on_button_release_event (GdkEventButton*); void on_realize (); - + void message (const std::string& msg); - + private: static Splash* the_splash; @@ -52,6 +52,6 @@ class Splash : public Gtk::Window Glib::RefPtr<Pango::Layout> layout; void boot_message (std::string); -}; +}; #endif /* __ardour_gtk_splash_h__ */ diff --git a/gtk2_ardour/startup.cc b/gtk2_ardour/startup.cc index e4b19947a7..4fc372b976 100644 --- a/gtk2_ardour/startup.cc +++ b/gtk2_ardour/startup.cc @@ -35,7 +35,7 @@ static string poor_mans_glob (string path) replace_all (copy, "~", Glib::get_home_dir()); return copy; } - + ArdourStartup::ArdourStartup () : applying (false) @@ -73,7 +73,7 @@ Ardour will play NO role in monitoring")) set_resizable (false); set_position (WIN_POS_CENTER); set_border_width (12); - + sys::path icon_file; if (!find_file_in_search_path (ardour_search_path() + system_data_search_path().add_subdirectory_to_paths("icons"), "ardour_icon_48px.png", icon_file)) { @@ -178,7 +178,7 @@ ArdourStartup::session_name (bool& should_be_new) should_be_new = false; TreeIter iter = recent_session_display.get_selection()->get_selected(); - + if (iter) { return (*iter)[recent_session_columns.visible_name]; } @@ -198,7 +198,7 @@ ArdourStartup::session_folder () if (iter) { return (*iter)[recent_session_columns.fullpath]; - } + } return ""; } } @@ -215,7 +215,7 @@ ArdourStartup::setup_audio_page () audio_page_index = append_page (*engine_dialog); set_page_type (*engine_dialog, ASSISTANT_PAGE_CONTENT); set_page_title (*engine_dialog, _("Audio Setup")); - + /* the default parameters should work, so the page is potentially complete */ set_page_complete (*engine_dialog, true); @@ -235,7 +235,7 @@ ideas about music and sound.\n\ There are a few things that need to configured before you start\n\ using the program.</span>\ ")); - + HBox* hbox = manage (new HBox); HBox* vbox = manage (new HBox); @@ -265,12 +265,12 @@ ArdourStartup::default_dir_changed () void ArdourStartup::setup_first_time_config_page () { - default_dir_chooser = manage (new FileChooserButton (_("Default folder for Ardour sessions"), + default_dir_chooser = manage (new FileChooserButton (_("Default folder for Ardour sessions"), FILE_CHOOSER_ACTION_SELECT_FOLDER)); Gtk::Label* txt = manage (new Label); HBox* hbox = manage (new HBox); VBox* vbox = manage (new VBox); - + txt->set_markup (_("\ Each project that you work on with Ardour has its own folder.\n\ These can require a lot of disk space if you are recording audio.\n\ @@ -307,7 +307,7 @@ ArdourStartup::setup_monitoring_choice_page () { mon_vbox.set_spacing (18); mon_vbox.set_border_width (24); - + HBox* hbox = manage (new HBox); VBox* vbox = manage (new VBox); RadioButton::Group g (monitor_via_hardware_button.get_group()); @@ -354,7 +354,7 @@ ArdourStartup::setup_initial_choice_page () HBox* centering_hbox = manage (new HBox); VBox* centering_vbox = manage (new VBox); - + centering_vbox->set_spacing (6); centering_vbox->pack_start (ic_new_session_button, false, true); @@ -445,13 +445,13 @@ ArdourStartup::on_apply () if (default_dir_chooser) { Config->set_default_session_parent_dir (default_dir_chooser->get_current_folder()); } - + if (monitor_via_hardware_button.get_active()) { Config->set_monitoring_model (ExternalMonitoring); } else if (monitor_via_ardour_button.get_active()) { Config->set_monitoring_model (SoftwareMonitoring); } - + Config->save_state (); } @@ -462,7 +462,7 @@ void ArdourStartup::on_prepare (Gtk::Widget* page) { if (page == &session_vbox) { - + if (ic_new_session_button.get_active()) { /* new session requested */ setup_new_session_page (); @@ -470,14 +470,14 @@ ArdourStartup::on_prepare (Gtk::Widget* page) /* existing session requested */ setup_existing_session_page (); } - } + } } void ArdourStartup::populate_session_templates () { vector<TemplateInfo> templates; - + find_session_templates (templates); template_model->clear (); @@ -486,7 +486,7 @@ ArdourStartup::populate_session_templates () TreeModel::Row row; row = *(template_model->append ()); - + row[session_template_columns.name] = (*x).name; row[session_template_columns.path] = (*x).path; } @@ -505,38 +505,38 @@ ArdourStartup::setup_new_session_page () VBox *vbox1 = manage (new VBox); HBox* hbox1 = manage (new HBox); Label* label1 = manage (new Label); - + vbox1->set_spacing (6); hbox1->set_spacing (6); hbox1->pack_start (*label1, false, false); hbox1->pack_start (new_name_entry, true, true); - + label1->set_text (_("Session name:")); - + if (!ARDOUR_COMMAND_LINE::session_name.empty()) { new_name_entry.set_text (Glib::path_get_basename (ARDOUR_COMMAND_LINE::session_name)); /* name provided - they can move right along */ set_page_complete (session_vbox, true); } - + new_name_entry.signal_changed().connect (mem_fun (*this, &ArdourStartup::new_name_changed)); new_name_entry.signal_activate().connect (mem_fun (*this, &ArdourStartup::move_along_now)); - + vbox1->pack_start (*hbox1, true, true); /* --- */ HBox* hbox2 = manage (new HBox); Label* label2 = manage (new Label); - + hbox2->set_spacing (6); hbox2->pack_start (*label2, false, false); hbox2->pack_start (new_folder_chooser, true, true); - + label2->set_text (_("Create session folder in:")); - + if (!ARDOUR_COMMAND_LINE::session_name.empty()) { new_folder_chooser.set_current_folder (poor_mans_glob (Glib::path_get_dirname (ARDOUR_COMMAND_LINE::session_name))); } else { @@ -557,7 +557,7 @@ ArdourStartup::setup_new_session_page () populate_session_templates (); vbox2->set_spacing (6); - + label3->set_markup (_("<b>Options</b>")); label3->set_alignment (0.0, 0.0); @@ -579,37 +579,37 @@ ArdourStartup::setup_new_session_page () hbox4a->set_spacing (6); hbox4a->pack_start (use_template_button, false, false); hbox4a->pack_start (template_chooser, true, true); - + template_chooser.set_model (template_model); - + Gtk::CellRendererText* text_renderer = Gtk::manage (new Gtk::CellRendererText); text_renderer->property_editable() = false; - + template_chooser.pack_start (*text_renderer); template_chooser.add_attribute (text_renderer->property_text(), session_template_columns.name); template_chooser.set_active (0); - + use_template_button.show(); template_chooser.show (); vbox3->pack_start (*hbox4a, false, false); } - + /* --- */ if (!new_user) { session_template_chooser.set_current_folder (poor_mans_glob (Config->get_default_session_parent_dir())); - + HBox* hbox4b = manage (new HBox); use_session_as_template_button.set_label (_("Use an existing session as a template:")); - + hbox4b->set_spacing (6); hbox4b->pack_start (use_session_as_template_button, false, false); hbox4b->pack_start (session_template_chooser, true, true); - + use_session_as_template_button.show (); session_template_chooser.show (); - + Gtk::FileFilter* template_filter = manage (new (Gtk::FileFilter)); template_filter->add_pattern(X_("*.template")); session_template_chooser.set_filter (*template_filter); @@ -619,12 +619,12 @@ ArdourStartup::setup_new_session_page () } /* --- */ - + HBox* hbox5 = manage (new HBox); - + hbox5->set_spacing (6); hbox5->pack_start (more_new_session_options_button, false, false); - + more_new_session_options_button.show (); more_new_session_options_button.signal_clicked().connect (mem_fun (*this, &ArdourStartup::more_new_session_options_button_clicked)); @@ -660,7 +660,7 @@ ArdourStartup::redisplay_recent_sessions () { std::vector<sys::path> session_directories; RecentSessionsSorter cmp; - + recent_session_display.set_model (Glib::RefPtr<TreeModel>(0)); recent_session_model->clear (); @@ -674,11 +674,11 @@ ArdourStartup::redisplay_recent_sessions () // // sort them alphabetically sort (rs.begin(), rs.end(), cmp); - + for (ARDOUR::RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) { session_directories.push_back ((*i).second); } - + for (vector<sys::path>::const_iterator i = session_directories.begin(); i != session_directories.end(); ++i) { std::vector<sys::path> state_file_paths; @@ -690,7 +690,7 @@ ArdourStartup::redisplay_recent_sessions () vector<string*>* states; vector<const gchar*> item; string fullpath = (*i).to_string(); - + /* remove any trailing / */ if (fullpath[fullpath.length()-1] == '/') { @@ -701,22 +701,22 @@ ArdourStartup::redisplay_recent_sessions () if (!Glib::file_test(fullpath.c_str(), Glib::FILE_TEST_EXISTS)) { /* session doesn't exist */ continue; - } - + } + /* now get available states for this session */ if ((states = Session::possible_states (fullpath)) == 0) { /* no state file? */ continue; } - + std::vector<string> state_file_names(get_file_names_no_extension (state_file_paths)); Gtk::TreeModel::Row row = *(recent_session_model->append()); row[recent_session_columns.visible_name] = Glib::path_get_basename (fullpath); row[recent_session_columns.fullpath] = fullpath; - + if (state_file_names.size() > 1) { // add the children @@ -760,13 +760,13 @@ ArdourStartup::setup_existing_session_page () recent_session_display.append_column (_("Recent Sessions"), recent_session_columns.visible_name); recent_session_display.set_headers_visible (false); recent_session_display.get_selection()->set_mode (SELECTION_BROWSE); - + recent_session_display.get_selection()->signal_changed().connect (mem_fun (*this, &ArdourStartup::recent_session_row_selected)); - + recent_scroller.add (recent_session_display); recent_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); recent_scroller.set_shadow_type (Gtk::SHADOW_IN); - + recent_session_display.show(); } @@ -801,7 +801,7 @@ ArdourStartup::setup_more_options_page () _input_limit_count.set_adjustment (_input_limit_count_adj); _control_bus_channel_count.set_adjustment (_control_bus_channel_count_adj); _master_bus_channel_count.set_adjustment (_master_bus_channel_count_adj); - + chan_count_label_1.set_text (_("channels")); chan_count_label_2.set_text (_("channels")); chan_count_label_3.set_text (_("channels")); @@ -856,14 +856,14 @@ ArdourStartup::setup_more_options_page () advanced_table.set_row_spacings(0); advanced_table.set_col_spacings(0); - + _connect_inputs.set_label (_("Automatically connect to physical_inputs")); _connect_inputs.set_flags(Gtk::CAN_FOCUS); _connect_inputs.set_relief(Gtk::RELIEF_NORMAL); _connect_inputs.set_mode(true); _connect_inputs.set_active(true); _connect_inputs.set_border_width(0); - + _limit_input_ports.set_label (_("Use only")); _limit_input_ports.set_flags(Gtk::CAN_FOCUS); _limit_input_ports.set_relief(Gtk::RELIEF_NORMAL); @@ -889,7 +889,7 @@ ArdourStartup::setup_more_options_page () bus_frame.set_label_align(0,0.5); bus_frame.add(bus_hbox); bus_frame.set_label_widget(bus_label); - + bus_table.set_row_spacings (0); bus_table.set_col_spacings (0); bus_table.attach (_create_master_bus, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); @@ -1000,7 +1000,7 @@ ArdourStartup::setup_more_options_page () * default. this is entirely by design - this page * should be skipped unless explicitly requested. */ - + session_options_page_index = append_page (more_options_vbox); set_page_title (more_options_vbox, _("Advanced Session Options")); set_page_complete (more_options_vbox, true); diff --git a/gtk2_ardour/startup.h b/gtk2_ardour/startup.h index b3b1379ea5..9a4202b399 100644 --- a/gtk2_ardour/startup.h +++ b/gtk2_ardour/startup.h @@ -55,7 +55,7 @@ class ArdourStartup : public Gtk::Assistant { bool connect_outs_to_master() const; bool connect_outs_to_physical() const ; - + private: bool applying; bool config_modified; @@ -104,11 +104,11 @@ class ArdourStartup : public Gtk::Assistant { void setup_session_page (); Gtk::VBox session_vbox; Gtk::HBox session_hbox; - + /* recent sessions */ - + void setup_existing_session_page (); - + struct RecentSessionsSorter { bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const { return cmp_nocase(a.first, b.first) == -1; @@ -133,7 +133,7 @@ class ArdourStartup : public Gtk::Assistant { void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col); /* audio setup page */ - + void setup_audio_page (); EngineControl* engine_dialog; @@ -145,7 +145,7 @@ class ArdourStartup : public Gtk::Assistant { Gtk::FileChooserButton session_template_chooser; struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord { - SessionTemplateColumns () { + SessionTemplateColumns () { add (name); add (path); } @@ -202,7 +202,7 @@ class ArdourStartup : public Gtk::Assistant { Gtk::CheckButton _create_master_bus; Gtk::SpinButton _master_bus_channel_count; - + Gtk::CheckButton _create_control_bus; Gtk::SpinButton _control_bus_channel_count; @@ -210,7 +210,7 @@ class ArdourStartup : public Gtk::Assistant { Gtk::CheckButton _limit_input_ports; Gtk::SpinButton _input_limit_count; - Gtk::CheckButton _connect_outputs; + Gtk::CheckButton _connect_outputs; Gtk::CheckButton _limit_output_ports; Gtk::SpinButton _output_limit_count; @@ -252,7 +252,7 @@ class ArdourStartup : public Gtk::Assistant { gint session_options_page_index; void move_along_now (); - + }; #endif /* __gtk2_ardour_startup_h__ */ diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index afa41d6f90..81c272a882 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001, 2006 Paul Davis + Copyright (C) 2001, 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -71,7 +71,7 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group) canvas_rect->property_y2() = (double) tv.current_height(); canvas_rect->raise(1); // raise above tempo lines - canvas_rect->property_outline_what() = (guint32) (0x2|0x8); // outline RHS and bottom + canvas_rect->property_outline_what() = (guint32) (0x2|0x8); // outline RHS and bottom canvas_rect->signal_event().connect (bind ( mem_fun (_trackview.editor(), &PublicEditor::canvas_stream_view_event), @@ -88,7 +88,7 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group) mem_fun (*this, &StreamView::rec_enable_changed)); _trackview.session().RecordStateChanged.connect ( mem_fun (*this, &StreamView::sess_rec_enable_changed)); - } + } ColorsChanged.connect (mem_fun (*this, &StreamView::color_handler)); } @@ -96,9 +96,9 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group) StreamView::~StreamView () { undisplay_diskstream (); - + delete canvas_rect; - + if (owns_canvas_group) { delete canvas_group; } @@ -137,11 +137,11 @@ StreamView::set_height (double h) update_contents_height (); HeightChanged (); - + return 0; } -int +int StreamView::set_samples_per_unit (gdouble spp) { RegionViewList::iterator i; @@ -158,7 +158,7 @@ StreamView::set_samples_per_unit (gdouble spp) for (vector<RecBoxInfo>::iterator xi = rec_rects.begin(); xi != rec_rects.end(); ++xi) { RecBoxInfo &recbox = (*xi); - + gdouble xstart = _trackview.editor().frame_to_pixel (recbox.start); gdouble xend = _trackview.editor().frame_to_pixel (recbox.start + recbox.length); @@ -175,7 +175,7 @@ void StreamView::add_region_view_weak (boost::weak_ptr<Region> r) { boost::shared_ptr<Region> sp (r.lock()); - + if (sp) { add_region_view (sp); } @@ -186,9 +186,9 @@ void StreamView::add_region_view (boost::shared_ptr<Region> r) { ENSURE_GUI_THREAD (bind (mem_fun (*this, &StreamView::add_region_view), r)); - + add_region_view_internal (r, true); - + if (_layer_display == Stacked) { update_contents_height (); } @@ -299,7 +299,7 @@ void StreamView::playlist_modified_weak (boost::weak_ptr<Diskstream> ds) { boost::shared_ptr<Diskstream> sp (ds.lock()); - + if (sp) { playlist_modified (sp); } @@ -344,7 +344,7 @@ StreamView::playlist_changed (boost::shared_ptr<Diskstream> ds) i != playlist_connections.end(); ++i) { (*i).disconnect(); } - + playlist_connections.clear(); undisplay_diskstream (); @@ -354,9 +354,9 @@ StreamView::playlist_changed (boost::shared_ptr<Diskstream> ds) update_coverage_frames (); ds->playlist()->set_explicit_relayering (_layer_display == Stacked); - + /* draw it */ - + redisplay_diskstream (); /* catch changes */ @@ -398,7 +398,7 @@ StreamView::apply_color (Gdk::Color& color, ColorTarget target) (*i)->set_color (region_color); } break; - + case StreamBaseColor: stream_base_color = RGBA_TO_UINT ( color.get_red_p(), color.get_green_p(), color.get_blue_p(), 255); @@ -451,28 +451,28 @@ StreamView::update_rec_box () nframes_t at = _trackview.get_diskstream()->current_capture_end(); double xstart; double xend; - + switch (_trackview.track()->mode()) { - + case NonLayered: case Normal: rect.length = at - rect.start; xstart = _trackview.editor().frame_to_pixel (rect.start); xend = _trackview.editor().frame_to_pixel (at); break; - + case Destructive: rect.length = 2; xstart = _trackview.editor().frame_to_pixel (_trackview.get_diskstream()->current_capture_start()); xend = _trackview.editor().frame_to_pixel (at); break; } - + rect.rectangle->property_x1() = xstart; rect.rectangle->property_x2() = xend; } } - + RegionView* StreamView::find_view (boost::shared_ptr<const Region> region) { @@ -484,7 +484,7 @@ StreamView::find_view (boost::shared_ptr<const Region> region) } return 0; } - + void StreamView::foreach_regionview (sigc::slot<void,RegionView*> slot) { @@ -499,9 +499,9 @@ StreamView::set_selected_regionviews (RegionSelection& regions) bool selected; for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) { - + selected = false; - + for (RegionSelection::iterator ii = regions.begin(); ii != regions.end(); ++ii) { if (*i == *ii) { selected = true; @@ -518,13 +518,13 @@ StreamView::get_selectables (nframes_t start, nframes_t end, double top, double { layer_t min_layer = 0; layer_t max_layer = 0; - + if (_layer_display == Stacked) { double const c = child_height (); min_layer = _layers - ((bottom - _trackview.y_position()) / c); max_layer = _layers - ((top - _trackview.y_position()) / c); } - + for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) { bool layer_ok = true; @@ -533,7 +533,7 @@ StreamView::get_selectables (nframes_t start, nframes_t end, double top, double layer_t const l = (*i)->region()->layer (); layer_ok = (min_layer <= l && l <= max_layer); } - + if ((*i)->region()->coverage (start, end) != OverlapNone && layer_ok) { results.push_back (*i); } @@ -557,7 +557,7 @@ StreamView::child_height () const if (_layer_display == Stacked) { return height / _layers; } - + return height; } diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h index 39ca9f10d3..bfd3cb7b00 100644 --- a/gtk2_ardour/streamview.h +++ b/gtk2_ardour/streamview.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001, 2006 Paul Davis + Copyright (C) 2001, 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -99,7 +99,7 @@ public: void region_layered (RegionView*); virtual void update_contents_height (); - + virtual void redisplay_diskstream () = 0; double child_height () const; ARDOUR::layer_t layers () const { return _layers; } @@ -107,20 +107,20 @@ public: virtual RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool) { return 0; } - + sigc::signal<void,RegionView*> RegionViewAdded; sigc::signal<void> HeightChanged; protected: StreamView (RouteTimeAxisView&, ArdourCanvas::Group* group = NULL); - + void transport_changed(); void transport_looped(); void rec_enable_changed(); void sess_rec_enable_changed(); virtual void setup_rec_box () = 0; void update_rec_box (); - + virtual RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>, bool wait_for_waves, bool recording = false) = 0; virtual void remove_region_view (boost::weak_ptr<ARDOUR::Region> ); @@ -129,12 +129,12 @@ protected: virtual void undisplay_diskstream (); void diskstream_changed (); void layer_regions (); - + virtual void playlist_changed_weak (boost::weak_ptr<ARDOUR::Diskstream>); virtual void playlist_changed (boost::shared_ptr<ARDOUR::Diskstream>); virtual void playlist_modified_weak (boost::weak_ptr<ARDOUR::Diskstream>); virtual void playlist_modified (boost::shared_ptr<ARDOUR::Diskstream>); - + virtual void color_handler () = 0; RouteTimeAxisView& _trackview; @@ -154,7 +154,7 @@ protected: bool rec_updating; bool rec_active; bool use_rec_regions; - + Gdk::Color region_color; ///< Contained region color uint32_t stream_base_color; ///< Background color @@ -163,7 +163,7 @@ protected: ARDOUR::layer_t _layers; LayerDisplay _layer_display; - + double height; std::list<sigc::connection> rec_data_ready_connections; diff --git a/gtk2_ardour/strip_selection.h b/gtk2_ardour/strip_selection.h index 466101851d..35e5950d61 100644 --- a/gtk2_ardour/strip_selection.h +++ b/gtk2_ardour/strip_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/strip_silence_dialog.cc b/gtk2_ardour/strip_silence_dialog.cc index 2770d6b03d..a455db3f24 100644 --- a/gtk2_ardour/strip_silence_dialog.cc +++ b/gtk2_ardour/strip_silence_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,12 +42,12 @@ StripSilenceDialog::StripSilenceDialog (std::list<boost::shared_ptr<ARDOUR::Audi w.view = 0; w.samples_per_unit = 1; _waves.push_back (w); - + } - + Gtk::HBox* hbox = Gtk::manage (new Gtk::HBox); hbox->set_spacing (16); - + Gtk::Table* table = Gtk::manage (new Gtk::Table (4, 3)); table->set_spacings (4); @@ -127,7 +127,7 @@ void StripSilenceDialog::create_waves () { int n = 0; - + for (std::list<Wave>::iterator i = _waves.begin(); i != _waves.end(); ++i) { if (i->region->audio_source(0)->peaks_ready (mem_fun (*this, &StripSilenceDialog::peaks_ready), _peaks_ready_connection)) { i->view = new WaveView (*(_canvas->root())); @@ -173,12 +173,12 @@ void StripSilenceDialog::update_silence_rects () { int n = 0; - + for (std::list<Wave>::iterator i = _waves.begin(); i != _waves.end(); ++i) { for (std::list<ArdourCanvas::SimpleRect*>::iterator j = i->silence_rects.begin(); j != i->silence_rects.end(); ++j) { delete *j; } - + i->silence_rects.clear (); std::list<std::pair<nframes_t, nframes_t> > const silence = @@ -194,7 +194,7 @@ StripSilenceDialog::update_silence_rects () r->property_outline_pixels() = 0; r->property_fill_color_rgba() = RGBA_TO_UINT (128, 128, 128, 128); i->silence_rects.push_back (r); - + } ++n; diff --git a/gtk2_ardour/strip_silence_dialog.h b/gtk2_ardour/strip_silence_dialog.h index 351fffa005..b7f776b537 100644 --- a/gtk2_ardour/strip_silence_dialog.h +++ b/gtk2_ardour/strip_silence_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,13 +43,13 @@ public: nframes_t fade_length () const { return _fade_length.get_value_as_int (); } - + private: void create_waves (); void peaks_ready (); void canvas_allocation (Gtk::Allocation &); void update_silence_rects (); - + Gtk::SpinButton _threshold; Gtk::SpinButton _minimum_length; Gtk::SpinButton _fade_length; diff --git a/gtk2_ardour/tape_region_view.cc b/gtk2_ardour/tape_region_view.cc index c5267a9f24..5daa3b4a6d 100644 --- a/gtk2_ardour/tape_region_view.cc +++ b/gtk2_ardour/tape_region_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,13 +49,13 @@ const TimeAxisViewItem::Visibility TapeAudioRegionView::default_tape_visibility TimeAxisViewItem::HideFrameRight | TimeAxisViewItem::FullWidthNameHighlight); -TapeAudioRegionView::TapeAudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, - boost::shared_ptr<AudioRegion> r, - double spu, +TapeAudioRegionView::TapeAudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, + boost::shared_ptr<AudioRegion> r, + double spu, Gdk::Color const & basic_color) : AudioRegionView (parent, tv, r, spu, basic_color, false, - TimeAxisViewItem::Visibility ((r->position() != 0) ? default_tape_visibility : + TimeAxisViewItem::Visibility ((r->position() != 0) ? default_tape_visibility : TimeAxisViewItem::Visibility (default_tape_visibility|TimeAxisViewItem::HideFrameLeft))) { } @@ -70,11 +70,11 @@ TapeAudioRegionView::init (Gdk::Color const & basic_color, bool /*wfw*/) AudioRegionView::init(basic_color, false); /* every time the wave data changes and peaks are ready, redraw */ - + for (uint32_t n = 0; n < audio_region()->n_channels(); ++n) { audio_region()->audio_source(n)->PeaksReady.connect (bind (mem_fun(*this, &TapeAudioRegionView::update), n)); } - + } TapeAudioRegionView::~TapeAudioRegionView() diff --git a/gtk2_ardour/tape_region_view.h b/gtk2_ardour/tape_region_view.h index 8887281393..a3aa7142ea 100644 --- a/gtk2_ardour/tape_region_view.h +++ b/gtk2_ardour/tape_region_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ class TapeAudioRegionView : public AudioRegionView { public: - TapeAudioRegionView (ArdourCanvas::Group *, + TapeAudioRegionView (ArdourCanvas::Group *, RouteTimeAxisView&, boost::shared_ptr<ARDOUR::AudioRegion>, double initial_samples_per_unit, diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index e83ff09a1d..b78d57df63 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ -#include <cstdio> // for snprintf, grrr +#include <cstdio> // for snprintf, grrr #include <gtkmm/stock.h> #include <gtkmm2ext/utils.h> @@ -76,7 +76,7 @@ TempoDialog::init (const BBT_Time& when, double bpm, double note_type, bool mova strings.push_back (_("eighth (8)")); strings.push_back (_("sixteenth (16)")); strings.push_back (_("thirty-second (32)")); - + set_popdown_strings (note_types, strings, true); if (note_type == 1.0f) { @@ -109,19 +109,19 @@ TempoDialog::init (const BBT_Time& when, double bpm, double note_type, bool mova when_bar_entry.set_text (buf); snprintf (buf, sizeof (buf), "%" PRIu32, when.beats); when_beat_entry.set_text (buf); - + when_bar_entry.set_name ("MetricEntry"); when_beat_entry.set_name ("MetricEntry"); - + when_bar_label.set_name ("MetricLabel"); when_beat_label.set_name ("MetricLabel"); - + table->attach (when_bar_label, 1, 2, 2, 3); table->attach (when_bar_entry, 2, 3, 2, 3); - + table->attach (when_beat_label, 1, 2, 1, 2); table->attach (when_beat_entry, 2, 3, 1, 2); - + Label* when_label = manage (new Label(_("Tempo begins at"), ALIGN_LEFT, ALIGN_CENTER)); table->attach (*when_label, 0, 1, 1, 2); } @@ -157,7 +157,7 @@ TempoDialog::bpm_button_press (GdkEventButton*) bool TempoDialog::bpm_button_release (GdkEventButton*) -{ +{ /* the value has been modified, accept should work now */ set_response_sensitive (RESPONSE_ACCEPT, true); @@ -166,7 +166,7 @@ TempoDialog::bpm_button_release (GdkEventButton*) bool TempoDialog::entry_key_release (GdkEventKey*) -{ +{ if (when_beat_entry.get_text() != "" && when_bar_entry.get_text() != "") { set_response_sensitive (RESPONSE_ACCEPT, true); } else { @@ -175,11 +175,11 @@ TempoDialog::entry_key_release (GdkEventKey*) return false; } -double +double TempoDialog::get_bpm () { return bpm_spinner.get_value (); -} +} bool TempoDialog::get_bbt_time (BBT_Time& requested) @@ -187,7 +187,7 @@ TempoDialog::get_bbt_time (BBT_Time& requested) if (sscanf (when_bar_entry.get_text().c_str(), "%" PRIu32, &requested.bars) != 1) { return false; } - + if (sscanf (when_beat_entry.get_text().c_str(), "%" PRIu32, &requested.beats) != 1) { return false; } @@ -203,7 +203,7 @@ TempoDialog::get_note_type () double note_type = 0; vector<string>::iterator i; string text = note_types.get_active_text(); - + for (i = strings.begin(); i != strings.end(); ++i) { if (text == *i) { if (sscanf (text.c_str(), "%*[^0-9]%lf", ¬e_type) != 1) { @@ -213,8 +213,8 @@ TempoDialog::get_note_type () break; } } - } - + } + if (i == strings.end()) { if (sscanf (text.c_str(), "%lf", ¬e_type) != 1) { error << string_compose(_("incomprehensible note type entry (%1)"), text) << endmsg; @@ -238,7 +238,7 @@ MeterDialog::MeterDialog (TempoMap& map, nframes_t frame, const string & action) cancel_button (_("Cancel")) { BBT_Time when; - frame = map.round_to_bar(frame,0); + frame = map.round_to_bar(frame,0); Meter meter (map.meter_at(frame)); map.bbt_time (frame, when); @@ -267,7 +267,7 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova strings.push_back (_("eighth (8)")); strings.push_back (_("sixteenth (16)")); strings.push_back (_("thirty-second (32)")); - + set_popdown_strings (note_types, strings, true); if (note_type == 1.0f) { @@ -302,7 +302,7 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova snprintf (buf, sizeof (buf), "%" PRIu32, when.bars); when_bar_entry.set_text (buf); when_bar_entry.set_name ("MetricEntry"); - + Label* when_label = manage (new Label(_("Meter begins at bar:"), ALIGN_LEFT, ALIGN_CENTER)); table->attach (*when_label, 0, 1, 2, 3, FILL | EXPAND, FILL | EXPAND); @@ -338,7 +338,7 @@ bool MeterDialog::entry_key_press (GdkEventKey* ev) { - switch (ev->keyval) { + switch (ev->keyval) { case GDK_0: case GDK_1: @@ -403,21 +403,21 @@ double MeterDialog::get_bpb () { double bpb = 0; - + if (sscanf (bpb_entry.get_text().c_str(), "%lf", &bpb) != 1) { return 0; } return bpb; } - + double MeterDialog::get_note_type () { double note_type = 0; vector<string>::iterator i; string text = note_types.get_active_text(); - + for (i = strings.begin(); i != strings.end(); ++i) { if (text == *i) { if (sscanf (text.c_str(), "%*[^0-9]%lf", ¬e_type) != 1) { @@ -427,8 +427,8 @@ MeterDialog::get_note_type () break; } } - } - + } + if (i == strings.end()) { if (sscanf (text.c_str(), "%lf", ¬e_type) != 1) { error << string_compose(_("incomprehensible note type entry (%1)"), text) << endmsg; @@ -446,7 +446,7 @@ MeterDialog::get_bbt_time (BBT_Time& requested) if (sscanf (when_bar_entry.get_text().c_str(), "%" PRIu32, &requested.bars) != 1) { return false; } - + requested.beats = 1; requested.ticks = 0; diff --git a/gtk2_ardour/tempo_dialog.h b/gtk2_ardour/tempo_dialog.h index 5dc56b1e37..c75f60ac23 100644 --- a/gtk2_ardour/tempo_dialog.h +++ b/gtk2_ardour/tempo_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ #include "ardour_dialog.h" -struct TempoDialog : public ArdourDialog +struct TempoDialog : public ArdourDialog { Gtk::ComboBoxText note_types; std::vector<std::string> strings; @@ -48,14 +48,14 @@ struct TempoDialog : public ArdourDialog Gtk::Label when_bar_label; Gtk::Label when_beat_label; char buf[64]; - + TempoDialog (ARDOUR::TempoMap&, nframes_t, const std::string & action); TempoDialog (ARDOUR::TempoSection&, const std::string & action); double get_bpm (); double get_note_type (); bool get_bbt_time (ARDOUR::BBT_Time&); - + private: void init (const ARDOUR::BBT_Time& start, double, double, bool); void bpm_changed (); @@ -65,7 +65,7 @@ private: void note_types_change (); }; -struct MeterDialog : public ArdourDialog +struct MeterDialog : public ArdourDialog { Gtk::Entry bpb_entry; Gtk::ComboBoxText note_types; @@ -74,7 +74,7 @@ struct MeterDialog : public ArdourDialog Gtk::Button cancel_button; Gtk::Entry when_bar_entry; char buf[64]; - + MeterDialog (ARDOUR::TempoMap&, nframes_t, const std::string & action); MeterDialog (ARDOUR::MeterSection&, const std::string & action); diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc index 1400b189fb..e9bd4bbc49 100644 --- a/gtk2_ardour/tempo_lines.cc +++ b/gtk2_ardour/tempo_lines.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2007 Paul Davis + Copyright (C) 2002-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ using namespace std; #define MAX_CACHED_LINES 128 - + TempoLines::TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group, double screen_height) : _canvas(canvas) , _group(group) @@ -82,7 +82,7 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit uint32_t beats = 0; uint32_t bars = 0; uint32_t color; - + const size_t needed = points.size(); _canvas.get_scroll_region (x1, y1, x2, who_cares); @@ -106,7 +106,7 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit const double needed_right = xpos; i = points.begin(); - + xpos = rint(((nframes64_t)(*i).frame) / (double)frames_per_unit); const double needed_left = xpos; @@ -116,7 +116,7 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit Lines::iterator li = left; if (li != _lines.end()) line = li->second; - + // Tempo map hasn't changed and we're entirely within a clean // range, don't need to do anything. Yay. if (needed_left >= _clean_left && needed_right <= _clean_right) { @@ -128,7 +128,7 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit bool inserted_last_time = true; bool invalidated = false; - + for (i = points.begin(); i != points.end(); ++i) { switch ((*i).type) { @@ -144,23 +144,23 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit break; /* only draw beat lines if the gaps between beats are large. */ } } - + xpos = rint(((nframes64_t)(*i).frame) / (double)frames_per_unit); if (inserted_last_time && !_lines.empty()) { li = _lines.lower_bound(xpos); // first line >= xpos } - + line = (li != _lines.end()) ? li->second : NULL; assert(!line || line->property_x1() == li->first); - + Lines::iterator next = li; if (next != _lines.end()) ++next; exhausted = (next == _lines.end()); - - // Hooray, line is perfect + + // Hooray, line is perfect if (line && line->property_x1() == xpos) { if (li != _lines.end()) ++li; @@ -172,7 +172,7 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit } else if (!exhausted) { Lines::iterator steal = _lines.end(); --steal; - + // Steal from the right if (left->first > needed_left && li != steal && steal->first > needed_right) { //cout << "*** STEALING FROM RIGHT" << endl; @@ -240,7 +240,7 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit _lines.insert(make_pair(xpos, line)); inserted_last_time = true; // search next time invalidated = true; - + // Shift clean range right _clean_left = max(_clean_left, steal->first); _clean_right = max(_clean_right, xpos); diff --git a/gtk2_ardour/tempo_lines.h b/gtk2_ardour/tempo_lines.h index 275db7c85e..0991ba7559 100644 --- a/gtk2_ardour/tempo_lines.h +++ b/gtk2_ardour/tempo_lines.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc index 6b574588b6..4bc383e8a3 100644 --- a/gtk2_ardour/theme_manager.cc +++ b/gtk2_ardour/theme_manager.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,13 +57,13 @@ ThemeManager::ThemeManager() Gtkmm2ext::WindowTitle title (Glib::get_application_name ()); title += _("Theme Manager"); set_title (title.get_string ()); - + color_list = ListStore::create (columns); color_display.set_model (color_list); color_display.append_column (_("Object"), columns.name); color_display.append_column (_("Color"), columns.color); - color_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0)); - color_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1)); + color_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0)); + color_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1)); color_display.set_reorderable (false); color_display.get_selection()->set_mode (SELECTION_NONE); color_display.set_headers_visible (true); @@ -71,10 +71,10 @@ ThemeManager::ThemeManager() CellRenderer* color_cell = color_display.get_column_cell_renderer (1); TreeViewColumn* color_column = color_display.get_column (1); color_column->add_attribute (color_cell->property_cell_background_gdk(), columns.gdkcolor); - + scroller.add (color_display); scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC); - + RadioButton::Group group = dark_button.get_group(); light_button.set_group(group); theme_selection_hbox.set_homogeneous(false); @@ -121,7 +121,7 @@ ThemeManager::button_press_event (GdkEventButton* ev) int celly; UIConfigVariable<uint32_t> *ccvar; - + if (!color_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { return false; } @@ -151,7 +151,7 @@ ThemeManager::button_press_event (GdkEventButton* ev) case RESPONSE_CANCEL: break; case RESPONSE_ACCEPT: - color = color_dialog.get_colorsel()->get_current_color(); + color = color_dialog.get_colorsel()->get_current_color(); a = color_dialog.get_colorsel()->get_current_alpha(); r = (int) floor (color.get_red_p() * 255.0); g = (int) floor (color.get_green_p() * 255.0); @@ -198,7 +198,7 @@ load_rc_file (const string& filename, bool themechange) if (!find_file_in_search_path (spath, filename, rc_file_path)) { warning << string_compose( _("Unable to find UI style file %1 in search path %2. Ardour will look strange"), - filename, spath.to_string()) + filename, spath.to_string()) << endmsg; return; } @@ -211,7 +211,7 @@ load_rc_file (const string& filename, bool themechange) /* hmm, this is a problem. the profile doesn't exist when the theme manager is constructed and toggles buttons during "normal" GTK setup. - + a better solution will be to make all Profile methods static or something. @@ -255,7 +255,7 @@ ThemeManager::setup_theme () color_list->clear(); for (std::vector<UIConfigVariable<uint32_t> *>::iterator i = ARDOUR_UI::config()->canvas_colors.begin(); i != ARDOUR_UI::config()->canvas_colors.end(); i++) { - + TreeModel::Row row = *(color_list->append()); Gdk::Color col; diff --git a/gtk2_ardour/theme_manager.h b/gtk2_ardour/theme_manager.h index 3419cf0768..ea617aee77 100644 --- a/gtk2_ardour/theme_manager.h +++ b/gtk2_ardour/theme_manager.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,20 +39,20 @@ class ThemeManager : public ArdourDialog int save (std::string path); void setup_theme (); void reset_canvas_colors(); - + void on_dark_theme_button_toggled (); void on_light_theme_button_toggled (); private: struct ColorDisplayModelColumns : public Gtk::TreeModel::ColumnRecord { - ColorDisplayModelColumns() { + ColorDisplayModelColumns() { add (name); add (color); add (gdkcolor); add (pVar); add (rgba); } - + Gtk::TreeModelColumn<Glib::ustring> name; Gtk::TreeModelColumn<Glib::ustring> color; Gtk::TreeModelColumn<Gdk::Color> gdkcolor; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 921d0424d6..3d747b33d4 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ using namespace std; using namespace Gtk; using namespace Gdk; -using namespace sigc; +using namespace sigc; using namespace ARDOUR; using namespace PBD; using namespace Editing; @@ -74,8 +74,8 @@ uint32_t TimeAxisView::hSmall = 0; bool TimeAxisView::need_size_info = true; int const TimeAxisView::_max_order = 512; -TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/) - : AxisView (sess), +TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/) + : AxisView (sess), controls_table (2, 8), _y_position (0), _editor (ed), @@ -431,7 +431,7 @@ TimeAxisView::name_entry_key_release (GdkEventKey* ev) return true; /* Shift+Tab Keys Pressed. Note that for Shift+Tab, GDK actually - * generates a different ev->keyval, rather than setting + * generates a different ev->keyval, rather than setting * ev->state. */ case GDK_ISO_Left_Tab: @@ -474,7 +474,7 @@ TimeAxisView::name_entry_key_release (GdkEventKey* ev) break; } -#ifdef TIMEOUT_NAME_EDIT +#ifdef TIMEOUT_NAME_EDIT /* adapt the timeout to reflect the user's typing speed */ guint32 name_entry_timeout; @@ -578,7 +578,7 @@ TimeAxisView::popup_display_menu (guint32 when) } conditionally_add_to_selection (); - display_menu->popup (1, when); + display_menu->popup (1, when); } gint @@ -871,7 +871,7 @@ TimeAxisView::get_selection_rect (uint32_t id) rect->rect->signal_event().connect (bind (mem_fun (_editor, &PublicEditor::canvas_selection_rect_event), rect->rect, rect)); rect->start_trim->signal_event().connect (bind (mem_fun (_editor, &PublicEditor::canvas_selection_start_trim_event), rect->rect, rect)); rect->end_trim->signal_event().connect (bind (mem_fun (_editor, &PublicEditor::canvas_selection_end_trim_event), rect->rect, rect)); - } + } rect = free_selection_rects.front(); rect->id = id; @@ -955,11 +955,11 @@ TimeAxisView::touched (double top, double bot) */ double mybot = _y_position + current_height(); - - return ((_y_position <= bot && _y_position >= top) || - ((mybot <= bot) && (top < mybot)) || + + return ((_y_position <= bot && _y_position >= top) || + ((mybot <= bot) && (top < mybot)) || (mybot >= bot && _y_position < top)); -} +} void TimeAxisView::set_parent (TimeAxisView& p) @@ -982,7 +982,7 @@ TimeAxisView::get_parent_with_state () if (parent->has_state()) { return parent; - } + } return parent->get_parent_with_state (); } @@ -1031,7 +1031,7 @@ TimeAxisView::set_state (const XMLNode& node) } else if ((prop = node.property ("height")) != 0) { set_height (atoi (prop->value())); - + } else { set_height (hNormal); @@ -1049,7 +1049,7 @@ TimeAxisView::reset_height() (*i)->set_height ((*i)->height); } } - + void TimeAxisView::compute_controls_size_info () { @@ -1080,7 +1080,7 @@ TimeAxisView::compute_controls_size_info () } one_row_table.attach (*buttons[0], 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); - + one_row_table.show_all (); Gtk::Requisition req(one_row_table.size_request ()); @@ -1100,11 +1100,11 @@ TimeAxisView::compute_controls_size_info () two_row_table.show_all (); req = two_row_table.size_request (); - // height required to show all normal buttons + // height required to show all normal buttons hNormal = /*req.height*/ 48 + extra_height; - // these heights are all just larger than normal. no more + // these heights are all just larger than normal. no more // elements are visible (yet). hLarger = hNormal + 50; @@ -1215,7 +1215,7 @@ TimeAxisView::covers_y_position (double y) l = view()->layers() - 1; } } - + return std::make_pair (this, l); } @@ -1327,7 +1327,7 @@ TimeAxisView::resizer_expose (GdkEventExpose* event) win->get_geometry (x, y, w, h, d); /* handle/line #1 */ - + win->draw_line (dark, 0, 0, w - 2, 0); win->draw_point (dark, 0, 1); win->draw_line (light, 1, 1, w - 1, 1); diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index 0589385762..e32913dbb2 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -180,10 +180,10 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful virtual void reveal_dependent_views (TimeAxisViewItem&) {} /* editing operations */ - + virtual bool cut_copy_clear (Selection&, Editing::CutCopyOp) { return false; } virtual bool paste (nframes_t, float /*times*/, Selection&, size_t /*nth*/) { return false; } - + virtual void set_selected_regionviews (RegionSelection&) {} virtual void set_selected_points (PointSelection&) {} @@ -214,7 +214,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful virtual LayerDisplay layer_display () const { return Overlaid; } virtual StreamView* view () const { return 0; } - + typedef std::vector<boost::shared_ptr<TimeAxisView> > Children; protected: @@ -241,7 +241,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful sigc::connection name_entry_key_timeout; bool name_entry_key_timed_out (); guint32 last_name_entry_key_press_event; - + /* derived classes can override these */ virtual void name_entry_changed (); @@ -249,7 +249,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful virtual bool name_entry_focus_out (GdkEventFocus *ev); /** Handle mouse relaese on our LHS control name ebox. - * + * *@ param ev the event */ virtual bool controls_ebox_button_release (GdkEventButton *ev); @@ -281,7 +281,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful void popup_size_menu(guint32 when); /** Handle the size option of our main menu. - * + * * @param ev the event */ gint size_click(GdkEventButton *ev); @@ -337,7 +337,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful ArdourCanvas::Group* _canvas_display; double _y_position; PublicEditor& _editor; - + private: ArdourCanvas::Group* _canvas_background; @@ -348,7 +348,7 @@ private: ArdourCanvas::Group* _ghost_group; static int const _max_order; - + }; /* class TimeAxisView */ #endif /* __ardour_gtk_time_axis_h__ */ diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index 2236050792..cb114f4f3d 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -74,7 +74,7 @@ double TimeAxisViewItem::NAME_HIGHLIGHT_THRESH; * @param start the start point of this item * @param duration the duration of this item */ -TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color const & base_color, +TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, bool recording, Visibility vis) : trackview (tv), _recregion(recording) @@ -84,7 +84,7 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group& /* first constructed item sets up font info */ NAME_FONT = get_font_for_style (N_("TimeAxisViewItemName")); - + Gtk::Window win; Gtk::Label foo; win.add (foo); @@ -104,7 +104,7 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group& } group = new ArdourCanvas::Group (parent); - + init (it_name, spu, base_color, start, duration, vis); } @@ -123,7 +123,7 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other) /* share the other's parent, but still create a new group */ Gnome::Canvas::Group* parent = other.group->property_parent(); - + group = new ArdourCanvas::Group (*parent); init (other.item_name, other.samples_per_unit, c, other.frame_position, other.item_duration, other.visibility); @@ -179,7 +179,7 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color const & ba } frame->property_outline_what() = outline_what; - + } else { frame = 0; } @@ -200,12 +200,12 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color const & ba name_pixbuf = new ArdourCanvas::Pixbuf(*group); name_pixbuf->property_x() = NAME_X_OFFSET; name_pixbuf->property_y() = trackview.current_height() - 1.0 - NAME_Y_OFFSET; - + } else { name_pixbuf = 0; } - /* create our grab handles used for trimming/duration etc */ + /* create our grab handles used for trimming/duration etc */ frame_handle_start = new ArdourCanvas::SimpleRect (*group, 0.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH, 5.0, trackview.current_height()); frame_handle_start->property_outline_what() = 0x0; @@ -245,7 +245,7 @@ TimeAxisViewItem::set_position(nframes64_t pos, void* src, double* delta) } frame_position = pos; - + /* This sucks. The GnomeCanvas version I am using doesn't correctly implement gnome_canvas_group_set_arg(), so that simply setting the "x" arg of the group @@ -254,7 +254,7 @@ TimeAxisViewItem::set_position(nframes64_t pos, void* src, double* delta) thing. I see that in GNOME CVS, the current (Sept 2001) version of GNOME Canvas rectifies this issue cleanly. */ - + double old_unit_pos ; double new_unit_pos = pos / samples_per_unit ; @@ -263,11 +263,11 @@ TimeAxisViewItem::set_position(nframes64_t pos, void* src, double* delta) if (new_unit_pos != old_unit_pos) { group->move (new_unit_pos - old_unit_pos, 0.0); } - + if (delta) { (*delta) = new_unit_pos - old_unit_pos; } - + PositionChanged (frame_position, src) ; /* EMIT_SIGNAL */ return true; @@ -305,9 +305,9 @@ TimeAxisViewItem::set_duration (nframes64_t dur, void* src) } item_duration = dur; - + reset_width_dependent_items (trackview.editor().frame_to_pixel (dur)); - + DurationChanged (dur, src) ; /* EMIT_SIGNAL */ return true; } @@ -334,7 +334,7 @@ TimeAxisViewItem::set_max_duration(nframes64_t dur, void* src) max_item_duration = dur ; MaxDurationChanged(max_item_duration, src) ; /* EMIT_SIGNAL */ } - + /** * Returns the maxmimum duration that this item may be set to * @@ -358,7 +358,7 @@ TimeAxisViewItem::set_min_duration(nframes64_t dur, void* src) min_item_duration = dur ; MinDurationChanged(max_item_duration, src) ; /* EMIT_SIGNAL */ } - + /** * Returns the minimum duration that this item mey be set to * @@ -408,7 +408,7 @@ TimeAxisViewItem::set_max_duration_active (bool active, void* /*src*/) { max_duration_active = active; } - + /** * Returns whether the Maximum Duration constraint is active and should be enforced * @@ -419,7 +419,7 @@ TimeAxisViewItem::get_max_duration_active() const { return(max_duration_active) ; } - + /** * Sets whether the Minimum Duration constraint is active and should be enforced * @@ -431,7 +431,7 @@ TimeAxisViewItem::set_min_duration_active (bool active, void* /*src*/) { min_duration_active = active ; } - + /** * Returns whether the Maximum Duration constraint is active and should be enforced * @@ -491,7 +491,7 @@ TimeAxisViewItem::set_selected(bool yn) } } -void +void TimeAxisViewItem::set_should_show_selection (bool yn) { if (should_show_selection != yn) { @@ -512,7 +512,7 @@ TimeAxisView& TimeAxisViewItem::get_time_axis_view() { return trackview; -} +} //---------------------------------------------------------------------------------------// // ui methods & data @@ -555,14 +555,14 @@ TimeAxisViewItem::set_name_text(const ustring& new_name) CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size (cr, 10); cairo_text_extents (cr, new_name.c_str(), &te); - + cairo_move_to (cr, 0.5, 0.5 - te.height / 2 - te.y_bearing + NAME_HIGHLIGHT_SIZE / 2); cairo_show_text (cr, new_name.c_str()); - + unsigned char* src = cairo_image_surface_get_data (surface); convert_bgra_to_rgba(src, buf->get_pixels(), pb_width, NAME_HIGHLIGHT_SIZE); - + cairo_destroy(cr); name_pixbuf->property_pixbuf() = buf; } @@ -571,7 +571,7 @@ TimeAxisViewItem::set_name_text(const ustring& new_name) * Set the height of this item * * @param h the new height - */ + */ void TimeAxisViewItem::set_height (double height) { @@ -579,11 +579,11 @@ TimeAxisViewItem::set_height (double height) if (height < NAME_HIGHLIGHT_THRESH) { name_highlight->hide(); name_pixbuf->hide(); - + } else { name_highlight->show(); name_pixbuf->show(); - + } if (height > NAME_HIGHLIGHT_SIZE) { @@ -611,7 +611,7 @@ TimeAxisViewItem::set_height (double height) } /** - * + * */ void TimeAxisViewItem::set_color (Gdk::Color const & base_color) @@ -621,7 +621,7 @@ TimeAxisViewItem::set_color (Gdk::Color const & base_color) } /** - * + * */ ArdourCanvas::Item* TimeAxisViewItem::get_canvas_frame() @@ -630,7 +630,7 @@ TimeAxisViewItem::get_canvas_frame() } /** - * + * */ ArdourCanvas::Group* TimeAxisViewItem::get_canvas_group() @@ -639,7 +639,7 @@ TimeAxisViewItem::get_canvas_group() } /** - * + * */ ArdourCanvas::Item* TimeAxisViewItem::get_name_highlight() @@ -648,7 +648,7 @@ TimeAxisViewItem::get_name_highlight() } /** - * + * */ ArdourCanvas::Pixbuf* TimeAxisViewItem::get_name_pixbuf() @@ -666,7 +666,7 @@ TimeAxisViewItem::compute_colors (Gdk::Color const & base_color) { unsigned char radius ; char minor_shift ; - + unsigned char r,g,b ; /* FILL: this is simple */ @@ -678,7 +678,7 @@ TimeAxisViewItem::compute_colors (Gdk::Color const & base_color) /* for minor colors: if the overall saturation is strong, make the minor colors light. if its weak, make them dark. - + we do this by moving an equal distance to the other side of the central circle in the color wheel from where we started. */ @@ -691,7 +691,7 @@ TimeAxisViewItem::compute_colors (Gdk::Color const & base_color) r = base_color.get_red()/256; g = base_color.get_green()/256; b = base_color.get_blue()/256; - + if (r > b) { if (r > g) @@ -703,7 +703,7 @@ TimeAxisViewItem::compute_colors (Gdk::Color const & base_color) { /* green sector => blue */ swap (g,b); - } + } } else { @@ -722,26 +722,26 @@ TimeAxisViewItem::compute_colors (Gdk::Color const & base_color) r += minor_shift; b += minor_shift; g += minor_shift; - + label_color = RGBA_TO_UINT(r,g,b,255); r = (base_color.get_red()/256) + 127 ; g = (base_color.get_green()/256) + 127 ; b = (base_color.get_blue()/256) + 127 ; - + label_color = RGBA_TO_UINT(r,g,b,255); /* XXX can we do better than this ? */ /* We're trying ;) */ /* NUKECOLORS */ - + //frame_color_r = 192; //frame_color_g = 192; //frame_color_b = 194; - + //selected_frame_color_r = 182; //selected_frame_color_g = 145; //selected_frame_color_b = 168; - + //handle_color_r = 25 ; //handle_color_g = 0 ; //handle_color_b = 255 ; @@ -773,7 +773,7 @@ TimeAxisViewItem::set_frame_color() { if (frame) { uint32_t r,g,b,a; - + if (_selected && should_show_selection) { UINT_TO_RGBA(ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get(), &r, &g, &b, &a); frame->property_fill_color_rgba() = RGBA_TO_UINT(r, g, b, a); @@ -850,7 +850,7 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width) frame_handle_start->hide(); frame_handle_end->hide(); } - + } else { vestigial_frame->hide(); @@ -951,4 +951,4 @@ TimeAxisViewItem::set_y (double y) } - + diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h index c1ae4e4e63..be475c65d6 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ class TimeAxisViewItem : public Selectable { public: virtual ~TimeAxisViewItem() ; - + /** * Set the position of this item upon the timeline to the specified value * @@ -48,14 +48,14 @@ class TimeAxisViewItem : public Selectable * @return true if the position change was a success, false otherwise */ virtual bool set_position(nframes64_t pos, void* src, double* delta = 0) ; - + /** * Return the position of this item upon the timeline * * @return the position of this item */ - nframes64_t get_position() const ; - + nframes64_t get_position() const ; + /** * Sets the duration of this item * @@ -64,13 +64,13 @@ class TimeAxisViewItem : public Selectable * @return true if the duration change was succesful, false otherwise */ virtual bool set_duration(nframes64_t dur, void* src) ; - + /** * Returns the duration of this item * */ nframes64_t get_duration() const ; - + /** * Sets the maximum duration that this item make have. * @@ -78,14 +78,14 @@ class TimeAxisViewItem : public Selectable * @param src the identity of the object that initiated the change */ virtual void set_max_duration(nframes64_t dur, void* src) ; - + /** * Returns the maxmimum duration that this item may be set to * * @return the maximum duration that this item may be set to */ nframes64_t get_max_duration() const ; - + /** * Sets the minimu duration that this item may be set to * @@ -93,14 +93,14 @@ class TimeAxisViewItem : public Selectable * @param src the identity of the object that initiated the change */ virtual void set_min_duration(nframes64_t dur, void* src) ; - + /** * Returns the minimum duration that this item mey be set to * * @return the nimum duration that this item mey be set to */ nframes64_t get_min_duration() const ; - + /** * Sets whether the position of this Item is locked to its current position * Locked items cannot be moved until the item is unlocked again. @@ -109,7 +109,7 @@ class TimeAxisViewItem : public Selectable * @param src the identity of the object that initiated the change */ virtual void set_position_locked(bool yn, void* src) ; - + /** * Returns whether this item is locked to its current position * @@ -117,7 +117,7 @@ class TimeAxisViewItem : public Selectable * false otherwise */ bool get_position_locked() const ; - + /** * Sets whether the Maximum Duration constraint is active and should be enforced * @@ -125,14 +125,14 @@ class TimeAxisViewItem : public Selectable * @param src the identity of the object that initiated the change */ void set_max_duration_active(bool active, void* src) ; - + /** * Returns whether the Maximum Duration constraint is active and should be enforced * * @return true if the maximum duration constraint is active, false otherwise */ bool get_max_duration_active() const ; - + /** * Sets whether the Minimum Duration constraint is active and should be enforced * @@ -140,14 +140,14 @@ class TimeAxisViewItem : public Selectable * @param src the identity of the object that initiated the change */ void set_min_duration_active(bool active, void* src) ; - + /** * Returns whether the Maximum Duration constraint is active and should be enforced * * @return true if the maximum duration constraint is active, false otherwise */ bool get_min_duration_active() const ; - + /** * Set the name/Id of this item. * @@ -155,14 +155,14 @@ class TimeAxisViewItem : public Selectable * @param src the identity of the object that initiated the change */ void set_item_name(std::string new_name, void* src) ; - + /** * Returns the name/id of this item * * @return the name/id of this item */ virtual std::string get_item_name() const ; - + /** * Set to true to indicate that this item is currently selected * @@ -179,20 +179,20 @@ class TimeAxisViewItem : public Selectable void set_sensitive (bool yn) { _sensitive = yn; } bool sensitive () const { return _sensitive; } - + //---------------------------------------------------------------------------------------// // Parent Component Methods - + /** * Returns the TimeAxisView that this item is upon * * @return the timeAxisView that this item is placed upon */ TimeAxisView& get_time_axis_view() ; - + //---------------------------------------------------------------------------------------// // ui methods & data - + /** * Sets the displayed item text * This item is the visual text name displayed on the canvas item, this can be different to the name of the item @@ -200,7 +200,7 @@ class TimeAxisViewItem : public Selectable * @param new_name the new name text to display */ void set_name_text(const Glib::ustring& new_name) ; - + /** * Set the height of this item * @@ -211,27 +211,27 @@ class TimeAxisViewItem : public Selectable void set_y (double); /** - * + * */ void set_color (Gdk::Color const &); - + /** - * + * */ ArdourCanvas::Item* get_canvas_frame() ; /** - * + * */ ArdourCanvas::Group* get_canvas_group(); /** - * + * */ ArdourCanvas::Item* get_name_highlight(); /** - * + * */ ArdourCanvas::Pixbuf* get_name_pixbuf(); @@ -249,7 +249,7 @@ class TimeAxisViewItem : public Selectable * @param spu the new samples per unit value */ virtual void set_samples_per_unit(double spu) ; - + /** * Returns the current samples per unit of this item * @@ -261,7 +261,7 @@ class TimeAxisViewItem : public Selectable virtual void raise_to_top () { return; } virtual void lower () { return; } virtual void lower_to_bottom () { return; } - + /** * returns true if the name area should respond to events. */ @@ -290,7 +290,7 @@ class TimeAxisViewItem : public Selectable * @param src the identity of the object that initiated the change */ virtual void remove_this_item(void* src) ; - + /** * Emitted when this Group has been removed * This is different to the GoingAway signal in that this signal @@ -300,25 +300,25 @@ class TimeAxisViewItem : public Selectable */ sigc::signal<void,std::string,void*> ItemRemoved ; - + /** Emitted when the name/Id of this item is changed */ sigc::signal<void,std::string,std::string,void*> NameChanged ; - + /** Emiited when the position of this item changes */ sigc::signal<void,nframes64_t,void*> PositionChanged ; - + /** Emitted when the position lock of this item is changed */ sigc::signal<void,bool,void*> PositionLockChanged ; - + /** Emitted when the duration of this item changes */ sigc::signal<void,nframes64_t,void*> DurationChanged ; - + /** Emitted when the maximum item duration is changed */ sigc::signal<void,nframes64_t,void*> MaxDurationChanged ; - + /** Emitted when the mionimum item duration is changed */ sigc::signal<void,nframes64_t,void*> MinDurationChanged ; - + enum Visibility { ShowFrame = 0x1, ShowNameHighlight = 0x2, @@ -341,30 +341,30 @@ class TimeAxisViewItem : public Selectable * @param start the start point of this item * @param duration the duration of this item */ - TimeAxisViewItem(const std::string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color const & base_color, + TimeAxisViewItem(const std::string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, bool recording = false, Visibility v = Visibility (0)); TimeAxisViewItem (const TimeAxisViewItem& other); void init (const std::string& it_name, double spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, Visibility vis); - + /** * Calculates some contrasting color for displaying various parts of this item, based upon the base color * * @param color the base color of the item */ virtual void compute_colors (Gdk::Color const & color); - + /** * convenience method to set the various canvas item colors */ virtual void set_colors() ; - + /** * Sets the frame color depending on whether this item is selected */ virtual void set_frame_color() ; - + /** * Sets the colors of the start and end trim handle depending on object state * @@ -383,34 +383,34 @@ class TimeAxisViewItem : public Selectable * @param src the identity of the object that initiated the change */ static gint idle_remove_this_item(TimeAxisViewItem* item, void* src) ; - + /** The time axis that this item is upon */ TimeAxisView& trackview ; - + /** indicates whether this item is locked to its current position */ bool position_locked ; - + /** The posotion of this item on the timeline */ nframes64_t frame_position ; - + /** the duration of this item upon the timeline */ nframes64_t item_duration ; - + /** the maximum duration that we allow this item to take */ nframes64_t max_item_duration ; - + /** the minimu duration that we allow this item to take */ nframes64_t min_item_duration ; - + /** indicates whether this Max Duration constraint is active */ bool max_duration_active ; - + /** indicates whether this Min Duration constraint is active */ bool min_duration_active ; - + /** the curretn samples per canvas unit */ double samples_per_unit ; - + /** indicates if this item is currently selected */ bool selected ; @@ -419,13 +419,13 @@ class TimeAxisViewItem : public Selectable /** should the item respond to events */ bool _sensitive; - + /** * The unique item name of this Item * Each item upon a time axis must have a unique id */ std::string item_name ; - + /** * true if the name should respond to events */ @@ -446,14 +446,14 @@ class TimeAxisViewItem : public Selectable uint32_t selected_frame_color_g ; uint32_t selected_frame_color_b ; uint32_t label_color ; - + uint32_t handle_color_r ; uint32_t handle_color_g ; uint32_t handle_color_b ; uint32_t lock_handle_color_r ; uint32_t lock_handle_color_g ; uint32_t lock_handle_color_b ; - + ArdourCanvas::Group* group; ArdourCanvas::SimpleRect* vestigial_frame; ArdourCanvas::SimpleRect* frame; diff --git a/gtk2_ardour/time_fx_dialog.cc b/gtk2_ardour/time_fx_dialog.cc index b0536a26b6..34fe6e932d 100644 --- a/gtk2_ardour/time_fx_dialog.cc +++ b/gtk2_ardour/time_fx_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2009 Paul Davis + Copyright (C) 2000-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -162,7 +162,7 @@ TimeFXDialog::TimeFXDialog (Editor& e, bool pitch) antialias_button.set_name (N_("TimeFXButton")); table->attach (antialias_button, 1, 3, 1, 2, Gtk::FILL, Gtk::EXPAND, 0, 0); -#endif +#endif add_button (_("Stretch/Shrink"), Gtk::RESPONSE_ACCEPT); @@ -176,7 +176,7 @@ TimeFXDialog::TimeFXDialog (Editor& e, bool pitch) l->set_use_markup (); progress_bar.set_name (N_("TimeFXProgress")); - + progress_box->pack_start (*l, false, false); progress_box->pack_start (progress_bar, false, true); @@ -186,7 +186,7 @@ TimeFXDialog::TimeFXDialog (Editor& e, bool pitch) get_vbox()->pack_start (*vbox, false, false); - + show_all_children (); } diff --git a/gtk2_ardour/time_fx_dialog.h b/gtk2_ardour/time_fx_dialog.h index 0a9952aa3e..aee9d40b16 100644 --- a/gtk2_ardour/time_fx_dialog.h +++ b/gtk2_ardour/time_fx_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2009 Paul Davis + Copyright (C) 2000-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gtk2_ardour/time_selection.cc b/gtk2_ardour/time_selection.cc index f9e45f7f6b..19fc321f78 100644 --- a/gtk2_ardour/time_selection.cc +++ b/gtk2_ardour/time_selection.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003-2004 Paul Davis + Copyright (C) 2003-2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -66,9 +66,9 @@ TimeSelection::consolidate () } return changed; -} +} -nframes_t +nframes_t TimeSelection::start () { if (empty()) { @@ -85,7 +85,7 @@ TimeSelection::start () return first; } -nframes_t +nframes_t TimeSelection::end_frame () { nframes_t last = 0; @@ -105,4 +105,4 @@ TimeSelection::length() { return end_frame() - start() + 1; } - + diff --git a/gtk2_ardour/time_selection.h b/gtk2_ardour/time_selection.h index ba4250ad7f..819a85e809 100644 --- a/gtk2_ardour/time_selection.h +++ b/gtk2_ardour/time_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,17 +30,17 @@ namespace ARDOUR { class TimeAxisView; struct TimeSelection : public std::list<ARDOUR::AudioRange> { - + /* if (track == 0 && group == 0) then it applies to all tracks. - if (track != 0 && group == 0) then it applies just to + if (track != 0 && group == 0) then it applies just to that track. - if (group != 0) then it applies to all tracks in + if (group != 0) then it applies to all tracks in the group. */ - + TimeAxisView* track; ARDOUR::RouteGroup* group; diff --git a/gtk2_ardour/track_selection.h b/gtk2_ardour/track_selection.h index 2a4cc1b288..38032d6de3 100644 --- a/gtk2_ardour/track_selection.h +++ b/gtk2_ardour/track_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ class TrackSelection : public std::list<TimeAxisView*> { public: TrackSelection () {} - + TrackSelection (std::list<TimeAxisView*> const &); std::list<TimeAxisView*> add (std::list<TimeAxisView*> const &); bool contains (TimeAxisView const *) const; diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index f52ad14277..0602b07a0e 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 1999-2006 Paul Davis + Copyright (C) 1999-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -80,7 +80,7 @@ UIConfiguration::load_defaults () string rcfile = default_ui_rc_file.to_string(); cerr << string_compose (_("Loading default ui configuration file %1"), rcfile) << endl; - + if (!tree.read (rcfile.c_str())) { error << string_compose(_("Ardour: cannot read default ui configuration file \"%1\""), rcfile) << endmsg; return -1; @@ -93,14 +93,14 @@ UIConfiguration::load_defaults () } return found; } - + int UIConfiguration::load_state () { bool found = false; - + sys::path default_ui_rc_file; - + if ( find_file_in_search_path (ardour_search_path() + system_config_search_path(), "ardour3_ui_default.conf", default_ui_rc_file) ) { @@ -110,7 +110,7 @@ UIConfiguration::load_state () string rcfile = default_ui_rc_file.to_string(); cerr << string_compose (_("Loading default ui configuration file %1"), rcfile) << endl; - + if (!tree.read (rcfile.c_str())) { error << string_compose(_("Ardour: cannot read default ui configuration file \"%1\""), rcfile) << endmsg; return -1; @@ -129,7 +129,7 @@ UIConfiguration::load_state () { XMLTree tree; found = true; - + string rcfile = user_ui_rc_file.to_string(); cerr << string_compose (_("Loading user ui configuration file %1"), rcfile) << endl; @@ -164,7 +164,7 @@ UIConfiguration::save_state() error << "Could not create user configuration directory" << endmsg; return -1; } - + sys::path rcfile_path(user_config_directory()); rcfile_path /= "ardour3_ui.conf"; @@ -189,14 +189,14 @@ UIConfiguration::get_state () LocaleGuard lg (X_("POSIX")); root = new XMLNode("Ardour"); - + root->add_child_nocopy (get_variables ("UI")); root->add_child_nocopy (get_variables ("Canvas")); - + if (_extra_xml) { root->add_child_copy (*_extra_xml); } - + return *root; } @@ -268,7 +268,7 @@ void UIConfiguration::pack_canvasvars () { #undef CANVAS_VARIABLE -#define CANVAS_VARIABLE(var,name) canvas_colors.push_back(&var); +#define CANVAS_VARIABLE(var,name) canvas_colors.push_back(&var); #include "canvas_vars.h" #undef CANVAS_VARIABLE } diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h index da1ebd3784..4a099fbc8d 100644 --- a/gtk2_ardour/ui_config.h +++ b/gtk2_ardour/ui_config.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ #include <ostream> #include <iostream> -#include "pbd/stateful.h" +#include "pbd/stateful.h" #include "pbd/xml++.h" #include "ardour/configuration_variable.h" diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index a5dcd72438..72b128c02f 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you an redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -99,7 +99,7 @@ fit_to_pixels (const ustring& str, int pixel_width, Pango::FontDescription& font actual_width = width; break; } - + ustr.erase (last--); shorter_by++; @@ -128,7 +128,7 @@ fit_to_pixels (cairo_t* cr, std::string name, double avail) bool abbreviated = false; uint32_t width = 0; - + while (1) { cairo_text_extents_t ext; cairo_text_extents (cr, name.c_str(), &ext); @@ -187,9 +187,9 @@ xpm2rgb (const char** xpm, uint32_t& w, uint32_t& h) uint32_t t, x, y, colors, cpp; unsigned char c; unsigned char *savergb, *rgb; - + // PARSE HEADER - + if ( sscanf(xpm[0], "%u%u%u%u", &w, &h, &colors, &cpp) != 4 ) { error << string_compose (_("bad XPM header %1"), xpm[0]) << endmsg; @@ -197,13 +197,13 @@ xpm2rgb (const char** xpm, uint32_t& w, uint32_t& h) } savergb = rgb = (unsigned char*) malloc (h * w * 3); - + // LOAD XPM COLORMAP LONG ENOUGH TO DO CONVERSION for (t = 0; t < colors; ++t) { sscanf (xpm[t+1], "%c c #%lx", &c, &val); vals[c] = val; } - + // COLORMAP -> RGB CONVERSION // Get low 3 bytes from vals[] // @@ -240,7 +240,7 @@ xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h) } savergb = rgb = (unsigned char*) malloc (h * w * 4); - + // LOAD XPM COLORMAP LONG ENOUGH TO DO CONVERSION if (strstr (xpm[1], "None")) { @@ -255,7 +255,7 @@ xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h) sscanf (xpm[t+1], "%c c #%lx", &c, &val); vals[c] = val; } - + // COLORMAP -> RGB CONVERSION // Get low 3 bytes from vals[] // @@ -311,17 +311,17 @@ get_font_for_style (string widgetname) style = foobar.get_style (); Glib::RefPtr<const Pango::Layout> layout = foobar.get_layout(); - + PangoFontDescription *pfd = (PangoFontDescription *)pango_layout_get_font_description((PangoLayout *)layout->gobj()); - + if (!pfd) { - + /* layout inherited its font description from a PangoContext */ PangoContext* ctxt = (PangoContext*) pango_layout_get_context ((PangoLayout*) layout->gobj()); pfd = pango_context_get_font_description (ctxt); return new Pango::FontDescription (pfd, true); /* make a copy */ - } + } return new Pango::FontDescription (pfd, true); /* make a copy */ } @@ -340,12 +340,12 @@ rgba_from_style (string style, uint32_t r, uint32_t g, uint32_t b, uint32_t a, s } Gtk::Label foo; - + window->add (foo); foo.set_name (style); foo.ensure_style (); - + GtkRcStyle* waverc = foo.get_style()->gobj()->rc_style; if (waverc) { @@ -353,7 +353,7 @@ rgba_from_style (string style, uint32_t r, uint32_t g, uint32_t b, uint32_t a, s r = waverc->fg[state].red / 257; g = waverc->fg[state].green / 257; b = waverc->fg[state].blue / 257; - + /* what a hack ... "a" is for "active" */ if (state == Gtk::STATE_NORMAL && rgba) { a = waverc->fg[GTK_STATE_ACTIVE].red / 257; @@ -377,7 +377,7 @@ rgba_from_style (string style, uint32_t r, uint32_t g, uint32_t b, uint32_t a, s } window->remove (); - + if (state == Gtk::STATE_NORMAL && rgba) { return (uint32_t) RGBA_TO_UINT(r,g,b,a); } else { @@ -491,7 +491,7 @@ gc_from_style (string widget_style_name, int state, string attr) } -bool +bool canvas_item_visible (ArdourCanvas::Item* item) { return (item->gobj()->object.flags & GNOME_CANVAS_ITEM_VISIBLE) ? true : false; @@ -535,8 +535,8 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev) if (focus) { if (GTK_IS_ENTRY(focus) || Keyboard::some_magic_widget_has_focus()) { special_handling_of_unmodified_accelerators = true; - } - } + } + } #ifdef GTKOSX /* should this be universally true? */ @@ -547,7 +547,7 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev) #ifdef DEBUG_ACCELERATOR_HANDLING if (debug) { - cerr << "Win = " << win << " Key event: code = " << ev->keyval << " state = " << hex << ev->state << dec << " special handling ? " + cerr << "Win = " << win << " Key event: code = " << ev->keyval << " state = " << hex << ev->state << dec << " special handling ? " << special_handling_of_unmodified_accelerators << " magic widget focus ? " << Keyboard::some_magic_widget_has_focus() @@ -566,18 +566,18 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev) the focus widget and/or focus chain The problem with this is that if the accelerators include - keys without modifiers, such as the space bar or the + keys without modifiers, such as the space bar or the letter "e", then pressing the key while typing into a text entry widget results in the accelerator being activated, instead of the desired letter appearing in the text entry. There is no good way of fixing this, but this - represents a compromise. The idea is that + represents a compromise. The idea is that key events involving modifiers (not Shift) get routed into the activation pathway first, then get propagated to the focus widget if necessary. - + If the key event doesn't involve modifiers, we deliver to the focus widget first, thus allowing it to get "normal text" without interference @@ -648,9 +648,9 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev) #endif return gtk_window_propagate_key_event (win, ev); } - + /* no modifiers, propagate first */ - + #ifdef DEBUG_ACCELERATOR_HANDLING if (debug) { cerr << "\tpropagate, then activate\n"; @@ -664,15 +664,15 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev) #endif if (allow_activating) { - + #ifdef GTKOSX if (gdk_quartz_possibly_forward ((GdkEvent*) ev)) { return true; } #endif return gtk_window_activate_key (win, ev); - } - + } + } else { #ifdef DEBUG_ACCELERATOR_HANDLING if (debug) { @@ -690,22 +690,22 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev) return true; } -Glib::RefPtr<Gdk::Pixbuf> +Glib::RefPtr<Gdk::Pixbuf> get_xpm (std::string name) { if (!xpm_map[name]) { SearchPath spath(ARDOUR::ardour_search_path()); spath += ARDOUR::system_data_search_path(); - + spath.add_subdirectory_to_paths("pixmaps"); - + sys::path data_file_path; - + if(!find_file_in_search_path (spath, name, data_file_path)) { fatal << string_compose (_("cannot find XPM file for %1"), name) << endmsg; } - + try { xpm_map[name] = Gdk::Pixbuf::create_from_file (data_file_path.to_string()); } catch(const Glib::Error& e) { @@ -736,7 +736,7 @@ get_icon_path (const char* cname) return data_file_path.to_string(); } -Glib::RefPtr<Gdk::Pixbuf> +Glib::RefPtr<Gdk::Pixbuf> get_icon (const char* cname) { Glib::RefPtr<Gdk::Pixbuf> img; @@ -760,22 +760,22 @@ longest (vector<string>& strings) vector<string>::iterator longest = strings.begin(); string::size_type longest_length = (*longest).length(); - + vector<string>::iterator i = longest; ++i; while (i != strings.end()) { - + string::size_type len = (*i).length(); - + if (len > longest_length) { longest = i; longest_length = len; - } - + } + ++i; } - + return *longest; } @@ -819,7 +819,7 @@ key_is_legal_for_numeric_entry (guint keyval) case GDK_Left: case GDK_Right: return true; - + default: break; } @@ -836,7 +836,7 @@ set_pango_fontsize () pango_ft2_font_map_set_resolution ((PangoFT2FontMap*) pango_ft2_font_map_for_display(), val/1024, val/1024); /* Cairo rendering, in case there is any */ - + pango_cairo_font_map_set_resolution ((PangoCairoFontMap*) pango_cairo_font_map_get_default(), val/1024); } @@ -862,35 +862,35 @@ possibly_translate_keyval_to_make_legal_accelerator (uint32_t& keyval) case GDK_ISO_Left_Tab: fakekey = GDK_nabla; break; - + case GDK_Up: fakekey = GDK_uparrow; break; - + case GDK_Down: fakekey = GDK_downarrow; break; - + case GDK_Right: fakekey = GDK_rightarrow; break; - + case GDK_Left: fakekey = GDK_leftarrow; break; - + default: break; } - + if (fakekey != GDK_VoidSymbol) { keyval = fakekey; return true; - } + } return false; } - + inline guint8 convert_color_channel (guint8 src, @@ -907,7 +907,7 @@ convert_bgra_to_rgba (guint8 const* src, { guint8 const* src_pixel = src; guint8* dst_pixel = dst; - + for (int y = 0; y < height; y++) for (int x = 0; x < width; x++) { @@ -918,7 +918,7 @@ convert_bgra_to_rgba (guint8 const* src, dst_pixel[2] = convert_color_channel (src_pixel[0], src_pixel[3]); dst_pixel[3] = src_pixel[3]; - + dst_pixel += 4; src_pixel += 4; } diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h index 0df04cb0f8..dfcd4c8469 100644 --- a/gtk2_ardour/utils.h +++ b/gtk2_ardour/utils.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ namespace Gtk { class Paned; } -static inline double +static inline double gain_to_slider_position (ARDOUR::gain_t g) { if (g == 0) return 0; @@ -45,7 +45,7 @@ gain_to_slider_position (ARDOUR::gain_t g) } -static inline ARDOUR::gain_t +static inline ARDOUR::gain_t slider_position_to_gain (double pos) { /* XXX Marcus writes: this doesn't seem right to me. but i don't have a better answer ... */ diff --git a/gtk2_ardour/visual_time_axis.cc b/gtk2_ardour/visual_time_axis.cc index 2b811e6c58..9574a83c26 100644 --- a/gtk2_ardour/visual_time_axis.cc +++ b/gtk2_ardour/visual_time_axis.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ using namespace ARDOUR; using namespace PBD; using namespace sigc; using namespace Gtk; - + /** * Abstract Constructor for base visual time axis classes * @@ -74,12 +74,12 @@ VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Se { time_axis_name = name ; _color = unique_random_color() ; - + name_entry.signal_activate().connect(mem_fun(*this, &VisualTimeAxis::name_entry_changed)) ; name_entry.signal_button_press_event().connect(mem_fun(*this, &VisualTimeAxis::name_entry_button_press_handler)) ; name_entry.signal_button_release_event().connect(mem_fun(*this, &VisualTimeAxis::name_entry_button_release_handler)) ; name_entry.signal_key_release_event().connect(mem_fun(*this, &VisualTimeAxis::name_entry_key_release_handler)) ; - + size_button.set_name("TrackSizeButton") ; visual_button.set_name("TrackVisualButton") ; hide_button.set_name("TrackRemoveButton") ; @@ -90,7 +90,7 @@ VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Se ARDOUR_UI::instance()->tooltips().set_tip(size_button,_("Display Height")) ; ARDOUR_UI::instance()->tooltips().set_tip(visual_button, _("Visual options")) ; ARDOUR_UI::instance()->tooltips().set_tip(hide_button, _("Hide this track")) ; - + controls_table.attach (hide_button, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); controls_table.attach (visual_button, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); controls_table.attach (size_button, 2, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); @@ -99,7 +99,7 @@ VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Se size_button.unset_flags(Gtk::CAN_FOCUS) ; hide_button.unset_flags(Gtk::CAN_FOCUS) ; visual_button.unset_flags(Gtk::CAN_FOCUS) ; - + set_height (hNormal) ; } @@ -119,13 +119,13 @@ void VisualTimeAxis::set_time_axis_name(const string & name, void* src) { std::string old_name = time_axis_name ; - + if(name != time_axis_name) { time_axis_name = name ; label_view() ; editor.route_name_changed(this) ; - + NameChanged(time_axis_name, old_name, src) ; /* EMIT_SIGNAL */ } } @@ -143,13 +143,13 @@ VisualTimeAxis::name() const /** * Sets the height of this TrackView to one of the defined TrackHeghts * - * @param h + * @param h */ void VisualTimeAxis::set_height(uint32_t h) { TimeAxisView::set_height(h); - + if (h >= hNormal) { hide_name_label (); show_name_entry (); @@ -185,9 +185,9 @@ VisualTimeAxis::hide_click() { // LAME fix for hide_button display refresh hide_button.set_sensitive(false); - + editor.hide_track_in_display (*this); - + hide_button.set_sensitive(true); } @@ -216,7 +216,7 @@ VisualTimeAxis::choose_time_axis_color() Gdk::Color color ; gdouble current[4] ; Gdk::Color current_color ; - + current[0] = _color.get_red() / 65535.0 ; current[1] = _color.get_green() / 65535.0 ; current[2] = _color.get_blue() / 65535.0 ; @@ -224,7 +224,7 @@ VisualTimeAxis::choose_time_axis_color() current_color.set_rgb_p (current[0],current[1],current[2]); color = Gtkmm2ext::UI::instance()->get_color(_("ardour: color selection"),picked, ¤t_color) ; - + if (picked) { set_time_axis_color(color) ; @@ -300,7 +300,7 @@ VisualTimeAxis::idle_remove_this_time_axis(VisualTimeAxis* ta, void* src) //---------------------------------------------------------------------------------------// // Handle TimeAxis rename - + /** * Construct a new prompt to receive a new name for this TimeAxis * @@ -325,7 +325,7 @@ VisualTimeAxis::start_time_axis_rename() ARDOUR_UI::instance()->popup_error (_("A track already exists with that name")); return ; } - + set_time_axis_name(result, this) ; } } @@ -348,13 +348,13 @@ VisualTimeAxis::label_view() //---------------------------------------------------------------------------------------// -// Handle name entry signals +// Handle name entry signals void VisualTimeAxis::name_entry_changed() { string x = name_entry.get_text (); - + if (x == time_axis_name) { return; } @@ -374,7 +374,7 @@ VisualTimeAxis::name_entry_changed() } } -gint +gint VisualTimeAxis::name_entry_button_press_handler(GdkEventButton *ev) { if (ev->button == 3) { @@ -383,7 +383,7 @@ VisualTimeAxis::name_entry_button_press_handler(GdkEventButton *ev) return FALSE; } -gint +gint VisualTimeAxis::name_entry_button_release_handler(GdkEventButton *ev) { return FALSE; @@ -407,7 +407,7 @@ VisualTimeAxis::name_entry_key_release_handler(GdkEventKey* ev) //---------------------------------------------------------------------------------------// // Super class methods not handled by VisualTimeAxis - + void VisualTimeAxis::show_timestretch (nframes_t start, nframes_t end) { diff --git a/gtk2_ardour/visual_time_axis.h b/gtk2_ardour/visual_time_axis.h index bce02c9bae..f728a1f4cf 100644 --- a/gtk2_ardour/visual_time_axis.h +++ b/gtk2_ardour/visual_time_axis.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,37 +47,37 @@ class TimeAxisViewStrip; /** * Base Abstact Class for TimeAxis views that operate purely within the visual domain. - * + * * This class provides many of the common methods required for visual TimeAxis views. The aim is * to provide an abstract layer during the developmnt of the visual based time axis'. Many of these - * methods have a better home further up the class heirarchy, and in fact some are replication of + * methods have a better home further up the class heirarchy, and in fact some are replication of * methods found within RouteUI. This, however, has been required due to various problems with previous * versions of g++, mainly 2.95, which are not correctly handling virtual methods, virtual base classes, * and virtual methods when used with Multiple Inheritance. Perhaps these could be combined once the * compilers all agree on hos do to do stuff... - */ + */ class VisualTimeAxis : public TimeAxisView { public: //---------------------------------------------------------------------------------------// // Constructor / Desctructor - + /** * VisualTimeAxis Destructor * */ virtual ~VisualTimeAxis() ; - + //---------------------------------------------------------------------------------------// // Name/Id Accessors/Mutators - + /** * Returns the name of this TimeAxis * * @return the name of this TimeAxis */ virtual std::string name() const ; - + /** * Sets the name of this TimeAxis * @@ -86,35 +86,35 @@ class VisualTimeAxis : public TimeAxisView */ virtual void set_time_axis_name(const std::string & name, void* src) ; - + //---------------------------------------------------------------------------------------// // ui methods & data - + /** * Sets the height of this TrackView to one of the defined TrackHeghts * * @param h the number of pixels to set the height to */ - virtual void set_height (uint32_t); + virtual void set_height (uint32_t); //---------------------------------------------------------------------------------------// // Selection Methods // selection methods are not handled by visual time axis object yet... - + /** * Not implemented */ virtual void set_selected_regionviews(RegionSelection&) ; - + //---------------------------------------------------------------------------------// // Emitted Signals - + /** * Emitted when we have changed the gui, and what we have shanged */ sigc::signal<void,const std::string &,void*> gui_changed ; - + /** * Emitted when this Visual Time Axis has been removed * This is different to the GoingAway signal in that this signal @@ -123,7 +123,7 @@ class VisualTimeAxis : public TimeAxisView * event */ sigc::signal<void,const std::string &,void*> VisualTimeAxisRemoved ; - + /** * Emitted when we have changed the name of this TimeAxis */ @@ -136,7 +136,7 @@ class VisualTimeAxis : public TimeAxisView //---------------------------------------------------------------------------------------// // Constructor / Desctructor - + /** * Abstract Constructor for base visual time axis classes * @@ -146,18 +146,18 @@ class VisualTimeAxis : public TimeAxisView * @param canvas the parent canvas object */ VisualTimeAxis(const std::string & name, PublicEditor& ed, ARDOUR::Session& sess, ArdourCanvas::Canvas& canvas) ; - - + + //---------------------------------------------------------------------------------------// // Handle time axis removal - + /** * Handles the Removal of this VisualTimeAxis * * @param src the identity of the object that initiated the change */ virtual void remove_this_time_axis(void* src) ; - + /** * Callback used to remove this time axis during the gtk idle loop * This is used to avoid deleting the obejct while inside the remove_this_time_axis @@ -168,64 +168,64 @@ class VisualTimeAxis : public TimeAxisView */ static gint idle_remove_this_time_axis(VisualTimeAxis* ta, void* src) ; - - + + //---------------------------------------------------------------------------------------// // ui methods & data - + /** * Handle the visuals button click * */ void visual_click() ; - + /** * Handle the hide buttons click * */ void hide_click() ; - + /** * Allows the selection of a new color for this TimeAxis * */ virtual void select_track_color() ; - + /** * Provides a color chooser for the selection of a new time axis color. * */ bool choose_time_axis_color() ; - + /** * Sets the color of this TimeAxis to the specified color c * * @param c the new TimeAxis color */ void set_time_axis_color(Gdk::Color c) ; - - + + //---------------------------------------------------------------------------------------// // Handle TimeAxis rename - + /** * Construct a new prompt to receive a new name for this TimeAxis * * @see finish_time_axis_rename() */ void start_time_axis_rename() ; - + /** * Handles the new name for this TimeAxis from the name prompt * * @see start_time_axis_rename() */ virtual void label_view() ; - - + + //---------------------------------------------------------------------------------------// - // Handle name entry signals - + // Handle name entry signals + void name_entry_changed() ; gint name_entry_focus_out_handler(GdkEventFocus*) ; gint name_entry_key_release_handler(GdkEventKey*) ; @@ -241,25 +241,25 @@ class VisualTimeAxis : public TimeAxisView /** the name of this TimeAxis object */ std::string time_axis_name ; - + //---------------------------------------------------------------------------------------// // Super class methods not handled by VisualTimeAxis - + /** * Not handled by purely Visual TimeAxis * * @todo should VisualTimeAxis handle this? */ void show_timestretch (nframes_t start, nframes_t end); - + /** * Not handle by purely visual TimeAxis * @see show_timestratch */ virtual void hide_timestretch() ; - + private: - + }; #endif /* __ardour_visual_time_axis_h__ */ diff --git a/gtk2_ardour/vst_pluginui.cc b/gtk2_ardour/vst_pluginui.cc index 7a80aaf71e..8b7847f0a3 100644 --- a/gtk2_ardour/vst_pluginui.cc +++ b/gtk2_ardour/vst_pluginui.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,7 +48,7 @@ VSTPluginUI::VSTPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr< vst_preset_combo.signal_changed().connect (mem_fun (*this, &VSTPluginUI::preset_chosen)); bypass_button.set_active (!insert->active()); - + pack_start (preset_box, false, false); pack_start (socket, true, true); pack_start (plugin_analysis_expander, true, true); @@ -90,7 +90,7 @@ VSTPluginUI::package (Gtk::Window& win) /* this assumes that the window's owner understands the XEmbed protocol. */ - + socket.add_id (fst_get_XID (vst->fst())); fst_move_window_into_view (vst->fst()); @@ -154,15 +154,15 @@ VSTPluginUI::create_preset_store () if (vst_version >= 2) { fst->plugin->dispatcher (fst->plugin, 29, i, 0, buf, 0.0); } - + row[preset_columns.name] = buf; row[preset_columns.number] = i; } - + if (fst->plugin->numPrograms > 0) { fst->plugin->dispatcher( fst->plugin, effSetProgram, 0, 0, NULL, 0.0 ); } - + vst_preset_combo.set_model (preset_model); CellRenderer* renderer = manage (new CellRendererText()); @@ -181,7 +181,7 @@ static Display *the_gtk_display; static error_handler_t wine_error_handler; static error_handler_t gtk_error_handler; -static int +static int fst_xerror_handler( Display *disp, XErrorEvent *ev ) { if (disp == the_gtk_display) { diff --git a/gtk2_ardour/waveview.cc b/gtk2_ardour/waveview.cc index f9f011ea41..9cc53355be 100644 --- a/gtk2_ardour/waveview.cc +++ b/gtk2_ardour/waveview.cc @@ -139,7 +139,7 @@ Glib::PropertyProxy_ReadOnly<void*> WaveView::property_data_src() const { return Glib::PropertyProxy_ReadOnly<void*> (this, "data_src"); } -Glib::PropertyProxy<uint32_t> WaveView::property_channel() +Glib::PropertyProxy<uint32_t> WaveView::property_channel() { return Glib::PropertyProxy<uint32_t> (this, "channel"); } diff --git a/gtk2_ardour/waveview.h b/gtk2_ardour/waveview.h index 2af3465932..53472f80d3 100644 --- a/gtk2_ardour/waveview.h +++ b/gtk2_ardour/waveview.h @@ -6,7 +6,7 @@ /* waveview.h - * + * * Copyright (C) 1998 EMC Capital Management Inc. * Developed by Havoc Pennington <hp@pobox.com> * @@ -80,7 +80,7 @@ private: protected: explicit WaveView(const Glib::ConstructParams& construct_params); explicit WaveView(GnomeCanvasWaveView* castitem); - + #endif /* DOXYGEN_SHOULD_SKIP_THIS */ public: diff --git a/gtk2_ardour/waveview_p.h b/gtk2_ardour/waveview_p.h index 941e036e5e..5b636a702f 100644 --- a/gtk2_ardour/waveview_p.h +++ b/gtk2_ardour/waveview_p.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index b8e0ad700f..99a6587dcf 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -67,7 +67,7 @@ Amp::configure_io (ChanCount in, ChanCount out) if (out != in) { // always 1:1 return false; } - + return Processor::configure_io (in, out); } @@ -87,30 +87,30 @@ Amp::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, n } if (_apply_gain) { - + if (_apply_gain_automation) { - + gain_t* gab = _session.gain_automation_buffer (); if (mute_gain == 0.0) { - + /* absolute mute */ if (_current_gain == 0.0) { - + /* already silent */ for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) { i->clear (); } } else { - + /* cut to silence */ Amp::apply_gain (bufs, nframes, _current_gain, 0.0); _current_gain = 0.0; } - + } else if (mute_gain != 1.0) { @@ -138,26 +138,26 @@ Amp::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, n _current_gain = gab[nframes-1]; } - - + + } else { /* manual (scalar) gain */ gain_t dg = _gain_control->user_float() * mute_gain; - + if (_current_gain != dg) { - + Amp::apply_gain (bufs, nframes, _current_gain, dg); _current_gain = dg; - + } else if (_current_gain != 1.0f) { - + /* gain has not changed, but its non-unity */ for (BufferSet::midi_iterator i = bufs.midi_begin(); i != bufs.midi_end(); ++i) { MidiBuffer& mb (*i); - + for (MidiBuffer::iterator m = mb.begin(); m != mb.end(); ++m) { Evoral::MIDIEvent<MidiBuffer::TimeType> ev = *m; if (ev.is_note_on()) { @@ -169,7 +169,7 @@ Amp::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, n for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) { apply_gain_to_buffer (i->data(), nframes, _current_gain); } - } + } } } @@ -179,9 +179,9 @@ Amp::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, n void Amp::apply_gain (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target) { - /** Apply a (potentially) declicked gain to the audio buffers of @a bufs + /** Apply a (potentially) declicked gain to the audio buffers of @a bufs */ - + if (nframes == 0 || bufs.count().n_audio() == 0) { return; } @@ -212,7 +212,7 @@ Amp::apply_gain (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t targ MidiBuffer& mb (*i); - + for (MidiBuffer::iterator m = mb.begin(); m != mb.end(); ++m) { Evoral::MIDIEvent<MidiBuffer::TimeType> ev = *m; @@ -228,16 +228,16 @@ Amp::apply_gain (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t targ for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) { Sample* const buffer = i->data(); - + fractional_pos = 1.0; for (nframes_t nx = 0; nx < declick; ++nx) { buffer[nx] *= polscale * (initial + (delta * (0.5 + 0.5 * cos (M_PI * fractional_pos)))); fractional_pos += fractional_shift; } - + /* now ensure the rest of the buffer has the target value applied, if necessary. */ - + if (declick != nframes) { if (target == 0.0) { @@ -256,7 +256,7 @@ Amp::apply_simple_gain (BufferSet& bufs, nframes_t nframes, gain_t target) for (BufferSet::midi_iterator i = bufs.midi_begin(); i != bufs.midi_end(); ++i) { MidiBuffer& mb (*i); - + for (MidiBuffer::iterator m = mb.begin(); m != mb.end(); ++m) { Evoral::MIDIEvent<MidiBuffer::TimeType> ev = *m; if (ev.is_note_on()) { @@ -273,7 +273,7 @@ Amp::apply_simple_gain (BufferSet& bufs, nframes_t nframes, gain_t target) for (BufferSet::midi_iterator i = bufs.midi_begin(); i != bufs.midi_end(); ++i) { MidiBuffer& mb (*i); - + for (MidiBuffer::iterator m = mb.begin(); m != mb.end(); ++m) { Evoral::MIDIEvent<MidiBuffer::TimeType> ev = *m; if (ev.is_note_on()) { @@ -292,7 +292,7 @@ void Amp::inc_gain (gain_t factor, void *src) { float desired_gain = _gain_control->user_float(); - + if (desired_gain == 0.0f) { set_gain (0.000001f + (0.000001f * factor), src); } else { @@ -361,7 +361,7 @@ Amp::GainControl::set_value (float val) val = 1.99526231f; _amp->set_gain (val, this); - + AutomationControl::set_value(val); } diff --git a/libs/ardour/analyser.cc b/libs/ardour/analyser.cc index 9309b4d03b..2e68cfed83 100644 --- a/libs/ardour/analyser.cc +++ b/libs/ardour/analyser.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ list<boost::weak_ptr<Source> > Analyser::analysis_queue; Analyser::Analyser () { - + } Analyser::~Analyser () diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h index 7be324dba1..f0a65c4ef5 100644 --- a/libs/ardour/ardour/amp.h +++ b/libs/ardour/ardour/amp.h @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -43,7 +43,7 @@ public: bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const; bool configure_io (ChanCount in, ChanCount out); - + void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes); bool apply_gain() const { return _apply_gain; } @@ -71,15 +71,15 @@ public: struct GainControl : public AutomationControl { GainControl (std::string name, Session& session, Amp* a, const Evoral::Parameter ¶m, - boost::shared_ptr<AutomationList> al = boost::shared_ptr<AutomationList>() ) - : AutomationControl (session, param, al, name ) + boost::shared_ptr<AutomationList> al = boost::shared_ptr<AutomationList>() ) + : AutomationControl (session, param, al, name) , _amp (a) {} - - void set_value (float val); - float get_value (void) const; - - Amp* _amp; + + void set_value (float val); + float get_value (void) const; + + Amp* _amp; }; boost::shared_ptr<GainControl> gain_control() { @@ -96,7 +96,7 @@ private: bool _apply_gain_automation; float _current_gain; - boost::shared_ptr<GainControl> _gain_control; + boost::shared_ptr<GainControl> _gain_control; boost::shared_ptr<MuteMaster> _mute_master; }; diff --git a/libs/ardour/ardour/analyser.h b/libs/ardour/ardour/analyser.h index 8771cab6b0..15e4220ad6 100644 --- a/libs/ardour/ardour/analyser.h +++ b/libs/ardour/ardour/analyser.h @@ -19,13 +19,13 @@ class Analyser { static void init (); static void queue_source_for_analysis (boost::shared_ptr<Source>, bool force); static void work (); - + private: static Analyser* the_analyser; static Glib::StaticMutex analysis_queue_lock; static Glib::Cond* SourcesToAnalyse; static std::list<boost::weak_ptr<Source> > analysis_queue; - + static void analyse_audio_file_source (boost::shared_ptr<AudioFileSource>); }; diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 4ea020403c..d7c67998c7 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -58,7 +58,7 @@ namespace ARDOUR { microseconds_t get_microseconds (); /* { - JACK has exported this functionality for a long time now + JACK has exported this functionality for a long time now but inlining this causes problems return (microseconds_t) jack_get_time(); } @@ -72,9 +72,9 @@ namespace ARDOUR { extern Change BoundsChanged; struct LocaleGuard { - LocaleGuard (const char*); - ~LocaleGuard (); - const char* old; + LocaleGuard (const char*); + ~LocaleGuard (); + const char* old; }; static const double SHUTTLE_FRACT_SPEED1=0.48412291827; /* derived from A1,A2 */ @@ -85,7 +85,7 @@ namespace ARDOUR { extern MIDI::Port* default_mtc_port; extern MIDI::Port* default_midi_port; extern MIDI::Port *default_midi_clock_port; - + int setup_midi (); } diff --git a/libs/ardour/ardour/audio_buffer.h b/libs/ardour/ardour/audio_buffer.h index be1af03061..65eb38d6db 100644 --- a/libs/ardour/ardour/audio_buffer.h +++ b/libs/ardour/ardour/audio_buffer.h @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -41,7 +41,7 @@ public: } _written = true; } - + /** Read @a len frames @a src starting at @a src_offset into self starting at @ dst_offset*/ void read_from (const Buffer& src, nframes_t len, nframes_t dst_offset = 0, nframes_t src_offset = 0) { assert(&src != this); @@ -63,7 +63,7 @@ public: assert (ab); accumulate_from (*ab, len, dst_offset, src_offset); } - + /** Acumulate (add) @a len frames @a src starting at @a src_offset into self starting at @ dst_offset*/ void accumulate_from (const AudioBuffer& src, nframes_t len, nframes_t dst_offset = 0, nframes_t src_offset = 0) { assert(_capacity > 0); @@ -77,7 +77,7 @@ public: _silent = (src.silent() && _silent); _written = true; } - + /** Acumulate (add) @a len frames @a src starting at @a src_offset into self starting at @ dst_offset * scaling by @a gain_coeff */ void accumulate_with_gain_from (const AudioBuffer& src, nframes_t len, gain_t gain_coeff, nframes_t dst_offset = 0, nframes_t src_offset = 0) { @@ -112,13 +112,13 @@ public: _silent = (_silent && gain_coeff == 0); _written = true; } - + void apply_gain (gain_t gain, nframes_t len) { apply_gain_to_buffer (_data, len, gain); } /** Set the data contained by this buffer manually (for setting directly to jack buffer). - * + * * Constructor MUST have been passed capacity=0 or this will die (to prevent mem leaks). */ void set_data (Sample* data, size_t size) { @@ -131,20 +131,20 @@ public: } /** Reallocate the buffer used internally to handle at least @nframes of data - * + * * Constructor MUST have been passed capacity!=0 or this will die (to prevent mem leaks). */ void resize (size_t nframes); - const Sample* data (nframes_t offset = 0) const { - assert(offset <= _capacity); - return _data + offset; + const Sample* data (nframes_t offset = 0) const { + assert(offset <= _capacity); + return _data + offset; } - Sample* data (nframes_t offset = 0) { - assert(offset <= _capacity); - return _data + offset; + Sample* data (nframes_t offset = 0) { + assert(offset <= _capacity); + return _data + offset; } void prepare () { _written = false; } @@ -154,7 +154,7 @@ public: bool _owns_data; bool _written; Sample* _data; ///< Actual buffer contents - + }; diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index 23744dfc57..a8072695ff 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,8 +31,8 @@ #include "pbd/fastlog.h" #include "pbd/ringbufferNPT.h" -#include "pbd/stateful.h" -#include "pbd/rcu.h" +#include "pbd/stateful.h" +#include "pbd/rcu.h" #include "ardour/ardour.h" #include "ardour/utils.h" @@ -53,7 +53,7 @@ class AudioFileSource; class IO; class AudioDiskstream : public Diskstream -{ +{ public: AudioDiskstream (Session &, const std::string& name, Diskstream::Flag f = Recordable); AudioDiskstream (Session &, const XMLNode&); @@ -67,13 +67,13 @@ class AudioDiskstream : public Diskstream if (n < c->size()) { return (*c)[n]->source ? (*c)[n]->source->name() : ""; } else { - return ""; + return ""; } } - Port *input_source_port (uint32_t n=0) const { + Port *input_source_port (uint32_t n=0) const { boost::shared_ptr<ChannelList> c = channels.reader(); - if (n < c->size()) return (*c)[n]->source; return 0; + if (n < c->size()) return (*c)[n]->source; return 0; } void set_record_enabled (bool yn); @@ -81,7 +81,7 @@ class AudioDiskstream : public Diskstream int set_non_layered (bool yn); bool can_become_destructive (bool& requires_bounce) const; - float peak_power(uint32_t n = 0) { + float peak_power(uint32_t n = 0) { boost::shared_ptr<ChannelList> c = channels.reader(); ChannelInfo* chaninfo = (*c)[n]; float x = chaninfo->peak_power; @@ -92,7 +92,7 @@ class AudioDiskstream : public Diskstream return minus_infinity(); } } - + boost::shared_ptr<AudioPlaylist> audio_playlist () { return boost::dynamic_pointer_cast<AudioPlaylist>(_playlist); } int use_playlist (boost::shared_ptr<Playlist>); @@ -105,7 +105,7 @@ class AudioDiskstream : public Diskstream return (*c)[n]->current_playback_buffer; return 0; } - + Sample *capture_buffer (uint32_t n = 0) { boost::shared_ptr<ChannelList> c = channels.reader(); if (n < c->size()) @@ -122,7 +122,7 @@ class AudioDiskstream : public Diskstream int add_channel (uint32_t how_many); int remove_channel (uint32_t how_many); - + /* stateful */ XMLNode& get_state(void); @@ -145,11 +145,11 @@ class AudioDiskstream : public Diskstream *last-- = tmp; } } - + CubicInterpolation interpolation; XMLNode* deprecated_io_node; - + protected: friend class Session; @@ -181,53 +181,52 @@ class AudioDiskstream : public Diskstream private: struct ChannelInfo { - - ChannelInfo (nframes_t buffer_size, nframes_t speed_buffer_size, nframes_t wrap_buffer_size); - ~ChannelInfo (); - - Sample *playback_wrap_buffer; - Sample *capture_wrap_buffer; - Sample *speed_buffer; - - float peak_power; - - boost::shared_ptr<AudioFileSource> fades_source; - boost::shared_ptr<AudioFileSource> write_source; - - /// the Port that our audio data comes from - Port *source; - Sample *current_capture_buffer; - Sample *current_playback_buffer; - - RingBufferNPT<Sample> *playback_buf; - RingBufferNPT<Sample> *capture_buf; - - Sample* scrub_buffer; - Sample* scrub_forward_buffer; - Sample* scrub_reverse_buffer; - - RingBufferNPT<Sample>::rw_vector playback_vector; - RingBufferNPT<Sample>::rw_vector capture_vector; - - RingBufferNPT<CaptureTransition> * capture_transition_buf; - // the following are used in the butler thread only - nframes_t curr_capture_cnt; + + ChannelInfo (nframes_t buffer_size, nframes_t speed_buffer_size, nframes_t wrap_buffer_size); + ~ChannelInfo (); + + Sample *playback_wrap_buffer; + Sample *capture_wrap_buffer; + Sample *speed_buffer; + + float peak_power; + + boost::shared_ptr<AudioFileSource> fades_source; + boost::shared_ptr<AudioFileSource> write_source; + + /// the Port that our audio data comes from + Port *source; + Sample *current_capture_buffer; + Sample *current_playback_buffer; + + RingBufferNPT<Sample> *playback_buf; + RingBufferNPT<Sample> *capture_buf; + + Sample* scrub_buffer; + Sample* scrub_forward_buffer; + Sample* scrub_reverse_buffer; + + RingBufferNPT<Sample>::rw_vector playback_vector; + RingBufferNPT<Sample>::rw_vector capture_vector; + + RingBufferNPT<CaptureTransition> * capture_transition_buf; + // the following are used in the butler thread only + nframes_t curr_capture_cnt; }; typedef std::vector<ChannelInfo*> ChannelList; void process_varispeed_playback(nframes_t nframes, boost::shared_ptr<ChannelList> c); - + /* The two central butler operations */ int do_flush (RunContext context, bool force = false); int do_refill () { return _do_refill(_mixdown_buffer, _gain_buffer); } - + int do_refill_with_alloc (); int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, - nframes_t& start, nframes_t cnt, - ChannelInfo* channel_info, int channel, bool reversed); - + nframes_t& start, nframes_t cnt, + ChannelInfo* channel_info, int channel, bool reversed); void finish_capture (bool rec_monitors_input, boost::shared_ptr<ChannelList>); void transport_stopped (struct tm&, time_t, bool abort); @@ -237,7 +236,7 @@ class AudioDiskstream : public Diskstream void init_channel (ChannelInfo &chan); void destroy_channel (ChannelInfo &chan); - + int use_new_write_source (uint32_t n=0); int find_and_use_playlist (const std::string &); @@ -264,9 +263,9 @@ class AudioDiskstream : public Diskstream static gain_t* _gain_buffer; std::vector<boost::shared_ptr<AudioFileSource> > capturing_sources; - + SerializedRCUManager<ChannelList> channels; - + /* really */ private: int _do_refill (Sample *mixdown_buffer, float *gain_buffer); diff --git a/libs/ardour/ardour/audio_library.h b/libs/ardour/ardour/audio_library.h index ed18ae9cbf..aada317dbd 100644 --- a/libs/ardour/ardour/audio_library.h +++ b/libs/ardour/ardour/audio_library.h @@ -38,7 +38,7 @@ class AudioLibrary void search_members_and (std::vector<std::string>& results, const std::vector<std::string> tags); void save_changes(); - + private: std::string src; }; diff --git a/libs/ardour/ardour/audio_playlist_importer.h b/libs/ardour/ardour/audio_playlist_importer.h index 5ae87cea01..5ab8ae9b26 100644 --- a/libs/ardour/ardour/audio_playlist_importer.h +++ b/libs/ardour/ardour/audio_playlist_importer.h @@ -49,12 +49,12 @@ class AudioPlaylistImportHandler : public ElementImportHandler AudioPlaylistImportHandler (XMLTree const & source, Session & session, AudioRegionImportHandler & region_handler, const char * nodename = "Playlists"); virtual ~AudioPlaylistImportHandler () {} virtual std::string get_info () const; - + void get_regions (XMLNode const & node, ElementList & list) const; void update_region_id (XMLProperty* id_prop); void playlists_by_diskstream (PBD::ID const & id, PlaylistList & list) const; - + protected: AudioRegionImportHandler & region_handler; }; @@ -75,7 +75,7 @@ class AudioPlaylistImporter : public ElementImporter ~AudioPlaylistImporter (); std::string get_info () const; - + void set_diskstream (PBD::ID const & id); PBD::ID const & orig_diskstream () const { return orig_diskstream_id; } diff --git a/libs/ardour/ardour/audio_port.h b/libs/ardour/ardour/audio_port.h index 09bd8bdd1e..0c08795819 100644 --- a/libs/ardour/ardour/audio_port.h +++ b/libs/ardour/ardour/audio_port.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Paul Davis + Copyright (C) 2002-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,37 +26,37 @@ namespace ARDOUR { -class AudioPort : public Port +class AudioPort : public Port { public: ~AudioPort (); - + DataType type () const { return DataType::AUDIO; } - + void cycle_start (nframes_t); void cycle_end (nframes_t); void cycle_split (); - + size_t raw_buffer_size(jack_nframes_t nframes) const; Buffer& get_buffer (nframes_t nframes, nframes_t offset = 0) { return get_audio_buffer (nframes, offset); } - + AudioBuffer& get_audio_buffer (nframes_t nframes, nframes_t offset = 0); protected: friend class AudioEngine; AudioPort (std::string const &, Flags); - + private: AudioBuffer* _buffer; }; - + } // namespace ARDOUR #endif /* __ardour_audio_port_h__ */ diff --git a/libs/ardour/ardour/audio_region_importer.h b/libs/ardour/ardour/audio_region_importer.h index 71e8718ce8..d6d5c192d9 100644 --- a/libs/ardour/ardour/audio_region_importer.h +++ b/libs/ardour/ardour/audio_region_importer.h @@ -44,9 +44,9 @@ class AudioRegionImportHandler : public ElementImportHandler // Inerface implementation AudioRegionImportHandler (XMLTree const & source, Session & session); std::string get_info () const; - + void create_regions_from_children (XMLNode const & node, ElementList & list); - + // Source management bool check_source (std::string const & filename) const; void add_source (std::string const & filename, boost::shared_ptr<Source> const & source); @@ -77,7 +77,7 @@ class AudioRegionImporter : public ElementImporter // Interface implementation std::string get_info () const; Session::ImportStatus * get_import_status () { return &status; } - + // other stuff void add_sources_to_session (); XMLNode const & get_xml (); @@ -95,11 +95,11 @@ class AudioRegionImporter : public ElementImporter PBD::ID id; std::list<std::string> filenames; Session::ImportStatus status; - + bool parse_xml_region (); bool parse_source_xml (); PBD::sys::path get_sound_dir (XMLTree const & tree); - + void prepare_region (); void prepare_sources (); std::vector<boost::shared_ptr<Region> > region; diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index 5813c2d697..bdbc4b8165 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2006 Paul Davis + Copyright (C) 2002-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,17 +36,17 @@ class AudioTrack : public Track AudioTrack (Session&, const XMLNode&); ~AudioTrack (); - int set_mode (TrackMode m); + int set_mode (TrackMode m); bool can_use_mode (TrackMode m, bool& bounce_required); - int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, - int declick, bool can_record, bool rec_monitors_input); + int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + int declick, bool can_record, bool rec_monitors_input); boost::shared_ptr<AudioDiskstream> audio_diskstream() const; int use_diskstream (std::string name); int use_diskstream (const PBD::ID& id); - + int export_stuff (BufferSet& bufs, sframes_t start_frame, nframes_t nframes, bool enable_processing = true); void freeze (InterThreadInfo&); @@ -59,7 +59,7 @@ class AudioTrack : public Track protected: XMLNode& state (bool full); - + int _set_state (const XMLNode&, bool call_base); private: diff --git a/libs/ardour/ardour/audio_track_importer.h b/libs/ardour/ardour/audio_track_importer.h index 59b5b520ac..683417de24 100644 --- a/libs/ardour/ardour/audio_track_importer.h +++ b/libs/ardour/ardour/audio_track_importer.h @@ -70,18 +70,18 @@ class AudioTrackImporter : public ElementImporter bool parse_route_xml (); bool parse_io (); - + bool parse_processor (XMLNode & node); bool parse_controllable (XMLNode & node); bool parse_automation (XMLNode & node); bool rate_convert_events (XMLNode & node); - + AudioTrackImportHandler & track_handler; XMLNode xml_track; - + PBD::ID old_ds_id; PBD::ID new_ds_id; - + PlaylistList playlists; AudioPlaylistImportHandler & pl_handler; }; diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index 83d85ec5d0..a1f22a88df 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis Written by Taybin Rutkin This program is free software; you can redistribute it and/or modify @@ -64,7 +64,7 @@ class AUPlugin : public ARDOUR::Plugin AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> comp); AUPlugin (const AUPlugin& other); virtual ~AUPlugin (); - + std::string unique_id () const; const char * label () const; const char * name () const { return _info->name.c_str(); } @@ -74,34 +74,34 @@ class AUPlugin : public ARDOUR::Plugin nframes_t latency () const; void set_parameter (uint32_t which, float val); float get_parameter (uint32_t which) const; - + int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; uint32_t nth_parameter (uint32_t which, bool& ok) const; void activate (); void deactivate (); void set_block_size (nframes_t nframes); - + int connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset); std::set<uint32_t> automatable() const; string describe_parameter (uint32_t); string state_node_name () const { return "audiounit"; } void print_parameter (uint32_t, char*, uint32_t len) const; - + bool parameter_is_audio (uint32_t) const; bool parameter_is_control (uint32_t) const; bool parameter_is_input (uint32_t) const; bool parameter_is_output (uint32_t) const; - + XMLNode& get_state(); int set_state(const XMLNode& node); - + bool save_preset (string name); bool load_preset (const string preset_label); std::vector<std::string> get_presets (); std::string current_preset() const; bool has_editor () const; - + int32_t can_do (int32_t in, int32_t& out); uint32_t output_streams() const; uint32_t input_streams() const; @@ -109,17 +109,17 @@ class AUPlugin : public ARDOUR::Plugin boost::shared_ptr<CAAudioUnit> get_au () { return unit; } boost::shared_ptr<CAComponent> get_comp () const { return comp; } - - OSStatus render_callback(AudioUnitRenderActionFlags *ioActionFlags, - const AudioTimeStamp *inTimeStamp, - UInt32 inBusNumber, - UInt32 inNumberFrames, - AudioBufferList* ioData); + + OSStatus render_callback(AudioUnitRenderActionFlags *ioActionFlags, + const AudioTimeStamp *inTimeStamp, + UInt32 inBusNumber, + UInt32 inNumberFrames, + AudioBufferList* ioData); private: - boost::shared_ptr<CAComponent> comp; - boost::shared_ptr<CAAudioUnit> unit; - - bool initialized; + boost::shared_ptr<CAComponent> comp; + boost::shared_ptr<CAAudioUnit> unit; + + bool initialized; int32_t input_channels; int32_t output_channels; std::vector<std::pair<int,int> > io_configs; @@ -133,7 +133,7 @@ class AUPlugin : public ARDOUR::Plugin UInt32 global_elements; UInt32 output_elements; UInt32 input_elements; - + int set_output_format (AudioStreamBasicDescription&); int set_input_format (AudioStreamBasicDescription&); int set_stream_format (int scope, uint32_t cnt, AudioStreamBasicDescription&); @@ -142,24 +142,24 @@ class AUPlugin : public ARDOUR::Plugin std::vector<std::pair<uint32_t, uint32_t> > parameter_map; uint32_t current_maxbuf; - nframes_t current_offset; - nframes_t cb_offset; - vector<Sample*>* current_buffers; - nframes_t frames_processed; - + nframes_t current_offset; + nframes_t cb_offset; + vector<Sample*>* current_buffers; + nframes_t frames_processed; + std::vector<AUParameterDescriptor> descriptors; void init (); }; - + typedef boost::shared_ptr<AUPlugin> AUPluginPtr; -struct AUPluginCachedInfo { +struct AUPluginCachedInfo { std::vector<std::pair<int,int> > io_configs; }; class AUPluginInfo : public PluginInfo { - public: - AUPluginInfo (boost::shared_ptr<CAComponentDescription>); + public: + AUPluginInfo (boost::shared_ptr<CAComponentDescription>); ~AUPluginInfo (); PluginPtr load (Session& session); @@ -175,7 +175,7 @@ class AUPluginInfo : public PluginInfo { private: boost::shared_ptr<CAComponentDescription> descriptor; UInt32 version; - + static void discover_music (PluginInfoList&); static void discover_fx (PluginInfoList&); static void discover_generators (PluginInfoList&); @@ -184,7 +184,7 @@ class AUPluginInfo : public PluginInfo { typedef std::map<std::string,AUPluginCachedInfo> CachedInfoMap; static CachedInfoMap cached_info; - + static bool cached_io_configuration (const std::string&, UInt32, CAComponent&, AUPluginCachedInfo&, const std::string& name); static void add_cached_info (const std::string&, AUPluginCachedInfo&); static void save_cached_info (); diff --git a/libs/ardour/ardour/audioanalyser.h b/libs/ardour/ardour/audioanalyser.h index 824e63d312..627dc3f137 100644 --- a/libs/ardour/ardour/audioanalyser.h +++ b/libs/ardour/ardour/audioanalyser.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ class AudioAnalyser : public boost::noncopyable { AudioAnalyser (float sample_rate, AnalysisPluginKey key); virtual ~AudioAnalyser(); - + /* analysis object should provide a run method that accepts a path to write the results to (optionally empty) a Readable* to read data from @@ -58,7 +58,7 @@ class AudioAnalyser : public boost::noncopyable { nframes64_t bufsize; nframes64_t stepsize; - + int initialize_plugin (AnalysisPluginKey name, float sample_rate); int analyse (const std::string& path, Readable*, uint32_t channel); diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index f0bd7cdb3d..9d3bfdb719 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2004 Paul Davis + Copyright (C) 2002-2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ class AudioEngine : public sigc::trackable AudioEngine (std::string client_name); virtual ~AudioEngine (); - + jack_client_t* jack() const; bool connected() const { return _jack != 0; } @@ -94,12 +94,12 @@ class AudioEngine : public sigc::trackable if (!_running || !_jack) return 0; return jack_get_current_transport_frame (_jack); } - + int request_buffer_size (nframes_t); - + nframes_t set_monitor_check_interval (nframes_t); - float get_cpu_load() { + float get_cpu_load() { if (!_running || !_jack) return 0; return jack_cpu_load (_jack); } @@ -108,18 +108,18 @@ class AudioEngine : public sigc::trackable void remove_session (); class PortRegistrationFailure : public std::exception { - public: + public: PortRegistrationFailure (const char* why = "") { reason = why; } virtual const char *what() const throw() { return reason; } - private: + private: const char* reason; }; class NoBackendAvailable : public std::exception { - public: + public: virtual const char *what() const throw() { return "could not connect to engine backend"; } }; @@ -128,11 +128,11 @@ class AudioEngine : public sigc::trackable int unregister_port (Port &); void split_cycle (nframes_t offset); - + int connect (const std::string& source, const std::string& destination); int disconnect (const std::string& source, const std::string& destination); int disconnect (Port &); - + const char ** get_ports (const std::string& port_name_pattern, const std::string& type_name_pattern, uint32_t flags); bool can_request_hardware_monitoring (); @@ -204,7 +204,7 @@ class AudioEngine : public sigc::trackable sigc::signal<void> Stopped; /* this signal is emitted if a JACK port is registered or unregistered */ - + sigc::signal<void> PortRegisteredOrUnregistered; std::string make_port_name_relative (std::string); diff --git a/libs/ardour/ardour/audiofile_tagger.h b/libs/ardour/ardour/audiofile_tagger.h index 9da84df561..0519e2233c 100644 --- a/libs/ardour/ardour/audiofile_tagger.h +++ b/libs/ardour/ardour/audiofile_tagger.h @@ -38,7 +38,7 @@ class AudiofileTagger public: /* Tags file with metadata, return true on success */ - + static bool tag_file (std::string const & filename, SessionMetadata const & metadata); private: diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index b161bcada1..4da7943a2d 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ -#ifndef __ardour_audiofilesource_h__ +#ifndef __ardour_audiofilesource_h__ #define __ardour_audiofilesource_h__ #include <exception> @@ -42,10 +42,10 @@ public: bool set_name (const std::string& newname) { return (set_source_name(newname, destructive()) == 0); } - + Glib::ustring peak_path (Glib::ustring audio_path); Glib::ustring find_broken_peakfile (Glib::ustring missing_peak_path, - Glib::ustring audio_path); + Glib::ustring audio_path); static void set_peak_dir (Glib::ustring dir) { peak_dir = dir; } @@ -75,12 +75,12 @@ public: int set_state (const XMLNode&); bool can_truncate_peaks() const { return !destructive(); } - bool can_be_analysed() const { return _length > 0; } - + bool can_be_analysed() const { return _length > 0; } + static bool safe_audio_file_extension (const Glib::ustring& path); - + static bool is_empty (Session&, Glib::ustring path); - + static void set_bwf_serial_number (int); static void set_header_position_offset (nframes_t offset ); @@ -92,16 +92,16 @@ protected: /** Constructor to be called for new in-session files */ AudioFileSource (Session&, const Glib::ustring& path, bool embedded, Source::Flag flags, - SampleFormat samp_format, HeaderFormat hdr_format); + SampleFormat samp_format, HeaderFormat hdr_format); /** Constructor to be called for existing in-session files */ AudioFileSource (Session&, const XMLNode&, bool must_exist = true); int init (const Glib::ustring& idstr, bool must_exist); - + virtual void set_header_timeline_position () = 0; virtual void handle_header_position_change () {} - + int move_dependents_to_trash(); static Sample* get_interleave_buffer (nframes_t size); diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h index 1d4118cf83..32fc77f2d6 100644 --- a/libs/ardour/ardour/audioplaylist.h +++ b/libs/ardour/ardour/audioplaylist.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ class AudioPlaylist : public ARDOUR::Playlist { public: typedef std::list<boost::shared_ptr<Crossfade> > Crossfades; - + public: AudioPlaylist (Session&, const XMLNode&, bool hidden = false); AudioPlaylist (Session&, std::string name, bool hidden = false); @@ -52,7 +52,7 @@ class AudioPlaylist : public ARDOUR::Playlist int set_state (const XMLNode&); - sigc::signal<void,boost::shared_ptr<Crossfade> > NewCrossfade; + sigc::signal<void,boost::shared_ptr<Crossfade> > NewCrossfade; void foreach_crossfade (sigc::slot<void, boost::shared_ptr<Crossfade> >); void crossfades_at (nframes_t frame, Crossfades&); @@ -66,7 +66,7 @@ class AudioPlaylist : public ARDOUR::Playlist void flush_notifications (); void finalize_split_region (boost::shared_ptr<Region> orig, boost::shared_ptr<Region> left, boost::shared_ptr<Region> right); - + void refresh_dependents (boost::shared_ptr<Region> region); void check_dependents (boost::shared_ptr<Region> region, bool norefresh); void remove_dependents (boost::shared_ptr<Region> region); diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index cda9cab878..ff718bb4b0 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -65,7 +65,7 @@ class AudioRegion : public Region void set_scale_amplitude (gain_t); gain_t scale_amplitude() const { return _scale_amplitude; } - + void normalize_to (float target_in_dB = 0.0f); bool envelope_active () const { return _flags & Region::EnvelopeActive; } @@ -77,9 +77,9 @@ class AudioRegion : public Region boost::shared_ptr<AutomationList> envelope() { return _envelope; } virtual nframes_t read_peaks (PeakData *buf, nframes_t npeaks, - nframes_t offset, nframes_t cnt, - uint32_t chan_n=0, double samples_per_unit= 1.0) const; - + nframes_t offset, nframes_t cnt, + uint32_t chan_n=0, double samples_per_unit= 1.0) const; + /* Readable interface */ enum ReadOps { @@ -89,7 +89,7 @@ class AudioRegion : public Region ReadOpsCount = 0x4, ReadOpsFades = 0x8 }; - + virtual nframes_t read (Sample*, sframes_t pos, nframes_t cnt, int channel) const; virtual nframes_t read_with_ops (Sample*, sframes_t pos, nframes_t cnt, int channel, ReadOps rops) const; virtual nframes64_t readable_length() const { return length(); } @@ -100,10 +100,10 @@ class AudioRegion : public Region uint32_t chan_n = 0, nframes_t read_frames = 0, nframes_t skip_frames = 0) const; - + virtual nframes_t master_read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf, sframes_t position, nframes_t cnt, uint32_t chan_n=0) const; - + virtual nframes_t read_raw_internal (Sample*, sframes_t, nframes_t, int channel) const; XMLNode& state (bool); @@ -135,9 +135,9 @@ class AudioRegion : public Region void set_default_envelope (); int separate_by_channel (ARDOUR::Session&, std::vector<boost::shared_ptr<Region> >&) const; - + /* automation */ - + boost::shared_ptr<Evoral::Control> control(const Evoral::Parameter& id, bool create=false) { return _automatable.data().control(id, create); @@ -185,12 +185,12 @@ class AudioRegion : public Region void recompute_gain_at_start (); nframes_t _read_at (const SourceList&, nframes_t limit, - Sample *buf, Sample *mixdown_buffer, float *gain_buffer, - sframes_t position, nframes_t cnt, - uint32_t chan_n = 0, - nframes_t read_frames = 0, - nframes_t skip_frames = 0, - ReadOps readops = ReadOps (~0)) const; + Sample *buf, Sample *mixdown_buffer, float *gain_buffer, + sframes_t position, nframes_t cnt, + uint32_t chan_n = 0, + nframes_t read_frames = 0, + nframes_t skip_frames = 0, + ReadOps readops = ReadOps (~0)) const; void recompute_at_start (); void recompute_at_end (); @@ -217,7 +217,7 @@ class AudioRegion : public Region protected: /* default constructor for derived (compound) types */ - AudioRegion (Session& s, nframes_t, nframes_t, std::string name); + AudioRegion (Session& s, nframes_t, nframes_t, std::string name); int set_live_state (const XMLNode&, Change&, bool send); }; diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index d097025e52..bc06642c33 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ #include "ardour/source.h" #include "ardour/ardour.h" -#include "pbd/stateful.h" +#include "pbd/stateful.h" #include "pbd/xml++.h" namespace ARDOUR { @@ -48,7 +48,7 @@ class AudioSource : virtual public Source, nframes64_t readable_length() const { return _length; } uint32_t n_channels() const { return 1; } - + sframes_t length (sframes_t pos) const; void update_length (sframes_t pos, sframes_t cnt); @@ -69,15 +69,15 @@ class AudioSource : virtual public Source, uint32_t read_data_count() const { return _read_data_count; } uint32_t write_data_count() const { return _write_data_count; } - int read_peaks (PeakData *peaks, nframes_t npeaks, + int read_peaks (PeakData *peaks, nframes_t npeaks, sframes_t start, nframes_t cnt, double samples_per_visual_peak) const; - int build_peaks (); + int build_peaks (); bool peaks_ready (sigc::slot<void>, sigc::connection&) const; mutable sigc::signal<void> PeaksReady; mutable sigc::signal<void,nframes_t,nframes_t> PeakRangeReady; - + XMLNode& get_state (); int set_state (const XMLNode&); @@ -117,7 +117,7 @@ class AudioSource : virtual public Source, int initialize_peakfile (bool newfile, Glib::ustring path); int build_peaks_from_scratch (); int compute_and_write_peaks (Sample* buf, sframes_t first_frame, nframes_t cnt, - bool force, bool intermediate_peaks_ready_signal); + bool force, bool intermediate_peaks_ready_signal); void truncate_peakfile(); mutable off_t _peak_byte_max; // modified in compute_and_write_peak() @@ -127,13 +127,13 @@ class AudioSource : virtual public Source, virtual Glib::ustring peak_path(Glib::ustring audio_path) = 0; virtual Glib::ustring find_broken_peakfile (Glib::ustring missing_peak_path, Glib::ustring audio_path) = 0; - - virtual int read_peaks_with_fpp (PeakData *peaks, - nframes_t npeaks, sframes_t start, nframes_t cnt, - double samples_per_visual_peak, nframes_t fpp) const; + + virtual int read_peaks_with_fpp (PeakData *peaks, + nframes_t npeaks, sframes_t start, nframes_t cnt, + double samples_per_visual_peak, nframes_t fpp) const; int compute_and_write_peaks (Sample* buf, sframes_t first_frame, nframes_t cnt, - bool force, bool intermediate_peaks_ready_signal, nframes_t frames_per_peak); + bool force, bool intermediate_peaks_ready_signal, nframes_t frames_per_peak); private: int peakfile; diff --git a/libs/ardour/ardour/auditioner.h b/libs/ardour/ardour/auditioner.h index 6114da0552..aa525b68c9 100644 --- a/libs/ardour/ardour/auditioner.h +++ b/libs/ardour/ardour/auditioner.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ class Auditioner : public AudioTrack int play_audition (nframes_t nframes); - void cancel_audition () { + void cancel_audition () { g_atomic_int_set (&_active, 0); } @@ -63,7 +63,7 @@ class Auditioner : public AudioTrack static void *_drop_ports (void *); void actually_drop_ports (); void output_changed (IOChange, void*); -}; +}; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/auto_bundle.h b/libs/ardour/ardour/auto_bundle.h index e3899069de..b41a5d344f 100644 --- a/libs/ardour/ardour/auto_bundle.h +++ b/libs/ardour/ardour/auto_bundle.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,6 +41,6 @@ class AutoBundle : public Bundle { private: }; -} - +} + #endif /* __ardour_auto_bundle_h__ */ diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h index 7fac339f77..90250abf52 100644 --- a/libs/ardour/ardour/automatable.h +++ b/libs/ardour/ardour/automatable.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,20 +51,20 @@ public: boost::shared_ptr<AutomationControl> automation_control (const Evoral::Parameter& id, bool create_if_missing=false); - + boost::shared_ptr<const AutomationControl> automation_control (const Evoral::Parameter& id) const; virtual void add_control(boost::shared_ptr<Evoral::Control>); - + virtual void automation_snapshot(nframes_t now, bool force); virtual void transport_stopped (sframes_t now); virtual std::string describe_parameter(Evoral::Parameter param); - + AutoState get_parameter_automation_state (Evoral::Parameter param, bool lock = true); virtual void set_parameter_automation_state (Evoral::Parameter param, AutoState); - + AutoStyle get_parameter_automation_style (Evoral::Parameter param); void set_parameter_automation_style (Evoral::Parameter param, AutoStyle); @@ -74,22 +74,22 @@ public: const std::set<Evoral::Parameter>& what_can_be_automated() const { return _can_automate_list; } void mark_automation_visible(Evoral::Parameter, bool); - + inline bool should_snapshot (nframes_t now) { return (_last_automation_snapshot > now || (now - _last_automation_snapshot) > _automation_interval); } - + static void set_automation_interval (jack_nframes_t frames) { _automation_interval = frames; } - static jack_nframes_t automation_interval() { + static jack_nframes_t automation_interval() { return _automation_interval; } - + typedef Evoral::ControlSet::Controls Controls; - + Evoral::ControlSet& data() { return *this; } const Evoral::ControlSet& data() const { return *this; } @@ -102,13 +102,13 @@ public: void can_automate(Evoral::Parameter); virtual void auto_state_changed (Evoral::Parameter /*which*/) {} - + int load_automation (const std::string& path); int old_set_automation_state(const XMLNode&); std::set<Evoral::Parameter> _visible_controls; std::set<Evoral::Parameter> _can_automate_list; - + nframes_t _last_automation_snapshot; static nframes_t _automation_interval; }; diff --git a/libs/ardour/ardour/automatable_controls.h b/libs/ardour/ardour/automatable_controls.h index 38df144694..9dd0988cf7 100644 --- a/libs/ardour/ardour/automatable_controls.h +++ b/libs/ardour/ardour/automatable_controls.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/automatable_sequence.h b/libs/ardour/ardour/automatable_sequence.h index 23ebb161c8..88e1733c1b 100644 --- a/libs/ardour/ardour/automatable_sequence.h +++ b/libs/ardour/ardour/automatable_sequence.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/automation_control.h b/libs/ardour/ardour/automation_control.h index f9b21b932c..15bac5fef8 100644 --- a/libs/ardour/ardour/automation_control.h +++ b/libs/ardour/ardour/automation_control.h @@ -38,10 +38,10 @@ class AutomationControl : public PBD::Controllable, public Evoral::Control { public: AutomationControl(ARDOUR::Session&, - const Evoral::Parameter& parameter, - boost::shared_ptr<ARDOUR::AutomationList> l=boost::shared_ptr<ARDOUR::AutomationList>(), - const std::string& name=""); - + const Evoral::Parameter& parameter, + boost::shared_ptr<ARDOUR::AutomationList> l=boost::shared_ptr<ARDOUR::AutomationList>(), + const std::string& name=""); + boost::shared_ptr<AutomationList> alist() const { return boost::dynamic_pointer_cast<AutomationList>(_list); } @@ -51,24 +51,24 @@ public: inline bool automation_playback() const { return ((ARDOUR::AutomationList*)_list.get())->automation_playback(); } - + inline bool automation_write() const { return ((ARDOUR::AutomationList*)_list.get())->automation_write(); } - + inline AutoState automation_state() const { return ((ARDOUR::AutomationList*)_list.get())->automation_state(); } - + inline void set_automation_state(AutoState as) { return ((ARDOUR::AutomationList*)_list.get())->set_automation_state(as); } - + inline void start_touch() { set_touching (true); return ((ARDOUR::AutomationList*)_list.get())->start_touch(); } - + inline void stop_touch() { set_touching (false); return ((ARDOUR::AutomationList*)_list.get())->stop_touch(); diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h index 7d34fe72b9..9b899e8cd1 100644 --- a/libs/ardour/ardour/automation_list.h +++ b/libs/ardour/ardour/automation_list.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ #include "pbd/undo.h" #include "pbd/xml++.h" -#include "pbd/statefuldestructible.h" +#include "pbd/statefuldestructible.h" #include "ardour/ardour.h" @@ -50,7 +50,7 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL AutomationList& operator= (const AutomationList&); bool operator== (const AutomationList&); - + void freeze(); void thaw (); void mark_dirty () const; @@ -69,9 +69,9 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL bool automation_write () const { return (_state & Write) || ((_state & Touch) && _touching); } - + sigc::signal<void> StateChanged; - + static sigc::signal<void, AutomationList*> AutomationListCreated; mutable sigc::signal<void> Dirty; @@ -79,7 +79,7 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL void stop_touch (); bool touching() const { return _touching; } - XMLNode& get_state(void); + XMLNode& get_state(void); int set_state (const XMLNode &s); XMLNode& state (bool full); XMLNode& serialize_events (); @@ -87,9 +87,9 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL private: void create_curve_if_necessary (); int deserialize_events (const XMLNode&); - + void maybe_signal_changed (); - + AutoState _state; AutoStyle _style; bool _touching; diff --git a/libs/ardour/ardour/beats_frames_converter.h b/libs/ardour/ardour/beats_frames_converter.h index 381ea6c3d8..7134ea2fe9 100644 --- a/libs/ardour/ardour/beats_frames_converter.h +++ b/libs/ardour/ardour/beats_frames_converter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -35,7 +35,7 @@ public: : _session(session) , _origin(origin) {} - + sframes_t to(double beats) const; double from(sframes_t frames) const; diff --git a/libs/ardour/ardour/broadcast_info.h b/libs/ardour/ardour/broadcast_info.h index 39ea96c590..522d7e7361 100644 --- a/libs/ardour/ardour/broadcast_info.h +++ b/libs/ardour/ardour/broadcast_info.h @@ -40,38 +40,38 @@ class BroadcastInfo /// Construct empty broadcast info BroadcastInfo (); ~BroadcastInfo (); - + /// Returns last error sring from libsndfile std::string get_error () const { return error; } - + /* Convenience functions */ - + void set_from_session (Session const & session, int64_t time_ref); - + /* Reading */ - + bool load_from_file (std::string const & filename); bool load_from_file (SNDFILE* sf); - + std::string get_description () const; int64_t get_time_reference () const; struct tm get_origination_time () const; std::string get_originator () const; std::string get_originator_ref () const; - + /* Writing */ - + bool write_to_file (std::string const & filename); bool write_to_file (SNDFILE* sf); - + void set_description (std::string const & desc); void set_time_reference (int64_t when); void set_origination_time (struct tm * now = 0); // if 0, use time generated at construction void set_originator (std::string const & str = ""); void set_originator_ref (Session const &, std::string const & str = ""); - + /* State info */ - + /// Returns true if a info has been succesfully loaded or anything has been manually set bool has_info () const { return _has_info; } @@ -79,10 +79,10 @@ class BroadcastInfo SF_BROADCAST_INFO * info; struct tm _time; - + void update_error (); std::string error; - + bool _has_info; }; diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h index 8ed054923b..46a6d62667 100644 --- a/libs/ardour/ardour/buffer.h +++ b/libs/ardour/ardour/buffer.h @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -38,7 +38,7 @@ namespace ARDOUR { * methods to actually access the data). This provides a way for code that * doesn't care about the data type to still deal with buffers (which is * why the base class can't be a template). - * + * * To actually read/write buffer contents, use the appropriate derived class. */ class Buffer : public boost::noncopyable @@ -61,20 +61,20 @@ public: DataType type() const { return _type; } bool silent() const { return _silent; } - + /** Reallocate the buffer used internally to handle at least @a size_t units of data. * * The buffer is not silent after this operation. the @a capacity argument * passed to the constructor must have been non-zero. */ virtual void resize (size_t) = 0; - + /** Clear (eg zero, or empty) buffer */ virtual void silence (nframes_t len, nframes_t offset = 0) = 0; - + /** Clear the entire buffer */ virtual void clear() { silence(_capacity, 0); } - + virtual void read_from (const Buffer& src, nframes_t len, nframes_t dst_offset = 0, nframes_t src_offset = 0) = 0; virtual void merge_from (const Buffer& src, nframes_t len, nframes_t dst_offset = 0, nframes_t src_offset = 0) = 0; diff --git a/libs/ardour/ardour/buffer_set.h b/libs/ardour/ardour/buffer_set.h index 49c392ce6a..df842613cb 100644 --- a/libs/ardour/ardour/buffer_set.h +++ b/libs/ardour/ardour/buffer_set.h @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -59,7 +59,7 @@ public: ~BufferSet(); void clear(); - + void attach_buffers(PortSet& ports, nframes_t nframes, nframes_t offset = 0); /* the capacity here is a size_t and has a different interpretation depending @@ -79,10 +79,10 @@ public: void is_silent(bool yn) { _is_silent = yn; } bool is_silent() const { return _is_silent; } void silence (nframes_t nframes, nframes_t offset); - bool is_mirror() const { return _is_mirror; } + bool is_mirror() const { return _is_mirror; } void set_count(const ChanCount& count) { assert(count <= _available); _count = count; } - + size_t buffer_capacity(DataType type) const; Buffer& get(DataType type, size_t i); @@ -90,7 +90,7 @@ public: AudioBuffer& get_audio(size_t i) { return (AudioBuffer&)get(DataType::AUDIO, i); } - + MidiBuffer& get_midi(size_t i) { return (MidiBuffer&)get(DataType::MIDI, i); } @@ -110,7 +110,7 @@ public: // ITERATORS // FIXME: possible to combine these? templates? - + class audio_iterator { public: AudioBuffer& operator*() { return _set.get_audio(_index); } @@ -175,13 +175,13 @@ public: iterator begin(DataType type) { return iterator(*this, type, 0); } iterator end(DataType type) { return iterator(*this, type, _count.get(type)); } - + private: typedef std::vector<Buffer*> BufferVec; /// Vector of vectors, indexed by DataType std::vector<BufferVec> _buffers; - + #ifdef HAVE_SLV2 /// LV2 MIDI buffers (for conversion to/from MIDI buffers) typedef std::vector< std::pair<bool, LV2EventBuffer*> > LV2Buffers; diff --git a/libs/ardour/ardour/bundle.h b/libs/ardour/ardour/bundle.h index 98344e8406..0e80c5433d 100644 --- a/libs/ardour/ardour/bundle.h +++ b/libs/ardour/ardour/bundle.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2007 Paul Davis + Copyright (C) 2002-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,8 +29,8 @@ namespace ARDOUR { -class AudioEngine; - +class AudioEngine; + /** A set of `channels', each of which is associated with 0 or more ports. * Each channel has a name which can be anything useful. * Intended for grouping things like, for example, a buss' outputs. @@ -52,7 +52,7 @@ class Bundle : public sigc::trackable bool operator== (Channel const &o) const { return name == o.name && ports == o.ports; } - + std::string name; PortList ports; }; @@ -61,7 +61,7 @@ class Bundle : public sigc::trackable Bundle (std::string const &, bool i = true); Bundle (std::string const &, DataType, bool i = true); Bundle (boost::shared_ptr<Bundle>); - + virtual ~Bundle() {} /** @return Number of channels that this Bundle has */ @@ -127,7 +127,7 @@ class Bundle : public sigc::trackable sigc::signal<void, Change> Changed; protected: - + /// mutex for _channel_ports and _channel_names /// XXX: is this necessary? mutable Glib::Mutex _channel_mutex; @@ -137,7 +137,7 @@ class Bundle : public sigc::trackable int set_channels (std::string const &); int parse_io_string (std::string const &, std::vector<std::string> &); void emit_changed (Change); - + std::string _name; DataType _type; bool _ports_are_inputs; @@ -151,14 +151,14 @@ class Bundle : public sigc::trackable struct BundleChannel { BundleChannel () : channel (0) {} - + BundleChannel (boost::shared_ptr<Bundle> b, uint32_t c) : bundle (b), channel (c) {} - + bool operator== (BundleChannel const& other) const { return bundle == other.bundle && channel == other.channel; } - + bool operator!= (BundleChannel const& other) const { return bundle != other.bundle || channel != other.channel; } @@ -166,7 +166,7 @@ struct BundleChannel boost::shared_ptr<Bundle> bundle; uint32_t channel; }; - + } #endif /* __ardour_bundle_h__ */ diff --git a/libs/ardour/ardour/caimportable.h b/libs/ardour/ardour/caimportable.h index 2cc20d21b7..dbf93dbb73 100644 --- a/libs/ardour/ardour/caimportable.h +++ b/libs/ardour/ardour/caimportable.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/chan_count.h b/libs/ardour/ardour/chan_count.h index ccae3920f6..3dc6423607 100644 --- a/libs/ardour/ardour/chan_count.h +++ b/libs/ardour/ardour/chan_count.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -38,7 +38,7 @@ class ChanCount { public: ChanCount(const XMLNode& node); ChanCount() { reset(); } - + // Convenience constructor for making single-typed streams (stereo, mono, etc) ChanCount(DataType type, uint32_t channels) { reset(); @@ -50,16 +50,16 @@ public: _counts[*t] = 0; } } - + void set(DataType t, uint32_t count) { assert(t != DataType::NIL); _counts[t] = count; } uint32_t get(DataType t) const { assert(t != DataType::NIL); return _counts[t]; } - + inline uint32_t n_audio() const { return _counts[DataType::AUDIO]; } inline void set_audio(uint32_t a) { _counts[DataType::AUDIO] = a; } - + inline uint32_t n_midi() const { return _counts[DataType::MIDI]; } inline void set_midi(uint32_t m) { _counts[DataType::MIDI] = m; } - + uint32_t n_total() const { uint32_t ret = 0; for (uint32_t i=0; i < DataType::num_types; ++i) @@ -75,7 +75,7 @@ public: return true; } - + bool operator!=(const ChanCount& other) const { return ! (*this == other); } @@ -92,7 +92,7 @@ public: bool operator<=(const ChanCount& other) const { return ( (*this < other) || (*this == other) ); } - + bool operator>(const ChanCount& other) const { for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { if (_counts[*t] < other._counts[*t]) { @@ -105,7 +105,7 @@ public: bool operator>=(const ChanCount& other) const { return ( (*this > other) || (*this == other) ); } - + ChanCount operator+(const ChanCount& other) const { ChanCount ret; for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { @@ -113,7 +113,7 @@ public: } return ret; } - + static ChanCount min(const ChanCount& a, const ChanCount& b) { ChanCount ret; for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { @@ -121,7 +121,7 @@ public: } return ret; } - + static ChanCount max(const ChanCount& a, const ChanCount& b) { ChanCount ret; for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { @@ -129,7 +129,7 @@ public: } return ret; } - + XMLNode* state(const std::string& name) const; static const ChanCount INFINITE; diff --git a/libs/ardour/ardour/chan_mapping.h b/libs/ardour/ardour/chan_mapping.h index 5f948a77b0..a08ff011af 100644 --- a/libs/ardour/ardour/chan_mapping.h +++ b/libs/ardour/ardour/chan_mapping.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -38,15 +38,15 @@ class ChanMapping { public: ChanMapping() {} ChanMapping(ARDOUR::ChanCount identity); - + uint32_t get(DataType t, uint32_t from); void set(DataType t, uint32_t from, uint32_t to); void offset_from(DataType t, int32_t delta); void offset_to(DataType t, int32_t delta); - + typedef std::map<uint32_t, uint32_t> TypeMapping; typedef std::map<DataType, TypeMapping> Mappings; - + Mappings mappings() { return _mappings; } const Mappings mappings() const { return _mappings; } diff --git a/libs/ardour/ardour/click.h b/libs/ardour/ardour/click.h index 2f174ab472..50efe7ce46 100644 --- a/libs/ardour/ardour/click.h +++ b/libs/ardour/ardour/click.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index e655cfde0e..d00cadb179 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/configuration_variable.h b/libs/ardour/ardour/configuration_variable.h index 6282da2c54..90859b72b1 100644 --- a/libs/ardour/ardour/configuration_variable.h +++ b/libs/ardour/ardour/configuration_variable.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,12 +37,12 @@ class ConfigVariableBase { std::string name () const { return _name; } void add_to_node (XMLNode&); bool set_from_node (XMLNode const &); - + virtual std::string get_as_string () const = 0; virtual void set_from_string (std::string const &) = 0; void show_stored_value (const std::string&); - + static void set_show_stored_values (bool); protected: @@ -96,14 +96,14 @@ template<class T> class ConfigVariableWithMutation : public ConfigVariable<T> { public: - ConfigVariableWithMutation (std::string name, T val, T (*m)(T)) + ConfigVariableWithMutation (std::string name, T val, T (*m)(T)) : ConfigVariable<T> (name, val), mutator (m) {} bool set (T val) { if (unmutated_value != val) { unmutated_value = val; return ConfigVariable<T>::set (mutator (val)); - } + } return false; } diff --git a/libs/ardour/ardour/control_outputs.h b/libs/ardour/ardour/control_outputs.h index 0a09ab10f4..069a000139 100644 --- a/libs/ardour/ardour/control_outputs.h +++ b/libs/ardour/ardour/control_outputs.h @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -26,7 +26,7 @@ namespace ARDOUR { -/* this exists for one reason only: so that it can override the "type" +/* this exists for one reason only: so that it can override the "type" property in the state of the Delivery processor. we need this because ControlOutputs are "unique" because they deliver to an IO object that is private to a Route and so cannot be looked diff --git a/libs/ardour/ardour/control_protocol_manager.h b/libs/ardour/ardour/control_protocol_manager.h index f315744e50..bceece9adf 100644 --- a/libs/ardour/ardour/control_protocol_manager.h +++ b/libs/ardour/ardour/control_protocol_manager.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ #include <glibmm/thread.h> -#include "pbd/stateful.h" +#include "pbd/stateful.h" namespace ARDOUR { diff --git a/libs/ardour/ardour/control_protocol_search_path.h b/libs/ardour/ardour/control_protocol_search_path.h index 69b13c493e..8795f4501a 100644 --- a/libs/ardour/ardour/control_protocol_search_path.h +++ b/libs/ardour/ardour/control_protocol_search_path.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Tim Mayberry + Copyright (C) 2007 Tim Mayberry This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ namespace ARDOUR { /** - * return a SearchPath containing directories in which to look for + * return a SearchPath containing directories in which to look for * control surface plugins. * * If ARDOUR_SURFACES_PATH is defined then the SearchPath returned diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h index e8b22e5524..7720ca7395 100644 --- a/libs/ardour/ardour/coreaudiosource.h +++ b/libs/ardour/ardour/coreaudiosource.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ -#ifndef __coreaudio_source_h__ +#ifndef __coreaudio_source_h__ #define __coreaudio_source_h__ #include <appleutility/CAAudioFile.h> diff --git a/libs/ardour/ardour/crossfade.h b/libs/ardour/ardour/crossfade.h index 9e1e39bb14..577bee8257 100644 --- a/libs/ardour/ardour/crossfade.h +++ b/libs/ardour/ardour/crossfade.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ #include <sigc++/signal.h> #include "pbd/undo.h" -#include "pbd/statefuldestructible.h" +#include "pbd/statefuldestructible.h" #include "ardour/ardour.h" #include "ardour/audioregion.h" @@ -44,29 +44,29 @@ class Crossfade : public ARDOUR::AudioRegion public: class NoCrossfadeHere: std::exception { - public: + public: virtual const char *what() const throw() { return "no crossfade should be constructed here"; } }; - + /* constructor for "fixed" xfades at each end of an internal overlap */ Crossfade (boost::shared_ptr<ARDOUR::AudioRegion> in, boost::shared_ptr<ARDOUR::AudioRegion> out, - nframes_t position, - nframes_t initial_length, - AnchorPoint); + nframes_t position, + nframes_t initial_length, + AnchorPoint); /* constructor for xfade between two regions that are overlapped in any way except the "internal" case. */ - + Crossfade (boost::shared_ptr<ARDOUR::AudioRegion> in, boost::shared_ptr<ARDOUR::AudioRegion> out, CrossfadeModel, bool active); /* copy constructor to copy a crossfade with new regions. used (for example) - when a playlist copy is made + when a playlist copy is made */ Crossfade (boost::shared_ptr<Crossfade>, boost::shared_ptr<ARDOUR::AudioRegion>, boost::shared_ptr<ARDOUR::AudioRegion>); - + /* the usual XML constructor */ Crossfade (const Playlist&, XMLNode&); @@ -79,13 +79,13 @@ class Crossfade : public ARDOUR::AudioRegion boost::shared_ptr<ARDOUR::AudioRegion> in() const { return _in; } boost::shared_ptr<ARDOUR::AudioRegion> out() const { return _out; } - - nframes_t read_at (Sample *buf, Sample *mixdown_buffer, - float *gain_buffer, sframes_t position, nframes_t cnt, - uint32_t chan_n, - nframes_t read_frames = 0, - nframes_t skip_frames = 0) const; - + + nframes_t read_at (Sample *buf, Sample *mixdown_buffer, + float *gain_buffer, sframes_t position, nframes_t cnt, + uint32_t chan_n, + nframes_t read_frames = 0, + nframes_t skip_frames = 0) const; + bool refresh (); uint32_t upper_layer () const { @@ -124,16 +124,16 @@ class Crossfade : public ARDOUR::AudioRegion bool can_follow_overlap() const; void set_follow_overlap (bool yn); - AutomationList& fade_in() { return _fade_in; } + AutomationList& fade_in() { return _fade_in; } AutomationList& fade_out() { return _fade_out; } nframes_t set_xfade_length (nframes_t); bool is_dependent() const { return true; } - bool depends_on (boost::shared_ptr<Region> other) const { - return other == _in || other == _out; + bool depends_on (boost::shared_ptr<Region> other) const { + return other == _in || other == _out; } - + static nframes_t short_xfade_length() { return _short_xfade_length; } static void set_short_xfade_length (nframes_t n); @@ -168,10 +168,10 @@ class Crossfade : public ARDOUR::AudioRegion bool update (); protected: - nframes_t read_raw_internal (Sample*, sframes_t, nframes_t, int) const; + nframes_t read_raw_internal (Sample*, sframes_t, nframes_t, int) const; }; } // namespace ARDOUR -#endif /* __ardour_overlap_h__ */ +#endif /* __ardour_overlap_h__ */ diff --git a/libs/ardour/ardour/crossfade_compare.h b/libs/ardour/ardour/crossfade_compare.h index b92806a6bb..ee934a2220 100644 --- a/libs/ardour/ardour/crossfade_compare.h +++ b/libs/ardour/ardour/crossfade_compare.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/cycle_timer.h b/libs/ardour/ardour/cycle_timer.h index 2861533025..146b393a63 100644 --- a/libs/ardour/ardour/cycle_timer.h +++ b/libs/ardour/ardour/cycle_timer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ class CycleTimer { cycles_t _entry; cycles_t _exit; std::string _name; - + public: CycleTimer(std::string name) : _name (name){ if (cycles_per_usec == 0) { diff --git a/libs/ardour/ardour/cycles.h b/libs/ardour/ardour/cycles.h index 2199a2eb9c..9f6d9b4b5c 100644 --- a/libs/ardour/ardour/cycles.h +++ b/libs/ardour/ardour/cycles.h @@ -1,7 +1,7 @@ /* Copyright (C) 2001 Paul Davis Code derived from various headers from the Linux kernel - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -37,7 +37,7 @@ * We only use the low 32 bits, and we'd simply better make sure * that we reschedule before that wraps. Scheduling at least every * four billion cycles just basically sounds like a good idea, - * regardless of how fast the machine is. + * regardless of how fast the machine is. */ typedef uint64_t cycles_t; @@ -103,7 +103,7 @@ get_cycles (void) * Standard way to access the cycle counter. * Currently only used on SMP for scheduling. * - * Only the low 32 bits are available as a continuously counting entity. + * Only the low 32 bits are available as a continuously counting entity. * But this only means we'll force a reschedule every 8 seconds or so, * which isn't an evil thing. */ diff --git a/libs/ardour/ardour/dB.h b/libs/ardour/ardour/dB.h index 1b5bb03d1f..209ab11edc 100644 --- a/libs/ardour/ardour/dB.h +++ b/libs/ardour/ardour/dB.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/data_type.h b/libs/ardour/ardour/data_type.h index 854f52acba..36114b29a9 100644 --- a/libs/ardour/ardour/data_type.h +++ b/libs/ardour/ardour/data_type.h @@ -1,17 +1,17 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis Author: Dave Robillard - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -49,7 +49,7 @@ public: MIDI = 1, NIL = 2, }; - + /** Number of types (not including NIL). * WARNING: make sure this matches Symbol! */ @@ -78,7 +78,7 @@ public: default: return ""; } } - + /** Inverse of the from-string constructor */ const char* to_string() const { switch (_symbol) { @@ -111,10 +111,10 @@ public: static iterator begin() { return iterator(0); } static iterator end() { return iterator(num_types); } - + bool operator==(const Symbol symbol) { return (_symbol == symbol); } bool operator!=(const Symbol symbol) { return (_symbol != symbol); } - + bool operator==(const DataType other) { return (_symbol == other._symbol); } bool operator!=(const DataType other) { return (_symbol != other._symbol); } diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h index 5cb11a9348..d2991a2d04 100644 --- a/libs/ardour/ardour/delivery.h +++ b/libs/ardour/ardour/delivery.h @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index 9eb5bae3de..6932913958 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ #include "pbd/fastlog.h" #include "pbd/ringbufferNPT.h" #include "pbd/stateful.h" -#include "pbd/statefuldestructible.h" +#include "pbd/statefuldestructible.h" #include "ardour/ardour.h" #include "ardour/location.h" @@ -59,7 +59,7 @@ class Send; class Session; class Diskstream : public SessionObject, public boost::noncopyable -{ +{ public: enum Flag { Recordable = 0x1, @@ -71,7 +71,7 @@ class Diskstream : public SessionObject, public boost::noncopyable Diskstream (Session &, const std::string& name, Flag f = Recordable); Diskstream (Session &, const XMLNode&); virtual ~Diskstream(); - + bool set_name (const std::string& str); boost::shared_ptr<ARDOUR::IO> io() const { return _io; } @@ -86,7 +86,7 @@ class Diskstream : public SessionObject, public boost::noncopyable AlignStyle alignment_style() const { return _alignment_style; } void set_align_style (AlignStyle); void set_persistent_align_style (AlignStyle a) { _persistent_alignment_style = a; } - + nframes_t roll_delay() const { return _roll_delay; } void set_roll_delay (nframes_t); @@ -103,7 +103,7 @@ class Diskstream : public SessionObject, public boost::noncopyable bool non_layered() const { return _flags & NonLayered; } bool reversed() const { return _actual_speed < 0.0f; } double speed() const { return _visible_speed; } - + virtual void punch_in() {} virtual void punch_out() {} @@ -122,7 +122,7 @@ class Diskstream : public SessionObject, public boost::noncopyable nframes_t current_capture_end() const { return capture_start_frame + capture_captured; } nframes_t get_capture_start_frame (uint32_t n=0); nframes_t get_captured_frames (uint32_t n=0); - + ChanCount n_channels() { return _n_channels; } static nframes_t disk_io_frames() { return disk_io_chunk_frames; } @@ -131,7 +131,7 @@ class Diskstream : public SessionObject, public boost::noncopyable /* Stateful */ virtual XMLNode& get_state(void) = 0; virtual int set_state(const XMLNode& node) = 0; - + virtual void monitor_input (bool) {} nframes_t capture_offset() const { return _capture_offset; } @@ -193,12 +193,12 @@ class Diskstream : public SessionObject, public boost::noncopyable virtual void recover (); /* called if commit will not be called, but process was */ //private: - + enum TransitionType { CaptureStart = 0, CaptureEnd }; - + struct CaptureTransition { TransitionType type; nframes_t capture_val; ///< The start or end file frame position @@ -207,10 +207,10 @@ class Diskstream : public SessionObject, public boost::noncopyable /* The two central butler operations */ virtual int do_flush (RunContext context, bool force = false) = 0; virtual int do_refill () = 0; - + /** For non-butler contexts (allocates temporary working buffers) */ virtual int do_refill_with_alloc() = 0; - + /* XXX fix this redundancy ... */ virtual void playlist_changed (Change); @@ -221,8 +221,8 @@ class Diskstream : public SessionObject, public boost::noncopyable virtual void transport_looped (nframes_t transport_frame) = 0; struct CaptureInfo { - uint32_t start; - uint32_t frames; + uint32_t start; + uint32_t frames; }; virtual void init (Flag); @@ -263,7 +263,7 @@ class Diskstream : public SessionObject, public boost::noncopyable /* items needed for speed change logic */ bool _buffer_reallocation_required; bool _seek_required; - + bool force_refill; nframes_t capture_start_frame; nframes_t capture_captured; @@ -287,10 +287,10 @@ class Diskstream : public SessionObject, public boost::noncopyable nframes_t wrap_buffer_size; nframes_t speed_buffer_size; - double _speed; + double _speed; double _target_speed; - - nframes_t file_frame; + + nframes_t file_frame; nframes_t playback_sample; nframes_t playback_distance; bool commit_should_unlock; @@ -312,7 +312,7 @@ class Diskstream : public SessionObject, public boost::noncopyable sigc::connection plmod_connection; sigc::connection plgone_connection; sigc::connection plregion_connection; - + Flag _flags; void route_going_away (); diff --git a/libs/ardour/ardour/element_import_handler.h b/libs/ardour/ardour/element_import_handler.h index 2401cf7a06..be2e3fafb0 100644 --- a/libs/ardour/ardour/element_import_handler.h +++ b/libs/ardour/ardour/element_import_handler.h @@ -34,7 +34,7 @@ namespace ARDOUR { class Session; class ElementImporter; -/// Virtual interface class for element import handlers +/// Virtual interface class for element import handlers class ElementImportHandler { public: @@ -48,58 +48,58 @@ class ElementImportHandler * @param source XML tree to be parsed * @see elements */ - ElementImportHandler (XMLTree const & source, ARDOUR::Session & session) : - source (source), session (session) { } - + ElementImportHandler (XMLTree const & source, ARDOUR::Session & session) + : source (source), session (session) { } + virtual ~ElementImportHandler (); - + /** Gets a textual representation of the element type * @return textual representation of element type */ virtual std::string get_info () const = 0; - + /// Elements this handler handles ElementList elements; - + /* For checking duplicates names against queued elements */ - + /** Checks whether or not an element with some name is queued or not * @param name name to check * @return true if name is not used */ bool check_name (const std::string & name) const; - + /// Adds name to the list of used names void add_name (std::string name); - + /// Removes name from the list of used names void remove_name (const std::string & name); - + /// Checks wheter or not all elements can be imported cleanly static bool dirty () { return _dirty; } - + /// Sets handler dirty static void set_dirty () { _dirty = true; } - + /// Checks wheter or not all elements were imported cleanly static bool errors () { return _errors; } - + /// Sets handler dirty static void set_errors () { _errors = true; } protected: /// Source session XML tree XMLTree const & source; - + /// Destination session ARDOUR::Session & session; - + /// Session XML readability static bool _dirty; - + /// Errors post initialization static bool _errors; - + private: /// Set of names for duplicate checking std::set<std::string> names; diff --git a/libs/ardour/ardour/element_importer.h b/libs/ardour/ardour/element_importer.h index 4a69565838..9d2d9cc0de 100644 --- a/libs/ardour/ardour/element_importer.h +++ b/libs/ardour/ardour/element_importer.h @@ -39,43 +39,43 @@ class ElementImporter ElementImporter (XMLTree const & source, ARDOUR::Session & session); virtual ~ElementImporter (); - + /** Returns the element name * @return the name of the element */ virtual std::string get_name () const { return name; }; - + /** Gets a textual representation of the element * @return a textual representation on this specific element */ virtual std::string get_info () const = 0; - + /** Gets import status, if applicable. */ virtual Session::ImportStatus * get_import_status () { return 0; } - + /** Prepares to move element * * @return whther or not the element could be prepared for moving */ bool prepare_move (); - + /** Cancels moving of element * If the element has been set to be moved, this cancels the move. */ void cancel_move (); - + /// Moves the element to the taget session void move (); - + /// Check if element is broken. Cannot be moved if broken. bool broken () { return _broken; } - + /// Signal that requests for anew name static sigc::signal <std::pair<bool, std::string>, std::string, std::string> Rename; - + /// Signal for ok/cancel prompting static sigc::signal <bool, std::string> Prompt; - + protected: /** Moves the element to the taget session @@ -84,44 +84,44 @@ class ElementImporter */ virtual void _move () = 0; - /** Should take care of all tasks that need to be done + /** Should take care of all tasks that need to be done * before moving the element. This includes prompting * the user for more information if necessary. * * @return whether or not the element can be moved */ virtual bool _prepare_move () = 0; - - /// Cancel move + + /// Cancel move virtual void _cancel_move () = 0; /// Source XML-tree XMLTree const & source; - + /// Target session ARDOUR::Session & session; - + /// Ture if the element has been prepared and queued for importing bool queued () { return _queued; } - + /// Name of element std::string name; - + /// The sample rate of the session from which we are importing nframes_t sample_rate; - + /// Converts smpte time to a string std::string smpte_to_string (SMPTE::Time & time) const; - + /// Converts samples so that times match the sessions sample rate nframes_t rate_convert_samples (nframes_t samples) const; - + /// Converts samples so that times match the sessions sample rate (for straight use in XML) std::string rate_convert_samples (std::string const & samples) const; - + /// Set element broken void set_broken () { _broken = true; } - + private: bool _queued; bool _broken; diff --git a/libs/ardour/ardour/event_type_map.h b/libs/ardour/ardour/event_type_map.h index 371adfc0ee..b3c6b89b3f 100644 --- a/libs/ardour/ardour/event_type_map.h +++ b/libs/ardour/ardour/event_type_map.h @@ -41,7 +41,7 @@ public: Evoral::Parameter new_parameter(uint32_t type, uint8_t channel=0, uint32_t id=0) const; Evoral::Parameter new_parameter(const std::string& str) const; std::string to_symbol(const Evoral::Parameter& param) const; - + bool is_midi_parameter(const Evoral::Parameter& param); static EventTypeMap& instance() { return event_type_map; } diff --git a/libs/ardour/ardour/export.h b/libs/ardour/ardour/export.h index ffc6ae5854..78a0e9abb0 100644 --- a/libs/ardour/ardour/export.h +++ b/libs/ardour/ardour/export.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ #include "ardour/ardour.h" #include "ardour/gdither.h" -namespace ARDOUR +namespace ARDOUR { class Port; @@ -41,59 +41,59 @@ namespace ARDOUR struct ExportSpecification : public SF_INFO, public sigc::trackable { - ExportSpecification(); - ~ExportSpecification (); + ExportSpecification(); + ~ExportSpecification (); - void init (); - void clear (); + void init (); + void clear (); - int prepare (nframes_t blocksize, nframes_t frame_rate); + int prepare (nframes_t blocksize, nframes_t frame_rate); - int process (nframes_t nframes); + int process (nframes_t nframes); - /* set by the user */ + /* set by the user */ - std::string path; - nframes_t sample_rate; + std::string path; + nframes_t sample_rate; - int src_quality; - SNDFILE* out; - uint32_t channels; - ExportPortMap port_map; - nframes_t start_frame; - nframes_t end_frame; - GDitherType dither_type; - bool do_freewheel; + int src_quality; + SNDFILE* out; + uint32_t channels; + ExportPortMap port_map; + nframes_t start_frame; + nframes_t end_frame; + GDitherType dither_type; + bool do_freewheel; - /* used exclusively during export */ + /* used exclusively during export */ - nframes_t frame_rate; - GDither dither; - float* dataF; - float* dataF2; - float* leftoverF; - nframes_t leftover_frames; - nframes_t max_leftover_frames; - void* output_data; - nframes_t out_samples_max; - uint32_t sample_bytes; - uint32_t data_width; + nframes_t frame_rate; + GDither dither; + float* dataF; + float* dataF2; + float* leftoverF; + nframes_t leftover_frames; + nframes_t max_leftover_frames; + void* output_data; + nframes_t out_samples_max; + uint32_t sample_bytes; + uint32_t data_width; - nframes_t total_frames; - SF_INFO sfinfo; - SRC_DATA src_data; - SRC_STATE* src_state; - nframes_t pos; + nframes_t total_frames; + SF_INFO sfinfo; + SRC_DATA src_data; + SRC_STATE* src_state; + nframes_t pos; - sigc::connection freewheel_connection; + sigc::connection freewheel_connection; - /* shared between UI thread and audio thread */ + /* shared between UI thread and audio thread */ - volatile float progress; /* audio thread sets this */ - volatile bool stop; /* UI sets this */ - volatile bool running; /* audio thread sets to false when export is done */ + volatile float progress; /* audio thread sets this */ + volatile bool stop; /* UI sets this */ + volatile bool running; /* audio thread sets to false when export is done */ - int status; + int status; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/export_channel.h b/libs/ardour/ardour/export_channel.h index 4fe1efa294..fdb466a06e 100644 --- a/libs/ardour/ardour/export_channel.h +++ b/libs/ardour/ardour/export_channel.h @@ -44,13 +44,13 @@ class ExportChannel virtual void read (Sample * data, nframes_t frames) const = 0; virtual bool empty () const = 0; - + /// Adds state to node passed virtual void get_state (XMLNode * node) const = 0; - + /// Sets state from node passed virtual void set_state (XMLNode * node, Session & session) = 0; - + // Operator< must be defined for usage in e.g. std::map or std::set to disallow duplicates when necessary virtual bool operator< (ExportChannel const & other) const = 0; }; @@ -72,13 +72,13 @@ class PortExportChannel : public ExportChannel typedef std::set<AudioPort *> PortSet; PortExportChannel () {} - + void read (Sample * data, nframes_t frames) const; bool empty () const { return ports.empty(); } - + void get_state (XMLNode * node) const; void set_state (XMLNode * node, Session & session); - + bool operator< (ExportChannel const & other) const; void add_port (AudioPort * port) { ports.insert (port); } @@ -97,13 +97,13 @@ class RegionExportChannelFactory : public sigc::trackable Fades, Processed }; - + RegionExportChannelFactory (Session * session, AudioRegion const & region, AudioTrack & track, Type type); ~RegionExportChannelFactory (); ExportChannelPtr create (uint32_t channel); void read (uint32_t channel, Sample * data, nframes_t frames_to_read); - + private: int new_cycle_started () { buffers_up_to_date = false; return 0; } @@ -119,7 +119,7 @@ class RegionExportChannelFactory : public sigc::trackable bool buffers_up_to_date; nframes_t region_start; nframes_t position; - + Sample * mixdown_buffer; Sample * gain_buffer; }; @@ -139,11 +139,11 @@ class RegionExportChannel : public ExportChannel private: - RegionExportChannel (RegionExportChannelFactory & factory, uint32_t channel) : - factory (factory), - channel (channel) + RegionExportChannel (RegionExportChannelFactory & factory, uint32_t channel) + : factory (factory) + , channel (channel) {} - + RegionExportChannelFactory & factory; uint32_t channel; }; diff --git a/libs/ardour/ardour/export_channel_configuration.h b/libs/ardour/ardour/export_channel_configuration.h index 70b2bb00d9..8ef9bba6dc 100644 --- a/libs/ardour/ardour/export_channel_configuration.h +++ b/libs/ardour/ardour/export_channel_configuration.h @@ -51,20 +51,20 @@ class ExportChannelConfiguration typedef boost::shared_ptr<ExportTimespan> TimespanPtr; typedef boost::shared_ptr<ExportFormatSpecification const> FormatPtr; typedef boost::shared_ptr<ExportFilename> FilenamePtr; - + typedef std::pair<FormatPtr, FilenamePtr> FileConfig; typedef std::list<FileConfig> FileConfigList; - + /// Struct for threading, acts like a pointer to a ExportChannelConfiguration struct WriterThread { WriterThread (ExportChannelConfiguration & channel_config) : - channel_config (channel_config), running (false) {} - + channel_config (channel_config), running (false) {} + ExportChannelConfiguration * operator-> () { return &channel_config; } ExportChannelConfiguration & operator* () { return channel_config; } - + ExportChannelConfiguration & channel_config; - + pthread_t thread; bool running; }; @@ -72,46 +72,46 @@ class ExportChannelConfiguration private: friend class ExportElementFactory; ExportChannelConfiguration (Session & session); - + public: XMLNode & get_state (); int set_state (const XMLNode &); - + typedef std::list<ExportChannelPtr> ChannelList; - + ChannelList const & get_channels () const { return channels; } bool all_channels_have_ports () const; - + Glib::ustring name () const { return _name; } void set_name (Glib::ustring name) { _name = name; } void set_split (bool value) { split = value; } - + bool get_split () const { return split; } uint32_t get_n_chans () const { return channels.size(); } - + void register_channel (ExportChannelPtr channel) { channels.push_back (channel); } void register_file_config (FormatPtr format, FilenamePtr filename) { file_configs.push_back (FileConfig (format, filename)); } - + void clear_channels () { channels.clear (); } - + /// Writes all files for this channel config @return true if a new thread was spawned bool write_files (boost::shared_ptr<ExportProcessor> new_processor); sigc::signal<void> FilesWritten; - + // Tells the handler the necessary information for it to handle tempfiles void register_with_timespan (TimespanPtr timespan); - + void unregister_all (); - + private: typedef boost::shared_ptr<ExportStatus> ExportStatusPtr; - Session & session; + Session & session; // processor has to be prepared before doing this. void write_file (); - + /// The actual write files, needed for threading static void * _write_files (void *arg); WriterThread writer_thread; @@ -123,7 +123,7 @@ class ExportChannelConfiguration TimespanPtr timespan; ChannelList channels; FileConfigList file_configs; - + bool split; // Split to mono files Glib::ustring _name; }; diff --git a/libs/ardour/ardour/export_failed.h b/libs/ardour/ardour/export_failed.h index 63256b458e..37f572f345 100644 --- a/libs/ardour/ardour/export_failed.h +++ b/libs/ardour/ardour/export_failed.h @@ -33,19 +33,19 @@ namespace ARDOUR class ExportFailed : public std::exception { public: - ExportFailed (std::string const & reason) : - reason (reason.c_str()) + ExportFailed (std::string const & reason) + : reason (reason.c_str()) { PBD::error << string_compose (_("Export failed: %1"), reason) << endmsg; } - + ~ExportFailed () throw() { } - + const char* what() const throw() { return reason; } - + private: const char * reason; diff --git a/libs/ardour/ardour/export_file_io.h b/libs/ardour/ardour/export_file_io.h index 0df2f99e29..48d5984f78 100644 --- a/libs/ardour/ardour/export_file_io.h +++ b/libs/ardour/ardour/export_file_io.h @@ -45,9 +45,9 @@ class ExportFileWriter std::string filename () const { return _filename; } nframes_t position () const { return _position; } - + void set_position (nframes_t position) { _position = position; } - + protected: ExportFileWriter (std::string filename) : _filename (filename) {} @@ -99,58 +99,58 @@ class ExportTempFile : public SndfileWriter<float>, public GraphSource<float> public: ExportTempFile (uint32_t channels, nframes_t samplerate); ~ExportTempFile () {} - + /// Causes the file to be read from the beginning again void reset_read () { reading = false; } nframes_t read (float * data, nframes_t frames); - + /* Silence management */ - + nframes_t trim_beginning (bool yn = true); nframes_t trim_end (bool yn = true); - + void set_silence_beginning (nframes_t frames); void set_silence_end (nframes_t frames); private: /* File access */ - + sf_count_t get_length (); sf_count_t get_position (); sf_count_t get_read_position (); // get position seems to default to the write pointer sf_count_t locate_to (nframes_t frames); sf_count_t _read (float * data, nframes_t frames); - + uint32_t channels; bool reading; - + /* Silence related */ - + /* start and end are used by read() */ - + nframes_t start; nframes_t end; - + /* these are the silence processing results and state */ - + void process_beginning (); void process_end (); - + bool beginning_processed; bool end_processed; - + nframes_t silent_frames_beginning; nframes_t silent_frames_end; - + /* Silence to add to start and end */ - + nframes_t silence_beginning; nframes_t silence_end; - + /* Takes care that the end postion gets set at some stage */ - + bool end_set; - + }; class ExportFileFactory @@ -160,7 +160,7 @@ class ExportFileFactory typedef GraphSink<float> FloatSink; typedef boost::shared_ptr<FloatSink> FloatSinkPtr; typedef boost::shared_ptr<ExportFileWriter> FileWriterPtr; - + typedef std::pair<FloatSinkPtr, FileWriterPtr> FilePair; static FilePair create (FormatPtr format, uint32_t channels, Glib::ustring const & filename); diff --git a/libs/ardour/ardour/export_filename.h b/libs/ardour/ardour/export_filename.h index 3dccda728f..2847291a13 100644 --- a/libs/ardour/ardour/export_filename.h +++ b/libs/ardour/ardour/export_filename.h @@ -49,7 +49,7 @@ class ExportFilename { D_BE, // big endian (no deliminator) D_BEShortY // big endian short year representation }; - + enum TimeFormat { T_None, T_NoDelim, @@ -60,39 +60,39 @@ class ExportFilename { friend class ExportElementFactory; ExportFilename (Session & session); - public: + public: /* Serialization */ - + XMLNode & get_state (); int set_state (const XMLNode &); - + /* data access */ - + Glib::ustring get_path (FormatPtr format) const; Glib::ustring get_folder () const { return folder; } - + TimeFormat get_time_format () const { return time_format; } DateFormat get_date_format () const { return date_format; } Glib::ustring get_time_format_str (TimeFormat format) const; Glib::ustring get_date_format_str (DateFormat format) const; - + Glib::ustring get_label () const { return label; } uint32_t get_revision () const { return revision; } - + /* data modification */ - + void set_time_format (TimeFormat format); void set_date_format (DateFormat format); void set_label (Glib::ustring value); void set_revision (uint32_t value) { revision = value; } void set_channel (uint32_t value) { channel = value; } bool set_folder (Glib::ustring path); - + void set_timespan (TimespanPtr ts) { timespan = ts; } void set_channel_config (ChannelConfigPtr cc) { channel_config = cc; } - + /* public members */ - + bool include_label; bool include_session; bool include_revision; @@ -101,7 +101,7 @@ class ExportFilename { bool include_timespan; bool include_time; bool include_date; - + private: Session & session; @@ -109,22 +109,22 @@ class ExportFilename { Glib::ustring label; uint32_t revision; uint32_t channel; - + Glib::ustring folder; - + DateFormat date_format; TimeFormat time_format; - + Glib::ustring get_formatted_time (Glib::ustring const & format) const; struct tm * time_struct; // Due to static allocation no destructor or copy-ctor is needed because of this - + TimespanPtr timespan; ChannelConfigPtr channel_config; - + /* Serialization helpers */ - + typedef std::pair<bool, Glib::ustring> FieldPair; - + void add_field (XMLNode * node, Glib::ustring const & name, bool enabled, Glib::ustring const & value = ""); FieldPair get_field (XMLNode const & node, Glib::ustring const & name); FieldPair analyse_folder (); diff --git a/libs/ardour/ardour/export_format_base.h b/libs/ardour/ardour/export_format_base.h index 7d5757a77d..7bc0125004 100644 --- a/libs/ardour/ardour/export_format_base.h +++ b/libs/ardour/ardour/export_format_base.h @@ -43,7 +43,7 @@ class ExportFormatBase { T_None = 0, T_Sndfile }; - + enum FormatId { F_None = 0, F_WAV = SF_FORMAT_WAV, @@ -55,7 +55,7 @@ class ExportFormatBase { F_FLAC = SF_FORMAT_FLAC, F_Ogg = SF_FORMAT_OGG }; - + enum Endianness { E_FileDefault = SF_ENDIAN_FILE, /* Default file endian-ness. */ E_Little = SF_ENDIAN_LITTLE, /* Force little endian-ness. */ @@ -74,14 +74,14 @@ class ExportFormatBase { SF_Double = SF_FORMAT_DOUBLE, SF_Vorbis = SF_FORMAT_VORBIS }; - + enum DitherType { D_None = GDitherNone, D_Rect = GDitherRect, D_Tri = GDitherTri, D_Shaped = GDitherShaped }; - + enum Quality { Q_None = 0, Q_Any, @@ -89,7 +89,7 @@ class ExportFormatBase { Q_LosslessCompression, Q_LossyCompression }; - + enum SampleRate { SR_None = 0, SR_22_05 = 220500, @@ -99,7 +99,7 @@ class ExportFormatBase { SR_96 = 96000, SR_192 = 192000 }; - + enum SRCQuality { SRC_SincBest = SRC_SINC_BEST_QUALITY, SRC_SincMedium = SRC_SINC_MEDIUM_QUALITY, @@ -107,31 +107,31 @@ class ExportFormatBase { SRC_ZeroOrderHold = SRC_ZERO_ORDER_HOLD, SRC_Linear = SRC_LINEAR }; - + /// Class for managing selection and compatibility states class SelectableCompatible { public: - SelectableCompatible () : - _selected (false), _compatible (true) { } + SelectableCompatible () + : _selected (false), _compatible (true) { } ~SelectableCompatible () {} - + sigc::signal<void, bool> SelectChanged; sigc::signal<void, bool> CompatibleChanged; - + bool selected () const { return _selected; } bool compatible () const { return _compatible; } Glib::ustring name () const { return _name; } - + void set_selected (bool value); void set_compatible (bool value); - + protected: void set_name (Glib::ustring name) { _name = name; } - + private: bool _selected; bool _compatible; - + Glib::ustring _name; }; @@ -139,9 +139,9 @@ class ExportFormatBase { ExportFormatBase (); ExportFormatBase (ExportFormatBase const & other); - + virtual ~ExportFormatBase (); - + boost::shared_ptr<ExportFormatBase> get_intersection (ExportFormatBase const & other) const; boost::shared_ptr<ExportFormatBase> get_difference (ExportFormatBase const & other) const; boost::shared_ptr<ExportFormatBase> get_union (ExportFormatBase const & other) const; @@ -151,13 +151,13 @@ class ExportFormatBase { bool sample_rates_empty () const { return sample_rates.empty (); } bool formats_empty () const { return format_ids.empty (); } bool qualities_empty () const { return qualities.empty (); } - + bool has_endianness (Endianness endianness) const { return endiannesses.find (endianness) != endiannesses.end() ; } bool has_sample_format (SampleFormat format) const { return sample_formats.find (format) != sample_formats.end(); } bool has_sample_rate (SampleRate rate) const { return sample_rates.find (rate) != sample_rates.end(); } bool has_format (FormatId format) const { return format_ids.find (format) != format_ids.end(); } bool has_quality (Quality quality) const { return qualities.find (quality) != qualities.end(); } - + void set_extension (Glib::ustring const & extension) { _extension = extension; } Glib::ustring const & extension () const { return _extension; } @@ -172,22 +172,22 @@ class ExportFormatBase { typedef std::set<SampleRate> SampleRateSet; typedef std::set<FormatId> FormatSet; typedef std::set<Quality> QualitySet; - + EndianSet endiannesses; SampleRateSet sample_rates; FormatSet format_ids; QualitySet qualities; - + private: Glib::ustring _extension; - + enum SetOperation { SetUnion, SetDifference, SetIntersection }; - + boost::shared_ptr<ExportFormatBase> do_set_operation (ExportFormatBase const & other, SetOperation operation) const; }; diff --git a/libs/ardour/ardour/export_format_compatibility.h b/libs/ardour/ardour/export_format_compatibility.h index 895937dc98..cd2dae5e20 100644 --- a/libs/ardour/ardour/export_format_compatibility.h +++ b/libs/ardour/ardour/export_format_compatibility.h @@ -39,12 +39,12 @@ class ExportFormatCompatibility : public ExportFormatBase, public ExportFormatBa format_ids.insert (F_None); qualities.insert (Q_None); } - + ~ExportFormatCompatibility () {}; - - ExportFormatCompatibility (ExportFormatBase const & other) : - ExportFormatBase (other) {} - + + ExportFormatCompatibility (ExportFormatBase const & other) + : ExportFormatBase (other) {} + void add_endianness (Endianness endianness) { endiannesses.insert (endianness); } void add_sample_format (SampleFormat format) { sample_formats.insert (format); } void add_sample_rate (SampleRate rate) { sample_rates.insert (rate); } diff --git a/libs/ardour/ardour/export_format_manager.h b/libs/ardour/ardour/export_format_manager.h index f69cfca986..705b9dcf17 100644 --- a/libs/ardour/ardour/export_format_manager.h +++ b/libs/ardour/ardour/export_format_manager.h @@ -46,39 +46,39 @@ class ExportFormatManager : public sigc::trackable typedef boost::shared_ptr<ExportFormatCompatibility> CompatPtr; typedef boost::weak_ptr<ExportFormatCompatibility> WeakCompatPtr; typedef std::list<CompatPtr> CompatList; - + typedef boost::shared_ptr<ExportFormat> FormatPtr; typedef boost::weak_ptr<ExportFormat> WeakFormatPtr; typedef std::list<FormatPtr> FormatList; - + typedef HasSampleFormat::SampleFormatPtr SampleFormatPtr; typedef HasSampleFormat::SampleFormatList SampleFormatList; typedef HasSampleFormat::WeakSampleFormatPtr WeakSampleFormatPtr; - + typedef HasSampleFormat::DitherTypePtr DitherTypePtr; typedef HasSampleFormat::WeakDitherTypePtr WeakDitherTypePtr; - + typedef boost::shared_ptr<ExportFormatSpecification> SpecPtr; typedef boost::shared_ptr<ExportFormatBase> FormatBasePtr; - + /* Quality states */ - + class QualityState : public ExportFormatBase::SelectableCompatible { - public: + public: QualityState (ExportFormatBase::Quality quality, Glib::ustring name) : - quality (quality) { set_name (name); } + quality (quality) { set_name (name); } ExportFormatBase::Quality quality; }; typedef boost::shared_ptr<QualityState> QualityPtr; typedef boost::weak_ptr<QualityState> WeakQualityPtr; typedef std::list<QualityPtr> QualityList; - + /* Sample rate states */ - + class SampleRateState : public ExportFormatBase::SelectableCompatible { public: - SampleRateState (ExportFormatBase::SampleRate rate, Glib::ustring name) : - rate (rate) { set_name (name); } + SampleRateState (ExportFormatBase::SampleRate rate, Glib::ustring name) + : rate (rate) { set_name (name); } ExportFormatBase::SampleRate rate; }; typedef boost::shared_ptr<SampleRateState> SampleRatePtr; @@ -100,11 +100,11 @@ class ExportFormatManager : public sigc::trackable QualityList const & get_qualities () { return qualities; } FormatList const & get_formats () { return formats; } SampleRateList const & get_sample_rates () { return sample_rates; } - + /* Non interactive selections */ - + void set_name (Glib::ustring name); - + void select_src_quality (ExportFormatBase::SRCQuality value); void select_trim_beginning (bool value); void select_silence_beginning (AnyTime const & time); @@ -127,41 +127,41 @@ class ExportFormatManager : public sigc::trackable void add_sample_rate (SampleRatePtr ptr); /* Connected to signals */ - + void change_compatibility_selection (bool select, WeakCompatPtr const & compat); void change_quality_selection (bool select, WeakQualityPtr const & quality); void change_format_selection (bool select, WeakFormatPtr const & format); void change_sample_rate_selection (bool select, WeakSampleRatePtr const & rate); - + void change_sample_format_selection (bool select, WeakSampleFormatPtr const & format); void change_dither_type_selection (bool select, WeakDitherTypePtr const & type); - + /* Do actual selection */ - + void select_compatibility (WeakCompatPtr const & compat); void select_quality (QualityPtr const & quality); void select_format (FormatPtr const & format); void select_sample_rate (SampleRatePtr const & rate); - + void select_sample_format (SampleFormatPtr const & format); void select_dither_type (DitherTypePtr const & type); - + bool pending_selection_change; void selection_changed (); - + /* Formats and compatibilities */ - + QualityPtr get_selected_quality (); FormatPtr get_selected_format (); SampleRatePtr get_selected_sample_rate (); - + SampleFormatPtr get_selected_sample_format (); - + FormatBasePtr get_compatibility_intersection (); - + FormatBasePtr universal_set; SpecPtr current_selection; - + CompatList compatibilities; QualityList qualities; FormatList formats; diff --git a/libs/ardour/ardour/export_format_specification.h b/libs/ardour/ardour/export_format_specification.h index a3f4d4fe19..628c70d25a 100644 --- a/libs/ardour/ardour/export_format_specification.h +++ b/libs/ardour/ardour/export_format_specification.h @@ -46,14 +46,14 @@ class ExportFormatSpecification : public ExportFormatBase { struct Time : public AnyTime { Time (Session & session) : AnyTime (), session (session) {} Time & operator= (AnyTime const & other); - + nframes_t get_frames (nframes_t target_rate) const; - + /* Serialization */ - + XMLNode & get_state (); int set_state (const XMLNode & node); - + private: Session & session; }; @@ -62,18 +62,18 @@ class ExportFormatSpecification : public ExportFormatBase { friend class ExportElementFactory; explicit ExportFormatSpecification (Session & s); ExportFormatSpecification (Session & s, XMLNode const & state); - + public: ExportFormatSpecification (ExportFormatSpecification const & other); ~ExportFormatSpecification (); /* compatibility */ - + bool is_compatible_with (ExportFormatCompatibility const & compatibility) const; bool is_complete () const; /* Modifying functions */ - + void set_format (boost::shared_ptr<ExportFormat> format); void set_name (Glib::ustring const & name) { _name = name; } @@ -84,29 +84,29 @@ class ExportFormatSpecification : public ExportFormatBase { void set_sample_format (SampleFormat value) { sample_formats.clear(); sample_formats.insert (value); } void set_sample_rate (SampleRate value) { sample_rates.clear(); sample_rates.insert (value); } void set_quality (Quality value) { qualities.clear(); qualities.insert (value); } - + void set_dither_type (DitherType value) { _dither_type = value; } void set_src_quality (SRCQuality value) { _src_quality = value; } void set_trim_beginning (bool value) { _trim_beginning = value; } void set_trim_end (bool value) { _trim_end = value; } void set_normalize (bool value) { _normalize = value; } void set_normalize_target (float value) { _normalize_target = value; } - + void set_tag (bool tag_it) { _tag = tag_it; } - + void set_silence_beginning (AnyTime const & value) { _silence_beginning = value; } void set_silence_end (AnyTime const & value) { _silence_end = value; } - + /* Accessing functions */ - + PBD::UUID const & id () { return _id; } Glib::ustring const & name () const { return _name; } Glib::ustring description (); - + bool has_broadcast_info () const { return _has_broadcast_info; } uint32_t channel_limit () const { return _channel_limit; } Glib::ustring format_name () const { return _format_name; } - + Type type () const { return _type; } FormatId format_id () const { return *format_ids.begin(); } Endianness endianness () const { return *endiannesses.begin(); } @@ -120,54 +120,54 @@ class ExportFormatSpecification : public ExportFormatBase { bool trim_end () const { return _trim_end; } bool normalize () const { return _normalize; } float normalize_target () const { return _normalize_target; } - + bool tag () const { return _tag && supports_tagging; } - + nframes_t silence_beginning () const { return _silence_beginning.get_frames (sample_rate()); } nframes_t silence_end () const { return _silence_end.get_frames (sample_rate()); } - + AnyTime silence_beginning_time () const { return _silence_beginning; } AnyTime silence_end_time () const { return _silence_end; } - + /* Serialization */ - + XMLNode & get_state (); int set_state (const XMLNode & root); - + private: - + Session & session; - + /* The variables below do not have setters (usually set via set_format) */ - + Glib::ustring _format_name; bool has_sample_format; bool supports_tagging; bool _has_broadcast_info; uint32_t _channel_limit; - + /* The variables below have getters and setters */ - + Glib::ustring _name; PBD::UUID _id; - + Type _type; DitherType _dither_type; SRCQuality _src_quality; - + bool _tag; - + bool _trim_beginning; Time _silence_beginning; bool _trim_end; Time _silence_end; - + bool _normalize; float _normalize_target; - + /* serialization helpers */ - + void add_option (XMLNode * node, std::string const & name, std::string const & value); std::string get_option (XMLNode const * node, std::string const & name); diff --git a/libs/ardour/ardour/export_formats.h b/libs/ardour/ardour/export_formats.h index b7a7916767..3312e9abd6 100644 --- a/libs/ardour/ardour/export_formats.h +++ b/libs/ardour/ardour/export_formats.h @@ -42,43 +42,43 @@ class ExportFormat : public ExportFormatBase, public ExportFormatBase::Selectabl public: ExportFormat () {}; ~ExportFormat () {}; - + virtual bool set_compatibility_state (ExportFormatCompatibility const & compatibility) = 0; virtual Type get_type () const = 0; - + FormatId get_format_id () const { return *format_ids.begin(); } Quality get_quality () const { return *qualities.begin(); } - + bool has_sample_format (); bool sample_format_is_compatible (SampleFormat format) const; - + /* If the format has a specific sample format, this function should be overriden * if the format has a selectable sample format, do not override this! */ - + virtual SampleFormat get_explicit_sample_format () const { return SF_None; } /* If the above is not overriden, this one should be */ virtual ExportFormat::SampleFormat default_sample_format () const { return SF_None; } - + /* If the format has a channel count limit, override this */ - + virtual uint32_t get_channel_limit () const { return 256; } - + /* If the format can be tagged with metadata override this */ - + virtual bool supports_tagging () const { return false; } - + /* If the format contains broadcast info override this */ - + virtual bool has_broadcast_info () const { return false; } protected: - + void add_sample_rate (SampleRate rate) { sample_rates.insert (rate); } void add_endianness (Endianness endianness) { endiannesses.insert (endianness); } - + void set_format_id (FormatId id) { format_ids.clear (); format_ids.insert (id); } void set_quality (Quality value) { qualities.clear(); qualities.insert (value); } }; @@ -91,7 +91,7 @@ class HasSampleFormat { public: SampleFormatState (ExportFormatBase::SampleFormat format, Glib::ustring name) : format (format) { set_name (name); } - + ExportFormatBase::SampleFormat format; }; @@ -99,14 +99,14 @@ class HasSampleFormat { public: DitherTypeState (ExportFormatBase::DitherType type, Glib::ustring name) : type (type) { set_name (name); } - + ExportFormatBase::DitherType type; }; - + typedef boost::shared_ptr<SampleFormatState> SampleFormatPtr; typedef boost::weak_ptr<SampleFormatState> WeakSampleFormatPtr; typedef std::list<SampleFormatPtr> SampleFormatList; - + typedef boost::shared_ptr<DitherTypeState> DitherTypePtr; typedef boost::weak_ptr<DitherTypeState> WeakDitherTypePtr; typedef std::list<DitherTypePtr> DitherTypeList; @@ -117,21 +117,21 @@ class HasSampleFormat { virtual ~HasSampleFormat () {}; void add_sample_format (ExportFormatBase::SampleFormat format); - + SampleFormatList const & get_sample_formats () const { return sample_format_states; } DitherTypeList const & get_dither_types () const { return dither_type_states; } - + SampleFormatPtr get_selected_sample_format (); DitherTypePtr get_selected_dither_type (); - + /* Proxies for signals from sample formats and dither types */ - + sigc::signal<void, bool, WeakSampleFormatPtr> SampleFormatSelectChanged; sigc::signal<void, bool, WeakSampleFormatPtr> SampleFormatCompatibleChanged; - + sigc::signal<void, bool, WeakDitherTypePtr> DitherTypeSelectChanged; sigc::signal<void, bool, WeakDitherTypePtr> DitherTypeCompatibleChanged; - + static std::string get_sample_format_name (ExportFormatBase::SampleFormat format); protected: @@ -142,11 +142,11 @@ class HasSampleFormat { private: /* Connected to signals */ - + void add_dither_type (ExportFormatBase::DitherType type, Glib::ustring name); void update_sample_format_selection (bool); void update_dither_type_selection (bool); - + /* Reference to ExportFormatBase::sample_formats */ ExportFormatBase::SampleFormatSet & _sample_formats; }; @@ -156,15 +156,15 @@ class ExportFormatLinear : public ExportFormat, public HasSampleFormat { ExportFormatLinear (Glib::ustring name, FormatId format_id); ~ExportFormatLinear () {}; - + bool set_compatibility_state (ExportFormatCompatibility const & compatibility); Type get_type () const { return T_Sndfile; } - + void add_endianness (Endianness endianness) { endiannesses.insert (endianness); } - + void set_default_sample_format (SampleFormat sf) { _default_sample_format = sf; } SampleFormat default_sample_format () const { return _default_sample_format; } - + protected: SampleFormat _default_sample_format; }; @@ -173,7 +173,7 @@ class ExportFormatOggVorbis : public ExportFormat { public: ExportFormatOggVorbis (); ~ExportFormatOggVorbis () {}; - + bool set_compatibility_state (ExportFormatCompatibility const & compatibility); Type get_type () const { return T_Sndfile; } SampleFormat get_explicit_sample_format () const { return SF_Vorbis; } @@ -184,10 +184,10 @@ class ExportFormatFLAC : public ExportFormat, public HasSampleFormat { public: ExportFormatFLAC (); ~ExportFormatFLAC () {}; - + bool set_compatibility_state (ExportFormatCompatibility const & compatibility); Type get_type () const { return T_Sndfile; } - + uint32_t get_channel_limit () const { return 8; } SampleFormat default_sample_format () const { return SF_16; } virtual bool supports_tagging () const { return true; } @@ -197,10 +197,10 @@ class ExportFormatBWF : public ExportFormat, public HasSampleFormat { public: ExportFormatBWF (); ~ExportFormatBWF () {}; - + bool set_compatibility_state (ExportFormatCompatibility const & compatibility); Type get_type () const { return T_Sndfile; } - + SampleFormat default_sample_format () const { return SF_16; } virtual bool has_broadcast_info () const { return true; } }; diff --git a/libs/ardour/ardour/export_handler.h b/libs/ardour/ardour/export_handler.h index c945070408..b222c04eb4 100644 --- a/libs/ardour/ardour/export_handler.h +++ b/libs/ardour/ardour/export_handler.h @@ -71,27 +71,27 @@ class ExportElementFactory class ExportHandler : public ExportElementFactory, public sigc::trackable { private: - + /* Stuff for export configs * The multimap maps timespans to file specifications */ - + struct FileSpec { - + FileSpec (ChannelConfigPtr channel_config, FormatPtr format, FilenamePtr filename) : channel_config (channel_config), format (format), filename (filename) {} - + ChannelConfigPtr channel_config; FormatPtr format; FilenamePtr filename; }; - + typedef std::pair<TimespanPtr, FileSpec> ConfigPair; typedef std::multimap<TimespanPtr, FileSpec> ConfigMap; - + typedef boost::shared_ptr<ExportProcessor> ProcessorPtr; typedef boost::shared_ptr<ExportStatus> StatusPtr; @@ -102,7 +102,7 @@ class ExportHandler : public ExportElementFactory, public sigc::trackable friend boost::shared_ptr<ExportHandler> Session::get_export_handler(); ExportHandler (Session & session); - + public: ~ExportHandler (); @@ -115,62 +115,62 @@ class ExportHandler : public ExportElementFactory, public sigc::trackable ProcessorPtr processor; StatusPtr export_status; ConfigMap config_map; - + bool realtime; - + sigc::connection files_written_connection; std::list<Glib::ustring> files_written; - + /* CD Marker stuff */ - + struct CDMarkerStatus { CDMarkerStatus (std::string out_file, TimespanPtr timespan, FormatPtr format, std::string filename) : out (out_file.c_str()), timespan (timespan), format (format), filename (filename), track_number (1), track_position (0), track_duration (0), track_start_frame (0), index_number (1), index_position (0) {} - + /* General info */ std::ofstream out; TimespanPtr timespan; FormatPtr format; std::string filename; Location * marker; - + /* Track info */ uint32_t track_number; nframes_t track_position; nframes_t track_duration; nframes_t track_start_frame; - + /* Index info */ uint32_t index_number; nframes_t index_position; }; - - + + void export_cd_marker_file (TimespanPtr timespan, FormatPtr file_format, std::string filename, CDMarkerFormat format); - + void write_cue_header (CDMarkerStatus & status); void write_toc_header (CDMarkerStatus & status); - + void write_track_info_cue (CDMarkerStatus & status); void write_track_info_toc (CDMarkerStatus & status); void write_index_info_cue (CDMarkerStatus & status); void write_index_info_toc (CDMarkerStatus & status); - + void frames_to_cd_frames_string (char* buf, nframes_t when); - + int cue_tracknum; int cue_indexnum; - + /* Timespan management */ - + void start_timespan (); void finish_timespan (); void timespan_thread_finished (); - + typedef std::pair<ConfigMap::iterator, ConfigMap::iterator> TimespanBounds; TimespanPtr current_timespan; ConfigMap::iterator current_map_it; diff --git a/libs/ardour/ardour/export_multiplication.h b/libs/ardour/ardour/export_multiplication.h index c8fd20c60e..4826a35668 100644 --- a/libs/ardour/ardour/export_multiplication.h +++ b/libs/ardour/ardour/export_multiplication.h @@ -12,42 +12,42 @@ public: GraphNode (); virtual ~GraphNode (); - + uint32_t id() const { return _id; } - + /* Children and parents. Note: only children are kept in order! */ - + list<GraphNode *> const & get_parents () const { return parents; } - + void add_child (GraphNode * child, GraphNode * left_sibling); void remove_child (GraphNode * child); GraphNode * first_child () const { return children.front(); } GraphNode * last_child () const { return children.back(); } list<GraphNode *> const & get_children () const { return children; } - + /* Relation functions */ - + bool is_ancestor_of (GraphNode const * node) const; bool is_descendant_of (GraphNode const * node) const; bool equals (GraphNode const * node) const { return node == this; } - + /* Selection functions */ - + bool selected () const { return _selected; } void select (bool value); - + sigc::signal<void, bool> SelectChanged; - + protected: - + /* Parent manipulation functions should be used only from child manipulation functions! */ - + void add_parent (GraphNode * parent); void remove_parent (GraphNode * parent); - + list<GraphNode *> parents; list<GraphNode *> children; - + bool _selected; uint32_t _id; static uint32_t id_counter; @@ -60,10 +60,10 @@ typedef boost::shared_ptr<T> DataPtr; typedef boost::shared_ptr<DataNode<T> > SelfPtr; typedef boost::weak_ptr<DataNode<T> > WeakSelfPtr; - + DataNode (DataPtr data) : _data (data) {} void set_self_ptr (boost::shared_ptr<DataNode<T> > ptr) { _self_ptr = ptr; } - + public: static SelfPtr create (T * data) { @@ -71,14 +71,14 @@ ptr->set_self_ptr (ptr); return ptr; } - + static SelfPtr create (DataPtr data) { SelfPtr ptr = SelfPtr (new DataNode<T> (data)); ptr->set_self_ptr (ptr); return ptr; } - + DataPtr data() { return _data; } SelfPtr self_ptr () { return _self_ptr.lock(); } @@ -87,7 +87,7 @@ { parents.sort (NodeSorter<P> (sort_list)); } - + private: DataPtr _data; WeakSelfPtr _self_ptr; @@ -95,14 +95,14 @@ private: /* Sorts GraphNodes according to a list of DataNodes */ - + template<typename T> class NodeSorter { public: typedef list<boost::shared_ptr<DataNode<T> > > ListType; - + NodeSorter (ListType const & list) : list (list) {} - + bool operator() (GraphNode * one, GraphNode * other) // '<' operator { if (one == other) { return false; } // Strict weak ordering @@ -114,12 +114,12 @@ return false; } } - + std::cerr << "Invalid comparison list given to NodeSorter" << std::endl; - + abort(); } - + private: ListType const & list; }; @@ -129,16 +129,16 @@ typedef DataNode<TimespanState> TimespanNode; typedef boost::shared_ptr<TimespanNode> TimespanNodePtr; - + typedef DataNode<ChannelConfigState> ChannelConfigNode; typedef boost::shared_ptr<ChannelConfigNode> ChannelConfigNodePtr; - + typedef DataNode<FormatState> FormatNode; typedef boost::shared_ptr<FormatNode> FormatNodePtr; - + typedef DataNode<FilenameState> FilenameNode; typedef boost::shared_ptr<FilenameNode> FilenameNodePtr; - + struct MultiplicationGraph { list<TimespanNodePtr> timespans; list<ChannelConfigNodePtr> channel_configs; @@ -147,35 +147,35 @@ }; MultiplicationGraph const & get_graph () { return graph; } - + void split_node (GraphNode * node, float position); void remove_node (GraphNode * node); - + sigc::signal<void> GraphChanged; private: void purge_graph (); - + template<typename T> static void insert_after (list<T> & the_list, T const & position, T const & element); - + template<typename T> static void remove_by_element (list<T> & the_list, T const & element); - + bool nodes_have_one_common_child (list<GraphNode *> const & the_list); list<GraphNode *>::const_iterator end_of_common_child_range (list<GraphNode *> const & the_list, list<GraphNode *>::const_iterator beginning); void split_node_at_position (GraphNode * old_node, GraphNode * new_node, float position); - + void split_timespan (TimespanNodePtr node, float position = 0.5); void split_channel_config (ChannelConfigNodePtr node, float position = 0.5); void split_format (FormatNodePtr node, float position = 0.5); void split_filename (FilenameNodePtr node, float position = 0.5); - + void duplicate_timespan_children (TimespanNodePtr source, TimespanNodePtr target, GraphNode * insertion_point = 0); void duplicate_channel_config_children (ChannelConfigNodePtr source, ChannelConfigNodePtr target, GraphNode * insertion_point = 0); void duplicate_format_children (FormatNodePtr source, FormatNodePtr target, GraphNode * insertion_point = 0); - + TimespanNodePtr duplicate_timespan_node (TimespanNodePtr node); ChannelConfigNodePtr duplicate_channel_config_node (ChannelConfigNodePtr node); FormatNodePtr duplicate_format_node (FormatNodePtr node); diff --git a/libs/ardour/ardour/export_preset.h b/libs/ardour/ardour/export_preset.h index c518a208ea..b24cc70dcf 100644 --- a/libs/ardour/ardour/export_preset.h +++ b/libs/ardour/ardour/export_preset.h @@ -44,10 +44,10 @@ class ExportPreset { // Note: The set_..._state functions take ownership of the XMLNode void set_global_state (XMLNode & state); void set_local_state (XMLNode & state); - + XMLNode const * get_global_state () const { return global.root(); } XMLNode const * get_local_state () const { return local; } - + void save (std::string const & filename); void remove_local () const; @@ -65,7 +65,7 @@ class ExportPreset { Session & session; XMLTree global; XMLNode * local; - + }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/export_processor.h b/libs/ardour/ardour/export_processor.h index 832b200848..c2cb5034c7 100644 --- a/libs/ardour/ardour/export_processor.h +++ b/libs/ardour/ardour/export_processor.h @@ -43,22 +43,22 @@ class ExportProcessor { private: /* Typedefs for utility processors */ - + typedef boost::shared_ptr<SampleRateConverter> SRConverterPtr; typedef boost::shared_ptr<PeakReader> PReaderPtr; typedef boost::shared_ptr<Normalizer> NormalizerPtr; typedef boost::shared_ptr<ExportTempFile> TempFilePtr; - + typedef GraphSink<float> FloatSink; typedef boost::shared_ptr<FloatSink> FloatSinkPtr; typedef std::vector<FloatSinkPtr> FloatSinkVect; - + typedef boost::shared_ptr<ExportFilename> FilenamePtr; typedef boost::shared_ptr<ExportFormatSpecification const> FormatPtr; - + typedef boost::shared_ptr<ExportFileWriter> FileWriterPtr; typedef std::list<FileWriterPtr> FileWriterList; - + public: ExportProcessor (Session & session); @@ -70,27 +70,27 @@ class ExportProcessor * @return 0 on success */ int prepare (FormatPtr format, FilenamePtr fname, uint32_t chans, bool split = false, nframes_t start = 0); - + /// Process data /** @param frames frames to process @return frames written **/ nframes_t process (float * data, nframes_t frames); - + /** should be called after all data is given to process **/ void prepare_post_processors (); - + void write_files (); - + static sigc::signal<void, Glib::ustring> WritingFile; - + private: - + void reset (); - + Session & session; boost::shared_ptr<ExportStatus> status; - + /* these are initalized in prepare() */ - + FilenamePtr filename; NormalizerPtr normalizer; SRConverterPtr src; @@ -98,15 +98,15 @@ class ExportProcessor TempFilePtr temp_file; FloatSinkVect file_sinks; FileWriterList writer_list; - + /* general info */ - + uint32_t channels; nframes_t blocksize; nframes_t frame_rate; - + /* Processing */ - + bool tag; bool broadcast_info; bool split_files; @@ -115,9 +115,9 @@ class ExportProcessor bool trim_end; nframes_t silence_beginning; nframes_t silence_end; - + /* Progress info */ - + nframes_t temp_file_position; nframes_t temp_file_length; }; diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h index bf261cad46..b402550a64 100644 --- a/libs/ardour/ardour/export_profile_manager.h +++ b/libs/ardour/ardour/export_profile_manager.h @@ -61,10 +61,10 @@ class ExportProfileManager void load_profile (); void prepare_for_export (); - + typedef boost::shared_ptr<ExportPreset> PresetPtr; typedef std::list<PresetPtr> PresetList; - + PresetList const & get_presets () { return preset_list; } bool load_preset (PresetPtr preset); PresetPtr save_preset (std::string const & name); @@ -75,27 +75,27 @@ class ExportProfileManager typedef std::pair<PBD::UUID, PBD::sys::path> FilePair; typedef std::map<PBD::UUID, PBD::sys::path> FileMap; - + HandlerPtr handler; Session & session; - + void load_presets (); void load_preset_from_disk (PBD::sys::path const & path); - + bool set_state (XMLNode const & root); bool set_global_state (XMLNode const & root); bool set_local_state (XMLNode const & root); - + void serialize_profile (XMLNode & root); void serialize_global_profile (XMLNode & root); void serialize_local_profile (XMLNode & root); - + PresetList preset_list; PresetPtr current_preset; FileMap preset_file_map; - + std::vector<PBD::sys::path> find_file (std::string const & pattern); - + PBD::sys::path export_config_dir; PBD::SearchPath search_path; @@ -118,47 +118,47 @@ class ExportProfileManager struct TimespanState { TimespanListPtr timespans; TimeFormat time_format; - + boost::shared_ptr<Location> session_range; boost::shared_ptr<Location> selection_range; boost::shared_ptr<LocationList> ranges; - + TimespanState (boost::shared_ptr<Location> session_range, boost::shared_ptr<Location> selection_range, boost::shared_ptr<LocationList> ranges) : timespans (new TimespanList ()), time_format (SMPTE), - + session_range (session_range), selection_range (selection_range), ranges (ranges) {} }; - + typedef boost::shared_ptr<TimespanState> TimespanStatePtr; typedef std::list<TimespanStatePtr> TimespanStateList; - + void set_selection_range (nframes_t start = 0, nframes_t end = 0); std::string set_single_range (nframes_t start, nframes_t end, Glib::ustring name); TimespanStateList const & get_timespans () { return check_list (timespans); } - + private: TimespanStateList timespans; bool init_timespans (XMLNodeList nodes); - + TimespanStatePtr deserialize_timespan (XMLNode & root); XMLNode & serialize_timespan (TimespanStatePtr state); - + /* Locations */ - + void update_ranges (); - + boost::shared_ptr<Location> session_range; boost::shared_ptr<Location> selection_range; boost::shared_ptr<LocationList> ranges; - + bool single_range_mode; boost::shared_ptr<Location> single_range; @@ -169,12 +169,12 @@ class ExportProfileManager struct ChannelConfigState { ChannelConfigPtr config; - + ChannelConfigState (ChannelConfigPtr ptr) : config (ptr) {} }; typedef boost::shared_ptr<ChannelConfigState> ChannelConfigStatePtr; typedef std::list<ChannelConfigStatePtr> ChannelConfigStateList; - + ChannelConfigStateList const & get_channel_configs () { return check_list (channel_configs); } private: @@ -192,21 +192,21 @@ class ExportProfileManager struct FormatState { boost::shared_ptr<FormatList const> list; FormatPtr format; - + FormatState (boost::shared_ptr<FormatList const> list, FormatPtr format) : list (list), format (format) {} }; typedef boost::shared_ptr<FormatState> FormatStatePtr; typedef std::list<FormatStatePtr> FormatStateList; - + FormatStateList const & get_formats () { return check_list (formats); } FormatStatePtr duplicate_format_state (FormatStatePtr state); void remove_format_state (FormatStatePtr state); - + PBD::sys::path save_format_to_disk (FormatPtr format); void remove_format_profile (FormatPtr format); FormatPtr get_new_format (FormatPtr original); - + sigc::signal<void> FormatListChanged; private: @@ -218,26 +218,26 @@ class ExportProfileManager XMLNode & serialize_format (FormatStatePtr state); void load_formats (); - + FormatPtr load_format (XMLNode & node); void load_format_from_disk (PBD::sys::path const & path); boost::shared_ptr<FormatList> format_list; FileMap format_file_map; - + /* Filenames */ public: - + typedef boost::shared_ptr<ExportFilename> FilenamePtr; - + struct FilenameState { FilenamePtr filename; - + FilenameState (FilenamePtr ptr) : filename (ptr) {} }; typedef boost::shared_ptr<FilenameState> FilenameStatePtr; typedef std::list<FilenameStatePtr> FilenameStateList; - + FilenameStateList const & get_filenames () { return check_list (filenames); } FilenameStatePtr duplicate_filename_state (FilenameStatePtr state); void remove_filename_state (FilenameStatePtr state); @@ -245,7 +245,7 @@ class ExportProfileManager private: FilenameStateList filenames; - + bool init_filenames (XMLNodeList nodes); FilenamePtr load_filename (XMLNode & node); @@ -256,9 +256,9 @@ class ExportProfileManager std::list<Glib::ustring> warnings; std::list<Glib::ustring> conflicting_filenames; }; - + boost::shared_ptr<Warnings> get_warnings (); - + private: void check_config (boost::shared_ptr<Warnings> warnings, TimespanStatePtr timespan_state, diff --git a/libs/ardour/ardour/export_status.h b/libs/ardour/ardour/export_status.h index 42b0b061f0..3322ca639c 100644 --- a/libs/ardour/ardour/export_status.h +++ b/libs/ardour/ardour/export_status.h @@ -40,40 +40,40 @@ struct ExportStatus : public sigc::trackable { ExportStatus (); void init (); - + /* Status info */ - + volatile bool stop; volatile bool running; - + sigc::signal<void> Aborting; void abort (bool error_occurred = false); bool aborted () const { return _aborted; } bool errors () const { return _errors; } - + sigc::signal<void> Finished; void finish (); bool finished () const { return _finished; } - + /* Progress info */ - + volatile ExportStage stage; volatile float progress; - + volatile uint32_t total_timespans; volatile uint32_t timespan; - + volatile uint32_t total_channel_configs; volatile uint32_t channel_config; - + volatile uint32_t total_formats; volatile uint32_t format; - + private: volatile bool _aborted; volatile bool _errors; volatile bool _finished; - + }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/export_timespan.h b/libs/ardour/ardour/export_timespan.h index 8c1ce10730..255d1e377d 100644 --- a/libs/ardour/ardour/export_timespan.h +++ b/libs/ardour/ardour/export_timespan.h @@ -47,30 +47,30 @@ class ExportTimespan : public sigc::trackable private: friend class ExportElementFactory; ExportTimespan (ExportStatusPtr status, nframes_t frame_rate); - + public: ~ExportTimespan (); - + Glib::ustring name () const { return _name; } void set_name (Glib::ustring name) { _name = name; } - + Glib::ustring range_id () const { return _range_id; } void set_range_id (Glib::ustring range_id) { _range_id = range_id; } - + /// Registers a channel to be read when export starts rolling void register_channel (ExportChannelPtr channel); - + /// "Rewinds" the tempfiles to start reading the beginnings again void rewind (); - + /// Reads data from the tempfile belonging to channel into data nframes_t get_data (float * data, nframes_t frames, ExportChannelPtr channel); - + /// Reads data from each channel and writes to tempfile int process (nframes_t frames); - + sigc::connection process_connection; - + void set_range (nframes_t start, nframes_t end); nframes_t get_length () const { return end_frame - start_frame; } nframes_t get_start () const { return start_frame; } @@ -86,7 +86,7 @@ class ExportTimespan : public sigc::trackable nframes_t frame_rate; TempFileMap filemap; - + Glib::ustring _name; Glib::ustring _range_id; diff --git a/libs/ardour/ardour/export_utilities.h b/libs/ardour/ardour/export_utilities.h index a9044345a6..5733ebb403 100644 --- a/libs/ardour/ardour/export_utilities.h +++ b/libs/ardour/ardour/export_utilities.h @@ -44,22 +44,22 @@ class SampleRateConverter : public GraphSinkVertex<float, float> protected: nframes_t process (float * data, nframes_t frames); - + private: bool active; uint32_t channels; - + nframes_t leftover_frames; nframes_t max_leftover_frames; nframes_t frames_in; nframes_t frames_out; - + float * data_in; float * leftover_data; - + float * data_out; nframes_t data_out_size; - + SRC_DATA src_data; SRC_STATE* src_state; }; @@ -72,21 +72,21 @@ class SampleFormatConverter : public GraphSinkVertex<float, TOut> public: SampleFormatConverter (uint32_t channels, ExportFormatBase::DitherType type = ExportFormatBase::D_None, int data_width_ = 0); ~SampleFormatConverter (); - + void set_clip_floats (bool yn) { clip_floats = yn; } - + protected: nframes_t process (float * data, nframes_t frames); - + private: uint32_t channels; int data_width; GDither dither; nframes_t data_out_size; TOut * data_out; - + bool clip_floats; - + }; /* Peak reader */ @@ -96,16 +96,16 @@ class PeakReader : public GraphSinkVertex<float, float> public: PeakReader (uint32_t channels) : channels (channels), peak (0) {} ~PeakReader () {} - + float get_peak () { return peak; } - + protected: nframes_t process (float * data, nframes_t frames) { peak = compute_peak (data, channels * frames, peak); return piped_to->write (data, frames); } - + private: uint32_t channels; float peak; @@ -118,15 +118,15 @@ class Normalizer : public GraphSinkVertex<float, float> public: Normalizer (uint32_t channels, float target_dB); ~Normalizer (); - + void set_peak (float peak); - + protected: nframes_t process (float * data, nframes_t frames); - + private: uint32_t channels; - + bool enabled; gain_t target; gain_t gain; diff --git a/libs/ardour/ardour/file_source.h b/libs/ardour/ardour/file_source.h index 82a54094ef..7844bb513a 100644 --- a/libs/ardour/ardour/file_source.h +++ b/libs/ardour/ardour/file_source.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006-2009 Paul Davis + Copyright (C) 2006-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ -#ifndef __ardour_filesource_h__ +#ifndef __ardour_filesource_h__ #define __ardour_filesource_h__ #include <exception> @@ -37,11 +37,11 @@ public: const Glib::ustring& path() const { return _path; } virtual bool safe_file_extension (const Glib::ustring& path) const = 0; - + int move_to_trash (const Glib::ustring& trash_dir_name); void mark_take (const Glib::ustring& id); void mark_immutable (); - + const Glib::ustring& take_id () const { return _take_id; } bool is_embedded () const { return _is_embedded; } uint16_t channel() const { return _channel; } @@ -49,24 +49,24 @@ public: int set_state (const XMLNode&); int set_source_name (const Glib::ustring& newname, bool destructive); - + static void set_search_path (DataType type, const Glib::ustring& path); static bool find (DataType type, const Glib::ustring& path, - bool must_exist, bool& is_new, uint16_t& chan, - Glib::ustring& found_path); + bool must_exist, bool& is_new, uint16_t& chan, + Glib::ustring& found_path); protected: FileSource (Session& session, DataType type, const Glib::ustring& path, bool embedded, Source::Flag flags = Source::Flag(0)); - + FileSource (Session& session, const XMLNode& node, bool must_exist); virtual int init (const Glib::ustring& idstr, bool must_exist); - + virtual int move_dependents_to_trash() { return 0; } - + bool removable () const; Glib::ustring _path; diff --git a/libs/ardour/ardour/filesystem_paths.h b/libs/ardour/ardour/filesystem_paths.h index 7e14c9a4fa..e183193cb0 100644 --- a/libs/ardour/ardour/filesystem_paths.h +++ b/libs/ardour/ardour/filesystem_paths.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Tim Mayberry + Copyright (C) 2007 Tim Mayberry This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/filter.h b/libs/ardour/ardour/filter.h index ad0c7d268c..697e19539e 100644 --- a/libs/ardour/ardour/filter.h +++ b/libs/ardour/ardour/filter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -42,7 +42,7 @@ class Filter { int make_new_sources (boost::shared_ptr<ARDOUR::Region>, ARDOUR::SourceList&, std::string suffix = ""); int finish (boost::shared_ptr<ARDOUR::Region>, ARDOUR::SourceList&, std::string region_name = ""); - + ARDOUR::Session& session; }; diff --git a/libs/ardour/ardour/gain.h b/libs/ardour/ardour/gain.h index 207f794910..785475444a 100644 --- a/libs/ardour/ardour/gain.h +++ b/libs/ardour/ardour/gain.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/gdither_types_internal.h b/libs/ardour/ardour/gdither_types_internal.h index e73a256310..6cb0c48af9 100644 --- a/libs/ardour/ardour/gdither_types_internal.h +++ b/libs/ardour/ardour/gdither_types_internal.h @@ -25,7 +25,7 @@ #ifdef __cplusplus extern "C" { #endif - + #define GDITHER_SH_BUF_SIZE 8 #define GDITHER_SH_BUF_MASK 7 diff --git a/libs/ardour/ardour/graph.h b/libs/ardour/ardour/graph.h index c0e29b6735..5d6919f56e 100644 --- a/libs/ardour/ardour/graph.h +++ b/libs/ardour/ardour/graph.h @@ -34,10 +34,10 @@ class GraphSink { public: GraphSink () : end_of_input (false) {} virtual ~GraphSink () { end_of_input = false; } - + // writes data and return number of frames written virtual nframes_t write (T * data, nframes_t frames) = 0; - + // Notifies end of input. All left over data must be written at this stage virtual void set_end_of_input (bool state = true) { @@ -54,7 +54,7 @@ class GraphSource { public: GraphSource () {} virtual ~GraphSource () {} - + virtual nframes_t read (T * data, nframes_t frames) = 0; }; @@ -64,19 +64,19 @@ class GraphSinkVertex : public GraphSink<TIn> { public: GraphSinkVertex () {} virtual ~GraphSinkVertex () {} - + void pipe_to (boost::shared_ptr<GraphSink<TOut> > dest) { piped_to = dest; } - + nframes_t write (TIn * data, nframes_t frames) { if (!piped_to) { return -1; } return process (data, frames); - } - + } + virtual void set_end_of_input (bool state = true) { if (!piped_to) { @@ -85,10 +85,10 @@ class GraphSinkVertex : public GraphSink<TIn> { piped_to->set_end_of_input (state); GraphSink<TIn>::end_of_input = state; } - + protected: boost::shared_ptr<GraphSink<TOut> > piped_to; - + /* process must process data, use piped_to->write to write the data and return number of frames written */ diff --git a/libs/ardour/ardour/importable_source.h b/libs/ardour/ardour/importable_source.h index 26c840b60f..801e7888a9 100644 --- a/libs/ardour/ardour/importable_source.h +++ b/libs/ardour/ardour/importable_source.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h index 384f2900d8..4d2839cb12 100644 --- a/libs/ardour/ardour/internal_return.h +++ b/libs/ardour/ardour/internal_return.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ namespace ARDOUR { class InternalReturn : public Return { - public: + public: InternalReturn (Session&); InternalReturn (Session&, const XMLNode&); diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h index 4cca8e2c89..ef7d3d3d54 100644 --- a/libs/ardour/ardour/internal_send.h +++ b/libs/ardour/ardour/internal_send.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ namespace ARDOUR { class InternalSend : public Send { - public: + public: InternalSend (Session&, boost::shared_ptr<MuteMaster>, boost::shared_ptr<Route> send_to, Delivery::Role role); InternalSend (Session&, boost::shared_ptr<MuteMaster>, const XMLNode&); virtual ~InternalSend (); @@ -39,7 +39,7 @@ class InternalSend : public Send XMLNode& state(bool full); XMLNode& get_state(void); int set_state(const XMLNode& node); - + void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes); bool feeds (boost::shared_ptr<Route> other) const; bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const; diff --git a/libs/ardour/ardour/interpolation.h b/libs/ardour/ardour/interpolation.h index cdd3bfc1b5..2b777ac840 100644 --- a/libs/ardour/ardour/interpolation.h +++ b/libs/ardour/ardour/interpolation.h @@ -12,22 +12,22 @@ class Interpolation { protected: double _speed, _target_speed; - // the idea is that when the speed is not 1.0, we have to - // interpolate between samples and then we have to store where we thought we were. + // the idea is that when the speed is not 1.0, we have to + // interpolate between samples and then we have to store where we thought we were. // rather than being at sample N or N+1, we were at N+0.8792922 std::vector<double> phase; - + public: Interpolation () { _speed = 1.0; _target_speed = 1.0; } ~Interpolation () { phase.clear(); } - + void set_speed (double new_speed) { _speed = new_speed; _target_speed = new_speed; } void set_target_speed (double new_speed) { _target_speed = new_speed; } double target_speed() const { return _target_speed; } double speed() const { return _speed; } - + void add_channel_to (int /*input_buffer_size*/, int /*output_buffer_size*/) { phase.push_back (0.0); } void remove_channel_from () { phase.pop_back (); } @@ -40,7 +40,7 @@ class Interpolation { class LinearInterpolation : public Interpolation { protected: - + public: nframes_t interpolate (int channel, nframes_t nframes, Sample* input, Sample* output); }; @@ -55,11 +55,11 @@ class CubicInterpolation : public Interpolation { fr * (4.0f * inp1 + 2.0f * inm1 - 5.0f * in - inp2 + fr * (3.0f * (in - inp1) - inm1 + inp2))); } - + public: nframes_t interpolate (int channel, nframes_t nframes, Sample* input, Sample* output); }; - + } // namespace ARDOUR #endif diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 858302442e..0be1493dbb 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ #include "pbd/fastlog.h" #include "pbd/undo.h" -#include "pbd/statefuldestructible.h" +#include "pbd/statefuldestructible.h" #include "pbd/controllable.h" #include "ardour/ardour.h" @@ -78,7 +78,7 @@ class IO : public SessionObject, public Latent IO (Session&, const std::string& name, Direction, DataType default_type = DataType::AUDIO); IO (Session&, const XMLNode&, DataType default_type = DataType::AUDIO); - + virtual ~IO(); Direction direction() const { return _direction; } @@ -88,7 +88,7 @@ class IO : public SessionObject, public Latent bool active() const { return _active; } void set_active(bool yn) { _active = yn; } - + bool set_name (const std::string& str); virtual void silence (nframes_t); @@ -101,7 +101,7 @@ class IO : public SessionObject, public Latent BundleList bundles_connected (); boost::shared_ptr<Bundle> bundle () { return _bundle; } - + int add_port (std::string connection, void *src, DataType type = DataType::NIL); int remove_port (Port *, void *src); int connect (Port *our_port, std::string other_port, void *src); @@ -143,7 +143,7 @@ class IO : public SessionObject, public Latent static int enable_connecting (void); static int disable_ports (void); static int enable_ports (void); - + static sigc::signal<void,ChanCount> PortCountChanged; // emitted when the number of ports changes static std::string name_from_state (const XMLNode&); @@ -156,7 +156,7 @@ class IO : public SessionObject, public Latent static bool connecting_legal; XMLNode *pending_state_node; - + /* three utility functions - this just seems to be simplest place to put them */ void collect_input (BufferSet& bufs, nframes_t nframes, ChanCount offset); @@ -175,7 +175,7 @@ class IO : public SessionObject, public Latent Direction _direction; DataType _default_type; bool _active; - + private: int connecting_became_legal (); @@ -185,16 +185,16 @@ class IO : public SessionObject, public Latent struct UserBundleInfo { UserBundleInfo (IO*, boost::shared_ptr<UserBundle> b); - + boost::shared_ptr<UserBundle> bundle; sigc::connection changed; }; - + std::vector<UserBundleInfo> _bundles_connected; ///< user bundles connected to our ports static int parse_io_string (const std::string&, std::vector<std::string>& chns); static int parse_gain_string (const std::string&, std::vector<std::string>& chns); - + int ensure_ports (ChanCount, bool clear, bool lockit, void *src); void check_bundles_connected (); diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h index d591962733..dc376b9a42 100644 --- a/libs/ardour/ardour/io_processor.h +++ b/libs/ardour/ardour/io_processor.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,12 +45,12 @@ class IOProcessor : public Processor { public: IOProcessor (Session&, bool with_input, bool with_output, - const std::string& proc_name, const std::string io_name="", - ARDOUR::DataType default_type = DataType::AUDIO); + const std::string& proc_name, const std::string io_name="", + ARDOUR::DataType default_type = DataType::AUDIO); IOProcessor (Session&, boost::shared_ptr<IO> input, boost::shared_ptr<IO> output, - const std::string& proc_name, ARDOUR::DataType default_type = DataType::AUDIO); + const std::string& proc_name, ARDOUR::DataType default_type = DataType::AUDIO); virtual ~IOProcessor (); - + bool set_name (const std::string& str); virtual ChanCount natural_output_streams() const; @@ -62,7 +62,7 @@ class IOProcessor : public Processor boost::shared_ptr<const IO> output() const { return _output; } void set_input (boost::shared_ptr<IO>); void set_output (boost::shared_ptr<IO>); - + void silence (nframes_t nframes); void disconnect (); @@ -70,10 +70,10 @@ class IOProcessor : public Processor sigc::signal<void,IOProcessor*,bool> AutomationPlaybackChanged; sigc::signal<void,IOProcessor*,uint32_t> AutomationChanged; - + XMLNode& state (bool full_state); int set_state (const XMLNode&); - + protected: boost::shared_ptr<IO> _input; boost::shared_ptr<IO> _output; diff --git a/libs/ardour/ardour/jack_port.h b/libs/ardour/ardour/jack_port.h index 30ffdd9d76..3101ce9523 100644 --- a/libs/ardour/ardour/jack_port.h +++ b/libs/ardour/ardour/jack_port.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,22 +37,22 @@ class JackPort : public virtual Port, public PortConnectableByName { ~JackPort(); - std::string short_name() const { + std::string short_name() const { return jack_port_short_name (_port); } - + int set_name (const std::string& str); - + bool connected () const { return jack_port_connected (_port); } - + int reestablish (); int reconnect (); int connect (Port& other) { - if( _flags & IsOutput ) { - return 0; + if (_flags & IsOutput) { + return 0; } return connect (other.name()); } @@ -73,7 +73,7 @@ class JackPort : public virtual Port, public PortConnectableByName { } int get_connections (std::vector<std::string>& names) const; - + bool monitoring_input () const { return jack_port_monitoring_input (_port); } @@ -104,12 +104,12 @@ class JackPort : public virtual Port, public PortConnectableByName { JackPort (const std::string&, DataType type, Flags flags); jack_port_t* _port; - int disconnect (); + int disconnect (); void recompute_total_latency() const; std::set<std::string> _named_connections; }; - + } // namespace ARDOUR #endif /* __ardour_jack_port_h__ */ diff --git a/libs/ardour/ardour/ladspa.h b/libs/ardour/ardour/ladspa.h index e552f35bb5..c6d7ddd0ff 100644 --- a/libs/ardour/ardour/ladspa.h +++ b/libs/ardour/ardour/ladspa.h @@ -3,17 +3,17 @@ Linux Audio Developer's Simple Plugin API Version 1.1[LGPL]. Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis, Stefan Westerfeld. - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -32,7 +32,7 @@ extern "C" { /*****************************************************************************/ -/* Overview: +/* Overview: There is a large number of synthesis packages in use or development on the Linux platform at this time. This API (`The Linux Audio @@ -76,7 +76,7 @@ extern "C" { /* Fundamental data type passed in and out of plugin. This data type is used to communicate audio samples and control values. It is assumed that the plugin will work sensibly given any numeric input - value although it may have a preferred range (see hints below). + value although it may have a preferred range (see hints below). For audio it is generally assumed that 1.0f is the `0dB' reference amplitude and is a `normal' signal level. */ @@ -85,8 +85,8 @@ typedef float LADSPA_Data; /*****************************************************************************/ -/* Special Plugin Properties: - +/* Special Plugin Properties: + Optional features of the plugin type are encapsulated in the LADSPA_Properties type. This is assembled by ORing individual properties together. */ @@ -123,7 +123,7 @@ typedef int LADSPA_Properties; (3) The plugin will not access files, devices, pipes, sockets, IPC or any other mechanism that might result in process or thread blocking. - + (4) The plugin will take an amount of time to execute a run() or run_adding() call approximately of form (A+B*SampleCount) where A and B depend on the machine and host in use. This amount of time @@ -138,7 +138,7 @@ typedef int LADSPA_Properties; /*****************************************************************************/ -/* Plugin Ports: +/* Plugin Ports: Plugins have `ports' that are inputs or outputs for audio or data. Ports can communicate arrays of LADSPA_Data (for audio @@ -174,23 +174,23 @@ typedef int LADSPA_PortDescriptor; /*****************************************************************************/ -/* Plugin Port Range Hints: +/* Plugin Port Range Hints: The host may wish to provide a representation of data entering or leaving a plugin (e.g. to generate a GUI automatically). To make this more meaningful, the plugin should provide `hints' to the host describing the usual values taken by the data. - + Note that these are only hints. The host may ignore them and the plugin must not assume that data supplied to it is meaningful. If the plugin receives invalid input data it is expected to continue to run without failure and, where possible, produce a sensible output (e.g. a high-pass filter given a negative cutoff frequency might switch to an all-pass mode). - + Hints are meaningful for all input and output ports but hints for input control ports are expected to be particularly useful. - + More hint information is encapsulated in the LADSPA_PortRangeHintDescriptor type which is assembled by ORing individual hint types together. Hints may require further @@ -356,7 +356,7 @@ typedef struct _LADSPA_PortRangeHint { /*****************************************************************************/ -/* Plugin Handles: +/* Plugin Handles: This plugin handle indicates a particular instance of the plugin concerned. It is valid to compare this to NULL (0 for C++) but @@ -367,13 +367,13 @@ typedef void * LADSPA_Handle; /*****************************************************************************/ -/* Descriptor for a Type of Plugin: +/* Descriptor for a Type of Plugin: This structure is used to describe a plugin type. It provides a number of functions to examine the type, instantiate it, link it to buffers and workspaces and to run it. */ -typedef struct _LADSPA_Descriptor { +typedef struct _LADSPA_Descriptor { /* This numeric identifier indicates the plugin type uniquely. Plugin programmers may reserve ranges of IDs from a @@ -433,7 +433,7 @@ typedef struct _LADSPA_Descriptor { instantiation function accepts a sample rate as a parameter. The plugin descriptor from which this instantiate function was found must also be passed. This function must return NULL if - instantiation fails. + instantiation fails. Note that instance initialisation should generally occur in activate() rather than here. */ @@ -554,7 +554,7 @@ typedef struct _LADSPA_Descriptor { /* Once an instance of a plugin has been finished with it can be deleted using the following function. The instance handle passed ceases to be valid after this call. - + If activate() was called for a plugin instance then a corresponding call to deactivate() must be made before cleanup() is called. */ @@ -592,7 +592,7 @@ typedef struct _LADSPA_Descriptor { const LADSPA_Descriptor * ladspa_descriptor(unsigned long Index); /* Datatype corresponding to the ladspa_descriptor() function. */ -typedef const LADSPA_Descriptor * +typedef const LADSPA_Descriptor * (*LADSPA_Descriptor_Function)(unsigned long Index); /**********************************************************************/ diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index b610a87567..8128fccf94 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ #include <sigc++/signal.h> -#include "pbd/stateful.h" +#include "pbd/stateful.h" #include <jack/types.h> #include "ardour/ladspa.h" @@ -45,7 +45,7 @@ class LadspaPlugin : public ARDOUR::Plugin ~LadspaPlugin (); /* Plugin interface */ - + std::string unique_id() const; const char* label() const { return _descriptor->Label; } const char* name() const { return _descriptor->Name; } @@ -57,10 +57,10 @@ class LadspaPlugin : public ARDOUR::Plugin float get_parameter (uint32_t port) const; int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; uint32_t nth_parameter (uint32_t port, bool& ok) const; - + std::set<Evoral::Parameter> automatable() const; - void activate () { + void activate () { if (!_was_activated && _descriptor->activate) _descriptor->activate (_handle); @@ -83,7 +83,7 @@ class LadspaPlugin : public ARDOUR::Plugin } void set_block_size (nframes_t /*nframes*/) {} - + int connect_and_run (BufferSet& bufs, ChanMapping in, ChanMapping out, nframes_t nframes, nframes_t offset); @@ -105,7 +105,7 @@ class LadspaPlugin : public ARDOUR::Plugin bool has_editor() const { return false; } int require_output_streams (uint32_t); - + /* LADSPA extras */ LADSPA_Properties properties() const { return _descriptor->Properties; } @@ -114,7 +114,7 @@ class LadspaPlugin : public ARDOUR::Plugin LADSPA_PortDescriptor port_descriptor(uint32_t i) const { return _descriptor->PortDescriptors[i]; } const LADSPA_PortRangeHint* port_range_hints() const { return _descriptor->PortRangeHints; } const char * const * port_names() const { return _descriptor->PortNames; } - + void set_gain (float gain) { _descriptor->set_run_adding_gain (_handle, gain); } void run_adding (uint32_t nsamples) { _descriptor->run_adding (_handle, nsamples); } void connect_port (uint32_t port, float *ptr) { _descriptor->connect_port (_handle, port, ptr); } @@ -136,7 +136,7 @@ class LadspaPlugin : public ARDOUR::Plugin }; class LadspaPluginInfo : public PluginInfo { - public: + public: LadspaPluginInfo () { }; ~LadspaPluginInfo () { }; diff --git a/libs/ardour/ardour/latent.h b/libs/ardour/ardour/latent.h index c5dc792f06..d1e62aaf45 100644 --- a/libs/ardour/ardour/latent.h +++ b/libs/ardour/ardour/latent.h @@ -13,8 +13,8 @@ class Latent { virtual nframes_t signal_latency() const = 0; nframes_t user_latency () const { return _user_latency; } - nframes_t effective_latency() const { - if (_user_latency) { + nframes_t effective_latency() const { + if (_user_latency) { return _user_latency; } else { return signal_latency (); diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index b008a62f18..2a583719cc 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,8 +31,8 @@ #include <glibmm/thread.h> #include "pbd/undo.h" -#include "pbd/stateful.h" -#include "pbd/statefuldestructible.h" +#include "pbd/stateful.h" +#include "pbd/statefuldestructible.h" #include "ardour/ardour.h" @@ -53,16 +53,16 @@ class Location : public PBD::StatefulDestructible }; Location (nframes64_t sample_start, - nframes64_t sample_end, - const std::string &name, - Flags bits = Flags(0)) - + nframes64_t sample_end, + const std::string &name, + Flags bits = Flags(0)) + : _name (name), _start (sample_start), _end (sample_end), _flags (bits), _locked (false) { } - + Location () { _start = 0; _end = 0; @@ -77,7 +77,7 @@ class Location : public PBD::StatefulDestructible bool locked() const { return _locked; } void lock() { _locked = true; changed (this); } void unlock() { _locked = false; changed (this); } - + nframes64_t start() const { return _start; } nframes64_t end() const { return _end; } nframes64_t length() const { return _end - _start; } @@ -118,7 +118,7 @@ class Location : public PBD::StatefulDestructible /* this is sent only when both start&end change at the same time */ sigc::signal<void,Location*> changed; - + /* CD Track / CD-Text info */ std::map<std::string, std::string> cd_info; @@ -145,7 +145,7 @@ class Locations : public PBD::StatefulDestructible Locations (); ~Locations (); - + const LocationList& list() { return locations; } void add (Location *, bool make_current = false); diff --git a/libs/ardour/ardour/location_importer.h b/libs/ardour/ardour/location_importer.h index 37895dbc97..2b6f1ec1c2 100644 --- a/libs/ardour/ardour/location_importer.h +++ b/libs/ardour/ardour/location_importer.h @@ -56,7 +56,7 @@ class LocationImporter : public ElementImporter LocationImportHandler & handler; XMLNode xml_location; Location * location; - + void parse_xml (); }; diff --git a/libs/ardour/ardour/logcurve.h b/libs/ardour/ardour/logcurve.h index b3f3b2a90a..a5f0ce4734 100644 --- a/libs/ardour/ardour/logcurve.h +++ b/libs/ardour/ardour/logcurve.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Steve Harris & Paul Davis + Copyright (C) 2001 Steve Harris & Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,22 +41,22 @@ class LogCurve { bool operator!= (const LogCurve& other) const { return S != other.S || l != other.l; } - + float value (float frac) const { return (fast_log(frac + S) - a) * b; - } - + } + float value (uint32_t pos) const { return (fast_log(((float) pos/l) + S) - a) * b; - } + } float invert_value (float frac) const { return (a - fast_log(frac + S)) * b; - } - + } + float invert_value (uint32_t pos) const { return (a - fast_log(((float) pos/l) + S)) * b; - } + } void fill (float *vec, uint32_t veclen, bool invert) const { float dx = 1.0f/veclen; @@ -85,10 +85,10 @@ class LogCurve { float steepness() const { return S; } uint32_t length() const { return l; } - - void set_steepness (float steepness) { - S = steepness; - a = log(S); + + void set_steepness (float steepness) { + S = steepness; + a = log(S); b = 1.0f / log(1.0f + (1.0f / S)); } void set_length (uint32_t len) { l = len; } @@ -102,25 +102,25 @@ class LogCurve { uint32_t l; }; -class LogCurveIn : public LogCurve +class LogCurveIn : public LogCurve { public: - LogCurveIn (float steepness = 0.2, uint32_t len = 0) + LogCurveIn (float steepness = 0.2, uint32_t len = 0) : LogCurve (steepness, len) {} float value (float frac) const { return (fast_log(frac + S) - a) * b; - } - + } + float value (uint32_t pos) const { return (fast_log(((float) pos/l) + S) - a) * b; - } + } }; -class LogCurveOut : public LogCurve +class LogCurveOut : public LogCurve { public: - LogCurveOut (float steepness = 0.2, uint32_t len = 0) + LogCurveOut (float steepness = 0.2, uint32_t len = 0) : LogCurve (steepness, len) {} }; diff --git a/libs/ardour/ardour/lv2_event_buffer.h b/libs/ardour/ardour/lv2_event_buffer.h index 9d35d36d55..076ccc1dd4 100644 --- a/libs/ardour/ardour/lv2_event_buffer.h +++ b/libs/ardour/ardour/lv2_event_buffer.h @@ -1,17 +1,17 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -33,9 +33,9 @@ public: inline LV2_Event_Buffer* data() { return _data; } inline const LV2_Event_Buffer* data() const { return _data; } - + inline void rewind() const { lv2_event_begin(&_iter, _data); } - + inline void reset() { _latest_frames = 0; _latest_subframes = 0; @@ -43,7 +43,7 @@ public: _data->size = 0; rewind(); } - + inline size_t event_count() const { return _data->event_count; } inline uint32_t capacity() const { return _data->capacity; } inline uint32_t size() const { return _data->size; } diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index e354599485..de42512cfe 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -28,7 +28,7 @@ #include <sigc++/signal.h> -#include "pbd/stateful.h" +#include "pbd/stateful.h" #include <jack/types.h> #include <slv2/slv2.h> @@ -48,7 +48,7 @@ class LV2Plugin : public ARDOUR::Plugin ~LV2Plugin (); /* Plugin interface */ - + std::string unique_id() const; const char* label() const { return slv2_value_as_string(_name); } const char* name() const { return slv2_value_as_string(_name); } @@ -69,12 +69,12 @@ class LV2Plugin : public ARDOUR::Plugin SLV2Port slv2_port(uint32_t i) { return slv2_plugin_get_port_by_index(_plugin, i); } const char* port_symbol(uint32_t port); - + const LV2_Feature* const* features() { return _features; } std::set<Evoral::Parameter> automatable() const; - void activate () { + void activate () { if (!_was_activated) { slv2_instance_activate(_instance); _was_activated = true; @@ -96,7 +96,7 @@ class LV2Plugin : public ARDOUR::Plugin } void set_block_size (nframes_t /*nframes*/) {} - + int connect_and_run (BufferSet& bufs, ChanMapping in, ChanMapping out, nframes_t nframes, nframes_t offset); @@ -181,7 +181,7 @@ struct LV2World { class LV2PluginInfo : public PluginInfo { -public: +public: LV2PluginInfo (void* slv2_world, void* slv2_plugin);; ~LV2PluginInfo ();; static PluginInfoList discover (void* slv2_world); diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h index e1fd97f107..be8472b170 100644 --- a/libs/ardour/ardour/meter.h +++ b/libs/ardour/ardour/meter.h @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -59,21 +59,21 @@ public: void reset (); void reset_max (); - + bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const; bool configure_io (ChanCount in, ChanCount out); - + /** Compute peaks */ void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes); - - float peak_power (uint32_t n) { + + float peak_power (uint32_t n) { if (n < _visible_peak_power.size()) { return _visible_peak_power[n]; } else { return minus_infinity(); } } - + float max_peak_power (uint32_t n) { if (n < _max_peak_power.size()) { return _max_peak_power[n]; @@ -81,7 +81,7 @@ public: return minus_infinity(); } } - + XMLNode& state (bool full); private: diff --git a/libs/ardour/ardour/midi_buffer.h b/libs/ardour/ardour/midi_buffer.h index d5f15fb621..b3ed093df7 100644 --- a/libs/ardour/ardour/midi_buffer.h +++ b/libs/ardour/ardour/midi_buffer.h @@ -1,17 +1,17 @@ /* - Copyright (C) 2006-2009 Paul Davis + Copyright (C) 2006-2009 Paul Davis Author: Dave Robillard - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -40,7 +40,7 @@ public: void silence (nframes_t nframes, nframes_t offset = 0); void read_from (const Buffer& src, nframes_t nframes, nframes_t dst_offset = 0, nframes_t src_offset = 0); void merge_from (const Buffer& src, nframes_t nframes, nframes_t dst_offset = 0, nframes_t src_offset = 0); - + void copy(const MidiBuffer& copy); bool push_back(const Evoral::MIDIEvent<TimeType>& event); @@ -52,10 +52,10 @@ public: bool merge(const MidiBuffer& a, const MidiBuffer& b); bool merge_in_place(const MidiBuffer &other); - + template<typename BufferType, typename EventType> struct iterator_base { - iterator_base<BufferType, EventType>(BufferType& b, nframes_t o) : buffer(b), offset(o) {} + iterator_base<BufferType, EventType>(BufferType& b, nframes_t o) : buffer(b), offset(o) {} inline EventType operator*() const { uint8_t* ev_start = buffer._data + offset + sizeof(TimeType); int event_size = Evoral::midi_event_size(ev_start); @@ -86,7 +86,7 @@ public: BufferType& buffer; size_t offset; }; - + typedef iterator_base< MidiBuffer, Evoral::MIDIEvent<TimeType> > iterator; typedef iterator_base< const MidiBuffer, const Evoral::MIDIEvent<TimeType> > const_iterator; @@ -99,7 +99,7 @@ public: private: friend class iterator_base< MidiBuffer, Evoral::MIDIEvent<TimeType> >; friend class iterator_base< const MidiBuffer, const Evoral::MIDIEvent<TimeType> >; - + uint8_t* _data; ///< timestamp, event, timestamp, event, ... }; diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index 730d6c0276..7035cdfd02 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ class Send; class Session; class MidiDiskstream : public Diskstream -{ +{ public: MidiDiskstream (Session &, const string& name, Diskstream::Flag f = Recordable); MidiDiskstream (Session &, const XMLNode&); @@ -62,7 +62,7 @@ class MidiDiskstream : public Diskstream float playback_buffer_load() const; float capture_buffer_load() const; - + void get_playback(MidiBuffer& dst, nframes_t start, nframes_t end); void set_record_enabled (bool yn); @@ -78,16 +78,16 @@ class MidiDiskstream : public Diskstream int set_state(const XMLNode& node); void monitor_input (bool); - + MidiRingBuffer<nframes_t>* playback_buffer () { return _playback_buf; } MidiRingBuffer<nframes_t>* capture_buffer () { return _capture_buf; } boost::shared_ptr<SMFSource> write_source () { return _write_source; } - + int set_destructive (bool yn); // doom! - + void set_note_mode (NoteMode m); - - uint16_t get_channel_mask() { + + uint16_t get_channel_mask() { uint16_t playback_mask = _playback_buf->get_channel_mask(); #ifndef NDEBUG uint16_t capture_mask = _capture_buf->get_channel_mask(); @@ -97,10 +97,10 @@ class MidiDiskstream : public Diskstream } void set_channel_mode(ChannelMode mode, uint16_t mask) { - _playback_buf->set_channel_mode(mode, mask); - _capture_buf->set_channel_mode(mode, mask); + _playback_buf->set_channel_mode(mode, mask); + _capture_buf->set_channel_mode(mode, mask); } - + ChannelMode get_channel_mode() { ChannelMode playback_mode = _playback_buf->get_channel_mode(); #ifndef NDEBUG @@ -145,7 +145,7 @@ class MidiDiskstream : public Diskstream /* The two central butler operations */ int do_flush (RunContext context, bool force = false); int do_refill (); - + int do_refill_with_alloc(); int read (nframes_t& start, nframes_t cnt, bool reversed); @@ -167,7 +167,7 @@ class MidiDiskstream : public Diskstream void get_input_sources (); void check_record_status (nframes_t transport_frame, nframes_t nframes, bool can_record); void set_align_style_from_io(); - + void engage_record_enable (); void disengage_record_enable (); @@ -176,7 +176,7 @@ class MidiDiskstream : public Diskstream MidiPort* _source_port; boost::shared_ptr<SMFSource> _write_source; nframes_t _last_flush_frame; - NoteMode _note_mode; + NoteMode _note_mode; volatile gint _frames_written_to_ringbuffer; volatile gint _frames_read_from_ringbuffer; }; diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 460e790323..6ea4a4cd30 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -18,7 +18,7 @@ */ -#ifndef __ardour_midi_model_h__ +#ifndef __ardour_midi_model_h__ #define __ardour_midi_model_h__ #include <queue> @@ -52,7 +52,7 @@ public: typedef double TimeType; MidiModel(MidiSource* s, size_t size=0); - + NoteMode note_mode() const { return (percussive() ? Percussive : Sustained); } void set_note_mode(NoteMode mode) { set_percussive(mode == Percussive); }; @@ -66,10 +66,10 @@ public: DeltaCommand (boost::shared_ptr<MidiModel> m, const XMLNode& node); const std::string& name() const { return _name; } - + void operator()(); void undo(); - + int set_state (const XMLNode&); XMLNode& get_state (); @@ -79,12 +79,12 @@ public: private: XMLNode &marshal_note(const boost::shared_ptr< Evoral::Note<TimeType> > note); boost::shared_ptr< Evoral::Note<TimeType> > unmarshal_note(XMLNode *xml_note); - + boost::shared_ptr<MidiModel> _model; const std::string _name; - + typedef std::list< boost::shared_ptr< Evoral::Note<TimeType> > > NoteList; - + NoteList _added_notes; NoteList _removed_notes; }; @@ -110,35 +110,35 @@ public: DiffCommand (boost::shared_ptr<MidiModel> m, const XMLNode& node); const std::string& name() const { return _name; } - + void operator()(); void undo(); - + int set_state (const XMLNode&); XMLNode& get_state (); - - void change (const boost::shared_ptr<Evoral::Note<TimeType> > note, - Property prop, uint8_t new_value); - void change (const boost::shared_ptr<Evoral::Note<TimeType> > note, - Property prop, TimeType new_time); - + + void change (const boost::shared_ptr<Evoral::Note<TimeType> > note, + Property prop, uint8_t new_value); + void change (const boost::shared_ptr<Evoral::Note<TimeType> > note, + Property prop, TimeType new_time); + private: boost::shared_ptr<MidiModel> _model; const std::string _name; struct NotePropertyChange { - DiffCommand::Property property; - boost::shared_ptr<Evoral::Note<TimeType> > note; - union { - uint8_t old_value; - TimeType old_time; - }; - union { - uint8_t new_value; - TimeType new_time; - }; - }; - + DiffCommand::Property property; + boost::shared_ptr<Evoral::Note<TimeType> > note; + union { + uint8_t old_value; + TimeType old_time; + }; + union { + uint8_t new_value; + TimeType new_time; + }; + }; + typedef std::list<NotePropertyChange> ChangeList; ChangeList _changes; @@ -154,22 +154,22 @@ public: bool write_to(boost::shared_ptr<MidiSource> source); - + // MidiModel doesn't use the normal AutomationList serialisation code // since controller data is stored in the .mid XMLNode& get_state(); int set_state(const XMLNode&) { return 0; } sigc::signal<void> ContentsChanged; - + const MidiSource* midi_source() const { return _midi_source; } - void set_midi_source(MidiSource* source) { _midi_source = source; } + void set_midi_source(MidiSource* source) { _midi_source = source; } boost::shared_ptr<Evoral::Note<TimeType> > find_note (boost::shared_ptr<Evoral::Note<TimeType> >); - + private: friend class DeltaCommand; - + // We cannot use a boost::shared_ptr here to avoid a retain cycle MidiSource* _midi_source; }; diff --git a/libs/ardour/ardour/midi_operator.h b/libs/ardour/ardour/midi_operator.h index 64ceaad841..31e412bafe 100644 --- a/libs/ardour/ardour/midi_operator.h +++ b/libs/ardour/ardour/midi_operator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ class MidiOperator { public: MidiOperator () {} virtual ~MidiOperator() {} - + virtual Command* operator() (boost::shared_ptr<ARDOUR::MidiModel>, std::vector<Evoral::Sequence<Evoral::MusicalTime>::Notes>&) = 0; virtual std::string name() const = 0; }; diff --git a/libs/ardour/ardour/midi_patch_manager.h b/libs/ardour/ardour/midi_patch_manager.h index 057d4f7b1d..a48c9ddfe7 100644 --- a/libs/ardour/ardour/midi_patch_manager.h +++ b/libs/ardour/ardour/midi_patch_manager.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Hans Baier + Copyright (C) 2008 Hans Baier This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,89 +40,88 @@ private: MidiPatchManager() {}; MidiPatchManager( const MidiPatchManager& ); MidiPatchManager& operator= (const MidiPatchManager&); - - static MidiPatchManager* _manager; - + + static MidiPatchManager* _manager; + public: typedef std::map<std::string, boost::shared_ptr<MIDINameDocument> > MidiNameDocuments; - + virtual ~MidiPatchManager() { _manager = 0; } - - static MidiPatchManager& instance() { + + static MidiPatchManager& instance() { if (_manager == 0) { _manager = new MidiPatchManager(); } - return *_manager; + return *_manager; } - + void set_session (ARDOUR::Session&); - - boost::shared_ptr<MIDINameDocument> document_by_model(std::string model_name) + + boost::shared_ptr<MIDINameDocument> document_by_model(std::string model_name) { return _documents[model_name]; } - - boost::shared_ptr<MasterDeviceNames> master_device_by_model(std::string model_name) + + boost::shared_ptr<MasterDeviceNames> master_device_by_model(std::string model_name) { return _master_devices_by_model[model_name]; } - + boost::shared_ptr<ChannelNameSet> find_channel_name_set( - std::string model, - std::string custom_device_mode, + std::string model, + std::string custom_device_mode, uint8_t channel) { boost::shared_ptr<MIDI::Name::MasterDeviceNames> master_device = master_device_by_model(model); - + if (master_device != 0 && custom_device_mode != "") { - return master_device-> - channel_name_set_by_device_mode_and_channel(custom_device_mode, channel); + return master_device->channel_name_set_by_device_mode_and_channel(custom_device_mode, channel); } else { return boost::shared_ptr<ChannelNameSet>(); - } + } } - + boost::shared_ptr<Patch> find_patch( - std::string model, - std::string custom_device_mode, - uint8_t channel, + std::string model, + std::string custom_device_mode, + uint8_t channel, PatchPrimaryKey patch_key) { - + boost::shared_ptr<ChannelNameSet> channel_name_set = find_channel_name_set(model, custom_device_mode, channel); - + if (channel_name_set) { - return channel_name_set->find_patch(patch_key); + return channel_name_set->find_patch(patch_key); } else { return boost::shared_ptr<Patch>(); } } - + boost::shared_ptr<Patch> previous_patch( - std::string model, - std::string custom_device_mode, - uint8_t channel, + std::string model, + std::string custom_device_mode, + uint8_t channel, PatchPrimaryKey patch_key) { - + boost::shared_ptr<ChannelNameSet> channel_name_set = find_channel_name_set(model, custom_device_mode, channel); - + if (channel_name_set) { - return channel_name_set->previous_patch(patch_key); + return channel_name_set->previous_patch(patch_key); } else { return boost::shared_ptr<Patch>(); } } - + boost::shared_ptr<Patch> next_patch( - std::string model, - std::string custom_device_mode, - uint8_t channel, + std::string model, + std::string custom_device_mode, + uint8_t channel, PatchPrimaryKey patch_key) { - + boost::shared_ptr<ChannelNameSet> channel_name_set = find_channel_name_set(model, custom_device_mode, channel); - + if (channel_name_set) { - return channel_name_set->next_patch(patch_key); + return channel_name_set->next_patch(patch_key); } else { return boost::shared_ptr<Patch>(); } } - + std::list<std::string> custom_device_mode_names_by_model(std::string model_name) { if (model_name != "") { return master_device_by_model(model_name)->custom_device_mode_names(); @@ -130,13 +129,13 @@ public: return std::list<std::string>(); } } - + const MasterDeviceNames::Models& all_models() const { return _all_models; } - + private: void drop_session(); void refresh(); - + ARDOUR::Session* _session; MidiNameDocuments _documents; MIDINameDocument::MasterDeviceNamesList _master_devices_by_model; diff --git a/libs/ardour/ardour/midi_playlist.h b/libs/ardour/ardour/midi_playlist.h index da8391a16b..11c1288e92 100644 --- a/libs/ardour/ardour/midi_playlist.h +++ b/libs/ardour/ardour/midi_playlist.h @@ -1,17 +1,17 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis Written by Dave Robillard, 2006 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -53,7 +53,7 @@ public: int set_state (const XMLNode&); bool destroy_region (boost::shared_ptr<Region>); - + void set_note_mode (NoteMode m) { _note_mode = m; } std::set<Evoral::Parameter> contained_automation(); @@ -63,7 +63,7 @@ protected: /* playlist "callbacks" */ void finalize_split_region (boost::shared_ptr<Region> original, boost::shared_ptr<Region> left, boost::shared_ptr<Region> right); - + void check_dependents (boost::shared_ptr<Region> region, bool norefresh); void refresh_dependents (boost::shared_ptr<Region> region); void remove_dependents (boost::shared_ptr<Region> region); @@ -72,8 +72,8 @@ private: void dump () const; bool region_changed (Change, boost::shared_ptr<Region>); - - NoteMode _note_mode; + + NoteMode _note_mode; }; } /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/midi_port.h b/libs/ardour/ardour/midi_port.h index e4d6a41d05..749829b7ea 100644 --- a/libs/ardour/ardour/midi_port.h +++ b/libs/ardour/ardour/midi_port.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ class MidiPort : public Port { void cycle_end (nframes_t nframes); void cycle_split (); void flush_buffers (nframes_t nframes, nframes_t offset = 0); - + size_t raw_buffer_size(jack_nframes_t nframes) const; Buffer& get_buffer (nframes_t nframes, nframes_t offset = 0) { @@ -53,13 +53,13 @@ class MidiPort : public Port { friend class AudioEngine; MidiPort (const std::string& name, Flags); - + private: MidiBuffer* _buffer; bool _has_been_mixed_down; }; - + } // namespace ARDOUR #endif /* __ardour_midi_port_h__ */ diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index 93a9f76f31..50fc1516df 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,14 +50,14 @@ class MidiRegion : public Region ~MidiRegion(); boost::shared_ptr<MidiSource> midi_source (uint32_t n=0) const; - + /* Stub Readable interface */ virtual nframes_t read (Sample*, sframes_t /*pos*/, nframes_t /*cnt*/, int /*channel*/) const { return 0; } virtual sframes_t readable_length() const { return length(); } nframes_t read_at (MidiRingBuffer<nframes_t>& dst, sframes_t position, - nframes_t dur, + nframes_t dur, uint32_t chan_n = 0, NoteMode mode = Sustained) const; @@ -71,9 +71,9 @@ class MidiRegion : public Region int set_state (const XMLNode&); int separate_by_channel (ARDOUR::Session&, std::vector< boost::shared_ptr<Region> >&) const; - + /* automation */ - + boost::shared_ptr<Evoral::Control> control(const Evoral::Parameter& id, bool create=false) { return model()->data().control(id, create); @@ -85,7 +85,7 @@ class MidiRegion : public Region } /* export */ - + int exportme (ARDOUR::Session&, ARDOUR::ExportSpecification&); boost::shared_ptr<MidiModel> model() { return midi_source()->model(); } @@ -104,14 +104,14 @@ class MidiRegion : public Region private: nframes_t _read_at (const SourceList&, MidiRingBuffer<nframes_t>& dst, - nframes_t position, - nframes_t dur, - uint32_t chan_n = 0, - NoteMode mode = Sustained) const; + nframes_t position, + nframes_t dur, + uint32_t chan_n = 0, + NoteMode mode = Sustained) const; void recompute_at_start (); void recompute_at_end (); - + void set_position_internal (nframes_t pos, bool allow_bbt_recompute); void switch_source(boost::shared_ptr<Source> source); diff --git a/libs/ardour/ardour/midi_ring_buffer.h b/libs/ardour/ardour/midi_ring_buffer.h index f879aa7534..2de611f4d6 100644 --- a/libs/ardour/ardour/midi_ring_buffer.h +++ b/libs/ardour/ardour/midi_ring_buffer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ public: size_t read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t offset=0); void dump(std::ostream& dst); - + /** Set the channel filtering mode. * @param mask If mode is FilterChannels, each bit represents a midi channel: * bit 0 = channel 0, bit 1 = channel 1 etc. the read and write methods will only @@ -67,11 +67,11 @@ public: ChannelMode get_channel_mode() const { return static_cast<ChannelMode>((g_atomic_int_get(&_channel_mask) & 0xFFFF0000) >> 16); } - + uint16_t get_channel_mask() const { return g_atomic_int_get(&_channel_mask) & 0x0000FFFF; } - + protected: inline bool is_channel_event(uint8_t event_type_byte) { // mask out channel information @@ -79,7 +79,7 @@ protected: // midi channel events range from 0x80 to 0xE0 return (0x80 <= event_type_byte) && (event_type_byte <= 0xE0); } - + private: volatile uint32_t _channel_mask; // 16 bits mode, 16 bits mask }; diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index a479b4a8a8..7056748786 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis Written by Dave Robillard, 2006 This program is free software; you can redistribute it and/or modify @@ -46,7 +46,7 @@ class MidiSource : virtual public Source MidiSource (Session& session, std::string name, Source::Flag flags = Source::Flag(0)); MidiSource (Session& session, const XMLNode&); virtual ~MidiSource (); - + /** Read the data in a given time range from the MIDI source. * All time stamps in parameters are in audio frames (even if the source has tempo time). * \param dst Ring buffer where read events are written @@ -69,14 +69,14 @@ class MidiSource : virtual public Source virtual void append_event_unlocked_frames(const Evoral::Event<nframes_t>& ev, sframes_t source_start) = 0; - + virtual sframes_t length (sframes_t pos) const; virtual void update_length (sframes_t pos, sframes_t cnt); virtual void mark_streaming_midi_write_started (NoteMode mode, sframes_t start_time); virtual void mark_streaming_write_started (); virtual void mark_streaming_write_completed (); - + virtual void session_saved(); std::string captured_for() const { return _captured_for; } @@ -86,13 +86,13 @@ class MidiSource : virtual public Source uint32_t write_data_count() const { return _write_data_count; } static sigc::signal<void,MidiSource*> MidiSourceCreated; - + // Signal a range of recorded data is available for reading from model() mutable sigc::signal<void,sframes_t,nframes_t> ViewDataRangeReady; - + XMLNode& get_state (); int set_state (const XMLNode&); - + bool length_mutable() const { return true; } virtual void load_model(bool lock=true, bool force_reload=false) = 0; @@ -104,14 +104,14 @@ class MidiSource : virtual public Source void invalidate(); void set_note_mode(NoteMode mode); - + boost::shared_ptr<MidiModel> model() { return _model; } void set_model(boost::shared_ptr<MidiModel> m) { _model = m; } void drop_model() { _model.reset(); } protected: virtual void flush_midi() = 0; - + virtual nframes_t read_unlocked (MidiRingBuffer<nframes_t>& dst, sframes_t position, sframes_t start, nframes_t cnt, @@ -120,16 +120,16 @@ class MidiSource : virtual public Source virtual nframes_t write_unlocked (MidiRingBuffer<nframes_t>& dst, sframes_t position, nframes_t cnt) = 0; - + std::string _captured_for; mutable uint32_t _read_data_count; ///< modified in read() mutable uint32_t _write_data_count; ///< modified in write() - + boost::shared_ptr<MidiModel> _model; bool _writing; - + mutable Evoral::Sequence<Evoral::MusicalTime>::const_iterator _model_iter; - + mutable double _length_beats; mutable sframes_t _last_read_end; sframes_t _last_write_end; diff --git a/libs/ardour/ardour/midi_state_tracker.h b/libs/ardour/ardour/midi_state_tracker.h index f9b39f9295..f5a44788db 100644 --- a/libs/ardour/ardour/midi_state_tracker.h +++ b/libs/ardour/ardour/midi_state_tracker.h @@ -1,17 +1,17 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis Author: Torben Hohn - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -49,4 +49,4 @@ private: } // namespace ARDOUR -#endif // __ardour_midi_state_tracker_h__ +#endif // __ardour_midi_state_tracker_h__ diff --git a/libs/ardour/ardour/midi_stretch.h b/libs/ardour/ardour/midi_stretch.h index 53f73578eb..9dbfbca2bd 100644 --- a/libs/ardour/ardour/midi_stretch.h +++ b/libs/ardour/ardour/midi_stretch.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index f8bca2304c..85941cd0ef 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -1,17 +1,17 @@ /* - Copyright (C) 2006 Paul Davis - Written by Dave Robillard - + Copyright (C) 2006 Paul Davis + Written by Dave Robillard + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -38,10 +38,10 @@ public: MidiTrack (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal); MidiTrack (Session&, const XMLNode&); ~MidiTrack (); - - int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, - int declick, bool can_record, bool rec_monitors_input); - + + int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + int declick, bool can_record, bool rec_monitors_input); + void handle_transport_stopped (bool abort, bool did_locate, bool flush_processors); boost::shared_ptr<MidiDiskstream> midi_diskstream() const; @@ -57,27 +57,27 @@ public: void unfreeze (); boost::shared_ptr<Region> bounce (InterThreadInfo&); - boost::shared_ptr<Region> bounce_range (nframes_t start, nframes_t end, InterThreadInfo&, - bool enable_processing); + boost::shared_ptr<Region> bounce_range ( + nframes_t start, nframes_t end, InterThreadInfo&, bool enable_processing); int set_state(const XMLNode& node); void midi_panic(void); bool write_immediate_event(size_t size, const uint8_t* buf); - + /** A control that will send "immediate" events to a MIDI track when twiddled */ struct MidiControl : public AutomationControl { - MidiControl(MidiTrack* route, const Evoral::Parameter& param, + MidiControl(MidiTrack* route, const Evoral::Parameter& param, boost::shared_ptr<AutomationList> al = boost::shared_ptr<AutomationList>()) : AutomationControl (route->session(), param, al) , _route (route) {} - - void set_value (float val); - + + void set_value (float val); + MidiTrack* _route; }; - + NoteMode note_mode() const { return _note_mode; } void set_note_mode (NoteMode m); @@ -90,15 +90,15 @@ public: bool midi_thru() const { return _midi_thru; } void set_midi_thru (bool yn); - + protected: XMLNode& state (bool full); - + int _set_state (const XMLNode&, bool call_base); private: - void write_out_of_band_data (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, - nframes_t nframes); + void write_out_of_band_data ( + BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes); int set_diskstream (boost::shared_ptr<MidiDiskstream> ds); void use_new_diskstream (); @@ -114,9 +114,9 @@ private: uint8_t _default_channel; bool _midi_thru; - - int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, - bool state_changing, bool can_record, bool rec_monitors_input); + + int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + bool state_changing, bool can_record, bool rec_monitors_input); void push_midi_input_to_step_edit_ringbuffer (nframes_t nframes); }; diff --git a/libs/ardour/ardour/mtdm.h b/libs/ardour/ardour/mtdm.h index 7fa9707554..4948d844f4 100644 --- a/libs/ardour/ardour/mtdm.h +++ b/libs/ardour/ardour/mtdm.h @@ -1,6 +1,6 @@ /* Copyright (C) 2003-2008 Fons Adriaensen <fons@kokkinizita.net> - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -25,34 +25,34 @@ #include <unistd.h> class MTDM { - public: - - MTDM (); - - int process (size_t len, float *inp, float *out); - int resolve (void); - void invert (void) { _inv ^= 1; } - int inv (void) { return _inv; } - double del (void) { return _del; } - double err (void) { return _err; } - - private: - class Freq { - public: - int p; - int f; - float a; - float xa; - float ya; - float xf; - float yf; - }; - - double _del; - double _err; - int _cnt; - int _inv; - Freq _freq [5]; +public: + + MTDM (); + + int process (size_t len, float *inp, float *out); + int resolve (void); + void invert (void) { _inv ^= 1; } + int inv (void) { return _inv; } + double del (void) { return _del; } + double err (void) { return _err; } + +private: + class Freq { + public: + int p; + int f; + float a; + float xa; + float ya; + float xf; + float yf; + }; + + double _del; + double _err; + int _cnt; + int _inv; + Freq _freq [5]; }; #endif /* __libardour_mtdm_h__ */ diff --git a/libs/ardour/ardour/mute_master.h b/libs/ardour/ardour/mute_master.h index eb64181d89..1b06b4bf7c 100644 --- a/libs/ardour/ardour/mute_master.h +++ b/libs/ardour/ardour/mute_master.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ class MuteMaster : public AutomationControl Listen = 0x4, Main = 0x8 }; - + MuteMaster (Session& s, const std::string& name); ~MuteMaster() {} @@ -48,7 +48,7 @@ class MuteMaster : public AutomationControl bool muted_at (MutePoint mp) const { return _mute_point & mp; } bool muted() const { return _mute_point != MutePoint (0); } - + gain_t mute_gain_at (MutePoint) const; void clear_mute (); diff --git a/libs/ardour/ardour/named_selection.h b/libs/ardour/ardour/named_selection.h index 0c13bcedc1..2dcfbd131c 100644 --- a/libs/ardour/ardour/named_selection.h +++ b/libs/ardour/ardour/named_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ #include <list> #include <boost/shared_ptr.hpp> -#include "pbd/stateful.h" +#include "pbd/stateful.h" class XMLNode; diff --git a/libs/ardour/ardour/noise.h b/libs/ardour/ardour/noise.h index f775fcce36..96a582ef9b 100644 --- a/libs/ardour/ardour/noise.h +++ b/libs/ardour/ardour/noise.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/onset_detector.h b/libs/ardour/ardour/onset_detector.h index 1724f216b6..dea4efe1ab 100644 --- a/libs/ardour/ardour/onset_detector.h +++ b/libs/ardour/ardour/onset_detector.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,7 +43,7 @@ class OnsetDetector : public AudioAnalyser int run (const std::string& path, Readable*, uint32_t channel, AnalysisFeatureList& results); static void cleanup_onsets (AnalysisFeatureList&, float sr, float gap_msecs); - + protected: AnalysisFeatureList* current_results; int use_features (Vamp::Plugin::FeatureSet&, std::ostream*); diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 474b3193c7..c211aafc8c 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ #include <iostream> #include <sigc++/signal.h> -#include "pbd/stateful.h" +#include "pbd/stateful.h" #include "pbd/controllable.h" #include "ardour/types.h" @@ -67,16 +67,16 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful virtual void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes) = 0; virtual void distribute_automated (AudioBuffer& src, BufferSet& obufs, - nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers) = 0; + nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers) = 0; boost::shared_ptr<AutomationControl> pan_control() { return _control; } - + sigc::signal<void> Changed; /* for position */ sigc::signal<void> StateChanged; /* for mute */ int set_state (const XMLNode&); virtual XMLNode& state (bool full_state) = 0; - + Panner & get_parent() { return parent; } /* old school automation loading */ @@ -90,7 +90,7 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful float x; float y; float z; - + /* these are for automation. they store the last value used by the most recent process() cycle. */ @@ -114,7 +114,7 @@ class BaseStereoPanner : public StreamPanner ~BaseStereoPanner (); /* this class just leaves the pan law itself to be defined - by the update(), distribute_automated() + by the update(), distribute_automated() methods. derived classes also need a factory method and a type name. See EqualPowerStereoPanner as an example. */ @@ -140,8 +140,8 @@ class EqualPowerStereoPanner : public BaseStereoPanner EqualPowerStereoPanner (Panner&, Evoral::Parameter param); ~EqualPowerStereoPanner (); - void distribute_automated (AudioBuffer& src, BufferSet& obufs, - nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers); + void distribute_automated (AudioBuffer& src, BufferSet& obufs, + nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers); void get_current_coefficients (pan_t*) const; void get_desired_coefficients (pan_t*) const; @@ -149,8 +149,8 @@ class EqualPowerStereoPanner : public BaseStereoPanner static StreamPanner* factory (Panner&, Evoral::Parameter param); static std::string name; - XMLNode& state (bool full_state); - XMLNode& get_state (void); + XMLNode& state (bool full_state); + XMLNode& get_state (void); int set_state (const XMLNode&); private: @@ -165,12 +165,12 @@ class Multi2dPanner : public StreamPanner void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes); void distribute_automated (AudioBuffer& src, BufferSet& obufs, - nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers); + nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers); static StreamPanner* factory (Panner&, Evoral::Parameter); static std::string name; - XMLNode& state (bool full_state); + XMLNode& state (bool full_state); XMLNode& get_state (void); int set_state (const XMLNode&); @@ -185,16 +185,16 @@ class Multi2dPanner : public StreamPanner class Panner : public SessionObject, public AutomatableControls { - public: +public: struct Output { - float x; - float y; - pan_t current_pan; - pan_t desired_pan; - - Output (float xp, float yp) - : x (xp), y (yp), current_pan (0.0f), desired_pan (0.f) {} - + float x; + float y; + pan_t current_pan; + pan_t desired_pan; + + Output (float xp, float yp) + : x (xp), y (yp), current_pan (0.0f), desired_pan (0.f) {} + }; //Panner (std::string name, Session&, int _num_bufs); @@ -248,7 +248,7 @@ class Panner : public SessionObject, public AutomatableControls LinkDirection link_direction() const { return _link_direction; } void set_link_direction (LinkDirection); - + bool linked() const { return _linked; } void set_linked (bool yn); @@ -260,7 +260,7 @@ class Panner : public SessionObject, public AutomatableControls sigc::signal<void> StateChanged; /* for bypass */ /* only StreamPanner should call these */ - + void set_position (float x, StreamPanner& orig); void set_position (float x, float y, StreamPanner& orig); void set_position (float x, float y, float z, StreamPanner& orig); @@ -270,31 +270,31 @@ class Panner : public SessionObject, public AutomatableControls int load (); struct PanControllable : public AutomationControl { - PanControllable (Session& s, std::string name, Panner& p, Evoral::Parameter param) + PanControllable (Session& s, std::string name, Panner& p, Evoral::Parameter param) : AutomationControl (s, param, boost::shared_ptr<AutomationList>(new AutomationList(param)), name) , panner (p) { assert(param.type() != NullAutomation); } - + AutomationList* alist() { return (AutomationList*)_list.get(); } - Panner& panner; - - void set_value (float); - float get_value (void) const; + Panner& panner; + + void set_value (float); + float get_value (void) const; }; boost::shared_ptr<AutomationControl> pan_control (int id, int chan=0) { - return automation_control(Evoral::Parameter (PanAutomation, chan, id)); + return automation_control(Evoral::Parameter (PanAutomation, chan, id)); } boost::shared_ptr<const AutomationControl> pan_control (int id, int chan=0) const { - return automation_control(Evoral::Parameter (PanAutomation, chan, id)); + return automation_control(Evoral::Parameter (PanAutomation, chan, id)); } private: /* disallow copy construction */ Panner (Panner const &); - + void distribute_no_automation(BufferSet& src, BufferSet& dest, nframes_t nframes, gain_t gain_coeff); std::vector<StreamPanner*> _streampanners; uint32_t current_outs; diff --git a/libs/ardour/ardour/peak.h b/libs/ardour/ardour/peak.h index 3d380b2b03..5be2c08f41 100644 --- a/libs/ardour/ardour/peak.h +++ b/libs/ardour/ardour/peak.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,12 +25,12 @@ #include "ardour/utils.h" static inline float -default_compute_peak (const ARDOUR::Sample * const buf, nframes_t nsamples, float current) +default_compute_peak (const ARDOUR::Sample * const buf, nframes_t nsamples, float current) { for (nframes_t i = 0; i < nsamples; ++i) { current = f_max (current, fabsf (buf[i])); } return current; -} +} #endif /* __ardour_peak_h__ */ diff --git a/libs/ardour/ardour/pitch.h b/libs/ardour/ardour/pitch.h index 589c370409..8c7718f685 100644 --- a/libs/ardour/ardour/pitch.h +++ b/libs/ardour/ardour/pitch.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ #ifdef WAF_BUILD #include "libardour-config.h" -#endif +#endif #include "ardour/filter.h" diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 6778a70f53..56c755bebb 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ #include <sigc++/signal.h> #include "pbd/undo.h" -#include "pbd/stateful.h" +#include "pbd/stateful.h" #include "pbd/statefuldestructible.h" #include "evoral/types.hpp" @@ -62,7 +62,7 @@ class Playlist : public SessionObject, Playlist (boost::shared_ptr<const Playlist>, std::string name, bool hidden = false); Playlist (boost::shared_ptr<const Playlist>, nframes_t start, nframes_t cnt, std::string name, bool hidden = false); - virtual ~Playlist (); + virtual ~Playlist (); void set_region_ownership (); @@ -148,10 +148,10 @@ class Playlist : public SessionObject, uint32_t read_data_count() const { return _read_data_count; } const PBD::ID& get_orig_diskstream_id () const { return _orig_diskstream_id; } - void set_orig_diskstream_id (const PBD::ID& did) { _orig_diskstream_id = did; } + void set_orig_diskstream_id (const PBD::ID& did) { _orig_diskstream_id = did; } /* destructive editing */ - + virtual bool destroy_region (boost::shared_ptr<Region>) = 0; /* special case function used by UI selection objects, which have playlists that actually own the regions @@ -163,7 +163,7 @@ class Playlist : public SessionObject, bool explicit_relayering () const { return _explicit_relayering; } - + void set_explicit_relayering (bool e); protected: @@ -171,20 +171,20 @@ class Playlist : public SessionObject, protected: struct RegionLock { - RegionLock (Playlist *pl, bool do_block_notify = true) : playlist (pl), block_notify (do_block_notify) { - playlist->region_lock.lock(); - if (block_notify) { - playlist->delay_notifications(); - } - } - ~RegionLock() { - playlist->region_lock.unlock(); - if (block_notify) { - playlist->release_notifications (); - } - } - Playlist *playlist; - bool block_notify; + RegionLock (Playlist *pl, bool do_block_notify = true) : playlist (pl), block_notify (do_block_notify) { + playlist->region_lock.lock(); + if (block_notify) { + playlist->delay_notifications(); + } + } + ~RegionLock() { + playlist->region_lock.unlock(); + if (block_notify) { + playlist->release_notifications (); + } + } + Playlist *playlist; + bool block_notify; }; friend class RegionLock; @@ -219,8 +219,8 @@ class Playlist : public SessionObject, uint32_t _read_data_count; PBD::ID _orig_diskstream_id; uint64_t layer_op_counter; - nframes_t freeze_length; - bool auto_partition; + nframes_t freeze_length; + bool auto_partition; /** true if relayering should be done using region's current layers and their `pending explicit relayer' * flags; otherwise false if relayering should be done using the layer-model (most recently moved etc.) @@ -230,7 +230,7 @@ class Playlist : public SessionObject, void init (bool hide); - bool holding_state () const { + bool holding_state () const { return g_atomic_int_get (&block_notifications) != 0 || g_atomic_int_get (&ignore_state_changes) != 0; } @@ -265,7 +265,7 @@ class Playlist : public SessionObject, void splice_unlocked (nframes_t at, nframes64_t distance, boost::shared_ptr<Region> exclude); virtual void finalize_split_region (boost::shared_ptr<Region> /*original*/, boost::shared_ptr<Region> /*left*/, boost::shared_ptr<Region> /*right*/) {} - + virtual void check_dependents (boost::shared_ptr<Region> /*region*/, bool /*norefresh*/) {} virtual void refresh_dependents (boost::shared_ptr<Region> /*region*/) {} virtual void remove_dependents (boost::shared_ptr<Region> /*region*/) {} @@ -275,7 +275,7 @@ class Playlist : public SessionObject, boost::shared_ptr<Region> region_by_id (PBD::ID); bool add_region_internal (boost::shared_ptr<Region>, nframes_t position); - + int remove_region_internal (boost::shared_ptr<Region>); RegionList *find_regions_at (nframes_t frame); void copy_regions (RegionList&) const; @@ -283,14 +283,14 @@ class Playlist : public SessionObject, nframes_t _get_maximum_extent() const; - boost::shared_ptr<Playlist> cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(nframes_t, nframes_t, bool), - std::list<AudioRange>& ranges, bool result_is_hidden); + boost::shared_ptr<Playlist> cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(nframes_t, nframes_t, bool), + std::list<AudioRange>& ranges, bool result_is_hidden); boost::shared_ptr<Playlist> cut (nframes_t start, nframes_t cnt, bool result_is_hidden); boost::shared_ptr<Playlist> copy (nframes_t start, nframes_t cnt, bool result_is_hidden); int move_region_to_layer (layer_t, boost::shared_ptr<Region> r, int dir); void relayer (); - + void unset_freeze_parent (Playlist*); void unset_freeze_child (Playlist*); diff --git a/libs/ardour/ardour/playlist_factory.h b/libs/ardour/ardour/playlist_factory.h index 46e27d9b87..02bd68ae7a 100644 --- a/libs/ardour/ardour/playlist_factory.h +++ b/libs/ardour/ardour/playlist_factory.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index a1fe25d31d..d80f299385 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ #include <sigc++/signal.h> #include <glibmm/ustring.h> -#include "pbd/statefuldestructible.h" +#include "pbd/statefuldestructible.h" #include "pbd/controllable.h" #include <jack/types.h> @@ -53,13 +53,13 @@ class PluginInfo { public: PluginInfo () { } PluginInfo (const PluginInfo &o) - : name(o.name), - category (o.category), + : name(o.name), + category (o.category), creator (o.creator), - path (o.path), - n_inputs(o.n_inputs), + path (o.path), + n_inputs(o.n_inputs), n_outputs(o.n_outputs), - unique_id(o.unique_id), + unique_id(o.unique_id), index(o.index) {} virtual ~PluginInfo () { } @@ -70,7 +70,7 @@ class PluginInfo { ChanCount n_inputs; ChanCount n_outputs; ARDOUR::PluginType type; - + std::string unique_id; virtual PluginPtr load (Session& session) = 0; @@ -89,23 +89,23 @@ class Plugin : public PBD::StatefulDestructible, public Latent Plugin (ARDOUR::AudioEngine&, ARDOUR::Session&); Plugin (const Plugin&); virtual ~Plugin (); - + struct ParameterDescriptor { - /* essentially a union of LADSPA and VST info */ - - bool integer_step; - bool toggled; - bool logarithmic; - bool sr_dependent; - std::string label; - float lower; - float upper; - float step; - float smallstep; - float largestep; - bool min_unbound; - bool max_unbound; + /* essentially a union of LADSPA and VST info */ + + bool integer_step; + bool toggled; + bool logarithmic; + bool sr_dependent; + std::string label; + float lower; + float upper; + float step; + float smallstep; + float largestep; + bool min_unbound; + bool max_unbound; }; virtual std::string unique_id() const = 0; @@ -125,7 +125,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent virtual int connect_and_run (BufferSet& bufs, ChanMapping in, ChanMapping out, nframes_t nframes, nframes_t offset) = 0; - + virtual std::set<Evoral::Parameter> automatable() const = 0; virtual std::string describe_parameter (Evoral::Parameter) = 0; virtual std::string state_node_name() const = 0; @@ -191,9 +191,9 @@ class Plugin : public PBD::StatefulDestructible, public Latent protected: friend class PluginInsert; friend struct PluginInsert::PluginControl; - + virtual void set_parameter (uint32_t which, float val) = 0; - + bool save_preset (std::string uri, std::string domain /* vst, ladspa etc. */); ARDOUR::AudioEngine& _engine; @@ -206,5 +206,5 @@ class Plugin : public PBD::StatefulDestructible, public Latent PluginPtr find_plugin(ARDOUR::Session&, std::string unique_id, ARDOUR::PluginType); } // namespace ARDOUR - + #endif /* __ardour_plugin_h__ */ diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 2908803aab..69b4ab1f8f 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000,2007 Paul Davis + Copyright (C) 2000,2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,14 +49,14 @@ class PluginInsert : public Processor ~PluginInsert (); static const std::string port_automation_node_name; - + XMLNode& state(bool); XMLNode& get_state(void); int set_state(const XMLNode&); void run (BufferSet& in, sframes_t start_frame, sframes_t end_frame, nframes_t nframes); void silence (nframes_t nframes); - + void activate (); void deactivate (); @@ -75,22 +75,22 @@ class PluginInsert : public Processor bool is_generator() const; - struct PluginControl : public AutomationControl + struct PluginControl : public AutomationControl { - PluginControl (PluginInsert* p, const Evoral::Parameter ¶m, - boost::shared_ptr<AutomationList> list = boost::shared_ptr<AutomationList>()); - + PluginControl (PluginInsert* p, const Evoral::Parameter ¶m, + boost::shared_ptr<AutomationList> list = boost::shared_ptr<AutomationList>()); + void set_value (float val); - float get_value (void) const; - - private: - PluginInsert* _plugin; + float get_value (void) const; + + private: + PluginInsert* _plugin; bool _logarithmic; bool _toggled; }; boost::shared_ptr<Plugin> plugin(uint32_t num=0) const { - if (num < _plugins.size()) { + if (num < _plugins.size()) { return _plugins[num]; } else { return _plugins[0]; // we always have one @@ -104,7 +104,7 @@ class PluginInsert : public Processor nframes_t signal_latency() const; boost::shared_ptr<Plugin> get_impulse_analysis_plugin(); - + void collect_signal_for_analysis(nframes_t nframes); sigc::signal<void, BufferSet*, BufferSet*> AnalysisDataGathered; @@ -114,12 +114,12 @@ class PluginInsert : public Processor PluginInsert (const PluginInsert&); void parameter_changed (Evoral::Parameter, float); - + void set_parameter (Evoral::Parameter param, float val); float get_parameter (Evoral::Parameter param); float default_parameter_value (const Evoral::Parameter& param); - + typedef std::vector<boost::shared_ptr<Plugin> > Plugins; Plugins _plugins; @@ -130,7 +130,7 @@ class PluginInsert : public Processor BufferSet _signal_analysis_inputs; BufferSet _signal_analysis_outputs; - + void automation_run (BufferSet& bufs, nframes_t nframes); void connect_and_run (BufferSet& bufs, nframes_t nframes, nframes_t offset, bool with_auto, nframes_t now = 0); diff --git a/libs/ardour/ardour/plugin_manager.h b/libs/ardour/ardour/plugin_manager.h index 90f00be8b1..c792b539a7 100644 --- a/libs/ardour/ardour/plugin_manager.h +++ b/libs/ardour/ardour/plugin_manager.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -65,22 +65,22 @@ class PluginManager : public boost::noncopyable { void add_favorite (ARDOUR::PluginType type, std::string unique_id); void remove_favorite (ARDOUR::PluginType type, std::string unique_id); bool is_a_favorite_plugin (const PluginInfoPtr&); - + private: struct FavoritePlugin { - ARDOUR::PluginType type; - std::string unique_id; - - FavoritePlugin (ARDOUR::PluginType t, std::string id) - : type (t), unique_id (id) {} - - bool operator==(const FavoritePlugin& other) const { - return other.type == type && other.unique_id == unique_id; - } - - bool operator<(const FavoritePlugin& other) const { - return other.type < type || other.unique_id < unique_id; - } + ARDOUR::PluginType type; + std::string unique_id; + + FavoritePlugin (ARDOUR::PluginType t, std::string id) + : type (t), unique_id (id) {} + + bool operator==(const FavoritePlugin& other) const { + return other.type == type && other.unique_id == unique_id; + } + + bool operator<(const FavoritePlugin& other) const { + return other.type < type || other.unique_id < unique_id; + } }; typedef std::set<FavoritePlugin> FavoritePluginList; FavoritePluginList favorites; @@ -93,7 +93,7 @@ class PluginManager : public boost::noncopyable { #ifdef HAVE_SLV2 LV2World* _lv2_world; #endif - + std::map<uint32_t, std::string> rdf_type; std::string ladspa_path; @@ -109,7 +109,7 @@ class PluginManager : public boost::noncopyable { int au_discover (); void au_refresh (); - + int lv2_discover (); void lv2_refresh (); diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index 5ac7cb90ca..75215e148d 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ namespace ARDOUR { class AudioEngine; -class Buffer; +class Buffer; class Port : public sigc::trackable, public boost::noncopyable { @@ -101,7 +101,7 @@ public: void set_latency (nframes_t); virtual void reset (); - + /** @return the size of the raw buffer (bytes) for duration @a nframes (audio frames) */ virtual size_t raw_buffer_size(jack_nframes_t nframes) const = 0; @@ -113,13 +113,13 @@ public: virtual void flush_buffers (nframes_t, nframes_t offset = 0) { (void) offset; } - + static void set_engine (AudioEngine *); sigc::signal<void, bool> MonitorInputChanged; protected: - + Port (std::string const &, DataType, Flags); jack_port_t* _jack_port; ///< JACK port @@ -133,7 +133,7 @@ private: friend class AudioEngine; void recompute_total_latency () const; - + /* XXX */ bool _last_monitor; diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index 7447c5b3e8..18f54b0216 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000,2007 Paul Davis + Copyright (C) 2000,2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -56,7 +56,7 @@ class PortInsert : public IOProcessor nframes_t signal_latency() const; bool set_name (const std::string& name); - + bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const; bool configure_io (ChanCount in, ChanCount out); @@ -67,7 +67,7 @@ class PortInsert : public IOProcessor PortInsert (const PortInsert&); boost::shared_ptr<Delivery> _out; - + uint32_t bitslot; }; diff --git a/libs/ardour/ardour/port_set.h b/libs/ardour/ardour/port_set.h index 86da79df72..106f2872d1 100644 --- a/libs/ardour/ardour/port_set.h +++ b/libs/ardour/ardour/port_set.h @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -47,16 +47,16 @@ public: /** nth port */ Port* port(size_t index) const; - + /** nth port of type @a t, or nth port if t = NIL */ Port* port(DataType t, size_t index) const; AudioPort* nth_audio_port(size_t n) const; - + MidiPort* nth_midi_port(size_t n) const; bool contains(const Port* port) const; - + /** Remove all ports from the PortSet. Ports are not deregistered with * the engine, it's the caller's responsibility to not leak here! */ @@ -68,7 +68,7 @@ public: // ITERATORS // FIXME: possible to combine these? templates? - + class iterator { public: Port& operator*() { return *_set.port(_type, _index); } @@ -91,12 +91,12 @@ public: iterator begin(DataType type = DataType::NIL) { return iterator(*this, type, 0); } - + iterator end(DataType type = DataType::NIL) { return iterator(*this, type, (type == DataType::NIL) ? _count.n_total() : _count.get(type)); } - + class const_iterator { public: @@ -139,9 +139,9 @@ public: audio_iterator audio_begin() { return audio_iterator(*this, 0); } audio_iterator audio_end() { return audio_iterator(*this, _count.n_audio()); } -private: +private: typedef std::vector<Port*> PortVec; - + // Vector of vectors, indexed by DataType::to_index() std::vector<PortVec> _ports; diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 90a4ab96b4..21b7966fba 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ #include <string> #include <exception> -#include "pbd/statefuldestructible.h" +#include "pbd/statefuldestructible.h" #include <sigc++/signal.h> @@ -55,7 +55,7 @@ class Processor : public SessionObject, public AutomatableControls, public Laten virtual ~Processor() { } virtual std::string display_name() const { return SessionObject::name(); } - + virtual bool visible() const { return true; } virtual void set_visible (bool) {} @@ -63,19 +63,19 @@ class Processor : public SessionObject, public AutomatableControls, public Laten bool get_next_ab_is_active () const { return _next_ab_is_active; } void set_next_ab_is_active (bool yn) { _next_ab_is_active = yn; } - + virtual nframes_t signal_latency() const { return 0; } - + virtual void transport_stopped (sframes_t /*frame*/) {} - + virtual void set_block_size (nframes_t /*nframes*/) {} virtual void run (BufferSet& /*bufs*/, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t /*nframes*/) {} virtual void silence (nframes_t /*nframes*/) {} - + virtual void activate () { _pending_active = true; ActiveChanged(); } virtual void deactivate () { _pending_active = false; ActiveChanged(); } - + virtual bool configure_io (ChanCount in, ChanCount out); /* Derived classes should override these, or processor appears as an in-place pass-through */ @@ -92,7 +92,7 @@ class Processor : public SessionObject, public AutomatableControls, public Laten virtual XMLNode& state (bool full); XMLNode& get_state (void); int set_state (const XMLNode&); - + void *get_gui () const { return _gui; } void set_gui (void *p) { _gui = p; } diff --git a/libs/ardour/ardour/profile.h b/libs/ardour/ardour/profile.h index b016063c4d..5d4e611833 100644 --- a/libs/ardour/ardour/profile.h +++ b/libs/ardour/ardour/profile.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,14 +26,14 @@ namespace ARDOUR { class RuntimeProfile { - public: - enum Element { - SmallScreen, - SAE, - SinglePackage, - LastElement - }; - +public: + enum Element { + SmallScreen, + SAE, + SinglePackage, + LastElement + }; + RuntimeProfile() { bits.resize (LastElement); } ~RuntimeProfile() {} @@ -46,9 +46,9 @@ class RuntimeProfile { void set_single_package () { bits[SinglePackage] = true; } bool get_single_package () const { return bits[SinglePackage]; } - private: +private: boost::dynamic_bitset<uint64_t> bits; - + }; extern RuntimeProfile* Profile; diff --git a/libs/ardour/ardour/quantize.h b/libs/ardour/ardour/quantize.h index 8db7e4185f..b02335811c 100644 --- a/libs/ardour/ardour/quantize.h +++ b/libs/ardour/ardour/quantize.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007-2009 Paul Davis + Copyright (C) 2007-2009 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -30,24 +30,24 @@ class Session; class Quantize : public MidiOperator { public: - Quantize (ARDOUR::Session&, QuantizeType type, - bool snap_start, bool snap_end, - double start_grid, double end_grid, - float strength, float swing, float threshold); - ~Quantize (); + Quantize (ARDOUR::Session&, QuantizeType type, + bool snap_start, bool snap_end, + double start_grid, double end_grid, + float strength, float swing, float threshold); + ~Quantize (); - Command* operator() (boost::shared_ptr<ARDOUR::MidiModel>, std::vector<Evoral::Sequence<Evoral::MusicalTime>::Notes>&); - std::string name() const { return std::string ("quantize"); } + Command* operator() (boost::shared_ptr<ARDOUR::MidiModel>, std::vector<Evoral::Sequence<Evoral::MusicalTime>::Notes>&); + std::string name() const { return std::string ("quantize"); } private: - ARDOUR::Session& session; - bool _snap_start; - bool _snap_end; - double _start_grid; - double _end_grid; - float _strength; - float _swing; - float _threshold; + ARDOUR::Session& session; + bool _snap_start; + bool _snap_end; + double _start_grid; + double _end_grid; + float _strength; + float _swing; + float _threshold; }; } /* namespace */ diff --git a/libs/ardour/ardour/rb_effect.h b/libs/ardour/ardour/rb_effect.h index f7ad6af9a5..e4b1c00034 100644 --- a/libs/ardour/ardour/rb_effect.h +++ b/libs/ardour/ardour/rb_effect.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/rc_configuration.h b/libs/ardour/ardour/rc_configuration.h index a599b94e9e..d12a9c63e7 100644 --- a/libs/ardour/ardour/rc_configuration.h +++ b/libs/ardour/ardour/rc_configuration.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1999 Paul Davis + Copyright (C) 1999 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ class RCConfiguration : public Configuration int load_state (); int save_state (); - /// calls Stateful::*instant_xml methods using + /// calls Stateful::*instant_xml methods using /// ARDOUR::user_config_directory for the directory argument void add_instant_xml (XMLNode&); XMLNode * instant_xml (const std::string& str); @@ -73,12 +73,12 @@ class RCConfiguration : public Configuration /* declare variables */ #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL #define CONFIG_VARIABLE(Type,var,name,value) ConfigVariable<Type> var; #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) ConfigVariableWithMutation<Type> var; #include "ardour/rc_configuration_vars.h" #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL XMLNode* _control_protocol_state; }; diff --git a/libs/ardour/ardour/recent_sessions.h b/libs/ardour/ardour/recent_sessions.h index d713c4f3f1..e6d2f83bcc 100644 --- a/libs/ardour/ardour/recent_sessions.h +++ b/libs/ardour/ardour/recent_sessions.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index c28e70bb5f..dab4f5df6f 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2001 Paul Davis + Copyright (C) 2000-2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -85,7 +85,7 @@ class Region MusicTime }; - static const Flag DefaultFlags = Flag (Opaque|DefaultFadeIn|DefaultFadeOut|FadeIn|FadeOut); + static const Flag DefaultFlags = Flag (Opaque|DefaultFadeIn|DefaultFadeOut|FadeIn|FadeOut); static Change FadeChanged; static Change SyncOffsetChanged; @@ -141,7 +141,7 @@ class Region nframes_t sync_point () const; nframes_t adjust_to_sync (nframes_t) const; - + /* first_frame() is an alias; last_frame() just hides some math */ nframes_t first_frame() const { return _position; } @@ -172,13 +172,13 @@ class Region OverlapType coverage (nframes_t start, nframes_t end) const { return ARDOUR::coverage (first_frame(), last_frame(), start, end); } - + bool equivalent (boost::shared_ptr<const Region>) const; bool size_equivalent (boost::shared_ptr<const Region>) const; bool overlap_equivalent (boost::shared_ptr<const Region>) const; bool region_list_equivalent (boost::shared_ptr<const Region>) const; bool source_equivalent (boost::shared_ptr<const Region>) const; - + /* EDITING OPERATIONS */ void set_length (nframes_t, void *src); @@ -196,7 +196,7 @@ class Region void trim_front (nframes_t new_position, void *src); void trim_end (nframes_t new_position, void *src); void trim_to (nframes_t position, nframes_t length, void *src); - + void set_layer (layer_t l); /* ONLY Playlist can call this */ void raise (); void lower (); @@ -210,7 +210,7 @@ class Region void set_opaque (bool yn); void set_locked (bool yn); void set_position_locked (bool yn); - + int apply (Filter&); virtual uint32_t read_data_count() const { return _read_data_count; } @@ -219,7 +219,7 @@ class Region virtual void set_playlist (boost::weak_ptr<ARDOUR::Playlist>); void source_deleted (boost::shared_ptr<Source>); - + boost::shared_ptr<Source> source (uint32_t n=0) const { return _sources[ (n < _sources.size()) ? n : 0 ]; } uint32_t n_channels() const { return _sources.size(); } @@ -228,24 +228,24 @@ class Region std::vector<std::string> master_source_names(); void set_master_sources (const SourceList&); - + /* automation */ - + virtual boost::shared_ptr<Evoral::Control> control(const Evoral::Parameter& id, bool create=false) = 0; virtual boost::shared_ptr<const Evoral::Control> control(const Evoral::Parameter& id) const = 0; - + /* serialization */ - + XMLNode& get_state (); virtual XMLNode& state (bool); virtual int set_state (const XMLNode&); virtual int set_live_state (const XMLNode&, Change&, bool send); virtual boost::shared_ptr<Region> get_parent() const; - + uint64_t last_layer_op() const { return _last_layer_op; } void set_last_layer_op (uint64_t when); @@ -259,7 +259,7 @@ class Region // no transients, but its OK return 0; } - + virtual int separate_by_channel (ARDOUR::Session&, std::vector< boost::shared_ptr<Region> >&) const { return 0; @@ -270,7 +270,7 @@ class Region void set_pending_explicit_relayer (bool p) { _pending_explicit_relayer = p; } - + bool pending_explicit_relayer () const { return _pending_explicit_relayer; } @@ -278,11 +278,11 @@ class Region protected: friend class RegionFactory; - Region (boost::shared_ptr<Source> src, nframes_t start, nframes_t length, + Region (boost::shared_ptr<Source> src, nframes_t start, nframes_t length, const std::string& name, DataType type, layer_t = 0, Flag flags = DefaultFlags); - Region (const SourceList& srcs, nframes_t start, nframes_t length, + Region (const SourceList& srcs, nframes_t start, nframes_t length, const std::string& name, DataType type, layer_t = 0, Flag flags = DefaultFlags); - + Region (boost::shared_ptr<const Region>, nframes_t start, nframes_t length, const std::string& name, layer_t = 0, Flag flags = DefaultFlags); Region (boost::shared_ptr<const Region>, nframes_t length, const std::string& name, layer_t = 0, Flag flags = DefaultFlags); Region (boost::shared_ptr<const Region>); @@ -304,12 +304,12 @@ class Region bool copied() const { return _flags & Copied; } void maybe_uncopy (); void first_edit (); - + bool verify_start (nframes_t); bool verify_start_and_length (nframes_t, nframes_t&); bool verify_start_mutable (nframes_t&_start); bool verify_length (nframes_t); - + virtual void recompute_at_start () = 0; virtual void recompute_at_end () = 0; @@ -342,7 +342,7 @@ class Region /** true if this region has had its layer explicitly set since the playlist last relayered */ bool _pending_explicit_relayer; - + boost::weak_ptr<ARDOUR::Playlist> _playlist; private: diff --git a/libs/ardour/ardour/region_factory.h b/libs/ardour/ardour/region_factory.h index 8da6dde25f..e702a2433f 100644 --- a/libs/ardour/ardour/region_factory.h +++ b/libs/ardour/ardour/region_factory.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ class RegionFactory { in a pure Region copy, it will not be emitted. It must be emitted by derived classes, not Region - itself, to permit dynamic_cast<> to be used to + itself, to permit dynamic_cast<> to be used to infer the type of Region. */ static sigc::signal<void,boost::shared_ptr<Region> > CheckNewRegion; @@ -48,12 +48,12 @@ class RegionFactory { gcc 4.1 doesn't seem to be able to disambiguate them if they do. */ - static boost::shared_ptr<Region> create (boost::shared_ptr<Region>, nframes_t start, - nframes_t length, const std::string& name, - layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); - static boost::shared_ptr<Region> create (boost::shared_ptr<AudioRegion>, nframes_t start, - nframes_t length, const std::string& name, - layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); + static boost::shared_ptr<Region> create (boost::shared_ptr<Region>, nframes_t start, + nframes_t length, const std::string& name, + layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); + static boost::shared_ptr<Region> create (boost::shared_ptr<AudioRegion>, nframes_t start, + nframes_t length, const std::string& name, + layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); static boost::shared_ptr<Region> create (boost::shared_ptr<Region>, const SourceList&, const std::string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); static boost::shared_ptr<Region> create (boost::shared_ptr<Source>, nframes_t start, nframes_t length, const std::string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); static boost::shared_ptr<Region> create (const SourceList &, nframes_t start, nframes_t length, const std::string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); diff --git a/libs/ardour/ardour/resampled_source.h b/libs/ardour/ardour/resampled_source.h index 1f6947aeac..efa1458152 100644 --- a/libs/ardour/ardour/resampled_source.h +++ b/libs/ardour/ardour/resampled_source.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,13 +27,13 @@ namespace ARDOUR { -class ResampledImportableSource : public ImportableSource +class ResampledImportableSource : public ImportableSource { public: ResampledImportableSource (boost::shared_ptr<ImportableSource>, nframes_t rate, SrcQuality); ~ResampledImportableSource (); - + nframes_t read (Sample* buffer, nframes_t nframes); float ratio() const { return src_data.src_ratio; } uint32_t channels() const { return source->channels(); } @@ -41,9 +41,9 @@ class ResampledImportableSource : public ImportableSource nframes_t samplerate() const { return source->samplerate(); } void seek (nframes_t pos) { source->seek (pos); } nframes64_t natural_position() const { return source->natural_position(); } - + static const uint32_t blocksize; - + private: boost::shared_ptr<ImportableSource> source; float* input; diff --git a/libs/ardour/ardour/return.h b/libs/ardour/ardour/return.h index 8f8a84f321..1a33795a37 100644 --- a/libs/ardour/ardour/return.h +++ b/libs/ardour/ardour/return.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -25,7 +25,7 @@ #include <string> -#include "pbd/stateful.h" +#include "pbd/stateful.h" #include "ardour/ardour.h" #include "ardour/audioengine.h" #include "ardour/io_processor.h" @@ -35,23 +35,23 @@ namespace ARDOUR { class Amp; class PeakMeter; -class Return : public IOProcessor +class Return : public IOProcessor { -public: +public: Return (Session&, bool internal = false); Return (Session&, const XMLNode&, bool internal = false); virtual ~Return (); - + uint32_t bit_slot() const { return _bitslot; } void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes); - + boost::shared_ptr<Amp> amp() const { return _amp; } boost::shared_ptr<PeakMeter> meter() const { return _meter; } bool metering() const { return _metering; } void set_metering (bool yn) { _metering = yn; } - + XMLNode& state(bool full); XMLNode& get_state(void); int set_state(const XMLNode& node); @@ -72,7 +72,7 @@ public: private: /* disallow copy construction */ Return (const Return&); - + uint32_t _bitslot; void collect_input (BufferSet& bufs, nframes_t nframes, ChanCount offset=ChanCount::ZERO); diff --git a/libs/ardour/ardour/reverse.h b/libs/ardour/ardour/reverse.h index 79f8880e56..0831e8184b 100644 --- a/libs/ardour/ardour/reverse.h +++ b/libs/ardour/ardour/reverse.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 34bf9e8d9f..1ecdb51488 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2002 Paul Davis + Copyright (C) 2000-2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ #include "pbd/fastlog.h" #include "pbd/xml++.h" #include "pbd/undo.h" -#include "pbd/stateful.h" +#include "pbd/stateful.h" #include "pbd/controllable.h" #include "pbd/destructible.h" @@ -97,14 +97,14 @@ class Route : public SessionObject, public AutomatableControls /* these are the core of the API of a Route. see the protected sections as well */ - virtual int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, - int declick, bool can_record, bool rec_monitors_input); + virtual int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + int declick, bool can_record, bool rec_monitors_input); - virtual int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, - bool state_changing, bool can_record, bool rec_monitors_input); + virtual int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + bool state_changing, bool can_record, bool rec_monitors_input); - virtual int silent_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, - bool can_record, bool rec_monitors_input); + virtual int silent_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + bool can_record, bool rec_monitors_input); virtual void toggle_monitor_input (); virtual bool can_record() { return false; } @@ -117,7 +117,7 @@ class Route : public SessionObject, public AutomatableControls /* end of vfunc-based API */ void shift (nframes64_t, nframes64_t); - + void set_gain (gain_t val, void *src); void inc_gain (gain_t delta, void *src); @@ -136,7 +136,7 @@ class Route : public SessionObject, public AutomatableControls void set_listen (bool yn, void* src); bool listening () const; - + void set_phase_invert (bool yn); bool phase_invert() const; @@ -166,7 +166,7 @@ class Route : public SessionObject, public AutomatableControls method (boost::weak_ptr<Processor> (*i)); } } - + boost::shared_ptr<Processor> nth_processor (uint32_t n) { Glib::RWLock::ReaderLock lm (_processor_lock); ProcessorList::iterator i; @@ -256,11 +256,11 @@ class Route : public SessionObject, public AutomatableControls XMLNode& get_processor_state (); virtual void set_processor_state (const XMLNode&); - + int save_as_template (const std::string& path, const std::string& name); sigc::signal<void,void*> SelectedChanged; - + int listen_via (boost::shared_ptr<Route>, Placement p, bool active, bool aux); void drop_listen (boost::shared_ptr<Route>); @@ -275,7 +275,7 @@ class Route : public SessionObject, public AutomatableControls SoloControllable (std::string name, Route&); void set_value (float); float get_value (void) const; - + Route& route; }; @@ -287,8 +287,8 @@ class Route : public SessionObject, public AutomatableControls return _mute_master; } - boost::shared_ptr<MuteMaster> mute_master() const { - return _mute_master; + boost::shared_ptr<MuteMaster> mute_master() const { + return _mute_master; } /* Route doesn't own these items, but sub-objects that it does own have them @@ -301,7 +301,7 @@ class Route : public SessionObject, public AutomatableControls void automation_snapshot (nframes_t now, bool force=false); void protect_automation (); - + void set_remote_control_id (uint32_t id); uint32_t remote_control_id () const; sigc::signal<void> RemoteControlIDChanged; @@ -322,17 +322,17 @@ class Route : public SessionObject, public AutomatableControls protected: nframes_t check_initial_delay (nframes_t, nframes_t&); - + void passthru (sframes_t start_frame, sframes_t end_frame, - nframes_t nframes, int declick); + nframes_t nframes, int declick); virtual void write_out_of_band_data (BufferSet& /* bufs */, sframes_t /* start_frame */, sframes_t /* end_frame */, - nframes_t /* nframes */) {} + nframes_t /* nframes */) {} virtual void process_output_buffers (BufferSet& bufs, - sframes_t start_frame, sframes_t end_frame, - nframes_t nframes, bool with_processors, int declick); - + sframes_t start_frame, sframes_t end_frame, + nframes_t nframes, bool with_processors, int declick); + boost::shared_ptr<IO> _input; boost::shared_ptr<IO> _output; @@ -354,7 +354,7 @@ class Route : public SessionObject, public AutomatableControls bool _solo_isolated; bool _denormal_protection; - + bool _recordable : 1; bool _silent : 1; bool _declickable : 1; @@ -374,9 +374,9 @@ class Route : public SessionObject, public AutomatableControls void passthru_silence (sframes_t start_frame, sframes_t end_frame, nframes_t nframes, int declick); - + void silence (nframes_t nframes); - + sigc::connection input_signal_connection; ChanCount processor_max_streams; @@ -384,7 +384,7 @@ class Route : public SessionObject, public AutomatableControls uint32_t pans_required() const; ChanCount n_process_buffers (); - + virtual int _set_state (const XMLNode&, bool call_base); boost::shared_ptr<Amp> _amp; @@ -407,7 +407,7 @@ class Route : public SessionObject, public AutomatableControls int configure_processors (ProcessorStreams*); int configure_processors_unlocked (ProcessorStreams*); - bool add_processor_from_xml (const XMLNode&, ProcessorList::iterator iter); + bool add_processor_from_xml (const XMLNode&, ProcessorList::iterator iter); void placement_range (Placement p, ProcessorList::iterator& start, ProcessorList::iterator& end); }; diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h index 75f5af790e..194aa84582 100644 --- a/libs/ardour/ardour/route_group.h +++ b/libs/ardour/ardour/route_group.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ #include <string> #include <stdint.h> #include <sigc++/signal.h> -#include "pbd/stateful.h" +#include "pbd/stateful.h" #include "ardour/types.h" namespace ARDOUR { @@ -51,22 +51,22 @@ public: Select = 0x10, Edit = 0x20 }; - + RouteGroup (Session& s, const std::string &n, Flag f = Flag(0), Property p = Property(0)); - + const std::string& name() { return _name; } void set_name (std::string str); - + bool is_active () const { return _flags & Active; } bool is_relative () const { return _flags & Relative; } bool is_hidden () const { return _flags & Hidden; } bool empty() const {return routes.empty();} - + gain_t get_max_factor(gain_t factor); gain_t get_min_factor(gain_t factor); - + int size() { return routes.size();} - + void set_active (bool yn, void *src); void set_relative (bool yn, void *src); void set_hidden (bool yn, void *src); @@ -74,7 +74,7 @@ public: bool property (Property p) const { return ((_properties & p) == p); } - + bool active_property (Property p) const { return is_active() && property (p); } @@ -85,37 +85,37 @@ public: _properties = (Property) (_properties | p); } } - + int add (Route *); - + int remove (Route *); - + void apply (void (Route::*func)(void *), void *src) { for (std::list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) { ((*i)->*func)(src); } } - + template<class T> void apply (void (Route::*func)(T, void *), T val, void *src) { for (std::list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) { ((*i)->*func)(val, src); } } - + template<class T> void foreach_route (T *obj, void (T::*func)(Route&)) { for (std::list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) { (obj->*func)(**i); } } - + /* to use these, #include "ardour/route_group_specialized.h" */ - + template<class T> void apply (void (Track::*func)(T, void *), T val, void *src); - + /* fills at_set with all members of the group that are AudioTracks */ - + void audio_track_group (std::set<AudioTrack*>& at_set); - + void clear () { routes.clear (); changed(); @@ -123,16 +123,16 @@ public: void make_subgroup (); void destroy_subgroup (); - + const std::list<Route*>& route_list() { return routes; } - + sigc::signal<void> changed; sigc::signal<void,void*> FlagsChanged; - + XMLNode& get_state (); - + int set_state (const XMLNode&); - + private: Session& _session; std::list<Route *> routes; @@ -140,10 +140,10 @@ private: std::string _name; Flag _flags; Property _properties; - + void remove_when_going_away (Route*); }; - + } /* namespace */ #endif /* __ardour_route_group_h__ */ diff --git a/libs/ardour/ardour/route_group_specialized.h b/libs/ardour/ardour/route_group_specialized.h index adf4dfc429..c9d06a93c9 100644 --- a/libs/ardour/ardour/route_group_specialized.h +++ b/libs/ardour/ardour/route_group_specialized.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,8 +25,8 @@ namespace ARDOUR { -template<class T> void -RouteGroup::apply (void (Track::*func)(T, void *), T val, void */*src*/) +template<class T> void +RouteGroup::apply (void (Track::*func)(T, void *), T val, void */*src*/) { for (std::list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) { Track *at; @@ -35,7 +35,7 @@ RouteGroup::apply (void (Track::*func)(T, void *), T val, void */*src*/) } } } - + } /* namespace ARDOUR */ #endif /* __ardour_route_group_specialized_h__ */ diff --git a/libs/ardour/ardour/runtime_functions.h b/libs/ardour/ardour/runtime_functions.h index be39702a2f..147d697fca 100644 --- a/libs/ardour/ardour/runtime_functions.h +++ b/libs/ardour/ardour/runtime_functions.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index dc57a72519..6b872df9fe 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ #include <sigc++/signal.h> #include <string> -#include "pbd/stateful.h" +#include "pbd/stateful.h" #include "ardour/ardour.h" #include "ardour/audioengine.h" @@ -36,7 +36,7 @@ class Amp; class Send : public Delivery { - public: + public: Send (Session&, boost::shared_ptr<MuteMaster>, Delivery::Role r = Delivery::Send); Send (Session&, boost::shared_ptr<MuteMaster>, const XMLNode&, Delivery::Role r = Delivery::Send); virtual ~Send (); @@ -50,7 +50,7 @@ class Send : public Delivery bool metering() const { return _metering; } void set_metering (bool yn) { _metering = yn; } - + XMLNode& state(bool full); XMLNode& get_state(void); int set_state(const XMLNode& node); @@ -78,7 +78,7 @@ class Send : public Delivery private: /* disallow copy construction */ Send (const Send&); - + uint32_t _bitslot; }; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index cdf6547674..5055ebc709 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -178,7 +178,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable std::list<AudioRange> audio_range; std::list<MusicRange> music_range; - + boost::shared_ptr<Region> region; Event(Type t, Action a, nframes_t when, nframes_t where, double spd, bool yn = false) @@ -223,15 +223,15 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable /* creating from an XML file */ Session (AudioEngine&, - const std::string& fullpath, - const std::string& snapshot_name, - std::string mix_template = ""); + const std::string& fullpath, + const std::string& snapshot_name, + std::string mix_template = ""); /* creating a new Session */ Session (AudioEngine&, - std::string fullpath, - std::string snapshot_name, + std::string fullpath, + std::string snapshot_name, AutoConnectOption input_auto_connect, AutoConnectOption output_auto_connect, uint32_t control_out_channels, @@ -248,7 +248,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable std::string raid_path () const; void set_snap_name (); - + bool writable() const { return _writable; } void set_dirty (); void set_clean (); @@ -319,9 +319,9 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable } struct RoutePublicOrderSorter { - bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b); + bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b); }; - + void sync_order_keys (std::string const &); template<class T> void foreach_route (T *obj, void (T::*func)(Route&)); @@ -419,7 +419,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable double frames_per_smpte_frame() const { return _frames_per_smpte_frame; } nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; } - MIDI::byte get_mtc_smpte_bits() const { + MIDI::byte get_mtc_smpte_bits() const { return mtc_smpte_bits; /* encoding of SMTPE type for MTC */ } @@ -506,7 +506,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable std::list<boost::shared_ptr<AudioTrack> > new_audio_track ( int input_channels, int output_channels, TrackMode mode = Normal, RouteGroup* route_group = 0, uint32_t how_many = 1 ); - + RouteList new_audio_route (int input_channels, int output_channels, RouteGroup* route_group, uint32_t how_many); std::list<boost::shared_ptr<MidiTrack> > new_midi_track ( @@ -582,7 +582,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable /// signals the current transport position in frames, bbt and smpte time (in that order) sigc::signal<void, const nframes_t&, const BBT_Time&, const SMPTE::Time&> tick; - + /* region info */ void add_regions (std::vector<boost::shared_ptr<Region> >&); @@ -628,7 +628,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable boost::shared_ptr<ExportHandler> get_export_handler (); boost::shared_ptr<ExportStatus> get_export_status (); - int start_audio_export (nframes_t position, bool realtime); + int start_audio_export (nframes_t position, bool realtime); sigc::signal<int, nframes_t> ProcessExport; sigc::signal<void> ExportReadFinished; @@ -717,8 +717,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable /* flattening stuff */ boost::shared_ptr<Region> write_one_track (AudioTrack&, nframes_t start, nframes_t end, - bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot, - bool enable_processing = true); + bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot, + bool enable_processing = true); int freeze (InterThreadInfo&); /* session-wide solo/mute/rec-enable */ @@ -846,22 +846,21 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable class GlobalRouteStateCommand : public Command { - public: + public: GlobalRouteStateCommand (Session&, void*); GlobalRouteStateCommand (Session&, const XMLNode& node); int set_state (const XMLNode&); XMLNode& get_state (); - protected: + protected: GlobalRouteBooleanState before, after; Session& sess; void* src; - }; class GlobalSoloStateCommand : public GlobalRouteStateCommand { - public: + public: GlobalSoloStateCommand (Session &, void *src); GlobalSoloStateCommand (Session&, const XMLNode&); void operator()(); //redo @@ -872,7 +871,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable class GlobalMuteStateCommand : public GlobalRouteStateCommand { - public: + public: GlobalMuteStateCommand(Session &, void *src); GlobalMuteStateCommand (Session&, const XMLNode&); void operator()(); // redo @@ -883,7 +882,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable class GlobalRecordEnableStateCommand : public GlobalRouteStateCommand { - public: + public: GlobalRecordEnableStateCommand(Session &, void *src); GlobalRecordEnableStateCommand (Session&, const XMLNode&); void operator()(); // redo @@ -894,7 +893,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable class GlobalMeteringStateCommand : public Command { - public: + public: GlobalMeteringStateCommand(Session &, void *src); GlobalMeteringStateCommand (Session&, const XMLNode&); void operator()(); @@ -903,7 +902,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable int set_state (const XMLNode&); void mark(); - protected: + protected: Session& sess; void* src; GlobalRouteMeterState before; @@ -939,7 +938,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable gain_t* gain_automation_buffer () const { return _gain_automation_buffer; } pan_t** pan_automation_buffer () const { return _pan_automation_buffer; } - + void ensure_buffer_set (BufferSet& buffers, const ChanCount& howmany); /* VST support */ @@ -967,7 +966,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable bool exporting () const { return _exporting; } - + protected: friend class AudioEngine; void set_block_size (nframes_t nframes); @@ -1019,13 +1018,13 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable Location* start_location; Slave* _slave; bool _silent; - + // varispeed playback volatile double _transport_speed; double _last_transport_speed; double _target_transport_speed; CubicInterpolation interpolation; - + bool auto_play_legal; nframes_t _last_slave_transport_frame; nframes_t maximum_output_latency; @@ -1085,10 +1084,10 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable void reset_slave_state (); bool follow_slave (nframes_t); void calculate_moving_average_of_slave_delta(int dir, nframes_t this_delta); - void track_slave_state(float slave_speed, nframes_t slave_transport_frame, - nframes_t this_delta, bool starting); + void track_slave_state(float slave_speed, nframes_t slave_transport_frame, + nframes_t this_delta, bool starting); void follow_slave_silently(nframes_t nframes, float slave_speed); - + void set_slave_source (SlaveSource); SlaveSource post_export_slave; @@ -1096,14 +1095,14 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable bool _exporting; bool _exporting_realtime; - + boost::shared_ptr<ExportHandler> export_handler; boost::shared_ptr<ExportStatus> export_status; int pre_export (); int stop_audio_export (); void finalize_audio_export (); - + sigc::connection export_freewheel_connection; void prepare_diskstreams (); @@ -1135,8 +1134,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable } bool maybe_stop (nframes_t limit) { - if ( (_transport_speed > 0.0f && _transport_frame >= limit) - || (_transport_speed < 0.0f && _transport_frame == 0) ) { + if ( (_transport_speed > 0.0f && _transport_frame >= limit) + || (_transport_speed < 0.0f && _transport_frame == 0) ) { stop_transport (); return true; } @@ -1644,7 +1643,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable pool.release (ptr); } - private: + private: static Pool pool; }; @@ -1730,7 +1729,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable void sync_order_keys (); static bool _disable_all_loaded_plugins; - + SessionMetadata * _metadata; mutable bool have_looped; ///< Used in ::audible_frame(*) diff --git a/libs/ardour/ardour/session_configuration.h b/libs/ardour/ardour/session_configuration.h index 57e78d2af0..fc7af8c450 100644 --- a/libs/ardour/ardour/session_configuration.h +++ b/libs/ardour/ardour/session_configuration.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,16 +54,16 @@ public: /* declare variables */ #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL #define CONFIG_VARIABLE(Type,var,name,value) ConfigVariable<Type> var; #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) ConfigVariableWithMutation<Type> var; #include "ardour/session_configuration_vars.h" #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL int foo; }; } - + #endif diff --git a/libs/ardour/ardour/session_directory.h b/libs/ardour/ardour/session_directory.h index 9a3f4d4d77..ae6aa256cb 100644 --- a/libs/ardour/ardour/session_directory.h +++ b/libs/ardour/ardour/session_directory.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Tim Mayberry + Copyright (C) 2007 Tim Mayberry This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ public: const PBD::sys::path root_path() const { return m_root_path; } /** - * @return the absolute path to the directory in which + * @return the absolute path to the directory in which * the session stores audio files. * * If the session is an older session with an existing @@ -50,16 +50,16 @@ public: * of root_path()/interchange/session_name/audiofiles */ const PBD::sys::path sound_path () const; - + /** - * @return the absolute path to the directory in which + * @return the absolute path to the directory in which * the session stores MIDI files, ie * root_path()/interchange/session_name/midifiles */ const PBD::sys::path midi_path () const; - + /** - * @return the absolute path to the directory in which + * @return the absolute path to the directory in which * the session stores MIDNAM patch files, ie * root_path()/interchange/session_name/patchfiles */ @@ -77,7 +77,7 @@ public: * session. */ const PBD::sys::path dead_sound_path () const; - + /** * @return The absolute path to the directory that midi * files are moved to when they are no longer part of the @@ -92,7 +92,7 @@ public: const PBD::sys::path export_path () const; /** - * @return true if session directory and all the required + * @return true if session directory and all the required * subdirectories exist. */ bool is_valid () const; diff --git a/libs/ardour/ardour/session_metadata.h b/libs/ardour/ardour/session_metadata.h index 71dd59904c..cfa1fb6f29 100644 --- a/libs/ardour/ardour/session_metadata.h +++ b/libs/ardour/ardour/session_metadata.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis Author: Sakari Bergen This program is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ class SessionMetadata : public PBD::StatefulDestructible public: SessionMetadata (); ~SessionMetadata (); - + /*** Accessing ***/ Glib::ustring comment () const; Glib::ustring copyright () const; @@ -50,7 +50,7 @@ class SessionMetadata : public PBD::StatefulDestructible Glib::ustring grouping () const; Glib::ustring title () const; Glib::ustring subtitle () const; - + Glib::ustring artist () const; Glib::ustring album_artist () const; Glib::ustring lyricist () const; @@ -62,7 +62,7 @@ class SessionMetadata : public PBD::StatefulDestructible Glib::ustring producer () const; Glib::ustring dj_mixer () const; Glib::ustring mixer () const; - + Glib::ustring album () const; Glib::ustring compilation () const; Glib::ustring disc_subtitle () const; @@ -70,19 +70,19 @@ class SessionMetadata : public PBD::StatefulDestructible uint32_t total_discs () const; uint32_t track_number () const; uint32_t total_tracks () const; - + Glib::ustring genre () const; - + /*** Editing ***/ void set_comment (const Glib::ustring &); void set_copyright (const Glib::ustring &); void set_isrc (const Glib::ustring &); void set_year (uint32_t); - + void set_grouping (const Glib::ustring &); void set_title (const Glib::ustring &); void set_subtitle (const Glib::ustring &); - + void set_artist (const Glib::ustring &); void set_album_artist (const Glib::ustring &); void set_lyricist (const Glib::ustring &); @@ -94,7 +94,7 @@ class SessionMetadata : public PBD::StatefulDestructible void set_producer (const Glib::ustring &); void set_dj_mixer (const Glib::ustring &); void set_mixer (const Glib::ustring &); - + void set_album (const Glib::ustring &); void set_compilation (const Glib::ustring &); void set_disc_subtitle (const Glib::ustring &); @@ -102,24 +102,24 @@ class SessionMetadata : public PBD::StatefulDestructible void set_total_discs (uint32_t); void set_track_number (uint32_t); void set_total_tracks (uint32_t); - + void set_genre (const Glib::ustring &); - + /*** Serialization ***/ XMLNode & get_state (); int set_state (const XMLNode &); private: - + typedef std::pair<Glib::ustring, Glib::ustring> Property; typedef std::map<Glib::ustring, Glib::ustring> PropertyMap; PropertyMap map; XMLNode * get_xml (const Glib::ustring & name); - + Glib::ustring get_value (const Glib::ustring & name) const; uint32_t get_uint_value (const Glib::ustring & name) const; - + void set_value (const Glib::ustring & name, const Glib::ustring & value); void set_value (const Glib::ustring & name, uint32_t value); }; diff --git a/libs/ardour/ardour/session_object.h b/libs/ardour/ardour/session_object.h index 7a05ab16b0..07c33c9701 100644 --- a/libs/ardour/ardour/session_object.h +++ b/libs/ardour/ardour/session_object.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ #define __ardour_session_object_h__ #include <string> -#include "pbd/statefuldestructible.h" +#include "pbd/statefuldestructible.h" namespace ARDOUR { @@ -40,10 +40,10 @@ public: : _session(session) , _name(name) {} - + Session& session() const { return _session; } const std::string& name() const { return _name; } - + virtual bool set_name (const std::string& str) { if (_name != str) { _name = str; @@ -51,7 +51,7 @@ public: } return true; } - + sigc::signal<void> NameChanged; protected: diff --git a/libs/ardour/ardour/session_playlist.h b/libs/ardour/ardour/session_playlist.h index 0641d442a8..f924fe4bbc 100644 --- a/libs/ardour/ardour/session_playlist.h +++ b/libs/ardour/ardour/session_playlist.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,8 +25,8 @@ namespace ARDOUR { -template<class T> void -Session::foreach_playlist (T *obj, void (T::*func)(boost::shared_ptr<Playlist>)) +template<class T> void +Session::foreach_playlist (T *obj, void (T::*func)(boost::shared_ptr<Playlist>)) { Glib::Mutex::Lock lm (playlist_lock); for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); i++) { diff --git a/libs/ardour/ardour/session_region.h b/libs/ardour/ardour/session_region.h index c4a6f64889..a9c9713035 100644 --- a/libs/ardour/ardour/session_region.h +++ b/libs/ardour/ardour/session_region.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/session_route.h b/libs/ardour/ardour/session_route.h index c7e911abb5..cfaa13cdc8 100644 --- a/libs/ardour/ardour/session_route.h +++ b/libs/ardour/ardour/session_route.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ namespace ARDOUR { -template<class T> void +template<class T> void Session::foreach_route (T *obj, void (T::*func)(Route&)) { boost::shared_ptr<RouteList> r = routes.reader(); @@ -43,7 +43,7 @@ Session::foreach_route (T *obj, void (T::*func)(Route&)) } } -template<class T> void +template<class T> void Session::foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>)) { boost::shared_ptr<RouteList> r = routes.reader(); @@ -57,7 +57,7 @@ Session::foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>)) } } -template<class T, class A> void +template<class T, class A> void Session::foreach_route (T *obj, void (T::*func)(Route&, A), A arg1) { boost::shared_ptr<RouteList> r = routes.reader(); diff --git a/libs/ardour/ardour/session_selection.h b/libs/ardour/ardour/session_selection.h index b92cb475a0..52c7ab0e0e 100644 --- a/libs/ardour/ardour/session_selection.h +++ b/libs/ardour/ardour/session_selection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,8 +25,8 @@ namespace ARDOUR { -template<class T> void -Session::foreach_named_selection (T& obj, void (T::*func)(NamedSelection&)) +template<class T> void +Session::foreach_named_selection (T& obj, void (T::*func)(NamedSelection&)) { Glib::Mutex::Lock lm (named_selection_lock); for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); i++) { diff --git a/libs/ardour/ardour/session_state_utils.h b/libs/ardour/ardour/session_state_utils.h index a41456b8f7..de58d3eff0 100644 --- a/libs/ardour/ardour/session_state_utils.h +++ b/libs/ardour/ardour/session_state_utils.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Tim Mayberry + Copyright (C) 2007 Tim Mayberry This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ namespace ARDOUR { /** * Attempt to create a backup copy of a file. * - * A copy of the file is created in the same directory using + * A copy of the file is created in the same directory using * the same filename with the backup suffix appended. * * @return true if successful, false otherwise. @@ -37,21 +37,21 @@ namespace ARDOUR { bool create_backup_file (const PBD::sys::path & file_path); /** - * Get the absolute paths to all state files in the directory + * Get the absolute paths to all state files in the directory * at path directory_path. * * @param directory_path The absolute path to a directory. * @param result vector to contain resulting state files. */ void get_state_files_in_directory (const PBD::sys::path & directory_path, - std::vector<PBD::sys::path>& result); + std::vector<PBD::sys::path>& result); /** * Given a vector of paths to files, return a vector containing * the filenames without any extension. * * @param file_paths a vector containing the file paths - * @return a vector containing a list of file names without any + * @return a vector containing a list of file names without any * filename extension. */ std::vector<std::string> get_file_names_no_extension (const std::vector<PBD::sys::path> & file_paths); diff --git a/libs/ardour/ardour/silentfilesource.h b/libs/ardour/ardour/silentfilesource.h index dcf7964ac6..ec7f1c4d0b 100644 --- a/libs/ardour/ardour/silentfilesource.h +++ b/libs/ardour/ardour/silentfilesource.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ -#ifndef __ardour_silentfilesource_h__ +#ifndef __ardour_silentfilesource_h__ #define __ardour_silentfilesource_h__ #include <cstring> @@ -32,9 +32,9 @@ public: float sample_rate () const { return _sample_rate; } void set_length (nframes_t len) { _length = len; } - + bool destructive() const { return false; } - bool can_be_analysed() const { return false; } + bool can_be_analysed() const { return false; } protected: friend class SourceFactory; @@ -56,12 +56,12 @@ protected: void set_header_timeline_position () {} - int read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t /*start*/, nframes_t /*cnt*/, - double /*samples_per_unit*/, nframes_t /*fpp*/) const { + int read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t /*start*/, nframes_t /*cnt*/, + double /*samples_per_unit*/, nframes_t /*fpp*/) const { memset (peaks, 0, sizeof (PeakData) * npeaks); return 0; } - + float _sample_rate; }; diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index 5987151307..64e350ae9c 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -38,10 +38,10 @@ namespace MIDI { namespace ARDOUR { /** * @class Slave - * + * * @brief The Slave interface can be used to sync ARDOURs tempo to an external source * like MTC, MIDI Clock, etc. - * + * * The name of the interface may be a bit misleading: A subclass of Slave actually * acts as a time master for ARDOUR, that means ARDOUR will try to follow the * speed and transport position of the implementation of Slave. @@ -57,7 +57,7 @@ class Slave { * This is the most important function to implement: * Each process cycle, Session::follow_slave will call this method. * and after the method call they should - * + * * Session::follow_slave will then try to follow the given * <emph>position</emph> using a delay locked loop (DLL), * starting with the first given transport speed. @@ -65,92 +65,92 @@ class Slave { * ARDOUR will always follow the position and disregard the speed. * Although, a correct speed is important so that ARDOUR * can sync to the master time source quickly. - * - * For background information on delay locked loops, + * + * For background information on delay locked loops, * see http://www.kokkinizita.net/papers/usingdll.pdf - * + * * The method has the following precondition: * <ul> - * <li> - * Slave::ok() should return true, otherwise playback will stop + * <li> + * Slave::ok() should return true, otherwise playback will stop * immediately and the method will not be called - * </li> + * </li> * <li> * when the references speed and position are passed into the Slave * they are uninitialized * </li> * </ul> - * + * * After the method call the following postconditions should be met: * <ul> - * <li> + * <li> * The first position value on transport start should be 0, - * otherwise ARDOUR will try to locate to the new position + * otherwise ARDOUR will try to locate to the new position * rather than move to it * </li> - * <li> - * the references speed and position should be assigned + * <li> + * the references speed and position should be assigned * to the Slaves current requested transport speed * and transport position. * </li> * <li> - * Slave::resolution() should be greater than the maximum distance of + * Slave::resolution() should be greater than the maximum distance of * ARDOURs transport position to the slaves requested transport position. * </li> - * <li>Slave::locked() should return true, otherwise Session::no_roll will be called</li> - * <li>Slave::starting() should be false, otherwise the transport will not move until it becomes true</li> * + * <li>Slave::locked() should return true, otherwise Session::no_roll will be called</li> + * <li>Slave::starting() should be false, otherwise the transport will not move until it becomes true</li> * * </ul> - * + * * @param speed - The transport speed requested * @param position - The transport position requested * @return - The return value is currently ignored (see Session::follow_slave) */ virtual bool speed_and_position (double& speed, nframes_t& position) = 0; - + /** - * reports to ARDOUR whether the Slave is currently synced to its external + * reports to ARDOUR whether the Slave is currently synced to its external * time source. - * + * * @return - when returning false, the transport will stop rolling */ virtual bool locked() const = 0; - + /** * reports to ARDOUR whether the slave is in a sane state - * - * @return - when returning false, the transport will be stopped and the slave + * + * @return - when returning false, the transport will be stopped and the slave * disconnected from ARDOUR. */ virtual bool ok() const = 0; - + /** * reports to ARDOUR whether the slave is in the process of starting * to roll - * + * * @return - when returning false, transport will not move until this method returns true */ virtual bool starting() const { return false; } - + /** * @return - the timing resolution of the Slave - If the distance of ARDOURs transport * to the slave becomes greater than the resolution, sound will stop */ virtual nframes_t resolution() const = 0; - + /** * @return - when returning true, ARDOUR will wait for one second before transport * starts rolling */ virtual bool requires_seekahead () const = 0; - + /** - * @return - when returning true, ARDOUR will use transport speed 1.0 no matter what + * @return - when returning true, ARDOUR will use transport speed 1.0 no matter what * the slave returns */ virtual bool is_always_synced() const { return false; } - + /** - * @return - whether ARDOUR should use the slave speed without any adjustments + * @return - whether ARDOUR should use the slave speed without any adjustments */ virtual bool give_slave_full_control_over_transport_speed() const { return false; } }; @@ -195,11 +195,11 @@ struct SafeTime { nframes_t timestamp; int guard2; - SafeTime() { - guard1 = 0; - guard2 = 0; - timestamp = 0; - } + SafeTime() { + guard1 = 0; + guard2 = 0; + timestamp = 0; + } }; class MTC_Slave : public Slave, public sigc::trackable { @@ -264,7 +264,7 @@ class MIDIClock_Slave : public Slave, public sigc::trackable { bool give_slave_full_control_over_transport_speed() const { return true; } void set_bandwidth (double a_bandwith) { bandwidth = a_bandwith; } - + private: ISlaveSessionProxy* session; MIDI::Port* port; @@ -272,41 +272,41 @@ class MIDIClock_Slave : public Slave, public sigc::trackable { /// pulses per quarter note for one MIDI clock frame (default 24) int ppqn; - + /// the duration of one ppqn in frame time double one_ppqn_in_frames; /// the timestamp of the first MIDI clock message nframes_t first_timestamp; - + /// the time stamp and should-be transport position of the last inbound MIDI clock message nframes_t last_timestamp; double should_be_position; - + /// the number of midi clock messages received (zero-based) /// since start long midi_clock_count; - + //the delay locked loop (DLL), see www.kokkinizita.net/papers/usingdll.pdf - + /// time at the beginning of the MIDI clock frame double t0; - + /// calculated end of the MIDI clock frame double t1; - + /// loop error = real value - expected value double e; - + /// second order loop error double e2; - + /// DLL filter bandwidth double bandwidth; - + /// DLL filter coefficients double b, c, omega; - + void reset (); void start (MIDI::Parser& parser, nframes_t timestamp); void contineu (MIDI::Parser& parser, nframes_t timestamp); @@ -322,7 +322,7 @@ class MIDIClock_Slave : public Slave, public sigc::trackable { /// whether transport should be rolling bool _started; - + /// is true if the MIDI Start message has just been received until /// the first MIDI Clock Event bool _starting; diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h index 025f770fc3..993a340a70 100644 --- a/libs/ardour/ardour/smf_source.h +++ b/libs/ardour/ardour/smf_source.h @@ -18,7 +18,7 @@ */ -#ifndef __ardour_smf_source_h__ +#ifndef __ardour_smf_source_h__ #define __ardour_smf_source_h__ #include <cstdio> @@ -44,13 +44,13 @@ public: SMFSource (Session& session, const XMLNode&, bool must_exist = false); virtual ~SMFSource (); - + bool safe_file_extension (const Glib::ustring& path) const { return safe_midi_file_extension(path); } bool set_name (const std::string& newname) { return (set_source_name(newname, false) == 0); } - + void append_event_unlocked_beats (const Evoral::Event<Evoral::MusicalTime>& ev); void append_event_unlocked_frames (const Evoral::Event<nframes_t>& ev, sframes_t source_start); @@ -64,7 +64,7 @@ public: void destroy_model (); void flush_midi (); - + static void set_header_position_offset (nframes_t offset, bool negative); static bool safe_midi_file_extension (const Glib::ustring& path); diff --git a/libs/ardour/ardour/smpte.h b/libs/ardour/ardour/smpte.h index d0901c372e..fa18a1eec4 100644 --- a/libs/ardour/ardour/smpte.h +++ b/libs/ardour/ardour/smpte.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006 Paul Davis +/* Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff --git a/libs/ardour/ardour/sndfile_helpers.h b/libs/ardour/ardour/sndfile_helpers.h index 54190dcae3..ed84820b8d 100644 --- a/libs/ardour/ardour/sndfile_helpers.h +++ b/libs/ardour/ardour/sndfile_helpers.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/sndfileimportable.h b/libs/ardour/ardour/sndfileimportable.h index 42ce83c0ee..95c6d80ebb 100644 --- a/libs/ardour/ardour/sndfileimportable.h +++ b/libs/ardour/ardour/sndfileimportable.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index d3c6cdb85a..7983b2e340 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ -#ifndef __sndfile_source_h__ +#ifndef __sndfile_source_h__ #define __sndfile_source_h__ #include <sndfile.h> @@ -34,9 +34,9 @@ class SndFileSource : public AudioFileSource { /* Constructor to be called for new in-session files */ SndFileSource (Session&, const Glib::ustring& path, bool embedded, - SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate, + SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate, Flag flags = SndFileSource::default_writable_flags); - + /** Constructor to be called for existing in-session files */ SndFileSource (Session&, const XMLNode&); diff --git a/libs/ardour/ardour/soundseq.h b/libs/ardour/ardour/soundseq.h index c7157428ee..ff8e96ad8f 100644 --- a/libs/ardour/ardour/soundseq.h +++ b/libs/ardour/ardour/soundseq.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index a61af84ac8..ae581f760d 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ #include <boost/utility.hpp> #include <sigc++/signal.h> -#include "pbd/statefuldestructible.h" +#include "pbd/statefuldestructible.h" #include "ardour/ardour.h" #include "ardour/session_object.h" @@ -53,39 +53,39 @@ class Source : public SessionObject, public boost::noncopyable Source (Session&, DataType type, const std::string& name, Flag flags=Flag(0)); Source (Session&, const XMLNode&); - + virtual ~Source (); - + DataType type() { return _type; } time_t timestamp() const { return _timestamp; } void stamp (time_t when) { _timestamp = when; } - + virtual sframes_t length (sframes_t pos) const = 0; virtual void update_length (sframes_t pos, sframes_t cnt) = 0; - + virtual const Glib::ustring& path() const = 0; virtual nframes64_t natural_position() const { return 0; } void mark_for_remove(); - + virtual void mark_streaming_write_started () {} virtual void mark_streaming_write_completed () = 0; virtual void session_saved() {} - + XMLNode& get_state (); int set_state (const XMLNode&); - + bool destructive() const { return (_flags & Destructive); } bool writable () const { return (_flags & Writable); } virtual bool set_destructive (bool /*yn*/) { return false; } virtual bool length_mutable() const { return false; } - + void use () { _in_use++; } void disuse () { if (_in_use) { _in_use--; } } - + void add_playlist (boost::shared_ptr<ARDOUR::Playlist>); void remove_playlist (boost::weak_ptr<ARDOUR::Playlist>); @@ -95,21 +95,21 @@ class Source : public SessionObject, public boost::noncopyable sigc::signal<void,boost::shared_ptr<Source> > Switched; bool has_been_analysed() const; - virtual bool can_be_analysed() const { return false; } + virtual bool can_be_analysed() const { return false; } virtual void set_been_analysed (bool yn); virtual bool check_for_analysis_data_on_disk(); sigc::signal<void> AnalysisChanged; - + AnalysisFeatureList transients; std::string get_transients_path() const; int load_transients (const std::string&); - + sframes_t timeline_position() const { return _timeline_position; } virtual void set_timeline_position (sframes_t pos); - + void set_allow_remove_if_empty (bool yn); - + Glib::Mutex& mutex() { return _lock; } Flag flags() const { return _flags; } @@ -122,7 +122,7 @@ class Source : public SessionObject, public boost::noncopyable mutable Glib::Mutex _lock; mutable Glib::Mutex _analysis_lock; Glib::Mutex _playlist_lock; - + typedef std::map<boost::shared_ptr<ARDOUR::Playlist>, uint32_t > PlaylistMap; PlaylistMap _playlists; diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index c5d5a410e9..8d53a3c865 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/spline.h b/libs/ardour/ardour/spline.h index de1ece6edb..28af6d4c92 100644 --- a/libs/ardour/ardour/spline.h +++ b/libs/ardour/ardour/spline.h @@ -45,38 +45,38 @@ void spline_fill (Spline *, float x0, float x1, float *vec, uint32_t veclen); float spline_get_max_x (Spline *); float spline_get_min_x (Spline *); -struct _spline +struct _spline { - float *deriv2; - float *x; - float *y; - float max_x; - float min_x; - SplinePoint *points; - uint32_t npoints; - uint32_t space; + float *deriv2; + float *x; + float *y; + float max_x; + float min_x; + SplinePoint *points; + uint32_t npoints; + uint32_t space; #ifdef __cplusplus - void set (uint32_t n, SplinePoint *points) { - spline_set (this, n, points); - } - - void add (uint32_t n, SplinePoint *points) { - spline_add (this, n, points); - } - - void solve () { - spline_solve (this); - } - - float eval (float val) { - return spline_eval (this, val); - } - - void fill (float x0, float x1, float *vec, uint32_t veclen) { - spline_fill (this, x0, x1, vec, veclen); - } + void set (uint32_t n, SplinePoint *points) { + spline_set (this, n, points); + } + + void add (uint32_t n, SplinePoint *points) { + spline_add (this, n, points); + } + + void solve () { + spline_solve (this); + } + + float eval (float val) { + return spline_eval (this, val); + } + + void fill (float x0, float x1, float *vec, uint32_t veclen) { + spline_fill (this, x0, x1, vec, veclen); + } #endif /* __cplusplus */ diff --git a/libs/ardour/ardour/stretch.h b/libs/ardour/ardour/stretch.h index b878d4794e..56a2555531 100644 --- a/libs/ardour/ardour/stretch.h +++ b/libs/ardour/ardour/stretch.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ #ifdef WAF_BUILD #include "libardour-config.h" -#endif +#endif #include "ardour/filter.h" diff --git a/libs/ardour/ardour/strip_silence.h b/libs/ardour/ardour/strip_silence.h index dab3ddd3d5..217f6b3d8a 100644 --- a/libs/ardour/ardour/strip_silence.h +++ b/libs/ardour/ardour/strip_silence.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,12 +21,12 @@ namespace ARDOUR { -/// A filter to strip silence from regions +/// A filter to strip silence from regions class StripSilence : public Filter { public: StripSilence (Session &, double, nframes_t, nframes_t); - + int run (boost::shared_ptr<ARDOUR::Region>); private: diff --git a/libs/ardour/ardour/tape_file_matcher.h b/libs/ardour/ardour/tape_file_matcher.h index ff6e23dc79..6c8392f46f 100644 --- a/libs/ardour/ardour/tape_file_matcher.h +++ b/libs/ardour/ardour/tape_file_matcher.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Tim Mayberry + Copyright (C) 2007 Tim Mayberry This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/template_utils.h b/libs/ardour/ardour/template_utils.h index f40ed1c552..fefb4a7c47 100644 --- a/libs/ardour/ardour/template_utils.h +++ b/libs/ardour/ardour/template_utils.h @@ -15,8 +15,8 @@ namespace ARDOUR { PBD::sys::path user_route_template_directory (); struct TemplateInfo { - std::string name; - std::string path; + std::string name; + std::string path; }; void find_route_templates (std::vector<TemplateInfo>& template_names); diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 49e370c7b4..69b7198408 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,8 +27,8 @@ #include <glibmm/thread.h> #include "pbd/undo.h" -#include "pbd/stateful.h" -#include "pbd/statefuldestructible.h" +#include "pbd/stateful.h" +#include "pbd/statefuldestructible.h" #include <sigc++/signal.h> @@ -41,7 +41,7 @@ class Meter; class Tempo { public: Tempo (double bpm, double type=4.0) // defaulting to quarter note - : _beats_per_minute (bpm), _note_type(type) {} + : _beats_per_minute (bpm), _note_type(type) {} double beats_per_minute () const { return _beats_per_minute;} double note_type () const { return _note_type;} @@ -56,12 +56,12 @@ class Meter { public: static const double ticks_per_beat; - Meter (double bpb, double bt) + Meter (double bpb, double bt) : _beats_per_bar (bpb), _note_type (bt) {} double beats_per_bar () const { return _beats_per_bar; } double note_divisor() const { return _note_type; } - + double frames_per_bar (const Tempo&, nframes_t sr) const; protected: @@ -154,22 +154,22 @@ class TempoMap : public PBD::StatefulDestructible }; struct BBTPoint { - BBTPointType type; - nframes_t frame; - const Meter* meter; - const Tempo* tempo; - uint32_t bar; - uint32_t beat; - - BBTPoint (const Meter& m, const Tempo& t, nframes_t f, - BBTPointType ty, uint32_t b, uint32_t e) - : type (ty), frame (f), meter (&m), tempo (&t), bar (b), beat (e) {} + BBTPointType type; + nframes_t frame; + const Meter* meter; + const Tempo* tempo; + uint32_t bar; + uint32_t beat; + + BBTPoint (const Meter& m, const Tempo& t, nframes_t f, + BBTPointType ty, uint32_t b, uint32_t e) + : type (ty), frame (f), meter (&m), tempo (&t), bar (b), beat (e) {} }; typedef std::vector<BBTPoint> BBTPointList; - + template<class T> void apply_with_metrics (T& obj, void (T::*method)(const Metrics&)) { - Glib::RWLock::ReaderLock lm (lock); + Glib::RWLock::ReaderLock lm (lock); (obj.*method)(*metrics); } @@ -197,7 +197,7 @@ class TempoMap : public PBD::StatefulDestructible void move_tempo (TempoSection&, const BBT_Time& to); void move_meter (MeterSection&, const BBT_Time& to); - + void remove_tempo(const TempoSection&); void remove_meter(const MeterSection&); @@ -223,17 +223,17 @@ class TempoMap : public PBD::StatefulDestructible class Metric { public: Metric (const Meter& m, const Tempo& t) : _meter (&m), _tempo (&t), _frame (0) {} - + void set_tempo (const Tempo& t) { _tempo = &t; } void set_meter (const Meter& m) { _meter = &m; } void set_frame (nframes_t f) { _frame = f; } void set_start (const BBT_Time& t) { _start = t; } - + const Meter& meter() const { return *_meter; } const Tempo& tempo() const { return *_tempo; } nframes_t frame() const { return _frame; } const BBT_Time& start() const { return _start; } - + private: const Meter* _meter; const Tempo* _tempo; @@ -265,7 +265,7 @@ class TempoMap : public PBD::StatefulDestructible bool last_bbt_valid; BBT_Time last_bbt; mutable Glib::RWLock lock; - + void timestamp_metrics (bool use_bbt); nframes_t round_to_type (nframes_t fr, int dir, BBTPointType); diff --git a/libs/ardour/ardour/ticker.h b/libs/ardour/ardour/ticker.h index 8e3ddd5547..f87bca665d 100644 --- a/libs/ardour/ardour/ticker.h +++ b/libs/ardour/ardour/ticker.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Hans Baier + Copyright (C) 2008 Hans Baier This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,12 +36,12 @@ class Ticker : public sigc::trackable public: Ticker() : _session(0) {}; virtual ~Ticker() {}; - + virtual void tick( - const nframes_t& transport_frames, - const BBT_Time& transport_bbt, + const nframes_t& transport_frames, + const BBT_Time& transport_bbt, const SMPTE::Time& transport_smpte) = 0; - + virtual void set_session(Session& s); virtual void going_away() { _session = 0; } @@ -56,45 +56,45 @@ private: MidiClockTicker() : _midi_port(0), _ppqn(24), _last_tick(0.0) {}; MidiClockTicker( const MidiClockTicker& ); MidiClockTicker& operator= (const MidiClockTicker&); - + public: virtual ~MidiClockTicker() {}; - + static MidiClockTicker& instance() { static MidiClockTicker _instance; return _instance; } - + void tick( - const nframes_t& transport_frames, - const BBT_Time& transport_bbt, + const nframes_t& transport_frames, + const BBT_Time& transport_bbt, const SMPTE::Time& transport_smpte); - + void set_session(Session& s); void going_away() { _midi_port = 0; Ticker::going_away(); } /// slot for the signal session::MIDIClock_PortChanged void update_midi_clock_port(); - + /// slot for the signal session::TransportStateChange void transport_state_changed(); - + /// slot for the signal session::PositionChanged void position_changed(nframes_t position); /// slot for the signal session::TransportLooped void transport_looped(); - + /// pulses per quarter note (default 24) void set_ppqn(int ppqn) { _ppqn = ppqn; } -private: +private: MIDI::Port* _midi_port; int _ppqn; double _last_tick; double one_ppqn_in_frames(nframes_t transport_position); - + void send_midi_clock_event(nframes_t offset); void send_start_event(nframes_t offset); void send_continue_event(nframes_t offset); diff --git a/libs/ardour/ardour/timestamps.h b/libs/ardour/ardour/timestamps.h index a0aeeae13d..f4380a648d 100644 --- a/libs/ardour/ardour/timestamps.h +++ b/libs/ardour/ardour/timestamps.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index cb2d05caa6..1b191a1d3e 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,23 +37,23 @@ class Track : public Route Track (Session&, std::string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO); virtual ~Track (); - + bool set_name (const std::string& str); TrackMode mode () const { return _mode; } virtual int set_mode (TrackMode /*m*/) { return false; } virtual bool can_use_mode (TrackMode /*m*/, bool& /*bounce_required*/) { return false; } sigc::signal<void> TrackModeChanged; - - virtual int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, - bool state_changing, bool can_record, bool rec_monitors_input); - - int silent_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + + virtual int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + bool state_changing, bool can_record, bool rec_monitors_input); + + int silent_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, bool can_record, bool rec_monitors_input); - virtual int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, - int declick, bool can_record, bool rec_monitors_input) = 0; - + virtual int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + int declick, bool can_record, bool rec_monitors_input) = 0; + void toggle_monitor_input (); bool can_record(); @@ -73,7 +73,7 @@ class Track : public Route }; FreezeState freeze_state() const; - + virtual void freeze (InterThreadInfo&) = 0; virtual void unfreeze () = 0; @@ -89,9 +89,9 @@ class Track : public Route bool record_enabled() const; void set_record_enable (bool yn, void *src); - + void set_meter_point (MeterPoint, void* src); - + sigc::signal<void> DiskstreamChanged; sigc::signal<void> FreezeChange; @@ -106,37 +106,37 @@ class Track : public Route //private: (FIXME) struct FreezeRecordProcessorInfo { - FreezeRecordProcessorInfo(XMLNode& st, boost::shared_ptr<Processor> proc) - : state (st), processor (proc) {} + FreezeRecordProcessorInfo(XMLNode& st, boost::shared_ptr<Processor> proc) + : state (st), processor (proc) {} - XMLNode state; - boost::shared_ptr<Processor> processor; - PBD::ID id; + XMLNode state; + boost::shared_ptr<Processor> processor; + PBD::ID id; }; struct FreezeRecord { - FreezeRecord() - : have_mementos(false) - {} - - ~FreezeRecord(); - - boost::shared_ptr<Playlist> playlist; - std::vector<FreezeRecordProcessorInfo*> processor_info; - bool have_mementos; - FreezeState state; - gain_t gain; - AutoState gain_automation_state; - AutoState pan_automation_state; + FreezeRecord() + : have_mementos(false) + {} + + ~FreezeRecord(); + + boost::shared_ptr<Playlist> playlist; + std::vector<FreezeRecordProcessorInfo*> processor_info; + bool have_mementos; + FreezeState state; + gain_t gain; + AutoState gain_automation_state; + AutoState pan_automation_state; }; struct RecEnableControllable : public PBD::Controllable { - RecEnableControllable (Track&); - - void set_value (float); - float get_value (void) const; + RecEnableControllable (Track&); - Track& track; + void set_value (float); + float get_value (void) const; + + Track& track; }; virtual void set_state_part_two () = 0; @@ -146,7 +146,7 @@ class Track : public Route sigc::connection recenable_connection; sigc::connection ic_connection; bool _destructive; - + boost::shared_ptr<RecEnableControllable> _rec_enable_control; }; diff --git a/libs/ardour/ardour/transient_detector.h b/libs/ardour/ardour/transient_detector.h index 2f4fc4c4f7..eb75f71c85 100644 --- a/libs/ardour/ardour/transient_detector.h +++ b/libs/ardour/ardour/transient_detector.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,11 +41,11 @@ class TransientDetector : public AudioAnalyser float get_threshold () const; float get_sensitivity () const; - + int run (const std::string& path, Readable*, uint32_t channel, AnalysisFeatureList& results); static void cleanup_transients (AnalysisFeatureList&, float sr, float gap_msecs); - + protected: AnalysisFeatureList* current_results; int use_features (Vamp::Plugin::FeatureSet&, std::ostream*); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 1a30cfd769..38a0e6d625 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -149,7 +149,7 @@ namespace ARDOUR { FilterChannels, ///< Ignore events on certain channels ForceChannel ///< Force all events to a certain channel }; - + enum ColorMode { MeterColors = 0, ChannelColors, @@ -157,30 +157,30 @@ namespace ARDOUR { }; struct BBT_Time { - uint32_t bars; - uint32_t beats; - uint32_t ticks; + uint32_t bars; + uint32_t beats; + uint32_t ticks; - BBT_Time() { - bars = 1; - beats = 1; - ticks = 0; - } + BBT_Time() { + bars = 1; + beats = 1; + ticks = 0; + } - /* we can't define arithmetic operators for BBT_Time, because - the results depend on a TempoMap, but we can define - a useful check on the less-than condition. - */ + /* we can't define arithmetic operators for BBT_Time, because + the results depend on a TempoMap, but we can define + a useful check on the less-than condition. + */ - bool operator< (const BBT_Time& other) const { - return bars < other.bars || - (bars == other.bars && beats < other.beats) || - (bars == other.bars && beats == other.beats && ticks < other.ticks); - } + bool operator< (const BBT_Time& other) const { + return bars < other.bars || + (bars == other.bars && beats < other.beats) || + (bars == other.bars && beats == other.beats && ticks < other.ticks); + } - bool operator== (const BBT_Time& other) const { - return bars == other.bars && beats == other.beats && ticks == other.ticks; - } + bool operator== (const BBT_Time& other) const { + return bars == other.bars && beats == other.beats && ticks == other.ticks; + } }; enum SmpteFormat { @@ -197,63 +197,63 @@ namespace ARDOUR { }; struct AnyTime { - enum Type { - SMPTE, - BBT, - Frames, - Seconds - }; + enum Type { + SMPTE, + BBT, + Frames, + Seconds + }; - Type type; + Type type; - SMPTE::Time smpte; - BBT_Time bbt; + SMPTE::Time smpte; + BBT_Time bbt; - union { - nframes_t frames; - double seconds; - }; + union { + nframes_t frames; + double seconds; + }; - AnyTime() { type = Frames; frames = 0; } + AnyTime() { type = Frames; frames = 0; } }; struct AudioRange { - nframes_t start; - nframes_t end; - uint32_t id; + nframes_t start; + nframes_t end; + uint32_t id; - AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {} + AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {} - nframes_t length() { return end - start + 1; } + nframes_t length() { return end - start + 1; } - bool operator== (const AudioRange& other) const { - return start == other.start && end == other.end && id == other.id; - } + bool operator== (const AudioRange& other) const { + return start == other.start && end == other.end && id == other.id; + } - bool equal (const AudioRange& other) const { - return start == other.start && end == other.end; - } + bool equal (const AudioRange& other) const { + return start == other.start && end == other.end; + } - OverlapType coverage (nframes_t s, nframes_t e) const { - return ARDOUR::coverage (start, end, s, e); - } + OverlapType coverage (nframes_t s, nframes_t e) const { + return ARDOUR::coverage (start, end, s, e); + } }; struct MusicRange { - BBT_Time start; - BBT_Time end; - uint32_t id; + BBT_Time start; + BBT_Time end; + uint32_t id; - MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i) - : start (s), end (e), id (i) {} + MusicRange (BBT_Time& s, BBT_Time& e, uint32_t i) + : start (s), end (e), id (i) {} - bool operator== (const MusicRange& other) const { - return start == other.start && end == other.end && id == other.id; - } + bool operator== (const MusicRange& other) const { + return start == other.start && end == other.end && id == other.id; + } - bool equal (const MusicRange& other) const { - return start == other.start && end == other.end; - } + bool equal (const MusicRange& other) const { + return start == other.start && end == other.end; + } }; /* @@ -285,9 +285,9 @@ namespace ARDOUR { }; enum RegionPoint { - Start, - End, - SyncPoint + Start, + End, + SyncPoint }; enum Change { @@ -342,10 +342,10 @@ namespace ARDOUR { }; struct InterThreadInfo { - volatile bool done; - volatile bool cancel; - volatile float progress; - pthread_t thread; + volatile bool done; + volatile bool cancel; + volatile float progress; + pthread_t thread; }; enum SampleFormat { @@ -371,10 +371,10 @@ namespace ARDOUR { }; struct PeakData { - typedef Sample PeakDatum; + typedef Sample PeakDatum; - PeakDatum min; - PeakDatum max; + PeakDatum min; + PeakDatum max; }; enum PluginType { @@ -383,7 +383,7 @@ namespace ARDOUR { LV2, VST }; - + enum RunContext { ButlerContext = 0, TransportContext, @@ -403,7 +403,7 @@ namespace ARDOUR { }; enum ShuttleUnits { - Percentage, + Percentage, Semitones }; @@ -418,15 +418,16 @@ namespace ARDOUR { }; struct TimeFXRequest : public InterThreadInfo { - TimeFXRequest() : time_fraction(0), pitch_fraction(0), + TimeFXRequest() + : time_fraction(0), pitch_fraction(0), quick_seek(false), antialias(false), opts(0) {} - float time_fraction; - float pitch_fraction; - /* SoundTouch */ - bool quick_seek; - bool antialias; - /* RubberBand */ - int opts; // really RubberBandStretcher::Options + float time_fraction; + float pitch_fraction; + /* SoundTouch */ + bool quick_seek; + bool antialias; + /* RubberBand */ + int opts; // really RubberBandStretcher::Options }; typedef std::list<nframes64_t> AnalysisFeatureList; diff --git a/libs/ardour/ardour/uri_map.h b/libs/ardour/ardour/uri_map.h index 78e5393271..c62ec6bfc4 100644 --- a/libs/ardour/ardour/uri_map.h +++ b/libs/ardour/ardour/uri_map.h @@ -26,7 +26,7 @@ #include <boost/utility.hpp> #include <slv2/slv2.h> #include "lv2ext/lv2_uri_map.h" - + namespace ARDOUR { @@ -35,7 +35,7 @@ namespace ARDOUR { class URIMap : public boost::noncopyable { public: URIMap(); - + LV2_Feature* feature() { return &uri_map_feature; } uint32_t uri_to_id(const char* map, @@ -43,11 +43,11 @@ public: private: typedef std::map<std::string, uint32_t> Map; - + static uint32_t uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data, const char* map, const char* uri); - + LV2_Feature uri_map_feature; LV2_URI_Map_Feature uri_map_feature_data; Map uri_map; diff --git a/libs/ardour/ardour/user_bundle.h b/libs/ardour/ardour/user_bundle.h index 6d197450c3..fa37392fc0 100644 --- a/libs/ardour/ardour/user_bundle.h +++ b/libs/ardour/ardour/user_bundle.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,11 +36,11 @@ class UserBundle : public Bundle, public PBD::Stateful { UserBundle (XMLNode const &, bool); XMLNode& get_state (); - + private: int set_state (XMLNode const &); }; } - + #endif diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index dc6c1b8479..e41c5f64ee 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1999 Paul Davis + Copyright (C) 1999 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ static inline float f_max(float x, float a) { x += fabsf (x); x *= 0.5f; x += a; - + return (x); } diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 1cb7e376e4..2d9875df57 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ #include <dlfcn.h> #include <sigc++/signal.h> -#include "pbd/stateful.h" +#include "pbd/stateful.h" #include <jack/types.h> #include "ardour/plugin.h" @@ -50,7 +50,7 @@ class VSTPlugin : public ARDOUR::Plugin ~VSTPlugin (); /* Plugin interface */ - + std::string unique_id() const; const char * label() const; const char * name() const; @@ -104,7 +104,7 @@ class VSTPluginInfo : public PluginInfo public: VSTPluginInfo () {} ~VSTPluginInfo () {} - + PluginPtr load (Session& session); }; diff --git a/libs/ardour/audio_buffer.cc b/libs/ardour/audio_buffer.cc index c5717f0528..a57891a27d 100644 --- a/libs/ardour/audio_buffer.cc +++ b/libs/ardour/audio_buffer.cc @@ -1,16 +1,16 @@ /* - Copyright (C) 2006-2007 Paul Davis - + Copyright (C) 2006-2007 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 04f4173e4d..55664eb352 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -81,7 +81,7 @@ AudioDiskstream::AudioDiskstream (Session &sess, const string &name, Diskstream: in_set_state = false; } - + AudioDiskstream::AudioDiskstream (Session& sess, const XMLNode& node) : Diskstream(sess, node) , deprecated_io_node(NULL) @@ -126,7 +126,7 @@ AudioDiskstream::~AudioDiskstream () { RCUWriter<ChannelList> writer (channels); boost::shared_ptr<ChannelList> c = writer.get_copy(); - + for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { delete *chan; } @@ -170,31 +170,31 @@ AudioDiskstream::non_realtime_input_change () { RCUWriter<ChannelList> writer (channels); boost::shared_ptr<ChannelList> c = writer.get_copy(); - + _n_channels.set(DataType::AUDIO, c->size()); - + if (_io->n_ports().n_audio() > _n_channels.n_audio()) { add_channel_to (c, _io->n_ports().n_audio() - _n_channels.n_audio()); } else if (_io->n_ports().n_audio() < _n_channels.n_audio()) { remove_channel_from (c, _n_channels.n_audio() - _io->n_ports().n_audio()); } } - + get_input_sources (); set_capture_offset (); - + if (first_input_change) { set_align_style (_persistent_alignment_style); first_input_change = false; } else { set_align_style_from_io (); } - + input_change_pending = NoChange; /* implicit unlock */ } - + /* reset capture files */ reset_write_sources (false); @@ -231,28 +231,28 @@ AudioDiskstream::get_input_sources () vector<string> connections; for (n = 0, chan = c->begin(); chan != c->end() && n < ni; ++chan, ++n) { - + connections.clear (); if (_io->nth (n)->get_connections (connections) == 0) { - + if ((*chan)->source) { // _source->disable_metering (); } - + (*chan)->source = 0; - + } else { (*chan)->source = dynamic_cast<AudioPort*>(_session.engine().get_port_by_name (connections[0]) ); } } -} +} int AudioDiskstream::find_and_use_playlist (const string& name) { boost::shared_ptr<AudioPlaylist> playlist; - + if ((playlist = boost::dynamic_pointer_cast<AudioPlaylist> (_session.playlist_by_name (name))) == 0) { playlist = boost::dynamic_pointer_cast<AudioPlaylist> (PlaylistFactory::create (DataType::AUDIO, _session, name)); } @@ -280,7 +280,7 @@ AudioDiskstream::use_new_playlist () { string newname; boost::shared_ptr<AudioPlaylist> playlist; - + if (!in_set_state && destructive()) { return 0; } @@ -292,11 +292,11 @@ AudioDiskstream::use_new_playlist () } if ((playlist = boost::dynamic_pointer_cast<AudioPlaylist> (PlaylistFactory::create (DataType::AUDIO, _session, newname, hidden()))) != 0) { - + playlist->set_orig_diskstream_id (id()); return use_playlist (playlist); - } else { + } else { return -1; } } @@ -319,11 +319,11 @@ AudioDiskstream::use_copy_playlist () boost::shared_ptr<AudioPlaylist> playlist; newname = Playlist::bump_name (_playlist->name(), _session); - + if ((playlist = boost::dynamic_pointer_cast<AudioPlaylist>(PlaylistFactory::create (audio_playlist(), newname))) != 0) { playlist->set_orig_diskstream_id (id()); return use_playlist (playlist); - } else { + } else { return -1; } } @@ -333,7 +333,7 @@ AudioDiskstream::setup_destructive_playlist () { SourceList srcs; boost::shared_ptr<ChannelList> c = channels.reader(); - + for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { srcs.push_back ((*chan)->write_source); } @@ -341,7 +341,7 @@ AudioDiskstream::setup_destructive_playlist () /* a single full-sized region */ boost::shared_ptr<Region> region (RegionFactory::create (srcs, 0, max_frames - srcs.front()->natural_position(), _name)); - _playlist->add_region (region, srcs.front()->natural_position()); + _playlist->add_region (region, srcs.front()->natural_position()); } void @@ -349,7 +349,7 @@ AudioDiskstream::use_destructive_playlist () { /* this is called from the XML-based constructor or ::set_destructive. when called, we already have a playlist and a region, but we need to - set up our sources for write. we use the sources associated + set up our sources for write. we use the sources associated with the (presumed single, full-extent) region. */ @@ -413,9 +413,9 @@ AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t /*nfr /* if per-track or global rec-enable turned on while the other was already on, we've started recording */ - if (((change & track_rec_enabled) && record_enabled() && (!(change & global_rec_enabled) && can_record)) || + if (((change & track_rec_enabled) && record_enabled() && (!(change & global_rec_enabled) && can_record)) || ((change & global_rec_enabled) && can_record && (!(change & track_rec_enabled) && record_enabled()))) { - + /* starting to record: compute first+last frames */ first_recordable_frame = transport_frame + _capture_offset; @@ -430,7 +430,7 @@ AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t /*nfr first_recordable_frame += _session.worst_output_latency(); } else { first_recordable_frame += _roll_delay; - } + } } else { @@ -441,8 +441,8 @@ AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t /*nfr if (!_session.config.get_punch_in()) { /* manual punch in happens at the correct transport frame - because the user hit a button. but to get alignment correct - we have to back up the position of the new region to the + because the user hit a button. but to get alignment correct + we have to back up the position of the new region to the appropriate spot given the roll delay. */ @@ -473,16 +473,16 @@ AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t /*nfr capture_start_frame -= _roll_delay; } } - + } if (recordable() && destructive()) { boost::shared_ptr<ChannelList> c = channels.reader(); for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { - + RingBufferNPT<CaptureTransition>::rw_vector transvec; (*chan)->capture_transition_buf->get_write_vector(&transvec); - + if (transvec.len[0] > 0) { transvec.buf[0]->type = CaptureStart; transvec.buf[0]->capture_val = capture_start_frame; @@ -490,18 +490,18 @@ AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t /*nfr } else { // bad! - fatal << X_("programming error: capture_transition_buf is full on rec start! inconceivable!") + fatal << X_("programming error: capture_transition_buf is full on rec start! inconceivable!") << endmsg; } - } + } } } else if (!record_enabled() || !can_record) { - + /* stop recording */ last_recordable_frame = transport_frame + _capture_offset; - + if (_alignment_style == ExistingMaterial) { last_recordable_frame += _session.worst_output_latency(); } else { @@ -561,7 +561,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can // If we can't take the state lock return. if (!state_lock.trylock()) { return 1; - } + } commit_should_unlock = true; adjust_capture_position = 0; @@ -572,10 +572,10 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can if (nominally_recording || (_session.get_record_enabled() && _session.config.get_punch_in())) { OverlapType ot; - + // Safeguard against situations where process() goes haywire when autopunching and last_recordable_frame < first_recordable_frame if (last_recordable_frame < first_recordable_frame) { - last_recordable_frame = max_frames; + last_recordable_frame = max_frames; } ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes); @@ -584,7 +584,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can case OverlapNone: rec_nframes = 0; break; - + case OverlapInternal: /* ---------- recrange |---| transrange @@ -592,7 +592,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can rec_nframes = nframes; rec_offset = 0; break; - + case OverlapStart: /* |--------| recrange -----| transrange @@ -602,7 +602,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can rec_offset = first_recordable_frame - transport_frame; } break; - + case OverlapEnd: /* |--------| recrange |-------- transrange @@ -610,7 +610,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can rec_nframes = last_recordable_frame - transport_frame; rec_offset = 0; break; - + case OverlapExternal: /* |--------| recrange -------------- transrange @@ -643,13 +643,13 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can */ for (n = 0, chan = c->begin(); chan != c->end() && n < limit; ++chan, ++n) { - + ChannelInfo* chaninfo (*chan); chaninfo->capture_buf->get_write_vector (&chaninfo->capture_vector); if (rec_nframes <= chaninfo->capture_vector.len[0]) { - + chaninfo->current_capture_buffer = chaninfo->capture_vector.buf[0]; /* note: grab the entire port buffer, but only copy what we were supposed to @@ -681,7 +681,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can memcpy (chaninfo->capture_vector.buf[0], buf, sizeof (Sample) * first); memcpy (chaninfo->capture_wrap_buffer+first, buf + first, sizeof (Sample) * (rec_nframes - first)); memcpy (chaninfo->capture_vector.buf[1], buf + first, sizeof (Sample) * (rec_nframes - first)); - + chaninfo->current_capture_buffer = chaninfo->capture_wrap_buffer; } } @@ -693,9 +693,9 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can } } - + if (rec_nframes) { - + /* data will be written to disk */ if (rec_nframes == nframes && rec_offset == 0) { @@ -747,15 +747,15 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can } else { necessary_samples = nframes; } - + for (chan = c->begin(); chan != c->end(); ++chan) { (*chan)->playback_buf->get_read_vector (&(*chan)->playback_vector); } - n = 0; + n = 0; for (chan = c->begin(); chan != c->end(); ++chan, ++n) { - + ChannelInfo* chaninfo (*chan); if (necessary_samples <= chaninfo->playback_vector.len[0]) { @@ -764,26 +764,26 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can } else { nframes_t total = chaninfo->playback_vector.len[0] + chaninfo->playback_vector.len[1]; - + if (necessary_samples > total) { cerr << "underrun for " << _name << endl; DiskUnderrun (); goto out; - + } else { - + memcpy ((char *) chaninfo->playback_wrap_buffer, chaninfo->playback_vector.buf[0], chaninfo->playback_vector.len[0] * sizeof (Sample)); memcpy (chaninfo->playback_wrap_buffer + chaninfo->playback_vector.len[0], - chaninfo->playback_vector.buf[1], + chaninfo->playback_vector.buf[1], (necessary_samples - chaninfo->playback_vector.len[0]) * sizeof (Sample)); - + chaninfo->current_playback_buffer = chaninfo->playback_wrap_buffer; } } - } + } if (rec_nframes == 0 && _actual_speed != 1.0f && _actual_speed != -1.0f) { process_varispeed_playback(nframes, c); @@ -805,10 +805,10 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can /* we're exiting with failure, so ::commit will not be called. unlock the state lock. */ - + commit_should_unlock = false; state_lock.unlock(); - } + } return ret; } @@ -817,16 +817,16 @@ void AudioDiskstream::process_varispeed_playback(nframes_t nframes, boost::shared_ptr<ChannelList> c) { ChannelList::iterator chan; - + interpolation.set_speed (_target_speed); - + int channel = 0; for (chan = c->begin(); chan != c->end(); ++chan, ++channel) { ChannelInfo* chaninfo (*chan); - + playback_distance = interpolation.interpolate ( channel, nframes, chaninfo->current_playback_buffer, chaninfo->speed_buffer); - + chaninfo->current_playback_buffer = chaninfo->speed_buffer; } } @@ -850,17 +850,17 @@ AudioDiskstream::commit (nframes_t /*nframes*/) for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { (*chan)->playback_buf->increment_read_ptr (playback_distance); - + if (adjust_capture_position) { (*chan)->capture_buf->increment_write_ptr (adjust_capture_position); } } - + if (adjust_capture_position != 0) { capture_captured += adjust_capture_position; adjust_capture_position = 0; } - + if (_slaved) { if (_io && _io->active()) { need_butler = c->front()->playback_buf->write_space() >= c->front()->playback_buf->bufsize() / 2; @@ -889,7 +889,7 @@ void AudioDiskstream::set_pending_overwrite (bool yn) { /* called from audio thread, so we can use the read ptr and playback sample as we wish */ - + pending_overwrite = yn; overwrite_frame = playback_sample; @@ -900,22 +900,22 @@ int AudioDiskstream::overwrite_existing_buffers () { boost::shared_ptr<ChannelList> c = channels.reader(); - Sample* mixdown_buffer; - float* gain_buffer; - int ret = -1; + Sample* mixdown_buffer; + float* gain_buffer; + int ret = -1; bool reversed = (_visible_speed * _session.transport_speed()) < 0.0f; overwrite_queued = false; /* assume all are the same size */ nframes_t size = c->front()->playback_buf->bufsize(); - - mixdown_buffer = new Sample[size]; - gain_buffer = new float[size]; - + + mixdown_buffer = new Sample[size]; + gain_buffer = new float[size]; + /* reduce size so that we can fill the buffer correctly. */ size--; - + uint32_t n=0; nframes_t start; @@ -923,7 +923,7 @@ AudioDiskstream::overwrite_existing_buffers () start = overwrite_frame; nframes_t cnt = size; - + /* to fill the buffer without resetting the playback sample, we need to do it one or two chunks (normally two). @@ -932,9 +932,9 @@ AudioDiskstream::overwrite_existing_buffers () ^ overwrite_offset |<- second chunk->||<----------------- first chunk ------------------>| - + */ - + nframes_t to_read = size - overwrite_offset; if (read ((*chan)->playback_buf->buffer() + overwrite_offset, mixdown_buffer, gain_buffer, start, to_read, *chan, n, reversed)) { @@ -942,11 +942,11 @@ AudioDiskstream::overwrite_existing_buffers () _id, size, playback_sample) << endmsg; goto out; } - + if (cnt > to_read) { cnt -= to_read; - + if (read ((*chan)->playback_buf->buffer(), mixdown_buffer, gain_buffer, start, cnt, *chan, n, reversed)) { error << string_compose(_("AudioDiskstream %1: when refilling, cannot read %2 from playlist at frame %3"), @@ -957,12 +957,12 @@ AudioDiskstream::overwrite_existing_buffers () } ret = 0; - + out: pending_overwrite = false; - delete [] gain_buffer; - delete [] mixdown_buffer; - return ret; + delete [] gain_buffer; + delete [] mixdown_buffer; + return ret; } int @@ -974,21 +974,21 @@ AudioDiskstream::seek (nframes_t frame, bool complete_refill) boost::shared_ptr<ChannelList> c = channels.reader(); Glib::Mutex::Lock lm (state_lock); - + for (n = 0, chan = c->begin(); chan != c->end(); ++chan, ++n) { (*chan)->playback_buf->reset (); (*chan)->capture_buf->reset (); } - + /* can't rec-enable in destructive mode if transport is before start */ - + if (destructive() && record_enabled() && frame < _session.current_start_frame()) { disengage_record_enable (); } - + playback_sample = frame; file_frame = frame; - + if (complete_refill) { while ((ret = do_refill_with_alloc ()) > 0) ; } else { @@ -1007,7 +1007,7 @@ AudioDiskstream::can_internal_playback_seek (nframes_t distance) for (chan = c->begin(); chan != c->end(); ++chan) { if ((*chan)->playback_buf->read_space() < distance) { return false; - } + } } return true; } @@ -1024,12 +1024,12 @@ AudioDiskstream::internal_playback_seek (nframes_t distance) first_recordable_frame += distance; playback_sample += distance; - + return 0; } int -AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, nframes_t& start, nframes_t cnt, +AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, nframes_t& start, nframes_t cnt, ChannelInfo* /*channel_info*/, int channel, bool reversed) { nframes_t this_read = 0; @@ -1045,23 +1045,23 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, if (!reversed) { /* Make the use of a Location atomic for this read operation. - + Note: Locations don't get deleted, so all we care about when I say "atomic" is that we are always pointing to the same one and using a start/length values obtained just once. */ - + if ((loc = loop_location) != 0) { loop_start = loc->start(); loop_end = loc->end(); loop_length = loop_end - loop_start; } - + /* if we are looping, ensure that the first frame we read is at the correct position within the loop. */ - + if (loc && start >= loop_end) { //cerr << "start adjusted from " << start; start = loop_start + ((start - loop_start) % loop_length); @@ -1076,7 +1076,7 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, if (reversed) { start -= cnt; } - + /* take any loop into account. we can't read past the end of the loop. */ if (loc && (loop_end - start < cnt)) { @@ -1095,27 +1095,27 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, this_read = min(cnt,this_read); if (audio_playlist()->read (buf+offset, mixdown_buffer, gain_buffer, start, this_read, channel) != this_read) { - error << string_compose(_("AudioDiskstream %1: cannot read %2 from playlist at frame %3"), _id, this_read, + error << string_compose(_("AudioDiskstream %1: cannot read %2 from playlist at frame %3"), _id, this_read, start) << endmsg; return -1; } _read_data_count = _playlist->read_data_count(); - + if (reversed) { swap_by_ptr (buf, buf + this_read - 1); - + } else { - + /* if we read to the end of the loop, go back to the beginning */ - + if (reloop) { start = loop_start; } else { start += this_read; } - } + } cnt -= this_read; offset += this_read; @@ -1131,7 +1131,7 @@ AudioDiskstream::do_refill_with_alloc () float* gain_buf = new float[disk_io_chunk_frames]; int ret = _do_refill(mix_buf, gain_buf); - + delete [] mix_buf; delete [] gain_buf; @@ -1165,7 +1165,7 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) vector.len[1] = 0; c->front()->playback_buf->get_write_vector (&vector); - + if ((total_space = vector.len[0] + vector.len[1]) == 0) { return 0; } @@ -1174,27 +1174,27 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) this track, let the caller know so that it can arrange for us to be called again, ASAP. */ - + if (total_space >= (_slaved?3:2) * disk_io_chunk_frames) { ret = 1; } - - /* if we're running close to normal speed and there isn't enough - space to do disk_io_chunk_frames of I/O, then don't bother. - + + /* if we're running close to normal speed and there isn't enough + space to do disk_io_chunk_frames of I/O, then don't bother. + at higher speeds, just do it because the sync between butler and audio thread may not be good enough. */ - + if ((total_space < disk_io_chunk_frames) && fabs (_actual_speed) < 2.0f) { return 0; } - + /* when slaved, don't try to get too close to the read pointer. this leaves space for the buffer reversal to have something useful to work with. */ - + if (_slaved && total_space < (c->front()->playback_buf->bufsize() / 2)) { return 0; } @@ -1210,7 +1210,7 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) /* at start: nothing to do but fill with silence */ for (chan_n = 0, i = c->begin(); i != c->end(); ++i, ++chan_n) { - + ChannelInfo* chan (*i); chan->playback_buf->get_write_vector (&vector); memset (vector.buf[0], 0, sizeof(Sample) * vector.len[0]); @@ -1224,8 +1224,8 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) if (file_frame < total_space) { - /* too close to the start: read what we can, - and then zero fill the rest + /* too close to the start: read what we can, + and then zero fill the rest */ zero_fill = total_space - file_frame; @@ -1233,7 +1233,7 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) file_frame = 0; } else { - + zero_fill = 0; } @@ -1242,9 +1242,9 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) if (file_frame == max_frames) { /* at end: nothing to do but fill with silence */ - + for (chan_n = 0, i = c->begin(); i != c->end(); ++i, ++chan_n) { - + ChannelInfo* chan (*i); chan->playback_buf->get_write_vector (&vector); memset (vector.buf[0], 0, sizeof(Sample) * vector.len[0]); @@ -1255,7 +1255,7 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) } return 0; } - + if (file_frame > max_frames - total_space) { /* to close to the end: read what we can, and zero fill the rest */ @@ -1267,7 +1267,7 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) zero_fill = 0; } } - + nframes_t file_frame_tmp = 0; for (chan_n = 0, i = c->begin(); i != c->end(); ++i, ++chan_n) { @@ -1280,27 +1280,27 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) chan->playback_buf->get_write_vector (&vector); if (vector.len[0] > disk_io_chunk_frames) { - + /* we're not going to fill the first chunk, so certainly do not bother with the other part. it won't be connected with the part we do fill, as in: - + .... => writable space ++++ => readable space ^^^^ => 1 x disk_io_chunk_frames that would be filled - + |......|+++++++++++++|...............................| buf1 buf0 ^^^^^^^^^^^^^^^ - - - So, just pretend that the buf1 part isn't there. - + + + So, just pretend that the buf1 part isn't there. + */ - + vector.buf[1] = 0; vector.len[1] = 0; - - } + + } ts = total_space; file_frame_tmp = file_frame; @@ -1336,7 +1336,7 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) ret = -1; goto out; } - + chan->playback_buf->increment_write_ptr (to_read); } @@ -1345,13 +1345,13 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) } } - + file_frame = file_frame_tmp; out: return ret; -} +} /** Flush pending data to disk. * @@ -1359,7 +1359,7 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) * of data to disk. it will never write more than that. If it writes that * much and there is more than that waiting to be written, it will return 1, * otherwise 0 on success or -1 on failure. - * + * * If there is less than disk_io_chunk_frames to be written, no data will be * written at all unless @a force_flush is true. */ @@ -1381,7 +1381,7 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush) boost::shared_ptr<ChannelList> c = channels.reader(); for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { - + (*chan)->capture_buf->get_read_vector (&vector); total = vector.len[0] + vector.len[1]; @@ -1393,7 +1393,7 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush) /* if there are 2+ chunks of disk i/o possible for this track, let the caller know so that it can arrange for us to be called again, ASAP. - + if we are forcing a flush, then if there is* any* extra work, let the caller know. @@ -1403,10 +1403,10 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush) if (total >= 2 * disk_io_chunk_frames || ((force_flush || !was_recording) && total > disk_io_chunk_frames)) { ret = 1; - } + } to_write = min (disk_io_chunk_frames, (nframes_t) vector.len[0]); - + // check the transition buffer when recording destructive // important that we get this after the capture buf @@ -1418,7 +1418,7 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush) for (ti=0; ti < transcount; ++ti) { CaptureTransition & captrans = (ti < transvec.len[0]) ? transvec.buf[0][ti] : transvec.buf[1][ti-transvec.len[0]]; - + if (captrans.type == CaptureStart) { // by definition, the first data we got above represents the given capture pos @@ -1434,7 +1434,7 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush) if (captrans.capture_val <= (*chan)->curr_capture_cnt + to_write) { // shorten to make the write a perfect fit - uint32_t nto_write = (captrans.capture_val - (*chan)->curr_capture_cnt); + uint32_t nto_write = (captrans.capture_val - (*chan)->curr_capture_cnt); if (nto_write < to_write) { ret = 1; // should we? @@ -1442,7 +1442,7 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush) to_write = nto_write; (*chan)->write_source->mark_capture_end (); - + // increment past this transition, but go no further ++ti; break; @@ -1467,14 +1467,14 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush) (*chan)->capture_buf->increment_read_ptr (to_write); (*chan)->curr_capture_cnt += to_write; - + if ((to_write == vector.len[0]) && (total > to_write) && (to_write < disk_io_chunk_frames) && !destructive()) { - + /* we wrote all of vector.len[0] but it wasn't an entire - disk_io_chunk_frames of data, so arrange for some part + disk_io_chunk_frames of data, so arrange for some part of vector.len[1] to be flushed to disk as well. */ - + to_write = min ((nframes_t)(disk_io_chunk_frames - to_write), (nframes_t) vector.len[1]); if ((*chan)->write_source->write (vector.buf[1], to_write) != to_write) { @@ -1483,7 +1483,7 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush) } _write_data_count += (*chan)->write_source->write_data_count(); - + (*chan)->capture_buf->increment_read_ptr (to_write); (*chan)->curr_capture_cnt += to_write; } @@ -1506,12 +1506,12 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca ChannelList::iterator chan; vector<CaptureInfo*>::iterator ci; boost::shared_ptr<ChannelList> c = channels.reader(); - uint32_t n = 0; + uint32_t n = 0; bool mark_write_completed = false; finish_capture (true, c); - /* butler is already stopped, but there may be work to do + /* butler is already stopped, but there may be work to do to flush remaining data to disk. */ @@ -1530,13 +1530,13 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca /* XXX is there anything we can do if err != 0 ? */ Glib::Mutex::Lock lm (capture_info_lock); - + if (capture_info.empty()) { return; } if (abort_capture) { - + if (destructive()) { goto outout; } @@ -1544,17 +1544,17 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { if ((*chan)->write_source) { - + (*chan)->write_source->mark_for_remove (); (*chan)->write_source->drop_references (); (*chan)->write_source.reset (); } - + /* new source set up in "out" below */ } goto out; - } + } for (total_capture = 0, ci = capture_info.begin(); ci != capture_info.end(); ++ci) { total_capture += (*ci)->frames; @@ -1565,7 +1565,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca for (n = 0, chan = c->begin(); chan != c->end(); ++chan, ++n) { boost::shared_ptr<AudioFileSource> s = (*chan)->write_source; - + if (s) { srcs.push_back (s); s->update_header (capture_info.front()->start, when, twhen); @@ -1581,12 +1581,12 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca if (destructive()) { - /* send a signal that any UI can pick up to do the right thing. there is + /* send a signal that any UI can pick up to do the right thing. there is a small problem here in that a UI may need the peak data to be ready for the data that was recorded and this isn't interlocked with that process. this problem is deferred to the UI. */ - + _playlist->Modified(); } else { @@ -1599,56 +1599,56 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca so that any sub-regions will obviously be children of this one (later!) */ - + try { boost::shared_ptr<Region> rx (RegionFactory::create (srcs, - c->front()->write_source->last_capture_start_frame(), total_capture, + c->front()->write_source->last_capture_start_frame(), total_capture, whole_file_region_name, 0, Region::Flag (Region::DefaultFlags|Region::Automatic|Region::WholeFile))); region = boost::dynamic_pointer_cast<AudioRegion> (rx); region->special_set_position (capture_info.front()->start); } - - + + catch (failed_constructor& err) { error << string_compose(_("%1: could not create region for complete audio file"), _name) << endmsg; /* XXX what now? */ } - + _last_capture_regions.push_back (region); // cerr << _name << ": there are " << capture_info.size() << " capture_info records\n"; - + XMLNode &before = _playlist->get_state(); _playlist->freeze (); - + for (buffer_position = c->front()->write_source->last_capture_start_frame(), ci = capture_info.begin(); ci != capture_info.end(); ++ci) { - + string region_name; _session.region_name (region_name, whole_file_region_name, false); - + // cerr << _name << ": based on ci of " << (*ci)->start << " for " << (*ci)->frames << " add region " << region_name << endl; - + try { boost::shared_ptr<Region> rx (RegionFactory::create (srcs, buffer_position, (*ci)->frames, region_name)); region = boost::dynamic_pointer_cast<AudioRegion> (rx); } - + catch (failed_constructor& err) { error << _("AudioDiskstream: could not create region for captured audio!") << endmsg; continue; /* XXX is this OK? */ } - + region->GoingAway.connect (bind (mem_fun (*this, &Diskstream::remove_region_from_last_capture), boost::weak_ptr<Region>(region))); - + _last_capture_regions.push_back (region); - + i_am_the_modifier++; _playlist->add_region (region, (*ci)->start, 1, non_layered()); i_am_the_modifier--; - + buffer_position += (*ci)->frames; } @@ -1703,10 +1703,10 @@ AudioDiskstream::transport_looped (nframes_t transport_frame) if (recordable() && destructive()) { for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { - + RingBufferNPT<CaptureTransition>::rw_vector transvec; (*chan)->capture_transition_buf->get_write_vector(&transvec); - + if (transvec.len[0] > 0) { transvec.buf[0]->type = CaptureStart; transvec.buf[0]->capture_val = capture_start_frame; @@ -1714,10 +1714,10 @@ AudioDiskstream::transport_looped (nframes_t transport_frame) } else { // bad! - fatal << X_("programming error: capture_transition_buf is full on rec loop! inconceivable!") + fatal << X_("programming error: capture_transition_buf is full on rec loop! inconceivable!") << endmsg; } - } + } } } @@ -1727,17 +1727,17 @@ void AudioDiskstream::finish_capture (bool /*rec_monitors_input*/, boost::shared_ptr<ChannelList> c) { was_recording = false; - + if (capture_captured == 0) { return; } if (recordable() && destructive()) { for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { - + RingBufferNPT<CaptureTransition>::rw_vector transvec; (*chan)->capture_transition_buf->get_write_vector(&transvec); - + if (transvec.len[0] > 0) { transvec.buf[0]->type = CaptureEnd; transvec.buf[0]->capture_val = capture_captured; @@ -1749,15 +1749,15 @@ AudioDiskstream::finish_capture (bool /*rec_monitors_input*/, boost::shared_ptr< } } } - - + + CaptureInfo* ci = new CaptureInfo; - + ci->start = capture_start_frame; ci->frames = capture_captured; - - /* XXX theoretical race condition here. Need atomic exchange ? - However, the circumstances when this is called right + + /* XXX theoretical race condition here. Need atomic exchange ? + However, the circumstances when this is called right now (either on record-disable or transport_stopped) mean that no actual race exists. I think ... We now have a capture_info_lock, but it is only to be used @@ -1827,7 +1827,7 @@ AudioDiskstream::engage_record_enable () capturing_sources.push_back ((*chan)->write_source); (*chan)->write_source->mark_streaming_write_started (); } - + } else { for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { capturing_sources.push_back ((*chan)->write_source); @@ -1868,7 +1868,7 @@ AudioDiskstream::get_state () node->add_property ("channels", buf); node->add_property ("playlist", _playlist->name()); - + snprintf (buf, sizeof(buf), "%.12g", _visible_speed); node->add_property ("speed", buf); @@ -1920,23 +1920,23 @@ AudioDiskstream::set_state (const XMLNode& node) in_set_state = true; - for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - if ((*niter)->name() == IO::state_node_name) { + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { + if ((*niter)->name() == IO::state_node_name) { deprecated_io_node = new XMLNode (**niter); - } + } if ((*niter)->name() == X_("CapturingSources")) { capture_pending_node = *niter; } - } + } /* prevent write sources from being created */ - + in_set_state = true; - + if ((prop = node.property ("name")) != 0) { _name = prop->value(); - } + } if (deprecated_io_node) { if ((prop = deprecated_io_node->property ("id")) != 0) { @@ -1955,12 +1955,12 @@ AudioDiskstream::set_state (const XMLNode& node) if ((prop = node.property ("channels")) != 0) { nchans = atoi (prop->value().c_str()); } - + // create necessary extra channels // we are always constructed with one and we always need one _n_channels.set(DataType::AUDIO, channels.reader()->size()); - + if (nchans > _n_channels.n_audio()) { add_channel (nchans - _n_channels.n_audio()); @@ -1977,7 +1977,7 @@ AudioDiskstream::set_state (const XMLNode& node) { bool had_playlist = (_playlist != 0); - + if (find_and_use_playlist (prop->value())) { return -1; } @@ -1985,7 +1985,7 @@ AudioDiskstream::set_state (const XMLNode& node) if (!had_playlist) { _playlist->set_orig_diskstream_id (_id); } - + if (!destructive() && capture_pending_node) { /* destructive streams have one and only one source per channel, and so they never end up in pending capture in any useful @@ -2010,10 +2010,10 @@ AudioDiskstream::set_state (const XMLNode& node) capturing_sources.clear (); - /* write sources are handled when we handle the input set + /* write sources are handled when we handle the input set up of the IO that owns this DS (::non_realtime_input_change()) */ - + return 0; } @@ -2032,7 +2032,7 @@ AudioDiskstream::use_new_write_source (uint32_t n) } ChannelInfo* chan = (*c)[n]; - + if (chan->write_source) { chan->write_source->done_with_peakfile_writes (); chan->write_source->set_allow_remove_if_empty (true); @@ -2043,7 +2043,7 @@ AudioDiskstream::use_new_write_source (uint32_t n) if ((chan->write_source = _session.create_audio_source_for_session (*this, n, destructive())) == 0) { throw failed_constructor(); } - } + } catch (failed_constructor &err) { error << string_compose (_("%1:%2 new capture file not initialized correctly"), _name, n) << endmsg; @@ -2068,7 +2068,7 @@ AudioDiskstream::reset_write_sources (bool mark_write_complete, bool /*force*/) if (!_session.writable() || !recordable()) { return; } - + capturing_sources.clear (); for (chan = c->begin(), n = 0; chan != c->end(); ++chan, ++n) { @@ -2153,10 +2153,10 @@ AudioDiskstream::allocate_temporary_buffers () for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { if ((*chan)->playback_wrap_buffer) delete [] (*chan)->playback_wrap_buffer; - (*chan)->playback_wrap_buffer = new Sample[required_wrap_size]; + (*chan)->playback_wrap_buffer = new Sample[required_wrap_size]; if ((*chan)->capture_wrap_buffer) delete [] (*chan)->capture_wrap_buffer; - (*chan)->capture_wrap_buffer = new Sample[required_wrap_size]; + (*chan)->capture_wrap_buffer = new Sample[required_wrap_size]; } wrap_buffer_size = required_wrap_size; @@ -2169,7 +2169,7 @@ AudioDiskstream::monitor_input (bool yn) boost::shared_ptr<ChannelList> c = channels.reader(); for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { - + if ((*chan)->source) { (*chan)->source->ensure_monitor_input (yn); } @@ -2186,7 +2186,7 @@ AudioDiskstream::set_align_style_from_io () } get_input_sources (); - + boost::shared_ptr<ChannelList> c = channels.reader(); for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { @@ -2213,7 +2213,7 @@ AudioDiskstream::add_channel_to (boost::shared_ptr<ChannelList> c, uint32_t how_ } _n_channels.set(DataType::AUDIO, c->size()); - + return 0; } @@ -2232,7 +2232,7 @@ AudioDiskstream::remove_channel_from (boost::shared_ptr<ChannelList> c, uint32_t while (how_many-- && !c->empty()) { // FIXME: crash (thread safe with RCU?) // memory leak, when disabled.... :( - //delete c->back(); + //delete c->back(); c->pop_back(); interpolation.remove_channel_from (); } @@ -2247,7 +2247,7 @@ AudioDiskstream::remove_channel (uint32_t how_many) { RCUWriter<ChannelList> writer (channels); boost::shared_ptr<ChannelList> c = writer.get_copy(); - + return remove_channel_from (c, how_many); } @@ -2316,7 +2316,7 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node) } pending_sources.push_back (fs); - + if (first_fs == 0) { first_fs = fs; } @@ -2337,7 +2337,7 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node) } boost::shared_ptr<AudioRegion> region; - + try { region = boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create ( pending_sources, 0, first_fs->length(first_fs->timeline_position()), @@ -2350,7 +2350,7 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node) error << string_compose ( _("%1: cannot create whole-file region from pending capture sources"), _name) << endmsg; - + return -1; } @@ -2364,7 +2364,7 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node) error << string_compose (_("%1: cannot create region from pending capture sources"), _name) << endmsg; - + return -1; } @@ -2377,7 +2377,7 @@ int AudioDiskstream::set_non_layered (bool yn) { if (yn != non_layered()) { - + if (yn) { _flags = Flag (_flags | NonLayered); } else { @@ -2394,10 +2394,10 @@ AudioDiskstream::set_destructive (bool yn) bool bounce_ignored; if (yn != destructive()) { - + if (yn) { /* requestor should already have checked this and - bounced if necessary and desired + bounced if necessary and desired */ if (!can_become_destructive (bounce_ignored)) { return -1; @@ -2432,7 +2432,7 @@ AudioDiskstream::can_become_destructive (bool& requires_bounce) const assert (first); /* do the source(s) for the region cover the session start position ? */ - + if (first->position() != _session.current_start_frame()) { if (first->start() > _session.current_start_frame()) { requires_bounce = true; @@ -2447,7 +2447,7 @@ AudioDiskstream::can_become_destructive (bool& requires_bounce) const assert (afirst); if (afirst->source()->used() > 1) { - requires_bounce = true; + requires_bounce = true; return false; } @@ -2470,11 +2470,11 @@ AudioDiskstream::ChannelInfo::ChannelInfo (nframes_t bufsize, nframes_t speed_si playback_buf = new RingBufferNPT<Sample> (bufsize); capture_buf = new RingBufferNPT<Sample> (bufsize); capture_transition_buf = new RingBufferNPT<CaptureTransition> (256); - + /* touch the ringbuffer buffers, which will cause them to be mapped into locked physical RAM if we're running with mlockall(). this doesn't do - much if we're not. + much if we're not. */ memset (playback_buf->buffer(), 0, sizeof (Sample) * playback_buf->bufsize()); @@ -2487,7 +2487,7 @@ AudioDiskstream::ChannelInfo::~ChannelInfo () if (write_source) { write_source.reset (); } - + delete [] speed_buffer; speed_buffer = 0; @@ -2496,7 +2496,7 @@ AudioDiskstream::ChannelInfo::~ChannelInfo () delete [] capture_wrap_buffer; capture_wrap_buffer = 0; - + delete playback_buf; playback_buf = 0; diff --git a/libs/ardour/audio_library.cc b/libs/ardour/audio_library.cc index 3dc97c622a..26f225273f 100644 --- a/libs/ardour/audio_library.cc +++ b/libs/ardour/audio_library.cc @@ -51,7 +51,7 @@ AudioLibrary::AudioLibrary () sfdb_file_path /= sfdb_file_name; src = Glib::filename_to_uri (sfdb_file_path.to_string ()); - + // workaround for possible bug in raptor that crashes when saving to a // non-existant file. @@ -77,11 +77,11 @@ AudioLibrary::set_tags (string member, vector<string> tags) { sort (tags.begin(), tags.end()); tags.erase (unique(tags.begin(), tags.end()), tags.end()); - + const string file_uri(Glib::filename_to_uri (member)); - + lrdf_remove_uri_matches (file_uri.c_str()); - + for (vector<string>::iterator i = tags.begin(); i != tags.end(); ++i) { lrdf_add_triple (src.c_str(), file_uri.c_str(), TAG, (*i).c_str(), lrdf_literal); } @@ -91,27 +91,27 @@ vector<string> AudioLibrary::get_tags (string member) { vector<string> tags; - + lrdf_statement pattern; pattern.subject = strdup(Glib::filename_to_uri(member).c_str()); pattern.predicate = (char*)TAG; pattern.object = 0; pattern.object_type = lrdf_literal; - + lrdf_statement* matches = lrdf_matches (&pattern); free (pattern.subject); - + lrdf_statement* current = matches; while (current != 0) { tags.push_back (current->object); - + current = current->next; } - + lrdf_free_statements (matches); - + sort (tags.begin(), tags.end()); - + return tags; } diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index d6bd83a478..a140d19da1 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -73,9 +73,9 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, stri RegionList::const_iterator out_n = regions.begin(); while (out_o != other->regions.end()) { - + boost::shared_ptr<AudioRegion>ar2 = boost::dynamic_pointer_cast<AudioRegion>(*out_o); - + if ((*xfades)->out() == ar2) { boost::shared_ptr<AudioRegion>in = boost::dynamic_pointer_cast<AudioRegion>(*in_n); boost::shared_ptr<AudioRegion>out = boost::dynamic_pointer_cast<AudioRegion>(*out_n); @@ -83,7 +83,7 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, stri add_crossfade(new_fade); break; } - + out_o++; out_n++; } @@ -104,12 +104,12 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, nfra AudioPlaylist::~AudioPlaylist () { - GoingAway (); /* EMIT SIGNAL */ + GoingAway (); /* EMIT SIGNAL */ /* drop connections to signals */ notify_callbacks (); - + _crossfades.clear (); } @@ -129,9 +129,9 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nf nframes_t skip_frames; /* optimizing this memset() away involves a lot of conditionals - that may well cause more of a hit due to cache misses + that may well cause more of a hit due to cache misses and related stuff than just doing this here. - + it would be great if someone could measure this at some point. @@ -143,7 +143,7 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nf memset (buf, 0, sizeof (Sample) * cnt); - /* this function is never called from a realtime thread, so + /* this function is never called from a realtime thread, so its OK to block (for short intervals). */ @@ -202,7 +202,7 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nf ar->read_at (buf, mixdown_buffer, gain_buffer, start, cnt, chan_n, read_frames, skip_frames); _read_data_count += ar->read_data_count(); } - + for (vector<boost::shared_ptr<Crossfade> >::iterator i = x.begin(); i != x.end(); ++i) { (*i)->read_at (buf, mixdown_buffer, gain_buffer, start, cnt, chan_n); @@ -225,7 +225,7 @@ AudioPlaylist::remove_dependents (boost::shared_ptr<Region> region) if (in_set_state) { return; } - + if (r == 0) { fatal << _("programming error: non-audio Region passed to remove_overlap in audio playlist") << endmsg; @@ -233,7 +233,7 @@ AudioPlaylist::remove_dependents (boost::shared_ptr<Region> region) } for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ) { - + if ((*i)->involves (r)) { i = _crossfades.erase (i); } else { @@ -260,7 +260,7 @@ AudioPlaylist::flush_notifications () } _pending_xfade_adds.clear (); - + in_flush = false; } @@ -277,7 +277,7 @@ AudioPlaylist::refresh_dependents (boost::shared_ptr<Region> r) for (Crossfades::iterator x = _crossfades.begin(); x != _crossfades.end();) { Crossfades::iterator tmp; - + tmp = x; ++tmp; @@ -286,7 +286,7 @@ AudioPlaylist::refresh_dependents (boost::shared_ptr<Region> r) if ((*x)->involves (ar)) { pair<set<boost::shared_ptr<Crossfade> >::iterator, bool> const u = updated.insert (*x); - + if (u.second) { /* x was successfully inserted into the set, so it has not already been updated */ try { @@ -316,7 +316,7 @@ AudioPlaylist::finalize_split_region (boost::shared_ptr<Region> o, boost::shared ++tmp; boost::shared_ptr<Crossfade> fade; - + if ((*x)->_in == orig) { if (! (*x)->covers(right->position())) { fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, left, (*x)->_out)); @@ -325,7 +325,7 @@ AudioPlaylist::finalize_split_region (boost::shared_ptr<Region> o, boost::shared fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, right, (*x)->_out)); } } - + if ((*x)->_out == orig) { if (! (*x)->covers(right->position())) { fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, (*x)->_in, right)); @@ -334,7 +334,7 @@ AudioPlaylist::finalize_split_region (boost::shared_ptr<Region> o, boost::shared fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, (*x)->_in, left)); } } - + if (fade) { _crossfades.remove (*x); add_crossfade (fade); @@ -385,7 +385,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh) if (other->muted() || region->muted()) { continue; } - + if (other->layer() < region->layer()) { top = region; @@ -413,41 +413,41 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh) break; case OverlapExternal: - + /* [ -------- top ------- ] * {=========== bottom =============} */ - + /* to avoid discontinuities at the region boundaries of an internal overlap (this region is completely within another), we create two hidden crossfades at each boundary. this is not dependent on the auto-xfade option, because we require it as basic audio engineering. */ - + xfade_length = min ((nframes_t) 720, top->length()); if (top_region_at (top->first_frame()) == top) { - + xfade = boost::shared_ptr<Crossfade> (new Crossfade (top, bottom, xfade_length, top->first_frame(), StartOfIn)); add_crossfade (xfade); } if (top_region_at (top->last_frame() - 1) == top) { - /* - only add a fade out if there is no region on top of the end of 'top' (which + /* + only add a fade out if there is no region on top of the end of 'top' (which would cover it). */ - + xfade = boost::shared_ptr<Crossfade> (new Crossfade (bottom, top, xfade_length, top->last_frame() - xfade_length, EndOfOut)); add_crossfade (xfade); } break; case OverlapStart: - /* { ==== top ============ } - * [---- bottom -------------------] + /* { ==== top ============ } + * [---- bottom -------------------] */ if (_session.config.get_xfade_model() == FullCrossfade) { @@ -458,8 +458,8 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh) } } else { - touched_regions = regions_touched (top->first_frame(), - top->first_frame() + min ((nframes_t)_session.config.get_short_xfade_seconds() * _session.frame_rate(), + touched_regions = regions_touched (top->first_frame(), + top->first_frame() + min ((nframes_t)_session.config.get_short_xfade_seconds() * _session.frame_rate(), top->length())); if (touched_regions->size() <= 2) { xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, _session.config.get_xfade_model(), _session.config.get_xfades_active())); @@ -470,22 +470,22 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh) case OverlapEnd: - /* [---- top ------------------------] - * { ==== bottom ============ } - */ + /* [---- top ------------------------] + * { ==== bottom ============ } + */ if (_session.config.get_xfade_model() == FullCrossfade) { touched_regions = regions_touched (bottom->first_frame(), top->last_frame()); if (touched_regions->size() <= 2) { - xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, + xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, _session.config.get_xfade_model(), _session.config.get_xfades_active())); add_crossfade (xfade); } } else { - touched_regions = regions_touched (bottom->first_frame(), - bottom->first_frame() + min ((nframes_t)_session.config.get_short_xfade_seconds() * _session.frame_rate(), + touched_regions = regions_touched (bottom->first_frame(), + bottom->first_frame() + min ((nframes_t)_session.config.get_short_xfade_seconds() * _session.frame_rate(), bottom->length())); if (touched_regions->size() <= 2) { xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, _session.config.get_xfade_model(), _session.config.get_xfades_active())); @@ -494,7 +494,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh) } break; default: - xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, + xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, _session.config.get_xfade_model(), _session.config.get_xfades_active())); add_crossfade (xfade); } @@ -503,11 +503,11 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh) catch (failed_constructor& err) { continue; } - + catch (Crossfade::NoCrossfadeHere& err) { continue; } - + } } @@ -521,7 +521,7 @@ AudioPlaylist::add_crossfade (boost::shared_ptr<Crossfade> xfade) break; } } - + if (ci != _crossfades.end()) { // it will just go away } else { @@ -533,7 +533,7 @@ AudioPlaylist::add_crossfade (boost::shared_ptr<Crossfade> xfade) notify_crossfade_added (xfade); } } - + void AudioPlaylist::notify_crossfade_added (boost::shared_ptr<Crossfade> x) { if (g_atomic_int_get(&block_notifications)) { @@ -569,7 +569,7 @@ AudioPlaylist::set_state (const XMLNode& node) Playlist::set_state (node); freeze (); - + nlist = node.children(); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { @@ -587,10 +587,10 @@ AudioPlaylist::set_state (const XMLNode& node) xfade->StateChanged.connect (mem_fun (*this, &AudioPlaylist::crossfade_changed)); NewCrossfade(xfade); } - + catch (failed_constructor& err) { // cout << string_compose (_("could not create crossfade object in playlist %1"), - // _name) + // _name) // << endl; continue; } @@ -619,7 +619,7 @@ AudioPlaylist::state (bool full_state) node.add_child_nocopy ((*i)->get_state()); } } - + return node; } @@ -636,9 +636,9 @@ AudioPlaylist::dump () const for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) { r = *i; - cerr << " " << r->name() << " @ " << r << " [" - << r->start() << "+" << r->length() - << "] at " + cerr << " " << r->name() << " @ " << r << " [" + << r->start() << "+" << r->length() + << "] at " << r->position() << " on layer " << r->layer () @@ -647,13 +647,13 @@ AudioPlaylist::dump () const for (Crossfades::const_iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) { x = *i; - cerr << " xfade [" + cerr << " xfade [" << x->out()->name() << ',' << x->in()->name() << " @ " << x->position() - << " length = " + << " length = " << x->length () << " active ? " << (x->active() ? "yes" : "no") @@ -680,15 +680,15 @@ AudioPlaylist::destroy_region (boost::shared_ptr<Region> region) RegionLock rlock (this); for (RegionList::iterator i = regions.begin(); i != regions.end(); ) { - + RegionList::iterator tmp = i; ++tmp; - + if ((*i) == region) { regions.erase (i); changed = true; } - + i = tmp; } @@ -696,12 +696,12 @@ AudioPlaylist::destroy_region (boost::shared_ptr<Region> region) set<boost::shared_ptr<Region> >::iterator xtmp = x; ++xtmp; - + if ((*x) == region) { all_regions.erase (x); changed = true; } - + x = xtmp; } @@ -716,7 +716,7 @@ AudioPlaylist::destroy_region (boost::shared_ptr<Region> region) unique_xfades.insert (*c); _crossfades.erase (c); } - + c = ctmp; } @@ -766,7 +766,7 @@ AudioPlaylist::region_changed (Change what_changed, boost::shared_ptr<Region> re notify_modified (); } - return true; + return true; } void @@ -782,7 +782,7 @@ AudioPlaylist::crossfades_at (nframes_t frame, Crossfades& clist) if (frame >= start && frame <= end) { clist.push_back (*i); - } + } } } diff --git a/libs/ardour/audio_playlist_importer.cc b/libs/ardour/audio_playlist_importer.cc index 905169345f..d97e95195f 100644 --- a/libs/ardour/audio_playlist_importer.cc +++ b/libs/ardour/audio_playlist_importer.cc @@ -42,11 +42,11 @@ AudioPlaylistImportHandler::AudioPlaylistImportHandler (XMLTree const & source, { XMLNode const * root = source.root(); XMLNode const * playlists; - + if (!(playlists = root->child (nodename))) { throw failed_constructor(); } - + XMLNodeList const & pl_children = playlists->children(); for (XMLNodeList::const_iterator it = pl_children.begin(); it != pl_children.end(); ++it) { const XMLProperty* type = (*it)->property("type"); @@ -92,7 +92,7 @@ AudioPlaylistImportHandler::playlists_by_diskstream (PBD::ID const & id, Playlis } /*** AudioPlaylistImporter ***/ -AudioPlaylistImporter::AudioPlaylistImporter (XMLTree const & source, Session & session, AudioPlaylistImportHandler & handler, XMLNode const & node) : +AudioPlaylistImporter::AudioPlaylistImporter (XMLTree const & source, Session & session, AudioPlaylistImportHandler & handler, XMLNode const & node) : ElementImporter (source, session), handler (handler), orig_node (node), @@ -100,9 +100,9 @@ AudioPlaylistImporter::AudioPlaylistImporter (XMLTree const & source, Session & diskstream_id ("0") { bool ds_ok = false; - + populate_region_list (); - + // Parse XML XMLPropertyList const & props = xml_playlist.properties(); for (XMLPropertyList::const_iterator it = props.begin(); it != props.end(); ++it) { @@ -118,7 +118,7 @@ AudioPlaylistImporter::AudioPlaylistImporter (XMLTree const & source, Session & std::cerr << string_compose (X_("AudioPlaylistImporter did not recognise XML-property \"%1\""), prop) << endmsg; } } - + if (!ds_ok) { error << string_compose (X_("AudioPlaylistImporter (%1): did not find XML-property \"orig_diskstream_id\" which is mandatory"), name) << endmsg; throw failed_constructor(); @@ -137,7 +137,7 @@ AudioPlaylistImporter::AudioPlaylistImporter (AudioPlaylistImporter const & othe AudioPlaylistImporter::~AudioPlaylistImporter () { - + } string @@ -146,21 +146,21 @@ AudioPlaylistImporter::get_info () const XMLNodeList children = xml_playlist.children(); unsigned int regions = 0; std::ostringstream oss; - + for (XMLNodeIterator it = children.begin(); it != children.end(); it++) { if ((*it)->name() == "Region") { ++regions; } } - + oss << regions << " "; - + if (regions == 1) { oss << _("region"); } else { oss << _("regions"); } - + return oss.str(); } @@ -177,7 +177,7 @@ AudioPlaylistImporter::_prepare_move () } xml_playlist.property ("name")->set_value (name); handler.add_name (name); - + return true; } @@ -191,10 +191,10 @@ void AudioPlaylistImporter::_move () { boost::shared_ptr<Playlist> playlist; - + // Update diskstream id xml_playlist.property ("orig-diskstream-id")->set_value (diskstream_id.to_s()); - + // Update region XML in playlist and prepare sources xml_playlist.remove_nodes("Region"); for (RegionList::iterator it = regions.begin(); it != regions.end(); ++it) { @@ -206,7 +206,7 @@ AudioPlaylistImporter::_move () return; // TODO clean up? } } - + // Update region ids in crossfades XMLNodeList crossfades = xml_playlist.children("Crossfade"); for (XMLNodeIterator it = crossfades.begin(); it != crossfades.end(); ++it) { @@ -215,22 +215,22 @@ AudioPlaylistImporter::_move () if (!in || !out) { error << string_compose (X_("AudioPlaylistImporter (%1): did not find the \"in\" or \"out\" property from a crossfade"), name) << endmsg; } - + handler.update_region_id (in); handler.update_region_id (out); - + // rate convert length and position XMLProperty* length = (*it)->property("length"); if (length) { length->set_value (rate_convert_samples (length->value())); } - + XMLProperty* position = (*it)->property("position"); if (position) { position->set_value (rate_convert_samples (position->value())); } } - + // Create playlist playlist = PlaylistFactory::create (session, xml_playlist, false, true); } diff --git a/libs/ardour/audio_port.cc b/libs/ardour/audio_port.cc index f69d6685ff..a75f7d7a09 100644 --- a/libs/ardour/audio_port.cc +++ b/libs/ardour/audio_port.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,8 +44,8 @@ AudioPort::cycle_start (nframes_t nframes) /* get_buffer() must only be run on outputs here in cycle_start(). - Inputs must be done in the correct processing order, which - requires interleaving with route processing. that will + Inputs must be done in the correct processing order, which + requires interleaving with route processing. that will happen when Port::get_buffer() is called. */ @@ -89,8 +89,8 @@ AudioPort::get_audio_buffer (nframes_t nframes, nframes_t offset) */ _buffer->set_data ((Sample *) jack_port_get_buffer (_jack_port, nframes) + offset + _port_offset, nframes); - } - + } + /* output ports set their _buffer data information during ::cycle_start() */ diff --git a/libs/ardour/audio_region_importer.cc b/libs/ardour/audio_region_importer.cc index de5d6f7102..19653f55c0 100644 --- a/libs/ardour/audio_region_importer.cc +++ b/libs/ardour/audio_region_importer.cc @@ -44,11 +44,11 @@ AudioRegionImportHandler::AudioRegionImportHandler (XMLTree const & source, Sess { XMLNode const * root = source.root(); XMLNode const * regions; - + if (!(regions = root->child (X_("Regions")))) { throw failed_constructor(); } - + create_regions_from_children (*regions, elements); } @@ -105,7 +105,7 @@ AudioRegionImportHandler::get_new_id (PBD::ID & old_id) const } /*** AudioRegionImporter ***/ -AudioRegionImporter::AudioRegionImporter (XMLTree const & source, Session & session, AudioRegionImportHandler & handler, XMLNode const & node) : +AudioRegionImporter::AudioRegionImporter (XMLTree const & source, Session & session, AudioRegionImportHandler & handler, XMLNode const & node) : ElementImporter (source, session), xml_region (node), handler (handler), @@ -129,26 +129,26 @@ AudioRegionImporter::get_info () const nframes_t length, position; SMPTE::Time length_time, position_time; std::ostringstream oss; - + // Get sample positions std::istringstream iss_length(xml_region.property ("length")->value()); iss_length >> length; std::istringstream iss_position(xml_region.property ("position")->value()); iss_position >> position; - + // Convert to smpte session.sample_to_smpte(length, length_time, true, false); session.sample_to_smpte(position, position_time, true, false); - + // return info oss << _("Length: ") << smpte_to_string(length_time) << - _("\nPosition: ") << + _("\nPosition: ") << smpte_to_string(position_time) << _("\nChannels: ") << xml_region.property ("channels")->value(); - + return oss.str(); } @@ -172,11 +172,11 @@ AudioRegionImporter::_move () return; } } - + if (broken()) { return; } - + session.add_regions (region); } @@ -186,7 +186,7 @@ AudioRegionImporter::parse_xml_region () XMLPropertyList const & props = xml_region.properties(); bool id_ok = false; bool name_ok = false; - + for (XMLPropertyList::const_iterator it = props.begin(); it != props.end(); ++it) { string prop = (*it)->name(); if (!prop.compare ("type") || !prop.compare ("stretch") || @@ -216,17 +216,17 @@ AudioRegionImporter::parse_xml_region () std::cerr << string_compose (X_("AudioRegionImporter (%1): did not recognise XML-property \"%2\""), name, prop) << endmsg; } } - + if (!id_ok) { error << string_compose (X_("AudioRegionImporter (%1): did not find necessary XML-property \"id\""), name) << endmsg; return false; } - + if (!name_ok) { error << X_("AudioRegionImporter: did not find necessary XML-property \"name\"") << endmsg; return false; } - + return true; } @@ -239,23 +239,23 @@ AudioRegionImporter::parse_source_xml () PBD::sys::path source_path; XMLNode * source_node; XMLProperty *prop; - + // Get XML for sources if (!(source_node = source.root()->child (X_("Sources")))) { return false; } XMLNodeList const & sources = source_node->children(); - + // Get source for each channel if (!(prop = xml_region.property ("channels"))) { error << string_compose (X_("AudioRegionImporter (%1): did not find necessary XML-property \"channels\""), name) << endmsg; return false; } - + channels = atoi (prop->value()); for (uint32_t i = 0; i < channels; ++i) { bool source_found = false; - + // Get id for source-n snprintf (buf, sizeof(buf), X_("source-%d"), i); prop = xml_region.property (buf); @@ -264,7 +264,7 @@ AudioRegionImporter::parse_source_xml () return false; } string source_id = prop->value(); - + // Get source for (XMLNodeList::const_iterator it = sources.begin(); it != sources.end(); it++) { prop = (*it)->property ("id"); @@ -277,18 +277,18 @@ AudioRegionImporter::parse_source_xml () } source_path /= prop->value(); filenames.push_back (source_path.to_string()); - + source_found = true; break; } } - + if (!source_found) { error << string_compose (X_("AudioRegionImporter (%1): could not find all necessary sources"), name) << endmsg; return false; } } - + return true; } @@ -299,7 +299,7 @@ AudioRegionImporter::get_sound_dir (XMLTree const & tree) source_dir = source_dir.branch_path(); SessionDirectory session_dir(source_dir); source_dir = session_dir.sound_path(); - + return source_dir; } @@ -309,15 +309,15 @@ AudioRegionImporter::prepare_region () if (region_prepared) { return; } - + SourceList source_list; prepare_sources(); - + // Create source list for (std::list<string>::iterator it = filenames.begin(); it != filenames.end(); ++it) { source_list.push_back (handler.get_source (*it)); } - + // create region and update XML region.push_back (RegionFactory::create (source_list, xml_region)); if (*region.begin()) { @@ -336,7 +336,7 @@ AudioRegionImporter::prepare_sources () if (sources_prepared) { return; } - + status.total = 0; status.replace_existing_source = false; status.done = false; @@ -344,7 +344,7 @@ AudioRegionImporter::prepare_sources () status.freeze = false; status.progress = 0.0; status.quality = SrcBest; // TODO other qualities also - + // Get sources that still need to be imported for (std::list<string>::iterator it = filenames.begin(); it != filenames.end(); ++it) { if (!handler.check_source (*it)) { @@ -352,11 +352,11 @@ AudioRegionImporter::prepare_sources () status.total++; } } - + // import files // TODO: threading & exception handling session.import_audiofiles (status); - + // Add imported sources to handlers map std::vector<Glib::ustring>::iterator file_it = status.paths.begin(); for (SourceList::iterator source_it = status.sources.begin(); source_it != status.sources.end(); ++source_it) { @@ -367,10 +367,10 @@ AudioRegionImporter::prepare_sources () handler.set_errors(); set_broken(); } - + ++file_it; } - + sources_prepared = true; } @@ -380,22 +380,22 @@ AudioRegionImporter::add_sources_to_session () if (!sources_prepared) { prepare_sources(); } - + if (broken()) { return; } - + for (std::list<string>::iterator it = filenames.begin(); it != filenames.end(); ++it) { session.add_source (handler.get_source (*it)); } } -XMLNode const & +XMLNode const & AudioRegionImporter::get_xml () { if(!region_prepared) { prepare_region(); } - + return xml_region; } diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 8e68eb0140..1d4412b950 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -82,10 +82,10 @@ AudioTrack::use_new_diskstream () } else if (_mode == NonLayered){ dflags = AudioDiskstream::Flag(dflags | AudioDiskstream::NonLayered); } - + boost::shared_ptr<AudioDiskstream> ds (new AudioDiskstream (_session, name(), dflags)); - + _session.add_diskstream (ds); set_diskstream (boost::dynamic_pointer_cast<AudioDiskstream> (ds), this); @@ -99,10 +99,10 @@ AudioTrack::set_mode (TrackMode m) if (_diskstream->set_destructive (m == Destructive)) { return -1; } - + _diskstream->set_non_layered (m == NonLayered); _mode = m; - + TrackModeChanged (); /* EMIT SIGNAL */ } @@ -117,7 +117,7 @@ AudioTrack::can_use_mode (TrackMode m, bool& bounce_required) case Normal: bounce_required = false; return true; - + case Destructive: default: return _diskstream->can_become_destructive (bounce_required); @@ -146,16 +146,16 @@ AudioTrack::deprecated_use_diskstream_connections () if ((prop = node.property ("input-connection")) != 0) { boost::shared_ptr<Bundle> c = _session.bundle_by_name (prop->value()); - + if (c == 0) { - error << string_compose(_("Unknown bundle \"%1\" listed for input of %2"), prop->value(), _name) << endmsg; - + error << string_compose(_("Unknown bundle \"%1\" listed for input of %2"), prop->value(), _name) << endmsg; + if ((c = _session.bundle_by_name (_("in 1"))) == 0) { - error << _("No input bundles available as a replacement") + error << _("No input bundles available as a replacement") << endmsg; return -1; } else { - info << string_compose (_("Bundle %1 was not available - \"in 1\" used instead"), prop->value()) + info << string_compose (_("Bundle %1 was not available - \"in 1\" used instead"), prop->value()) << endmsg; } } @@ -164,11 +164,11 @@ AudioTrack::deprecated_use_diskstream_connections () } else if ((prop = node.property ("inputs")) != 0) { if (_input->set_ports (prop->value())) { - error << string_compose(_("improper input channel list in XML node (%1)"), prop->value()) << endmsg; + error << string_compose(_("improper input channel list in XML node (%1)"), prop->value()) << endmsg; return -1; } } - + return 0; } @@ -198,9 +198,9 @@ AudioTrack::set_diskstream (boost::shared_ptr<AudioDiskstream> ds, void * /*src* DiskstreamChanged (); /* EMIT SIGNAL */ return 0; -} +} -int +int AudioTrack::use_diskstream (string name) { boost::shared_ptr<AudioDiskstream> dstream; @@ -209,20 +209,20 @@ AudioTrack::use_diskstream (string name) error << string_compose(_("AudioTrack: audio diskstream \"%1\" not known by session"), name) << endmsg; return -1; } - + return set_diskstream (dstream, this); } -int +int AudioTrack::use_diskstream (const PBD::ID& id) { boost::shared_ptr<AudioDiskstream> dstream; if ((dstream = boost::dynamic_pointer_cast<AudioDiskstream> (_session.diskstream_by_id (id))) == 0) { - error << string_compose(_("AudioTrack: audio diskstream \"%1\" not known by session"), id) << endmsg; + error << string_compose(_("AudioTrack: audio diskstream \"%1\" not known by session"), id) << endmsg; return -1; } - + return set_diskstream (dstream, this); } @@ -257,7 +257,7 @@ AudioTrack::_set_state (const XMLNode& node, bool call_base) } if ((prop = node.property ("diskstream-id")) == 0) { - + /* some old sessions use the diskstream name rather than the ID */ if ((prop = node.property ("diskstream")) == 0) { @@ -271,10 +271,10 @@ AudioTrack::_set_state (const XMLNode& node, bool call_base) } } else { - + PBD::ID id (prop->value()); PBD::ID zero ("0"); - + /* this wierd hack is used when creating tracks from a template. there isn't a particularly good time to interpose between setting the first part of the track state (notably Route::set_state() and the track mode), and the @@ -282,7 +282,7 @@ AudioTrack::_set_state (const XMLNode& node, bool call_base) that means "you should create a new diskstream here, not look for an old one. */ - + if (id == zero) { use_new_diskstream (); } else if (use_diskstream (id)) { @@ -316,7 +316,7 @@ AudioTrack::_set_state (const XMLNode& node, bool call_base) return 0; } -XMLNode& +XMLNode& AudioTrack::state(bool full_state) { XMLNode& root (Route::state(full_state)); @@ -335,7 +335,7 @@ AudioTrack::state(bool full_state) (*i)->id.print (buf, sizeof (buf)); inode->add_property (X_("id"), buf); inode->add_child_copy ((*i)->state); - + freeze_node->add_child_nocopy (*inode); } @@ -343,7 +343,7 @@ AudioTrack::state(bool full_state) } /* Alignment: act as a proxy for the diskstream */ - + XMLNode* align_node = new XMLNode (X_("Alignment")); AlignStyle as = _diskstream->alignment_style (); align_node->add_property (X_("style"), enum_2_string (as)); @@ -383,12 +383,12 @@ AudioTrack::set_state_part_two () if ((fnode = find_named_node (*pending_state, X_("freeze-info"))) != 0) { _freeze_record.state = Frozen; - + for (vector<FreezeRecordProcessorInfo*>::iterator i = _freeze_record.processor_info.begin(); i != _freeze_record.processor_info.end(); ++i) { delete *i; } _freeze_record.processor_info.clear (); - + if ((prop = fnode->property (X_("playlist"))) != 0) { boost::shared_ptr<Playlist> pl = _session.playlist_by_name (prop->value()); if (pl) { @@ -399,23 +399,23 @@ AudioTrack::set_state_part_two () return; } } - + if ((prop = fnode->property (X_("state"))) != 0) { _freeze_record.state = FreezeState (string_2_enum (prop->value(), _freeze_record.state)); } - + XMLNodeConstIterator citer; XMLNodeList clist = fnode->children(); - + for (citer = clist.begin(); citer != clist.end(); ++citer) { if ((*citer)->name() != X_("processor")) { continue; } - + if ((prop = (*citer)->property (X_("id"))) == 0) { continue; } - + FreezeRecordProcessorInfo* frii = new FreezeRecordProcessorInfo (*((*citer)->children().front()), boost::shared_ptr<Processor>()); frii->id = prop->value (); @@ -446,7 +446,7 @@ AudioTrack::set_state_part_two () } } return; -} +} int AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, int declick, @@ -457,7 +457,7 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, Sample* tmpb; nframes_t transport_frame; boost::shared_ptr<AudioDiskstream> diskstream = audio_diskstream(); - + { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); if (lm.locked()) { @@ -467,7 +467,7 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, } } - + if (n_outputs().n_total() == 0 && _processors.empty()) { return 0; } @@ -486,7 +486,7 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, to do nothing. */ return diskstream->process (transport_frame, 0, can_record, rec_monitors_input); - } + } _silent = false; _amp->apply_gain_automation(false); @@ -497,7 +497,7 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, } /* special condition applies */ - + if (_meter_point == MeterInput) { _input->process_input (_meter, start_frame, end_frame, nframes); } @@ -520,7 +520,7 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, while in the process() tree. */ - + /* copy the diskstream data to all output buffers */ size_t limit = n_process_buffers().n_audio(); @@ -536,19 +536,19 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, but loaded with an 8 channel file. there are only 2 passthrough buffers, but n_process_buffers() will return 8. - + arbitrary decision: map all channels in the diskstream to the outputs available. */ float scaling = limit/blimit; - + for (i = 0, n = 1; i < blimit; ++i, ++n) { - /* first time through just copy a channel into + /* first time through just copy a channel into the output buffer. */ - + Sample* bb = bufs.get_audio (i).data(); for (nframes_t xx = 0; xx < nframes; ++xx) { @@ -564,27 +564,27 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, } for (;i < limit; ++i, ++n) { - + /* for all remaining channels, sum with existing - data in the output buffers + data in the output buffers */ - + bufs.get_audio (i%blimit).accumulate_with_gain_from (b, nframes, 0, scaling); - + if (n < diskstream->n_channels().n_audio()) { tmpb = diskstream->playback_buffer(n); if (tmpb!=0) { b = tmpb; } } - + } limit = blimit; } else { for (i = 0, n = 1; i < limit; ++i, ++n) { - memcpy (bufs.get_audio (i).data(), b, sizeof (Sample) * nframes); + memcpy (bufs.get_audio (i).data(), b, sizeof (Sample) * nframes); if (n < diskstream->n_channels().n_audio()) { tmpb = diskstream->playback_buffer(n); if (tmpb!=0) { @@ -594,7 +594,7 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, } /* try to leave any MIDI buffers alone */ - + ChanCount chn; chn.set_audio (limit); chn.set_midi (_input->n_ports().n_midi()); @@ -606,7 +606,7 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, if (!diskstream->record_enabled() && _session.transport_rolling()) { #ifdef XXX_MOVE_THIS_TO_AMP Glib::Mutex::Lock am (data().control_lock(), Glib::TRY_LOCK); - + if (am.locked() && gain_control()->automation_playback()) { _amp->apply_gain_automation( gain_control()->list()->curve().rt_safe_get_vector ( @@ -616,7 +616,7 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, } process_output_buffers (bufs, start_frame, end_frame, nframes, (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick); - + } else { /* problem with the diskstream; just be quiet for a bit */ silence (nframes); @@ -632,7 +632,7 @@ AudioTrack::export_stuff (BufferSet& buffers, sframes_t start, nframes_t nframes float mix_buffer[nframes]; ProcessorList::iterator i; boost::shared_ptr<AudioDiskstream> diskstream = audio_diskstream(); - + Glib::RWLock::ReaderLock rlock (_processor_lock); boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(diskstream->playlist()); @@ -658,7 +658,7 @@ AudioTrack::export_stuff (BufferSet& buffers, sframes_t start, nframes_t nframes } else { /* duplicate last across remaining buffers */ - memcpy (bi->data(), b, sizeof (Sample) * nframes); + memcpy (bi->data(), b, sizeof (Sample) * nframes); } } @@ -670,14 +670,14 @@ AudioTrack::export_stuff (BufferSet& buffers, sframes_t start, nframes_t nframes /* note: only run processors during export. other layers in the machinery will already have checked that there are no external port processors. */ - + for (i = _processors.begin(); i != _processors.end(); ++i) { boost::shared_ptr<Processor> processor; if ((processor = boost::dynamic_pointer_cast<Processor>(*i)) != 0) { processor->run (buffers, start, start+nframes, nframes); } } - + return 0; } @@ -704,7 +704,7 @@ AudioTrack::freeze (InterThreadInfo& itt) string dir; string region_name; boost::shared_ptr<AudioDiskstream> diskstream = audio_diskstream(); - + if ((_freeze_record.playlist = boost::dynamic_pointer_cast<AudioPlaylist>(diskstream->playlist())) == 0) { return; } @@ -712,9 +712,9 @@ AudioTrack::freeze (InterThreadInfo& itt) uint32_t n = 1; while (n < (UINT_MAX-1)) { - + string candidate; - + candidate = string_compose ("<F%2>%1", _freeze_record.playlist->name(), n); if (_session.playlist_by_name (candidate) == 0) { @@ -724,11 +724,11 @@ AudioTrack::freeze (InterThreadInfo& itt) ++n; - } + } if (n == (UINT_MAX-1)) { error << string_compose (X_("There are too many frozen versions of playlist \"%1\"" - " to create another one"), _freeze_record.playlist->name()) + " to create another one"), _freeze_record.playlist->name()) << endmsg; return; } @@ -743,21 +743,21 @@ AudioTrack::freeze (InterThreadInfo& itt) { Glib::RWLock::ReaderLock lm (_processor_lock); - + for (ProcessorList::iterator r = _processors.begin(); r != _processors.end(); ++r) { - + boost::shared_ptr<Processor> processor; if ((processor = boost::dynamic_pointer_cast<Processor>(*r)) != 0) { - + FreezeRecordProcessorInfo* frii = new FreezeRecordProcessorInfo ((*r)->get_state(), processor); - + frii->id = processor->id(); _freeze_record.processor_info.push_back (frii); - + /* now deactivate the processor */ - + processor->deactivate (); _session.set_dirty (); } @@ -775,7 +775,7 @@ AudioTrack::freeze (InterThreadInfo& itt) /* create a new region from all filesources, keep it private */ boost::shared_ptr<Region> region (RegionFactory::create (srcs, 0, - srcs[0]->length(srcs[0]->timeline_position()), + srcs[0]->length(srcs[0]->timeline_position()), region_name, 0, (Region::Flag) (Region::WholeFile|Region::DefaultFlags), false)); @@ -789,7 +789,7 @@ AudioTrack::freeze (InterThreadInfo& itt) diskstream->set_record_enabled (false); /* reset stuff that has already been accounted for in the freeze process */ - + set_gain (1.0, this); _amp->gain_control()->set_automation_state (Off); /* XXX need to use _main_outs _panner->set_automation_state (Off); */ @@ -815,7 +815,7 @@ AudioTrack::unfreeze () } } } - + _freeze_record.playlist.reset (); set_gain (_freeze_record.gain, this); _amp->gain_control()->set_automation_state (_freeze_record.gain_automation_state); diff --git a/libs/ardour/audio_track_importer.cc b/libs/ardour/audio_track_importer.cc index dd453f34c3..364d681217 100644 --- a/libs/ardour/audio_track_importer.cc +++ b/libs/ardour/audio_track_importer.cc @@ -44,11 +44,11 @@ AudioTrackImportHandler::AudioTrackImportHandler (XMLTree const & source, Sessio { XMLNode const * root = source.root(); XMLNode const * routes; - + if (!(routes = root->child ("Routes"))) { throw failed_constructor(); } - + XMLNodeList const & route_list = routes->children(); for (XMLNodeList::const_iterator it = route_list.begin(); it != route_list.end(); ++it) { const XMLProperty* type = (*it)->property("default-type"); @@ -86,22 +86,22 @@ AudioTrackImporter::AudioTrackImporter (XMLTree const & source, if (!parse_route_xml ()) { throw failed_constructor(); } - + if (!parse_io ()) { throw failed_constructor(); } - + XMLNodeList const & controllables = node.children ("Controllable"); for (XMLNodeList::const_iterator it = controllables.begin(); it != controllables.end(); ++it) { parse_controllable (**it); } - + XMLNode * remote_control = xml_track.child ("RemoteControl"); if (remote_control && (prop = remote_control->property ("id"))) { uint32_t control_id = session.ntracks() + session.nbusses() + 1; prop->set_value (to_string (control_id, std::dec)); } - + xml_track.remove_nodes_and_delete ("Extra"); } @@ -136,12 +136,12 @@ AudioTrackImporter::parse_route_xml () std::cerr << string_compose (X_("AudioTrackImporter: did not recognise XML-property \"%1\""), prop) << endmsg; } } - + if (!ds_ok) { error << X_("AudioTrackImporter: did not find necessary XML-property \"diskstream-id\"") << endmsg; return false; } - + return true; } @@ -155,7 +155,7 @@ AudioTrackImporter::parse_io () if (!(io = xml_track.child ("IO"))) { return false; } - + XMLPropertyList const & props = io->properties(); for (XMLPropertyList::const_iterator it = props.begin(); it != props.end(); ++it) { @@ -186,32 +186,32 @@ AudioTrackImporter::parse_io () std::cerr << string_compose (X_("AudioTrackImporter: did not recognise XML-property \"%1\""), prop) << endmsg; } } - + if (!name_ok) { error << X_("AudioTrackImporter: did not find necessary XML-property \"name\"") << endmsg; return false; } - + if (!id_ok) { error << X_("AudioTrackImporter: did not find necessary XML-property \"id\"") << endmsg; return false; } - + XMLNodeList const & controllables = io->children ("Controllable"); for (XMLNodeList::const_iterator it = controllables.begin(); it != controllables.end(); ++it) { parse_controllable (**it); } - + XMLNodeList const & processors = io->children ("Processor"); for (XMLNodeList::const_iterator it = processors.begin(); it != processors.end(); ++it) { parse_processor (**it); } - + XMLNodeList const & automations = io->children ("Automation"); for (XMLNodeList::const_iterator it = automations.begin(); it != automations.end(); ++it) { parse_automation (**it); } - + return true; } @@ -228,7 +228,7 @@ AudioTrackImporter::_prepare_move () /* Copy dependent playlists */ pl_handler.playlists_by_diskstream (old_ds_id, playlists); - + for (PlaylistList::iterator it = playlists.begin(); it != playlists.end(); ++it) { if (!(*it)->prepare_move ()) { playlists.clear (); @@ -236,9 +236,9 @@ AudioTrackImporter::_prepare_move () } (*it)->set_diskstream (new_ds_id); } - + /* Rename */ - + while (session.route_by_name (name) || !track_handler.check_name (name)) { std::pair<bool, string> rename_pair = Rename (_("A playlist with this name already exists, please rename it."), name); if (!rename_pair.first) { @@ -248,7 +248,7 @@ AudioTrackImporter::_prepare_move () } xml_track.child ("IO")->property ("name")->set_value (name); track_handler.add_name (name); - + return true; } @@ -261,21 +261,21 @@ AudioTrackImporter::_cancel_move () void AudioTrackImporter::_move () -{ +{ /* Add diskstream */ - + boost::shared_ptr<XMLSharedNodeList> ds_node_list; string xpath = "/Session/DiskStreams/AudioDiskstream[@id='" + old_ds_id.to_s() + "']"; ds_node_list = source.root()->find (xpath); - + if (ds_node_list->size() != 1) { error << string_compose (_("Error Importing Audio track %1"), name) << endmsg; return; } - + boost::shared_ptr<XMLNode> ds_node = ds_node_list->front(); ds_node->property ("id")->set_value (new_ds_id.to_s()); - + boost::shared_ptr<Diskstream> new_ds (new AudioDiskstream (session, *ds_node)); new_ds->set_name (name); session.add_diskstream (new_ds); @@ -300,7 +300,7 @@ AudioTrackImporter::parse_processor (XMLNode & node) if (automation) { parse_automation (*automation); } - + return true; } @@ -308,7 +308,7 @@ bool AudioTrackImporter::parse_controllable (XMLNode & node) { XMLProperty * prop; - + if ((prop = node.property ("id"))) { PBD::ID new_id; prop->set_value (new_id.to_s()); @@ -326,12 +326,12 @@ AudioTrackImporter::parse_automation (XMLNode & node) XMLNodeList const & lists = node.children ("AutomationList"); for (XMLNodeList::const_iterator it = lists.begin(); it != lists.end(); ++it) { XMLProperty * prop; - + if ((prop = (*it)->property ("id"))) { PBD::ID id; prop->set_value (id.to_s()); } - + if (!(*it)->name().compare ("events")) { rate_convert_events (**it); } @@ -352,14 +352,14 @@ AudioTrackImporter::rate_convert_events (XMLNode & node) if (content_node->content().empty()) { return false; } - + std::stringstream str (content_node->content()); std::ostringstream new_content; - + nframes_t x; double y; bool ok = true; - + while (str) { str >> x; if (!str) { @@ -370,10 +370,10 @@ AudioTrackImporter::rate_convert_events (XMLNode & node) ok = false; break; } - + new_content << rate_convert_samples (x) << ' ' << y; } - + if (!ok) { error << X_("AudioTrackImporter: error in rate converting automation events") << endmsg; return false; diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 9b313a3659..b0ced9bdfb 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -1,6 +1,6 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -62,7 +62,7 @@ static string preset_search_path = "/Library/Audio/Presets:/Network/Library/Audi static string preset_suffix = ".aupreset"; static bool preset_search_path_initialized = false; -static OSStatus +static OSStatus _render_callback(void *userData, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, @@ -73,7 +73,7 @@ _render_callback(void *userData, return ((AUPlugin*)userData)->render_callback (ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, ioData); } -static int +static int save_property_list (CFPropertyListRef propertyList, Glib::ustring path) { @@ -81,7 +81,7 @@ save_property_list (CFPropertyListRef propertyList, Glib::ustring path) int fd; // Convert the property list into XML data. - + xmlData = CFPropertyListCreateXMLData( kCFAllocatorDefault, propertyList); if (!xmlData) { @@ -119,10 +119,10 @@ save_property_list (CFPropertyListRef propertyList, Glib::ustring path) close (fd); return 0; } - -static CFPropertyListRef -load_property_list (Glib::ustring path) + +static CFPropertyListRef +load_property_list (Glib::ustring path) { int fd; CFPropertyListRef propertyList; @@ -130,12 +130,12 @@ load_property_list (Glib::ustring path) CFStringRef errorString; // Read the XML file. - + if ((fd = open (path.c_str(), O_RDONLY)) < 0) { return propertyList; } - + off_t len = lseek (fd, 0, SEEK_END); char* buf = new char[len]; lseek (fd, 0, SEEK_SET); @@ -145,13 +145,13 @@ load_property_list (Glib::ustring path) close (fd); return propertyList; } - + close (fd); xmlData = CFDataCreateWithBytesNoCopy (kCFAllocatorDefault, (UInt8*) buf, len, kCFAllocatorNull); - + // Reconstitute the dictionary using the XML data. - + propertyList = CFPropertyListCreateFromXMLData( kCFAllocatorDefault, xmlData, kCFPropertyListImmutable, @@ -164,7 +164,7 @@ load_property_list (Glib::ustring path) } //----------------------------------------------------------------------------- -static void +static void set_preset_name_in_plist (CFPropertyListRef plist, string preset_name) { if (!plist) { @@ -175,7 +175,7 @@ set_preset_name_in_plist (CFPropertyListRef plist, string preset_name) if (CFGetTypeID (plist) == CFDictionaryGetTypeID()) { CFDictionarySetValue ((CFMutableDictionaryRef)plist, CFSTR(kAUPresetNameKey), pn); } - + CFRelease (pn); } @@ -199,7 +199,7 @@ get_preset_name_in_plist (CFPropertyListRef plist) if (CFStringGetCString (str, local_buffer, len, kCFStringEncodingUTF8)) { ret = local_buffer; } - } + } } return ret; } @@ -213,7 +213,7 @@ Boolean ComponentDescriptionsMatch_General(const ComponentDescription * inCompon if ( (inComponentDescription1 == NULL) || (inComponentDescription2 == NULL) ) return FALSE; - if ( (inComponentDescription1->componentSubType == inComponentDescription2->componentSubType) + if ( (inComponentDescription1->componentSubType == inComponentDescription2->componentSubType) && (inComponentDescription1->componentManufacturer == inComponentDescription2->componentManufacturer) ) { // only sub-type and manufacturer IDs need to be equal @@ -250,7 +250,7 @@ Boolean ComponentAndDescriptionMatch_General(Component inComponent, const Compon //-------------------------------------------------------------------------- // determine if 2 ComponentDescriptions are basically equal -// (by that, I mean that the important identifying values are compared, +// (by that, I mean that the important identifying values are compared, // but not the ComponentDescription flags) Boolean ComponentDescriptionsMatch(const ComponentDescription * inComponentDescription1, const ComponentDescription * inComponentDescription2) { @@ -289,7 +289,7 @@ AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAC current_offset (0), current_buffers (0), frames_processed (0) -{ +{ if (!preset_search_path_initialized) { Glib::ustring p = Glib::get_home_dir(); p += "/Library/Audio/Presets:"; @@ -311,7 +311,7 @@ AUPlugin::AUPlugin (const AUPlugin& other) , current_offset (0) , current_buffers (0) , frames_processed (0) - + { init (); } @@ -344,13 +344,13 @@ AUPlugin::init () error << _("AudioUnit: Could not convert CAComponent to CAAudioUnit") << endmsg; throw failed_constructor (); } - + AURenderCallbackStruct renderCallbackInfo; renderCallbackInfo.inputProc = _render_callback; renderCallbackInfo.inputProcRefCon = this; - if ((err = unit->SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, + if ((err = unit->SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, (void*) &renderCallbackInfo, sizeof(renderCallbackInfo))) != 0) { cerr << "cannot install render callback (err = " << err << ')' << endl; throw failed_constructor(); @@ -381,8 +381,8 @@ void AUPlugin::discover_parameters () { /* discover writable parameters */ - - AudioUnitScope scopes[] = { + + AudioUnitScope scopes[] = { kAudioUnitScope_Global, kAudioUnitScope_Output, kAudioUnitScope_Input @@ -393,7 +393,7 @@ AUPlugin::discover_parameters () for (uint32_t i = 0; i < sizeof (scopes) / sizeof (scopes[0]); ++i) { AUParamInfo param_info (unit->AU(), false, false, scopes[i]); - + for (uint32_t i = 0; i < param_info.NumParams(); ++i) { AUParameterDescriptor d; @@ -472,10 +472,10 @@ AUPlugin::discover_parameters () d.toggled = (info.unit & kAudioUnitParameterUnit_Boolean) || (d.integer_step && ((d.upper - d.lower) == 1.0)); d.sr_dependent = (info.unit & kAudioUnitParameterUnit_SampleFrames); - d.automatable = !d.toggled && + d.automatable = !d.toggled && !(info.flags & kAudioUnitParameterFlag_NonRealTime) && (info.flags & kAudioUnitParameterFlag_IsWritable); - + d.logarithmic = (info.flags & kAudioUnitParameterFlag_DisplayLogarithmic); d.unit = info.unit; @@ -551,7 +551,7 @@ AUPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& pd) con if (which < descriptors.size()) { pd = descriptors[which]; return 0; - } + } return -1; } @@ -604,7 +604,7 @@ AUPlugin::_set_block_size (nframes_t nframes) initialized = false; } - if ((err = unit->SetProperty (kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, + if ((err = unit->SetProperty (kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, 0, &numFrames, sizeof (numFrames))) != noErr) { cerr << "cannot set max frames (err = " << err << ')' << endl; return -1; @@ -702,7 +702,7 @@ AUPlugin::can_do (int32_t in, int32_t& out) plugcnt = 1; } } - + if (possible_in == -1) { /* wildcard for input */ @@ -724,8 +724,8 @@ AUPlugin::can_do (int32_t in, int32_t& out) out = possible_out; plugcnt = 1; } - } - + } + if (possible_in == -2) { if (possible_out == -1) { @@ -778,7 +778,7 @@ AUPlugin::can_do (int32_t in, int32_t& out) if (possible_in == in) { /* exact number of inputs ... must match obviously */ - + if (possible_out == -1) { /* out must match in */ out = in; @@ -824,8 +824,8 @@ AUPlugin::set_output_format (AudioStreamBasicDescription& fmt) free (buffers); buffers = 0; } - - buffers = (AudioBufferList *) malloc (offsetof(AudioBufferList, mBuffers) + + + buffers = (AudioBufferList *) malloc (offsetof(AudioBufferList, mBuffers) + fmt.mChannelsPerFrame * sizeof(AudioBuffer)); Glib::Mutex::Lock em (_session.engine().process_lock()); @@ -877,7 +877,7 @@ AUPlugin::output_streams() const return output_channels; } -OSStatus +OSStatus AUPlugin::render_callback(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, @@ -928,7 +928,7 @@ AUPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, current_maxbuf = 0; frames_processed += nframes; - + for (uint32_t i = 0; i < maxbuf; ++i) { if (bufs[i] + offset != buffers->mBuffers[i].mData) { memcpy (bufs[i]+offset, buffers->mBuffers[i].mData, nframes * sizeof (Sample)); @@ -1005,7 +1005,7 @@ AUPlugin::get_state() } // Convert the property list into XML data. - + xmlData = CFPropertyListCreateXMLData( kCFAllocatorDefault, propertyList); if (!xmlData) { @@ -1034,7 +1034,7 @@ AUPlugin::get_state() seen_get_state_message = true; } #endif - + return *root; } @@ -1050,7 +1050,7 @@ AUPlugin::set_state(const XMLNode& node) error << _("Bad node sent to AUPlugin::set_state") << endmsg; return -1; } - + if (node.children().empty()) { return -1; } @@ -1071,14 +1071,14 @@ AUPlugin::set_state(const XMLNode& node) &errorString); CFRelease (xmlData); - + if (propertyList) { if (unit->SetAUPreset (propertyList) == noErr) { ret = 0; - } + } CFRelease (propertyList); } - + return ret; #else if (!seen_set_state_message) { @@ -1101,14 +1101,14 @@ AUPlugin::load_preset (const string preset_label) if (x == preset_map.end()) { return false; } - + if ((propertyList = load_property_list (x->second)) != 0) { if (unit->SetAUPreset (propertyList) == noErr) { ret = true; } CFRelease(propertyList); } - + return ret; #else if (!seen_loading_message) { @@ -1131,7 +1131,7 @@ AUPlugin::save_preset (string preset_name) std::string m = maker(); std::string n = name(); - + strip_whitespace_edges (m); strip_whitespace_edges (n); @@ -1141,7 +1141,7 @@ AUPlugin::save_preset (string preset_name) v.push_back ("Presets"); v.push_back (m); v.push_back (n); - + user_preset_path = Glib::build_filename (v); if (g_mkdir_with_parents (user_preset_path.c_str(), 0775) < 0) { @@ -1156,11 +1156,11 @@ AUPlugin::save_preset (string preset_name) // add the actual preset name */ v.push_back (preset_name + preset_suffix); - + // rebuild user_preset_path = Glib::build_filename (v); - + set_preset_name_in_plist (propertyList, preset_name); if (save_property_list (propertyList, user_preset_path)) { @@ -1183,7 +1183,7 @@ AUPlugin::save_preset (string preset_name) //----------------------------------------------------------------------------- // this is just a little helper function used by GetAUComponentDescriptionFromPresetFile() -static SInt32 +static SInt32 GetDictionarySInt32Value(CFDictionaryRef inAUStateDictionary, CFStringRef inDictionaryKey, Boolean * outSuccess) { CFNumberRef cfNumber; @@ -1211,7 +1211,7 @@ GetDictionarySInt32Value(CFDictionaryRef inAUStateDictionary, CFStringRef inDict return 0; } -static OSStatus +static OSStatus GetAUComponentDescriptionFromStateData(CFPropertyListRef inAUStateData, ComponentDescription * outComponentDescription) { CFDictionaryRef auStateDictionary; @@ -1221,7 +1221,7 @@ GetAUComponentDescriptionFromStateData(CFPropertyListRef inAUStateData, Componen if ( (inAUStateData == NULL) || (outComponentDescription == NULL) ) return paramErr; - + // the property list for AU state data must be of the dictionary type if (CFGetTypeID(inAUStateData) != CFDictionaryGetTypeID()) { return kAudioUnitErr_InvalidPropertyValue; @@ -1259,7 +1259,7 @@ static bool au_preset_filter (const string& str, void* arg) /* Not a dotfile, has a prefix before a period, suffix is aupreset */ bool ret; - + ret = (str[0] != '.' && str.length() > 9 && str.find (preset_suffix) == (str.length() - preset_suffix.length())); if (ret && arg) { @@ -1284,32 +1284,32 @@ static bool au_preset_filter (const string& str, void* arg) match = m; match += '/'; match += n; - + ret = str.find (match) != string::npos; } } - + return ret; } -bool +bool check_and_get_preset_name (Component component, const string& pathstr, string& preset_name) { OSStatus status; CFPropertyListRef plist; ComponentDescription presetDesc; bool ret = false; - + plist = load_property_list (pathstr); if (!plist) { return ret; } - + // get the ComponentDescription from the AU preset file - + status = GetAUComponentDescriptionFromStateData(plist, &presetDesc); - + if (status == noErr) { if (ComponentAndDescriptionMatch_Loosely(component, &presetDesc)) { @@ -1332,7 +1332,7 @@ check_and_get_preset_name (Component component, const string& pathstr, string& p } } } - } + } } CFRelease (plist); @@ -1344,7 +1344,7 @@ std::string AUPlugin::current_preset() const { string preset_name; - + #ifdef AU_STATE_SUPPORT CFPropertyListRef propertyList; @@ -1364,7 +1364,7 @@ AUPlugin::get_presets () PathScanner scanner; preset_files = scanner (preset_search_path, au_preset_filter, this, true, true, -1, true); - + if (!preset_files) { return presets; } @@ -1387,13 +1387,13 @@ AUPlugin::get_presets () if (check_and_get_preset_name (get_comp()->Comp(), path, preset_name)) { presets.push_back (preset_name); preset_map[preset_name] = path; - } + } delete *x; } delete preset_files; - + return presets; } @@ -1422,13 +1422,13 @@ AUPluginInfo::load (Session& session) PluginPtr plugin; boost::shared_ptr<CAComponent> comp (new CAComponent(*descriptor)); - + if (!comp->IsValid()) { error << ("AudioUnit: not a valid Component") << endmsg; } else { plugin.reset (new AUPlugin (session.engine(), session, comp)); } - + plugin->set_info (PluginInfoPtr (new AUPluginInfo (*this))); return plugin; } @@ -1454,7 +1454,7 @@ AUPluginInfo::discover () } PluginInfoList plugs; - + discover_fx (plugs); discover_music (plugs); discover_generators (plugs); @@ -1512,7 +1512,7 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip CAComponentDescription temp; GetComponentInfo (comp, &temp, NULL, NULL, NULL); - AUPluginInfoPtr info (new AUPluginInfo + AUPluginInfoPtr info (new AUPluginInfo (boost::shared_ptr<CAComponentDescription> (new CAComponentDescription(temp)))); /* no panners, format converters or i/o AU's for our purposes @@ -1649,14 +1649,14 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip if (cacomp.GetResourceVersion (info->version) != noErr) { info->version = 0; } - + if (cached_io_configuration (info->unique_id, info->version, cacomp, info->cache, info->name)) { /* here we have to map apple's wildcard system to a simple pair of values. in ::can_do() we use the whole system, but here we need a single pair of values. XXX probably means we should remove any use of these values. - */ + */ info->n_inputs = info->cache.io_configs.front().first; info->n_outputs = info->cache.io_configs.front().second; @@ -1670,16 +1670,16 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip } else { error << string_compose (_("Cannot get I/O configuration info for AU %1"), info->name) << endmsg; } - + comp = FindNextComponent (comp, &desc); } } bool -AUPluginInfo::cached_io_configuration (const std::string& unique_id, +AUPluginInfo::cached_io_configuration (const std::string& unique_id, UInt32 version, - CAComponent& comp, - AUPluginCachedInfo& cinfo, + CAComponent& comp, + AUPluginCachedInfo& cinfo, const std::string& name) { std::string id; @@ -1706,9 +1706,9 @@ AUPluginInfo::cached_io_configuration (const std::string& unique_id, AUChannelInfo* channel_info; UInt32 cnt; int ret; - + ARDOUR::BootMessage (string_compose (_("Checking AudioUnit: %1"), name)); - + try { if (CAAudioUnit::Open (comp, unit) != noErr) { @@ -1722,7 +1722,7 @@ AUPluginInfo::cached_io_configuration (const std::string& unique_id, return false; } - + if ((ret = unit.GetChannelInfo (&channel_info, cnt)) < 0) { return false; } @@ -1733,9 +1733,9 @@ AUPluginInfo::cached_io_configuration (const std::string& unique_id, cinfo.io_configs.push_back (pair<int,int> (-1, -1)); } else { - + /* store each configuration */ - + for (uint32_t n = 0; n < cnt; ++n) { cinfo.io_configs.push_back (pair<int,int> (channel_info[n].inChannels, channel_info[n].outChannels)); @@ -1762,7 +1762,7 @@ AUPluginInfo::save_cached_info () XMLNode* node; node = new XMLNode (X_("AudioUnitPluginCache")); - + for (map<string,AUPluginCachedInfo>::iterator i = cached_info.begin(); i != cached_info.end(); ++i) { XMLNode* parent = new XMLNode (X_("plugin")); parent->add_property ("id", i->first); @@ -1798,7 +1798,7 @@ AUPluginInfo::load_cached_info () { Glib::ustring path = au_cache_path (); XMLTree tree; - + if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) { return 0; } @@ -1815,9 +1815,9 @@ AUPluginInfo::load_cached_info () const XMLNodeList children = root->children(); for (XMLNodeConstIterator iter = children.begin(); iter != children.end(); ++iter) { - + const XMLNode* child = *iter; - + if (child->name() == X_("plugin")) { const XMLNode* gchild; @@ -1846,7 +1846,7 @@ AUPluginInfo::load_cached_info () ((oprop = gchild->property (X_("out"))) != 0)) { in = atoi (iprop->value()); out = atoi (iprop->value()); - + cinfo.io_configs.push_back (pair<int,int> (in, out)); } } @@ -1882,16 +1882,16 @@ AUPluginInfo::get_names (CAComponentDescription& comp_desc, std::string& name, G DisposeHandle(nameHandle); } } - + // if Marc-style fails, do the original way if (itemName == NULL) { CFStringRef compTypeString = UTCreateStringForOSType(comp_desc.componentType); CFStringRef compSubTypeString = UTCreateStringForOSType(comp_desc.componentSubType); CFStringRef compManufacturerString = UTCreateStringForOSType(comp_desc.componentManufacturer); - - itemName = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ - %@ - %@"), + + itemName = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ - %@ - %@"), compTypeString, compManufacturerString, compSubTypeString); - + if (compTypeString != NULL) CFRelease(compTypeString); if (compSubTypeString != NULL) @@ -1899,7 +1899,7 @@ AUPluginInfo::get_names (CAComponentDescription& comp_desc, std::string& name, G if (compManufacturerString != NULL) CFRelease(compManufacturerString); } - + string str = CFStringRefToStdString(itemName); string::size_type colon = str.find (':'); @@ -1925,10 +1925,10 @@ AUPluginInfo::stringify_descriptor (const CAComponentDescription& desc) s << StringForOSType (desc.Type(), str); s << " - "; - + s << StringForOSType (desc.SubType(), str); s << " - "; - + s << StringForOSType (desc.Manu(), str); return s.str(); diff --git a/libs/ardour/audioanalyser.cc b/libs/ardour/audioanalyser.cc index 53b60f9eaa..3acfc9bce4 100644 --- a/libs/ardour/audioanalyser.cc +++ b/libs/ardour/audioanalyser.cc @@ -26,11 +26,11 @@ AudioAnalyser::AudioAnalyser (float sr, AnalysisPluginKey key) , plugin_key (key) { /* create VAMP plugin and initialize */ - + if (initialize_plugin (plugin_key, sample_rate)) { error << string_compose (_("cannot load VAMP plugin \"%1\""), key) << endmsg; throw failed_constructor(); - } + } } AudioAnalyser::~AudioAnalyser () @@ -50,7 +50,7 @@ AudioAnalyser::initialize_plugin (AnalysisPluginKey key, float sr) if (!plugin) { error << string_compose (_("VAMP Plugin \"%1\" could not be loaded"), key) << endmsg; return -1; - } + } /* we asked for the buffering adapter, so set the blocksize to something that makes for efficient disk i/o @@ -79,7 +79,7 @@ AudioAnalyser::reset () plugin->reset (); } } - + int AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel) { @@ -96,7 +96,7 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel) if (!path.empty()) { /* store data in tmp file, not the real one */ - + tmp_path = path; tmp_path += ".tmp"; @@ -112,11 +112,11 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel) while (!done) { nframes64_t to_read; - + /* read from source */ to_read = min ((len - pos), bufsize); - + if (src->read (data, pos, to_read, channel) != to_read) { goto out; } @@ -126,7 +126,7 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel) if (to_read != bufsize) { memset (data + to_read, 0, (bufsize - to_read) * sizeof (Sample)); } - + features = plugin->process (bufs, RealTime::fromSeconds ((double) pos / sample_rate)); if (use_features (features, (path.empty() ? 0 : &ofile))) { diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 56f78482ee..6f153dcc9e 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ using namespace PBD; gint AudioEngine::m_meter_exit; -AudioEngine::AudioEngine (string client_name) +AudioEngine::AudioEngine (string client_name) : ports (new Ports) { session = 0; @@ -82,7 +82,7 @@ AudioEngine::AudioEngine (string client_name) } Port::set_engine (this); - + // Initialize parameter metadata (e.g. ranges) Evoral::Parameter p(NullAutomation); p = EventTypeMap::instance().new_parameter(NullAutomation); @@ -106,12 +106,12 @@ AudioEngine::~AudioEngine () { Glib::Mutex::Lock tm (_process_lock); session_removed.signal (); - + if (_running) { jack_client_close (_jack); _jack = 0; } - + stop_metering_thread (); } } @@ -146,13 +146,13 @@ AudioEngine::start () if (!_running) { nframes_t blocksize = jack_get_buffer_size (_jack); - + if (session) { BootMessage (_("Connect session to engine")); session->set_block_size (blocksize); session->set_frame_rate (jack_get_sample_rate (_jack)); - + /* page in as much of the session process code as we can before we really start running. */ @@ -224,10 +224,10 @@ AudioEngine::get_sync_offset (nframes_t& offset) const #ifdef HAVE_JACK_VIDEO_SUPPORT jack_position_t pos; - + if (_jack) { (void) jack_transport_query (_jack, &pos); - + if (pos.valid & JackVideoFrameOffset) { offset = pos.video_offset; return true; @@ -346,7 +346,7 @@ AudioEngine::process_callback (nframes_t nframes) /// The number of frames that will have been processed when we've finished nframes_t next_processed_frames; - + /* handle wrap around of total frames counter */ if (max_frames - _processed_frames < nframes) { @@ -395,7 +395,7 @@ AudioEngine::process_callback (nframes_t nframes) session->process (nframes); } } - + if (_freewheeling) { return 0; } @@ -410,13 +410,13 @@ AudioEngine::process_callback (nframes_t nframes) boost::shared_ptr<Ports> p = ports.reader(); for (Ports::iterator i = p->begin(); i != p->end(); ++i) { - + Port *port = (*i); bool x; - + if (port->_last_monitor != (x = port->monitoring_input ())) { port->_last_monitor = x; - /* XXX I think this is dangerous, due to + /* XXX I think this is dangerous, due to a likely mutex in the signal handlers ... */ port->MonitorInputChanged (x); /* EMIT SIGNAL */ @@ -430,14 +430,14 @@ AudioEngine::process_callback (nframes_t nframes) boost::shared_ptr<Ports> p = ports.reader(); for (Ports::iterator i = p->begin(); i != p->end(); ++i) { - + Port *port = (*i); - + if (port->sends_output()) { port->get_buffer(nframes).silence(nframes); } } - } + } // Finalize ports @@ -460,12 +460,12 @@ AudioEngine::jack_sample_rate_callback (nframes_t nframes) { _frame_rate = nframes; _usecs_per_cycle = (int) floor ((((double) frames_per_cycle() / nframes)) * 1000000.0); - + /* check for monitor input change every 1/10th of second */ monitor_check_interval = nframes / 10; last_monitor_check = 0; - + if (session) { session->set_frame_rate (nframes); } @@ -536,7 +536,7 @@ AudioEngine::meter_thread () } } -void +void AudioEngine::set_session (Session *s) { Glib::Mutex::Lock pl (_process_lock); @@ -546,11 +546,11 @@ AudioEngine::set_session (Session *s) session = s; nframes_t blocksize = jack_get_buffer_size (_jack); - + /* page in as much of the session process code as we can before we really start running. */ - + boost::shared_ptr<Ports> p = ports.reader(); for (Ports::iterator i = p->begin(); i != p->end(); ++i) { @@ -572,7 +572,7 @@ AudioEngine::set_session (Session *s) } } -void +void AudioEngine::remove_session () { Glib::Mutex::Lock lm (_process_lock); @@ -587,7 +587,7 @@ AudioEngine::remove_session () } else { session = 0; } - + remove_all_ports (); } @@ -597,19 +597,19 @@ AudioEngine::port_registration_failure (const std::string& portname) string full_portname = jack_client_name; full_portname += ':'; full_portname += portname; - - + + jack_port_t* p = jack_port_by_name (_jack, full_portname.c_str()); string reason; - + if (p) { reason = string_compose (_("a port with the name \"%1\" already exists: check for duplicated track/bus names"), portname); } else { reason = _("No more JACK ports are available. You will need to stop Ardour and restart JACK with ports if you need this many tracks."); } - + throw PortRegistrationFailure (string_compose (_("AudioEngine: cannot register port \"%1\": %2"), portname, reason).c_str()); -} +} Port * AudioEngine::register_port (DataType dtype, const string& portname, bool input) @@ -624,7 +624,7 @@ AudioEngine::register_port (DataType dtype, const string& portname, bool input) } else { throw PortRegistrationFailure("unable to create port (unknown type)"); } - + size_t& old_buffer_size = _raw_buffer_sizes[newport->type()]; size_t port_buffer_size = newport->raw_buffer_size(0); if (port_buffer_size > old_buffer_size) { @@ -667,7 +667,7 @@ AudioEngine::unregister_port (Port& port) { /* caller must hold process lock */ - if (!_running) { + if (!_running) { /* probably happening when the engine has been halted by JACK, in which case, there is nothing we can do here. */ @@ -677,7 +677,7 @@ AudioEngine::unregister_port (Port& port) { RCUWriter<Ports> writer (ports); boost::shared_ptr<Ports> ps = writer.get_copy (); - + for (Ports::iterator i = ps->begin(); i != ps->end(); ++i) { if ((*i) == &port) { delete *i; @@ -685,18 +685,18 @@ AudioEngine::unregister_port (Port& port) break; } } - + /* writer goes out of scope, forces update */ } - + return 0; } -int +int AudioEngine::connect (const string& source, const string& destination) { /* caller must hold process lock */ - + int ret; if (!_running) { @@ -722,23 +722,23 @@ AudioEngine::connect (const string& source, const string& destination) /* neither port is known to us, and this API isn't intended for use as a general patch bay */ ret = -1; } - + if (ret > 0) { /* already exists - no error, no warning */ } else if (ret < 0) { - error << string_compose(_("AudioEngine: cannot connect %1 (%2) to %3 (%4)"), - source, s, destination, d) + error << string_compose(_("AudioEngine: cannot connect %1 (%2) to %3 (%4)"), + source, s, destination, d) << endmsg; } return ret; } -int +int AudioEngine::disconnect (const string& source, const string& destination) { /* caller must hold process lock */ - + int ret; if (!_running) { @@ -749,7 +749,7 @@ AudioEngine::disconnect (const string& source, const string& destination) return -1; } } - + string s = make_port_name_non_relative (source); string d = make_port_name_non_relative (destination); @@ -836,7 +836,7 @@ AudioEngine::get_port_by_name (const string& portname) } else { s = portname; } - + Glib::Mutex::Lock lm (_process_lock); return get_port_by_name_locked (s); } @@ -909,7 +909,7 @@ AudioEngine::halted (void *arg) } bool -AudioEngine::can_request_hardware_monitoring () +AudioEngine::can_request_hardware_monitoring () { const char ** ports; @@ -952,11 +952,11 @@ AudioEngine::n_physical_inputs (DataType type) const { const char ** ports; uint32_t i = 0; - + if (!_jack) { return 0; } - + if ((ports = jack_get_ports (_jack, NULL, type.to_jack_type(), JackPortIsPhysical|JackPortIsOutput)) == 0) { return 0; } @@ -973,11 +973,11 @@ AudioEngine::get_physical_inputs (DataType type, vector<string>& ins) { const char ** ports; uint32_t i = 0; - + if (!_jack) { return; } - + if ((ports = jack_get_ports (_jack, NULL, type.to_jack_type(), JackPortIsPhysical|JackPortIsOutput)) == 0) { return; } @@ -995,11 +995,11 @@ AudioEngine::get_physical_outputs (DataType type, vector<string>& outs) { const char ** ports; uint32_t i = 0; - + if (!_jack) { return; } - + if ((ports = jack_get_ports (_jack, NULL, type.to_jack_type(), JackPortIsPhysical|JackPortIsInput)) == 0) { return; } @@ -1031,7 +1031,7 @@ AudioEngine::get_nth_physical (DataType type, uint32_t n, int flag) } ports = jack_get_ports (_jack, NULL, type.to_jack_type(), JackPortIsPhysical|flag); - + if (ports == 0) { return ""; } @@ -1059,7 +1059,7 @@ AudioEngine::update_total_latency (const Port& port) if (!_has_run) { fatal << _("update_total_latency() called before engine was started") << endmsg; /*NOTREACHED*/ - } + } } port.recompute_total_latency (); @@ -1150,13 +1150,13 @@ AudioEngine::remove_all_ports () for (Ports::iterator i = ps->begin(); i != ps->end(); ++i) { delete *i; } - + ps->clear (); } } -static void -ardour_jack_error (const char* msg) +static void +ardour_jack_error (const char* msg) { error << "JACK: " << msg << endmsg; } @@ -1181,11 +1181,11 @@ AudioEngine::connect_to_jack (string client_name) } jack_set_error_function (ardour_jack_error); - + return 0; } -int +int AudioEngine::disconnect_from_jack () { if (!_jack) { @@ -1196,7 +1196,7 @@ AudioEngine::disconnect_from_jack () stop_metering_thread (); } - { + { Glib::Mutex::Lock lm (_process_lock); jack_client_close (_jack); _jack = 0; @@ -1235,14 +1235,14 @@ AudioEngine::reconnect_to_jack () for (i = p->begin(); i != p->end(); ++i) { if ((*i)->reestablish ()) { break; - } + } } if (i != p->end()) { /* failed */ remove_all_ports (); return -1; - } + } if (session) { @@ -1250,14 +1250,14 @@ AudioEngine::reconnect_to_jack () nframes_t blocksize = jack_get_buffer_size (_jack); session->set_block_size (blocksize); session->set_frame_rate (jack_get_sample_rate (_jack)); - + _raw_buffer_sizes[DataType::AUDIO] = blocksize * sizeof(float); cout << "FIXME: Assuming maximum MIDI buffer size " << blocksize * 4 << "bytes" << endl; _raw_buffer_sizes[DataType::MIDI] = blocksize * 4; } last_monitor_check = 0; - + jack_on_shutdown (_jack, halted, this); jack_set_graph_order_callback (_jack, _graph_order_callback, this); jack_set_thread_init_callback (_jack, _thread_init_callback, this); @@ -1267,11 +1267,11 @@ AudioEngine::reconnect_to_jack () jack_set_xrun_callback (_jack, _xrun_callback, this); jack_set_sync_callback (_jack, _jack_sync_callback, this); jack_set_freewheel_callback (_jack, _freewheel_callback, this); - + if (session && session->config.get_jack_time_master()) { jack_set_timebase_callback (_jack, 0, _jack_timebase_callback, this); - } - + } + if (jack_activate (_jack) == 0) { _running = true; _has_run = true; @@ -1280,7 +1280,7 @@ AudioEngine::reconnect_to_jack () } /* re-establish connections */ - + for (i = p->begin(); i != p->end(); ++i) { (*i)->reconnect (); } @@ -1317,13 +1317,13 @@ AudioEngine::update_total_latencies () } #endif } - + string AudioEngine::make_port_name_relative (string portname) { string::size_type len; string::size_type n; - + len = portname.length(); for (n = 0; n < len; ++n) { @@ -1331,7 +1331,7 @@ AudioEngine::make_port_name_relative (string portname) break; } } - + if ((n != len) && (portname.substr (0, n) == jack_client_name)) { return portname.substr (n+1); } @@ -1351,7 +1351,7 @@ AudioEngine::make_port_name_non_relative (string portname) str = jack_client_name; str += ':'; str += portname; - + return str; } diff --git a/libs/ardour/audiofile_tagger.cc b/libs/ardour/audiofile_tagger.cc index cfd839fc0c..c06b712f4e 100644 --- a/libs/ardour/audiofile_tagger.cc +++ b/libs/ardour/audiofile_tagger.cc @@ -44,11 +44,11 @@ AudiofileTagger::tag_file (string const & filename, SessionMetadata const & meta { TagLib::FileRef file (filename.c_str()); TagLib::Tag & tag (*file.tag()); - + tag_generic (tag, metadata); - + /* FLAC */ - + TagLib::FLAC::File * flac_file; if ((flac_file = dynamic_cast<TagLib::FLAC::File *> (file.file()))) { TagLib::Ogg::XiphComment * vorbis_tag; @@ -58,9 +58,9 @@ AudiofileTagger::tag_file (string const & filename, SessionMetadata const & meta std::cerr << "Could not get Xiph comment for FLAC file!" << std::endl; } } - + /* Ogg */ - + TagLib::Ogg::File * ogg_file; if ((ogg_file = dynamic_cast<TagLib::Ogg::File *> (file.file()))) { TagLib::Ogg::XiphComment * vorbis_tag; @@ -70,7 +70,7 @@ AudiofileTagger::tag_file (string const & filename, SessionMetadata const & meta std::cerr << "Could not get Xiph comment for Ogg file!" << std::endl; } } - + file.save(); return true; } @@ -85,7 +85,7 @@ AudiofileTagger::tag_generic (TagLib::Tag & tag, SessionMetadata const & metadat tag.setGenre (TL_STR(metadata.genre())); tag.setYear (metadata.year()); tag.setTrack (metadata.track_number()); - + return true; } @@ -109,7 +109,7 @@ AudiofileTagger::tag_vorbis_comment (TagLib::Ogg::XiphComment & tag, SessionMeta tag.addField ("COMPILATION", TL_STR(metadata.compilation())); tag.addField ("DISCSUBTITLE", TL_STR(metadata.disc_subtitle())); tag.addField ("DISCNUMBER", to_string (metadata.disc_number(), std::dec)); - + // No field for total discs or tracks return true; diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index fa3a86e44b..0412ee0966 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ // if these headers come before sigc++ is included // the parser throws ObjC++ errors. (nil is a keyword) -#ifdef HAVE_COREAUDIO +#ifdef HAVE_COREAUDIO #include "ardour/coreaudiosource.h" #include <AudioToolbox/ExtendedAudioFile.h> #include <AudioToolbox/AudioFormat.h> @@ -79,7 +79,7 @@ struct SizedSampleBuffer { nframes_t size; Sample* buf; - SizedSampleBuffer (nframes_t sz) : size (sz) { + SizedSampleBuffer (nframes_t sz) : size (sz) { buf = new Sample[size]; } @@ -163,33 +163,33 @@ AudioFileSource::find_broken_peakfile (ustring peak_path, ustring audio_path) ustring str; /* check for the broken location in use by 2.0 for several months */ - + str = broken_peak_path (audio_path); - + if (Glib::file_test (str, Glib::FILE_TEST_EXISTS)) { - + if (is_embedded()) { - - /* it would be nice to rename it but the nature of + + /* it would be nice to rename it but the nature of the bug means that we can't reliably use it. */ - + peak_path = str; - + } else { /* all native files are mono, so we can just rename it. */ ::rename (str.c_str(), peak_path.c_str()); } - + } else { /* Nasty band-aid for older sessions that were created before we used libsndfile for all audio files. */ - - - str = old_peak_path (audio_path); + + + str = old_peak_path (audio_path); if (Glib::file_test (str, Glib::FILE_TEST_EXISTS)) { peak_path = str; } @@ -267,7 +267,7 @@ AudioFileSource::set_state (const XMLNode& node) if (AudioSource::set_state (node)) { return -1; } - + if (FileSource::set_state (node)) { return -1; } @@ -281,7 +281,7 @@ AudioFileSource::mark_streaming_write_completed () if (!writable()) { return; } - + /* XXX notice that we're readers of _peaks_built but we must hold a solid lock on PeaksReady. */ @@ -311,10 +311,10 @@ AudioFileSource::is_empty (Session& /*s*/, ustring path) { SoundFileInfo info; string err; - + if (!get_soundfile_info (path, info, err)) { /* dangerous: we can't get info, so assume that its not empty */ - return false; + return false; } return info.length == 0; diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index a3444c0b23..38fede7c51 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -170,7 +170,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, nframes_t _scale_amplitude = other->_scale_amplitude; assert(_type == DataType::AUDIO); - + listen_to_my_curves (); connect_to_analysis_changed (); @@ -321,7 +321,7 @@ ARDOUR::nframes_t AudioRegion::read_peaks (PeakData *buf, nframes_t npeaks, nframes_t offset, nframes_t cnt, uint32_t chan_n, double samples_per_unit) const { if (chan_n >= _sources.size()) { - return 0; + return 0; } if (audio_source(chan_n)->read_peaks (buf, npeaks, offset, cnt, samples_per_unit)) { @@ -366,16 +366,16 @@ AudioRegion::master_read_at (Sample *buf, Sample *mixdown_buffer, float *gain_bu { /* do not read gain/scaling/fades and do not count this disk i/o in statistics */ - return _read_at (_master_sources, _master_sources.front()->length(_master_sources.front()->timeline_position()), + return _read_at (_master_sources, _master_sources.front()->length(_master_sources.front()->timeline_position()), buf, mixdown_buffer, gain_buffer, position, cnt, chan_n, 0, 0, ReadOps (0)); } nframes_t AudioRegion::_read_at (const SourceList& /*srcs*/, nframes_t limit, Sample *buf, Sample *mixdown_buffer, float *gain_buffer, - sframes_t position, nframes_t cnt, - uint32_t chan_n, - nframes_t /*read_frames*/, + sframes_t position, nframes_t cnt, + uint32_t chan_n, + nframes_t /*read_frames*/, nframes_t /*skip_frames*/, ReadOps rops) const { @@ -424,13 +424,13 @@ AudioRegion::_read_at (const SourceList& /*srcs*/, nframes_t limit, if (src->read (mixdown_buffer, _start + internal_offset, to_read) != to_read) { return 0; /* "read nothing" */ } - + if (rops & ReadOpsCount) { _read_data_count += src->read_data_count(); } } else { - + /* track is N-channel, this region has less channels; silence the ones we don't have. */ @@ -439,53 +439,53 @@ AudioRegion::_read_at (const SourceList& /*srcs*/, nframes_t limit, } if (rops & ReadOpsFades) { - + /* fade in */ if ((_flags & FadeIn) && _session.config.get_use_region_fades()) { - + nframes_t fade_in_length = (nframes_t) _fade_in->back()->when; - + /* see if this read is within the fade in */ - + if (internal_offset < fade_in_length) { - + nframes_t fi_limit; - + fi_limit = min (to_read, fade_in_length - internal_offset); - + _fade_in->curve().get_vector (internal_offset, internal_offset+fi_limit, gain_buffer, fi_limit); - + for (nframes_t n = 0; n < fi_limit; ++n) { mixdown_buffer[n] *= gain_buffer[n]; } } } - + /* fade out */ - + if ((_flags & FadeOut) && _session.config.get_use_region_fades()) { /* see if some part of this read is within the fade out */ - + /* ................. >| REGION limit - + { } FADE fade_out_length - ^ + ^ limit - fade_out_length |--------------| ^internal_offset ^internal_offset + to_read - + we need the intersection of [internal_offset,internal_offset+to_read] with [limit - fade_out_length, limit] - + */ - + nframes_t fade_out_length = (nframes_t) _fade_out->back()->when; nframes_t fade_interval_start = max(internal_offset, limit-fade_out_length); nframes_t fade_interval_end = min(internal_offset + to_read, limit); @@ -496,22 +496,22 @@ AudioRegion::_read_at (const SourceList& /*srcs*/, nframes_t limit, nframes_t fo_limit = fade_interval_end - fade_interval_start; nframes_t curve_offset = fade_interval_start - (limit-fade_out_length); nframes_t fade_offset = fade_interval_start - internal_offset; - + _fade_out->curve().get_vector (curve_offset, curve_offset+fo_limit, gain_buffer, fo_limit); for (nframes_t n = 0, m = fade_offset; n < fo_limit; ++n, ++m) { mixdown_buffer[m] *= gain_buffer[n]; } - } - + } + } } - + /* Regular gain curves and scaling */ - + if ((rops & ReadOpsOwnAutomation) && envelope_active()) { _envelope->curve().get_vector (internal_offset, internal_offset + to_read, gain_buffer, to_read); - + if ((rops & ReadOpsOwnScaling) && _scale_amplitude != 1.0f) { for (nframes_t n = 0; n < to_read; ++n) { mixdown_buffer[n] *= gain_buffer[n] * _scale_amplitude; @@ -523,29 +523,29 @@ AudioRegion::_read_at (const SourceList& /*srcs*/, nframes_t limit, } } else if ((rops & ReadOpsOwnScaling) && _scale_amplitude != 1.0f) { - // XXX this should be using what in 2.0 would have been: + // XXX this should be using what in 2.0 would have been: // Session::apply_gain_to_buffer (mixdown_buffer, to_read, _scale_amplitude); for (nframes_t n = 0; n < to_read; ++n) { mixdown_buffer[n] *= _scale_amplitude; } } - + if (!opaque()) { - + /* gack. the things we do for users. */ - + buf += buf_offset; - + for (nframes_t n = 0; n < to_read; ++n) { buf[n] += mixdown_buffer[n]; } - } + } return to_read; } - + XMLNode& AudioRegion::state (bool full) { @@ -554,7 +554,7 @@ AudioRegion::state (bool full) char buf[64]; char buf2[64]; LocaleGuard lg (X_("POSIX")); - + node.add_property ("flags", enum_2_string (_flags)); snprintf (buf, sizeof(buf), "%.12g", _scale_amplitude); @@ -578,9 +578,9 @@ AudioRegion::state (bool full) node.add_property ("channels", buf); if (full) { - + child = node.add_child (X_("FadeIn")); - + if ((_flags & DefaultFadeIn)) { child->add_property (X_("default"), X_("yes")); } else { @@ -588,23 +588,23 @@ AudioRegion::state (bool full) } child->add_property (X_("active"), _fade_in_disabled ? X_("no") : X_("yes")); - + child = node.add_child (X_("FadeOut")); - + if ((_flags & DefaultFadeOut)) { child->add_property (X_("default"), X_("yes")); } else { child->add_child_nocopy (_fade_out->get_state ()); } - + child->add_property (X_("active"), _fade_out_disabled ? X_("no") : X_("yes")); } - + child = node.add_child ("Envelope"); if (full) { bool default_env = false; - + // If there are only two points, the points are in the start of the region and the end of the region // so, if they are both at 1.0f, that means the default region. @@ -614,7 +614,7 @@ AudioRegion::state (bool full) if (_envelope->front()->when == 0 && _envelope->back()->when == _length) { default_env = true; } - } + } if (default_env) { child->add_property ("default", "yes"); @@ -677,16 +677,16 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen } else { _scale_amplitude = 1.0; } - + /* Now find envelope description and other misc child items */ - + for (XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); ++niter) { - + XMLNode *child; XMLProperty *prop; - + child = (*niter); - + if (child->name() == "Envelope") { _envelope->clear (); @@ -699,9 +699,9 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen _envelope->truncate_end (_length); } else if (child->name() == "FadeIn") { - + _fade_in->clear (); - + if ((prop = child->property ("default")) != 0 || (prop = child->property ("steepness")) != 0) { set_default_fade_in (); } else { @@ -720,7 +720,7 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen } } else if (child->name() == "FadeOut") { - + _fade_out->clear (); if ((prop = child->property ("default")) != 0 || (prop = child->property ("steepness")) != 0) { @@ -729,7 +729,7 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen XMLNode* grandchild = child->child ("AutomationList"); if (grandchild) { _fade_out->set_state (*grandchild); - } + } } if ((prop = child->property ("active")) != 0) { @@ -740,7 +740,7 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen } } - } + } } if (send) { @@ -997,10 +997,10 @@ AudioRegion::set_default_envelope () void AudioRegion::recompute_at_end () { - /* our length has changed. recompute a new final point by interpolating + /* our length has changed. recompute a new final point by interpolating based on the the existing curve. */ - + _envelope->freeze (); _envelope->truncate_end (_length); _envelope->set_max_xval (_length); @@ -1015,7 +1015,7 @@ AudioRegion::recompute_at_end () _fade_out->extend_to (_length); send_change (FadeOutChanged); } -} +} void AudioRegion::recompute_at_start () @@ -1070,7 +1070,7 @@ AudioRegion::separate_by_channel (Session& /*session*/, vector<boost::shared_ptr Flag f = Flag (_flags & ~WholeFile); v.push_back(RegionFactory::create (srcs, _start, _length, new_name, _layer, f)); - + ++n; } @@ -1087,65 +1087,65 @@ int AudioRegion::exportme (Session& /*session*/, ARDOUR::ExportSpecification& /*spec*/) { // TODO EXPORT -// const nframes_t blocksize = 4096; -// nframes_t to_read; -// int status = -1; -// -// spec.channels = _sources.size(); -// -// if (spec.prepare (blocksize, session.frame_rate())) { -// goto out; -// } -// -// spec.pos = 0; -// spec.total_frames = _length; -// -// while (spec.pos < _length && !spec.stop) { -// -// -// /* step 1: interleave */ -// -// to_read = min (_length - spec.pos, blocksize); -// -// if (spec.channels == 1) { -// -// if (read_raw_internal (spec.dataF, _start + spec.pos, to_read) != to_read) { -// goto out; -// } -// -// } else { -// -// Sample buf[blocksize]; -// -// for (uint32_t chan = 0; chan < spec.channels; ++chan) { -// -// if (audio_source(chan)->read (buf, _start + spec.pos, to_read) != to_read) { -// goto out; -// } -// -// for (nframes_t x = 0; x < to_read; ++x) { -// spec.dataF[chan+(x*spec.channels)] = buf[x]; -// } -// } -// } -// -// if (spec.process (to_read)) { -// goto out; -// } -// -// spec.pos += to_read; -// spec.progress = (double) spec.pos /_length; -// -// } -// -// status = 0; -// -// out: -// spec.running = false; -// spec.status = status; -// spec.clear(); -// -// return status; +// const nframes_t blocksize = 4096; +// nframes_t to_read; +// int status = -1; +// +// spec.channels = _sources.size(); +// +// if (spec.prepare (blocksize, session.frame_rate())) { +// goto out; +// } +// +// spec.pos = 0; +// spec.total_frames = _length; +// +// while (spec.pos < _length && !spec.stop) { +// +// +// /* step 1: interleave */ +// +// to_read = min (_length - spec.pos, blocksize); +// +// if (spec.channels == 1) { +// +// if (read_raw_internal (spec.dataF, _start + spec.pos, to_read) != to_read) { +// goto out; +// } +// +// } else { +// +// Sample buf[blocksize]; +// +// for (uint32_t chan = 0; chan < spec.channels; ++chan) { +// +// if (audio_source(chan)->read (buf, _start + spec.pos, to_read) != to_read) { +// goto out; +// } +// +// for (nframes_t x = 0; x < to_read; ++x) { +// spec.dataF[chan+(x*spec.channels)] = buf[x]; +// } +// } +// } +// +// if (spec.process (to_read)) { +// goto out; +// } +// +// spec.pos += to_read; +// spec.progress = (double) spec.pos /_length; +// +// } +// +// status = 0; +// +// out: +// spec.running = false; +// spec.status = status; +// spec.clear(); +// +// return status; return 0; } @@ -1157,7 +1157,7 @@ AudioRegion::set_scale_amplitude (gain_t g) _scale_amplitude = g; /* tell the diskstream we're in */ - + if (pl) { pl->Modified(); } @@ -1203,7 +1203,7 @@ AudioRegion::normalize_to (float target_dB) if (read_raw_internal (buf, fpos, to_read, 0) != to_read) { return; } - + maxamp = compute_peak (buf, to_read, maxamp); } @@ -1321,7 +1321,7 @@ AudioRegion::source_offset_changed () if (afs && afs->destructive()) { // set_start (source()->natural_position(), this); set_position (source()->natural_position(), this); - } + } } boost::shared_ptr<AudioSource> @@ -1346,14 +1346,14 @@ AudioRegion::get_transients (AnalysisFeatureList& results, bool force_new) } SourceList::iterator s; - + for (s = _sources.begin() ; s != _sources.end(); ++s) { if (!(*s)->has_been_analysed()) { cerr << "For " << name() << " source " << (*s)->name() << " has not been analyzed\n"; break; } } - + if (s == _sources.end()) { /* all sources are analyzed, merge data from each one */ @@ -1368,14 +1368,14 @@ AudioRegion::get_transients (AnalysisFeatureList& results, bool force_new) AnalysisFeatureList::iterator high = upper_bound ((*s)->transients.begin(), (*s)->transients.end(), _start + _length); - + /* and add them */ results.insert (results.end(), low, high); } TransientDetector::cleanup_transients (results, pl->session().frame_rate(), 3.0); - + /* translate all transients to current position */ for (AnalysisFeatureList::iterator x = results.begin(); x != results.end(); ++x) { @@ -1418,19 +1418,19 @@ then quit ardour and restart.")); } /* translate all transients to give absolute position */ - + for (AnalysisFeatureList::iterator i = these_results.begin(); i != these_results.end(); ++i) { (*i) += _position; } /* merge */ - + _transients.insert (_transients.end(), these_results.begin(), these_results.end()); } - + if (!results.empty()) { if (existing_results) { - + /* merge our transients into the existing ones, then clean up those. */ @@ -1467,7 +1467,7 @@ AudioRegion::find_silence (Sample threshold, nframes_t min_length) const nframes_t const block_size = 64 * 1024; Sample loudest[block_size]; Sample buf[block_size]; - + nframes_t pos = _start; nframes_t const end = _start + _length - 1; @@ -1519,7 +1519,7 @@ AudioRegion::find_silence (Sample threshold, nframes_t min_length) const extern "C" { - int region_read_peaks_from_c (void *arg, uint32_t npeaks, uint32_t start, uint32_t cnt, intptr_t data, uint32_t n_chan, double samples_per_unit) + int region_read_peaks_from_c (void *arg, uint32_t npeaks, uint32_t start, uint32_t cnt, intptr_t data, uint32_t n_chan, double samples_per_unit) { return ((AudioRegion *) arg)->read_peaks ((PeakData *) data, (nframes_t) npeaks, (nframes_t) start, (nframes_t) cnt, n_chan,samples_per_unit); } diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index 78e3cd2c6b..f9864d69b3 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -71,11 +71,11 @@ AudioSource::AudioSource (Session& s, ustring name) peak_leftovers = 0; } -AudioSource::AudioSource (Session& s, const XMLNode& node) +AudioSource::AudioSource (Session& s, const XMLNode& node) : Source (s, node) , _length (0) { - + _peaks_built = false; _peak_byte_max = 0; peakfile = -1; @@ -93,7 +93,7 @@ AudioSource::AudioSource (Session& s, const XMLNode& node) AudioSource::~AudioSource () { /* shouldn't happen but make sure we don't leak file descriptors anyway */ - + if (peak_leftover_cnt) { cerr << "AudioSource destroyed with leftover peak data pending" << endl; } @@ -173,12 +173,12 @@ AudioSource::touch_peakfile () if (stat (peakpath.c_str(), &statbuf) != 0 || statbuf.st_size == 0) { return; } - + struct utimbuf tbuf; - + tbuf.actime = statbuf.st_atime; tbuf.modtime = time ((time_t) 0); - + utime (peakpath.c_str(), &tbuf); } @@ -209,7 +209,7 @@ AudioSource::initialize_peakfile (bool newfile, ustring audio_path) peakpath = peak_path (audio_path); /* if the peak file should be there, but isn't .... */ - + if (!newfile && !Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) { peakpath = find_broken_peakfile (peakpath, audio_path); } @@ -217,19 +217,19 @@ AudioSource::initialize_peakfile (bool newfile, ustring audio_path) if (stat (peakpath.c_str(), &statbuf)) { if (errno != ENOENT) { /* it exists in the peaks dir, but there is some kind of error */ - + error << string_compose(_("AudioSource: cannot stat peakfile \"%1\""), peakpath) << endmsg; return -1; } /* peakfile does not exist */ - + _peaks_built = false; - + } else { - + /* we found it in the peaks dir, so check it out */ - + if (statbuf.st_size == 0 || ((nframes_t) statbuf.st_size < ((length(_timeline_position) / _FPP) * sizeof (PeakData)))) { // empty _peaks_built = false; @@ -237,7 +237,7 @@ AudioSource::initialize_peakfile (bool newfile, ustring audio_path) // Check if the audio file has changed since the peakfile was built. struct stat stat_file; int err = stat (audio_path.c_str(), &stat_file); - + if (err) { _peaks_built = false; _peak_byte_max = 0; @@ -260,8 +260,8 @@ AudioSource::initialize_peakfile (bool newfile, ustring audio_path) if (!newfile && !_peaks_built && _build_missing_peakfiles && _build_peakfiles) { build_peaks_from_scratch (); - } - + } + return 0; } @@ -289,8 +289,8 @@ AudioSource::read_peaks (PeakData *peaks, nframes_t npeaks, sframes_t start, nfr * @param npeaks Number of peaks to write. */ -int -AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t start, nframes_t cnt, +int +AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t start, nframes_t cnt, double samples_per_visual_peak, nframes_t samples_per_file_peak) const { Glib::Mutex::Lock lm (_lock); @@ -311,15 +311,15 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t s #undef DEBUG_READ_PEAKS #ifdef DEBUG_READ_PEAKS - cerr << "======>RP: npeaks = " << npeaks - << " start = " << start - << " cnt = " << cnt - << " len = " << _length - << " samples_per_visual_peak =" << samples_per_visual_peak + cerr << "======>RP: npeaks = " << npeaks + << " start = " << start + << " cnt = " << cnt + << " len = " << _length + << " samples_per_visual_peak =" << samples_per_visual_peak << " expected was " << expected_peaks << " ... scale = " << scale << " PD ptr = " << peaks <<endl; - + #endif /* fix for near-end-of-file conditions */ @@ -331,20 +331,20 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t s npeaks = min ((nframes_t) floor (cnt / samples_per_visual_peak), npeaks); zero_fill = old - npeaks; } - + // cerr << "actual npeaks = " << npeaks << " zf = " << zero_fill << endl; if (npeaks == cnt) { #ifdef DEBUG_READ_PEAKS cerr << "RAW DATA\n"; -#endif +#endif /* no scaling at all, just get the sample data and duplicate it for both max and min peak values. */ Sample* raw_staging = new Sample[cnt]; - + if (read_unlocked (raw_staging, start, cnt) != cnt) { error << _("cannot read sample data for unscaled peak computation") << endmsg; return -1; @@ -373,18 +373,18 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t s #ifdef DEBUG_READ_PEAKS cerr << "DIRECT PEAKS\n"; #endif - + nread = ::pread (_peakfile, peaks, sizeof (PeakData)* npeaks, first_peak_byte); close (_peakfile); if (nread != sizeof (PeakData) * npeaks) { cerr << "AudioSource[" << _name - << "]: cannot read peaks from peakfile! (read only " + << "]: cannot read peaks from peakfile! (read only " << nread - << " not " + << " not " << npeaks - << "at sample " + << "at sample " << start << " = byte " << first_peak_byte @@ -407,7 +407,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t s #ifdef DEBUG_READ_PEAKS cerr << "DOWNSAMPLE\n"; -#endif +#endif /* the caller wants: - more frames-per-peak (lower resolution) than the peakfile, or to put it another way, @@ -415,15 +415,15 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t s So, read a block into a staging area, and then downsample from there. - to avoid confusion, I'll refer to the requested peaks as visual_peaks and the peakfile peaks as stored_peaks + to avoid confusion, I'll refer to the requested peaks as visual_peaks and the peakfile peaks as stored_peaks */ const uint32_t chunksize = (uint32_t) min (expected_peaks, 65536.0); - + staging = new PeakData[chunksize]; - + /* compute the rounded up frame position */ - + nframes_t current_frame = start; nframes_t current_stored_peak = (nframes_t) ceil (current_frame / (double) samples_per_file_peak); uint32_t next_visual_peak = (uint32_t) ceil (current_frame / samples_per_visual_peak); @@ -451,16 +451,16 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t s uint32_t start_byte = current_stored_peak * sizeof(PeakData); tnp = min ((nframes_t)(_length/samples_per_file_peak - current_stored_peak), (nframes_t) expected_peaks); to_read = min (chunksize, tnp); - + #ifdef DEBUG_READ_PEAKS cerr << "read " << sizeof (PeakData) * to_read << " from peakfile @ " << start_byte << endl; #endif - + if ((nread = ::pread (_peakfile, staging, sizeof (PeakData) * to_read, start_byte)) != sizeof (PeakData) * to_read) { off_t fend = lseek (_peakfile, 0, SEEK_END); - + cerr << "AudioSource[" << _name << "]: cannot read peak data from peakfile (" @@ -470,18 +470,18 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t s << ") (" << strerror (errno) << ')' - << " at start_byte = " << start_byte + << " at start_byte = " << start_byte << " _length = " << _length << " versus len = " << fend << " expected maxpeaks = " << (_length - current_frame)/samples_per_file_peak << " npeaks was " << npeaks << endl; goto out; } - + i = 0; stored_peaks_read = nread / sizeof(PeakData); } - + xmax = -1.0; xmin = 1.0; @@ -501,21 +501,21 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t s //next_visual_peak_frame = min ((next_visual_peak * samples_per_visual_peak), (next_visual_peak_frame+samples_per_visual_peak) ); next_visual_peak_frame = min ((double) start+cnt, (next_visual_peak_frame+samples_per_visual_peak) ); - stored_peak_before_next_visual_peak = (uint32_t) next_visual_peak_frame / samples_per_file_peak; + stored_peak_before_next_visual_peak = (uint32_t) next_visual_peak_frame / samples_per_file_peak; } if (zero_fill) { - memset (&peaks[npeaks], 0, sizeof (PeakData) * zero_fill); - } - + memset (&peaks[npeaks], 0, sizeof (PeakData) * zero_fill); + } + ret = 0; } else { - + #ifdef DEBUG_READ_PEAKS cerr << "UPSAMPLE\n"; #endif - /* the caller wants + /* the caller wants - less frames-per-peak (more resolution) - more peaks than stored in the Peakfile @@ -530,7 +530,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t s nframes_t nvisual_peaks = 0; nframes_t chunksize = (nframes_t) min (cnt, (nframes_t) 4096); raw_staging = new Sample[chunksize]; - + nframes_t frame_pos = start; double pixel_pos = floor (frame_pos / samples_per_visual_peak); double next_pixel_pos = ceil (frame_pos / samples_per_visual_peak); @@ -556,14 +556,14 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t s if ((frames_read = read_unlocked (raw_staging, current_frame, to_read)) == 0) { error << string_compose(_("AudioSource[%1]: peak read - cannot read %2 samples at offset %3 of %4 (%5)"), - _name, to_read, current_frame, _length, strerror (errno)) + _name, to_read, current_frame, _length, strerror (errno)) << endmsg; goto out; } - + i = 0; } - + xmax = max (xmax, raw_staging[i]); xmin = min (xmin, raw_staging[i]); ++i; @@ -581,7 +581,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, nframes_t npeaks, sframes_t s next_pixel_pos = ceil (pixel_pos + 0.5); } } - + if (zero_fill) { memset (&peaks[npeaks], 0, sizeof (PeakData) * zero_fill); } @@ -622,18 +622,18 @@ AudioSource::build_peaks_from_scratch () /* hold lock while building peaks */ Glib::Mutex::Lock lp (_lock); - + if (prepare_for_peakfile_writes ()) { goto out; } - + current_frame = 0; cnt = _length; _peaks_built = false; buf = new Sample[bufsize]; while (cnt) { - + frames_to_read = min (bufsize, cnt); if ((frames_read = read_unlocked (buf, current_frame, frames_to_read)) != frames_to_read) { @@ -645,7 +645,7 @@ AudioSource::build_peaks_from_scratch () if (compute_and_write_peaks (buf, current_frame, frames_read, true, false, _FPP)) { break; } - + current_frame += frames_read; cnt -= frames_read; } @@ -653,14 +653,14 @@ AudioSource::build_peaks_from_scratch () if (cnt == 0) { /* success */ truncate_peakfile(); - } + } done_with_peakfile_writes ((cnt == 0)); } - + { Glib::Mutex::Lock lm (_peaks_ready_lock); - + if (_peaks_built) { PeaksReady (); /* EMIT SIGNAL */ ret = 0; @@ -693,7 +693,7 @@ AudioSource::done_with_peakfile_writes (bool done) if (peak_leftover_cnt) { compute_and_write_peaks (0, 0, 0, true, false, _FPP); } - + if (done) { _peaks_built = true; } @@ -734,13 +734,13 @@ AudioSource::compute_and_write_peaks (Sample* buf, sframes_t first_frame, nframe if (first_frame != peak_leftover_frame + peak_leftover_cnt) { - /* uh-oh, ::seek() since the last ::compute_and_write_peaks(), + /* uh-oh, ::seek() since the last ::compute_and_write_peaks(), and we have leftovers. flush a single peak (since the leftovers never represent more than that, and restart. */ - + PeakData x; - + x.min = peak_leftovers[0]; x.max = peak_leftovers[0]; @@ -753,12 +753,12 @@ AudioSource::compute_and_write_peaks (Sample* buf, sframes_t first_frame, nframe _peak_byte_max = max (_peak_byte_max, (off_t) (byte + sizeof(PeakData))); - { + { Glib::Mutex::Lock lm (_peaks_ready_lock); PeakRangeReady (peak_leftover_frame, peak_leftover_cnt); /* EMIT SIGNAL */ if (intermediate_peaks_ready) { PeaksReady (); /* EMIT SIGNAL */ - } + } } /* left overs are done */ @@ -791,7 +791,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, sframes_t first_frame, nframe /* make sure that when we write into the peakfile, we startup where we left off */ first_frame = peak_leftover_frame; - + } else { to_do = cnt; } @@ -824,7 +824,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, sframes_t first_frame, nframe break; } - + nframes_t this_time = min (fpp, to_do); peakbuf[peaks_computed].max = buf[0]; @@ -838,20 +838,20 @@ AudioSource::compute_and_write_peaks (Sample* buf, sframes_t first_frame, nframe frames_done += this_time; current_frame += this_time; } - + first_peak_byte = (first_frame / fpp) * sizeof (PeakData); if (can_truncate_peaks()) { /* on some filesystems (ext3, at least) this helps to reduce fragmentation of the peakfiles. its not guaranteed to do so, and even on ext3 (as of december 2006) - it does not cause single-extent allocation even for peakfiles of + it does not cause single-extent allocation even for peakfiles of less than BLOCKSIZE bytes. only call ftruncate if we'll make the file larger. */ - + off_t endpos = lseek (peakfile, 0, SEEK_END); off_t target_length = blocksize * ((first_peak_byte + blocksize + 1) / blocksize); - + if (endpos < target_length) { ftruncate (peakfile, target_length); /* error doesn't actually matter though, so continue on without testing */ @@ -863,7 +863,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, sframes_t first_frame, nframe goto out; } - _peak_byte_max = max (_peak_byte_max, (off_t) (first_peak_byte + sizeof(PeakData)*peaks_computed)); + _peak_byte_max = max (_peak_byte_max, (off_t) (first_peak_byte + sizeof(PeakData)*peaks_computed)); if (frames_done) { Glib::Mutex::Lock lm (_peaks_ready_lock); @@ -894,7 +894,7 @@ AudioSource::truncate_peakfile () /* truncate the peakfile down to its natural length if necessary */ off_t end = lseek (peakfile, 0, SEEK_END); - + if (end > _peak_byte_max) { ftruncate (peakfile, _peak_byte_max); } @@ -908,7 +908,7 @@ AudioSource::file_changed (ustring path) int e1 = stat (path.c_str(), &stat_file); int e2 = stat (peak_path(path).c_str(), &stat_peak); - + if (!e1 && !e2 && stat_file.st_mtime > stat_peak.st_mtime){ return true; } else { @@ -921,8 +921,8 @@ AudioSource::available_peaks (double zoom_factor) const { if (zoom_factor < _FPP) { return length(_timeline_position); // peak data will come from the audio file - } - + } + /* peak data comes from peakfile, but the filesize might not represent the valid data due to ftruncate optimizations, so use _peak_byte_max state. XXX - there might be some atomicity issues here, we should probably add a lock, diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc index 4d99e2f5e0..9db604cd54 100644 --- a/libs/ardour/auditioner.cc +++ b/libs/ardour/auditioner.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,13 +46,13 @@ Auditioner::Auditioner (Session& s) string right = _session.config.get_auditioner_output_right(); if (left == "default") { - left = _session.engine().get_nth_physical_output (DataType::AUDIO, 0); + left = _session.engine().get_nth_physical_output (DataType::AUDIO, 0); } if (right == "default") { right = _session.engine().get_nth_physical_output (DataType::AUDIO, 1); } - + if ((left.length() == 0) && (right.length() == 0)) { warning << _("no outputs available for auditioner - manual connection required") << endmsg; return; @@ -68,7 +68,7 @@ Auditioner::Auditioner (Session& s) audio_diskstream()->add_channel (1); _output->add_port (right, this, DataType::AUDIO); } - + _main_outs->allow_pan_reset (); _main_outs->reset_panner (); @@ -216,7 +216,7 @@ Auditioner::output_changed (IOChange change, void* /*src*/) } else { _session.config.set_auditioner_output_left (""); } - + connections.clear (); if (_output->nth (1)->get_connections (connections)) { diff --git a/libs/ardour/auto_bundle.cc b/libs/ardour/auto_bundle.cc index fc70768601..bedb270dc5 100644 --- a/libs/ardour/auto_bundle.cc +++ b/libs/ardour/auto_bundle.cc @@ -10,7 +10,7 @@ ARDOUR::AutoBundle::AutoBundle (bool i) ARDOUR::AutoBundle::AutoBundle (std::string const & n, bool i) : Bundle (n, i) { - + } ARDOUR::ChanCount diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index bf08a4026c..85f083ca37 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001,2007 Paul Davis + Copyright (C) 2001,2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,19 +53,19 @@ int Automatable::old_set_automation_state (const XMLNode& node) { const XMLProperty *prop; - + if ((prop = node.property ("path")) != 0) { load_automation (prop->value()); } else { warning << _("Automation node has no path property") << endmsg; } - + if ((prop = node.property ("visible")) != 0) { uint32_t what; stringstream sstr; - + _visible_controls.clear (); - + sstr << prop->value(); while (1) { sstr >> what; @@ -75,7 +75,7 @@ Automatable::old_set_automation_state (const XMLNode& node) mark_automation_visible (Evoral::Parameter(PluginAutomation, 0, what), true); } } - + _last_automation_snapshot = 0; return 0; @@ -103,7 +103,7 @@ Automatable::load_automation (const string& path) Glib::Mutex::Lock lm (control_lock()); set<Evoral::Parameter> tosave; controls().clear (); - + _last_automation_snapshot = 0; while (in) { @@ -114,14 +114,14 @@ Automatable::load_automation (const string& path) in >> port; if (!in) break; in >> when; if (!in) goto bad; in >> value; if (!in) goto bad; - + Evoral::Parameter param(PluginAutomation, 0, port); /* FIXME: this is legacy and only used for plugin inserts? I think? */ boost::shared_ptr<Evoral::Control> c = control (param, true); c->list()->add (when, value); tosave.insert (param); } - + return 0; bad: @@ -134,7 +134,7 @@ void Automatable::add_control(boost::shared_ptr<Evoral::Control> ac) { Evoral::Parameter param = ac->parameter(); - + ControlSet::add_control(ac); _can_automate_list.insert(param); auto_state_changed(param); // sync everything up @@ -145,7 +145,7 @@ Automatable::what_has_visible_data(set<Evoral::Parameter>& s) const { Glib::Mutex::Lock lm (control_lock()); set<Evoral::Parameter>::const_iterator li; - + for (li = _visible_controls.begin(); li != _visible_controls.end(); ++li) { s.insert (*li); } @@ -201,7 +201,7 @@ Automatable::mark_automation_visible (Evoral::Parameter what, bool yn) */ int Automatable::set_automation_state (const XMLNode& node, Evoral::Parameter legacy_param) -{ +{ Glib::Mutex::Lock lm (control_lock()); /* Don't clear controls, since some may be special derived Controllable classes */ @@ -210,7 +210,7 @@ Automatable::set_automation_state (const XMLNode& node, Evoral::Parameter legacy XMLNodeList nlist = node.children(); XMLNodeIterator niter; - + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { /*if (sscanf ((*niter)->name().c_str(), "parameter-%" PRIu32, ¶m) != 1) { @@ -230,9 +230,9 @@ Automatable::set_automation_state (const XMLNode& node, Evoral::Parameter legacy warning << "Automation has null type" << endl; continue; } - + boost::shared_ptr<AutomationList> al (new AutomationList(**niter, param)); - + if (!id_prop) { warning << "AutomationList node without automation-id property, " << "using default: " << EventTypeMap::instance().to_symbol(legacy_param) << endmsg; @@ -262,7 +262,7 @@ Automatable::get_automation_state () { Glib::Mutex::Lock lm (control_lock()); XMLNode* node = new XMLNode (X_("Automation")); - + if (controls().empty()) { return *node; } @@ -282,7 +282,7 @@ void Automatable::set_parameter_automation_state (Evoral::Parameter param, AutoState s) { Glib::Mutex::Lock lm (control_lock()); - + boost::shared_ptr<Evoral::Control> c = control (param, true); boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(c->list()); @@ -305,7 +305,7 @@ Automatable::get_parameter_automation_state (Evoral::Parameter param, bool lock) if (c) result = l->automation_state(); - + if (lock) control_lock().unlock(); @@ -316,7 +316,7 @@ void Automatable::set_parameter_automation_style (Evoral::Parameter param, AutoStyle s) { Glib::Mutex::Lock lm (control_lock()); - + boost::shared_ptr<Evoral::Control> c = control(param, true); boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(c->list()); @@ -379,7 +379,7 @@ Automatable::automation_snapshot (nframes_t now, bool force) c->list()->rt_add (now, i->second->user_float()); } } - + _last_automation_snapshot = now; } } @@ -388,12 +388,12 @@ void Automatable::transport_stopped (sframes_t now) { for (Controls::iterator li = controls().begin(); li != controls().end(); ++li) { - + boost::shared_ptr<AutomationControl> c = boost::dynamic_pointer_cast<AutomationControl>(li->second); boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(c->list()); - + c->list()->reposition_for_rt_add (now); if (c->automation_state() != Off) { diff --git a/libs/ardour/automation.cc b/libs/ardour/automation.cc index c6e96cfac8..931e2f45b8 100644 --- a/libs/ardour/automation.cc +++ b/libs/ardour/automation.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ struct AutomationEvent { void (AutomatedObject::*function) (void *); void *arg; - void operator() (){ + void operator() (){ object->function (arg); } }; diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc index ef54705e03..1460c42c7b 100644 --- a/libs/ardour/automation_control.cc +++ b/libs/ardour/automation_control.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -54,7 +54,7 @@ AutomationControl::set_value(float value) { bool to_list = _list && _session.transport_stopped() && ((AutomationList*)_list.get())->automation_write(); - + Control::set_float(value, to_list, _session.transport_frame()); Changed(); /* EMIT SIGNAL */ diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc index 08cf69308f..2f06f267c1 100644 --- a/libs/ardour/automation_list.cc +++ b/libs/ardour/automation_list.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,9 +70,9 @@ AutomationList::AutomationList (const AutomationList& other) _style = other._style; _state = other._state; _touching = other._touching; - + create_curve_if_necessary(); - + assert(_parameter.type() != NullAutomation); AutomationListCreated(this); } @@ -83,7 +83,7 @@ AutomationList::AutomationList (const AutomationList& other, double start, doubl _style = other._style; _state = other._state; _touching = other._touching; - + create_curve_if_necessary(); assert(_parameter.type() != NullAutomation); @@ -99,13 +99,13 @@ AutomationList::AutomationList (const XMLNode& node, Evoral::Parameter id) _touching = false; _state = Off; _style = Absolute; - + set_state (node); if (id) { _parameter = id; } - + create_curve_if_necessary(); assert(_parameter.type() != NullAutomation); @@ -149,18 +149,18 @@ AutomationList& AutomationList::operator= (const AutomationList& other) { if (this != &other) { - + _events.clear (); - + for (const_iterator i = other._events.begin(); i != other._events.end(); ++i) { _events.push_back (new Evoral::ControlEvent (**i)); } - + _min_yval = other._min_yval; _max_yval = other._max_yval; _max_xval = other._max_xval; _default_value = other._default_value; - + mark_dirty (); maybe_signal_changed (); } @@ -226,7 +226,7 @@ AutomationList::thaw () } } -void +void AutomationList::mark_dirty () const { ControlList::mark_dirty (); @@ -317,13 +317,13 @@ AutomationList::deserialize_events (const XMLNode& node) freeze (); clear (); - + stringstream str (content_node->content()); - + double x; double y; bool ok = true; - + while (str) { str >> x; if (!str) { @@ -336,7 +336,7 @@ AutomationList::deserialize_events (const XMLNode& node) } fast_simple_add (x, y); } - + if (!ok) { clear (); error << _("automation list: cannot load coordinates from XML, all points ignored") << endmsg; @@ -363,7 +363,7 @@ AutomationList::set_state (const XMLNode& node) /* partial state setting*/ return deserialize_events (node); } - + if (node.name() == X_("Envelope") || node.name() == X_("FadeOut") || node.name() == X_("FadeIn")) { if ((nsos = node.child (X_("AutomationList")))) { @@ -378,27 +378,27 @@ AutomationList::set_state (const XMLNode& node) XMLProperty* prop; nframes_t x; double y; - + freeze (); clear (); - + for (i = elist.begin(); i != elist.end(); ++i) { - + if ((prop = (*i)->property ("x")) == 0) { error << _("automation list: no x-coordinate stored for control point (point ignored)") << endmsg; continue; } x = atoi (prop->value().c_str()); - + if ((prop = (*i)->property ("y")) == 0) { error << _("automation list: no y-coordinate stored for control point (point ignored)") << endmsg; continue; } y = atof (prop->value().c_str()); - + fast_simple_add (x, y); } - + thaw (); return 0; @@ -414,20 +414,20 @@ AutomationList::set_state (const XMLNode& node) /* update session AL list */ AutomationListCreated(this); } - - if ((prop = node.property (X_("automation-id"))) != 0){ + + if ((prop = node.property (X_("automation-id"))) != 0){ _parameter = EventTypeMap::instance().new_parameter(prop->value()); } else { warning << "Legacy session: automation list has no automation-id property."; } - + if ((prop = node.property (X_("interpolation-style"))) != 0) { _interpolation = (InterpolationStyle)string_2_enum(prop->value(), _interpolation); } else { _interpolation = Linear; } - - if ((prop = node.property (X_("default"))) != 0){ + + if ((prop = node.property (X_("default"))) != 0){ _default_value = atof (prop->value().c_str()); } else { _default_value = 0.0; diff --git a/libs/ardour/beats_frames_converter.cc b/libs/ardour/beats_frames_converter.cc index f3d4840f34..da0f6e4c18 100644 --- a/libs/ardour/beats_frames_converter.cc +++ b/libs/ardour/beats_frames_converter.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify diff --git a/libs/ardour/broadcast_info.cc b/libs/ardour/broadcast_info.cc index 1144aaa2cd..f956e1207d 100644 --- a/libs/ardour/broadcast_info.cc +++ b/libs/ardour/broadcast_info.cc @@ -56,10 +56,10 @@ BroadcastInfo::BroadcastInfo () : { info = new SF_BROADCAST_INFO; memset (info, 0, sizeof (*info)); - + // Note: Set version to 1 when UMID is used, otherwise version should stay at 0 info->version = 0; - + time_t rawtime; std::time (&rawtime); _time = *localtime (&rawtime); @@ -85,16 +85,16 @@ BroadcastInfo::load_from_file (std::string const & filename) { SNDFILE * file = 0; SF_INFO info; - + info.format = 0; - + if (!(file = sf_open (filename.c_str(), SFM_READ, &info))) { update_error(); return false; } - + bool ret = load_from_file (file); - + sf_close (file); return ret; } @@ -107,7 +107,7 @@ BroadcastInfo::load_from_file (SNDFILE* sf) _has_info = false; return false; } - + _has_info = true; return true; } @@ -124,7 +124,7 @@ BroadcastInfo::get_time_reference () const if (!_has_info) { return 0; } - + int64_t ret = (uint32_t) info->time_reference_high; ret <<= 32; ret |= (uint32_t) info->time_reference_low; @@ -135,17 +135,17 @@ struct tm BroadcastInfo::get_origination_time () const { struct tm ret; - + std::string date = info->origination_date; ret.tm_year = atoi (date.substr (0, 4)) - 1900; ret.tm_mon = atoi (date.substr (5, 2)); ret.tm_mday = atoi (date.substr (8, 2)); - + std::string time = info->origination_time; ret.tm_hour = atoi (time.substr (0,2)); ret.tm_min = atoi (time.substr (3,2)); ret.tm_sec = atoi (time.substr (6,2)); - + return ret; } @@ -166,16 +166,16 @@ BroadcastInfo::write_to_file (std::string const & filename) { SNDFILE * file = 0; SF_INFO info; - + info.format = 0; - + if (!(file = sf_open (filename.c_str(), SFM_RDWR, &info))) { update_error(); return false; } - + bool ret = write_to_file (file); - + sf_close (file); return ret; } @@ -187,7 +187,7 @@ BroadcastInfo::write_to_file (SNDFILE* sf) update_error(); return false; } - + return true; } @@ -195,7 +195,7 @@ void BroadcastInfo::set_description (std::string const & desc) { _has_info = true; - + snprintf_bounded_null_filled (info->description, sizeof (info->description), desc.c_str()); } @@ -203,7 +203,7 @@ void BroadcastInfo::set_time_reference (int64_t when) { _has_info = true; - + info->time_reference_high = (when >> 32); info->time_reference_low = (when & 0xffffffff); } @@ -212,16 +212,16 @@ void BroadcastInfo::set_origination_time (struct tm * now) { _has_info = true; - + if (now) { _time = *now; } - + snprintf_bounded_null_filled (info->origination_date, sizeof (info->origination_date), "%4d-%02d-%02d", _time.tm_year + 1900, _time.tm_mon + 1, _time.tm_mday); - + snprintf_bounded_null_filled (info->origination_time, sizeof (info->origination_time), "%02d:%02d:%02d", _time.tm_hour, _time.tm_min, @@ -232,12 +232,12 @@ void BroadcastInfo::set_originator (std::string const & str) { _has_info = true; - + if (!str.empty()) { snprintf_bounded_null_filled (info->originator, sizeof (info->originator), str.c_str()); return; } - + snprintf_bounded_null_filled (info->originator, sizeof (info->originator), Glib::get_real_name().c_str()); } @@ -245,21 +245,21 @@ void BroadcastInfo::set_originator_ref (Session const & session, std::string const & str) { _has_info = true; - + if (!str.empty()) { snprintf_bounded_null_filled (info->originator_reference, sizeof (info->originator_reference), str.c_str()); return; } - + /* random code is 9 digits */ - + int random_code = random() % 999999999; - + /* Serial number is 12 chars */ - + std::ostringstream serial_number; serial_number << "ARDOUR" << "r" << std::setfill('0') << std::right << std::setw(5) << svn_revision; - + snprintf_bounded_null_filled (info->originator_reference, sizeof (info->originator_reference), "%2s%3s%12s%02d%02d%02d%9d", session.config.get_bwf_country_code().c_str(), session.config.get_bwf_organization_code().c_str(), @@ -268,7 +268,7 @@ BroadcastInfo::set_originator_ref (Session const & session, std::string const & _time.tm_min, _time.tm_sec, random_code); - + } void diff --git a/libs/ardour/buffer.cc b/libs/ardour/buffer.cc index 21803c3854..3d4737911b 100644 --- a/libs/ardour/buffer.cc +++ b/libs/ardour/buffer.cc @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/libs/ardour/buffer_set.cc b/libs/ardour/buffer_set.cc index e02e2ba2cb..71b9ee6d9f 100644 --- a/libs/ardour/buffer_set.cc +++ b/libs/ardour/buffer_set.cc @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -88,7 +88,7 @@ BufferSet::attach_buffers(PortSet& ports, nframes_t nframes, nframes_t offset) v.push_back(&(p->get_buffer(nframes, offset))); } } - + _count = ports.count(); _available = ports.count(); @@ -110,7 +110,7 @@ BufferSet::ensure_buffers(DataType type, size_t num_buffers, size_t buffer_capac // The vector of buffers of the type we care about BufferVec& bufs = _buffers[type]; - + // If we're a mirror just make sure we're ok if (_is_mirror) { assert(_count.get(type) >= num_buffers); @@ -133,7 +133,7 @@ BufferSet::ensure_buffers(DataType type, size_t num_buffers, size_t buffer_capac for (size_t i = 0; i < num_buffers; ++i) { bufs.push_back(Buffer::create(type, buffer_capacity)); } - + _available.set(type, num_buffers); _count.set (type, num_buffers); } @@ -177,7 +177,7 @@ BufferSet::ensure_buffers(const ChanCount& chns, size_t buffer_capacity) BufferVec& bufs = _buffers[*t]; uint32_t nbufs = chns.get (*t); - + if (nbufs == 0) { // Nuke it for (BufferVec::iterator i = bufs.begin(); i != bufs.end(); ++i) { @@ -191,21 +191,21 @@ BufferSet::ensure_buffers(const ChanCount& chns, size_t buffer_capacity) // rebuild it (so I'm lazy..) if (bufs.size() < nbufs || (bufs.size() > 0 && bufs[0]->capacity() < buffer_capacity)) { - + // Nuke it for (BufferVec::iterator i = bufs.begin(); i != bufs.end(); ++i) { delete (*i); } bufs.clear(); - + // Rebuild it for (size_t i = 0; i < nbufs; ++i) { bufs.push_back(Buffer::create(*t, buffer_capacity)); } - + _available.set (*t, nbufs); } - + #ifdef HAVE_SLV2 // Ensure enough low level MIDI format buffers are available for conversion // in both directions (input & output, out-of-place) @@ -215,13 +215,13 @@ BufferSet::ensure_buffers(const ChanCount& chns, size_t buffer_capacity) } } #endif - + // Post-conditions assert(bufs[0]->type() == *t); assert(bufs.size() == _available.get(*t)); assert(bufs[0]->capacity() >= buffer_capacity); } - + assert (available() == chns); } @@ -251,7 +251,7 @@ BufferSet::get_lv2_midi(bool input, size_t i) MidiBuffer& mbuf = get_midi(i); LV2Buffers::value_type b = _lv2_buffers.at(i * 2 + (input ? 0 : 1)); LV2EventBuffer* ebuf = b.second; - + ebuf->reset(); if (input) { for (MidiBuffer::iterator e = mbuf.begin(); e != mbuf.end(); ++e) { diff --git a/libs/ardour/bundle.cc b/libs/ardour/bundle.cc index c21f239a45..cd416c6a67 100644 --- a/libs/ardour/bundle.cc +++ b/libs/ardour/bundle.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -84,7 +84,7 @@ Bundle::Bundle (boost::shared_ptr<Bundle> other) _signals_suspended (other->_signals_suspended), _pending_change (other->_pending_change) { - + } uint32_t @@ -136,7 +136,7 @@ Bundle::remove_port_from_channel (uint32_t ch, string portname) Glib::Mutex::Lock lm (_channel_mutex); PortList& pl = _channel[ch].ports; PortList::iterator i = find (pl.begin(), pl.end(), portname); - + if (i != pl.end()) { pl.erase (i); changed = true; @@ -183,7 +183,7 @@ bool Bundle::port_attached_to_channel (uint32_t ch, std::string portname) { assert (ch < nchannels()); - + Glib::Mutex::Lock lm (_channel_mutex); return (std::find (_channel[ch].ports.begin (), _channel[ch].ports.end (), portname) != _channel[ch].ports.end ()); } @@ -283,7 +283,7 @@ void Bundle::add_channels_from_bundle (boost::shared_ptr<Bundle> other) { uint32_t const ch = nchannels (); - + for (uint32_t i = 0; i < other->nchannels(); ++i) { std::stringstream s; @@ -361,7 +361,7 @@ void Bundle::remove_ports_from_channel (uint32_t ch) { assert (ch < nchannels ()); - + { Glib::Mutex::Lock lm (_channel_mutex); _channel[ch].ports.clear (); @@ -396,7 +396,7 @@ Bundle::emit_changed (Change c) Changed (c); } } - + bool Bundle::connected_to (boost::shared_ptr<Bundle> other, AudioEngine & engine) { @@ -410,7 +410,7 @@ Bundle::connected_to (boost::shared_ptr<Bundle> other, AudioEngine & engine) for (uint32_t i = 0; i < nchannels(); ++i) { Bundle::PortList const & A = channel_ports (i); Bundle::PortList const & B = other->channel_ports (i); - + for (uint32_t j = 0; j < A.size(); ++j) { for (uint32_t k = 0; k < B.size(); ++k) { diff --git a/libs/ardour/caimportable.cc b/libs/ardour/caimportable.cc index 37e8f487f2..f5a70a5f6a 100644 --- a/libs/ardour/caimportable.cc +++ b/libs/ardour/caimportable.cc @@ -35,7 +35,7 @@ CAImportableSource::~CAImportableSource () } nframes_t -CAImportableSource::read (Sample* buffer, nframes_t nframes) +CAImportableSource::read (Sample* buffer, nframes_t nframes) { nframes_t nread = 0; AudioBufferList abl; @@ -48,12 +48,12 @@ CAImportableSource::read (Sample* buffer, nframes_t nframes) per_channel = nframes / abl.mBuffers[0].mNumberChannels; while (nread < per_channel) { - + UInt32 new_cnt = per_channel - nread; - + abl.mBuffers[0].mDataByteSize = new_cnt * abl.mBuffers[0].mNumberChannels * sizeof(Sample); abl.mBuffers[0].mData = buffer + nread; - + try { af.Read (new_cnt, &abl); } catch (CAXException& cax) { @@ -73,18 +73,18 @@ CAImportableSource::read (Sample* buffer, nframes_t nframes) if (!at_end && nread < per_channel) { return 0; } else { - return nread * abl.mBuffers[0].mNumberChannels; + return nread * abl.mBuffers[0].mNumberChannels; } } uint -CAImportableSource::channels () const +CAImportableSource::channels () const { return af.GetFileDataFormat().NumberChannels(); } nframes_t -CAImportableSource::length () const +CAImportableSource::length () const { return af.GetNumberFrames(); } @@ -114,5 +114,5 @@ CAImportableSource::seek (nframes_t pos) } } - + diff --git a/libs/ardour/chan_count.cc b/libs/ardour/chan_count.cc index b11c578455..c6764456e0 100644 --- a/libs/ardour/chan_count.cc +++ b/libs/ardour/chan_count.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/chan_mapping.cc b/libs/ardour/chan_mapping.cc index 653d45d58f..20ea6722a9 100644 --- a/libs/ardour/chan_mapping.cc +++ b/libs/ardour/chan_mapping.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -99,7 +99,7 @@ std::ostream& operator<<(std::ostream& o, const ARDOUR::ChanMapping& cm) o << "\t" << i->first << " => " << i->second << endl; } } - + return o; } diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc index 79f36c86d8..68f13f8245 100644 --- a/libs/ardour/configuration.cc +++ b/libs/ardour/configuration.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 1999-2009 Paul Davis + Copyright (C) 1999-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,20 +48,20 @@ bool ConfigVariableBase::set_from_node (XMLNode const & node) { if (node.name() == "Config" || node.name() == "Canvas" || node.name() == "UI") { - + /* ardour.rc */ - + const XMLProperty* prop; XMLNodeList nlist; XMLNodeConstIterator niter; XMLNode* child; - + nlist = node.children(); - + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - + child = *niter; - + if (child->name() == "Option") { if ((prop = child->property ("name")) != 0) { if (prop->value() == _name) { @@ -73,7 +73,7 @@ ConfigVariableBase::set_from_node (XMLNode const & node) } } } - + } else if (node.name() == "Options") { /* session file */ @@ -82,13 +82,13 @@ ConfigVariableBase::set_from_node (XMLNode const & node) XMLNodeConstIterator oiter; XMLNode* option; const XMLProperty* opt_prop; - + olist = node.children(); - + for (oiter = olist.begin(); oiter != olist.end(); ++oiter) { - + option = *oiter; - + if (option->name() == _name) { if ((opt_prop = option->property ("val")) != 0) { set_from_string (opt_prop->value()); @@ -97,7 +97,7 @@ ConfigVariableBase::set_from_node (XMLNode const & node) } } } - + return false; } @@ -125,7 +125,7 @@ ConfigVariableBase::notify () void ConfigVariableBase::miss () { - // placeholder for any debugging desired when a config variable + // placeholder for any debugging desired when a config variable // is set but to the same value as it already has } diff --git a/libs/ardour/control_outputs.cc b/libs/ardour/control_outputs.cc index 8efb75145c..570e7ab72b 100644 --- a/libs/ardour/control_outputs.cc +++ b/libs/ardour/control_outputs.cc @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc index f0bdfae874..18e6534c84 100644 --- a/libs/ardour/control_protocol_manager.cc +++ b/libs/ardour/control_protocol_manager.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ const string ControlProtocolManager::state_node_name = X_("ControlProtocols"); ControlProtocolManager::ControlProtocolManager () : _session (0) { - + } ControlProtocolManager::~ControlProtocolManager() @@ -54,7 +54,7 @@ ControlProtocolManager::~ControlProtocolManager() control_protocols.clear (); - + for (list<ControlProtocolInfo*>::iterator p = control_protocol_info.begin(); p != control_protocol_info.end(); ++p) { delete (*p); } @@ -91,7 +91,7 @@ ControlProtocolManager::drop_session () delete *p; } control_protocols.clear (); - + for (list<ControlProtocolInfo*>::iterator p = control_protocol_info.begin(); p != control_protocol_info.end(); ++p) { // otherwise the ControlProtocol instances are not recreated in set_session if ((*p)->protocol) { @@ -143,7 +143,7 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi) } cpi.descriptor->destroy (cpi.descriptor, cpi.protocol); - + { Glib::Mutex::Lock lm (protocols_lock); list<ControlProtocol*>::iterator p = find (control_protocols.begin(), control_protocols.end(), cpi.protocol); @@ -160,7 +160,7 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi) cerr << "Programming error: ControlProtocolManager::teardown() called for " << cpi.name << ", but it was not found in control_protocol_info" << endl; } } - + cpi.protocol = 0; dlclose (cpi.descriptor->module); return 0; @@ -223,9 +223,9 @@ ControlProtocolManager::control_protocol_discover (string path) cpi->mandatory = descriptor->mandatory; cpi->supports_feedback = descriptor->supports_feedback; cpi->state = 0; - + control_protocol_info.push_back (cpi); - + info << string_compose(_("Control surface protocol discovered: \"%1\""), cpi->name) << endmsg; } @@ -310,7 +310,7 @@ ControlProtocolManager::set_state (const XMLNode& node) } else { cpi->state = 0; } - + if (_session) { instantiate (*cpi); } else { @@ -319,7 +319,7 @@ ControlProtocolManager::set_state (const XMLNode& node) } } } - } + } } return 0; } diff --git a/libs/ardour/control_protocol_search_path.cc b/libs/ardour/control_protocol_search_path.cc index a74195b4c0..7cdf75a441 100644 --- a/libs/ardour/control_protocol_search_path.cc +++ b/libs/ardour/control_protocol_search_path.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Tim Mayberry + Copyright (C) 2007 Tim Mayberry This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ control_protocol_search_path () { bool surfaces_path_defined = false; SearchPath spath_env(Glib::getenv(surfaces_env_variable_name, surfaces_path_defined)); - + if (surfaces_path_defined) { return spath_env; diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc index d9d1f01601..eac6426520 100644 --- a/libs/ardour/coreaudiosource.cc +++ b/libs/ardour/coreaudiosource.cc @@ -38,8 +38,8 @@ using namespace ARDOUR; using namespace PBD; CoreAudioSource::CoreAudioSource (Session& s, const XMLNode& node) - : Source (s, node), - AudioFileSource (s, node) + : Source (s, node) + , AudioFileSource (s, node) { init (); } @@ -54,7 +54,7 @@ CoreAudioSource::CoreAudioSource (Session& s, const string& path, bool, int chn, init (); } -void +void CoreAudioSource::init () { /* note that we temporarily truncated _id at the colon */ @@ -63,7 +63,7 @@ CoreAudioSource::init () CAStreamBasicDescription file_format (af.GetFileDataFormat()); n_channels = file_format.NumberChannels(); - + if (_channel >= n_channels) { error << string_compose("CoreAudioSource: file only contains %1 channels; %2 is invalid as a channel number (%3)", n_channels, _channel, name()) << endmsg; throw failed_constructor(); @@ -81,8 +81,8 @@ CoreAudioSource::init () af.SetClientFormat (client_format); } catch (CAXException& cax) { - - error << string_compose(_("CoreAudioSource: cannot open file \"%1\" for %2"), + + error << string_compose(_("CoreAudioSource: cannot open file \"%1\" for %2"), _path, (writable() ? "read+write" : "reading")) << endmsg; throw failed_constructor (); } @@ -99,19 +99,19 @@ CoreAudioSource::safe_read (Sample* dst, nframes_t start, nframes_t cnt, AudioBu nframes_t nread = 0; while (nread < cnt) { - + try { af.Seek (start+nread); } catch (CAXException& cax) { error << string_compose("CoreAudioSource: %1 to %2 (%3)", cax.mOperation, start+nread, _name.substr (1)) << endmsg; return -1; } - + UInt32 new_cnt = cnt - nread; - + abl.mBuffers[0].mDataByteSize = new_cnt * n_channels * sizeof(Sample); abl.mBuffers[0].mData = dst + nread; - + try { af.Read (new_cnt, &abl); } catch (CAXException& cax) { @@ -137,7 +137,7 @@ CoreAudioSource::safe_read (Sample* dst, nframes_t start, nframes_t cnt, AudioBu return 0; } } - + nframes_t CoreAudioSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) const @@ -151,17 +151,17 @@ CoreAudioSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) con if (start > _length) { /* read starts beyond end of data, just memset to zero */ - + file_cnt = 0; } else if (start + cnt > _length) { - + /* read ends beyond end of data, read some, memset the rest */ - + file_cnt = _length - start; } else { - + /* read is entirely within data */ file_cnt = cnt; @@ -184,7 +184,7 @@ CoreAudioSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) con } Sample* interleave_buf = get_interleave_buffer (file_cnt * n_channels); - + if (safe_read (interleave_buf, start, file_cnt, abl) != 0) { return 0; } @@ -192,9 +192,9 @@ CoreAudioSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) con _read_data_count = cnt * sizeof(float); Sample *ptr = interleave_buf + _channel; - + /* stride through the interleaved data */ - + for (uint32_t n = 0; n < file_cnt; ++n) { dst[n] = *ptr; ptr += n_channels; @@ -227,7 +227,7 @@ CoreAudioSource::update_header (sframes_t when, struct tm&, time_t) int CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string& error_msg) { - FSRef ref; + FSRef ref; ExtAudioFileRef af = 0; size_t size; CFStringRef name; @@ -236,18 +236,18 @@ CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string& if (FSPathMakeRef ((UInt8*)path.c_str(), &ref, 0) != noErr) { goto out; } - + if (ExtAudioFileOpen(&ref, &af) != noErr) { goto out; } - + AudioStreamBasicDescription absd; memset(&absd, 0, sizeof(absd)); size = sizeof(AudioStreamBasicDescription); if (ExtAudioFileGetProperty (af, kExtAudioFileProperty_FileDataFormat, &size, &absd) != noErr) { goto out; } - + _info.samplerate = absd.mSampleRate; _info.channels = absd.mChannelsPerFrame; @@ -255,7 +255,7 @@ CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string& if (ExtAudioFileGetProperty(af, kExtAudioFileProperty_FileLengthFrames, &size, &_info.length) != noErr) { goto out; } - + size = sizeof(CFStringRef); if (AudioFormatGetProperty(kAudioFormatProperty_FormatName, sizeof(absd), &absd, &size, &name) != noErr) { goto out; @@ -269,12 +269,12 @@ CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string& } else { _info.format_name += "little-endian"; } - + char buf[32]; snprintf (buf, sizeof (buf), " %" PRIu32 " bit", absd.mBitsPerChannel); _info.format_name += buf; _info.format_name += '\n'; - + if (absd.mFormatFlags & kAudioFormatFlagIsFloat) { _info.format_name += "float"; } else { @@ -285,14 +285,14 @@ CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string& } /* integer is typical, do not show it */ } - + if (_info.channels > 1) { if (absd.mFormatFlags & kAudioFormatFlagIsNonInterleaved) { _info.format_name += " noninterleaved"; } /* interleaved is the normal case, do not show it */ } - + _info.format_name += ' '; } @@ -363,9 +363,9 @@ CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string& _info.timecode = 0; ret = 0; - + out: ExtAudioFileDispose (af); return ret; - + } diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc index 2d46c0c01a..f12b32228d 100644 --- a/libs/ardour/crossfade.cc +++ b/libs/ardour/crossfade.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003-2006 Paul Davis + Copyright (C) 2003-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,7 +69,7 @@ Crossfade::operator== (const Crossfade& other) return (_in == other._in) && (_out == other._out); } -Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<AudioRegion> out, +Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<AudioRegion> out, nframes_t length, nframes_t position, AnchorPoint ap) @@ -123,7 +123,7 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node) error << _("Crossfade: no \"in\" region in state") << endmsg; throw failed_constructor(); } - + PBD::ID id (prop->value()); if ((r = playlist.find_region (id)) == 0) { @@ -131,7 +131,7 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node) << endmsg; throw failed_constructor(); } - + if ((_in = boost::dynamic_pointer_cast<AudioRegion> (r)) == 0) { throw failed_constructor(); } @@ -148,7 +148,7 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node) << endmsg; throw failed_constructor(); } - + if ((_out = boost::dynamic_pointer_cast<AudioRegion> (r)) == 0) { throw failed_constructor(); } @@ -156,7 +156,7 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node) _length = 0; initialize(); _active = true; - + if (set_state (node)) { throw failed_constructor(); } @@ -172,13 +172,13 @@ Crossfade::Crossfade (boost::shared_ptr<Crossfade> orig, boost::shared_ptr<Audio _anchor_point = orig->_anchor_point; _follow_overlap = orig->_follow_overlap; _fixed = orig->_fixed; - + _in = newin; _out = newout; // copied from Crossfade::initialize() _in_update = false; - + _out->suspend_fade_out (); _in->suspend_fade_in (); @@ -204,9 +204,9 @@ Crossfade::initialize () _sources.insert (_sources.end(), _out->sources().begin(), _out->sources().end()); _master_sources = _in->master_sources(); _master_sources.insert(_master_sources.end(), _out->master_sources().begin(), _out->master_sources().end()); - + _in_update = false; - + _out->suspend_fade_out (); _in->suspend_fade_in (); @@ -236,7 +236,7 @@ Crossfade::initialize () #endif _fade_out.thaw (); - + _fade_in.freeze (); _fade_in.clear (); @@ -267,9 +267,9 @@ Crossfade::initialize () overlap_type = _in->coverage (_out->position(), _out->last_frame()); layer_relation = (int32_t) (_in->layer() - _out->layer()); -} +} -nframes_t +nframes_t Crossfade::read_raw_internal (Sample* /*buf*/, sframes_t /*start*/, nframes_t cnt, int /*channel*/) const { // FIXME: Why is this disabled? @@ -288,8 +288,8 @@ Crossfade::read_raw_internal (Sample* /*buf*/, sframes_t /*start*/, nframes_t cn return cnt; } -nframes_t -Crossfade::read_at (Sample *buf, Sample *mixdown_buffer, +nframes_t +Crossfade::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, sframes_t start, nframes_t cnt, uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const { @@ -313,15 +313,15 @@ Crossfade::read_at (Sample *buf, Sample *mixdown_buffer, } else { return 0; } - + start = _position; buf += offset; to_write = min (_length, cnt); } else { - + to_write = min (nframes_t(_length - (start - _position)), cnt); - + } offset = start - _position; @@ -345,7 +345,7 @@ Crossfade::read_at (Sample *buf, Sample *mixdown_buffer, /* note: although we have not explicitly taken into account the return values from _out->read_at() or _in->read_at(), the length() function does this implicitly. why? because it computes a value based on the in+out regions' - position and length, and so we know precisely how much data they could return. + position and length, and so we know precisely how much data they could return. */ for (nframes_t n = 0; n < to_write; ++n) { @@ -356,9 +356,9 @@ Crossfade::read_at (Sample *buf, Sample *mixdown_buffer, delete [] fiv; return to_write; -} +} -OverlapType +OverlapType Crossfade::coverage (nframes_t start, nframes_t end) const { nframes_t my_end = _position + _length; @@ -391,14 +391,14 @@ bool Crossfade::refresh () { /* crossfades must be between non-muted regions */ - + if (_out->muted() || _in->muted()) { Invalidated (shared_from_this ()); return false; } /* Top layer shouldn't be transparent */ - + if (!((layer_relation > 0 ? _in : _out)->opaque())) { Invalidated (shared_from_this()); return false; @@ -418,7 +418,7 @@ Crossfade::refresh () if (ot == OverlapNone) { Invalidated (shared_from_this ()); return false; - } + } bool send_signal; @@ -428,7 +428,7 @@ Crossfade::refresh () try { compute (_in, _out, _session.config.get_xfade_model()); - } + } catch (NoCrossfadeHere& err) { Invalidated (shared_from_this ()); @@ -460,39 +460,39 @@ bool Crossfade::update () { nframes_t newlen; - + if (_follow_overlap) { newlen = _out->first_frame() + _out->length() - _in->first_frame(); } else { newlen = _length; } - + if (newlen == 0) { Invalidated (shared_from_this ()); return false; } - + _in_update = true; - + if ((_follow_overlap && newlen != _length) || (_length > newlen)) { - + double factor = newlen / (double) _length; - + _fade_out.x_scale (factor); _fade_in.x_scale (factor); - + _length = newlen; - } - + } + switch (_anchor_point) { case StartOfIn: _position = _in->first_frame(); break; - + case EndOfIn: _position = _in->last_frame() - _length; break; - + case EndOfOut: _position = _out->last_frame() - _length; } @@ -507,7 +507,7 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg boost::shared_ptr<AudioRegion> bottom; nframes_t short_xfade_length; - short_xfade_length = _short_xfade_length; + short_xfade_length = _short_xfade_length; if (a->layer() < b->layer()) { top = b; @@ -516,19 +516,19 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg top = a; bottom = b; } - + /* first check for matching ends */ - + if (top->first_frame() == bottom->first_frame()) { /* Both regions start at the same point */ - + if (top->last_frame() < bottom->last_frame()) { - + /* top ends before bottom, so put an xfade in at the end of top. */ - + /* [-------- top ---------- ] * {====== bottom =====================} */ @@ -551,24 +551,24 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg } else { /* top ends after (or same time) as bottom - no xfade */ - + /* [-------- top ------------------------ ] * {====== bottom =====================} */ throw NoCrossfadeHere(); } - + } else if (top->last_frame() == bottom->last_frame()) { - + /* Both regions end at the same point */ - + if (top->first_frame() > bottom->first_frame()) { - + /* top starts after bottom, put an xfade in at the start of top */ - + /* [-------- top ---------- ] * {====== bottom =====================} */ @@ -581,7 +581,7 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg _anchor_point = StartOfIn; _active = true; _fixed = true; - + } else { /* top starts before bottom - no xfade */ @@ -594,7 +594,7 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg } } else { - + /* OK, time to do more regular overlapping */ OverlapType ot = top->coverage (bottom->first_frame(), bottom->last_frame()); @@ -606,18 +606,18 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg */ throw NoCrossfadeHere(); break; - + case OverlapInternal: case OverlapExternal: /* should be NOTREACHED because of tests above */ throw NoCrossfadeHere(); break; - + case OverlapEnd: /* top covers start of bottom but ends within it */ - /* [---- top ------------------------] - * { ==== bottom ============ } - */ + /* [---- top ------------------------] + * { ==== bottom ============ } + */ _in = bottom; _out = top; @@ -630,17 +630,17 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg _follow_overlap = true; } else { _length = min (short_xfade_length, top->length()); - _position = top->last_frame() - _length; // "]" - length + _position = top->last_frame() - _length; // "]" - length _active = true; _follow_overlap = false; - + } break; - + case OverlapStart: /* top starts within bottom but covers bottom's end */ - /* { ==== top ============ } - * [---- bottom -------------------] + /* { ==== top ============ } + * [---- bottom -------------------] */ _in = top; @@ -656,18 +656,18 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg _length = min (short_xfade_length, top->length()); _active = true; _follow_overlap = false; - + } - + break; } } - + return 0; } XMLNode& -Crossfade::get_state () +Crossfade::get_state () { XMLNode* node = new XMLNode (X_("Crossfade")); XMLNode* child; @@ -779,11 +779,11 @@ Crossfade::set_state (const XMLNode& node) } } else { - + /* XXX this branch is legacy code from before the point where we stored xfade lengths. */ - + if ((_length = overlap_length()) == 0) { throw failed_constructor(); } @@ -792,26 +792,26 @@ Crossfade::set_state (const XMLNode& node) if ((fi = find_named_node (node, "FadeIn")) == 0) { return -1; } - + if ((fo = find_named_node (node, "FadeOut")) == 0) { return -1; } /* fade in */ - + _fade_in.freeze (); _fade_in.clear (); - + children = fi->children(); - + for (i = children.begin(); i != children.end(); ++i) { if ((*i)->name() == "point") { nframes_t x; float y; - + prop = (*i)->property ("x"); sscanf (prop->value().c_str(), "%" PRIu32, &x); - + prop = (*i)->property ("y"); sscanf (prop->value().c_str(), "%f", &y); @@ -820,14 +820,14 @@ Crossfade::set_state (const XMLNode& node) } _fade_in.thaw (); - + /* fade out */ - + _fade_out.freeze (); _fade_out.clear (); children = fo->children(); - + for (i = children.begin(); i != children.end(); ++i) { if ((*i)->name() == "point") { nframes_t x; @@ -839,7 +839,7 @@ Crossfade::set_state (const XMLNode& node) prop = (*i)->property ("y"); sscanf (prop->value().c_str(), "%f", &y); - + _fade_out.add (x, y); } } @@ -892,7 +892,7 @@ Crossfade::set_xfade_length (nframes_t len) case EndOfOut: limit = _out->length(); break; - + } len = min (limit, len); @@ -903,7 +903,7 @@ Crossfade::set_xfade_length (nframes_t len) _fade_out.x_scale (factor); _fade_in.x_scale (factor); _in_update = false; - + _length = len; StateChanged (LengthChanged); diff --git a/libs/ardour/cycle_timer.cc b/libs/ardour/cycle_timer.cc index e7cfc9402c..7a6b1fcab2 100644 --- a/libs/ardour/cycle_timer.cc +++ b/libs/ardour/cycle_timer.cc @@ -31,7 +31,7 @@ float CycleTimer::get_mhz() { FILE *f; - + if ((f = fopen("/proc/cpuinfo", "r")) == 0) { fatal << _("CycleTimer::get_mhz(): can't open /proc/cpuinfo") << endmsg; /*NOTREACHED*/ @@ -68,7 +68,7 @@ CycleTimer::get_mhz() } } - fatal << _("cannot locate cpu MHz in /proc/cpuinfo") << endmsg; + fatal << _("cannot locate cpu MHz in /proc/cpuinfo") << endmsg; /*NOTREACHED*/ return 0.0f; } diff --git a/libs/ardour/default_click.cc b/libs/ardour/default_click.cc index 585d660809..b1f4772852 100644 --- a/libs/ardour/default_click.cc +++ b/libs/ardour/default_click.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 20002 Paul Davis + Copyright (C) 20002 Paul Davis Sounds by Nick Mainsbridge. This program is free software; you can redistribute it and/or modify diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index 1b5f96d36c..17e073b070 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -1,16 +1,16 @@ /* - Copyright (C) 2009 Paul Davis - + Copyright (C) 2009 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -62,7 +62,7 @@ Delivery::Delivery (Session& s, boost::shared_ptr<IO> io, boost::shared_ptr<Mute { _panner = boost::shared_ptr<Panner>(new Panner (_name, _session)); - + if (_output) { _output->changed.connect (mem_fun (*this, &Delivery::output_changed)); } @@ -192,7 +192,7 @@ Delivery::can_support_io_configuration (const ChanCount& in, ChanCount& out) con of our output object. */ - if (_output) { + if (_output) { if (_output->n_ports() != ChanCount::ZERO) { out = _output->n_ports(); return true; @@ -210,10 +210,10 @@ Delivery::can_support_io_configuration (const ChanCount& in, ChanCount& out) con } else if (_role == Insert) { /* the output buffers will be filled with data from the *input* ports - of this Insert. + of this Insert. */ - if (_input) { + if (_input) { if (_input->n_ports() != ChanCount::ZERO) { out = _input->n_ports(); return true; @@ -238,12 +238,12 @@ bool Delivery::configure_io (ChanCount in, ChanCount out) { /* check configuration by comparison with our I/O port configuration, if appropriate. - see ::can_support_io_configuration() for comments + see ::can_support_io_configuration() for comments */ if (_role == Main) { - if (_output) { + if (_output) { if (_output->n_ports() != out) { if (_output->n_ports() != ChanCount::ZERO) { fatal << _name << " programming error: configure_io with nports = " << _output->n_ports() << " called with " << in << " and " << out << " with " << _output->n_ports() << " output ports" << endmsg; @@ -251,12 +251,12 @@ Delivery::configure_io (ChanCount in, ChanCount out) } else { /* I/O not yet configured */ } - } + } } } else if (_role == Insert) { - if (_input) { + if (_input) { if (_input->n_ports() != in) { if (_input->n_ports() != ChanCount::ZERO) { fatal << _name << " programming error: configure_io called with " << in << " and " << out << " with " << _input->n_ports() << " input ports" << endmsg; @@ -294,7 +294,7 @@ Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nfra goto out; } - /* this setup is not just for our purposes, but for anything that comes after us in the + /* this setup is not just for our purposes, but for anything that comes after us in the processing pathway that wants to use this->output_buffers() for some reason. */ @@ -306,9 +306,9 @@ Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nfra // which cannot do this. tgain = target_gain (); - + if (tgain != _current_gain) { - + /* target gain has changed */ Amp::apply_gain (bufs, nframes, _current_gain, tgain); @@ -319,7 +319,7 @@ Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nfra /* we were quiet last time, and we're still supposed to be quiet. Silence the outputs, and make sure the buffers are quiet too, */ - + _output->silence (nframes); Amp::apply_simple_gain (bufs, nframes, 0.0); goto out; @@ -379,7 +379,7 @@ Delivery::set_state (const XMLNode& node) if (IOProcessor::set_state (node)) { return -1; } - + if ((prop = node.property ("role")) != 0) { _role = Role (string_2_enum (prop->value(), _role)); // std::cerr << this << ' ' << _name << " set role to " << enum_2_string (_role) << std::endl; @@ -388,10 +388,10 @@ Delivery::set_state (const XMLNode& node) } XMLNode* pan_node = node.child (X_("Panner")); - + if (pan_node) { _panner->set_state (*pan_node); - } + } reset_panner (); @@ -405,7 +405,7 @@ Delivery::reset_panner () if (!no_panner_reset) { uint32_t ntargets; - + if (_output) { ntargets = _output->n_ports().n_audio(); } else { @@ -493,7 +493,7 @@ void Delivery::flush (nframes_t nframes) { /* io_lock, not taken: function must be called from Session::process() calltree */ - + PortSet& ports (_output->ports()); for (PortSet::iterator i = ports.begin(); i != ports.end(); ++i) { @@ -525,7 +525,7 @@ Delivery::target_gain () } else { MuteMaster::MutePoint mp; - + switch (_role) { case Main: mp = MuteMaster::Main; @@ -542,9 +542,9 @@ Delivery::target_gain () } if (_solo_isolated) { - + /* ... but we are isolated from all that nonsense */ - + desired_gain = _mute_master->mute_gain_at (mp); } else if (_session.soloing()) { diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index 6b9ecc53fe..6912846cd0 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ Diskstream::Diskstream (Session &sess, const string &name, Flag flag) { init (flag); } - + Diskstream::Diskstream (Session& sess, const XMLNode& /*node*/) : SessionObject(sess, "unnamed diskstream") { @@ -183,21 +183,21 @@ Diskstream::realtime_set_speed (double sp, bool global) { bool changed = false; double new_speed = sp * _session.transport_speed(); - + if (_visible_speed != sp) { _visible_speed = sp; changed = true; } - + if (new_speed != _actual_speed) { - - nframes_t required_wrap_size = (nframes_t) floor (_session.get_block_size() * + + nframes_t required_wrap_size = (nframes_t) floor (_session.get_block_size() * fabs (new_speed)) + 1; - + if (required_wrap_size > wrap_buffer_size) { _buffer_reallocation_required = true; } - + _actual_speed = new_speed; _target_speed = fabs(_actual_speed); } @@ -326,14 +326,14 @@ Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist) if (_playlist) { _playlist->release(); } - + _playlist = playlist; _playlist->use(); if (!in_set_state && recordable()) { reset_write_sources (false); } - + plmod_connection = _playlist->Modified.connect (mem_fun (*this, &Diskstream::playlist_modified)); plgone_connection = _playlist->GoingAway.connect (bind (mem_fun (*this, &Diskstream::playlist_deleted), boost::weak_ptr<Playlist>(_playlist))); plregion_connection = _playlist->RangesMoved.connect (mem_fun (*this, &Diskstream::playlist_ranges_moved)); @@ -348,7 +348,7 @@ Diskstream::use_playlist (boost::shared_ptr<Playlist> playlist) _session.request_overwrite_buffer (this); overwrite_queued = true; } - + PlaylistChanged (); /* EMIT SIGNAL */ _session.set_dirty (); @@ -367,7 +367,7 @@ Diskstream::playlist_modified () if (!i_am_the_modifier && !overwrite_queued) { _session.request_overwrite_buffer (this); overwrite_queued = true; - } + } } void @@ -377,14 +377,14 @@ Diskstream::playlist_deleted (boost::weak_ptr<Playlist> wpl) if (pl == _playlist) { - /* this catches an ordering issue with session destruction. playlists + /* this catches an ordering issue with session destruction. playlists are destroyed before diskstreams. we have to invalidate any handles we have to the playlist. */ - + if (_playlist) { _playlist.reset (); - } + } } } @@ -394,9 +394,9 @@ Diskstream::set_name (const string& str) if (str != _name) { assert(playlist()); playlist()->set_name (str); - + SessionObject::set_name(str); - + if (!in_set_state && recordable()) { /* rename existing capture files so that they have the correct name */ return rename_write_sources (); @@ -416,7 +416,7 @@ Diskstream::remove_region_from_last_capture (boost::weak_ptr<Region> wregion) if (!region) { return; } - + _last_capture_regions.remove (region); } @@ -435,7 +435,7 @@ Diskstream::playlist_ranges_moved (list< Evoral::RangeMove<nframes_t> > const & movements.push_back(Evoral::RangeMove<double>(i->from, i->length, i->to)); } - + /* move panner automation */ boost::shared_ptr<Panner> p = _route->main_outs()->panner (); if (p) { @@ -460,13 +460,13 @@ Diskstream::move_processor_automation (boost::weak_ptr<Processor> p, if (!processor) { return; } - + list< Evoral::RangeMove<double> > movements; for (list< Evoral::RangeMove<nframes_t> >::const_iterator i = movements_frames.begin(); i != movements_frames.end(); ++i) { movements.push_back(Evoral::RangeMove<double>(i->from, i->length, i->to)); } - + set<Evoral::Parameter> const a = processor->what_can_be_automated (); for (set<Evoral::Parameter>::iterator i = a.begin (); i != a.end (); ++i) { diff --git a/libs/ardour/element_importer.cc b/libs/ardour/element_importer.cc index eb6e39d13a..4438985586 100644 --- a/libs/ardour/element_importer.cc +++ b/libs/ardour/element_importer.cc @@ -35,7 +35,7 @@ using namespace ARDOUR; sigc::signal <std::pair<bool, string>, string, string> ElementImporter::Rename; sigc::signal <bool, string> ElementImporter::Prompt; -ElementImporter::ElementImporter (XMLTree const & source, ARDOUR::Session & session) : +ElementImporter::ElementImporter (XMLTree const & source, ARDOUR::Session & session) : source (source), session(session), _queued (false), @@ -91,7 +91,7 @@ ElementImporter::smpte_to_string(SMPTE::Time & time) const time.seconds << ":" << std::setw(2) << time.frames; - + return oss.str(); } @@ -101,7 +101,7 @@ ElementImporter::rate_convert_samples (nframes_t samples) const if (sample_rate == session.frame_rate()) { return samples; } - + // +0.5 for proper rounding return static_cast<nframes_t> (samples * (static_cast<double> (session.nominal_frame_rate()) / sample_rate) + 0.5); } diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 92810534ee..1ca26f8fae 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -177,7 +177,7 @@ setup_enum_writer () REGISTER_ENUM (ChannelColors); REGISTER_ENUM (TrackColor); REGISTER (_ColorMode); - + REGISTER_ENUM (MeterFalloffOff); REGISTER_ENUM (MeterFalloffSlowest); REGISTER_ENUM (MeterFalloffSlow); diff --git a/libs/ardour/event_type_map.cc b/libs/ardour/event_type_map.cc index d380906c0c..dd5b1a9149 100644 --- a/libs/ardour/event_type_map.cc +++ b/libs/ardour/event_type_map.cc @@ -49,10 +49,10 @@ uint8_t EventTypeMap::parameter_midi_type(const Evoral::Parameter& param) const { switch (param.type()) { - case MidiCCAutomation: return MIDI_CMD_CONTROL; break; - case MidiPgmChangeAutomation: return MIDI_CMD_PGM_CHANGE; break; - case MidiChannelPressureAutomation: return MIDI_CMD_CHANNEL_PRESSURE; break; - case MidiPitchBenderAutomation: return MIDI_CMD_BENDER; break; + case MidiCCAutomation: return MIDI_CMD_CONTROL; break; + case MidiPgmChangeAutomation: return MIDI_CMD_PGM_CHANGE; break; + case MidiChannelPressureAutomation: return MIDI_CMD_CHANNEL_PRESSURE; break; + case MidiPitchBenderAutomation: return MIDI_CMD_BENDER; break; case MidiSystemExclusiveAutomation: return MIDI_CMD_COMMON_SYSEX; break; default: return 0; } @@ -78,7 +78,7 @@ EventTypeMap::is_integer(const Evoral::Parameter& param) const && param.type() <= MidiChannelPressureAutomation); } -Evoral::ControlList::InterpolationStyle +Evoral::ControlList::InterpolationStyle EventTypeMap::interpolation_of(const Evoral::Parameter& param) { switch (param.type()) { @@ -117,15 +117,15 @@ EventTypeMap::interpolation_of(const Evoral::Parameter& param) case MIDI_CTL_OMNI_OFF: case MIDI_CTL_OMNI_ON: case MIDI_CTL_MONO: - case MIDI_CTL_POLY: + case MIDI_CTL_POLY: return Evoral::ControlList::Discrete; break; default: return Evoral::ControlList::Linear; break; } - break; - case MidiPgmChangeAutomation: return Evoral::ControlList::Discrete; break; - case MidiChannelPressureAutomation: return Evoral::ControlList::Linear; break; - case MidiPitchBenderAutomation: return Evoral::ControlList::Linear; break; + break; + case MidiPgmChangeAutomation: return Evoral::ControlList::Discrete; break; + case MidiChannelPressureAutomation: return Evoral::ControlList::Linear; break; + case MidiPitchBenderAutomation: return Evoral::ControlList::Linear; break; default: assert(false); } return Evoral::ControlList::Linear; // Not reached, suppress warnings @@ -167,7 +167,7 @@ EventTypeMap::new_parameter(uint32_t type, uint8_t channel, uint32_t id) const case MidiSystemExclusiveAutomation: return p; } - + p.set_range(type, min, max, normal); return p; } diff --git a/libs/ardour/export_channel.cc b/libs/ardour/export_channel.cc index 58110ea5a9..583dc9a843 100644 --- a/libs/ardour/export_channel.cc +++ b/libs/ardour/export_channel.cc @@ -46,7 +46,7 @@ PortExportChannel::read (Sample * data, nframes_t frames) const for (PortSet::const_iterator it = ports.begin(); it != ports.end(); ++it) { if (*it != 0) { Sample* port_buffer = (*it)->get_audio_buffer(frames, 0).data(); - + for (uint32_t i = 0; i < frames; ++i) { data[i] += (float) port_buffer[i]; } @@ -95,11 +95,11 @@ RegionExportChannelFactory::RegionExportChannelFactory (Session * session, Audio break; case Fades: n_channels = region.n_channels(); - + mixdown_buffer = new Sample [frames_per_cycle]; gain_buffer = new Sample [frames_per_cycle]; memset (gain_buffer, 1.0, sizeof (Sample) * frames_per_cycle); - + break; case Processed: n_channels = track.n_outputs().n_audio(); @@ -107,9 +107,9 @@ RegionExportChannelFactory::RegionExportChannelFactory (Session * session, Audio default: throw ExportFailed ("Unhandled type in ExportChannelFactory constructor"); } - + session->ProcessExport.connect (sigc::hide (sigc::mem_fun (*this, &RegionExportChannelFactory::new_cycle_started))); - + buffers.set_count (ChanCount (DataType::AUDIO, n_channels)); buffers.ensure_buffers (DataType::AUDIO, n_channels, frames_per_cycle); } @@ -132,12 +132,12 @@ RegionExportChannelFactory::read (uint32_t channel, Sample * data, nframes_t fra { assert (channel < n_channels); assert (frames_to_read <= frames_per_cycle); - + if (!buffers_up_to_date) { update_buffers(frames_to_read); buffers_up_to_date = true; } - + memcpy (data, buffers.get_audio (channel).data(), frames_to_read * sizeof (Sample)); } @@ -165,6 +165,6 @@ RegionExportChannelFactory::update_buffers (nframes_t frames) default: throw ExportFailed ("Unhandled type in ExportChannelFactory::update_buffers"); } - + position += frames; } diff --git a/libs/ardour/export_channel_configuration.cc b/libs/ardour/export_channel_configuration.cc index 4fe8c09cb6..47bbbd276c 100644 --- a/libs/ardour/export_channel_configuration.cc +++ b/libs/ardour/export_channel_configuration.cc @@ -57,21 +57,21 @@ ExportChannelConfiguration::get_state () { XMLNode * root = new XMLNode ("ExportChannelConfiguration"); XMLNode * channel; - + root->add_property ("split", get_split() ? "true" : "false"); root->add_property ("channels", to_string (get_n_chans(), std::dec)); - + uint32_t i = 1; for (ExportChannelConfiguration::ChannelList::const_iterator c_it = channels.begin(); c_it != channels.end(); ++c_it) { channel = root->add_child ("Channel"); if (!channel) { continue; } - + channel->add_property ("number", to_string (i, std::dec)); (*c_it)->get_state (channel); - + ++i; } - + return *root; } @@ -79,7 +79,7 @@ int ExportChannelConfiguration::set_state (const XMLNode & root) { XMLProperty const * prop; - + if ((prop = root.property ("split"))) { set_split (!prop->value().compare ("true")); } @@ -100,7 +100,7 @@ ExportChannelConfiguration::all_channels_have_ports () const for (ChannelList::const_iterator it = channels.begin(); it != channels.end(); ++it) { if ((*it)->empty ()) { return false; } } - + return true; } @@ -110,23 +110,23 @@ ExportChannelConfiguration::write_files (boost::shared_ptr<ExportProcessor> new_ if (files_written || writer_thread.running) { return false; } - + files_written = true; if (!timespan) { throw ExportFailed (X_("Programming error: No timespan registered to channel configuration when requesting files to be written")); } - + /* Take a local copy of the processor to be used in the thread that is created below */ - + processor.reset (new_processor->copy()); - + /* Create new thread for post processing */ - + pthread_create (&writer_thread.thread, 0, _write_files, &writer_thread); writer_thread.running = true; pthread_detach (writer_thread.thread); - + return true; } @@ -139,36 +139,36 @@ ExportChannelConfiguration::write_file () nframes_t frames = 2048; // TODO good block size ? nframes_t frames_read = 0; - + float * channel_buffer = new float [frames]; float * file_buffer = new float [channels.size() * frames]; uint32_t channel_count = channels.size(); uint32_t channel; - + do { if (status->aborted()) { break; } - + channel = 0; for (ChannelList::iterator it = channels.begin(); it != channels.end(); ++it) { - + /* Get channel data */ - + frames_read = timespan->get_data (channel_buffer, frames, *it); - + /* Interleave into file buffer */ - + for (uint32_t i = 0; i < frames_read; ++i) { file_buffer[channel + (channel_count * i)] = channel_buffer[i]; } - + ++channel; } - + progress += frames_read; status->progress = (float) progress / timespan_length; - + } while (processor->process (file_buffer, frames_read) > 0); - + delete [] channel_buffer; delete [] file_buffer; } @@ -177,10 +177,10 @@ void * ExportChannelConfiguration::_write_files (void *arg) { notify_gui_about_thread_creation (pthread_self(), "Export post-processing"); - + // cc can be trated like 'this' WriterThread & cc (*((WriterThread *) arg)); - + try { for (FileConfigList::iterator it = cc->file_configs.begin(); it != cc->file_configs.end(); ++it) { if (cc->status->aborted()) { @@ -194,11 +194,11 @@ ExportChannelConfiguration::_write_files (void *arg) } catch (ExportFailed & e) { cc->status->abort (true); } - + cc.running = false; cc->files_written = true; cc->FilesWritten(); - + return 0; // avoid compiler warnings } @@ -206,7 +206,7 @@ void ExportChannelConfiguration::register_with_timespan (TimespanPtr new_timespan) { timespan = new_timespan; - + for (ChannelList::iterator it = channels.begin(); it != channels.end(); ++it) { timespan->register_channel (*it); } diff --git a/libs/ardour/export_file_io.cc b/libs/ardour/export_file_io.cc index 2f8fdeacdf..4c39e5c907 100644 --- a/libs/ardour/export_file_io.cc +++ b/libs/ardour/export_file_io.cc @@ -40,24 +40,24 @@ SndfileWriterBase::SndfileWriterBase (int channels, nframes_t samplerate, int fo ExportFileWriter (path) { char errbuf[256]; - + sf_info.channels = channels; sf_info.samplerate = samplerate; sf_info.format = format; - + if (!sf_format_check (&sf_info)) { throw ExportFailed (X_("Invalid format given for SndfileWriter!")); } - + if (path.length() == 0) { throw ExportFailed (X_("No output file specified for SndFileWriter")); } - /* TODO add checks that the directory path exists, and also + /* TODO add checks that the directory path exists, and also check if we are overwriting an existing file... */ - - // Open file TODO make sure we have enough disk space for the output + + // Open file TODO make sure we have enough disk space for the output if (path.compare ("temp")) { if ((sndfile = sf_open (path.c_str(), SFM_WRITE, &sf_info)) == 0) { sf_error_str (0, errbuf, sizeof (errbuf) - 1); @@ -118,11 +118,11 @@ SndfileWriter<T>::write (T * data, nframes_t frames) sf_error_str (sndfile, errbuf, sizeof (errbuf) - 1); throw ExportFailed (string_compose(_("Could not write data to output file (%1)"), errbuf)); } - + if (GraphSink<T>::end_of_input) { sf_write_sync (sndfile); } - + return frames; } @@ -152,9 +152,9 @@ ExportTempFile::read (float * data, nframes_t frames) nframes_t frames_read = 0; nframes_t to_read = 0; sf_count_t read_status = 0; - + /* Initialize state at first read */ - + if (!reading) { if (!end_set) { end = get_length(); @@ -163,25 +163,25 @@ ExportTempFile::read (float * data, nframes_t frames) locate_to (start); reading = true; } - + /* Add silence to beginning */ - + if (silence_beginning > 0) { if (silence_beginning >= frames) { memset (data, 0, channels * frames * sizeof (float)); silence_beginning -= frames; return frames; } - + memset (data, 0, channels * silence_beginning * sizeof (float)); - + frames_read += silence_beginning; data += channels * silence_beginning; silence_beginning = 0; } - + /* Read file, but don't read past end */ - + if (get_read_position() >= end) { // File already read, do nothing! } else { @@ -190,32 +190,32 @@ ExportTempFile::read (float * data, nframes_t frames) } else { to_read = frames - frames_read; } - + read_status = sf_readf_float (sndfile, data, to_read); - + frames_read += to_read; data += channels * to_read; } - + /* Check for errors */ - + if (read_status != to_read) { throw ExportFailed (X_("Error reading temporary export file, export might not be complete!")); } - + /* Add silence at end */ - + if (silence_end > 0) { to_read = frames - frames_read; if (silence_end < to_read) { to_read = silence_end; } - + memset (data, 0, channels * to_read * sizeof (float)); silence_end -= to_read; frames_read += to_read; } - + return frames_read; } @@ -230,10 +230,10 @@ ExportTempFile::trim_beginning (bool yn) if (!beginning_processed) { process_beginning (); } - + start = silent_frames_beginning; return start; - + } nframes_t @@ -249,7 +249,7 @@ ExportTempFile::trim_end (bool yn) if (!end_processed) { process_end (); } - + end = silent_frames_end; return end; } @@ -261,10 +261,10 @@ ExportTempFile::process_beginning () nframes_t frames = 1024; nframes_t frames_read; float * buf = new float[channels * frames]; - + nframes_t pos = 0; locate_to (pos); - + while ((frames_read = _read (buf, frames)) > 0) { for (nframes_t i = 0; i < frames_read; i++) { for (uint32_t chn = 0; chn < channels; ++chn) { @@ -276,12 +276,12 @@ ExportTempFile::process_beginning () ++pos; } } - + out: - + silent_frames_beginning = pos; beginning_processed = true; - + delete [] buf; } @@ -291,9 +291,9 @@ ExportTempFile::process_end () nframes_t frames = 1024; nframes_t frames_read; float * buf = new float[channels * frames]; - + nframes_t pos = get_length() - 1; - + while (pos > 0) { if (pos > frames) { locate_to (pos - frames); @@ -303,7 +303,7 @@ ExportTempFile::process_end () locate_to (0); frames_read = _read (buf, pos); } - + for (nframes_t i = frames_read; i > 0; --i) { for (uint32_t chn = 0; chn < channels; ++chn) { if (buf[chn + (i - 1) * channels] != 0.0f) { @@ -313,12 +313,12 @@ ExportTempFile::process_end () --pos; } } - + out: - + silent_frames_end = pos; end_processed = true; - + delete [] buf; } @@ -397,37 +397,37 @@ ExportFileFactory::create_sndfile (FormatPtr format, unsigned int channels, ustr typedef boost::shared_ptr<SampleFormatConverter<short> > ShortConverterPtr; typedef boost::shared_ptr<SampleFormatConverter<int> > IntConverterPtr; typedef boost::shared_ptr<SampleFormatConverter<float> > FloatConverterPtr; - + typedef boost::shared_ptr<SndfileWriter<short> > ShortWriterPtr; typedef boost::shared_ptr<SndfileWriter<int> > IntWriterPtr; typedef boost::shared_ptr<SndfileWriter<float> > FloatWriterPtr; - + int real_format = format->format_id() | format->sample_format() | format->endianness(); uint32_t data_width = sndfile_data_width (real_format); if (data_width == 8 || data_width == 16) { - + ShortConverterPtr sfc = ShortConverterPtr (new SampleFormatConverter<short> (channels, format->dither_type(), data_width)); ShortWriterPtr sfw = ShortWriterPtr (new SndfileWriter<short> (channels, format->sample_rate(), real_format, filename)); sfc->pipe_to (sfw); - + return std::make_pair (boost::static_pointer_cast<FloatSink> (sfc), boost::static_pointer_cast<ExportFileWriter> (sfw)); } else if (data_width == 24 || data_width == 32) { - + IntConverterPtr sfc = IntConverterPtr (new SampleFormatConverter<int> (channels, format->dither_type(), data_width)); IntWriterPtr sfw = IntWriterPtr (new SndfileWriter<int> (channels, format->sample_rate(), real_format, filename)); sfc->pipe_to (sfw); - + return std::make_pair (boost::static_pointer_cast<FloatSink> (sfc), boost::static_pointer_cast<ExportFileWriter> (sfw)); } - + FloatConverterPtr sfc = FloatConverterPtr (new SampleFormatConverter<float> (channels, format->dither_type(), data_width)); FloatWriterPtr sfw = FloatWriterPtr (new SndfileWriter<float> (channels, format->sample_rate(), real_format, filename)); sfc->pipe_to (sfw); - + return std::make_pair (boost::static_pointer_cast<FloatSink> (sfc), boost::static_pointer_cast<ExportFileWriter> (sfw)); } diff --git a/libs/ardour/export_filename.cc b/libs/ardour/export_filename.cc index 539d4f2027..51e32a4ca9 100644 --- a/libs/ardour/export_filename.cc +++ b/libs/ardour/export_filename.cc @@ -54,9 +54,9 @@ ExportFilename::ExportFilename (Session & session) : time_t rawtime; std::time (&rawtime); time_struct = localtime (&rawtime); - + folder = session.session_directory().export_path().to_string(); - + XMLNode * instant_node = session.instant_xml ("ExportFilename"); if (instant_node) { set_state (*instant_node); @@ -68,22 +68,22 @@ ExportFilename::get_state () { XMLNode * node = new XMLNode ("ExportFilename"); XMLNode * child; - + FieldPair dir = analyse_folder(); child = node->add_child ("Folder"); child->add_property ("relative", dir.first ? "true" : "false"); child->add_property ("path", dir.second); - + add_field (node, "label", include_label, label); add_field (node, "session", include_session); add_field (node, "revision", include_revision); add_field (node, "time", include_time, enum_2_string (time_format)); add_field (node, "date", include_date, enum_2_string (date_format)); - + XMLNode * instant_node = new XMLNode ("ExportRevision"); instant_node->add_property ("revision", to_string (revision, std::dec)); session.add_instant_xml (*instant_node); - + return *node; } @@ -93,37 +93,37 @@ ExportFilename::set_state (const XMLNode & node) XMLNode * child; XMLProperty * prop; FieldPair pair; - + child = node.child ("Folder"); if (!child) { return -1; } - + folder = ""; - + if ((prop = child->property ("relative"))) { if (!prop->value().compare ("true")) { folder = session.session_directory().root_path().to_string(); } } - + if ((prop = child->property ("path"))) { folder += prop->value(); } - - + + pair = get_field (node, "label"); include_label = pair.first; label = pair.second; - + pair = get_field (node, "session"); include_session = pair.first; - + pair = get_field (node, "revision"); include_revision = pair.first; - + pair = get_field (node, "time"); include_time = pair.first; time_format = (TimeFormat) string_2_enum (pair.second, time_format); - + pair = get_field (node, "date"); include_date = pair.first; date_format = (DateFormat) string_2_enum (pair.second, date_format); @@ -137,66 +137,66 @@ ExportFilename::set_state (const XMLNode & node) } ustring -ExportFilename::get_path (FormatPtr format) const +ExportFilename::get_path (FormatPtr format) const { ustring path = folder; bool filename_empty = true; - + path += "/"; - + if (include_session) { path += filename_empty ? "" : "_"; path += session.name(); filename_empty = false; } - + if (include_label) { path += filename_empty ? "" : "_"; path += label; filename_empty = false; } - + if (include_revision) { path += filename_empty ? "" : "_"; path += "r"; path += to_string (revision, std::dec); filename_empty = false; } - + if (include_timespan && timespan) { path += filename_empty ? "" : "_"; path += timespan->name(); filename_empty = false; } - + if (include_channel_config && channel_config) { path += filename_empty ? "" : "_"; path += channel_config->name(); filename_empty = false; } - + if (include_channel) { path += filename_empty ? "" : "_"; path += "channel"; path += to_string (channel, std::dec); filename_empty = false; } - + if (include_date) { path += filename_empty ? "" : "_"; path += get_date_format_str (date_format); filename_empty = false; } - + if (include_time) { path += filename_empty ? "" : "_"; path += get_time_format_str (time_format); filename_empty = false; } - + path += "."; path += format->extension (); - + return path; } @@ -206,13 +206,13 @@ ExportFilename::get_time_format_str (TimeFormat format) const switch ( format ) { case T_None: return _("No Time"); - + case T_NoDelim: return get_formatted_time ("%H%M"); - + case T_Delim: return get_formatted_time ("%H.%M"); - + default: return _("Invalid time format"); } @@ -224,19 +224,19 @@ ExportFilename::get_date_format_str (DateFormat format) const switch (format) { case D_None: return _("No Date"); - + case D_BE: return get_formatted_time ("%Y%m%d"); - + case D_ISO: return get_formatted_time ("%Y-%m-%d"); - + case D_BEShortY: return get_formatted_time ("%y%m%d"); - + case D_ISOShortY: return get_formatted_time ("%y-%m-%d"); - + default: return _("Invalid date format"); } @@ -246,7 +246,7 @@ void ExportFilename::set_time_format (TimeFormat format) { time_format = format; - + if (format == T_None) { include_time = false; } else { @@ -258,7 +258,7 @@ void ExportFilename::set_date_format (DateFormat format) { date_format = format; - + if (format == D_None) { include_date = false; } else { @@ -286,7 +286,7 @@ ExportFilename::get_formatted_time (ustring const & format) const { char buffer [80]; strftime (buffer, 80, format.c_str(), time_struct); - + ustring return_value (buffer); return return_value; } @@ -295,12 +295,12 @@ void ExportFilename::add_field (XMLNode * node, ustring const & name, bool enabled, ustring const & value) { XMLNode * child = node->add_child ("Field"); - + if (!child) { std::cerr << "Error adding a field to ExportFilename XML-tree" << std::endl; return; } - + child->add_property ("name", name); child->add_property ("enabled", enabled ? "true" : "false"); if (!value.empty()) { @@ -315,27 +315,27 @@ ExportFilename::get_field (XMLNode const & node, ustring const & name) pair.first = false; XMLNodeList children = node.children(); - + for (XMLNodeList::iterator it = children.begin(); it != children.end(); ++it) { XMLProperty * prop = (*it)->property ("name"); if (prop && !prop->value().compare (name)) { - + prop = (*it)->property ("enabled"); if (prop && !prop->value().compare ("true")) { pair.first = true; } else { pair.first = false; } - + prop = (*it)->property ("value"); if (prop) { pair.second = prop->value(); } - + return pair; } } - + return pair; } @@ -343,12 +343,12 @@ ExportFilename::FieldPair ExportFilename::analyse_folder () { FieldPair pair; - + ustring session_dir = session.session_directory().root_path().to_string(); ustring::size_type session_dir_len = session_dir.length(); - + ustring folder_beginning = folder.substr (0, session_dir_len); - + if (!folder_beginning.compare (session_dir)) { pair.first = true; pair.second = folder.substr (session_dir_len); @@ -356,7 +356,7 @@ ExportFilename::analyse_folder () pair.first = false; pair.second = folder; } - + return pair; } diff --git a/libs/ardour/export_format_base.cc b/libs/ardour/export_format_base.cc index f2570f8f65..a994b97ac3 100644 --- a/libs/ardour/export_format_base.cc +++ b/libs/ardour/export_format_base.cc @@ -46,7 +46,7 @@ ExportFormatBase::SelectableCompatible::set_compatible (bool value) ExportFormatBase::ExportFormatBase () { - + } ExportFormatBase::ExportFormatBase (ExportFormatBase const & other) : @@ -61,7 +61,7 @@ ExportFormatBase::ExportFormatBase (ExportFormatBase const & other) : ExportFormatBase::~ExportFormatBase () { - + } boost::shared_ptr<ExportFormatBase> @@ -86,9 +86,9 @@ boost::shared_ptr<ExportFormatBase> ExportFormatBase::do_set_operation (ExportFormatBase const & other, SetOperation operation) const { boost::shared_ptr<ExportFormatBase> result (new ExportFormatBase ()); - + /* Sets */ - + // Endiannesses { EndianSet::const_iterator start1 = endiannesses.begin(); @@ -96,7 +96,7 @@ ExportFormatBase::do_set_operation (ExportFormatBase const & other, SetOperation EndianSet::const_iterator start2 = other.endiannesses.begin(); EndianSet::const_iterator end2 = other.endiannesses.end(); std::insert_iterator<EndianSet> insert (result->endiannesses, result->endiannesses.begin()); - + switch (operation) { case SetIntersection: std::set_intersection (start1, end1, start2, end2, insert); @@ -109,7 +109,7 @@ ExportFormatBase::do_set_operation (ExportFormatBase const & other, SetOperation break; } } - + // Sample formats { SampleFormatSet::const_iterator start1 = sample_formats.begin(); @@ -117,7 +117,7 @@ ExportFormatBase::do_set_operation (ExportFormatBase const & other, SetOperation SampleFormatSet::const_iterator start2 = other.sample_formats.begin(); SampleFormatSet::const_iterator end2 = other.sample_formats.end(); std::insert_iterator<SampleFormatSet> insert (result->sample_formats, result->sample_formats.begin()); - + switch (operation) { case SetIntersection: std::set_intersection (start1, end1, start2, end2, insert); @@ -130,8 +130,8 @@ ExportFormatBase::do_set_operation (ExportFormatBase const & other, SetOperation break; } } - - + + // Sample rates { SampleRateSet::const_iterator start1 = sample_rates.begin(); @@ -139,7 +139,7 @@ ExportFormatBase::do_set_operation (ExportFormatBase const & other, SetOperation SampleRateSet::const_iterator start2 = other.sample_rates.begin(); SampleRateSet::const_iterator end2 = other.sample_rates.end(); std::insert_iterator<SampleRateSet> insert (result->sample_rates, result->sample_rates.begin()); - + switch (operation) { case SetIntersection: std::set_intersection (start1, end1, start2, end2, insert); @@ -152,7 +152,7 @@ ExportFormatBase::do_set_operation (ExportFormatBase const & other, SetOperation break; } } - + // Format ids { FormatSet::const_iterator start1 = format_ids.begin(); @@ -160,7 +160,7 @@ ExportFormatBase::do_set_operation (ExportFormatBase const & other, SetOperation FormatSet::const_iterator start2 = other.format_ids.begin(); FormatSet::const_iterator end2 = other.format_ids.end(); std::insert_iterator<FormatSet> insert (result->format_ids, result->format_ids.begin()); - + switch (operation) { case SetIntersection: std::set_intersection (start1, end1, start2, end2, insert); @@ -173,7 +173,7 @@ ExportFormatBase::do_set_operation (ExportFormatBase const & other, SetOperation break; } } - + // Qualities { QualitySet::const_iterator start1 = qualities.begin(); @@ -181,7 +181,7 @@ ExportFormatBase::do_set_operation (ExportFormatBase const & other, SetOperation QualitySet::const_iterator start2 = other.qualities.begin(); QualitySet::const_iterator end2 = other.qualities.end(); std::insert_iterator<QualitySet> insert (result->qualities, result->qualities.begin()); - + switch (operation) { case SetIntersection: std::set_intersection (start1, end1, start2, end2, insert); @@ -194,7 +194,7 @@ ExportFormatBase::do_set_operation (ExportFormatBase const & other, SetOperation break; } } - + return result; } diff --git a/libs/ardour/export_format_manager.cc b/libs/ardour/export_format_manager.cc index 8b4b9e550f..908ae6f8a8 100644 --- a/libs/ardour/export_format_manager.cc +++ b/libs/ardour/export_format_manager.cc @@ -48,9 +48,9 @@ ExportFormatManager::~ExportFormatManager () void ExportFormatManager::init_compatibilities () -{ +{ CompatPtr c_ptr; - + c_ptr.reset (new ExportFormatCompatibility (_("CD"))); c_ptr->add_sample_rate (ExportFormatBase::SR_44_1); c_ptr->add_format_id (ExportFormatBase::F_WAV); @@ -59,7 +59,7 @@ ExportFormatManager::init_compatibilities () c_ptr->add_sample_format (ExportFormatBase::SF_16); c_ptr->add_endianness (ExportFormatBase::E_FileDefault); add_compatibility (c_ptr); - + c_ptr.reset (new ExportFormatCompatibility (_("DVD-A"))); c_ptr->add_sample_rate (ExportFormatBase::SR_44_1); c_ptr->add_sample_rate (ExportFormatBase::SR_48); @@ -73,7 +73,7 @@ ExportFormatManager::init_compatibilities () c_ptr->add_sample_format (ExportFormatBase::SF_24); c_ptr->add_endianness (ExportFormatBase::E_FileDefault); add_compatibility (c_ptr); - + c_ptr.reset (new ExportFormatCompatibility (_("iPod"))); c_ptr->add_sample_rate (ExportFormatBase::SR_44_1); c_ptr->add_sample_rate (ExportFormatBase::SR_48); @@ -84,7 +84,7 @@ ExportFormatManager::init_compatibilities () c_ptr->add_sample_format (ExportFormatBase::SF_24); c_ptr->add_endianness (ExportFormatBase::E_FileDefault); add_compatibility (c_ptr); - + c_ptr.reset (new ExportFormatCompatibility (_("Something else"))); c_ptr->add_sample_rate (ExportFormatBase::SR_44_1); c_ptr->add_sample_rate (ExportFormatBase::SR_48); @@ -112,10 +112,10 @@ ExportFormatManager::init_qualities () void ExportFormatManager::init_formats () -{ +{ FormatPtr f_ptr; ExportFormatLinear * fl_ptr; - + f_ptr.reset (fl_ptr = new ExportFormatLinear ("AIFF", ExportFormatBase::F_AIFF)); fl_ptr->add_sample_format (ExportFormatBase::SF_U8); fl_ptr->add_sample_format (ExportFormatBase::SF_8); @@ -127,7 +127,7 @@ ExportFormatManager::init_formats () fl_ptr->set_default_sample_format (ExportFormatBase::SF_16); fl_ptr->set_extension ("aiff"); add_format (f_ptr); - + f_ptr.reset (fl_ptr = new ExportFormatLinear ("AU", ExportFormatBase::F_AU)); fl_ptr->add_sample_format (ExportFormatBase::SF_8); fl_ptr->add_sample_format (ExportFormatBase::SF_16); @@ -138,10 +138,10 @@ ExportFormatManager::init_formats () fl_ptr->set_default_sample_format (ExportFormatBase::SF_16); fl_ptr->set_extension ("au"); add_format (f_ptr); - + f_ptr.reset (new ExportFormatBWF ()); add_format (f_ptr); - + f_ptr.reset (fl_ptr = new ExportFormatLinear ("IRCAM", ExportFormatBase::F_IRCAM)); fl_ptr->add_sample_format (ExportFormatBase::SF_16); fl_ptr->add_sample_format (ExportFormatBase::SF_24); @@ -150,7 +150,7 @@ ExportFormatManager::init_formats () fl_ptr->set_default_sample_format (ExportFormatBase::SF_24); fl_ptr->set_extension ("sf"); add_format (f_ptr); - + f_ptr.reset (fl_ptr = new ExportFormatLinear ("WAV", ExportFormatBase::F_WAV)); fl_ptr->add_sample_format (ExportFormatBase::SF_U8); fl_ptr->add_sample_format (ExportFormatBase::SF_16); @@ -161,7 +161,7 @@ ExportFormatManager::init_formats () fl_ptr->set_default_sample_format (ExportFormatBase::SF_16); fl_ptr->set_extension ("wav"); add_format (f_ptr); - + f_ptr.reset (fl_ptr = new ExportFormatLinear ("W64", ExportFormatBase::F_W64)); fl_ptr->add_sample_format (ExportFormatBase::SF_U8); fl_ptr->add_sample_format (ExportFormatBase::SF_16); @@ -172,7 +172,7 @@ ExportFormatManager::init_formats () fl_ptr->set_default_sample_format (ExportFormatBase::SF_Double); fl_ptr->set_extension ("w64"); add_format (f_ptr); - + f_ptr.reset (fl_ptr = new ExportFormatLinear ("RAW", ExportFormatBase::F_RAW)); fl_ptr->add_sample_format (ExportFormatBase::SF_U8); fl_ptr->add_sample_format (ExportFormatBase::SF_8); @@ -184,12 +184,12 @@ ExportFormatManager::init_formats () fl_ptr->set_default_sample_format (ExportFormatBase::SF_Float); fl_ptr->set_extension ("raw"); add_format (f_ptr); - + try { f_ptr.reset (new ExportFormatOggVorbis ()); add_format (f_ptr); } catch (ExportFormatIncompatible & e) {} - + try { f_ptr.reset (new ExportFormatFLAC ()); add_format (f_ptr); @@ -201,9 +201,9 @@ ExportFormatManager::init_sample_rates () { add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_22_05, "22,05 kHz"))); add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_44_1, "44,1 kHz"))); - add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_48, "48 kHz"))); - add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_88_2, "88,2 kHz"))); - add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_96, "96 kHz"))); + add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_48, "48 kHz"))); + add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_88_2, "88,2 kHz"))); + add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_96, "96 kHz"))); add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_192, "192 kHz"))); } @@ -227,11 +227,11 @@ ExportFormatManager::add_format (FormatPtr ptr) formats.push_back (ptr); ptr->SelectChanged.connect (sigc::bind (sigc::mem_fun (*this, &ExportFormatManager::change_format_selection), WeakFormatPtr (ptr))); universal_set = universal_set->get_union (*ptr); - + /* Encoding options */ - + boost::shared_ptr<HasSampleFormat> hsf; - + if (hsf = boost::dynamic_pointer_cast<HasSampleFormat> (ptr)) { hsf->SampleFormatSelectChanged.connect (sigc::mem_fun (*this, &ExportFormatManager::change_sample_format_selection)); hsf->DitherTypeSelectChanged.connect (sigc::mem_fun (*this, &ExportFormatManager::change_dither_type_selection)); @@ -308,7 +308,7 @@ ExportFormatManager::change_compatibility_selection (bool select, WeakCompatPtr } CompatPtr ptr = compat.lock(); - + if (ptr && select) { select_compatibility (ptr); } @@ -322,11 +322,11 @@ void ExportFormatManager::change_quality_selection (bool select, WeakQualityPtr const & quality) { QualityPtr ptr = quality.lock (); - + if (!ptr) { return; } - + if (select) { select_quality (ptr); } else if (ptr->quality == current_selection->quality()) { @@ -339,11 +339,11 @@ void ExportFormatManager::change_format_selection (bool select, WeakFormatPtr const & format) { FormatPtr ptr = format.lock(); - + if (!ptr) { return; } - + if (select) { select_format (ptr); } else if (ptr->get_format_id() == current_selection->format_id()) { @@ -356,11 +356,11 @@ void ExportFormatManager::change_sample_rate_selection (bool select, WeakSampleRatePtr const & rate) { SampleRatePtr ptr = rate.lock(); - + if (!ptr) { return; } - + if (select) { select_sample_rate (ptr); } else if (ptr->rate == current_selection->sample_rate()) { @@ -373,11 +373,11 @@ void ExportFormatManager::change_sample_format_selection (bool select, WeakSampleFormatPtr const & format) { SampleFormatPtr ptr = format.lock(); - + if (!ptr) { return; } - + if (select) { select_sample_format (ptr); } else if (ptr->format == current_selection->sample_format()) { @@ -390,11 +390,11 @@ void ExportFormatManager::change_dither_type_selection (bool select, WeakDitherTypePtr const & type) { DitherTypePtr ptr = type.lock(); - + if (!ptr) { return; } - + if (select) { select_dither_type (ptr); } else if (ptr->type == current_selection->dither_type()) { @@ -407,28 +407,28 @@ void ExportFormatManager::select_compatibility (WeakCompatPtr const & /*compat*/) { /* Calculate compatibility intersection for the selection */ - + FormatBasePtr compat_intersect = get_compatibility_intersection (); - + /* Unselect incompatible items */ - + boost::shared_ptr<ExportFormatBase> select_intersect; - + select_intersect = compat_intersect->get_intersection (*current_selection); if (select_intersect->qualities_empty()) { select_quality (QualityPtr()); } - + select_intersect = compat_intersect->get_intersection (*current_selection); if (select_intersect->formats_empty()) { select_format (FormatPtr()); } - + select_intersect = compat_intersect->get_intersection (*current_selection); if (select_intersect->sample_rates_empty()) { select_sample_rate (SampleRatePtr()); } - + select_intersect = compat_intersect->get_intersection (*current_selection); if (select_intersect->sample_formats_empty()) { select_sample_format (SampleFormatPtr()); @@ -445,29 +445,29 @@ ExportFormatManager::select_quality (QualityPtr const & quality) if (quality) { current_selection->set_quality (quality->quality); - + /* Deselect format if it is incompatible */ - + FormatPtr format = get_selected_format(); if (format && !format->has_quality (quality->quality)) { format->set_selected (false); } - + } else { current_selection->set_quality (ExportFormatBase::Q_None); - + QualityPtr current_quality = get_selected_quality(); if (current_quality) { current_quality->set_selected (false); } - + /* Note: * A quality is never explicitly deselected without also deselecting the format * so we don't need to deselect the format here. * doing so causes extra complications */ } - + if (do_selection_changed) { selection_changed (); } @@ -484,9 +484,9 @@ ExportFormatManager::select_format (FormatPtr const & format) current_selection->set_format (format); if (format) { - + /* Slect right quality for format */ - + ExportFormatBase::Quality quality = format->get_quality(); for (QualityList::iterator it = qualities.begin (); it != qualities.end (); ++it) { if ((*it)->quality == quality) { @@ -495,16 +495,16 @@ ExportFormatManager::select_format (FormatPtr const & format) (*it)->set_selected (false); } } - + /* Handle sample formats */ - + ExportFormatBase::SampleFormat format_to_select; if (format->sample_format_is_compatible (current_selection->sample_format())) { format_to_select = current_selection->sample_format(); } else { format_to_select = format->default_sample_format(); } - + boost::shared_ptr<HasSampleFormat> hsf; if ((hsf = boost::dynamic_pointer_cast<HasSampleFormat> (format))) { SampleFormatList sample_formats = hsf->get_sample_formats(); @@ -516,16 +516,16 @@ ExportFormatManager::select_format (FormatPtr const & format) } } } - + current_selection->set_sample_format (format_to_select); - + } else { FormatPtr current_format = get_selected_format (); if (current_format) { current_format->set_selected (false); } } - + if (do_selection_changed) { selection_changed (); } @@ -544,13 +544,13 @@ ExportFormatManager::select_sample_rate (SampleRatePtr const & rate) current_selection->set_sample_rate (rate->rate); } else { current_selection->set_sample_rate (ExportFormatBase::SR_None); - + SampleRatePtr current_rate = get_selected_sample_rate(); if (current_rate) { current_rate->set_selected (false); } } - + if (do_selection_changed) { selection_changed (); } @@ -569,13 +569,13 @@ ExportFormatManager::select_sample_format (SampleFormatPtr const & format) current_selection->set_sample_format (format->format); } else { current_selection->set_sample_format (ExportFormatBase::SF_None); - + SampleFormatPtr current_format = get_selected_sample_format(); if (current_format) { current_format->set_selected (false); } } - + if (do_selection_changed) { selection_changed (); } @@ -595,7 +595,7 @@ ExportFormatManager::select_dither_type (DitherTypePtr const & type) } else { current_selection->set_dither_type (ExportFormatBase::D_None); } - + if (do_selection_changed) { selection_changed (); } @@ -605,46 +605,46 @@ void ExportFormatManager::selection_changed () { /* Get a list of incompatible compatibility selections */ - + CompatList incompatibles; for (CompatList::iterator it = compatibilities.begin(); it != compatibilities.end(); ++it) { if (!current_selection->is_compatible_with (**it)) { incompatibles.push_back (*it); } } - + /* Deselect them */ - + for (CompatList::iterator it = incompatibles.begin(); it != incompatibles.end(); ++it) { (*it)->set_selected (false); } - + /* Mark compatibility for everything necessary */ - + std::set<ExportFormatBase::Quality> compatible_qualities; FormatBasePtr compat_intersect = get_compatibility_intersection (); ExportFormatCompatibility global_compat (*compat_intersect); - + for (FormatList::iterator it = formats.begin(); it != formats.end(); ++it) { if ((*it)->set_compatibility_state (global_compat)) { compatible_qualities.insert ((*it)->get_quality()); } } - + bool any_quality_compatible = true; for (QualityList::iterator it = qualities.begin(); it != qualities.end(); ++it) { if (compatible_qualities.find((*it)->quality) != compatible_qualities.end()) { (*it)->set_compatible (true); - + } else { (*it)->set_compatible (false); - + if ((*it)->quality != ExportFormatBase::Q_Any) { any_quality_compatible = false; } } } - + if (any_quality_compatible) { for (QualityList::iterator it = qualities.begin(); it != qualities.end(); ++it) { if ((*it)->quality == ExportFormatBase::Q_Any) { @@ -653,7 +653,7 @@ ExportFormatManager::selection_changed () } } } - + for (SampleRateList::iterator it = sample_rates.begin(); it != sample_rates.end(); ++it) { if (compat_intersect->has_sample_rate ((*it)->rate)) { (*it)->set_compatible (true); @@ -661,10 +661,10 @@ ExportFormatManager::selection_changed () (*it)->set_compatible (false); } } - + boost::shared_ptr<HasSampleFormat> hsf; if (hsf = boost::dynamic_pointer_cast<HasSampleFormat> (get_selected_format())) { - + SampleFormatList sf_list = hsf->get_sample_formats(); for (SampleFormatList::iterator it = sf_list.begin(); it != sf_list.end(); ++it) { if (compat_intersect->has_sample_format ((*it)->format)) { @@ -673,15 +673,15 @@ ExportFormatManager::selection_changed () (*it)->set_compatible (false); } } - + } - + /* Signal completeness */ - + CompleteChanged (current_selection->is_complete()); - + /* Reset pending state */ - + pending_selection_change = false; } @@ -693,7 +693,7 @@ ExportFormatManager::get_selected_quality () return *it; } } - + return QualityPtr(); } @@ -707,7 +707,7 @@ ExportFormatManager::get_selected_format () return *it; } } - + return format; } @@ -719,7 +719,7 @@ ExportFormatManager::get_selected_sample_rate () return *it; } } - + return SampleRatePtr(); } @@ -727,7 +727,7 @@ ExportFormatManager::SampleFormatPtr ExportFormatManager::get_selected_sample_format () { boost::shared_ptr<HasSampleFormat> hsf; - + if (hsf = boost::dynamic_pointer_cast<HasSampleFormat> (get_selected_format())) { return hsf->get_selected_sample_format (); } else { @@ -740,13 +740,13 @@ ExportFormatManager::FormatBasePtr ExportFormatManager::get_compatibility_intersection () { FormatBasePtr compat_intersect = universal_set; - + for (CompatList::iterator it = compatibilities.begin(); it != compatibilities.end(); ++it) { if ((*it)->selected ()) { compat_intersect = compat_intersect->get_intersection (**it); } } - + return compat_intersect; } diff --git a/libs/ardour/export_format_specification.cc b/libs/ardour/export_format_specification.cc index ab05aa4a64..60a7732b58 100644 --- a/libs/ardour/export_format_specification.cc +++ b/libs/ardour/export_format_specification.cc @@ -45,29 +45,29 @@ ExportFormatSpecification::Time::operator= (AnyTime const & other) type = other.type; smpte = other.smpte; bbt = other.bbt; - + if (type == Frames) { frames = other.frames; } else { seconds = other.seconds; } - + return *this; } nframes_t ExportFormatSpecification::Time::get_frames (nframes_t target_rate) const -{ +{ //TODO position nframes_t duration = session.convert_to_frames_at (0, *this); - + return ((double) target_rate / session.frame_rate()) * duration + 0.5; } XMLNode & ExportFormatSpecification::Time::get_state () { - + XMLNode * node = new XMLNode ("Duration"); node->add_property ("format", enum_2_string (type)); @@ -91,7 +91,7 @@ ExportFormatSpecification::Time::get_state () node->add_property ("seconds", to_string (seconds, std::dec)); break; } - + return *node; } @@ -99,61 +99,61 @@ int ExportFormatSpecification::Time::set_state (const XMLNode & node) { XMLProperty const * prop; - + prop = node.property ("format"); - + if (!prop) { return -1; } - + type = (Type) string_2_enum (prop->value(), Type); - + switch (type) { case SMPTE: if ((prop = node.property ("hours"))) { smpte.hours = atoi (prop->value()); } - + if ((prop = node.property ("minutes"))) { smpte.minutes = atoi (prop->value()); } - + if ((prop = node.property ("seconds"))) { smpte.seconds = atoi (prop->value()); } - + if ((prop = node.property ("frames"))) { smpte.frames = atoi (prop->value()); } - + break; - + case BBT: if ((prop = node.property ("bars"))) { bbt.bars = atoi (prop->value()); } - + if ((prop = node.property ("beats"))) { bbt.beats = atoi (prop->value()); } - + if ((prop = node.property ("ticks"))) { bbt.ticks = atoi (prop->value()); } - + break; - + case Frames: if ((prop = node.property ("frames"))) { std::istringstream iss (prop->value()); iss >> frames; } - + break; - + case Seconds: if ((prop = node.property ("seconds"))) { seconds = atof (prop->value()); } - + break; } @@ -162,7 +162,7 @@ ExportFormatSpecification::Time::set_state (const XMLNode & node) ExportFormatSpecification::ExportFormatSpecification (Session & s) : session (s) - + , has_sample_format (false) , supports_tagging (false) , _has_broadcast_info (false) @@ -170,12 +170,12 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s) , _dither_type (D_None) , _src_quality (SRC_SincBest) , _tag (true) - + , _trim_beginning (false) , _silence_beginning (s) , _trim_end (false) , _silence_end (s) - + , _normalize (false) , _normalize_target (1.0) { @@ -207,7 +207,7 @@ ExportFormatSpecification::ExportFormatSpecification (ExportFormatSpecification _format_name = other._format_name; has_sample_format = other.has_sample_format; - + supports_tagging = other.supports_tagging; _has_broadcast_info = other._has_broadcast_info; _channel_limit = other._channel_limit; @@ -218,16 +218,16 @@ ExportFormatSpecification::ExportFormatSpecification (ExportFormatSpecification set_sample_format (other.sample_format()); set_sample_rate (other.sample_rate()); set_quality (other.quality()); - + set_dither_type (other.dither_type()); set_src_quality (other.src_quality()); set_trim_beginning (other.trim_beginning()); set_trim_end (other.trim_end()); set_normalize (other.normalize()); set_normalize_target (other.normalize_target()); - + set_tag (other.tag()); - + set_silence_beginning (other.silence_beginning_time()); set_silence_end (other.silence_end_time()); } @@ -241,10 +241,10 @@ ExportFormatSpecification::get_state () { XMLNode * node; XMLNode * root = new XMLNode ("ExportFormatSpecification"); - + root->add_property ("name", _name); root->add_property ("id", _id.to_s()); - + node = root->add_child ("Encoding"); node->add_property ("id", enum_2_string (format_id())); node->add_property ("type", enum_2_string (type())); @@ -252,45 +252,45 @@ ExportFormatSpecification::get_state () node->add_property ("name", _format_name); node->add_property ("has-sample-format", has_sample_format ? "true" : "false"); node->add_property ("channel-limit", to_string (_channel_limit, std::dec)); - + node = root->add_child ("SampleRate"); node->add_property ("rate", to_string (sample_rate(), std::dec)); - + node = root->add_child ("SRCQuality"); node->add_property ("quality", enum_2_string (src_quality())); - + XMLNode * enc_opts = root->add_child ("EncodingOptions"); - + add_option (enc_opts, "sample-format", enum_2_string (sample_format())); add_option (enc_opts, "dithering", enum_2_string (dither_type())); add_option (enc_opts, "tag-metadata", _tag ? "true" : "false"); add_option (enc_opts, "tag-support", supports_tagging ? "true" : "false"); add_option (enc_opts, "broadcast-info", _has_broadcast_info ? "true" : "false"); - + XMLNode * processing = root->add_child ("Processing"); - + node = processing->add_child ("Normalize"); node->add_property ("enabled", normalize() ? "true" : "false"); node->add_property ("target", to_string (normalize_target(), std::dec)); - + XMLNode * silence = processing->add_child ("Silence"); XMLNode * start = silence->add_child ("Start"); XMLNode * end = silence->add_child ("End"); - + node = start->add_child ("Trim"); node->add_property ("enabled", trim_beginning() ? "true" : "false"); - + node = start->add_child ("Add"); node->add_property ("enabled", silence_beginning() > 0 ? "true" : "false"); node->add_child_nocopy (_silence_beginning.get_state()); - + node = end->add_child ("Trim"); node->add_property ("enabled", trim_end() ? "true" : "false"); - + node = end->add_child ("Add"); node->add_property ("enabled", silence_end() > 0 ? "true" : "false"); node->add_child_nocopy (_silence_end.get_state()); - + return *root; } @@ -300,57 +300,57 @@ ExportFormatSpecification::set_state (const XMLNode & root) XMLProperty const * prop; XMLNode const * child; string value; - + if ((prop = root.property ("name"))) { _name = prop->value(); } - + if ((prop = root.property ("id"))) { _id = prop->value(); } - + /* Encoding and SRC */ - + if ((child = root.child ("Encoding"))) { if ((prop = child->property ("id"))) { set_format_id ((FormatId) string_2_enum (prop->value(), FormatId)); } - + if ((prop = child->property ("type"))) { set_type ((Type) string_2_enum (prop->value(), Type)); } - + if ((prop = child->property ("extension"))) { set_extension (prop->value()); } - + if ((prop = child->property ("name"))) { _format_name = prop->value(); } - + if ((prop = child->property ("has-sample-format"))) { has_sample_format = !prop->value().compare ("true"); } - + if ((prop = child->property ("channel-limit"))) { _channel_limit = atoi (prop->value()); } } - + if ((child = root.child ("SampleRate"))) { if ((prop = child->property ("rate"))) { set_sample_rate ( (SampleRate) string_2_enum (prop->value(), SampleRate)); } } - + if ((child = root.child ("SRCQuality"))) { if ((prop = child->property ("quality"))) { _src_quality = (SRCQuality) string_2_enum (prop->value(), SRCQuality); } } - + /* Encoding options */ - + if ((child = root.child ("EncodingOptions"))) { set_sample_format ((SampleFormat) string_2_enum (get_option (child, "sample-format"), SampleFormat)); set_dither_type ((DitherType) string_2_enum (get_option (child, "dithering"), DitherType)); @@ -358,37 +358,37 @@ ExportFormatSpecification::set_state (const XMLNode & root) supports_tagging = (!(get_option (child, "tag-support").compare ("true"))); _has_broadcast_info = (!(get_option (child, "broadcast-info").compare ("true"))); } - + /* Processing */ - + XMLNode const * proc = root.child ("Processing"); if (!proc) { std::cerr << X_("Could not load processing for export format") << std::endl; return -1; } - + if ((child = proc->child ("Normalize"))) { if ((prop = child->property ("enabled"))) { _normalize = (!prop->value().compare ("true")); } - + if ((prop = child->property ("target"))) { _normalize_target = atof (prop->value()); } } - + XMLNode const * silence = proc->child ("Silence"); if (!silence) { std::cerr << X_("Could not load silence for export format") << std::endl; return -1; } - + XMLNode const * start = silence->child ("Start"); XMLNode const * end = silence->child ("End"); if (!start || !end) { std::cerr << X_("Could not load end or start silence for export format") << std::endl; return -1; } - + /* Silence start */ - + if ((child = start->child ("Trim"))) { if ((prop = child->property ("enabled"))) { _trim_beginning = (!prop->value().compare ("true")); } } - + if ((child = start->child ("Add"))) { if ((prop = child->property ("enabled"))) { if (!prop->value().compare ("true")) { @@ -400,15 +400,15 @@ ExportFormatSpecification::set_state (const XMLNode & root) } } } - + /* Silence end */ - + if ((child = end->child ("Trim"))) { if ((prop = child->property ("enabled"))) { _trim_end = (!prop->value().compare ("true")); } } - + if ((child = end->child ("Add"))) { if ((prop = child->property ("enabled"))) { if (!prop->value().compare ("true")) { @@ -420,7 +420,7 @@ ExportFormatSpecification::set_state (const XMLNode & root) } } } - + return 0; } @@ -428,27 +428,27 @@ bool ExportFormatSpecification::is_compatible_with (ExportFormatCompatibility const & compatibility) const { boost::shared_ptr<ExportFormatBase> intersection = get_intersection (compatibility); - + if (intersection->formats_empty() && format_id() != 0) { return false; } - + if (intersection->endiannesses_empty() && endianness() != E_FileDefault) { return false; } - + if (intersection->sample_rates_empty() && sample_rate() != SR_None) { return false; } - + if (intersection->sample_formats_empty() && sample_format() != SF_None) { return false; } - + if (intersection->qualities_empty() && quality() != Q_None) { return false; } - + return true; } @@ -458,15 +458,15 @@ ExportFormatSpecification::is_complete () const if (type() == T_None) { return false; } - + if (!format_id()) { return false; } - + if (!sample_rate()) { return false; } - + if (has_sample_format) { if (sample_format() == SF_None) { return false; @@ -483,22 +483,22 @@ ExportFormatSpecification::set_format (boost::shared_ptr<ExportFormat> format) set_format_id (format->get_format_id ()); set_type (format->get_type()); set_extension (format->extension()); - + if (format->get_explicit_sample_format()) { set_sample_format (format->get_explicit_sample_format()); } - + if (format->has_sample_format()) { has_sample_format = true; } - + if (format->has_broadcast_info()) { _has_broadcast_info = true; } - + supports_tagging = format->supports_tagging (); _channel_limit = format->get_channel_limit(); - + _format_name = format->name(); } else { set_format_id (F_None); @@ -516,13 +516,13 @@ Glib::ustring ExportFormatSpecification::description () { Glib::ustring desc; - + desc = _name + ": "; - + if (_normalize) { desc += _("normalize, "); } - + if (_trim_beginning && _trim_end) { desc += _("trim, "); } else if (_trim_beginning) { @@ -530,13 +530,13 @@ ExportFormatSpecification::description () } else if (_trim_end) { desc += "trim end, "; } - + desc += _format_name + ", "; - + if (has_sample_format) { desc += HasSampleFormat::get_sample_format_name (sample_format()) + ", "; } - + switch (sample_rate()) { case SR_22_05: desc += "22,5 kHz"; @@ -559,7 +559,7 @@ ExportFormatSpecification::description () case SR_None: break; } - + return desc; } @@ -575,7 +575,7 @@ std::string ExportFormatSpecification::get_option (XMLNode const * node, std::string const & name) { XMLNodeList list (node->children ("Option")); - + for (XMLNodeList::iterator it = list.begin(); it != list.end(); ++it) { XMLProperty * prop = (*it)->property ("name"); if (prop && !name.compare (prop->value())) { @@ -585,9 +585,9 @@ ExportFormatSpecification::get_option (XMLNode const * node, std::string const & } } } - + std::cerr << "Could not load encoding option \"" << name << "\" for export format" << std::endl; - + return ""; } diff --git a/libs/ardour/export_formats.cc b/libs/ardour/export_formats.cc index a3fa389e8c..362076876e 100644 --- a/libs/ardour/export_formats.cc +++ b/libs/ardour/export_formats.cc @@ -45,7 +45,7 @@ HasSampleFormat::HasSampleFormat (ExportFormatBase::SampleFormatSet & sample_for _sample_formats (sample_formats) { /* Dither Types */ - + add_dither_type (ExportFormatBase::D_Shaped, _("Shaped Noise")); add_dither_type (ExportFormatBase::D_Tri, _("Triangular")); add_dither_type (ExportFormatBase::D_Rect, _("Rectangular")); @@ -56,7 +56,7 @@ void HasSampleFormat::add_sample_format (ExportFormatBase::SampleFormat format) { _sample_formats.insert (format); - + SampleFormatPtr ptr (new SampleFormatState (format, get_sample_format_name (format))); sample_format_states.push_back (ptr); ptr->SelectChanged.connect (sigc::bind (SampleFormatSelectChanged.make_slot(), WeakSampleFormatPtr (ptr))); @@ -82,7 +82,7 @@ HasSampleFormat::get_selected_sample_format () return *it; } } - + return SampleFormatPtr(); } @@ -94,7 +94,7 @@ HasSampleFormat::get_selected_dither_type () return *it; } } - + return DitherTypePtr(); } @@ -105,7 +105,7 @@ HasSampleFormat::update_sample_format_selection (bool) if (!format) { return; } - + if (format->format == ExportFormatBase::SF_24 || format->format == ExportFormatBase::SF_32 || format->format == ExportFormatBase::SF_Float || @@ -132,13 +132,13 @@ HasSampleFormat::update_dither_type_selection (bool) if (!type) { return; } - + if (!type->compatible()) { SampleFormatPtr format = get_selected_sample_format(); if (format) { format->set_selected (false); } - + for (DitherTypeList::iterator it = dither_type_states.begin(); it != dither_type_states.end(); ++it) { (*it)->set_compatible (true); } @@ -179,16 +179,16 @@ ExportFormatLinear::ExportFormatLinear (Glib::ustring name, FormatId format_id) { set_name (name); set_format_id (format_id); - + add_sample_rate (SR_22_05); add_sample_rate (SR_44_1); add_sample_rate (SR_48); add_sample_rate (SR_88_2); add_sample_rate (SR_96); add_sample_rate (SR_192); - + add_endianness (E_FileDefault); - + set_quality (Q_LosslessLinear); } @@ -202,29 +202,29 @@ ExportFormatLinear::set_compatibility_state (ExportFormatCompatibility const & c if (!compatibility.has_quality (Q_LosslessLinear)) { compatible = false; } - + if (!compatibility.has_format (get_format_id())) { compatible = false; } boost::shared_ptr<ExportFormatBase> intersection = get_intersection (compatibility); - + if (intersection->endiannesses_empty()) { compatible = false; } - + if (intersection->sample_rates_empty()) { compatible = false; } - + if (intersection->sample_formats_empty()) { compatible = false; } - + set_compatible (compatible); /* Sample Formats */ - + for (SampleFormatList::iterator it = sample_format_states.begin(); it != sample_format_states.end(); ++it) { (*it)->set_compatible (compatibility.has_sample_format ((*it)->format)); } @@ -237,7 +237,7 @@ ExportFormatLinear::set_compatibility_state (ExportFormatCompatibility const & c ExportFormatOggVorbis::ExportFormatOggVorbis () { /* Check system compatibility */ - + SF_INFO sf_info; sf_info.channels = 2; sf_info.samplerate = SR_44_1; @@ -245,20 +245,20 @@ ExportFormatOggVorbis::ExportFormatOggVorbis () if (sf_format_check (&sf_info) != SF_TRUE) { throw ExportFormatIncompatible(); } - + set_name ("Ogg Vorbis"); set_format_id (F_Ogg); sample_formats.insert (SF_Vorbis); - + add_sample_rate (SR_22_05); add_sample_rate (SR_44_1); add_sample_rate (SR_48); add_sample_rate (SR_88_2); add_sample_rate (SR_96); add_sample_rate (SR_192); - + add_endianness (E_FileDefault); - + set_extension ("ogg"); set_quality (Q_LossyCompression); } @@ -277,7 +277,7 @@ ExportFormatFLAC::ExportFormatFLAC () : HasSampleFormat (sample_formats) { /* Check system compatibility */ - + SF_INFO sf_info; sf_info.channels = 2; sf_info.samplerate = SR_44_1; @@ -285,23 +285,23 @@ ExportFormatFLAC::ExportFormatFLAC () : if (sf_format_check (&sf_info) != SF_TRUE) { throw ExportFormatIncompatible(); } - + set_name ("FLAC"); set_format_id (F_FLAC); - + add_sample_rate (SR_22_05); add_sample_rate (SR_44_1); add_sample_rate (SR_48); add_sample_rate (SR_88_2); add_sample_rate (SR_96); add_sample_rate (SR_192); - + add_sample_format (SF_8); add_sample_format (SF_16); add_sample_format (SF_24); - + add_endianness (E_FileDefault); - + set_extension ("flac"); set_quality (Q_LosslessCompression); } @@ -321,7 +321,7 @@ ExportFormatBWF::ExportFormatBWF () : { set_name ("BWF"); set_format_id (F_WAV); - + add_sample_rate (SR_22_05); add_sample_rate (SR_44_1); add_sample_rate (SR_48); @@ -335,9 +335,9 @@ ExportFormatBWF::ExportFormatBWF () : add_sample_format (SF_32); add_sample_format (SF_Float); add_sample_format (SF_Double); - + add_endianness (E_FileDefault); - + set_extension ("wav"); set_quality (Q_LosslessLinear); } diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc index 59da803ac9..0c7a2e8d48 100644 --- a/libs/ardour/export_handler.cc +++ b/libs/ardour/export_handler.cc @@ -116,7 +116,7 @@ ExportHandler::~ExportHandler () sys::remove (sys::path (*it)); } } - + channel_config_connection.disconnect(); files_written_connection.disconnect(); } @@ -127,7 +127,7 @@ ExportHandler::add_export_config (TimespanPtr timespan, ChannelConfigPtr channel FileSpec spec (channel_config, format, filename); ConfigPair pair (timespan, spec); config_map.insert (pair); - + return true; } @@ -177,7 +177,7 @@ ExportHandler::export_cd_marker_file (TimespanPtr timespan, FormatPtr file_forma { string filepath; string basename = Glib::path_get_basename(filename); - + size_t ext_pos = basename.rfind('.'); if (ext_pos != string::npos) { basename = basename.substr(0, ext_pos); /* strip file extension, if there is one */ @@ -203,18 +203,18 @@ ExportHandler::export_cd_marker_file (TimespanPtr timespan, FormatPtr file_forma default: return; } - + CDMarkerStatus status (filepath, timespan, file_format, filename); if (!status.out) { error << string_compose(_("Editor: cannot open \"%1\" as export file for CD marker file"), filepath) << endmsg; return; } - + (this->*header_func) (status); - + /* Get locations and sort */ - + Locations::LocationList const & locations (session.locations()->list()); Locations::LocationList::const_iterator i; Locations::LocationList temp; @@ -229,7 +229,7 @@ ExportHandler::export_cd_marker_file (TimespanPtr timespan, FormatPtr file_forma // TODO One index marker for whole thing return; } - + LocationSortByStart cmp; temp.sort (cmp); Locations::LocationList::const_iterator nexti; @@ -246,45 +246,45 @@ ExportHandler::export_cd_marker_file (TimespanPtr timespan, FormatPtr file_forma if ((*i)->start() < last_end_time) { if ((*i)->is_mark()) { /* Index within track */ - + status.index_position = (*i)->start() - timespan->get_start(); (this->*index_func) (status); } - + continue; } /* A track, defined by a cd range marker or a cd location marker outside of a cd range */ - + status.track_position = last_end_time - timespan->get_start(); status.track_start_frame = (*i)->start() - timespan->get_start(); // everything before this is the pregap status.track_duration = 0; - + if ((*i)->is_mark()) { // a mark track location needs to look ahead to the next marker's start to determine length nexti = i; ++nexti; - + if (nexti != temp.end()) { status.track_duration = (*nexti)->start() - last_end_time; - + last_start_time = (*i)->start(); last_end_time = (*nexti)->start(); } else { // this was the last marker, use timespan end status.track_duration = timespan->get_end() - last_end_time; - + last_start_time = (*i)->start(); last_end_time = timespan->get_end(); } } else { // range status.track_duration = (*i)->end() - last_end_time; - + last_start_time = (*i)->start(); last_end_time = (*i)->end(); } - + (this->*track_func) (status); } } @@ -349,31 +349,31 @@ ExportHandler::write_track_info_cue (CDMarkerStatus & status) snprintf (buf, sizeof(buf), " TRACK %02d AUDIO", status.track_number); status.out << buf << endl; - + status.out << " FLAGS" ; if (status.marker->cd_info.find("scms") != status.marker->cd_info.end()) { status.out << " SCMS "; } else { status.out << " DCP "; } - + if (status.marker->cd_info.find("preemph") != status.marker->cd_info.end()) { status.out << " PRE"; } status.out << endl; - + if (status.marker->cd_info.find("isrc") != status.marker->cd_info.end()) { status.out << " ISRC " << status.marker->cd_info["isrc"] << endl; - + } if (status.marker->name() != "") { status.out << " TITLE \"" << status.marker->name() << "\"" << endl; } - + if (status.marker->cd_info.find("performer") != status.marker->cd_info.end()) { status.out << " PERFORMER \"" << status.marker->cd_info["performer"] << "\"" << endl; } - + if (status.marker->cd_info.find("string_composer") != status.marker->cd_info.end()) { status.out << " SONGWRITER \"" << status.marker->cd_info["string_composer"] << "\"" << endl; } @@ -382,10 +382,10 @@ ExportHandler::write_track_info_cue (CDMarkerStatus & status) frames_to_cd_frames_string (buf, status.track_position); status.out << " INDEX 00" << buf << endl; } - + frames_to_cd_frames_string (buf, status.track_start_frame); status.out << " INDEX 01" << buf << endl; - + status.index_number = 2; status.track_number++; } @@ -396,22 +396,22 @@ ExportHandler::write_track_info_toc (CDMarkerStatus & status) gchar buf[18]; status.out << endl << "TRACK AUDIO" << endl; - + if (status.marker->cd_info.find("scms") != status.marker->cd_info.end()) { status.out << "NO "; } status.out << "COPY" << endl; - + if (status.marker->cd_info.find("preemph") != status.marker->cd_info.end()) { status.out << "PRE_EMPHASIS" << endl; } else { status.out << "NO PRE_EMPHASIS" << endl; } - + if (status.marker->cd_info.find("isrc") != status.marker->cd_info.end()) { status.out << "ISRC \"" << status.marker->cd_info["isrc"] << "\"" << endl; } - + status.out << "CD_TEXT {" << endl << " LANGUAGE 0 {" << endl << " TITLE \"" << status.marker->name() << "\"" << endl; if (status.marker->cd_info.find("performer") != status.marker->cd_info.end()) { status.out << " PERFORMER \"" << status.marker->cd_info["performer"] << "\"" << endl; @@ -419,23 +419,23 @@ ExportHandler::write_track_info_toc (CDMarkerStatus & status) if (status.marker->cd_info.find("string_composer") != status.marker->cd_info.end()) { status.out << " COMPOSER \"" << status.marker->cd_info["string_composer"] << "\"" << endl; } - - if (status.marker->cd_info.find("isrc") != status.marker->cd_info.end()) { + + if (status.marker->cd_info.find("isrc") != status.marker->cd_info.end()) { status.out << " ISRC \""; status.out << status.marker->cd_info["isrc"].substr(0,2) << "-"; status.out << status.marker->cd_info["isrc"].substr(2,3) << "-"; status.out << status.marker->cd_info["isrc"].substr(5,2) << "-"; status.out << status.marker->cd_info["isrc"].substr(7,5) << "\"" << endl; } - + status.out << " }" << endl << "}" << endl; - + frames_to_cd_frames_string (buf, status.track_position); status.out << "FILE \"" << status.filename << "\" " << buf; - + frames_to_cd_frames_string (buf, status.track_duration); status.out << buf << endl; - + frames_to_cd_frames_string (buf, status.track_start_frame - status.track_position); status.out << "START" << buf << endl; } @@ -449,7 +449,7 @@ ExportHandler::write_index_info_cue (CDMarkerStatus & status) status.out << buf; frames_to_cd_frames_string (buf, status.index_position); status.out << buf << endl; - + cue_indexnum++; } @@ -488,11 +488,11 @@ ExportHandler::start_timespan () } current_timespan = config_map.begin()->first; - + /* Register channel configs with timespan */ - + timespan_bounds = config_map.equal_range (current_timespan); - + for (ConfigMap::iterator it = timespan_bounds.first; it != timespan_bounds.second; ++it) { it->second.channel_config->register_with_timespan (current_timespan); } @@ -507,29 +507,29 @@ void ExportHandler::finish_timespan () { current_timespan->process_connection.disconnect (); - + /* Register formats and filenames to relevant channel configs */ - + export_status->total_formats = 0; export_status->format = 0; - + for (ConfigMap::iterator it = timespan_bounds.first; it != timespan_bounds.second; ++it) { - + export_status->total_formats++; - + /* Setup filename */ - + it->second.filename->set_timespan (current_timespan); it->second.filename->set_channel_config (it->second.channel_config); - + /* Do actual registration */ - + ChannelConfigPtr chan_config = it->second.channel_config; chan_config->register_file_config (it->second.format, it->second.filename); } - + /* Start writing files by doing a manual call to timespan_thread_finished */ - + current_map_it = timespan_bounds.first; timespan_thread_finished (); } @@ -540,44 +540,44 @@ ExportHandler::timespan_thread_finished () channel_config_connection.disconnect(); if (current_map_it != timespan_bounds.second) { - + /* Get next configuration as long as no new export process is started */ - + ChannelConfigPtr cc = current_map_it->second.channel_config; while (!cc->write_files(processor)) { - + ++current_map_it; - + if (current_map_it == timespan_bounds.second) { - + /* reached end of bounds, this call will end up in the else block below */ - + timespan_thread_finished (); return; } - + cc = current_map_it->second.channel_config; } - + channel_config_connection = cc->FilesWritten.connect (sigc::mem_fun (*this, &ExportHandler::timespan_thread_finished)); ++current_map_it; - + } else { /* All files are written from current timespan, reset timespan and start new */ - + /* Unregister configs and remove configs with this timespan */ - + for (ConfigMap::iterator it = timespan_bounds.first; it != timespan_bounds.second;) { it->second.channel_config->unregister_all (); - + ConfigMap::iterator to_erase = it; ++it; config_map.erase (to_erase); } - + /* Start new timespan */ - + start_timespan (); - + } } diff --git a/libs/ardour/export_multiplication.cc b/libs/ardour/export_multiplication.cc index 943ca5a172..a0bc7f830e 100644 --- a/libs/ardour/export_multiplication.cc +++ b/libs/ardour/export_multiplication.cc @@ -9,48 +9,48 @@ ExportProfileManager::register_all_configs () { list<TimespanNodePtr>::iterator tsl_it; // timespan list node iterator for (tsl_it = graph.timespans.begin(); tsl_it != graph.timespans.end(); ++tsl_it) { - list<GraphNode *>::const_iterator cc_it; // channel config node iterator - for (cc_it = (*tsl_it)->get_children().begin(); cc_it != (*tsl_it)->get_children().end(); ++cc_it) { - list<GraphNode *>::const_iterator f_it; // format node iterator - for (f_it = (*cc_it)->get_children().begin(); f_it != (*cc_it)->get_children().end(); ++f_it) { - list<GraphNode *>::const_iterator fn_it; // filename node iterator - for (fn_it = (*f_it)->get_children().begin(); fn_it != (*f_it)->get_children().end(); ++fn_it) { - /* Finally loop through each timespan in the timespan list */ - - TimespanNodePtr ts_node; - if (!(ts_node = boost::dynamic_pointer_cast<TimespanNode> (*tsl_it))) { - throw ExportFailed (X_("Programming error, Invalid pointer cast in ExportProfileManager")); - } - - TimespanListPtr ts_list = ts_node->data()->timespans; - TimespanList::iterator ts_it; - for (ts_it = ts_list->begin(); ts_it != ts_list->end(); ++ts_it) { - - TimespanPtr timespan = *ts_it; - - ChannelConfigNode * cc_node; - if (!(cc_node = dynamic_cast<ChannelConfigNode *> (*cc_it))) { - throw ExportFailed (X_("Programming error, Invalid pointer cast in ExportProfileManager")); - } - ChannelConfigPtr channel_config = cc_node->data()->config; - - FormatNode * f_node; - if (!(f_node = dynamic_cast<FormatNode *> (*f_it))) { - throw ExportFailed (X_("Programming error, Invalid pointer cast in ExportProfileManager")); - } - FormatPtr format = f_node->data()->format; - - FilenameNode * fn_node; - if (!(fn_node = dynamic_cast<FilenameNode *> (*fn_it))) { - throw ExportFailed (X_("Programming error, Invalid pointer cast in ExportProfileManager")); + list<GraphNode *>::const_iterator cc_it; // channel config node iterator + for (cc_it = (*tsl_it)->get_children().begin(); cc_it != (*tsl_it)->get_children().end(); ++cc_it) { + list<GraphNode *>::const_iterator f_it; // format node iterator + for (f_it = (*cc_it)->get_children().begin(); f_it != (*cc_it)->get_children().end(); ++f_it) { + list<GraphNode *>::const_iterator fn_it; // filename node iterator + for (fn_it = (*f_it)->get_children().begin(); fn_it != (*f_it)->get_children().end(); ++fn_it) { + /* Finally loop through each timespan in the timespan list */ + + TimespanNodePtr ts_node; + if (!(ts_node = boost::dynamic_pointer_cast<TimespanNode> (*tsl_it))) { + throw ExportFailed (X_("Programming error, Invalid pointer cast in ExportProfileManager")); + } + + TimespanListPtr ts_list = ts_node->data()->timespans; + TimespanList::iterator ts_it; + for (ts_it = ts_list->begin(); ts_it != ts_list->end(); ++ts_it) { + + TimespanPtr timespan = *ts_it; + + ChannelConfigNode * cc_node; + if (!(cc_node = dynamic_cast<ChannelConfigNode *> (*cc_it))) { + throw ExportFailed (X_("Programming error, Invalid pointer cast in ExportProfileManager")); + } + ChannelConfigPtr channel_config = cc_node->data()->config; + + FormatNode * f_node; + if (!(f_node = dynamic_cast<FormatNode *> (*f_it))) { + throw ExportFailed (X_("Programming error, Invalid pointer cast in ExportProfileManager")); + } + FormatPtr format = f_node->data()->format; + + FilenameNode * fn_node; + if (!(fn_node = dynamic_cast<FilenameNode *> (*fn_it))) { + throw ExportFailed (X_("Programming error, Invalid pointer cast in ExportProfileManager")); + } + FilenamePtr filename = fn_node->data()->filename; + + handler->add_export_config (timespan, channel_config, format, filename); + } + } } - FilenamePtr filename = fn_node->data()->filename; - - handler->add_export_config (timespan, channel_config, format, filename); } - } - } - } } } @@ -61,7 +61,7 @@ ExportProfileManager::create_empty_config () timespan->data()->timespans->push_back (handler->add_timespan()); ChannelConfigNodePtr channel_config = ChannelConfigNode::create (new ChannelConfigState(handler->add_channel_config())); - + FormatNodePtr format; load_formats (); if (!format_list.empty()) { @@ -69,15 +69,15 @@ ExportProfileManager::create_empty_config () } else { format = FormatNode::create (new FormatState (handler->add_format ())); } - + FilenameNodePtr filename = FilenameNode::create (new FilenameState (handler->add_filename())); - + /* Bring everything together */ - + timespan->add_child (channel_config.get(), 0); channel_config->add_child (format.get(), 0); format->add_child (filename.get(), 0); - + graph.timespans.push_back (timespan); graph.channel_configs.push_back (channel_config); graph.formats.push_back (format); @@ -98,7 +98,7 @@ ExportProfileManager::GraphNode::~GraphNode () while (!children.empty()) { remove_child (children.front()); } - + while (!parents.empty()) { parents.front()->remove_child (this); } @@ -130,7 +130,7 @@ ExportProfileManager::GraphNode::add_child (GraphNode * child, GraphNode * left_ } else { children.push_back (child); } - + child->add_parent (this); } @@ -142,7 +142,7 @@ ExportProfileManager::GraphNode::is_ancestor_of (GraphNode const * node) const return true; } } - + return false; } @@ -154,7 +154,7 @@ ExportProfileManager::GraphNode::is_descendant_of (GraphNode const * node) const return true; } } - + return false; } @@ -162,7 +162,7 @@ void ExportProfileManager::GraphNode::select (bool value) { if (_selected == value) { return; } - + _selected = value; SelectChanged (value); } @@ -187,7 +187,7 @@ ExportProfileManager::GraphNode::remove_child (GraphNode * child) break; } } - + child->remove_parent (this); } @@ -199,19 +199,19 @@ ExportProfileManager::split_node (GraphNode * node, float position) split_timespan (ts_node->self_ptr(), position); return; } - + ChannelConfigNode * cc_node; if ((cc_node = dynamic_cast<ChannelConfigNode *> (node))) { split_channel_config (cc_node->self_ptr(), position); return; } - + FormatNode * f_node; if ((f_node = dynamic_cast<FormatNode *> (node))) { split_format (f_node->self_ptr(), position); return; } - + FilenameNode * fn_node; if ((fn_node = dynamic_cast<FilenameNode *> (node))) { split_filename (fn_node->self_ptr(), position); @@ -227,19 +227,19 @@ ExportProfileManager::remove_node (GraphNode * node) remove_timespan (ts_node->self_ptr()); return; } - + ChannelConfigNode * cc_node; if ((cc_node = dynamic_cast<ChannelConfigNode *> (node))) { remove_channel_config (cc_node->self_ptr()); return; } - + FormatNode * f_node; if ((f_node = dynamic_cast<FormatNode *> (node))) { remove_format (f_node->self_ptr()); return; } - + FilenameNode * fn_node; if ((fn_node = dynamic_cast<FilenameNode *> (node))) { remove_filename (fn_node->self_ptr()); @@ -258,7 +258,7 @@ ExportProfileManager::purge_graph () graph.timespans.erase (tmp); } } - + for (list<ChannelConfigNodePtr>::iterator it = graph.channel_configs.begin(); it != graph.channel_configs.end(); ) { list<ChannelConfigNodePtr>::iterator tmp = it; ++it; @@ -267,7 +267,7 @@ ExportProfileManager::purge_graph () graph.channel_configs.erase (tmp); } } - + for (list<FormatNodePtr>::iterator it = graph.formats.begin(); it != graph.formats.end(); ) { list<FormatNodePtr>::iterator tmp = it; ++it; @@ -276,7 +276,7 @@ ExportProfileManager::purge_graph () graph.formats.erase (tmp); } } - + for (list<FilenameNodePtr>::iterator it = graph.filenames.begin(); it != graph.filenames.end(); ) { list<FilenameNodePtr>::iterator tmp = it; ++it; @@ -285,7 +285,7 @@ ExportProfileManager::purge_graph () graph.filenames.erase (tmp); } } - + GraphChanged(); } @@ -300,9 +300,9 @@ ExportProfileManager::insert_after (list<T> & the_list, T const & position, T co return; } } - + std::cerr << "invalid position given to ExportProfileManager::insert_after (aborting)" << std::endl; - + abort(); } @@ -330,12 +330,12 @@ ExportProfileManager::end_of_common_child_range (list<GraphNode *> const & the_l { if ((*beginning)->get_children().size() != 1) { return beginning; } GraphNode * child = (*beginning)->get_children().front(); - + list<GraphNode *>::const_iterator it = beginning; while (it != the_list.end() && (*it)->get_children().size() == 1 && (*it)->get_children().front() == child) { ++it; } - + return --it; } @@ -345,7 +345,7 @@ ExportProfileManager::split_node_at_position (GraphNode * old_node, GraphNode * list<GraphNode *> const & node_parents = old_node->get_parents(); uint32_t split_index = (int) (node_parents.size() * position + 0.5); split_index = std::max ((uint32_t) 1, std::min (split_index, node_parents.size() - 1)); - + list<GraphNode *>::const_iterator it = node_parents.begin(); for (uint32_t index = 1; it != node_parents.end(); ++index) { if (index > split_index) { @@ -362,14 +362,14 @@ void ExportProfileManager::split_timespan (TimespanNodePtr node, float) { TimespanNodePtr new_timespan = duplicate_timespan_node (node); - insert_after (graph.timespans, node, new_timespan); - + insert_after (graph.timespans, node, new_timespan); + /* Note: Since a timespan selector allows all combinations of ranges * there is no reason for a channel configuration to have two parents */ - + duplicate_timespan_children (node->self_ptr(), new_timespan); - + GraphChanged(); } @@ -378,16 +378,16 @@ ExportProfileManager::split_channel_config (ChannelConfigNodePtr node, float) { ChannelConfigNodePtr new_config = duplicate_channel_config_node (node); insert_after (graph.channel_configs, node, new_config); - + /* Channel configs have only one parent, see above! */ node->get_parents().front()->add_child (new_config.get(), node.get()); - + if (node->get_children().size() == 1) { new_config->add_child (node->first_child(), 0); } else { duplicate_channel_config_children (node, new_config); } - + GraphChanged(); } @@ -404,13 +404,13 @@ ExportProfileManager::split_format (FormatNodePtr node, float position) node->sort_parents (graph.channel_configs); split_node_at_position (node.get(), new_format.get(), position); } - + if (node->get_children().size() == 1) { new_format->add_child (node->first_child(), 0); } else { duplicate_format_children (node, new_format); } - + GraphChanged(); } @@ -428,7 +428,7 @@ ExportProfileManager::split_filename (FilenameNodePtr node, float position) node->sort_parents (graph.formats); split_node_at_position (node.get(), new_filename.get(), position); } - + GraphChanged(); } @@ -446,35 +446,35 @@ ExportProfileManager::duplicate_timespan_children (TimespanNodePtr source, Times throw ExportFailed (X_("Programming error, Invalid pointer cast in ExportProfileManager")); } node_insertion_point = node_insertion_ptr->self_ptr(); - + /* Keep track of common children */ - + list<GraphNode *>::const_iterator common_children_begin = source_children.begin(); list<GraphNode *>::const_iterator common_children_end = end_of_common_child_range (source_children, source_children.begin()); GraphNode * common_child = 0; - + for (list<GraphNode *>::const_iterator it = source_children.begin(); it != source_children.end(); ++it) { /* Duplicate node */ - + ChannelConfigNode * node; ChannelConfigNodePtr new_node; - + if (!(node = dynamic_cast<ChannelConfigNode *> (*it))) { throw ExportFailed (X_("Programming error, Invalid pointer cast in ExportProfileManager")); } - + new_node = duplicate_channel_config_node (node->self_ptr()); - + /* Insert in gaph's list and update insertion position */ - + insert_after (graph.channel_configs, node_insertion_point, new_node); node_insertion_point = new_node; - + /* Handle children */ - + target->add_child (new_node.get(), child_insertion_point); child_insertion_point = new_node.get(); - + if (one_grandchild) { new_node->add_child (node->first_child(), 0); } else { @@ -483,7 +483,7 @@ ExportProfileManager::duplicate_timespan_children (TimespanNodePtr source, Times common_children_begin = it; common_children_end = end_of_common_child_range (source_children, it); } - + if (it == common_children_begin) { // At beginning => do duplication GraphNode * grand_child_ins_pt = common_child; if (!grand_child_ins_pt) { @@ -514,33 +514,33 @@ ExportProfileManager::duplicate_channel_config_children (ChannelConfigNodePtr so node_insertion_point = node_insertion_ptr->self_ptr(); /* Keep track of common children */ - + list<GraphNode *>::const_iterator common_children_begin = source_children.begin(); list<GraphNode *>::const_iterator common_children_end = end_of_common_child_range (source_children, source_children.begin()); GraphNode * common_child = 0; for (list<GraphNode *>::const_iterator it = source_children.begin(); it != source_children.end(); ++it) { /* Duplicate node */ - + FormatNode * node; FormatNodePtr new_node; - + if (!(node = dynamic_cast<FormatNode *> (*it))) { throw ExportFailed (X_("Programming error, Invalid pointer cast in ExportProfileManager")); } - + new_node = duplicate_format_node (node->self_ptr()); - + /* Insert in gaph's list and update insertion position */ - + insert_after (graph.formats, node_insertion_point, new_node); node_insertion_point = new_node; - + /* Handle children */ - + target->add_child (new_node.get(), child_insertion_point); child_insertion_point = new_node.get(); - + if (one_grandchild) { new_node->add_child (node->first_child(), 0); } else { @@ -549,7 +549,7 @@ ExportProfileManager::duplicate_channel_config_children (ChannelConfigNodePtr so common_children_begin = it; common_children_end = end_of_common_child_range (source_children, it); } - + if (it == common_children_begin) { // At beginning => do duplication GraphNode * grand_child_ins_pt = common_child; if (!grand_child_ins_pt) { @@ -579,23 +579,23 @@ ExportProfileManager::duplicate_format_children (FormatNodePtr source, FormatNod for (list<GraphNode *>::const_iterator it = source->get_children().begin(); it != source->get_children().end(); ++it) { /* Duplicate node */ - + FilenameNode * node; FilenameNodePtr new_node; - + if (!(node = dynamic_cast<FilenameNode *> (*it))) { throw ExportFailed (X_("Programming error, Invalid pointer cast in ExportProfileManager")); } - + new_node = duplicate_filename_node (node->self_ptr()); - + /* Insert in gaph's list and update insertion position */ - + insert_after (graph.filenames, node_insertion_point, new_node); node_insertion_point = new_node; - + /* Handle children */ - + target->add_child (new_node.get(), child_insertion_point); child_insertion_point = new_node.get(); } @@ -607,14 +607,14 @@ ExportProfileManager::duplicate_timespan_node (TimespanNodePtr node) TimespanStatePtr state = node->data(); TimespanStatePtr new_state (new TimespanState ()); TimespanNodePtr new_node = TimespanNode::create (new_state); - + for (TimespanList::iterator it = state->timespans->begin(); it != state->timespans->end(); ++it) { new_state->timespans->push_back (handler->add_timespan_copy (*it)); } - + new_state->time_format = state->time_format; new_state->marker_format = state->marker_format; - + return new_node; } @@ -624,7 +624,7 @@ ExportProfileManager::duplicate_channel_config_node (ChannelConfigNodePtr node) ChannelConfigStatePtr state = node->data(); ChannelConfigStatePtr new_state (new ChannelConfigState (handler->add_channel_config_copy (state->config))); ChannelConfigNodePtr new_node = ChannelConfigNode::create (new_state); - + return new_node; } @@ -634,7 +634,7 @@ ExportProfileManager::duplicate_format_node (FormatNodePtr node) FormatStatePtr state = node->data(); FormatStatePtr new_state (new FormatState (handler->add_format_copy (state->format))); FormatNodePtr new_node = FormatNode::create (new_state); - + return new_node; } @@ -644,7 +644,7 @@ ExportProfileManager::duplicate_filename_node (FilenameNodePtr node) FilenameStatePtr state = node->data(); FilenameStatePtr new_state (new FilenameState (handler->add_filename_copy (state->filename))); FilenameNodePtr new_node = FilenameNode::create (new_state); - + return new_node; } @@ -674,4 +674,4 @@ ExportProfileManager::remove_filename (FilenameNodePtr node) { remove_by_element (graph.filenames, node); purge_graph (); -}
\ No newline at end of file +} diff --git a/libs/ardour/export_preset.cc b/libs/ardour/export_preset.cc index 093803daa6..92fcb9e5a7 100644 --- a/libs/ardour/export_preset.cc +++ b/libs/ardour/export_preset.cc @@ -37,7 +37,7 @@ ExportPreset::ExportPreset (string filename, Session & s) : if ((prop = root->property ("name"))) { set_name (prop->value()); } - + XMLNode * instant_xml = get_instant_xml (); if (instant_xml) { XMLNode * instant_copy = new XMLNode (*instant_xml); @@ -56,7 +56,7 @@ ExportPreset::set_name (string const & name) { _name = name; - XMLNode * node; + XMLNode * node; if ((node = global.root())) { node->add_property ("name", name); } @@ -84,7 +84,7 @@ ExportPreset::set_global_state (XMLNode & state) { delete global.root (); global.set_root (&state); - + set_id (_id.to_s()); set_name (_name); } @@ -94,7 +94,7 @@ ExportPreset::set_local_state (XMLNode & state) { delete local; local = &state; - + set_id (_id.to_s()); set_name (_name); } @@ -119,7 +119,7 @@ XMLNode * ExportPreset::get_instant_xml () const { XMLNode * instant_xml; - + if ((instant_xml = session.instant_xml ("ExportPresets"))) { XMLNodeList children = instant_xml->children ("ExportPreset"); for (XMLNodeList::iterator it = children.begin(); it != children.end(); ++it) { @@ -129,7 +129,7 @@ ExportPreset::get_instant_xml () const } } } - + return 0; } @@ -139,9 +139,9 @@ ExportPreset::save_instant_xml () const if (!local) { return; } /* First remove old, then add new */ - + remove_instant_xml (); - + XMLNode * instant_xml; if ((instant_xml = session.instant_xml ("ExportPresets"))) { instant_xml->add_child_copy (*local); diff --git a/libs/ardour/export_processor.cc b/libs/ardour/export_processor.cc index 19ff9ac001..d36ef9f18a 100644 --- a/libs/ardour/export_processor.cc +++ b/libs/ardour/export_processor.cc @@ -73,11 +73,11 @@ ExportProcessor::prepare (FormatPtr format, FilenamePtr fname, uint32_t chans, b temp_file_length = 0; /* Reset just to be sure all references are dropped */ - + reset(); - + /* Get parameters needed later on */ - + channels = chans; split_files = split; filename = fname; @@ -88,50 +88,50 @@ ExportProcessor::prepare (FormatPtr format, FilenamePtr fname, uint32_t chans, b trim_end = format->trim_end(); silence_beginning = format->silence_beginning(); silence_end = format->silence_end(); - + /* SRC */ - + src.reset (new SampleRateConverter (channels, frame_rate, format->sample_rate(), format->src_quality())); - + /* Construct export pipe to temp file */ - + status->stage = export_PostProcess; - + if (normalize) { /* Normalizing => we need a normalizer, peak reader and tempfile */ - + normalizer.reset (new Normalizer (channels, format->normalize_target())); - + peak_reader.reset (new PeakReader (channels)); temp_file.reset (new ExportTempFile (channels, format->sample_rate())); - + src->pipe_to (peak_reader); peak_reader->pipe_to (temp_file); - + } else if (trim_beginning || trim_end) { /* Not normalizing, but silence will be trimmed => need for a tempfile */ - + temp_file.reset (new ExportTempFile (channels, format->sample_rate())); src->pipe_to (temp_file); - + } else { /* Due to complexity and time running out, a tempfile will be created for this also... */ - + temp_file.reset (new ExportTempFile (channels, format->sample_rate())); src->pipe_to (temp_file); } /* Ensure directory exists */ - + sys::path folder (filename->get_folder()); if (!sys::exists (folder)) { if (!sys::create_directory (folder)) { throw ExportFailed (X_("sys::create_directory failed for export dir")); } } - + /* prep file sinks */ - + if (split) { filename->include_channel = true; for (uint32_t chn = 1; chn <= channels; ++chn) { @@ -148,23 +148,23 @@ ExportProcessor::prepare (FormatPtr format, FilenamePtr fname, uint32_t chans, b writer_list.push_back (pair.second); WritingFile (filename->get_path (format)); } - + /* Set position info */ - + nframes_t start_position = ((double) format->sample_rate() / frame_rate) * start + 0.5; - + for (FileWriterList::iterator it = writer_list.begin(); it != writer_list.end(); ++it) { (*it)->set_position (start_position); } - + /* set broadcast info if necessary */ - + if (broadcast_info) { for (FileWriterList::iterator it = writer_list.begin(); it != writer_list.end(); ++it) { - + BroadcastInfo bci; bci.set_from_session (session, (*it)->position()); - + boost::shared_ptr<SndfileWriterBase> sndfile_ptr; if ((sndfile_ptr = boost::dynamic_pointer_cast<SndfileWriterBase> (*it))) { if (!bci.write_to_file (sndfile_ptr->get_sndfile())) { @@ -196,17 +196,17 @@ ExportProcessor::prepare_post_processors () float dummy; src->set_end_of_input (); src->write (&dummy, 0); - + /* Trim and add silence */ - + temp_file->trim_beginning (trim_beginning); temp_file->trim_end (trim_end); - + temp_file->set_silence_beginning (silence_beginning); temp_file->set_silence_end (silence_end); - + /* Set up normalizer */ - + if (normalize) { normalizer->set_peak (peak_reader->get_peak ()); } @@ -216,35 +216,35 @@ void ExportProcessor::write_files () { /* Write to disk */ - + status->stage = export_Write; temp_file_position = 0; - + uint32_t buffer_size = 4096; // TODO adjust buffer size? float * buf = new float[channels * buffer_size]; int frames_read; - + FloatSinkPtr disk_sink; - + if (normalize) { disk_sink = boost::dynamic_pointer_cast<FloatSink> (normalizer); normalizer->pipe_to (file_sinks[0]); } else { disk_sink = file_sinks[0]; } - + if (split_files) { - + /* Get buffers for each channel separately */ - + std::vector<float *> chan_bufs; - + for (uint32_t i = 0; i < channels; ++i) { chan_bufs.push_back(new float[buffer_size]); } - + /* de-interleave and write files */ - + while ((frames_read = temp_file->read (buf, buffer_size)) > 0) { for (uint32_t channel = 0; channel < channels; ++channel) { for (uint32_t i = 0; i < buffer_size; ++i) { @@ -257,33 +257,33 @@ ExportProcessor::write_files () } disk_sink->write (chan_bufs[channel], frames_read); } - + if (status->aborted()) { break; } temp_file_position += frames_read; status->progress = (float) temp_file_position / temp_file_length; } - + /* Clean up */ - + for (std::vector<float *>::iterator it = chan_bufs.begin(); it != chan_bufs.end(); ++it) { delete[] *it; } - + } else { while ((frames_read = temp_file->read (buf, buffer_size)) > 0) { disk_sink->write (buf, frames_read); - + if (status->aborted()) { break; } temp_file_position += frames_read; status->progress = (float) temp_file_position / temp_file_length; } } - + delete [] buf; - + /* Tag files if necessary and send exported signal */ - - + + for (FileWriterList::iterator it = writer_list.begin(); it != writer_list.end(); ++it) { if (tag) { AudiofileTagger::tag_file ((*it)->filename(), session.metadata()); diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc index 6e6d2ea290..2b1b15dbce 100644 --- a/libs/ardour/export_profile_manager.cc +++ b/libs/ardour/export_profile_manager.cc @@ -63,21 +63,21 @@ ExportProfileManager::ExportProfileManager (Session & s) : export_config_dir = user_config_directory(); export_config_dir /= "export"; search_path += export_config_dir; - + search_path += ardour_search_path().add_subdirectory_to_paths("export"); search_path += system_config_search_path().add_subdirectory_to_paths("export");; - + /* create export config directory if necessary */ if (!sys::exists (export_config_dir)) { sys::create_directory (export_config_dir); } - + load_presets (); load_formats (); - + /* Initialize all lists with an empty config */ - + XMLNodeList dummy; init_timespans (dummy); init_channel_configs (dummy); @@ -88,7 +88,7 @@ ExportProfileManager::ExportProfileManager (Session & s) : ExportProfileManager::~ExportProfileManager () { if (single_range_mode) { return; } - + XMLNode * instant_xml (new XMLNode ("ExportProfile")); serialize_profile (*instant_xml); session.add_instant_xml (*instant_xml, false); @@ -111,15 +111,15 @@ ExportProfileManager::prepare_for_export () { ChannelConfigPtr channel_config = channel_configs.front()->config; TimespanListPtr ts_list = timespans.front()->timespans; - + FormatStateList::const_iterator format_it; FilenameStateList::const_iterator filename_it; - + for (TimespanList::iterator ts_it = ts_list->begin(); ts_it != ts_list->end(); ++ts_it) { for (format_it = formats.begin(), filename_it = filenames.begin(); format_it != formats.end() && filename_it != filenames.end(); ++format_it, ++filename_it) { - + // filename->include_timespan = (ts_list->size() > 1); Disabled for now... handler->add_export_config (*ts_it, channel_config, (*format_it)->format, (*filename_it)->filename); } @@ -138,13 +138,13 @@ ExportProfileManager::load_preset (PresetPtr preset) if ((state = preset->get_local_state())) { set_local_state (*state); } else { ok = false; } - + if ((state = preset->get_global_state())) { if (!set_global_state (*state)) { ok = false; } } else { ok = false; } - + return ok; } @@ -167,7 +167,7 @@ ExportProfileManager::save_preset (string const & name) current_preset.reset (new ExportPreset (filename, session)); preset_list.push_back (current_preset); } - + XMLNode * global_preset = new XMLNode ("ExportPreset"); XMLNode * local_preset = new XMLNode ("ExportPreset"); @@ -177,9 +177,9 @@ ExportProfileManager::save_preset (string const & name) current_preset->set_name (name); current_preset->set_global_state (*global_preset); current_preset->set_local_state (*local_preset); - + current_preset->save (filename); - + return current_preset; } @@ -200,7 +200,7 @@ ExportProfileManager::remove_preset () sys::remove (it->second); preset_file_map.erase (it); } - + current_preset->remove_local(); current_preset.reset(); } @@ -209,9 +209,9 @@ void ExportProfileManager::load_preset_from_disk (PBD::sys::path const & path) { PresetPtr preset (new ExportPreset (path.to_string(), session)); - + /* Handle id to filename mapping and don't add duplicates to list */ - + FilePair pair (preset->id(), path); if (preset_file_map.insert (pair).second) { preset_list.push_back (preset); @@ -263,7 +263,7 @@ ExportProfileManager::serialize_local_profile (XMLNode & root) for (TimespanStateList::iterator it = timespans.begin(); it != timespans.end(); ++it) { root.add_child_nocopy (serialize_timespan (*it)); } - + for (ChannelConfigStateList::iterator it = channel_configs.begin(); it != channel_configs.end(); ++it) { root.add_child_nocopy ((*it)->config->get_state()); } @@ -291,7 +291,7 @@ ExportProfileManager::set_selection_range (nframes_t start, nframes_t end) } else { selection_range.reset(); } - + for (TimespanStateList::iterator it = timespans.begin(); it != timespans.end(); ++it) { (*it)->selection_range = selection_range; } @@ -301,13 +301,13 @@ std::string ExportProfileManager::set_single_range (nframes_t start, nframes_t end, Glib::ustring name) { single_range_mode = true; - + single_range.reset (new Location()); single_range->set_name (name); single_range->set (start, end); - + update_ranges (); - + return single_range->id().to_s(); } @@ -316,7 +316,7 @@ ExportProfileManager::init_timespans (XMLNodeList nodes) { timespans.clear (); update_ranges (); - + bool ok = true; for (XMLNodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { TimespanStatePtr span = deserialize_timespan (**it); @@ -324,13 +324,13 @@ ExportProfileManager::init_timespans (XMLNodeList nodes) timespans.push_back (span); } else { ok = false; } } - + if (timespans.empty()) { TimespanStatePtr timespan (new TimespanState (session_range, selection_range, ranges)); timespans.push_back (timespan); return false; } - + return ok; } @@ -339,14 +339,14 @@ ExportProfileManager::deserialize_timespan (XMLNode & root) { TimespanStatePtr state (new TimespanState (session_range, selection_range, ranges)); XMLProperty const * prop; - + XMLNodeList spans = root.children ("Range"); for (XMLNodeList::iterator node_it = spans.begin(); node_it != spans.end(); ++node_it) { - + prop = (*node_it)->property ("id"); if (!prop) { continue; } ustring id = prop->value(); - + for (LocationList::iterator it = ranges->begin(); it != ranges->end(); ++it) { if ((!id.compare ("session") && *it == session_range.get()) || (!id.compare ("selection") && *it == selection_range.get()) || @@ -359,11 +359,11 @@ ExportProfileManager::deserialize_timespan (XMLNode & root) } } } - + if ((prop = root.property ("format"))) { state->time_format = (TimeFormat) string_2_enum (prop->value(), TimeFormat); } - + return state; } @@ -372,24 +372,24 @@ ExportProfileManager::serialize_timespan (TimespanStatePtr state) { XMLNode & root = *(new XMLNode ("ExportTimespan")); XMLNode * span; - + update_ranges (); - + for (TimespanList::iterator it = state->timespans->begin(); it != state->timespans->end(); ++it) { if ((span = root.add_child ("Range"))) { span->add_property ("id", (*it)->range_id()); } } - + root.add_property ("format", enum_2_string (state->time_format)); - + return root; } void ExportProfileManager::update_ranges () { ranges->clear(); - + if (single_range_mode) { ranges->push_back (single_range.get()); return; @@ -400,15 +400,15 @@ ExportProfileManager::update_ranges () { session_range->set_name (_("Session")); session_range->set (session.current_start_frame(), session.current_end_frame()); ranges->push_back (session_range.get()); - + /* Selection */ - + if (selection_range) { ranges->push_back (selection_range.get()); } - + /* ranges */ - + LocationList const & list (session.locations()->list()); for (LocationList::const_iterator it = list.begin(); it != list.end(); ++it) { if ((*it)->is_range_marker()) { @@ -422,18 +422,18 @@ ExportProfileManager::init_channel_configs (XMLNodeList nodes) { channel_configs.clear(); - if (nodes.empty()) { + if (nodes.empty()) { ChannelConfigStatePtr config (new ChannelConfigState (handler->add_channel_config())); channel_configs.push_back (config); return false; } - + for (XMLNodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { ChannelConfigStatePtr config (new ChannelConfigState (handler->add_channel_config())); config->config->set_state (**it); channel_configs.push_back (config); } - + return true; } @@ -468,46 +468,46 @@ ExportProfileManager::save_format_to_disk (FormatPtr format) Glib::ustring new_name = format->name(); new_name += export_format_suffix; - + sys::path new_path (export_config_dir); new_path /= new_name; /* Check if format is on disk already */ FileMap::iterator it; if ((it = format_file_map.find (format->id())) != format_file_map.end()) { - + /* Check if config is not in user config dir */ if (it->second.branch_path().to_string().compare (export_config_dir.to_string())) { - + /* Write new file */ - + XMLTree tree (new_path.to_string()); tree.set_root (&format->get_state()); tree.write(); - + } else { - + /* Update file and rename if necessary */ - + XMLTree tree (it->second.to_string()); tree.set_root (&format->get_state()); tree.write(); - + if (new_name.compare (it->second.leaf())) { sys::rename (it->second, new_path); } } - + it->second = new_path; - + } else { /* Write new file */ - + XMLTree tree (new_path.to_string()); tree.set_root (&format->get_state()); tree.write(); } - + FormatListChanged (); return new_path; } @@ -527,13 +527,13 @@ ExportProfileManager::remove_format_profile (FormatPtr format) sys::remove (it->second); format_file_map.erase (it); } - + FormatListChanged (); } ExportProfileManager::FormatPtr ExportProfileManager::get_new_format (FormatPtr original) -{ +{ FormatPtr format; if (original) { format.reset (new ExportFormatSpecification (*original)); @@ -541,14 +541,14 @@ ExportProfileManager::get_new_format (FormatPtr original) format = handler->add_format(); format->set_name ("empty format"); } - + sys::path path = save_format_to_disk (format); FilePair pair (format->id(), path); format_file_map.insert (pair); - + format_list->push_back (format); FormatListChanged (); - + return format; } @@ -564,13 +564,13 @@ ExportProfileManager::init_formats (XMLNodeList nodes) formats.push_back (format); } else { ok = false; } } - + if (formats.empty ()) { FormatStatePtr format (new FormatState (format_list, FormatPtr ())); formats.push_back (format); return false; } - + return ok; } @@ -579,11 +579,11 @@ ExportProfileManager::deserialize_format (XMLNode & root) { XMLProperty * prop; UUID id; - + if ((prop = root.property ("id"))) { id = prop->value(); } - + for (FormatList::iterator it = format_list->begin(); it != format_list->end(); ++it) { if ((*it)->id() == id) { return FormatStatePtr (new FormatState (format_list, *it)); @@ -597,10 +597,10 @@ XMLNode & ExportProfileManager::serialize_format (FormatStatePtr state) { XMLNode * root = new XMLNode ("ExportFormat"); - + string id = state->format ? state->format->id().to_s() : ""; root->add_property ("id", id); - + return *root; } @@ -619,14 +619,14 @@ ExportProfileManager::load_format_from_disk (PBD::sys::path const & path) { XMLTree const tree (path.to_string()); FormatPtr format = handler->add_format (*tree.root()); - + /* Handle id to filename mapping and don't add duplicates to list */ - + FilePair pair (format->id(), path); if (format_file_map.insert (pair).second) { format_list->push_back (format); } - + FormatListChanged (); } @@ -659,13 +659,13 @@ ExportProfileManager::init_filenames (XMLNodeList nodes) filename->set_state (**it); filenames.push_back (FilenameStatePtr (new FilenameState (filename))); } - + if (filenames.empty()) { FilenameStatePtr filename (new FilenameState (handler->add_filename())); filenames.push_back (filename); return false; } - + return true; } @@ -676,26 +676,26 @@ ExportProfileManager::get_warnings () ChannelConfigStatePtr channel_config_state = channel_configs.front(); TimespanStatePtr timespan_state = timespans.front(); - + /*** Check "global" config ***/ - + TimespanListPtr timespans = timespan_state->timespans; ChannelConfigPtr channel_config = channel_config_state->config; /* Check Timespans are not empty */ - + if (timespans->empty()) { warnings->errors.push_back (_("No timespan has been selected!")); } /* Check channel config ports */ - + if (!channel_config->all_channels_have_ports ()) { warnings->warnings.push_back (_("Some channels are empty")); } - + /*** Check files ***/ - + FormatStateList::const_iterator format_it; FilenameStateList::const_iterator filename_it; for (format_it = formats.begin(), filename_it = filenames.begin(); @@ -703,7 +703,7 @@ ExportProfileManager::get_warnings () ++format_it, ++filename_it) { check_config (warnings, timespan_state, channel_config_state, *format_it, *filename_it); } - + return warnings; } @@ -733,32 +733,32 @@ ExportProfileManager::check_config (boost::shared_ptr<Warnings> warnings, format->channel_limit(), channel_config->get_n_chans())); } - + if (!warnings->errors.empty()) { return; } - + /* Check filenames */ - + // filename->include_timespan = (timespans->size() > 1); Disabled for now... - + for (std::list<TimespanPtr>::iterator timespan_it = timespans->begin(); timespan_it != timespans->end(); ++timespan_it) { filename->set_timespan (*timespan_it); - + if (channel_config->get_split()) { filename->include_channel = true; - + for (uint32_t chan = 1; chan <= channel_config->get_n_chans(); ++chan) { filename->set_channel (chan); - + Glib::ustring path = filename->get_path (format); - + if (sys::exists (sys::path (path))) { warnings->conflicting_filenames.push_back (path); } } - + } else { Glib::ustring path = filename->get_path (format); - + if (sys::exists (sys::path (path))) { warnings->conflicting_filenames.push_back (path); } diff --git a/libs/ardour/export_status.cc b/libs/ardour/export_status.cc index c575ee79be..eb0a3504b4 100644 --- a/libs/ardour/export_status.cc +++ b/libs/ardour/export_status.cc @@ -36,16 +36,16 @@ ExportStatus::init () _aborted = false; _finished = false; _errors = false; - + stage = export_None; progress = 0.0; - + total_timespans = 0; timespan = 0; - + total_channel_configs = 0; channel_config = 0; - + total_formats = 0; format = 0; } diff --git a/libs/ardour/export_timespan.cc b/libs/ardour/export_timespan.cc index 60654cf06a..d638c84b16 100644 --- a/libs/ardour/export_timespan.cc +++ b/libs/ardour/export_timespan.cc @@ -64,7 +64,7 @@ ExportTimespan::get_data (float * data, nframes_t frames, ExportChannelPtr chann if (it == filemap.end()) { throw ExportFailed (X_("Trying to get data from ExportTimespan for channel that was never registered!")); } - + return it->second->read (data, frames); } @@ -84,26 +84,26 @@ ExportTimespan::process (nframes_t frames) /* update position */ nframes_t frames_to_read; - + if (position + frames <= end_frame) { frames_to_read = frames; } else { frames_to_read = end_frame - position; status->stop = true; } - + position += frames_to_read; status->progress = (float) (position - start_frame) / (end_frame - start_frame); /* Read channels from ports and save to tempfiles */ float * data = new float[frames_to_read]; - + for (TempFileMap::iterator it = filemap.begin(); it != filemap.end(); ++it) { it->first->read (data, frames_to_read); it->second->write (data, frames_to_read); } - + delete [] data; return 0; diff --git a/libs/ardour/export_utilities.cc b/libs/ardour/export_utilities.cc index dcc43c8a7f..a91912359e 100644 --- a/libs/ardour/export_utilities.cc +++ b/libs/ardour/export_utilities.cc @@ -24,7 +24,7 @@ #include <cmath> #undef _ISOC99_SOURCE #undef _ISOC9X_SOURCE -#undef __USE_SVID +#undef __USE_SVID #define __USE_SVID 1 #include <cstdlib> #undef __USE_SVID @@ -68,14 +68,14 @@ SampleRateConverter::SampleRateConverter (uint32_t channels, nframes_t in_rate, active = false; return; } - + active = true; int err; if ((src_state = src_new (quality, channels, &err)) == 0) { throw ExportFailed (string_compose (X_("Cannot initialize sample rate conversion: %1"), src_strerror (err))); } - + src_data.src_ratio = out_rate / (double) in_rate; } @@ -101,7 +101,7 @@ SampleRateConverter::process (float * data, nframes_t frames) } /* Manage memory */ - + nframes_t out_samples_max = (nframes_t) ceil (frames * src_data.src_ratio * channels); if (data_out_size < out_samples_max) { @@ -109,13 +109,13 @@ SampleRateConverter::process (float * data, nframes_t frames) data_out = new float[out_samples_max]; src_data.data_out = data_out; - + max_leftover_frames = 4 * frames; leftover_data = (float *) realloc (leftover_data, max_leftover_frames * channels * sizeof (float)); if (!leftover_data) { throw ExportFailed (X_("A memory allocation error occured during sample rate conversion")); } - + data_out_size = out_samples_max; } @@ -127,7 +127,7 @@ SampleRateConverter::process (float * data, nframes_t frames) int err; int cnt = 0; nframes_t frames_out_total = 0; - + do { src_data.output_frames = out_samples_max / channels; src_data.end_of_input = end_of_input; @@ -140,13 +140,13 @@ SampleRateConverter::process (float * data, nframes_t frames) src_data.data_in = leftover_data; if (cnt == 0) { - + /* first time, append new data from data_in into the leftover_data buffer */ memcpy (leftover_data + (leftover_frames * channels), data_in, frames_in * channels * sizeof(float)); src_data.input_frames = frames_in + leftover_frames; } else { - + /* otherwise, just use whatever is still left in leftover_data; the contents were adjusted using memmove() right after the last SRC call (see below) @@ -154,7 +154,7 @@ SampleRateConverter::process (float * data, nframes_t frames) src_data.input_frames = leftover_frames; } - + } else { src_data.data_in = data_in; @@ -167,7 +167,7 @@ SampleRateConverter::process (float * data, nframes_t frames) if ((err = src_process (src_state, &src_data)) != 0) { throw ExportFailed (string_compose ("An error occured during sample rate conversion: %1", src_strerror (err))); } - + frames_out = src_data.output_frames_gen; leftover_frames = src_data.input_frames - src_data.input_frames_used; @@ -179,14 +179,14 @@ SampleRateConverter::process (float * data, nframes_t frames) memmove (leftover_data, (char *) (src_data.data_in + (src_data.input_frames_used * channels)), leftover_frames * channels * sizeof(float)); } - - + + nframes_t frames_written = piped_to->write (data_out, frames_out); frames_out_total += frames_written; } while (leftover_frames > frames_in); - + return frames_out_total; } @@ -204,7 +204,7 @@ SampleFormatConverter<TOut>::SampleFormatConverter (uint32_t channels, ExportFor if (data_width != 24) { data_width = sizeof (TOut) * 8; } - + GDitherSize dither_size = GDitherFloat; switch (data_width) { @@ -218,7 +218,7 @@ SampleFormatConverter<TOut>::SampleFormatConverter (uint32_t channels, ExportFor case 24: dither_size = GDither32bit; } - + dither = gdither_new ((GDitherType) type, channels, dither_size, data_width); } @@ -237,7 +237,7 @@ nframes_t SampleFormatConverter<TOut>::process (float * data, nframes_t frames) { /* Make sure we have enough memory allocated */ - + size_t data_size = channels * frames * sizeof (TOut); if (data_size > data_out_size) { @@ -246,24 +246,24 @@ SampleFormatConverter<TOut>::process (float * data, nframes_t frames) data_out = new TOut[data_size]; data_out_size = data_size; } - + /* Do conversion */ - + if (data_width < 32) { for (uint32_t chn = 0; chn < channels; ++chn) { gdither_runf (dither, chn, frames, data, data_out); } } else { for (uint32_t chn = 0; chn < channels; ++chn) { - + TOut * ob = data_out; const double int_max = (float) INT_MAX; const double int_min = (float) INT_MIN; - + nframes_t i; for (nframes_t x = 0; x < frames; ++x) { i = chn + (x * channels); - + if (data[i] > 1.0f) { ob[i] = static_cast<TOut> (INT_MAX); } else if (data[i] < -1.0f) { @@ -278,9 +278,9 @@ SampleFormatConverter<TOut>::process (float * data, nframes_t frames) } } } - + /* Write forward */ - + return GraphSinkVertex<float, TOut>::piped_to->write (data_out, frames); } @@ -294,10 +294,10 @@ SampleFormatConverter<float>::process (float * data, nframes_t frames) data[x] = 1.0f; } else if (data[x] < -1.0f) { data[x] = -1.0f; - } + } } } - + return piped_to->write (data, frames); } @@ -311,8 +311,8 @@ Normalizer::Normalizer (uint32_t channels, float target_dB) : channels (channels), enabled (false) { - target = dB_to_coefficient (target_dB); - + target = dB_to_coefficient (target_dB); + if (target == 1.0f) { /* do not normalize to precisely 1.0 (0 dBFS), to avoid making it appear that we may have clipped. @@ -328,7 +328,7 @@ Normalizer::~Normalizer () void Normalizer::set_peak (float peak) -{ +{ if (peak == 0.0f || peak == target) { /* don't even try */ enabled = false; diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index a8119170de..f5b06ee046 100644 --- a/libs/ardour/file_source.cc +++ b/libs/ardour/file_source.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2006-2009 Paul Davis + Copyright (C) 2006-2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -99,7 +99,7 @@ FileSource::init (const ustring& pathstr, bool must_exist) if (_file_is_new && must_exist) { return -1; } - + return 0; } @@ -142,10 +142,10 @@ FileSource::move_to_trash (const ustring& trash_dir_name) /* don't move the file across filesystems, just stick it in the trash_dir_name directory on whichever filesystem it was already on */ - + ustring newpath; newpath = Glib::path_get_dirname (_path); - newpath = Glib::path_get_dirname (newpath); + newpath = Glib::path_get_dirname (newpath); newpath += string(PATH_SEP) + trash_dir_name + PATH_SEP; newpath += Glib::path_get_basename (_path); @@ -163,7 +163,7 @@ FileSource::move_to_trash (const ustring& trash_dir_name) snprintf (buf, sizeof (buf), "%s.%d", newpath.c_str(), ++version); newpath_v = buf; } - + if (version == 999) { PBD::error << string_compose ( _("there are already 1000 files with names like %1; versioning discontinued"), @@ -185,9 +185,9 @@ FileSource::move_to_trash (const ustring& trash_dir_name) rename (newpath.c_str(), _path.c_str()); return -1; } - + _path = newpath; - + /* file can not be removed twice, since the operation is not idempotent */ _flags = Flag (_flags & ~(RemoveAtDestroy|Removable|RemovableIfEmpty)); @@ -195,7 +195,7 @@ FileSource::move_to_trash (const ustring& trash_dir_name) } /** Find the actual source file based on \a filename. - * + * * If the source is embedded, \a filename should be a simple filename (no slashes). * If the source is external, \a filename should be a full path. * In either case, found_path is set to the complete absolute path of the source file. @@ -230,7 +230,7 @@ FileSource::find (DataType type, const ustring& path, bool must_exist, split (search_path, dirs, ':'); cnt = 0; - + for (vector<ustring>::iterator i = dirs.begin(); i != dirs.end(); ++i) { fullpath = *i; if (fullpath[fullpath.length()-1] != '/') { @@ -242,24 +242,24 @@ FileSource::find (DataType type, const ustring& path, bool must_exist, /* i (paul) made a nasty design error by using ':' as a special character in Ardour 0.99 .. this hack tries to make things sort of work. */ - + if ((pos = pathstr.find_last_of (':')) != ustring::npos) { - + if (Glib::file_test (fullpath, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { /* its a real file, no problem */ - + keeppath = fullpath; ++cnt; } else { - + if (must_exist) { - + /* might be an older session using file:channel syntax. see if the version without the :suffix exists */ - + ustring shorter = pathstr.substr (0, pos); fullpath = *i; @@ -274,12 +274,12 @@ FileSource::find (DataType type, const ustring& path, bool must_exist, pathstr = shorter; keeppath = fullpath; ++cnt; - } - + } + } else { - + /* new derived file (e.g. for timefx) being created in a newer session */ - + } } @@ -288,7 +288,7 @@ FileSource::find (DataType type, const ustring& path, bool must_exist, if (Glib::file_test (fullpath, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { keeppath = fullpath; ++cnt; - } + } } } @@ -322,17 +322,17 @@ FileSource::find (DataType type, const ustring& path, bool must_exist, } found_path = keeppath; - + ret = true; } else { - + /* external files and/or very very old style sessions include full paths */ /* ugh, handle ':' situation */ if ((pos = pathstr.find_last_of (':')) != ustring::npos) { - + ustring shorter = pathstr.substr (0, pos); if (Glib::file_test (shorter, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { @@ -340,38 +340,38 @@ FileSource::find (DataType type, const ustring& path, bool must_exist, pathstr = shorter; } } - + found_path = pathstr; if (!Glib::file_test (pathstr, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { /* file does not exist or we cannot read it */ - + if (must_exist) { error << string_compose( _("Filesource: cannot find required file (%1): %2"), path, strerror (errno)) << endmsg; goto out; } - + if (errno != ENOENT) { error << string_compose( _("Filesource: cannot check for existing file (%1): %2"), path, strerror (errno)) << endmsg; goto out; } - + /* a new file */ isnew = true; ret = true; } else { - + /* already exists */ ret = true; } } - + out: return ret; } @@ -382,13 +382,13 @@ FileSource::set_source_name (const ustring& newname, bool destructive) Glib::Mutex::Lock lm (_lock); ustring oldpath = _path; ustring newpath = Session::change_source_path_by_name (oldpath, _name, newname, destructive); - + if (newpath.empty()) { error << string_compose (_("programming error: %1"), "cannot generate a changed file path") << endmsg; return -1; } - // Test whether newpath exists, if yes notify the user but continue. + // Test whether newpath exists, if yes notify the user but continue. if (access(newpath.c_str(),F_OK) == 0) { error << _("Programming error! Ardour tried to rename a file over another file! It's safe to continue working, but please report this to the developers.") << endmsg; return -1; diff --git a/libs/ardour/filename_extensions.cc b/libs/ardour/filename_extensions.cc index c30483456e..c09a8c481c 100644 --- a/libs/ardour/filename_extensions.cc +++ b/libs/ardour/filename_extensions.cc @@ -3,7 +3,7 @@ #include <stdint.h> #include "i18n.h" -namespace ARDOUR { +namespace ARDOUR { const char* const template_suffix = X_(".template"); const char* const statefile_suffix = X_(".ardour"); diff --git a/libs/ardour/filesystem_paths.cc b/libs/ardour/filesystem_paths.cc index 7372c467a6..2f2afe3c7b 100644 --- a/libs/ardour/filesystem_paths.cc +++ b/libs/ardour/filesystem_paths.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Tim Mayberry + Copyright (C) 2007 Tim Mayberry This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/filter.cc b/libs/ardour/filter.cc index 88a6e1d253..53a28c8691 100644 --- a/libs/ardour/filter.cc +++ b/libs/ardour/filter.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004-2007 Paul Davis + Copyright (C) 2004-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -62,7 +62,7 @@ Filter::make_new_sources (boost::shared_ptr<Region> region, SourceList& nsrcs, s PBD::basename_nosuffix (names[i]), string ("")); if (path.length() == 0) { - error << string_compose (_("filter: error creating name for new file based on %1"), region->name()) + error << string_compose (_("filter: error creating name for new file based on %1"), region->name()) << endmsg; return -1; } @@ -72,7 +72,7 @@ Filter::make_new_sources (boost::shared_ptr<Region> region, SourceList& nsrcs, s SourceFactory::createWritable (region->data_type(), session, path, true, false, session.frame_rate()))); - } + } catch (failed_constructor& err) { error << string_compose (_("filter: error creating new file %1 (%2)"), path, strerror (errno)) << endmsg; @@ -102,15 +102,15 @@ Filter::finish (boost::shared_ptr<Region> region, SourceList& nsrcs, string regi afs->update_header (region->position(), *now, xnow); afs->mark_immutable (); } - + boost::shared_ptr<SMFSource> smfs = boost::dynamic_pointer_cast<SMFSource>(*si); if (smfs) { smfs->set_timeline_position (region->position()); smfs->flush (); } - + /* now that there is data there, requeue the file for analysis */ - + Analyser::queue_source_for_analysis (*si, false); } @@ -121,7 +121,7 @@ Filter::finish (boost::shared_ptr<Region> region, SourceList& nsrcs, string regi } results.clear (); - boost::shared_ptr<Region> r = RegionFactory::create (nsrcs, 0, region->length(), region_name, 0, + boost::shared_ptr<Region> r = RegionFactory::create (nsrcs, 0, region->length(), region_name, 0, Region::Flag (Region::WholeFile|Region::DefaultFlags)); r->set_position (region->position(), 0); @@ -131,7 +131,7 @@ Filter::finish (boost::shared_ptr<Region> region, SourceList& nsrcs, string regi audio_r->set_scale_amplitude (audio_region->scale_amplitude()); } results.push_back (r); - + return 0; } diff --git a/libs/ardour/find_session.cc b/libs/ardour/find_session.cc index e28bbe9ccb..a572a9a7a3 100644 --- a/libs/ardour/find_session.cc +++ b/libs/ardour/find_session.cc @@ -31,7 +31,7 @@ ARDOUR::find_session (string str, string& path, string& snapshot, bool& isnew) } str = buf; - + /* check to see if it exists, and what it is */ if (stat (str.c_str(), &statbuf)) { @@ -54,9 +54,9 @@ ARDOUR::find_session (string str, string& path, string& snapshot, bool& isnew) if (S_ISDIR (statbuf.st_mode)) { string::size_type slash = str.find_last_of ('/'); - + if (slash == string::npos) { - + /* a subdirectory of cwd, so statefile should be ... */ string tmp; @@ -66,7 +66,7 @@ ARDOUR::find_session (string str, string& path, string& snapshot, bool& isnew) tmp += statefile_suffix; /* is it there ? */ - + if (stat (tmp.c_str(), &statbuf)) { error << string_compose (_("cannot check statefile %1 (%2)"), tmp, strerror (errno)) << endmsg; @@ -85,16 +85,16 @@ ARDOUR::find_session (string str, string& path, string& snapshot, bool& isnew) path = str; snapshot = str.substr (slash+1); - + } } else if (S_ISREG (statbuf.st_mode)) { - + string::size_type slash = str.find_last_of ('/'); string::size_type suffix; /* remove the suffix */ - + if (slash != string::npos) { snapshot = str.substr (slash+1); } else { @@ -102,7 +102,7 @@ ARDOUR::find_session (string str, string& path, string& snapshot, bool& isnew) } suffix = snapshot.find (statefile_suffix); - + if (suffix == string::npos) { error << string_compose (_("%1 is not an Ardour snapshot file"), str) << endmsg; return -1; @@ -111,10 +111,10 @@ ARDOUR::find_session (string str, string& path, string& snapshot, bool& isnew) /* remove suffix */ snapshot = snapshot.substr (0, suffix); - + if (slash == string::npos) { - - /* we must be in the directory where the + + /* we must be in the directory where the statefile lives. get it using cwd(). */ @@ -134,7 +134,7 @@ ARDOUR::find_session (string str, string& path, string& snapshot, bool& isnew) path = str.substr (0, slash); } - + } else { /* what type of file is it? */ @@ -151,14 +151,14 @@ ARDOUR::find_session (string str, string& path, string& snapshot, bool& isnew) string::size_type slash = str.find_last_of ('/'); if (slash == string::npos) { - + /* no slash, just use the name, but clean it up */ - + path = legalize_for_path (str); snapshot = path; - + } else { - + path = str; snapshot = str.substr (slash+1); } diff --git a/libs/ardour/gain.cc b/libs/ardour/gain.cc index cf38050063..6f2161f578 100644 --- a/libs/ardour/gain.cc +++ b/libs/ardour/gain.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/gdither.cc b/libs/ardour/gdither.cc index 7ad9bebd6d..f09e06edc2 100644 --- a/libs/ardour/gdither.cc +++ b/libs/ardour/gdither.cc @@ -35,7 +35,7 @@ #include <math.h> #endif -#undef __USE_SVID +#undef __USE_SVID #define __USE_SVID 1 #ifdef __cplusplus #include <cstdlib> @@ -163,13 +163,13 @@ void gdither_free(GDither s) } } -inline static void gdither_innner_loop(const GDitherType dt, - const uint32_t stride, const float bias, const float scale, +inline static void gdither_innner_loop(const GDitherType dt, + const uint32_t stride, const float bias, const float scale, - const uint32_t post_scale, const int bit_depth, - const uint32_t channel, const uint32_t length, float *ts, + const uint32_t post_scale, const int bit_depth, + const uint32_t channel, const uint32_t length, float *ts, - GDitherShapedState *ss, float *x, void *y, const int clamp_u, + GDitherShapedState *ss, float *x, void *y, const int clamp_u, const int clamp_l) { @@ -216,7 +216,7 @@ inline static void gdither_innner_loop(const GDitherType dt, ss->buffer[ss->phase] = (float)lrintf(tmp) - ideal; break; } - + clamped = lrintf(tmp); if (clamped > clamp_u) { clamped = clamp_u; @@ -239,13 +239,13 @@ inline static void gdither_innner_loop(const GDitherType dt, } /* floating pint version of the inner loop function */ -inline static void gdither_innner_loop_fp(const GDitherType dt, - const uint32_t stride, const float bias, const float scale, +inline static void gdither_innner_loop_fp(const GDitherType dt, + const uint32_t stride, const float bias, const float scale, - const float post_scale, const int bit_depth, - const uint32_t channel, const uint32_t length, float *ts, + const float post_scale, const int bit_depth, + const uint32_t channel, const uint32_t length, float *ts, - GDitherShapedState *ss, float *x, void *y, const int clamp_u, + GDitherShapedState *ss, float *x, void *y, const int clamp_u, const int clamp_l) { @@ -291,7 +291,7 @@ inline static void gdither_innner_loop_fp(const GDitherType dt, ss->buffer[ss->phase] = (float)lrintf(tmp) - ideal; break; } - + clamped = rintf(tmp); if (clamped > clamp_u) { clamped = clamp_u; diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 4d6498654f..acd7da1bc5 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -182,17 +182,17 @@ ARDOUR::setup_midi () << endmsg; return 0; } - + if (default_mtc_port == 0) { warning << string_compose (_("No MTC support (MIDI port \"%1\" not available)"), Config->get_mtc_port_name()) << endmsg; - } + } if (default_midi_port == 0) { warning << string_compose (_("No MIDI parameter support (MIDI port \"%1\" not available)"), Config->get_midi_port_name()) << endmsg; - } + } if (default_midi_clock_port == 0) { warning << string_compose (_("No MIDI Clock support (MIDI port \"%1\" not available)"), Config->get_midi_clock_port_name()) @@ -438,7 +438,7 @@ ARDOUR::find_bindings_files (map<string,string>& files) } bool -ARDOUR::no_auto_connect() +ARDOUR::no_auto_connect() { return getenv ("ARDOUR_NO_AUTOCONNECT") != 0; } @@ -569,7 +569,7 @@ ARDOUR::coverage (nframes_t sa, nframes_t ea, /* |---------------------| A |----------------- B - |----------------------- B + |----------------------- B |- B "B overlaps the end of A" diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index f98e42d051..94d26ed4da 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -80,15 +80,15 @@ open_importable_source (const string& path, nframes_t samplerate, ARDOUR::SrcQua #ifdef USE_COREAUDIO_FOR_FILE_IO /* see if we can use CoreAudio to handle the IO */ - - try { + + try { CAImportableSource* src = new CAImportableSource(path); boost::shared_ptr<CAImportableSource> source (src); - + if (source->samplerate() == samplerate) { return source; } - + /* rewrap as a resampled source */ return boost::shared_ptr<ImportableSource>(new ResampledImportableSource(source, samplerate, quality)); @@ -97,26 +97,26 @@ open_importable_source (const string& path, nframes_t samplerate, ARDOUR::SrcQua catch (...) { /* fall back to SndFile */ -#endif +#endif #endif - try { + try { boost::shared_ptr<SndFileImportableSource> source(new SndFileImportableSource(path)); - + if (source->samplerate() == samplerate) { return source; } - + /* rewrap as a resampled source */ - + return boost::shared_ptr<ImportableSource>(new ResampledImportableSource(source, samplerate, quality)); } - + catch (...) { throw; // rethrow } - -#ifdef HAVE_COREAUDIO + +#ifdef HAVE_COREAUDIO #ifdef USE_COREAUDIO_FOR_FILE_IO } #endif @@ -144,7 +144,7 @@ get_non_existent_filename (DataType type, const bool allow_replacing, const std: } else { snprintf (buf, sizeof(buf), "%s.%s", base.c_str(), ext); } - + string tempname = destdir + "/" + buf; if (!allow_replacing && Glib::file_test (tempname, Glib::FILE_TEST_EXISTS)) { @@ -183,7 +183,7 @@ get_paths_for_new_sources (const bool allow_replacing, const string& import_file ? sdir.midi_path().to_string() : sdir.sound_path().to_string(); filepath += '/'; - filepath += get_non_existent_filename (type, allow_replacing, filepath, basename, n, channels); + filepath += get_non_existent_filename (type, allow_replacing, filepath, basename, n, channels); new_paths.push_back (filepath); } @@ -223,7 +223,7 @@ create_mono_sources_for_writing (const vector<string>& new_paths, Session& sess, { const DataType type = ((*i).rfind(".mid") != string::npos) ? DataType::MIDI : DataType::AUDIO; - + source = SourceFactory::createWritable (type, sess, i->c_str(), true, false, // destructive @@ -255,7 +255,7 @@ compose_status_message (const string& path, current_file, total_files); } - return string_compose (_("copying %1\n(%2 of %3)"), + return string_compose (_("copying %1\n(%2 of %3)"), Glib::path_get_basename (path), current_file, total_files); } @@ -274,7 +274,7 @@ write_audio_data_to_new_files (ImportableSource* source, Session::ImportStatus& for (uint n = 0; n < channels; ++n) { channel_data.push_back(boost::shared_array<Sample>(new Sample[nframes])); } - + uint read_count = 0; status.progress = 0.0f; @@ -326,13 +326,13 @@ write_midi_data_to_new_files (Evoral::SMF* source, Session::ImportStatus& status for (unsigned i = 1; i <= source->num_tracks(); ++i) { boost::shared_ptr<SMFSource> smfs = boost::dynamic_pointer_cast<SMFSource>(newfiles[i-1]); smfs->drop_model(); - + source->seek_to_track(i); - + uint64_t t = 0; uint32_t delta_t = 0; uint32_t size = 0; - + while (!status.cancel) { size = buf_size; @@ -343,7 +343,7 @@ write_midi_data_to_new_files (Evoral::SMF* source, Session::ImportStatus& status if (ret < 0) { // EOT break; } - + t += delta_t; if (ret == 0) { // Meta @@ -403,7 +403,7 @@ Session::import_audiofiles (ImportStatus& status) { boost::shared_ptr<ImportableSource> source; std::auto_ptr<Evoral::SMF> smf_reader; - const DataType type = ((*p).rfind(".mid") != string::npos) ? + const DataType type = ((*p).rfind(".mid") != string::npos) ? DataType::MIDI : DataType::AUDIO; if (type == DataType::AUDIO) { @@ -476,14 +476,14 @@ Session::import_audiofiles (ImportStatus& status) if ((afs = boost::dynamic_pointer_cast<AudioFileSource>(*x)) != 0) { afs->update_header(0, *now, xnow); afs->done_with_peakfile_writes (); - + /* now that there is data there, requeue the file for analysis */ - + if (Config->get_auto_analyse_audio()) { Analyser::queue_source_for_analysis (boost::static_pointer_cast<Source>(*x), false); } } - + /* don't create tracks for empty MIDI sources (channels) */ if ((smfs = boost::dynamic_pointer_cast<SMFSource>(*x)) != 0 && smfs->is_empty()) { diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc index 807582c379..b9efaf9a18 100644 --- a/libs/ardour/internal_return.cc +++ b/libs/ardour/internal_return.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,7 +69,7 @@ InternalReturn::configure_io (ChanCount in, ChanCount out) return true; } -void +void InternalReturn::set_block_size (nframes_t nframes) { allocate_buffers (nframes); @@ -136,7 +136,7 @@ InternalReturn::set_state (const XMLNode& node) return Return::set_state (node); } -bool +bool InternalReturn::can_support_io_configuration (const ChanCount& in, ChanCount& out) const { out = in; @@ -146,5 +146,5 @@ InternalReturn::can_support_io_configuration (const ChanCount& in, ChanCount& ou bool InternalReturn::visible () const { - return false; + return false; } diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc index ad56622fc7..7d1f316c78 100644 --- a/libs/ardour/internal_send.cc +++ b/libs/ardour/internal_send.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, boost: } set_name (sendto->name()); - + _send_to->GoingAway.connect (mem_fun (*this, &InternalSend::send_to_going_away)); } @@ -79,16 +79,16 @@ InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, // we have to copy the input, because we may alter the buffers with the amp // in-place, which a send must never do. - + assert(mixbufs.available() >= bufs.count()); mixbufs.read_from (bufs, nframes); - + /* gain control */ gain_t tgain = target_gain (); - + if (tgain != _current_gain) { - + /* target gain has changed */ Amp::apply_gain (mixbufs, nframes, _current_gain, tgain); @@ -109,7 +109,7 @@ InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, Amp::apply_simple_gain (mixbufs, nframes, tgain); } - + // Can't automate gain for sends or returns yet because we need different buffers // so that we don't overwrite the main automation data for the route amp // _amp->setup_gain_automation (start_frame, end_frame, nframes); @@ -119,7 +119,7 @@ InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, /* XXX NEED TO PAN */ /* consider metering */ - + if (_metering) { if (_amp->gain_control()->get_value() == 0) { _meter->reset(); @@ -160,7 +160,7 @@ InternalSend::state (bool full) if (_send_to) { node.add_property ("target", _send_to->id().to_s()); } - + return node; } @@ -192,7 +192,7 @@ InternalSend::set_state (const XMLNode& node) connect_when_legal (); } } - + return 0; } @@ -209,8 +209,8 @@ InternalSend::connect_when_legal () if ((_send_to = _session.route_by_id (_send_to_id)) == 0) { error << X_("cannot find route to connect to") << endmsg; return -1; - } - + } + if ((target = _send_to->get_return_buffer ()) == 0) { error << X_("target for internal send has no return buffer") << endmsg; return -1; @@ -219,7 +219,7 @@ InternalSend::connect_when_legal () return 0; } -bool +bool InternalSend::can_support_io_configuration (const ChanCount& in, ChanCount& out) const { out = in; @@ -258,5 +258,5 @@ InternalSend::visible () const return true; } - return false; + return false; } diff --git a/libs/ardour/interpolation.cc b/libs/ardour/interpolation.cc index 9a45d560c0..79ec82b482 100644 --- a/libs/ardour/interpolation.cc +++ b/libs/ardour/interpolation.cc @@ -11,16 +11,16 @@ LinearInterpolation::interpolate (int channel, nframes_t nframes, Sample *input, { // index in the input buffers nframes_t i = 0; - + double acceleration; double distance = 0.0; - + if (_speed != _target_speed) { acceleration = _target_speed - _speed; } else { acceleration = 0.0; } - + distance = phase[channel]; for (nframes_t outsample = 0; outsample < nframes; ++outsample) { i = floor(distance); @@ -29,19 +29,19 @@ LinearInterpolation::interpolate (int channel, nframes_t nframes, Sample *input, fractional_phase_part -= 1.0; i++; } - + if (input && output) { // Linearly interpolate into the output buffer - output[outsample] = + output[outsample] = input[i] * (1.0f - fractional_phase_part) + input[i+1] * fractional_phase_part; } distance += _speed + acceleration; } - + i = floor(distance); phase[channel] = distance - floor(distance); - + return i; } @@ -50,16 +50,16 @@ CubicInterpolation::interpolate (int channel, nframes_t nframes, Sample *input, { // index in the input buffers nframes_t i = 0; - + double acceleration; double distance = 0.0; - + if (_speed != _target_speed) { acceleration = _target_speed - _speed; } else { acceleration = 0.0; } - + distance = phase[channel]; for (nframes_t outsample = 0; outsample < nframes; ++outsample) { i = floor(distance); @@ -68,16 +68,16 @@ CubicInterpolation::interpolate (int channel, nframes_t nframes, Sample *input, fractional_phase_part -= 1.0; i++; } - + if (input && output) { // Cubically interpolate into the output buffer output[outsample] = cube_interp(fractional_phase_part, input[i-1], input[i], input[i+1], input[i+2]); } distance += _speed + acceleration; } - + i = floor(distance); phase[channel] = distance - floor(distance); - + return i; } diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 2749b9f405..9811cfed3a 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ #include <cmath> /* - A bug in OS X's cmath that causes isnan() and isinf() to be + A bug in OS X's cmath that causes isnan() and isinf() to be "undeclared". the following works around that */ @@ -128,7 +128,7 @@ void IO::check_bundles (std::vector<UserBundleInfo>& list, const PortSet& ports) { std::vector<UserBundleInfo> new_list; - + for (std::vector<UserBundleInfo>::iterator i = list.begin(); i != list.end(); ++i) { uint32_t const N = i->bundle->nchannels (); @@ -172,20 +172,20 @@ IO::disconnect (Port* our_port, string other_port, void* src) return 0; } - { + { BLOCK_PROCESS_CALLBACK (); - + { Glib::Mutex::Lock lm (io_lock); - + /* check that our_port is really one of ours */ - + if ( ! _ports.contains(our_port)) { return -1; } - + /* disconnect it from the source */ - + if (our_port->disconnect (other_port)) { error << string_compose(_("IO: cannot disconnect port %1 from %2"), our_port->name(), other_port) << endmsg; return -1; @@ -210,16 +210,16 @@ IO::connect (Port* our_port, string other_port, void* src) { BLOCK_PROCESS_CALLBACK (); - + { Glib::Mutex::Lock lm (io_lock); - + /* check that our_port is really one of ours */ - + if ( ! _ports.contains(our_port) ) { return -1; } - + /* connect it to the source */ if (our_port->connect (other_port)) { @@ -241,7 +241,7 @@ IO::remove_port (Port* port, void* src) { BLOCK_PROCESS_CALLBACK (); - + { Glib::Mutex::Lock lm (io_lock); @@ -250,7 +250,7 @@ IO::remove_port (Port* port, void* src) if (port->connected()) { change = IOChange (change|ConnectionsChanged); - } + } _session.engine().unregister_port (*port); check_bundles_connected (); @@ -291,12 +291,12 @@ IO::add_port (string destination, void* src, DataType type) { BLOCK_PROCESS_CALLBACK (); - - { + + { Glib::Mutex::Lock lm (io_lock); - + /* Create a new output port */ - + string portname = build_legal_port_name (type); if (_direction == Input) { @@ -322,7 +322,7 @@ IO::add_port (string destination, void* src, DataType type) return -1; } } - + // pan_changed (src); /* EMIT SIGNAL */ changed (ConfigurationChanged, src); /* EMIT SIGNAL */ setup_bundles (); @@ -334,12 +334,12 @@ IO::add_port (string destination, void* src, DataType type) int IO::disconnect (void* src) { - { + { BLOCK_PROCESS_CALLBACK (); - + { Glib::Mutex::Lock lm (io_lock); - + for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) { i->disconnect_all (); } @@ -347,9 +347,9 @@ IO::disconnect (void* src) check_bundles_connected (); } } - + changed (ConnectionsChanged, src); /* EMIT SIGNAL */ - + return 0; } @@ -358,15 +358,15 @@ IO::ensure_ports_locked (ChanCount count, bool clear, void* /*src*/) { Port* port = 0; bool changed = false; - + for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { - + const size_t n = count.get(*t); - + /* remove unused ports */ for (size_t i = n_ports().get(*t); i > n; --i) { port = _ports.port(*t, i-1); - + assert(port); _ports.remove(port); _session.engine().unregister_port (*port); @@ -403,13 +403,13 @@ IO::ensure_ports_locked (ChanCount count, bool clear, void* /*src*/) changed = true; } } - + if (changed) { check_bundles_connected (); PortCountChanged (n_ports()); /* EMIT SIGNAL */ _session.set_dirty (); } - + if (clear) { /* disconnect all existing ports so that we get a fresh start */ for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) { @@ -483,7 +483,7 @@ IO::state (bool /*full_state*/) } for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) { - + vector<string> connections; XMLNode* pnode = new XMLNode (X_("Port")); @@ -500,14 +500,14 @@ IO::state (bool /*full_state*/) to be re-established even when our client name is different. */ - + XMLNode* cnode = new XMLNode (X_("Connection")); cnode->add_property (X_("other"), _session.engine().make_port_name_relative (*ci)); pnode->add_child_nocopy (*cnode); - } + } } - + node->add_child_nocopy (*pnode); } @@ -529,7 +529,7 @@ IO::set_state (const XMLNode& node) error << string_compose(_("incorrect XML node \"%1\" passed to IO object"), node.name()) << endmsg; return -1; } - + if ((prop = node.property ("name")) != 0) { set_name (prop->value()); } @@ -552,7 +552,7 @@ IO::set_state (const XMLNode& node) } if (connecting_legal) { - + if (make_connections (node)) { return -1; } @@ -577,7 +577,7 @@ IO::connecting_became_legal () connection_legal_c.disconnect (); ret = make_connections (*pending_state_node); - + delete pending_state_node; pending_state_node = 0; @@ -590,7 +590,7 @@ IO::find_possible_bundle (const string &desired_name) static const string digits = "0123456789"; const string &default_name = (_direction == Input ? _("in") : _("out")); const string &bundle_type_name = (_direction == Input ? _("input") : _("output")); - + boost::shared_ptr<Bundle> c = _session.bundle_by_name (desired_name); if (!c) { @@ -604,7 +604,7 @@ IO::find_possible_bundle (const string &desired_name) // find numeric suffix of desired name bundle_number = 0; - + last_non_digit_pos = desired_name.find_last_not_of(digits); if (last_non_digit_pos != string::npos) { @@ -612,7 +612,7 @@ IO::find_possible_bundle (const string &desired_name) s << desired_name.substr(last_non_digit_pos); s >> bundle_number; } - + // see if it's a stereo connection e.g. "in 3+4" if (last_non_digit_pos > 1 && desired_name[last_non_digit_pos] == '+') { @@ -640,22 +640,22 @@ IO::find_possible_bundle (const string &desired_name) // find highest set bit mask = 1; while ((mask <= bundle_number) && (mask <<= 1)) {} - - // "wrap" bundle number into largest possible power of 2 + + // "wrap" bundle number into largest possible power of 2 // that works... while (mask) { if (bundle_number & mask) { bundle_number &= ~mask; - + stringstream s; s << default_name << " " << bundle_number + 1; if (stereo) { s << "+" << bundle_number + 2; } - + possible_name = s.str(); if ((c = _session.bundle_by_name (possible_name)) != 0) { @@ -696,7 +696,7 @@ IO::get_port_counts (const XMLNode& node, ChanCount& n, boost::shared_ptr<Bundle } return 0; } - + for (iter = node.children().begin(); iter != node.children().end(); ++iter) { if ((*iter)->name() == X_("Bundle")) { @@ -722,7 +722,7 @@ IO::get_port_counts (const XMLNode& node, ChanCount& n, boost::shared_ptr<Bundle } } } - + n = ChanCount::max (n, cnt); return 0; } @@ -732,9 +732,9 @@ IO::create_ports (const XMLNode& node) { ChanCount n; boost::shared_ptr<Bundle> c; - + get_port_counts (node, n, c); - + if (ensure_ports (n, true, true, this)) { error << string_compose(_("%1: cannot create I/O ports"), _name) << endmsg; return -1; @@ -771,22 +771,22 @@ IO::make_connections (const XMLNode& node) if (!prop) { continue; } - + Port* p = port_by_name (prop->value()); if (p) { - for (XMLNodeConstIterator c = (*i)->children().begin(); c != (*i)->children().end(); ++c) { + for (XMLNodeConstIterator c = (*i)->children().begin(); c != (*i)->children().end(); ++c) { XMLNode* cnode = (*c); - + if (cnode->name() != X_("Connection")) { continue; } - + if ((prop = cnode->property (X_("other"))) == 0) { continue; } - + if (prop) { p->connect (prop->value()); } @@ -794,7 +794,7 @@ IO::make_connections (const XMLNode& node) } } } - + return 0; } @@ -805,7 +805,7 @@ IO::set_ports (const string& str) int i; int n; uint32_t nports; - + if ((nports = count (str.begin(), str.end(), '{')) == 0) { return 0; } @@ -834,7 +834,7 @@ IO::set_ports (const string& str) error << string_compose(_("bad input string in XML node \"%1\""), str) << endmsg; return -1; - + } else if (n > 0) { for (int x = 0; x < n; ++x) { @@ -867,7 +867,7 @@ IO::parse_io_string (const string& str, vector<string>& ports) ports.push_back (str.substr (opos, pos - opos)); opos = pos + 1; } - + if (opos < str.length()) { ports.push_back (str.substr(opos)); } @@ -888,7 +888,7 @@ IO::parse_gain_string (const string& str, vector<string>& ports) ports.push_back (str.substr (opos, pos - opos)); opos = pos + 1; } - + if (opos < str.length()) { ports.push_back (str.substr(opos)); } @@ -904,7 +904,7 @@ IO::set_name (const string& requested_name) if (name == _name) { return true; } - + /* replace all colons in the name. i wish we didn't have to do this */ if (replace_all (name, ":", "-")) { @@ -947,7 +947,7 @@ IO::latency () const for (PortSet::const_iterator i = _ports.begin(); i != _ports.end(); ++i) { if ((latency = i->total_latency ()) > max_latency) { max_latency = latency; - } + } } return max_latency; @@ -1002,7 +1002,7 @@ IO::disconnect_ports_from_bundle (boost::shared_ptr<Bundle> c, void* src) Glib::Mutex::Lock lm2 (io_lock); c->disconnect (_bundle, _session.engine()); - + /* If this is a UserBundle, make a note of what we've done */ boost::shared_ptr<UserBundle> ub = boost::dynamic_pointer_cast<UserBundle> (c); @@ -1060,7 +1060,7 @@ IO::build_legal_port_name (DataType type) } else { throw unknown_type(); } - + /* note that if "in" or "out" are translated it will break a session across locale switches because a port's connection list will show (old) translated names, but the current port name will @@ -1079,9 +1079,9 @@ IO::build_legal_port_name (DataType type) char buf1[name_size+1]; char buf2[name_size+1]; - + snprintf (buf1, name_size+1, ("%.*s/%s"), limit, _name.c_str(), suffix.c_str()); - + int port_number = find_port_hole (buf1); snprintf (buf2, name_size+1, "%s %d", buf1, port_number); @@ -1205,7 +1205,7 @@ IO::bundles_connected () } } } - + return bundles; } @@ -1222,7 +1222,7 @@ std::string IO::bundle_channel_name (uint32_t c, uint32_t n) const { char buf[32]; - + switch (n) { case 1: return _("mono"); @@ -1240,11 +1240,11 @@ string IO::name_from_state (const XMLNode& node) { const XMLProperty* prop; - + if ((prop = node.property ("name")) != 0) { return prop->value(); - } - + } + return string(); } @@ -1252,10 +1252,10 @@ void IO::set_name_in_state (XMLNode& node, const string& new_name) { const XMLProperty* prop; - + if ((prop = node.property ("name")) != 0) { node.add_property ("name", new_name); - } + } } bool @@ -1278,7 +1278,7 @@ IO::connected_to (boost::shared_ptr<const IO> other) const uint32_t i, j; uint32_t no = n_ports().n_total(); uint32_t ni = other->n_ports ().n_total(); - + for (i = 0; i < no; ++i) { for (j = 0; j < ni; ++j) { if (nth(i)->connected_to (other->nth(j)->name())) { @@ -1305,7 +1305,7 @@ void IO::collect_input (BufferSet& bufs, nframes_t nframes, ChanCount offset) { assert(bufs.available() >= _ports.count()); - + if (_ports.count() == ChanCount::ZERO) { return; } @@ -1333,7 +1333,7 @@ void IO::copy_to_outputs (BufferSet& bufs, DataType type, nframes_t nframes, nframes_t offset) { // Copy any buffers 1:1 to outputs - + PortSet::iterator o = _ports.begin(type); BufferSet::iterator i = bufs.begin(type); BufferSet::iterator prev = i; @@ -1345,7 +1345,7 @@ IO::copy_to_outputs (BufferSet& bufs, DataType type, nframes_t nframes, nframes_ ++i; ++o; } - + // Copy last buffer to any extra outputs while (o != _ports.end(type)) { diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc index 1408cdcafb..af07f7242a 100644 --- a/libs/ardour/io_processor.cc +++ b/libs/ardour/io_processor.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -68,7 +68,7 @@ IOProcessor::IOProcessor (Session& s, bool with_input, bool with_output, /* create an IOProcessor that proxies to an existing IO object */ -IOProcessor::IOProcessor (Session& s, boost::shared_ptr<IO> in, boost::shared_ptr<IO> out, +IOProcessor::IOProcessor (Session& s, boost::shared_ptr<IO> in, boost::shared_ptr<IO> out, const string& proc_name, DataType /*dtype*/) : Processor(s, proc_name) , _input (in) @@ -114,7 +114,7 @@ XMLNode& IOProcessor::state (bool full_state) { XMLNode& node (Processor::state (full_state)); - + if (_own_input) { node.add_property ("own-input", "yes"); if (_input) { @@ -128,7 +128,7 @@ IOProcessor::state (bool full_state) node.add_property ("input", _input->name()); } } - + if (_own_output) { node.add_property ("own-output", "yes"); if (_output) { @@ -166,7 +166,7 @@ IOProcessor::set_state (const XMLNode& node) XMLNodeList nlist = node.children(); XMLNodeIterator niter; - + if (_own_input) { for (niter = nlist.begin(); niter != nlist.end(); ++niter) { if ((*niter)->name() == "input") { @@ -174,21 +174,21 @@ IOProcessor::set_state (const XMLNode& node) break; } } - + if (io_node) { _input->set_state(*io_node); - + // legacy sessions: use IO name if ((prop = node.property ("name")) == 0) { set_name (_input->name()); } - + } else { /* no input */ } } - + if (_own_output) { for (niter = nlist.begin(); niter != nlist.end(); ++niter) { if ((*niter)->name() == "output") { @@ -196,10 +196,10 @@ IOProcessor::set_state (const XMLNode& node) break; } } - + if (io_node) { _output->set_state(*io_node); - + // legacy sessions: use IO name if ((prop = node.property ("name")) == 0) { set_name (_output->name()); diff --git a/libs/ardour/jack_slave.cc b/libs/ardour/jack_slave.cc index 289b0a8fa9..9f92f1b21f 100644 --- a/libs/ardour/jack_slave.cc +++ b/libs/ardour/jack_slave.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,8 +63,8 @@ JACK_Slave::ok() const return true; } -bool -JACK_Slave::speed_and_position (double& sp, nframes_t& position) +bool +JACK_Slave::speed_and_position (double& sp, nframes_t& position) { jack_position_t pos; jack_transport_state_t state; diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index 06a67aca08..70a8390de1 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -102,7 +102,7 @@ LadspaPlugin::init (void *mod, uint32_t index, nframes_t rate) error << string_compose(_("LADSPA: \"%1\" cannot be used, since it cannot do inplace processing"), _descriptor->Name) << endmsg; throw failed_constructor(); } - + _sample_rate = rate; if (_descriptor->instantiate == 0) { @@ -121,7 +121,7 @@ LadspaPlugin::init (void *mod, uint32_t index, nframes_t rate) for (i = 0; i < port_cnt; ++i) { if (LADSPA_IS_PORT_CONTROL(port_descriptor (i))) { connect_port (i, &_control_data[i]); - + if (LADSPA_IS_PORT_OUTPUT(port_descriptor (i)) && strcmp (port_names()[i], X_("latency")) == 0) { _latency_control_port = &_control_data[i]; @@ -131,7 +131,7 @@ LadspaPlugin::init (void *mod, uint32_t index, nframes_t rate) if (!LADSPA_IS_PORT_INPUT(port_descriptor (i))) { continue; } - + _shadow_data[i] = default_value (i); } } @@ -145,7 +145,7 @@ LadspaPlugin::~LadspaPlugin () cleanup (); GoingAway (); /* EMIT SIGNAL */ - + /* XXX who should close a plugin? */ // dlclose (module); @@ -172,16 +172,16 @@ LadspaPlugin::default_value (uint32_t port) bool earlier_hint = false; /* defaults - case 1 */ - + if (LADSPA_IS_HINT_HAS_DEFAULT(prh[port].HintDescriptor)) { if (LADSPA_IS_HINT_DEFAULT_MINIMUM(prh[port].HintDescriptor)) { ret = prh[port].LowerBound; bounds_given = true; sr_scaling = true; } - + /* FIXME: add support for logarithmic defaults */ - + else if (LADSPA_IS_HINT_DEFAULT_LOW(prh[port].HintDescriptor)) { if (LADSPA_IS_HINT_LOGARITHMIC(prh[port].HintDescriptor)) { ret = exp(log(prh[port].LowerBound) * 0.75f + log(prh[port].UpperBound) * 0.25f); @@ -238,11 +238,11 @@ LadspaPlugin::default_value (uint32_t port) ret = 0.0f; } } - + /* defaults - case 2 */ else if (LADSPA_IS_HINT_BOUNDED_BELOW(prh[port].HintDescriptor) && !LADSPA_IS_HINT_BOUNDED_ABOVE(prh[port].HintDescriptor)) { - + if (prh[port].LowerBound < 0) { ret = 0.0f; } else { @@ -252,11 +252,11 @@ LadspaPlugin::default_value (uint32_t port) bounds_given = true; sr_scaling = true; } - + /* defaults - case 3 */ else if (!LADSPA_IS_HINT_BOUNDED_BELOW(prh[port].HintDescriptor) && LADSPA_IS_HINT_BOUNDED_ABOVE(prh[port].HintDescriptor)) { - + if (prh[port].UpperBound > 0) { ret = 0.0f; } else { @@ -266,11 +266,11 @@ LadspaPlugin::default_value (uint32_t port) bounds_given = true; sr_scaling = true; } - + /* defaults - case 4 */ else if (LADSPA_IS_HINT_BOUNDED_BELOW(prh[port].HintDescriptor) && LADSPA_IS_HINT_BOUNDED_ABOVE(prh[port].HintDescriptor)) { - + if (prh[port].LowerBound < 0 && prh[port].UpperBound > 0) { ret = 0.0f; } else if (prh[port].LowerBound < 0 && prh[port].UpperBound < 0) { @@ -278,12 +278,12 @@ LadspaPlugin::default_value (uint32_t port) } else { ret = prh[port].LowerBound; } - bounds_given = true; + bounds_given = true; sr_scaling = true; } - + /* defaults - case 5 */ - + if (LADSPA_IS_HINT_SAMPLE_RATE(prh[port].HintDescriptor) && !earlier_hint) { if (bounds_given) { if (sr_scaling) { @@ -295,7 +295,7 @@ LadspaPlugin::default_value (uint32_t port) } return ret; -} +} void LadspaPlugin::set_parameter (uint32_t which, float val) @@ -309,7 +309,7 @@ LadspaPlugin::set_parameter (uint32_t which, float val) controls[which]->Changed (); } #endif - + } else { warning << string_compose (_("illegal parameter number used with plugin \"%1\". This may" "indicate a change in the plugin design, and presets may be" @@ -356,7 +356,7 @@ LadspaPlugin::get_state() for (uint32_t i = 0; i < parameter_count(); ++i){ - if (LADSPA_IS_PORT_INPUT(port_descriptor (i)) && + if (LADSPA_IS_PORT_INPUT(port_descriptor (i)) && LADSPA_IS_PORT_CONTROL(port_descriptor (i))){ child = new XMLNode("Port"); @@ -428,7 +428,7 @@ LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& des LADSPA_PortRangeHint prh; prh = port_range_hints()[which]; - + if (LADSPA_IS_HINT_BOUNDED_BELOW(prh.HintDescriptor)) { desc.min_unbound = false; @@ -441,7 +441,7 @@ LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& des desc.min_unbound = true; desc.lower = 0; } - + if (LADSPA_IS_HINT_BOUNDED_ABOVE(prh.HintDescriptor)) { desc.max_unbound = false; @@ -454,7 +454,7 @@ LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& des desc.max_unbound = true; desc.upper = 4; /* completely arbitrary */ } - + if (LADSPA_IS_HINT_INTEGER (prh.HintDescriptor)) { desc.step = 1.0; desc.smallstep = 0.1; @@ -465,7 +465,7 @@ LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& des desc.smallstep = delta / 10000.0f; desc.largestep = delta/10.0f; } - + desc.toggled = LADSPA_IS_HINT_TOGGLED (prh.HintDescriptor); desc.logarithmic = LADSPA_IS_HINT_LOGARITHMIC (prh.HintDescriptor); desc.sr_dependent = LADSPA_IS_HINT_SAMPLE_RATE (prh.HintDescriptor); @@ -506,9 +506,9 @@ LadspaPlugin::automatable () const set<Evoral::Parameter> ret; for (uint32_t i = 0; i < parameter_count(); ++i){ - if (LADSPA_IS_PORT_INPUT(port_descriptor (i)) && + if (LADSPA_IS_PORT_INPUT(port_descriptor (i)) && LADSPA_IS_PORT_CONTROL(port_descriptor (i))){ - + ret.insert (ret.end(), Evoral::Parameter(PluginAutomation, 0, i)); } } @@ -537,7 +537,7 @@ LadspaPlugin::connect_and_run (BufferSet& bufs, } } } - + run_in_place (nframes); now = get_cycles (); set_cycles ((uint32_t) (now - then)); @@ -602,9 +602,9 @@ LadspaPlugin::latency_compute_run () /* we need to run the plugin so that it can set its latency parameter. */ - + activate (); - + uint32_t port_index = 0; uint32_t in_index = 0; uint32_t out_index = 0; @@ -612,13 +612,13 @@ LadspaPlugin::latency_compute_run () LADSPA_Data buffer[bufsize]; memset(buffer,0,sizeof(LADSPA_Data)*bufsize); - + /* Note that we've already required that plugins be able to handle in-place processing. */ - + port_index = 0; - + while (port_index < parameter_count()) { if (LADSPA_IS_PORT_AUDIO (port_descriptor (port_index))) { if (LADSPA_IS_PORT_INPUT (port_descriptor (port_index))) { @@ -631,7 +631,7 @@ LadspaPlugin::latency_compute_run () } port_index++; } - + run_in_place (bufsize); deactivate (); } @@ -656,5 +656,5 @@ LadspaPluginInfo::load (Session& session) catch (failed_constructor &err) { return PluginPtr ((Plugin*) 0); - } + } } diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index c232b9738e..4db398e534 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -83,7 +83,7 @@ Location::operator= (const Location& other) _locked = false; /* "changed" not emitted on purpose */ - + return this; } @@ -121,7 +121,7 @@ Location::set_start (nframes64_t s) } if (s != _start) { - _start = s; + _start = s; start_changed(this); /* EMIT SIGNAL */ } @@ -159,7 +159,7 @@ Location::set_end (nframes64_t e) } if (e != _end) { - _end = e; + _end = e; end_changed(this); /* EMIT SIGNAL */ } return 0; @@ -177,7 +177,7 @@ Location::set (nframes64_t start, nframes64_t end) } else if (((is_auto_punch() || is_auto_loop()) && start >= end) || (start > end)) { return -1; } - + if (_start != start) { _start = start; start_changed(this); /* EMIT SIGNAL */ @@ -191,7 +191,7 @@ Location::set (nframes64_t start, nframes64_t end) } int -Location::move_to (nframes64_t pos) +Location::move_to (nframes64_t pos) { if (_locked) { return -1; @@ -200,10 +200,10 @@ Location::move_to (nframes64_t pos) if (_start != pos) { _start = pos; _end = _start + length(); - + changed (this); /* EMIT SIGNAL */ } - + return 0; } @@ -256,7 +256,7 @@ Location::set_is_range_marker (bool yn, void *src) } void -Location::set_auto_punch (bool yn, void *src) +Location::set_auto_punch (bool yn, void *src) { if (is_mark() || _start == _end) { return; @@ -268,7 +268,7 @@ Location::set_auto_punch (bool yn, void *src) } void -Location::set_auto_loop (bool yn, void *src) +Location::set_auto_loop (bool yn, void *src) { if (is_mark() || _start == _end) { return; @@ -304,7 +304,7 @@ Location::set_mark (bool yn) if (_start != _end) { return; } - + set_flag_internal (yn, IsMark); } @@ -316,11 +316,11 @@ Location::cd_info_node(const string & name, const string & value) root->add_property("name", name); root->add_property("value", value); - + return *root; } - + XMLNode& Location::get_state (void) { @@ -354,7 +354,7 @@ Location::set_state (const XMLNode& node) XMLNodeList cd_list = node.children(); XMLNodeConstIterator cd_iter; XMLNode *cd_node; - + string cd_name; string cd_value; @@ -373,32 +373,32 @@ Location::set_state (const XMLNode& node) error << _("XML node for Location has no name information") << endmsg; return -1; } - + set_name (prop->value()); - + if ((prop = node.property ("start")) == 0) { - error << _("XML node for Location has no start information") << endmsg; + error << _("XML node for Location has no start information") << endmsg; return -1; } - + /* can't use set_start() here, because _end may make the value of _start illegal. */ - + sscanf (prop->value().c_str(), "%" PRId64, &_start); - + if ((prop = node.property ("end")) == 0) { - error << _("XML node for Location has no end information") << endmsg; + error << _("XML node for Location has no end information") << endmsg; return -1; } - + sscanf (prop->value().c_str(), "%" PRId64, &_end); - + if ((prop = node.property ("flags")) == 0) { - error << _("XML node for Location has no flags information") << endmsg; + error << _("XML node for Location has no flags information") << endmsg; return -1; } - + _flags = Flags (string_2_enum (prop->value(), _flags)); if ((prop = node.property ("locked")) != 0) { @@ -408,32 +408,32 @@ Location::set_state (const XMLNode& node) } for (cd_iter = cd_list.begin(); cd_iter != cd_list.end(); ++cd_iter) { - + cd_node = *cd_iter; - + if (cd_node->name() != "CD-Info") { continue; } - + if ((prop = cd_node->property ("name")) != 0) { cd_name = prop->value(); } else { throw failed_constructor (); } - + if ((prop = cd_node->property ("value")) != 0) { cd_value = prop->value(); } else { throw failed_constructor (); } - - + + cd_info[cd_name] = cd_value; - + } changed(this); /* EMIT SIGNAL */ - + return 0; } @@ -445,7 +445,7 @@ Locations::Locations () current_location = 0; } -Locations::~Locations () +Locations::~Locations () { for (LocationList::iterator i = locations.begin(); i != locations.end(); ) { LocationList::iterator tmp = i; @@ -499,7 +499,7 @@ Locations::next_available_name(string& result,string base) } } for (int k=1; k<=SUFFIX_MAX; k++) { - if (available[k]) { + if (available[k]) { snprintf (buf, 31, "%d", k); result += buf; return 1; @@ -515,7 +515,7 @@ Locations::set_current_unlocked (Location *loc) error << _("Locations: attempt to use unknown location as selected location") << endmsg; return -1; } - + current_location = loc; return 0; } @@ -543,7 +543,7 @@ Locations::clear () changed (); /* EMIT SIGNAL */ current_changed (0); /* EMIT SIGNAL */ -} +} void Locations::clear_markers () @@ -565,7 +565,7 @@ Locations::clear_markers () } changed (); /* EMIT SIGNAL */ -} +} void Locations::clear_ranges () @@ -573,7 +573,7 @@ Locations::clear_ranges () { Glib::Mutex::Lock lm (lock); LocationList::iterator tmp; - + for (LocationList::iterator i = locations.begin(); i != locations.end(); ) { tmp = i; @@ -592,7 +592,7 @@ Locations::clear_ranges () changed (); /* EMIT SIGNAL */ current_changed (0); /* EMIT SIGNAL */ -} +} void Locations::add (Location *loc, bool make_current) @@ -605,12 +605,12 @@ Locations::add (Location *loc, bool make_current) current_location = loc; } } - + added (loc); /* EMIT SIGNAL */ if (make_current) { current_changed (current_location); /* EMIT SIGNAL */ - } + } } void @@ -640,9 +640,9 @@ Locations::remove (Location *loc) } } } - + if (was_removed) { - + removed (loc); /* EMIT SIGNAL */ if (was_current) { @@ -665,13 +665,13 @@ Locations::get_state () XMLNode *node = new XMLNode ("Locations"); LocationList::iterator iter; Glib::Mutex::Lock lm (lock); - + for (iter = locations.begin(); iter != locations.end(); ++iter) { node->add_child_nocopy ((*iter)->get_state ()); } return *node; -} +} int Locations::set_state (const XMLNode& node) @@ -683,7 +683,7 @@ Locations::set_state (const XMLNode& node) error << _("incorrect XML mode passed to Locations::set_state") << endmsg; return -1; } - + nlist = node.children(); locations.clear (); @@ -693,7 +693,7 @@ Locations::set_state (const XMLNode& node) Glib::Mutex::Lock lm (lock); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - + try { Location *loc = new Location (**niter); @@ -704,7 +704,7 @@ Locations::set_state (const XMLNode& node) error << _("could not load location from session file - ignored") << endmsg; } } - + if (locations.size()) { current_location = locations.front(); @@ -714,18 +714,18 @@ Locations::set_state (const XMLNode& node) } changed (); /* EMIT SIGNAL */ - + return 0; -} +} -struct LocationStartEarlierComparison +struct LocationStartEarlierComparison { bool operator() (Location *a, Location *b) { return a->start() < b->start(); } }; -struct LocationStartLaterComparison +struct LocationStartLaterComparison { bool operator() (Location *a, Location *b) { return a->start() > b->start(); @@ -746,7 +746,7 @@ Locations::first_location_before (nframes64_t frame, bool include_special_ranges locs.sort (cmp); /* locs is now sorted latest..earliest */ - + for (LocationList::iterator i = locs.begin(); i != locs.end(); ++i) { if (!include_special_ranges && ((*i)->is_auto_loop() || (*i)->is_auto_punch())) { continue; @@ -773,7 +773,7 @@ Locations::first_location_after (nframes64_t frame, bool include_special_ranges) locs.sort (cmp); /* locs is now sorted earliest..latest */ - + for (LocationList::iterator i = locs.begin(); i != locs.end(); ++i) { if (!include_special_ranges && ((*i)->is_auto_loop() || (*i)->is_auto_punch())) { continue; @@ -800,7 +800,7 @@ Locations::first_mark_before (nframes64_t frame, bool include_special_ranges) locs.sort (cmp); /* locs is now sorted latest..earliest */ - + for (LocationList::iterator i = locs.begin(); i != locs.end(); ++i) { if (!include_special_ranges && ((*i)->is_auto_loop() || (*i)->is_auto_punch())) { continue; @@ -840,7 +840,7 @@ Locations::first_mark_after (nframes64_t frame, bool include_special_ranges) locs.sort (cmp); /* locs is now sorted earliest..latest */ - + for (LocationList::iterator i = locs.begin(); i != locs.end(); ++i) { if (!include_special_ranges && ((*i)->is_auto_loop() || (*i)->is_auto_punch())) { continue; @@ -875,7 +875,7 @@ Locations::end_location () const } } return 0; -} +} Location* Locations::start_location () const @@ -886,7 +886,7 @@ Locations::start_location () const } } return 0; -} +} Location* Locations::auto_loop_location () const @@ -897,7 +897,7 @@ Locations::auto_loop_location () const } } return 0; -} +} Location* Locations::auto_punch_location () const @@ -908,7 +908,7 @@ Locations::auto_punch_location () const } } return 0; -} +} uint32_t Locations::num_range_markers () const @@ -940,7 +940,7 @@ Locations::find_all_between (nframes64_t start, nframes64_t end, LocationList& l Glib::Mutex::Lock lm (lock); for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) { - if ((flags == 0 || (*i)->matches (flags)) && + if ((flags == 0 || (*i)->matches (flags)) && ((*i)->start() >= start && (*i)->end() < end)) { ll.push_back (*i); } diff --git a/libs/ardour/location_importer.cc b/libs/ardour/location_importer.cc index 31a49e44f5..fd74e802a7 100644 --- a/libs/ardour/location_importer.cc +++ b/libs/ardour/location_importer.cc @@ -39,11 +39,11 @@ LocationImportHandler::LocationImportHandler (XMLTree const & source, Session & { XMLNode const *root = source.root(); XMLNode const * location_node; - + if (!(location_node = root->child ("Locations"))) { throw failed_constructor(); } - + // Construct importable locations XMLNodeList const & locations = location_node->children(); for (XMLNodeList::const_iterator it = locations.begin(); it != locations.end(); it++) { @@ -62,7 +62,7 @@ LocationImportHandler::get_info () const } /*** LocationImporter ***/ -LocationImporter::LocationImporter (XMLTree const & source, Session & session, LocationImportHandler & handler, XMLNode const & node) : +LocationImporter::LocationImporter (XMLTree const & source, Session & session, LocationImportHandler & handler, XMLNode const & node) : ElementImporter (source, session), handler (handler), xml_location (node), @@ -71,7 +71,7 @@ LocationImporter::LocationImporter (XMLTree const & source, Session & session, L // Parse XML bool name_ok = false; XMLPropertyList props = xml_location.properties(); - + for (XMLPropertyIterator it = props.begin(); it != props.end(); ++it) { string prop = (*it)->name(); if (!prop.compare ("id") || !prop.compare ("flags") || !prop.compare ("locked")) { @@ -87,7 +87,7 @@ LocationImporter::LocationImporter (XMLTree const & source, Session & session, L std::cerr << string_compose (X_("LocationImporter did not recognise XML-property \"%1\""), prop) << endmsg; } } - + if (!name_ok) { error << X_("LocationImporter did not find necessary XML-property \"name\"") << endmsg; throw failed_constructor(); @@ -106,17 +106,17 @@ LocationImporter::get_info () const { nframes_t start, end; SMPTE::Time start_time, end_time; - + // Get sample positions std::istringstream iss_start (xml_location.property ("start")->value()); iss_start >> start; std::istringstream iss_end (xml_location.property ("end")->value()); iss_end >> end; - + // Convert to smpte session.sample_to_smpte (start, start_time, true, false); session.sample_to_smpte (end, end_time, true, false); - + // return info std::ostringstream oss; if (start == end) { @@ -125,7 +125,7 @@ LocationImporter::get_info () const oss << _("Range\nstart: ") << smpte_to_string (start_time) << _("\nend: ") << smpte_to_string (end_time); } - + return oss.str(); } @@ -137,30 +137,30 @@ LocationImporter::_prepare_move () location = new Location (original); // Updates id } catch (failed_constructor& err) { throw std::runtime_error (X_("Error in session file!")); - return false; + return false; } - + std::pair<bool, string> rename_pair; - + if (location->is_auto_punch()) { rename_pair = Rename (_("The location is the Punch range. It will be imported as a normal range.\nYou may rename the imported location:"), name); if (!rename_pair.first) { return false; } - + name = rename_pair.second; location->set_auto_punch (false, this); location->set_is_range_marker (true, this); } - + if (location->is_auto_loop()) { rename_pair = Rename (_("The location is a Loop range. It will be imported as a normal range.\nYou may rename the imported location:"), name); if (!rename_pair.first) { return false; } - + location->set_auto_loop (false, this); location->set_is_range_marker (true, this); } - + // duplicate name checking Locations::LocationList const & locations(session.locations()->list()); for (Locations::LocationList::const_iterator it = locations.begin(); it != locations.end(); ++it) { @@ -170,7 +170,7 @@ LocationImporter::_prepare_move () name = rename_pair.second; } } - + location->set_name (name); return true; @@ -178,7 +178,7 @@ LocationImporter::_prepare_move () void LocationImporter::_cancel_move () -{ +{ delete location; location = 0; } diff --git a/libs/ardour/lv2_event_buffer.cc b/libs/ardour/lv2_event_buffer.cc index 88ecfe1433..9bc61d93d1 100644 --- a/libs/ardour/lv2_event_buffer.cc +++ b/libs/ardour/lv2_event_buffer.cc @@ -1,17 +1,17 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -99,14 +99,14 @@ LV2EventBuffer::is_valid() const /** Read an event from the current position in the buffer - * + * * \return true if read was successful, or false if end of buffer reached */ bool LV2EventBuffer::get_event(uint32_t* frames, - uint32_t* subframes, - uint16_t* type, - uint16_t* size, + uint32_t* subframes, + uint16_t* type, + uint16_t* size, uint8_t** data) const { if (lv2_event_is_valid(&_iter)) { @@ -188,7 +188,7 @@ LV2EventBuffer::append(const LV2_Event_Buffer* /*buf*/) _latest_frames = ev->frames; _latest_subframes = ev->subframes; } - + return ret; } diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index c6f18da80e..0fb766e7d4 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -82,7 +82,7 @@ LV2Plugin::init (LV2World& world, SLV2Plugin plugin, nframes_t rate) _shadow_data = 0; _latency_control_port = 0; _was_activated = false; - + _instance = slv2_plugin_instantiate(plugin, rate, _features); _name = slv2_plugin_get_name(plugin); assert(_name); @@ -101,14 +101,14 @@ LV2Plugin::init (LV2World& world, SLV2Plugin plugin, nframes_t rate) slv2_value_free(_author); throw failed_constructor(); } - + _instance_access_feature.URI = "http://lv2plug.in/ns/ext/instance-access"; _instance_access_feature.data = (void*)_instance->lv2_handle; _data_access_extension_data.extension_data = _instance->lv2_descriptor->extension_data; _data_access_feature.URI = "http://lv2plug.in/ns/ext/data-access"; _data_access_feature.data = &_data_access_extension_data; - + _features = (LV2_Feature**)malloc(sizeof(LV2_Feature*) * 4); _features[0] = &_instance_access_feature; _features[1] = &_data_access_feature; @@ -150,7 +150,7 @@ LV2Plugin::init (LV2World& world, SLV2Plugin plugin, nframes_t rate) _defaults[i] = 0.0f; } } - + SLV2UIs uis = slv2_plugin_get_uis(_plugin); if (slv2_uis_size(uis) > 0) { for (unsigned i=0; i < slv2_uis_size(uis); ++i) { @@ -182,7 +182,7 @@ LV2Plugin::~LV2Plugin () cleanup (); GoingAway (); /* EMIT SIGNAL */ - + slv2_instance_free(_instance); slv2_value_free(_name); slv2_value_free(_author); @@ -208,7 +208,7 @@ float LV2Plugin::default_value (uint32_t port) { return _defaults[port]; -} +} const char* LV2Plugin::port_symbol (uint32_t index) @@ -235,7 +235,7 @@ LV2Plugin::set_parameter (uint32_t which, float val) controls[which]->Changed (); } #endif - + } else { warning << string_compose (_("Illegal parameter number used with plugin \"%1\"." "This is a bug in either Ardour or the LV2 plugin (%2)"), @@ -269,7 +269,7 @@ LV2Plugin::nth_parameter (uint32_t n, bool& ok) const } } } - + return 0; } @@ -346,7 +346,7 @@ LV2Plugin::save_preset (string /*name*/) { return false; } - + bool LV2Plugin::has_editor() const { @@ -400,7 +400,7 @@ LV2Plugin::set_state(const XMLNode& node) set_parameter (port_id, atof(value)); } - + latency_compute_run (); return 0; @@ -413,7 +413,7 @@ LV2Plugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc) SLV2Value def, min, max; slv2_port_get_range(_plugin, port, &def, &min, &max); - + desc.integer_step = slv2_port_has_property(_plugin, port, _world.integer); desc.toggled = slv2_port_has_property(_plugin, port, _world.toggled); desc.logarithmic = slv2_port_has_property(_plugin, port, _world.logarithmic); @@ -423,7 +423,7 @@ LV2Plugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc) desc.upper = max ? slv2_value_as_float(max) : 1.0f; desc.min_unbound = false; // TODO (LV2 extension) desc.max_unbound = false; // TODO (LV2 extension) - + if (desc.integer_step) { desc.step = 1.0; desc.smallstep = 0.1; @@ -522,9 +522,9 @@ LV2Plugin::connect_and_run (BufferSet& bufs, slv2_instance_connect_port(_instance, port_index, NULL); } } - + run (nframes); - + midi_out_index = 0; for (uint32_t port_index = 0; port_index < parameter_count(); ++port_index) { if (parameter_is_midi(port_index) && parameter_is_output(port_index)) { @@ -532,7 +532,7 @@ LV2Plugin::connect_and_run (BufferSet& bufs, bufs.flush_lv2_midi(true, buf_index); } } - + cycles_t now = get_cycles (); set_cycles ((uint32_t) (now - then)); @@ -609,9 +609,9 @@ LV2Plugin::latency_compute_run () /* we need to run the plugin so that it can set its latency parameter. */ - + activate (); - + uint32_t port_index = 0; uint32_t in_index = 0; uint32_t out_index = 0; @@ -619,13 +619,13 @@ LV2Plugin::latency_compute_run () float buffer[bufsize]; memset(buffer,0,sizeof(float)*bufsize); - + /* Note that we've already required that plugins be able to handle in-place processing. */ - + port_index = 0; - + while (port_index < parameter_count()) { if (parameter_is_audio (port_index)) { if (parameter_is_input (port_index)) { @@ -638,7 +638,7 @@ LV2Plugin::latency_compute_run () } port_index++; } - + run (bufsize); deactivate (); } @@ -659,7 +659,7 @@ LV2World::LV2World() srate = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "sampleRate"); gtk_gui = slv2_value_new_uri(world, "http://lv2plug.in/ns/extensions/ui#GtkUI"); external_gui = slv2_value_new_uri(world, "http://lv2plug.in/ns/extensions/ui#external"); - logarithmic = slv2_value_new_uri(world, "http://lv2plug.in/ns/dev/extportinfo#logarithmic"); + logarithmic = slv2_value_new_uri(world, "http://lv2plug.in/ns/dev/extportinfo#logarithmic"); } LV2World::~LV2World() @@ -698,8 +698,8 @@ LV2PluginInfo::load (Session& session) catch (failed_constructor &err) { return PluginPtr ((Plugin*) 0); - } - + } + return PluginPtr(); } @@ -707,7 +707,7 @@ PluginInfoList LV2PluginInfo::discover (void* lv2_world) { PluginInfoList plugs; - + LV2World* world = (LV2World*)lv2_world; SLV2Plugins plugins = slv2_world_get_all_plugins(world->world); @@ -723,7 +723,7 @@ LV2PluginInfo::discover (void* lv2_world) cerr << "LV2: invalid plugin\n"; continue; } - + info->name = string(slv2_value_as_string(name)); slv2_value_free(name); @@ -741,7 +741,7 @@ LV2PluginInfo::discover (void* lv2_world) world->input_class, world->audio_class, NULL)); info->n_inputs.set_midi(slv2_plugin_get_num_ports_of_class(p, world->input_class, world->event_class, NULL)); - + info->n_outputs.set_audio(slv2_plugin_get_num_ports_of_class(p, world->output_class, world->audio_class, NULL)); info->n_outputs.set_midi(slv2_plugin_get_num_ports_of_class(p, @@ -749,7 +749,7 @@ LV2PluginInfo::discover (void* lv2_world) info->unique_id = slv2_value_as_uri(slv2_plugin_get_uri(p)); info->index = 0; // Meaningless for LV2 - + plugs.push_back (info); } diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index 76d2be262c..a5e82c3bf3 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -53,11 +53,11 @@ Metering::disconnect (sigc::connection& c) /** Update the meters. - The meter signal lock is taken to prevent modification of the + The meter signal lock is taken to prevent modification of the Meter signal while updating the meters, taking the meter signal - lock prior to taking the io_lock ensures that all IO will remain + lock prior to taking the io_lock ensures that all IO will remain valid while metering. -*/ +*/ void Metering::update_meters() { @@ -79,9 +79,9 @@ PeakMeter::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_fram const uint32_t n_audio = min(_configured_input.n_audio(), bufs.count().n_audio()); const uint32_t n_midi = min(_configured_input.n_midi(), bufs.count().n_midi()); - + uint32_t n = 0; - + // Meter MIDI in to the first n_midi peaks for (uint32_t i = 0; i < n_midi; ++i, ++n) { float val = 0.0f; @@ -104,7 +104,7 @@ PeakMeter::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_fram // Meter audio in to the rest of the peaks for (uint32_t i = 0; i < n_audio; ++i, ++n) { - _peak_power[n] = compute_peak (bufs.get_audio(i).data(), nframes, _peak_power[n]); + _peak_power[n] = compute_peak (bufs.get_audio(i).data(), nframes, _peak_power[n]); } // Zero any excess peaks @@ -149,9 +149,9 @@ PeakMeter::configure_io (ChanCount in, ChanCount out) if (out != in) { // always 1:1 return false; } - + uint32_t limit = in.n_total(); - + while (_peak_power.size() > limit) { _peak_power.pop_back(); _visible_peak_power.pop_back(); @@ -191,7 +191,7 @@ PeakMeter::meter () /* grab peak since last read */ - float new_peak = _peak_power[n]; /* XXX we should use atomic exchange from here ... */ + float new_peak = _peak_power[n]; /* XXX we should use atomic exchange from here ... */ _peak_power[n] = 0; /* ... to here */ /* compute new visible value using falloff */ @@ -201,11 +201,11 @@ PeakMeter::meter () } else { new_peak = minus_infinity(); } - + /* update max peak */ - + _max_peak_power[n] = std::max (new_peak, _max_peak_power[n]); - + if (Config->get_meter_falloff() == 0.0f || new_peak > _visible_peak_power[n]) { _visible_peak_power[n] = new_peak; } else { diff --git a/libs/ardour/midi_buffer.cc b/libs/ardour/midi_buffer.cc index 1e049eba72..1e41668889 100644 --- a/libs/ardour/midi_buffer.cc +++ b/libs/ardour/midi_buffer.cc @@ -1,17 +1,17 @@ /* - Copyright (C) 2006-2007 Paul Davis + Copyright (C) 2006-2007 Paul Davis Author: Dave Robillard - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -34,7 +34,7 @@ MidiBuffer::MidiBuffer(size_t capacity) silence(_capacity); } } - + MidiBuffer::~MidiBuffer() { free(_data); @@ -79,7 +79,7 @@ MidiBuffer::read_from (const Buffer& src, nframes_t nframes, nframes_t dst_offse assert (&src != this); const MidiBuffer& msrc = (MidiBuffer&) src; - + assert (_capacity >= msrc.size()); if (dst_offset == 0) { @@ -88,7 +88,7 @@ MidiBuffer::read_from (const Buffer& src, nframes_t nframes, nframes_t dst_offse } /* XXX use dst_offset somehow */ - + for (MidiBuffer::const_iterator i = msrc.begin(); i != msrc.end(); ++i) { const Evoral::MIDIEvent<TimeType> ev(*i, false); if (ev.time() >= src_offset && ev.time() < (nframes+src_offset)) { @@ -123,7 +123,7 @@ MidiBuffer::push_back(const Evoral::MIDIEvent<TimeType>& ev) const size_t stamp_size = sizeof(TimeType); /*cerr << "MidiBuffer: pushing event @ " << ev.time() << " size = " << ev.size() << endl;*/ - + if (_size + stamp_size + ev.size() >= _capacity) { cerr << "MidiBuffer::push_back failed (buffer is full)" << endl; return false; @@ -135,7 +135,7 @@ MidiBuffer::push_back(const Evoral::MIDIEvent<TimeType>& ev) } push_back(ev.time(), ev.size(), ev.buffer()); - + return true; } @@ -149,7 +149,7 @@ MidiBuffer::push_back(TimeType time, size_t size, const uint8_t* data) const size_t stamp_size = sizeof(TimeType); /*cerr << "MidiBuffer: pushing event @ " << ev.time() << " size = " << ev.size() << endl;*/ - + if (_size + stamp_size + size >= _capacity) { cerr << "MidiBuffer::push_back failed (buffer is full)" << endl; return false; @@ -166,7 +166,7 @@ MidiBuffer::push_back(TimeType time, size_t size, const uint8_t* data) _size += stamp_size + size; _silent = false; - + return true; } @@ -186,7 +186,7 @@ MidiBuffer::push_back(const jack_midi_event_t& ev) cerr << "MidiBuffer::push_back failed (buffer is full)" << endl; return false; } - + if (!Evoral::midi_event_is_valid(ev.buffer, ev.size)) { cerr << "WARNING: MidiBuffer ignoring illegal MIDI event" << endl; return false; @@ -198,7 +198,7 @@ MidiBuffer::push_back(const jack_midi_event_t& ev) _size += stamp_size + ev.size; _silent = false; - + return true; } @@ -221,13 +221,13 @@ MidiBuffer::reserve(TimeType time, size_t size) // write timestamp uint8_t* write_loc = _data + _size; *((TimeType*)write_loc) = time; - + // move write_loc to begin of MIDI buffer data to write to write_loc += stamp_size; _size += stamp_size + size; _silent = false; - + return write_loc; } @@ -322,7 +322,7 @@ bool MidiBuffer::merge(const MidiBuffer& a, const MidiBuffer& b) { _size = 0; - + if (this == &a) { merge_in_place(b); } @@ -330,7 +330,7 @@ MidiBuffer::merge(const MidiBuffer& a, const MidiBuffer& b) if (this == &b) { merge_in_place(a); } - + cerr << "FIXME: MIDI BUFFER MERGE" << endl; return true; } diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc index 1182fed23d..a41864571d 100644 --- a/libs/ardour/midi_clock_slave.cc +++ b/libs/ardour/midi_clock_slave.cc @@ -75,7 +75,7 @@ MIDIClock_Slave::rebind (MIDI::Port& p) port = &p; - #ifdef DEBUG_MIDI_CLOCK + #ifdef DEBUG_MIDI_CLOCK std::cerr << "MIDIClock_Slave: connecting to port " << port->name() << std::endl; #endif @@ -86,7 +86,7 @@ MIDIClock_Slave::rebind (MIDI::Port& p) connections.push_back (port->input()->position.connect (mem_fun (*this, &MIDIClock_Slave::position))); } -void +void MIDIClock_Slave::calculate_one_ppqn_in_frames_at(nframes_t time) { const Tempo& current_tempo = session->tempo_map().tempo_at(time); @@ -101,7 +101,7 @@ MIDIClock_Slave::calculate_one_ppqn_in_frames_at(nframes_t time) one_ppqn_in_frames = frames_per_quarter_note / double (ppqn); } -ARDOUR::nframes_t +ARDOUR::nframes_t MIDIClock_Slave::calculate_song_position(uint16_t song_position_in_sixteenth_notes) { nframes_t song_position_frames = 0; @@ -110,49 +110,49 @@ MIDIClock_Slave::calculate_song_position(uint16_t song_position_in_sixteenth_not calculate_one_ppqn_in_frames_at(song_position_frames); song_position_frames += one_ppqn_in_frames * nframes_t(ppqn / 4); } - + return song_position_frames; } -void +void MIDIClock_Slave::calculate_filter_coefficients() { // omega = 2 * PI * Bandwidth / MIDI clock frame frequency in Hz omega = 2.0 * 3.14159265358979323846 * bandwidth * one_ppqn_in_frames / session->frame_rate(); b = 1.4142135623730950488 * omega; - c = omega * omega; + c = omega * omega; } void MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, nframes_t timestamp) -{ - // some pieces of hardware send MIDI Clock all the time +{ + // some pieces of hardware send MIDI Clock all the time if ( (!_starting) && (!_started) ) { return; } - + calculate_one_ppqn_in_frames_at(should_be_position); - + nframes_t elapsed_since_start = timestamp - first_timestamp; double error = 0; - - if (_starting || last_timestamp == 0) { + + if (_starting || last_timestamp == 0) { midi_clock_count = 0; - + first_timestamp = timestamp; elapsed_since_start = should_be_position; - + // calculate filter coefficients calculate_filter_coefficients(); - + // initialize DLL e2 = double(one_ppqn_in_frames) / double(session->frame_rate()); t0 = double(elapsed_since_start) / double(session->frame_rate()); t1 = t0 + e2; - + // let ardour go after first MIDI Clock Event _starting = false; - } else { + } else { midi_clock_count++; should_be_position += one_ppqn_in_frames; calculate_filter_coefficients(); @@ -161,33 +161,33 @@ MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, nframes_t timestamp) // we use session->transport_frame() instead of t1 here // because t1 is used to calculate the transport speed, // so the loop will compensate for accumulating rounding errors - error = (double(should_be_position) - double(session->audible_frame())); + error = (double(should_be_position) - double(session->audible_frame())); e = error / double(session->frame_rate()); - + // update DLL t0 = t1; t1 += b * e + e2; - e2 += c * e; - } - - #ifdef DEBUG_MIDI_CLOCK - cerr + e2 += c * e; + } + + #ifdef DEBUG_MIDI_CLOCK + cerr << "MIDI Clock #" << midi_clock_count - //<< "@" << timestamp - << " arrived at: " << elapsed_since_start << " (elapsed time) " - << " should-be transport: " << should_be_position + //<< "@" << timestamp + << " arrived at: " << elapsed_since_start << " (elapsed time) " + << " should-be transport: " << should_be_position << " audible: " << session->audible_frame() << " real transport: " << session->transport_frame() << " error: " << error - //<< " engine: " << session->frame_time() - << " real delta: " << timestamp - last_timestamp + //<< " engine: " << session->frame_time() + << " real delta: " << timestamp - last_timestamp << " should-be delta: " << one_ppqn_in_frames << " t1-t0: " << (t1 -t0) * session->frame_rate() << " t0: " << t0 * session->frame_rate() - << " t1: " << t1 * session->frame_rate() - << " frame-rate: " << session->frame_rate() + << " t1: " << t1 * session->frame_rate() + << " frame-rate: " << session->frame_rate() << endl; - + cerr << "frames since cycle start: " << session->frames_since_cycle_start() << endl; #endif // DEBUG_MIDI_CLOCK @@ -196,14 +196,14 @@ MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, nframes_t timestamp) void MIDIClock_Slave::start (Parser& /*parser*/, nframes_t /*timestamp*/) -{ - #ifdef DEBUG_MIDI_CLOCK +{ + #ifdef DEBUG_MIDI_CLOCK cerr << "MIDIClock_Slave got start message at time " << timestamp << " engine time: " << session->frame_time() << endl; #endif - + if (!_started) { reset(); - + _started = true; _starting = true; } @@ -213,24 +213,24 @@ void MIDIClock_Slave::reset () { - should_be_position = 0; + should_be_position = 0; last_timestamp = 0; - + _starting = false; _started = false; - + session->request_locate(0, false); } void MIDIClock_Slave::contineu (Parser& /*parser*/, nframes_t /*timestamp*/) { - #ifdef DEBUG_MIDI_CLOCK + #ifdef DEBUG_MIDI_CLOCK std::cerr << "MIDIClock_Slave got continue message" << endl; #endif if (!_started) { _starting = true; - _started = true; + _started = true; } } @@ -238,29 +238,29 @@ MIDIClock_Slave::contineu (Parser& /*parser*/, nframes_t /*timestamp*/) void MIDIClock_Slave::stop (Parser& /*parser*/, nframes_t /*timestamp*/) { - #ifdef DEBUG_MIDI_CLOCK + #ifdef DEBUG_MIDI_CLOCK std::cerr << "MIDIClock_Slave got stop message" << endl; #endif - + if (_started || _starting) { _starting = false; _started = false; // locate to last MIDI clock position session->request_transport_speed(0.0); - + // we need to go back to the last MIDI beat (6 ppqn) // and lets hope the tempo didnt change in the meantime :) - + // begin at the should be position, because // that is the position of the last MIDI Clock // message and that is probably what the master // expects where we are right now nframes_t stop_position = should_be_position; - + // find out the last MIDI beat: go back #midi_clocks mod 6 // and lets hope the tempo didnt change in those last 6 beats :) stop_position -= (midi_clock_count % 6) * one_ppqn_in_frames; - + session->request_locate(stop_position, false); should_be_position = stop_position; last_timestamp = 0; @@ -275,23 +275,23 @@ MIDIClock_Slave::position (Parser& /*parser*/, byte* message, size_t size) if (_started || _starting) { return; } - + assert(size == 3); byte lsb = message[1]; byte msb = message[2]; assert((lsb <= 0x7f) && (msb <= 0x7f)); - + uint16_t position_in_sixteenth_notes = (uint16_t(msb) << 7) | uint16_t(lsb); nframes_t position_in_frames = calculate_song_position(position_in_sixteenth_notes); - + #ifdef DEBUG_MIDI_CLOCK - cerr << "Song Position: " << position_in_sixteenth_notes << " frames: " << position_in_frames << endl; + cerr << "Song Position: " << position_in_sixteenth_notes << " frames: " << position_in_frames << endl; #endif - + session->request_locate(position_in_frames, false); should_be_position = position_in_frames; last_timestamp = 0; - + } bool @@ -316,12 +316,12 @@ bool MIDIClock_Slave::stop_if_no_more_clock_events(nframes_t& pos, nframes_t now) { /* no timecode for 1/4 second ? conclude that its stopped */ - if (last_timestamp && - now > last_timestamp && + if (last_timestamp && + now > last_timestamp && now - last_timestamp > session->frame_rate() / 4) { - #ifdef DEBUG_MIDI_CLOCK + #ifdef DEBUG_MIDI_CLOCK cerr << "No MIDI Clock frames received for some time, stopping!" << endl; - #endif + #endif pos = should_be_position; session->request_transport_speed (0); session->request_locate (should_be_position, false); @@ -339,16 +339,16 @@ MIDIClock_Slave::speed_and_position (double& speed, nframes_t& pos) pos = should_be_position; return true; } - + nframes_t engine_now = session->frame_time(); - + if (stop_if_no_more_clock_events(pos, engine_now)) { return false; } // calculate speed speed = ((t1 - t0) * session->frame_rate()) / one_ppqn_in_frames; - + // calculate position if (engine_now > last_timestamp) { // we are in between MIDI clock messages @@ -359,11 +359,11 @@ MIDIClock_Slave::speed_and_position (double& speed, nframes_t& pos) // A new MIDI clock message has arrived this cycle pos = should_be_position; } - - #ifdef DEBUG_MIDI_CLOCK + + #ifdef DEBUG_MIDI_CLOCK cerr << "speed_and_position: " << speed << " & " << pos << " <-> " << session->transport_frame() << " (transport)" << endl; - #endif - + #endif + return true; } diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 97a8fb3044..dd221e103b 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2003 Paul Davis + Copyright (C) 2000-2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -84,7 +84,7 @@ MidiDiskstream::MidiDiskstream (Session &sess, const string &name, Diskstream::F assert(!destructive()); } - + MidiDiskstream::MidiDiskstream (Session& sess, const XMLNode& node) : Diskstream(sess, node) , _playback_buf(0) @@ -126,7 +126,7 @@ MidiDiskstream::init (Diskstream::Flag f) const size_t size = _session.midi_diskstream_buffer_size(); _playback_buf = new MidiRingBuffer<nframes_t>(size); _capture_buf = new MidiRingBuffer<nframes_t>(size); - + _n_channels = ChanCount(DataType::MIDI, 1); assert(recordable()); @@ -137,7 +137,7 @@ MidiDiskstream::~MidiDiskstream () Glib::Mutex::Lock lm (state_lock); } - + void MidiDiskstream::non_realtime_locate (nframes_t position) { @@ -151,7 +151,7 @@ MidiDiskstream::non_realtime_locate (nframes_t position) void MidiDiskstream::non_realtime_input_change () { - { + { Glib::Mutex::Lock lm (state_lock); if (input_change_pending == NoChange) { @@ -163,7 +163,7 @@ MidiDiskstream::non_realtime_input_change () error << "Can not feed IO " << _io->n_ports() << " with diskstream " << _n_channels << endl; } - } + } get_input_sources (); set_capture_offset (); @@ -176,7 +176,7 @@ MidiDiskstream::non_realtime_input_change () } input_change_pending = NoChange; - + /* implicit unlock */ } @@ -211,13 +211,13 @@ MidiDiskstream::get_input_sources () _source_port = _io->midi(0); // do... stuff? -} +} int MidiDiskstream::find_and_use_playlist (const string& name) { boost::shared_ptr<MidiPlaylist> playlist; - + if ((playlist = boost::dynamic_pointer_cast<MidiPlaylist> (_session.playlist_by_name (name))) == 0) { playlist = boost::dynamic_pointer_cast<MidiPlaylist> (PlaylistFactory::create (DataType::MIDI, _session, name)); } @@ -232,7 +232,7 @@ MidiDiskstream::find_and_use_playlist (const string& name) int MidiDiskstream::use_playlist (boost::shared_ptr<Playlist> playlist) -{ +{ assert(boost::dynamic_pointer_cast<MidiPlaylist>(playlist)); Diskstream::use_playlist(playlist); @@ -242,7 +242,7 @@ MidiDiskstream::use_playlist (boost::shared_ptr<Playlist> playlist) int MidiDiskstream::use_new_playlist () -{ +{ string newname; boost::shared_ptr<MidiPlaylist> playlist; @@ -258,11 +258,11 @@ MidiDiskstream::use_new_playlist () if ((playlist = boost::dynamic_pointer_cast<MidiPlaylist> (PlaylistFactory::create ( DataType::MIDI, _session, newname, hidden()))) != 0) { - + playlist->set_orig_diskstream_id (id()); return use_playlist (playlist); - } else { + } else { return -1; } } @@ -285,11 +285,11 @@ MidiDiskstream::use_copy_playlist () boost::shared_ptr<MidiPlaylist> playlist; newname = Playlist::bump_name (_playlist->name(), _session); - + if ((playlist = boost::dynamic_pointer_cast<MidiPlaylist>(PlaylistFactory::create (midi_playlist(), newname))) != 0) { playlist->set_orig_diskstream_id (id()); return use_playlist (playlist); - } else { + } else { return -1; } } @@ -303,7 +303,7 @@ MidiDiskstream::set_destructive (bool yn) assert( ! yn); return -1; } - + void MidiDiskstream::set_note_mode (NoteMode m) { @@ -317,7 +317,7 @@ void MidiDiskstream::check_record_status (nframes_t transport_frame, nframes_t /*nframes*/, bool can_record) { // FIXME: waaay too much code to duplicate (AudioDiskstream) - + int possibly_recording; int rolling; int change; @@ -341,9 +341,9 @@ MidiDiskstream::check_record_status (nframes_t transport_frame, nframes_t /*nfra /* if per-track or global rec-enable turned on while the other was already on, we've started recording */ - if (((change & track_rec_enabled) && record_enabled() && (!(change & global_rec_enabled) && can_record)) || + if (((change & track_rec_enabled) && record_enabled() && (!(change & global_rec_enabled) && can_record)) || ((change & global_rec_enabled) && can_record && (!(change & track_rec_enabled) && record_enabled()))) { - + /* starting to record: compute first+last frames */ first_recordable_frame = transport_frame + _capture_offset; @@ -358,8 +358,8 @@ MidiDiskstream::check_record_status (nframes_t transport_frame, nframes_t /*nfra first_recordable_frame += _session.worst_output_latency(); } else { first_recordable_frame += _roll_delay; - } - + } + } else { /* was rolling, but record state changed */ @@ -370,8 +370,8 @@ MidiDiskstream::check_record_status (nframes_t transport_frame, nframes_t /*nfra if (!_session.config.get_punch_in()) { /* manual punch in happens at the correct transport frame - because the user hit a button. but to get alignment correct - we have to back up the position of the new region to the + because the user hit a button. but to get alignment correct + we have to back up the position of the new region to the appropriate spot given the roll delay. */ @@ -402,15 +402,15 @@ MidiDiskstream::check_record_status (nframes_t transport_frame, nframes_t /*nfra capture_start_frame -= _roll_delay; } } - + } } else if (!record_enabled() || !can_record) { - + /* stop recording */ last_recordable_frame = transport_frame + _capture_offset; - + if (_alignment_style == ExistingMaterial) { last_recordable_frame += _session.worst_output_latency(); } else { @@ -428,7 +428,7 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len) using namespace MIDI; eventType type; const char trace_prefix = ':'; - + type = (eventType) (msg[0]&0xF0); switch (type) { @@ -442,7 +442,7 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len) << (int) msg[2] << endl; break; - + case on: o << trace_prefix << "Channel " @@ -453,7 +453,7 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len) << (int) msg[2] << endl; break; - + case polypress: o << trace_prefix << "Channel " @@ -462,7 +462,7 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len) << (int) msg[1] << endl; break; - + case MIDI::controller: o << trace_prefix << "Channel " @@ -473,25 +473,25 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len) << (int) msg[2] << endl; break; - + case program: - o << trace_prefix + o << trace_prefix << "Channel " << (msg[0]&0xF)+1 << " Program Change ProgNum " << (int) msg[1] << endl; break; - + case chanpress: - o << trace_prefix + o << trace_prefix << "Channel " << (msg[0]&0xF)+1 << " Channel Pressure " << (int) msg[1] << endl; break; - + case MIDI::pitchbend: o << trace_prefix << "Channel " @@ -500,7 +500,7 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len) << ((msg[2]<<7)|msg[1]) << endl; break; - + case MIDI::sysex: if (len == 1) { switch (msg[0]) { @@ -537,9 +537,9 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len) default: o << trace_prefix << "System Exclusive (1 byte : " << hex << (int) *msg << dec << ')' - << endl; + << endl; break; - } + } } else { o << trace_prefix << "System Exclusive (" << len << ") = [ " << hex; @@ -547,42 +547,42 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len) o << (int) msg[i] << ' '; } o << dec << ']' << endl; - + } break; - + case MIDI::song: o << trace_prefix << "Song" << endl; break; - + case MIDI::tune: o << trace_prefix << "Tune" << endl; break; - + case MIDI::eox: o << trace_prefix << "End-of-System Exclusive" << endl; break; - + case MIDI::timing: o << trace_prefix << "Timing" << endl; break; - + case MIDI::start: o << trace_prefix << "Start" << endl; break; - + case MIDI::stop: o << trace_prefix << "Stop" << endl; break; - + case MIDI::contineu: o << trace_prefix << "Continue" << endl; break; - + case active: o << trace_prefix << "Active Sense" << endl; break; - + default: o << trace_prefix << "Unrecognized MIDI message" << endl; break; @@ -611,7 +611,7 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_ if (_processed) { return 0; } - + commit_should_unlock = false; check_record_status (transport_frame, nframes, can_record); @@ -700,7 +700,7 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_ assert(ev.buffer()); _capture_buf->write(ev.time() + transport_frame, ev.type(), ev.size(), ev.buffer()); } - + } else { if (was_recording) { @@ -741,7 +741,7 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_ commit_should_unlock = false; state_lock.unlock(); - } + } return ret; } @@ -771,7 +771,7 @@ MidiDiskstream::commit (nframes_t nframes) /*cerr << "MDS written: " << frames_written << " - read: " << frames_read << " = " << frames_written - frames_read << " + " << nframes << " < " << midi_readahead << " = " << need_butler << ")" << endl;*/ - + if (commit_should_unlock) { state_lock.unlock(); } @@ -785,9 +785,9 @@ void MidiDiskstream::set_pending_overwrite (bool yn) { /* called from audio thread, so we can use the read ptr and playback sample as we wish */ - + pending_overwrite = yn; - + overwrite_frame = playback_sample; } @@ -806,7 +806,7 @@ MidiDiskstream::seek (nframes_t frame, bool complete_refill) { Glib::Mutex::Lock lm (state_lock); int ret = -1; - + _playback_buf->reset(); _capture_buf->reset(); g_atomic_int_set(&_frames_read_from_ringbuffer, 0); @@ -844,7 +844,7 @@ MidiDiskstream::internal_playback_seek (nframes_t distance) /** @a start is set to the new frame position (TIME) read up to */ int MidiDiskstream::read (nframes_t& start, nframes_t dur, bool reversed) -{ +{ nframes_t this_read = 0; bool reloop = false; nframes_t loop_end = 0; @@ -854,23 +854,23 @@ MidiDiskstream::read (nframes_t& start, nframes_t dur, bool reversed) if (!reversed) { /* Make the use of a Location atomic for this read operation. - + Note: Locations don't get deleted, so all we care about when I say "atomic" is that we are always pointing to the same one and using a start/length values obtained just once. */ - + if ((loc = loop_location) != 0) { loop_start = loc->start(); loop_end = loc->end(); loop_length = loop_end - loop_start; } - + /* if we are looping, ensure that the first frame we read is at the correct position within the loop. */ - + if (loc && (start >= loop_end)) { //cerr << "start adjusted from " << start; start = loop_start + ((start - loop_start) % loop_length); @@ -908,7 +908,7 @@ MidiDiskstream::read (nframes_t& start, nframes_t dur, bool reversed) g_atomic_int_add(&_frames_written_to_ringbuffer, this_read); _read_data_count = _playlist->read_data_count(); - + if (reversed) { // Swap note ons with note offs here. etc? @@ -916,21 +916,21 @@ MidiDiskstream::read (nframes_t& start, nframes_t dur, bool reversed) // CC values etc. hard. } else { - + /* if we read to the end of the loop, go back to the beginning */ - + if (reloop) { // Synthesize LoopEvent here, because the next events // written will have non-monotonic timestamps. _playback_buf->write(loop_end - 1, LoopEventType, 0, 0); - cout << "Pushing LoopEvent ts=" << loop_end-1 + cout << "Pushing LoopEvent ts=" << loop_end-1 << " start+this_read " << start+this_read << endl; start = loop_start; } else { start += this_read; } - } + } dur -= this_read; //offset += this_read; @@ -955,7 +955,7 @@ MidiDiskstream::do_refill () if (write_space == 0) { return 0; } - + if (reversed) { return 0; } @@ -984,11 +984,11 @@ MidiDiskstream::do_refill () // << frames_written - frames_read << endl; to_read = min(to_read, (max_frames - file_frame)); - + if (read (file_frame, to_read, reversed)) { ret = -1; } - + return ret; } @@ -998,7 +998,7 @@ MidiDiskstream::do_refill () * of data to disk. it will never write more than that. If it writes that * much and there is more than that waiting to be written, it will return 1, * otherwise 0 on success or -1 on failure. - * + * * If there is less than disk_io_chunk_frames to be written, no data will be * written at all unless @a force_flush is true. */ @@ -1012,7 +1012,7 @@ MidiDiskstream::do_flush (RunContext /*context*/, bool force_flush) _write_data_count = 0; total = _session.transport_frame() - _last_flush_frame; - + if (_last_flush_frame > _session.transport_frame() || _last_flush_frame < capture_start_frame) { _last_flush_frame = _session.transport_frame(); @@ -1036,7 +1036,7 @@ MidiDiskstream::do_flush (RunContext /*context*/, bool force_flush) if (total >= 2 * disk_io_chunk_frames || ((force_flush || !was_recording) && total > disk_io_chunk_frames)) { ret = 1; - } + } to_write = disk_io_chunk_frames; @@ -1072,7 +1072,7 @@ MidiDiskstream::transport_stopped (struct tm& /*when*/, time_t /*twhen*/, bool a finish_capture (true); - /* butler is already stopped, but there may be work to do + /* butler is already stopped, but there may be work to do to flush remaining data to disk. */ @@ -1116,7 +1116,7 @@ MidiDiskstream::transport_stopped (struct tm& /*when*/, time_t /*twhen*/, bool a } /* figure out the name for this take */ - + srcs.push_back (_write_source); _write_source->set_timeline_position (capture_info.front()->start); _write_source->set_captured_for (_name); @@ -1169,7 +1169,7 @@ MidiDiskstream::transport_stopped (struct tm& /*when*/, time_t /*twhen*/, bool a error << _("MidiDiskstream: could not create region for captured midi!") << endmsg; continue; /* XXX is this OK? */ } - + region->GoingAway.connect (bind (mem_fun (*this, &Diskstream::remove_region_from_last_capture), boost::weak_ptr<Region>(region))); _last_capture_regions.push_back (region); @@ -1234,7 +1234,7 @@ void MidiDiskstream::finish_capture (bool /*rec_monitors_input*/) { was_recording = false; - + if (capture_captured == 0) { return; } @@ -1243,12 +1243,12 @@ MidiDiskstream::finish_capture (bool /*rec_monitors_input*/) assert(!destructive()); CaptureInfo* ci = new CaptureInfo; - + ci->start = capture_start_frame; ci->frames = capture_captured; - - /* XXX theoretical race condition here. Need atomic exchange ? - However, the circumstances when this is called right + + /* XXX theoretical race condition here. Need atomic exchange ? + However, the circumstances when this is called right now (either on record-disable or transport_stopped) mean that no actual race exists. I think ... We now have a capture_info_lock, but it is only to be used @@ -1270,7 +1270,7 @@ MidiDiskstream::set_record_enabled (bool yn) } assert(!destructive()); - + if (yn && _source_port == 0) { /* pick up connections not initiated *from* the IO object @@ -1299,7 +1299,7 @@ MidiDiskstream::engage_record_enable () bool rolling = _session.transport_speed() != 0.0f; g_atomic_int_set (&_record_enabled, 1); - + if (_source_port && Config->get_monitoring_model() == HardwareMonitoring) { _source_port->request_monitor_input (!(_session.config.get_auto_input() && rolling)); } @@ -1337,12 +1337,12 @@ MidiDiskstream::get_state () node->add_property ("flags", buf); node->add_property("channel-mode", enum_2_string(get_channel_mode())); - + snprintf (buf, sizeof(buf), "0x%x", get_channel_mask()); node->add_property("channel-mask", buf); - + node->add_property ("playlist", _playlist->name()); - + snprintf (buf, sizeof(buf), "%f", _visible_speed); node->add_property ("speed", buf); @@ -1392,24 +1392,24 @@ MidiDiskstream::set_state (const XMLNode& node) in_set_state = true; - for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - /*if ((*niter)->name() == IO::state_node_name) { + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { + /*if ((*niter)->name() == IO::state_node_name) { deprecated_io_node = new XMLNode (**niter); - }*/ - assert ((*niter)->name() != IO::state_node_name); + }*/ + assert ((*niter)->name() != IO::state_node_name); if ((*niter)->name() == X_("CapturingSources")) { capture_pending_node = *niter; } - } + } /* prevent write sources from being created */ - + in_set_state = true; - + if ((prop = node.property ("name")) != 0) { _name = prop->value(); - } + } if ((prop = node.property ("id")) != 0) { _id = prop->value (); @@ -1423,7 +1423,7 @@ MidiDiskstream::set_state (const XMLNode& node) if ((prop = node.property ("channel-mode")) != 0) { channel_mode = ChannelMode (string_2_enum(prop->value(), channel_mode)); } - + unsigned int channel_mask = 0xFFFF; if ((prop = node.property ("channel-mask")) != 0) { sscanf (prop->value().c_str(), "0x%x", &channel_mask); @@ -1433,18 +1433,18 @@ MidiDiskstream::set_state (const XMLNode& node) } set_channel_mode(channel_mode, channel_mask); - + if ((prop = node.property ("channels")) != 0) { nchans = atoi (prop->value().c_str()); } - + if ((prop = node.property ("playlist")) == 0) { return -1; } { bool had_playlist = (_playlist != 0); - + if (find_and_use_playlist (prop->value())) { return -1; } @@ -1452,7 +1452,7 @@ MidiDiskstream::set_state (const XMLNode& node) if (!had_playlist) { _playlist->set_orig_diskstream_id (_id); } - + if (capture_pending_node) { use_pending_capture_data (*capture_pending_node); } @@ -1474,10 +1474,10 @@ MidiDiskstream::set_state (const XMLNode& node) // FIXME? //_capturing_source = 0; - /* write sources are handled when we handle the input set + /* write sources are handled when we handle the input set up of the IO that owns this DS (::non_realtime_input_change()) */ - + in_set_state = false; return 0; @@ -1507,7 +1507,7 @@ MidiDiskstream::use_new_write_source (uint32_t n) if (!_write_source) { throw failed_constructor(); } - } + } catch (failed_constructor &err) { error << string_compose (_("%1:%2 new capture file not initialized correctly"), _name, n) << endmsg; @@ -1532,7 +1532,7 @@ MidiDiskstream::reset_write_sources (bool mark_write_complete, bool /*force*/) } use_new_write_source (0); - + if (record_enabled()) { //_capturing_sources.push_back (_write_source); } @@ -1575,7 +1575,7 @@ MidiDiskstream::set_align_style_from_io () } get_input_sources (); - + if (_source_port && _source_port->flags() & JackPortIsPhysical) { have_physical = true; } @@ -1616,7 +1616,7 @@ MidiDiskstream::get_playback (MidiBuffer& dst, nframes_t start, nframes_t end) { dst.clear(); assert(dst.size() == 0); - + // Reverse. ... We just don't do reverse, ok? Back off. if (end <= start) { return; @@ -1633,7 +1633,7 @@ MidiDiskstream::get_playback (MidiBuffer& dst, nframes_t start, nframes_t end) << " readspace " << _playback_buf->read_space() << " writespace " << _playback_buf->write_space() << endl; #endif - + gint32 frames_read = end - start; g_atomic_int_add(&_frames_read_from_ringbuffer, frames_read); } diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index 79e59ecde4..fb09cda60f 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -146,7 +146,7 @@ MidiModel::DeltaCommand::operator()() for (NoteList::iterator i = _removed_notes.begin(); i != _removed_notes.end(); ++i) { _model->remove_note_unlocked(*i); } - + _model->write_unlock(); _model->ContentsChanged(); /* EMIT SIGNAL */ } @@ -156,7 +156,7 @@ MidiModel::DeltaCommand::undo() { // This could be made much faster by using a priority_queue for added and // removed notes (or sort here), and doing a single iteration over _model - + Glib::Mutex::Lock lm (_model->_midi_source->mutex()); _model->_midi_source->invalidate(); // release model read lock _model->write_lock(); @@ -411,7 +411,7 @@ MidiModel::DiffCommand::operator()() break; } } - + _model->write_unlock(); _model->ContentsChanged(); /* EMIT SIGNAL */ } @@ -452,7 +452,7 @@ XMLNode& MidiModel::DiffCommand::marshal_change(const NotePropertyChange& change) { XMLNode* xml_change = new XMLNode("change"); - + /* first, the change itself */ xml_change->add_property ("property", enum_2_string (change.property)); @@ -480,13 +480,13 @@ MidiModel::DiffCommand::marshal_change(const NotePropertyChange& change) /* now the rest of the note */ const SMFSource* smf = dynamic_cast<const SMFSource*> (_model->midi_source()); - + if (change.property != NoteNumber) { ostringstream note_str; note_str << int(change.note->note()); xml_change->add_property("note", note_str.str()); } - + if (change.property != Channel) { ostringstream channel_str; channel_str << int(change.note->channel()); @@ -631,7 +631,7 @@ MidiModel::DiffCommand::unmarshal_change(XMLNode *xml_change) /* we must point at the instance of the note that is actually in the model. so go look for it ... */ - + boost::shared_ptr<Evoral::Note<TimeType> > new_note (new Evoral::Note<TimeType> (channel, time, length, note, velocity)); change.note = _model->find_note (new_note); @@ -696,13 +696,13 @@ MidiModel::write_to(boost::shared_ptr<MidiSource> source) set_percussive(false); source->drop_model(); - + for (Evoral::Sequence<TimeType>::const_iterator i = begin(); i != end(); ++i) { source->append_event_unlocked_beats(*i); } - + set_percussive(old_percussive); - + read_unlock(); set_edited(false); @@ -717,14 +717,14 @@ MidiModel::get_state() } boost::shared_ptr<Evoral::Note<MidiModel::TimeType> > -MidiModel::find_note (boost::shared_ptr<Evoral::Note<TimeType> > other) +MidiModel::find_note (boost::shared_ptr<Evoral::Note<TimeType> > other) { for (Notes::iterator x = notes().begin(); x != notes().end(); ++x) { if (**x == *other) { return *x; } - /* XXX optimize by using a stored iterator and break out + /* XXX optimize by using a stored iterator and break out when passed start time. */ } diff --git a/libs/ardour/midi_patch_manager.cc b/libs/ardour/midi_patch_manager.cc index 7c824b1e8d..a0ccbdec9e 100644 --- a/libs/ardour/midi_patch_manager.cc +++ b/libs/ardour/midi_patch_manager.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Hans Baier + Copyright (C) 2008 Hans Baier This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ MidiPatchManager::set_session (Session& s) { _session = &s; _session->GoingAway.connect (mem_fun (*this, &MidiPatchManager::drop_session)); - + refresh(); } @@ -56,27 +56,27 @@ MidiPatchManager::refresh() _documents.clear(); _master_devices_by_model.clear(); _all_models.clear(); - + path path_to_patches = _session->session_directory().midi_patch_path(); - + if (!exists(path_to_patches)) { return; } - + assert(is_directory(path_to_patches)); - + Glib::PatternSpec pattern(Glib::ustring("*.midnam")); vector<path> result; - + find_matching_files_in_directory(path_to_patches, pattern, result); cerr << "Loading " << result.size() << " MIDI patches from " << path_to_patches.to_string() << endl; - + for (vector<path>::iterator i = result.begin(); i != result.end(); ++i) { boost::shared_ptr<MIDINameDocument> document(new MIDINameDocument(i->to_string())); - for (MIDINameDocument::MasterDeviceNamesList::const_iterator device = + for (MIDINameDocument::MasterDeviceNamesList::const_iterator device = document->master_device_names_by_model().begin(); - device != document->master_device_names_by_model().end(); + device != document->master_device_names_by_model().end(); ++device) { //cerr << "got model " << device->first << endl; // have access to the documents by model name @@ -84,7 +84,7 @@ MidiPatchManager::refresh() // build a list of all master devices from all documents _master_devices_by_model[device->first] = device->second; _all_models.push_back(device->first); - + // make sure there are no double model names // TODO: handle this gracefully. assert(_documents.count(device->first) == 1); diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc index 82f8827f21..cc72a630ba 100644 --- a/libs/ardour/midi_playlist.cc +++ b/libs/ardour/midi_playlist.cc @@ -1,17 +1,17 @@ /* - Copyright (C) 2006 Paul Davis - Written by Dave Robillard, 2006 + Copyright (C) 2006 Paul Davis + Written by Dave Robillard, 2006 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -109,10 +109,10 @@ MidiPlaylist::MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, nframes MidiPlaylist::~MidiPlaylist () { - GoingAway (); /* EMIT SIGNAL */ - + GoingAway (); /* EMIT SIGNAL */ + /* drop connections to signals */ - + notify_callbacks (); } @@ -294,7 +294,7 @@ MidiPlaylist::region_changed (Change what_changed, boost::shared_ptr<Region> reg } // Feeling rather uninterested today, but thanks for the heads up anyway! - + Change our_interests = Change (/*MidiRegion::FadeInChanged| MidiRegion::FadeOutChanged| MidiRegion::FadeInActiveChanged| diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc index b07eb84f1b..880c1b5474 100644 --- a/libs/ardour/midi_port.cc +++ b/libs/ardour/midi_port.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ MidiPort::cycle_start (nframes_t nframes) { _buffer->clear (); assert (_buffer->size () == 0); - + if (sends_output ()) { jack_midi_clear_buffer (jack_port_get_buffer (_jack_port, nframes)); } @@ -59,34 +59,34 @@ MidiPort::get_midi_buffer (nframes_t nframes, nframes_t offset) void* jack_buffer = jack_port_get_buffer (_jack_port, nframes); const nframes_t event_count = jack_midi_get_event_count(jack_buffer); - + assert (event_count < _buffer->capacity()); /* suck all relevant MIDI events from the JACK MIDI port buffer into our MidiBuffer */ - + nframes_t off = offset + _port_offset; for (nframes_t i = 0; i < event_count; ++i) { - + jack_midi_event_t ev; jack_midi_event_get (&ev, jack_buffer, i); - + if (ev.time > off && ev.time < off+nframes) { _buffer->push_back (ev); } } - + if (nframes) { _has_been_mixed_down = true; } - + } else { _buffer->silence (nframes); } - + if (nframes) { _has_been_mixed_down = true; } @@ -94,7 +94,7 @@ MidiPort::get_midi_buffer (nframes_t nframes, nframes_t offset) return *_buffer; } - + void MidiPort::cycle_end (nframes_t /*nframes*/) { @@ -111,7 +111,7 @@ void MidiPort::flush_buffers (nframes_t nframes, nframes_t offset) { if (sends_output ()) { - + void* jack_buffer = jack_port_get_buffer (_jack_port, nframes); for (MidiBuffer::iterator i = _buffer->begin(); i != _buffer->end(); ++i) { diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index aca8d039ad..87c7d656e7 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -123,7 +123,7 @@ MidiRegion::set_position_internal (nframes_t pos, bool allow_bbt_recompute) double length_beats = old_converter.from(_length); Region::set_position_internal(pos, allow_bbt_recompute); - + BeatsFramesConverter new_converter(_session, pos - _start); set_length(new_converter.to(length_beats), 0); @@ -151,7 +151,7 @@ MidiRegion::_read_at (const SourceList& /*srcs*/, MidiRingBuffer<nframes_t>& dst /* precondition: caller has verified that we cover the desired section */ assert(chan_n == 0); - + if (position < _position) { internal_offset = 0; src_offset = _position - position; @@ -164,7 +164,7 @@ MidiRegion::_read_at (const SourceList& /*srcs*/, MidiRingBuffer<nframes_t>& dst if (internal_offset >= _length) { return 0; /* read nothing */ } - + if ((to_read = min (dur, _length - internal_offset)) == 0) { return 0; /* read nothing */ } @@ -189,15 +189,15 @@ MidiRegion::_read_at (const SourceList& /*srcs*/, MidiRingBuffer<nframes_t>& dst } else { // when _start is greater than _position, we have to subtract // _start from the note times in the midi source - negative_output_buffer_position = _start; + negative_output_buffer_position = _start; } -#if 0 +#if 0 cerr << "\t\tsource read from " << _position << " - " << _start << " (" << _position - _start << ") " << " start in source " << _start << " + " << internal_offset << " (" << _start + internal_offset << ") " - << " dur = " << to_read - << " offset = " << output_buffer_position - << " negoffset = " << negative_output_buffer_position + << " dur = " << to_read + << " offset = " << output_buffer_position + << " negoffset = " << negative_output_buffer_position << endl; #endif @@ -216,7 +216,7 @@ MidiRegion::_read_at (const SourceList& /*srcs*/, MidiRingBuffer<nframes_t>& dst return to_read; } - + XMLNode& MidiRegion::state (bool full) { @@ -224,11 +224,11 @@ MidiRegion::state (bool full) char buf[64]; char buf2[64]; LocaleGuard lg (X_("POSIX")); - + node.add_property ("flags", enum_2_string (_flags)); // XXX these should move into Region - + for (uint32_t n=0; n < _sources.size(); ++n) { snprintf (buf2, sizeof(buf2), "source-%d", n); _sources[n]->id().print (buf, sizeof(buf)); @@ -257,7 +257,7 @@ MidiRegion::set_live_state (const XMLNode& node, Change& what_changed, bool send Region::set_live_state (node, what_changed, false); uint32_t old_flags = _flags; - + if ((prop = node.property ("flags")) != 0) { _flags = Flag (string_2_enum (prop->value(), _flags)); @@ -302,7 +302,7 @@ MidiRegion::recompute_at_end () * (non destructively) "chop" notes that pass the end boundary, to * prevent stuck notes. */ -} +} void MidiRegion::recompute_at_start () diff --git a/libs/ardour/midi_ring_buffer.cc b/libs/ardour/midi_ring_buffer.cc index e5e01cc8cb..f886eb8443 100644 --- a/libs/ardour/midi_ring_buffer.cc +++ b/libs/ardour/midi_ring_buffer.cc @@ -46,7 +46,7 @@ MidiRingBuffer<T>::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes while (this->read_space() >= sizeof(T) + sizeof(Evoral::EventType) + sizeof(uint32_t)) { this->full_peek(sizeof(T), (uint8_t*)&ev_time); - + if (ev_time > end) { // cerr << "MRB event @ " << ev_time << " past end @ " << end << endl; break; @@ -85,7 +85,7 @@ MidiRingBuffer<T>::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes continue; } } - + assert(ev_time >= start); ev_time -= start; ev_time += offset; @@ -96,10 +96,10 @@ MidiRingBuffer<T>::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes // cerr << "MRB: Unable to reserve space in buffer, event skipped"; continue; } - + // write MIDI buffer contents success = Evoral::EventRingBuffer<T>::full_read(ev_size, write_loc); - + #if 0 cerr << "wrote MidiEvent to Buffer: " << hex; for (size_t i=0; i < ev_size; ++i) { @@ -117,12 +117,12 @@ MidiRingBuffer<T>::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes cerr << "WARNING: error reading event contents from MIDI ring" << endl; } } - + return count; } template<typename T> void -MidiRingBuffer<T>::dump(ostream& str) +MidiRingBuffer<T>::dump(ostream& str) { size_t rspace; @@ -137,21 +137,21 @@ MidiRingBuffer<T>::dump(ostream& str) size_t read_ptr = g_atomic_int_get (&this->_read_ptr); str << "Dump @ " << read_ptr << endl; - + while (1) { uint8_t* wp; uint8_t* data; size_t write_ptr; #define space(r,w) ((w > r) ? (w - r) : ((w - r + this->_size) % this->_size)) - + write_ptr = g_atomic_int_get (&this->_write_ptr); if (space (read_ptr, write_ptr) < sizeof (T)) { break; } wp = &this->_buf[read_ptr]; - memcpy (&ev_time, wp, sizeof (T)); + memcpy (&ev_time, wp, sizeof (T)); read_ptr = (read_ptr + sizeof (T)) % this->_size; str << "time " << ev_time; @@ -161,7 +161,7 @@ MidiRingBuffer<T>::dump(ostream& str) } wp = &this->_buf[read_ptr]; - memcpy (&ev_type, wp, sizeof (ev_type)); + memcpy (&ev_type, wp, sizeof (ev_type)); read_ptr = (read_ptr + sizeof (ev_type)) % this->_size; str << " type " << ev_type; @@ -172,7 +172,7 @@ MidiRingBuffer<T>::dump(ostream& str) } wp = &this->_buf[read_ptr]; - memcpy (&ev_size, wp, sizeof (ev_size)); + memcpy (&ev_size, wp, sizeof (ev_size)); read_ptr = (read_ptr + sizeof (ev_size)) % this->_size; str << " size " << ev_size; @@ -181,11 +181,11 @@ MidiRingBuffer<T>::dump(ostream& str) str << "!OUT!\n"; break; } - + data = new uint8_t[ev_size]; - + wp = &this->_buf[read_ptr]; - memcpy (data, wp, ev_size); + memcpy (data, wp, ev_size); read_ptr = (read_ptr + ev_size) % this->_size; for (uint32_t i = 0; i != ev_size; ++i) { diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index 4da2dbb845..f92d6a2a4f 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -60,7 +60,7 @@ MidiSource::MidiSource (Session& s, string name, Source::Flag flags) { } -MidiSource::MidiSource (Session& s, const XMLNode& node) +MidiSource::MidiSource (Session& s, const XMLNode& node) : Source (s, node) , _read_data_count(0) , _write_data_count(0) @@ -177,7 +177,7 @@ MidiSource::file_changed (string path) struct stat stat_file; int e1 = stat (path.c_str(), &stat_file); - + return !e1; } @@ -252,7 +252,7 @@ MidiSource::session_saved() // cyclic dependency here, ugly :( newsrc->set_model(_model); _model->set_midi_source(newsrc.get()); - + newsrc->flush_midi(); Switched.emit(newsrc); diff --git a/libs/ardour/midi_state_tracker.cc b/libs/ardour/midi_state_tracker.cc index e25dbdd094..69d1807623 100644 --- a/libs/ardour/midi_state_tracker.cc +++ b/libs/ardour/midi_state_tracker.cc @@ -1,17 +1,17 @@ /* - Copyright (C) 2006-2008 Paul Davis + Copyright (C) 2006-2008 Paul Davis Author: Torben Hohn - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -73,8 +73,8 @@ MidiStateTracker::resolve_notes (MidiBuffer &dst, nframes_t time) uint8_t buffer[3] = { MIDI_CMD_NOTE_OFF | channel, note, 0 }; Evoral::MIDIEvent<MidiBuffer::TimeType> noteoff (time, MIDI_CMD_NOTE_OFF, 3, buffer, false); - - dst.push_back (noteoff); + + dst.push_back (noteoff); _active_notes[channel * 128 + note]--; } } diff --git a/libs/ardour/midi_stretch.cc b/libs/ardour/midi_stretch.cc index ea5ab62d02..9cd1321a12 100644 --- a/libs/ardour/midi_stretch.cc +++ b/libs/ardour/midi_stretch.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis Author: Dave Robillard This program is free software; you can redistribute it and/or modify @@ -54,9 +54,9 @@ MidiStretch::run (boost::shared_ptr<Region> r) /* the name doesn't need to be super-precise, but allow for 2 fractional digits just to disambiguate close but not identical stretches. */ - + snprintf (suffix, sizeof (suffix), "@%d", (int) floor (_request.time_fraction * 100.0f)); - + string new_name = region->name(); string::size_type at = new_name.find ('@'); @@ -67,15 +67,15 @@ MidiStretch::run (boost::shared_ptr<Region> r) } new_name += suffix; - + /* create new sources */ - + if (make_new_sources (region, nsrcs, suffix)) return -1; // FIXME: how to make a whole file region if it isn't? //assert(region->whole_file()); - + boost::shared_ptr<MidiSource> src = region->midi_source(0); src->load_model(); @@ -87,11 +87,11 @@ MidiStretch::run (boost::shared_ptr<Region> r) new_src->load_model(true, true); boost::shared_ptr<MidiModel> new_model = new_src->model(); new_model->start_write(); - + for (Evoral::Sequence<MidiModel::TimeType>::const_iterator i = old_model->begin(); i != old_model->end(); ++i) { const double new_time = i->time() * _request.time_fraction; - + // FIXME: double copy Evoral::Event<MidiModel::TimeType> ev(*i, true); ev.time() = new_time; @@ -100,9 +100,9 @@ MidiStretch::run (boost::shared_ptr<Region> r) new_model->end_write(); new_model->set_edited(true); - + const int ret = finish (region, nsrcs, new_name); - + results[0]->set_length((nframes_t) floor (r->length() * _request.time_fraction), NULL); return ret; diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index bc6ea5fe58..c399cc94dd 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis By Dave Robillard, 2006 This program is free software; you can redistribute it and/or modify @@ -99,7 +99,7 @@ MidiTrack::use_new_diskstream () _session.add_diskstream (ds); set_diskstream (boost::dynamic_pointer_cast<MidiDiskstream> (ds)); -} +} int MidiTrack::set_diskstream (boost::shared_ptr<MidiDiskstream> ds) @@ -117,9 +117,9 @@ MidiTrack::set_diskstream (boost::shared_ptr<MidiDiskstream> ds) DiskstreamChanged (); /* EMIT SIGNAL */ return 0; -} +} -int +int MidiTrack::use_diskstream (string name) { boost::shared_ptr<MidiDiskstream> dstream; @@ -130,21 +130,21 @@ MidiTrack::use_diskstream (string name) error << string_compose(_("MidiTrack: midi diskstream \"%1\" not known by session"), name) << endmsg; return -1; } - + cerr << "\n\n\nMIDI found DS\n"; return set_diskstream (dstream); } -int +int MidiTrack::use_diskstream (const PBD::ID& id) { boost::shared_ptr<MidiDiskstream> dstream; if ((dstream = boost::dynamic_pointer_cast<MidiDiskstream> (_session.diskstream_by_id (id))) == 0) { - error << string_compose(_("MidiTrack: midi diskstream \"%1\" not known by session"), id) << endmsg; + error << string_compose(_("MidiTrack: midi diskstream \"%1\" not known by session"), id) << endmsg; return -1; } - + return set_diskstream (dstream); } @@ -169,10 +169,10 @@ MidiTrack::_set_state (const XMLNode& node, bool call_base) if (Route::_set_state (node, call_base)) { return -1; } - + // No destructive MIDI tracks (yet?) _mode = Normal; - + if ((prop = node.property (X_("note-mode"))) != 0) { _note_mode = NoteMode (string_2_enum (prop->value(), _note_mode)); } else { @@ -188,7 +188,7 @@ MidiTrack::_set_state (const XMLNode& node, bool call_base) } if ((prop = node.property ("diskstream-id")) == 0) { - + /* some old sessions use the diskstream name rather than the ID */ if ((prop = node.property ("diskstream")) == 0) { @@ -202,10 +202,10 @@ MidiTrack::_set_state (const XMLNode& node, bool call_base) } } else { - + PBD::ID id (prop->value()); PBD::ID zero ("0"); - + /* this wierd hack is used when creating tracks from a template. there isn't a particularly good time to interpose between setting the first part of the track state (notably Route::set_state() and the track mode), and the @@ -215,7 +215,7 @@ MidiTrack::_set_state (const XMLNode& node, bool call_base) */ cerr << "\n\n\n\n MIDI track " << name() << " found DS id " << id << endl; - + if (id == zero) { use_new_diskstream (); } else if (use_diskstream (id)) { @@ -248,7 +248,7 @@ MidiTrack::_set_state (const XMLNode& node, bool call_base) return 0; } -XMLNode& +XMLNode& MidiTrack::state(bool full_state) { XMLNode& root (Route::state(full_state)); @@ -267,7 +267,7 @@ MidiTrack::state(bool full_state) (*i)->id.print (buf, sizeof(buf)); inode->add_property (X_("id"), buf); inode->add_child_copy ((*i)->state); - + freeze_node->add_child_nocopy (*inode); } @@ -275,14 +275,14 @@ MidiTrack::state(bool full_state) } /* Alignment: act as a proxy for the diskstream */ - + XMLNode* align_node = new XMLNode (X_("Alignment")); AlignStyle as = _diskstream->alignment_style (); align_node->add_property (X_("style"), enum_2_string (as)); root.add_child_nocopy (*align_node); root.add_property (X_("note-mode"), enum_2_string (_note_mode)); - + /* we don't return diskstream state because we don't own the diskstream exclusively. control of the diskstream state is ceded to the Session, even if we create the @@ -291,7 +291,7 @@ MidiTrack::state(bool full_state) _diskstream->id().print (buf, sizeof(buf)); root.add_property ("diskstream-id", buf); - + root.add_child_nocopy (_rec_enable_control->get_state()); root.add_property ("step-editing", (_step_editing ? "yes" : "no")); @@ -299,7 +299,7 @@ MidiTrack::state(bool full_state) root.add_property ("midi-thru", (_midi_thru ? "yes" : "no")); snprintf (buf, sizeof (buf), "%d", (int) _default_channel); root.add_property ("default-channel", buf); - + return root; } @@ -321,12 +321,12 @@ MidiTrack::set_state_part_two () if ((fnode = find_named_node (*pending_state, X_("freeze-info"))) != 0) { _freeze_record.state = Frozen; - + for (vector<FreezeRecordProcessorInfo*>::iterator i = _freeze_record.processor_info.begin(); i != _freeze_record.processor_info.end(); ++i) { delete *i; } _freeze_record.processor_info.clear (); - + if ((prop = fnode->property (X_("playlist"))) != 0) { boost::shared_ptr<Playlist> pl = _session.playlist_by_name (prop->value()); if (pl) { @@ -337,23 +337,23 @@ MidiTrack::set_state_part_two () return; } } - + if ((prop = fnode->property (X_("state"))) != 0) { _freeze_record.state = FreezeState (string_2_enum (prop->value(), _freeze_record.state)); } - + XMLNodeConstIterator citer; XMLNodeList clist = fnode->children(); - + for (citer = clist.begin(); citer != clist.end(); ++citer) { if ((*citer)->name() != X_("processor")) { continue; } - + if ((prop = (*citer)->property (X_("id"))) == 0) { continue; } - + FreezeRecordProcessorInfo* frii = new FreezeRecordProcessorInfo (*((*citer)->children().front()), boost::shared_ptr<Processor>()); frii->id = prop->value (); @@ -384,7 +384,7 @@ MidiTrack::set_state_part_two () } } return; -} +} int MidiTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, int declick, @@ -392,7 +392,7 @@ MidiTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, { int dret; boost::shared_ptr<MidiDiskstream> diskstream = midi_diskstream(); - + { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); if (lm.locked()) { @@ -413,14 +413,14 @@ MidiTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, nframes_t transport_frame = _session.transport_frame(); - + if ((nframes = check_initial_delay (nframes, transport_frame)) == 0) { /* need to do this so that the diskstream sets its playback distance to zero, thus causing diskstream::commit to do nothing. */ return diskstream->process (transport_frame, 0, can_record, rec_monitors_input); - } + } _silent = false; @@ -442,7 +442,7 @@ MidiTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, */ passthru (start_frame, end_frame, nframes, 0); - + } else { /* XXX is it true that the earlier test on n_outputs() @@ -458,12 +458,12 @@ MidiTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, //const size_t limit = n_process_buffers().n_audio(); BufferSet& bufs = _session.get_scratch_buffers (n_process_buffers()); MidiBuffer& mbuf (bufs.get_midi (0)); - + diskstream->get_playback (mbuf, start_frame, end_frame); /* append immediate messages to the first MIDI buffer (thus sending it to the first output port) */ - write_out_of_band_data (bufs, start_frame, end_frame, nframes); + write_out_of_band_data (bufs, start_frame, end_frame, nframes); // Feed the data through the MidiStateTracker bool did_loop; @@ -487,7 +487,7 @@ MidiTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, } int -MidiTrack::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, +MidiTrack::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, bool state_changing, bool can_record, bool rec_monitors_input) { int ret = Track::no_roll (nframes, start_frame, end_frame, state_changing, can_record, rec_monitors_input); @@ -499,13 +499,13 @@ MidiTrack::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_fram return ret; } -void +void MidiTrack::handle_transport_stopped (bool abort, bool did_locate, bool flush_processors) { /* turn off any notes that are on */ - MidiBuffer buf (1024); // XXX is this a reasonable size ? - + MidiBuffer buf (1024); // XXX is this a reasonable size ? + _midi_state_tracker.resolve_notes (buf, 0); // time is zero because notes are immediate for (MidiBuffer::iterator i = buf.begin(); i != buf.end(); ++i) { @@ -514,7 +514,7 @@ MidiTrack::handle_transport_stopped (bool abort, bool did_locate, bool flush_pro Route::handle_transport_stopped (abort, did_locate, flush_processors); } - + void MidiTrack::push_midi_input_to_step_edit_ringbuffer (nframes_t nframes) @@ -530,7 +530,7 @@ MidiTrack::push_midi_input_to_step_edit_ringbuffer (nframes_t nframes) for (MidiBuffer::const_iterator e = mb->begin(); e != mb->end(); ++e) { const Evoral::MIDIEvent<nframes_t> ev(*e, false); - + /* we don't care about the time for this purpose */ _step_edit_ring_buffer.write (0, ev.type(), ev.size(), ev.buffer()); @@ -605,7 +605,7 @@ MidiTrack::set_note_mode (NoteMode m) } void -MidiTrack::midi_panic() +MidiTrack::midi_panic() { for (uint8_t channel = 0; channel <= 0xF; channel++) { uint8_t ev[3] = { MIDI_CMD_CONTROL | channel, MIDI_CTL_SUSTAIN, 0 }; @@ -645,7 +645,7 @@ MidiTrack::MidiControl::set_value(float val) } else { valid = true; } - + if (!valid) { return; } @@ -661,25 +661,25 @@ MidiTrack::MidiControl::set_value(float val) ev[1] = _list->parameter().id(); ev[2] = int(val); break; - + case MidiPgmChangeAutomation: size = 2; ev[0] += MIDI_CMD_PGM_CHANGE; ev[1] = int(val); break; - + case MidiChannelPressureAutomation: size = 2; ev[0] += MIDI_CMD_CHANNEL_PRESSURE; ev[1] = int(val); break; - + case MidiPitchBenderAutomation: ev[0] += MIDI_CMD_BENDER; ev[1] = 0x7F & int(val); ev[2] = 0x7F & (int(val) >> 7); break; - + default: assert(false); } @@ -687,7 +687,7 @@ MidiTrack::MidiControl::set_value(float val) } AutomationControl::set_value(val); -} +} void MidiTrack::set_step_editing (bool yn) diff --git a/libs/ardour/mix.cc b/libs/ardour/mix.cc index 0bdbf7aa1b..c058dec06b 100644 --- a/libs/ardour/mix.cc +++ b/libs/ardour/mix.cc @@ -30,7 +30,7 @@ using namespace ARDOUR; // Debug wrappers float -debug_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current) +debug_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current) { if ( ((intptr_t)buf % 16) != 0) { std::cerr << "compute_peak(): buffer unaligned!" << std::endl; @@ -83,14 +83,14 @@ debug_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t n float -default_compute_peak (const ARDOUR::Sample * buf, nframes_t nsamples, float current) +default_compute_peak (const ARDOUR::Sample * buf, nframes_t nsamples, float current) { for (nframes_t i = 0; i < nsamples; ++i) { current = f_max (current, fabsf (buf[i])); } return current; -} +} void default_find_peaks (const ARDOUR::Sample * buf, nframes_t nframes, float *min, float *max) @@ -101,7 +101,7 @@ default_find_peaks (const ARDOUR::Sample * buf, nframes_t nframes, float *min, f a = *max; b = *min; - for (i = 0; i < nframes; i++) + for (i = 0; i < nframes; i++) { a = fmax (buf[i], a); b = fmin (buf[i], b); @@ -113,7 +113,7 @@ default_find_peaks (const ARDOUR::Sample * buf, nframes_t nframes, float *min, f void default_apply_gain_to_buffer (ARDOUR::Sample * buf, nframes_t nframes, float gain) -{ +{ for (nframes_t i=0; i<nframes; i++) buf[i] *= gain; } @@ -173,5 +173,5 @@ veclib_mix_buffers_no_gain (ARDOUR::Sample * dst, const ARDOUR::Sample * src, nf } #endif - + diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index 587d6007b3..a97b8aa658 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-4 Paul Davis + Copyright (C) 2002-4 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ using namespace sigc; using namespace MIDI; using namespace PBD; -MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p) +MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p) : session (s) { can_notify_on_unknown_rate = true; @@ -93,14 +93,14 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full) { nframes_t now = session.engine().frame_time(); SMPTE::Time smpte; - + smpte.hours = msg[3]; smpte.minutes = msg[2]; smpte.seconds = msg[1]; smpte.frames = msg[0]; last_mtc_fps_byte = msg[4]; - + switch (msg[4]) { case MTC_24_FPS: smpte.rate = 24; @@ -126,7 +126,7 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full) /* throttle error messages about unknown MTC rates */ if (can_notify_on_unknown_rate) { error << string_compose (_("Unknown rate/drop value %1 in incoming MTC stream, session values used instead"), - (int) msg[4]) + (int) msg[4]) << endmsg; can_notify_on_unknown_rate = false; } @@ -135,42 +135,42 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full) } session.smpte_to_sample (smpte, mtc_frame, true, false); - + if (was_full) { - - current.guard1++; - current.position = mtc_frame; - current.timestamp = 0; - current.guard2++; - - session.request_locate (mtc_frame, false); + + current.guard1++; + current.position = mtc_frame; + current.timestamp = 0; + current.guard2++; + + session.request_locate (mtc_frame, false); session.request_transport_speed (0); - update_mtc_status (MIDI::Parser::MTC_Stopped); + update_mtc_status (MIDI::Parser::MTC_Stopped); + + reset (); - reset (); - } else { - + /* We received the last quarter frame 7 quarter frames (1.75 mtc frames) after the instance when the contents of the mtc quarter frames were decided. Add time to compensate for the elapsed 1.75 frames. - Also compensate for audio latency. + Also compensate for audio latency. */ mtc_frame += (long) (1.75 * session.frames_per_smpte_frame()) + session.worst_output_latency(); - + if (first_mtc_frame == 0) { first_mtc_frame = mtc_frame; first_mtc_time = now; - } - + } + current.guard1++; current.position = mtc_frame; current.timestamp = now; current.guard2++; } - + last_inbound_frame = now; } @@ -178,7 +178,7 @@ void MTC_Slave::handle_locate (const MIDI::byte* mmc_tc) { MIDI::byte mtc[5]; - + mtc[4] = last_mtc_fps_byte; mtc[3] = mmc_tc[0] & 0xf; /* hrs only */ mtc[2] = mmc_tc[1]; @@ -257,7 +257,7 @@ MTC_Slave::ok() const return true; } -bool +bool MTC_Slave::speed_and_position (double& speed, nframes_t& pos) { nframes_t now = session.engine().frame_time(); @@ -273,7 +273,7 @@ MTC_Slave::speed_and_position (double& speed, nframes_t& pos) pos = last.position; return true; } - + /* no timecode for 1/4 second ? conclude that its stopped */ if (last_inbound_frame && now > last_inbound_frame && now - last_inbound_frame > session.frame_rate() / 4) { @@ -317,9 +317,9 @@ MTC_Slave::speed_and_position (double& speed, nframes_t& pos) elapsed = 0; } else { - + /* scale elapsed time by the current MTC speed */ - + if (last.timestamp && (now > last.timestamp)) { elapsed = (nframes_t) floor (mtc_speed * (now - last.timestamp)); } else { @@ -348,9 +348,9 @@ MTC_Slave::reset () be being updated as we call this. but this supposed to be a realtime-safe call. */ - + port->input()->reset_mtc_state (); - + last_inbound_frame = 0; current.guard1++; current.position = 0; diff --git a/libs/ardour/mtdm.cc b/libs/ardour/mtdm.cc index c2a0e1e021..4e208a56f7 100644 --- a/libs/ardour/mtdm.cc +++ b/libs/ardour/mtdm.cc @@ -1,6 +1,6 @@ /* Copyright (C) 2003-2008 Fons Adriaensen <fons@kokkinizita.net> - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -18,25 +18,25 @@ #include <ardour/mtdm.h> -MTDM::MTDM (void) +MTDM::MTDM (void) : _cnt (0) , _inv (0) { int i; Freq *F; - + _freq [0].f = 4096; _freq [1].f = 512; _freq [2].f = 1088; _freq [3].f = 1544; _freq [4].f = 2049; - + _freq [0].a = 0.2f; _freq [1].a = 0.1f; _freq [2].a = 0.1f; _freq [3].a = 0.1f; _freq [4].a = 0.1f; - + for (i = 0, F = _freq; i < 5; i++, F++) { F->p = 128; F->xa = F->ya = 0.0f; @@ -44,27 +44,27 @@ MTDM::MTDM (void) } } -int +int MTDM::process (size_t len, float *ip, float *op) { int i; float vip, vop, a, c, s; Freq *F; - + while (len--) { vop = 0.0f; vip = *ip++; for (i = 0, F = _freq; i < 5; i++, F++) { - a = 2 * (float) M_PI * (F->p & 65535) / 65536.0; + a = 2 * (float) M_PI * (F->p & 65535) / 65536.0; F->p += F->f; - c = cosf (a); - s = -sinf (a); + c = cosf (a); + s = -sinf (a); vop += F->a * s; F->xa += s * vip; F->ya += c * vip; - } + } *op++ = vop; if (++_cnt == 16) { @@ -81,13 +81,13 @@ MTDM::process (size_t len, float *ip, float *op) return 0; } -int +int MTDM::resolve () { int i, k, m; double d, e, f0, p; Freq *F = _freq; - + if (hypot (F->xf, F->yf) < 0.01) { return -1; } @@ -120,13 +120,13 @@ MTDM::resolve () _err = e; } if (e > 0.4) { - return 1; + return 1; } d += m * (k & 7); m *= 8; - } + } _del = 16 * d; - + return 0; } diff --git a/libs/ardour/mute_master.cc b/libs/ardour/mute_master.cc index db4b6ca178..9aea8f981a 100644 --- a/libs/ardour/mute_master.cc +++ b/libs/ardour/mute_master.cc @@ -1,6 +1,6 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/named_selection.cc b/libs/ardour/named_selection.cc index dbb4a8ca4d..d2cf1c03a8 100644 --- a/libs/ardour/named_selection.cc +++ b/libs/ardour/named_selection.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ sigc::signal<void,NamedSelection*> NamedSelection::NamedSelectionCreated; typedef std::list<boost::shared_ptr<Playlist> > PlaylistList; -NamedSelection::NamedSelection (string n, PlaylistList& l) +NamedSelection::NamedSelection (string n, PlaylistList& l) : name (n) { playlists = l; @@ -65,7 +65,7 @@ NamedSelection::NamedSelection (Session& session, const XMLNode& node) } name = property->value(); - + if ((lists_node = find_named_node (node, "Playlists")) == 0) { return; } @@ -126,6 +126,6 @@ NamedSelection::get_state () plnode->add_property ("name", (*i)->name()); child->add_child_nocopy (*plnode); } - + return *root; } diff --git a/libs/ardour/onset_detector.cc b/libs/ardour/onset_detector.cc index 474632115f..85917041b6 100644 --- a/libs/ardour/onset_detector.cc +++ b/libs/ardour/onset_detector.cc @@ -16,9 +16,9 @@ OnsetDetector::OnsetDetector (float sr) /* update the op_id */ _op_id = X_("libardourvampplugins:aubioonset"); - + // XXX this should load the above-named plugin and get the current version - + _op_id += ":2"; } @@ -48,13 +48,13 @@ OnsetDetector::use_features (Plugin::FeatureSet& features, ostream* out) const Plugin::FeatureList& fl (features[0]); for (Plugin::FeatureList::const_iterator f = fl.begin(); f != fl.end(); ++f) { - + if ((*f).hasTimestamp) { if (out) { (*out) << (*f).timestamp.toString() << endl; - } - + } + current_results->push_back (RealTime::realTime2Frame ((*f).timestamp, (nframes_t) floor(sample_rate))); } } @@ -94,23 +94,23 @@ OnsetDetector::cleanup_onsets (AnalysisFeatureList& t, float sr, float gap_msecs } t.sort (); - + /* remove duplicates or other things that are too close */ - + AnalysisFeatureList::iterator i = t.begin(); AnalysisFeatureList::iterator f, b; const nframes64_t gap_frames = (nframes64_t) floor (gap_msecs * (sr / 1000.0)); - + while (i != t.end()) { // move front iterator to just past i, and back iterator the same place - + f = i; ++f; b = f; // move f until we find a new value that is far enough away - + while ((f != t.end()) && (((*f) - (*i)) < gap_frames)) { ++f; } diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index d23929232a..a8d30954cc 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -62,15 +62,15 @@ string EqualPowerStereoPanner::name = "Equal Power Stereo"; string Multi2dPanner::name = "Multiple (2D)"; /* this is a default mapper of control values to a pan position - others can be imagined. + others can be imagined. */ -static pan_t direct_control_to_pan (double fract) { +static pan_t direct_control_to_pan (double fract) { return fract; } -//static double direct_pan_to_control (pan_t val) { +//static double direct_pan_to_control (pan_t val) { // return val; //} @@ -82,7 +82,7 @@ StreamPanner::StreamPanner (Panner& p, Evoral::Parameter param) _muted = false; _control = boost::dynamic_pointer_cast<AutomationControl>( parent.control( param, true ) ); - + x = 0.5; y = 0.5; z = 0.5; @@ -137,7 +137,7 @@ StreamPanner::set_position (float xpos, float ypos, bool link_call) } if (x != xpos || y != ypos) { - + x = xpos; y = ypos; update (); @@ -196,7 +196,7 @@ BaseStereoPanner::load (istream& in, string path, uint32_t& linecnt) { char line[128]; LocaleGuard lg (X_("POSIX")); - + _control->list()->clear (); while (in.getline (line, sizeof (line), '\n')) { @@ -236,55 +236,55 @@ BaseStereoPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain if (_muted) { return; } - + Sample* const src = srcbuf.data(); /* LEFT */ dst = obufs.get_audio(0).data(); - if (fabsf ((delta = (left - desired_left))) > 0.002) { // about 1 degree of arc - + if (fabsf ((delta = (left - desired_left))) > 0.002) { // about 1 degree of arc + /* interpolate over 64 frames or nframes, whichever is smaller */ - + nframes_t limit = min ((nframes_t)64, nframes); nframes_t n; delta = -(delta / (float) (limit)); - + for (n = 0; n < limit; n++) { left_interp = left_interp + delta; left = left_interp + 0.9 * (left - left_interp); dst[n] += src[n] * left * gain_coeff; } - + pan = left * gain_coeff; mix_buffers_with_gain (dst+n,src+n,nframes-n,pan); - + } else { - + left = desired_left; left_interp = left; if ((pan = (left * gain_coeff)) != 1.0f) { - + if (pan != 0.0f) { - + mix_buffers_with_gain(dst,src,nframes,pan); /* mark that we wrote into the buffer */ // obufs[0] = 0; - } - + } + } else { - + mix_buffers_no_gain(dst,src,nframes); - + /* mark that we wrote into the buffer */ - + // obufs[0] = 0; } } @@ -292,11 +292,11 @@ BaseStereoPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain /* RIGHT */ dst = obufs.get_audio(1).data(); - - if (fabsf ((delta = (right - desired_right))) > 0.002) { // about 1 degree of arc - + + if (fabsf ((delta = (right - desired_right))) > 0.002) { // about 1 degree of arc + /* interpolate over 64 frames or nframes, whichever is smaller */ - + nframes_t limit = min ((nframes_t)64, nframes); nframes_t n; @@ -307,31 +307,31 @@ BaseStereoPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain right = right_interp + 0.9 * (right - right_interp); dst[n] += src[n] * right * gain_coeff; } - + pan = right * gain_coeff; - + mix_buffers_with_gain(dst+n,src+n,nframes-n,pan); - + /* XXX it would be nice to mark the buffer as written to */ } else { right = desired_right; right_interp = right; - + if ((pan = (right * gain_coeff)) != 1.0f) { - + if (pan != 0.0f) { - + mix_buffers_with_gain(dst,src,nframes,pan); - + /* XXX it would be nice to mark the buffer as written to */ } - + } else { - + mix_buffers_no_gain(dst,src,nframes); - + /* XXX it would be nice to mark the buffer as written to */ } } @@ -359,7 +359,7 @@ EqualPowerStereoPanner::update () { /* it would be very nice to split this out into a virtual function that can be accessed from BaseStereoPanner and used in distribute_automated(). - + but the place where its used in distribute_automated() is a tight inner loop, and making "nframes" virtual function calls to compute values is an absurd overhead. @@ -374,7 +374,7 @@ EqualPowerStereoPanner::update () const float pan_law_attenuation = -3.0f; const float scale = 2.0f - 4.0f * powf (10.0f,pan_law_attenuation/20.0f); - + desired_left = panL * (scale * panL + 1.0f - scale); desired_right = panR * (scale * panR + 1.0f - scale); @@ -383,7 +383,7 @@ EqualPowerStereoPanner::update () } void -EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& obufs, +EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& obufs, nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers) { @@ -424,7 +424,7 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob float panR = buffers[0][n]; float panL = 1 - panR; - + buffers[0][n] = panL * (scale * panL + 1.0f - scale); buffers[1][n] = panR * (scale * panR + 1.0f - scale); } @@ -433,10 +433,10 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob dst = obufs.get_audio(0).data(); pbuf = buffers[0]; - + for (nframes_t n = 0; n < nframes; ++n) { dst[n] += src[n] * pbuf[n]; - } + } /* XXX it would be nice to mark the buffer as written to */ @@ -447,8 +447,8 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob for (nframes_t n = 0; n < nframes; ++n) { dst[n] += src[n] * pbuf[n]; - } - + } + /* XXX it would be nice to mark the buffer as written to */ } @@ -471,7 +471,7 @@ EqualPowerStereoPanner::state (bool /*full_state*/) char buf[64]; LocaleGuard lg (X_("POSIX")); - snprintf (buf, sizeof (buf), "%.12g", x); + snprintf (buf, sizeof (buf), "%.12g", x); root->add_property (X_("x"), buf); root->add_property (X_("type"), EqualPowerStereoPanner::name); @@ -494,7 +494,7 @@ EqualPowerStereoPanner::set_state (const XMLNode& node) if ((prop = node.property (X_("x")))) { pos = atof (prop->value().c_str()); set_position (pos, true); - } + } StreamPanner::set_state (node); @@ -554,7 +554,7 @@ Multi2dPanner::update () fr = (float) (1.0 / sqrt((double)f)); #else fr = 1.0 / sqrtf(f); -#endif +#endif for (i = 0; i < nouts; ++i) { parent.outputs[i].desired_pan = 1.0f - (dsq[i] * fr); } @@ -573,43 +573,43 @@ Multi2dPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_co if (_muted) { return; } - + Sample* const src = srcbuf.data(); for (n = 0, o = parent.outputs.begin(); o != parent.outputs.end(); ++o, ++n) { dst = obufs.get_audio(n).data(); - + #ifdef CAN_INTERP - if (fabsf ((delta = (left_interp - desired_left))) > 0.002) { // about 1 degree of arc - + if (fabsf ((delta = (left_interp - desired_left))) > 0.002) { // about 1 degree of arc + /* interpolate over 64 frames or nframes, whichever is smaller */ - + nframes_t limit = min ((nframes_t)64, nframes); nframes_t n; - + delta = -(delta / (float) (limit)); - + for (n = 0; n < limit; n++) { left_interp = left_interp + delta; left = left_interp + 0.9 * (left - left_interp); dst[n] += src[n] * left * gain_coeff; } - + pan = left * gain_coeff; mix_buffers_with_gain(dst+n,src+n,nframes-n,pan); - + } else { -#else +#else pan = (*o).desired_pan; - + if ((pan *= gain_coeff) != 1.0f) { - + if (pan != 0.0f) { mix_buffers_with_gain(dst,src,nframes,pan); - } + } } else { mix_buffers_no_gain(dst,src,nframes); } @@ -618,12 +618,12 @@ Multi2dPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_co } #endif } - + return; } void -Multi2dPanner::distribute_automated (AudioBuffer& /*src*/, BufferSet& /*obufs*/, +Multi2dPanner::distribute_automated (AudioBuffer& /*src*/, BufferSet& /*obufs*/, nframes_t /*start*/, nframes_t /*end*/, nframes_t /*nframes*/, pan_t** /*buffers*/) { @@ -661,9 +661,9 @@ Multi2dPanner::state (bool /*full_state*/) char buf[64]; LocaleGuard lg (X_("POSIX")); - snprintf (buf, sizeof (buf), "%.12g", x); + snprintf (buf, sizeof (buf), "%.12g", x); root->add_property (X_("x"), buf); - snprintf (buf, sizeof (buf), "%.12g", y); + snprintf (buf, sizeof (buf), "%.12g", y); root->add_property (X_("y"), buf); root->add_property (X_("type"), Multi2dPanner::name); @@ -685,17 +685,17 @@ Multi2dPanner::set_state (const XMLNode& node) if ((prop = node.property (X_("x")))) { newx = atof (prop->value().c_str()); } - + if ((prop = node.property (X_("y")))) { newy = atof (prop->value().c_str()); } - + if (x < 0 || y < 0) { error << _("badly-formed positional data for Multi2dPanner - ignored") << endmsg; return -1; - } - + } + set_position (newx, newy); return 0; } @@ -759,7 +759,7 @@ Panner::reset_to_default () case 1: return; } - + if (outputs.size() == 2) { switch (_streampanners.size()) { case 1: @@ -777,7 +777,7 @@ Panner::reset_to_default () break; } } - + vector<Output>::iterator o; vector<StreamPanner*>::iterator p; @@ -792,7 +792,7 @@ Panner::reset_streampanner (uint32_t which) if (which >= _streampanners.size() || which >= outputs.size()) { return; } - + switch (outputs.size()) { case 0: case 1: @@ -830,14 +830,14 @@ Panner::reset (uint32_t nouts, uint32_t npans) bool changed = false; bool do_not_and_did_not_need_panning = ((nouts < 2) && (outputs.size() < 2)); - /* if new and old config don't need panning, or if + /* if new and old config don't need panning, or if the config hasn't changed, we're done. */ - if (do_not_and_did_not_need_panning || + if (do_not_and_did_not_need_panning || ((nouts == outputs.size()) && (npans == _streampanners.size()))) { return; - } + } n = _streampanners.size(); clear_panners (); @@ -889,7 +889,7 @@ Panner::reset (uint32_t nouts, uint32_t npans) _streampanners.push_back (new Multi2dPanner (*this, Evoral::Parameter(PanAutomation, 0, n))); } - break; + break; case 4: // square outputs.push_back (Output (0, 0)); @@ -901,7 +901,7 @@ Panner::reset (uint32_t nouts, uint32_t npans) _streampanners.push_back (new Multi2dPanner (*this, Evoral::Parameter(PanAutomation, 0, n))); } - break; + break; case 5: //square+offcenter center outputs.push_back (Output (0, 0)); @@ -933,9 +933,9 @@ Panner::reset (uint32_t nouts, uint32_t npans) (*x)->update (); } - /* force hard left/right panning in a common case: 2in/2out + /* force hard left/right panning in a common case: 2in/2out */ - + if (npans == 2 && outputs.size() == 2) { /* Do this only if we changed configuration, or our configuration @@ -949,13 +949,13 @@ Panner::reset (uint32_t nouts, uint32_t npans) _streampanners.back()->get_position (right); if (changed || ((left == 0.5) && (right == 0.5))) { - + _streampanners.front()->set_position (0.0); _streampanners.front()->pan_control()->list()->reset_default (0.0); - + _streampanners.back()->set_position (1.0); _streampanners.back()->pan_control()->list()->reset_default (1.0); - + changed = true; } } @@ -999,7 +999,7 @@ Panner::set_automation_style (AutoStyle style) ((AutomationList*)(*i)->pan_control()->list().get())->set_automation_style (style); } _session.set_dirty (); -} +} void Panner::set_automation_state (AutoState state) @@ -1008,7 +1008,7 @@ Panner::set_automation_state (AutoState state) ((AutomationList*)(*i)->pan_control()->list().get())->set_automation_state (state); } _session.set_dirty (); -} +} AutoState Panner::automation_state () const @@ -1075,7 +1075,7 @@ Panner::state (bool full) onode->add_property (X_("y"), buf); node->add_child_nocopy (*onode); } - + for (vector<StreamPanner*>::const_iterator i = _streampanners.begin(); i != _streampanners.end(); ++i) { node->add_child_nocopy ((*i)->state (full)); } @@ -1111,7 +1111,7 @@ Panner::set_state (const XMLNode& node) if ((prop = node.property (X_("bypassed"))) != 0) { set_bypassed (string_is_affirmative (prop->value())); } - + if ((prop = node.property (X_("link_direction"))) != 0) { LinkDirection ld; /* here to provide type information */ set_link_direction (LinkDirection (string_2_enum (prop->value(), ld))); @@ -1121,15 +1121,15 @@ Panner::set_state (const XMLNode& node) for (niter = nlist.begin(); niter != nlist.end(); ++niter) { if ((*niter)->name() == X_("Output")) { - + float x, y; - + prop = (*niter)->property (X_("x")); sscanf (prop->value().c_str(), "%g", &x); - + prop = (*niter)->property (X_("y")); sscanf (prop->value().c_str(), "%g", &y); - + outputs.push_back (Output (x, y)); } } @@ -1137,30 +1137,30 @@ Panner::set_state (const XMLNode& node) for (niter = nlist.begin(); niter != nlist.end(); ++niter) { if ((*niter)->name() == X_("StreamPanner")) { - + if ((prop = (*niter)->property (X_("type")))) { - + for (i = 0; pan_plugins[i].factory; ++i) { if (prop->value() == pan_plugins[i].name) { - - + + /* note that we assume that all the stream panners are of the same type. pretty good assumption, but it's still an assumption. */ - + sp = pan_plugins[i].factory (*this, Evoral::Parameter(PanAutomation, 0, num_panners)); num_panners++; - + if (sp->set_state (**niter) == 0) { _streampanners.push_back (sp); } - + break; } } - - + + if (!pan_plugins[i].factory) { error << string_compose (_("Unknown panner plugin \"%1\" found in pan state - ignored"), prop->value()) @@ -1173,7 +1173,7 @@ Panner::set_state (const XMLNode& node) return -1; } - } + } } reset (outputs.size (), num_panners); @@ -1182,9 +1182,9 @@ Panner::set_state (const XMLNode& node) if ((prop = node.property (X_("automation")))) { /* automation path is relative */ - + automation_path = Glib::build_filename(_session.automation_dir(), prop->value ()); - } + } return 0; } @@ -1210,7 +1210,7 @@ Panner::set_position (float xpos, StreamPanner& orig) orig.get_position (xnow); xdelta = xpos - xnow; - + if (_link_direction == SameDirection) { for (vector<StreamPanner*>::iterator i = _streampanners.begin(); i != _streampanners.end(); ++i) { @@ -1249,7 +1249,7 @@ Panner::set_position (float xpos, float ypos, StreamPanner& orig) orig.get_position (xnow, ynow); xdelta = xpos - xnow; ydelta = ypos - ynow; - + if (_link_direction == SameDirection) { for (vector<StreamPanner*>::iterator i = _streampanners.begin(); i != _streampanners.end(); ++i) { @@ -1275,7 +1275,7 @@ Panner::set_position (float xpos, float ypos, StreamPanner& orig) (*i)->set_position (xpos, ypos, true); } else { (*i)->get_position (xnow, ynow); - + xnew = min (1.0f, xnow - xdelta); xnew = max (0.0f, xnew); @@ -1307,7 +1307,7 @@ Panner::set_position (float xpos, float ypos, float zpos, StreamPanner& orig) (*i)->set_position (xpos, ypos, zpos, true); } else { (*i)->get_position (xnow, ynow, znow); - + xnew = min (1.0f, xnow + xdelta); xnew = max (0.0f, xnew); @@ -1357,7 +1357,7 @@ Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes assert(!bypassed()); assert(!empty()); - + if (outbufs.count().n_audio() == 1) { AudioBuffer& dst = outbufs.get_audio(0); @@ -1367,14 +1367,14 @@ Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes /* only one output, and gain was zero, so make it silent */ dst.silence (nframes); - + } else if (gain_coeff == 1.0f){ /* mix all buffers into the output */ // copy the first dst.read_from(inbufs.get_audio(0), nframes); - + // accumulate starting with the second if (inbufs.count().n_audio() > 0) { BufferSet::audio_iterator i = inbufs.audio_begin(); @@ -1389,7 +1389,7 @@ Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes // copy the first dst.read_from(inbufs.get_audio(0), nframes); - + // accumulate (with gain) starting with the second if (inbufs.count().n_audio() > 0) { BufferSet::audio_iterator i = inbufs.audio_begin(); @@ -1402,7 +1402,7 @@ Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes return; } - + /* the terrible silence ... */ for (BufferSet::audio_iterator i = outbufs.audio_begin(); i != outbufs.audio_end(); ++i) { i->silence(nframes); @@ -1417,7 +1417,7 @@ Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes void Panner::run (BufferSet& inbufs, BufferSet& outbufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes) -{ +{ if (outbufs.count().n_audio() == 0) { // Failing to deliver audio we were asked to deliver is a bug assert(inbufs.count().n_audio() == 0); @@ -1443,7 +1443,7 @@ Panner::run (BufferSet& inbufs, BufferSet& outbufs, sframes_t start_frame, sfram } // Otherwise.. let the automation flow, baby - + if (outbufs.count().n_audio() == 1) { AudioBuffer& dst = outbufs.get_audio(0); @@ -1464,7 +1464,7 @@ Panner::run (BufferSet& inbufs, BufferSet& outbufs, sframes_t start_frame, sfram // More than 1 output, we should have 1 panner for each input //assert(_streampanners.size() == inbufs.count().n_audio()); - + /* the terrible silence ... */ for (BufferSet::audio_iterator i = outbufs.audio_begin(); i != outbufs.audio_end(); ++i) { i->silence(nframes); @@ -1482,7 +1482,7 @@ Panner::run (BufferSet& inbufs, BufferSet& outbufs, sframes_t start_frame, sfram void Panner::set_name (string str) { - automation_path = Glib::build_filename(_session.automation_dir(), + automation_path = Glib::build_filename(_session.automation_dir(), _session.snap_name() + "-pan-" + legalize_for_path (str) + ".automation"); } */ @@ -1499,7 +1499,7 @@ Panner::load () if (automation_path.length() == 0) { return 0; } - + if (access (automation_path.c_str(), F_OK)) { return 0; } @@ -1524,7 +1524,7 @@ Panner::load () return -1; } } else { - error << string_compose(_("no version information in pan automation event file \"%1\" (first line = %2)"), + error << string_compose(_("no version information in pan automation event file \"%1\" (first line = %2)"), automation_path, line) << endmsg; return -1; } @@ -1537,7 +1537,7 @@ Panner::load () } if (strcmp (line, "begin") == 0) { - + if (sp == _streampanners.end()) { error << string_compose (_("too many panner states found in pan automation file %1"), automation_path) @@ -1548,7 +1548,7 @@ Panner::load () if ((*sp)->load (in, automation_path, linecnt)) { return -1; } - + ++sp; } } diff --git a/libs/ardour/pcm_utils.cc b/libs/ardour/pcm_utils.cc index 0e810ba599..de3497d977 100644 --- a/libs/ardour/pcm_utils.cc +++ b/libs/ardour/pcm_utils.cc @@ -38,7 +38,7 @@ pcm_let2f_array (tribyte *src, int count, float *dest) static const float normfact = 1.0 / ((float) 0x80000000); unsigned char *ucptr ; - int value ; + int value ; ucptr = ((unsigned char*) src) + 3 * count ; while (--count >= 0) @@ -53,11 +53,11 @@ pcm_bet2f_array (tribyte *src, int count, float *dest) { /* Special normfactor because tribyte value is read into an int. */ static const float normfact = 1.0 / ((float) 0x80000000); - + unsigned char *ucptr ; int value ; - + ucptr = ((unsigned char*) src) + 3 * count ; while (--count >= 0) { ucptr -= 3 ; @@ -125,7 +125,7 @@ void pcm_f2bet_array (const float *src, tribyte *dest, int count) { static const float normfact = (1.0 * 0x7FFFFF); - + unsigned char *ucptr ; int value ; diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 53d749db82..ce9f0335b8 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2003 Paul Davis + Copyright (C) 2000-2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,8 +47,8 @@ using namespace PBD; struct ShowMeTheList { ShowMeTheList (boost::shared_ptr<Playlist> pl, const string& n) : playlist (pl), name (n) {} - ~ShowMeTheList () { - cerr << ">>>>" << name << endl; playlist->dump(); cerr << "<<<<" << name << endl << endl; + ~ShowMeTheList () { + cerr << ">>>>" << name << endl; playlist->dump(); cerr << "<<<<" << name << endl << endl; }; boost::shared_ptr<Playlist> playlist; string name; @@ -62,17 +62,17 @@ struct RegionSortByLayer { struct RegionSortByLayerWithPending { bool operator () (boost::shared_ptr<Region> a, boost::shared_ptr<Region> b) { - + double p = a->layer (); if (a->pending_explicit_relayer()) { p += 0.5; } - + double q = b->layer (); if (b->pending_explicit_relayer()) { q += 0.5; } - + return p < q; } }; @@ -97,7 +97,7 @@ Playlist::Playlist (Session& sess, string nom, DataType type, bool hide) init (hide); first_set_state = false; _name = nom; - + } Playlist::Playlist (Session& sess, const XMLNode& node, DataType type, bool hide) @@ -120,7 +120,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, boo RegionList tmp; other->copy_regions (tmp); - + in_set_state++; for (list<boost::shared_ptr<Region> >::iterator x = tmp.begin(); x != tmp.end(); ++x) { @@ -140,7 +140,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, boo subcnt = 0; _read_data_count = 0; _frozen = other->_frozen; - + layer_op_counter = other->layer_op_counter; freeze_length = other->freeze_length; } @@ -205,7 +205,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, nframes_t start, nf add_region_internal (new_region, position); } - + in_set_state--; first_set_state = false; @@ -223,7 +223,7 @@ void Playlist::release () { if (_refcnt > 0) { - _refcnt--; + _refcnt--; } if (_refcnt == 0) { @@ -299,7 +299,7 @@ Playlist::set_name (const string& str) /*********************************************************************** CHANGE NOTIFICATION HANDLING - + Notifications must be delayed till the region_lock is released. This is necessary because handlers for the signals may need to acquire the lock (e.g. to read from the playlist). @@ -330,9 +330,9 @@ Playlist::delay_notifications () void Playlist::release_notifications () { - if (g_atomic_int_dec_and_test (&block_notifications)) { + if (g_atomic_int_dec_and_test (&block_notifications)) { flush_notifications (); - } + } } void @@ -369,11 +369,11 @@ void Playlist::notify_region_moved (boost::shared_ptr<Region> r) { Evoral::RangeMove<nframes_t> const move (r->last_position (), r->length (), r->position ()); - + if (holding_state ()) { pending_range_moves.push_back (move); - + } else { list< Evoral::RangeMove<nframes_t> > m; @@ -431,7 +431,7 @@ Playlist::flush_notifications () /* we have no idea what order the regions ended up in pending bounds (it could be based on selection order, for example). - so, to preserve layering in the "most recently moved is higher" + so, to preserve layering in the "most recently moved is higher" model, sort them by existing layer, then timestamp them. */ @@ -496,11 +496,11 @@ Playlist::flush_notifications () *************************************************************/ void -Playlist::add_region (boost::shared_ptr<Region> region, nframes_t position, float times, bool auto_partition) +Playlist::add_region (boost::shared_ptr<Region> region, nframes_t position, float times, bool auto_partition) { RegionLock rlock (this); times = fabs (times); - + int itimes = (int) floor (times); nframes_t pos = position; @@ -508,14 +508,14 @@ Playlist::add_region (boost::shared_ptr<Region> region, nframes_t position, floa if(times == 1 && auto_partition){ partition(pos, (nframes_t) (pos + region->length()), true); } - + if (itimes >= 1) { add_region_internal (region, pos); pos += region->length(); --itimes; } - - + + /* note that itimes can be zero if we being asked to just insert a single fraction of the region. */ @@ -525,7 +525,7 @@ Playlist::add_region (boost::shared_ptr<Region> region, nframes_t position, floa add_region_internal (copy, pos); pos += region->length(); } - + nframes_t length = 0; if (floor (times) != times) { @@ -559,7 +559,7 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, nframes_t posit } RegionSortByPosition cmp; - + nframes_t old_length = 0; if (!holding_state()) { @@ -569,7 +569,7 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, nframes_t posit if (!first_set_state) { boost::shared_ptr<Playlist> foo (shared_from_this()); region->set_playlist (boost::weak_ptr<Playlist>(foo)); - } + } region->set_position (position, this); @@ -588,7 +588,7 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, nframes_t posit /* we need to notify the existence of new region before checking dependents. Ick. */ notify_region_added (region); - + if (!holding_state ()) { check_dependents (region, false); @@ -599,7 +599,7 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, nframes_t posit } region_state_changed_connections.push_back ( - region->StateChanged.connect (sigc::bind (mem_fun (this, &Playlist::region_changed_proxy), + region->StateChanged.connect (sigc::bind (mem_fun (this, &Playlist::region_changed_proxy), boost::weak_ptr<Region> (region))) ); @@ -657,7 +657,7 @@ Playlist::remove_region_internal (boost::shared_ptr<Region> region) if (!holding_state ()) { relayer (); remove_dependents (region); - + if (old_length != _get_maximum_extent()) { notify_length_changed (); } @@ -728,20 +728,20 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi RegionList::iterator tmp; OverlapType overlap; nframes_t pos1, pos2, pos3, pos4; - + in_partition = true; - + /* need to work from a copy, because otherwise the regions we add during the process get operated on as well. */ - + RegionList copy = regions; - + for (RegionList::iterator i = copy.begin(); i != copy.end(); i = tmp) { tmp = i; ++tmp; - + current = *i; if (current->first_frame() >= start && current->last_frame() < end) { @@ -752,7 +752,7 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi continue; } - + /* coverage will return OverlapStart if the start coincides with the end point. we do not partition such a region, so catch this special case. @@ -770,12 +770,12 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi pos2 = start; pos3 = end; pos4 = current->last_frame(); - + if (overlap == OverlapInternal) { /* split: we need 3 new regions, the front, middle and end. cut: we need 2 regions, the front and end. */ - + /* start end ---------------*************************------------ @@ -784,30 +784,30 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi ---------------*****++++++++++++++++====------------ CUT ---------------*****----------------====------------ - + */ if (!cutting) { /* "middle" ++++++ */ - + _session.region_name (new_name, current->name(), false); region = RegionFactory::create (current, pos2 - pos1, pos3 - pos2, new_name, regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit|Region::RightOfSplit)); add_region_internal (region, start); new_regions.push_back (region); } - + /* "end" ====== */ - + _session.region_name (new_name, current->name(), false); - region = RegionFactory::create (current, pos3 - pos1, pos4 - pos3, new_name, + region = RegionFactory::create (current, pos3 - pos1, pos4 - pos3, new_name, regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit)); add_region_internal (region, end); new_regions.push_back (region); - + /* "front" ***** */ - + current->freeze (); thawlist.push_back (current); current->trim_end (pos2, this); @@ -818,16 +818,16 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi start end ---------------*************************------------ P1 P2 P4 P3 - SPLIT: + SPLIT: ---------------**************+++++++++++------------ - CUT: + CUT: ---------------**************----------------------- */ - + if (!cutting) { /* end +++++ */ - + _session.region_name (new_name, current->name(), false); region = RegionFactory::create (current, pos2 - pos1, pos4 - pos2, new_name, (layer_t) regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit)); @@ -835,9 +835,9 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi add_region_internal (region, start); new_regions.push_back (region); } - + /* front ****** */ - + current->freeze (); thawlist.push_back (current); current->trim_end (pos2, this); @@ -847,17 +847,17 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi /* split: we need 2 regions: the front and the end. cut: just trim current to skip the cut area */ - + /* start end ---------------*************************------------ - P2 P1 P3 P4 + P2 P1 P3 P4 SPLIT: ---------------****+++++++++++++++++++++------------ CUT: -------------------*********************------------ - + */ if (!cutting) { @@ -868,10 +868,10 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi add_region_internal (region, pos1); new_regions.push_back (region); - } - + } + /* end */ - + current->freeze (); thawlist.push_back (current); current->trim_front (pos3, this); @@ -880,19 +880,19 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi /* split: no split required. cut: remove the region. */ - + /* start end ---------------*************************------------ - P2 P1 P3 P4 + P2 P1 P3 P4 SPLIT: ---------------*************************------------ CUT: ---------------------------------------------------- - + */ - + if (cutting) { remove_region_internal (current); } @@ -925,11 +925,11 @@ Playlist::cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(nframes_t, nfra for (list<AudioRange>::iterator i = ranges.begin(); i != ranges.end(); ++i) { pl = (this->*pmf)((*i).start, (*i).length(), result_is_hidden); - + if (i == ranges.begin()) { ret = pl; } else { - + /* paste the next section into the nascent playlist, offset to reflect the start of the first range we chopped. @@ -985,7 +985,7 @@ boost::shared_ptr<Playlist> Playlist::copy (nframes_t start, nframes_t cnt, bool result_is_hidden) { char buf[32]; - + snprintf (buf, sizeof (buf), "%" PRIu32, ++subcnt); string new_name = _name; new_name += '.'; @@ -1006,7 +1006,7 @@ Playlist::paste (boost::shared_ptr<Playlist> other, nframes_t position, float ti RegionLock rl2 (other.get()); old_length = _get_maximum_extent(); - + int itimes = (int) floor (times); nframes_t pos = position; nframes_t shift = other->_get_maximum_extent(); @@ -1019,7 +1019,7 @@ Playlist::paste (boost::shared_ptr<Playlist> other, nframes_t position, float ti /* put these new regions on top of all existing ones, but preserve the ordering they had in the original playlist. */ - + copy_of_region->set_layer (copy_of_region->layer() + top_layer); add_region_internal (copy_of_region, copy_of_region->position() + pos); } @@ -1033,7 +1033,7 @@ Playlist::paste (boost::shared_ptr<Playlist> other, nframes_t position, float ti notify_length_changed (); } - + } return 0; @@ -1077,14 +1077,14 @@ Playlist::shift (nframes64_t at, nframes64_t distance, bool move_intersected, bo /* too early */ continue; } - + if (at > (*r)->first_frame() && at < (*r)->last_frame()) { /* intersected region */ if (!move_intersected) { continue; } } - + /* do not move regions glued to music time - that has to be done separately. */ @@ -1143,13 +1143,13 @@ Playlist::_split_region (boost::shared_ptr<Region> region, nframes_t playlist_po string after_name; /* split doesn't change anything about length, so don't try to splice */ - + bool old_sp = _splicing; _splicing = true; before = playlist_position - region->position(); after = region->length() - before; - + _session.region_name (before_name, region->name(), false); left = RegionFactory::create (region, 0, before, before_name, region->layer(), Region::Flag (region->flags()|Region::LeftOfSplit)); @@ -1165,14 +1165,14 @@ Playlist::_split_region (boost::shared_ptr<Region> region, nframes_t playlist_po (*i)->set_last_layer_op( (*i)->last_layer_op() + 1 ); } } - + left->set_last_layer_op ( orig_layer_op ); right->set_last_layer_op ( orig_layer_op + 1); layer_op_counter++; finalize_split_region (region, left, right); - + remove_region_internal (region); _splicing = old_sp; @@ -1236,8 +1236,8 @@ Playlist::core_splice (nframes_t at, nframes64_t distance, boost::shared_ptr<Reg new_pos = 0; } else if (new_pos >= max_frames - (*i)->length()) { new_pos = max_frames - (*i)->length(); - } - + } + (*i)->set_position (new_pos, this); } } @@ -1259,11 +1259,11 @@ Playlist::region_bounds_changed (Change what_changed, boost::shared_ptr<Region> /* remove it from the list then add it back in the right place again. */ - + RegionSortByPosition cmp; RegionList::iterator i = find (regions.begin(), regions.end(), region); - + if (i == regions.end()) { warning << string_compose (_("%1: bounds changed received for region (%2)not in playlist"), _name, region->name()) @@ -1276,16 +1276,16 @@ Playlist::region_bounds_changed (Change what_changed, boost::shared_ptr<Region> } if (what_changed & Change (ARDOUR::PositionChanged|ARDOUR::LengthChanged)) { - + nframes64_t delta = 0; - + if (what_changed & ARDOUR::PositionChanged) { delta = (nframes64_t) region->position() - (nframes64_t) region->last_position(); - } - + } + if (what_changed & ARDOUR::LengthChanged) { delta += (nframes64_t) region->length() - (nframes64_t) region->last_length(); - } + } if (delta) { possibly_splice (region->last_position() + region->last_length(), delta, region); @@ -1298,7 +1298,7 @@ Playlist::region_bounds_changed (Change what_changed, boost::shared_ptr<Region> /* it moved or changed length, so change the timestamp */ timestamp_layer_op (region); } - + notify_length_changed (); relayer (); check_dependents (region, false); @@ -1335,8 +1335,8 @@ Playlist::region_changed (Change what_changed, boost::shared_ptr<Region> region) region_bounds_changed (what_changed, region); save = !(_splicing || _nudging); } - - if ((what_changed & our_interests) && + + if ((what_changed & our_interests) && !(what_changed & Change (ARDOUR::PositionChanged|ARDOUR::LengthChanged))) { check_dependents (region, false); } @@ -1344,7 +1344,7 @@ Playlist::region_changed (Change what_changed, boost::shared_ptr<Region> region) if (what_changed & Change (ARDOUR::PositionChanged)) { notify_region_moved (region); } - + if (what_changed & our_interests) { save = true; } @@ -1371,9 +1371,9 @@ Playlist::clear (bool with_signals) i != region_state_changed_connections.end (); ++i ) { - i->disconnect (); + i->disconnect (); } - + for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { pending_removes.insert (*i); } @@ -1400,7 +1400,7 @@ Playlist::regions_at (nframes_t frame) { RegionLock rlock (this); return find_regions_at (frame); -} +} boost::shared_ptr<Region> Playlist::top_region_at (nframes_t frame) @@ -1409,12 +1409,12 @@ Playlist::top_region_at (nframes_t frame) RegionLock rlock (this); RegionList *rlist = find_regions_at (frame); boost::shared_ptr<Region> region; - + if (rlist->size()) { RegionSortByLayer cmp; rlist->sort (cmp); region = rlist->back(); - } + } delete rlist; return region; @@ -1438,14 +1438,14 @@ Playlist::top_unmuted_region_at (nframes_t frame) i = tmp; } - + boost::shared_ptr<Region> region; - + if (rlist->size()) { RegionSortByLayer cmp; rlist->sort (cmp); region = rlist->back(); - } + } delete rlist; return region; @@ -1507,45 +1507,45 @@ Playlist::regions_to_read (nframes_t start, nframes_t end) if (covering.size() == 1) { rlist->push_back (covering.front()); - + } else { - + for (set<nframes_t>::iterator t = to_check.begin(); t != to_check.end(); ++t) { - + here.clear (); - + for (RegionList::iterator x = covering.begin(); x != covering.end(); ++x) { - + if ((*x)->covers (*t)) { here.push_back (*x); } } - + RegionSortByLayer cmp; here.sort (cmp); - + /* ... and get the top/transparent regions at "here" */ - + for (RegionList::reverse_iterator c = here.rbegin(); c != here.rend(); ++c) { - + unique.insert (*c); - + if ((*c)->opaque()) { - + /* the other regions at this position are hidden by this one */ - + break; } } } - + for (set<boost::shared_ptr<Region> >::iterator s = unique.begin(); s != unique.end(); ++s) { rlist->push_back (*s); } if (rlist->size() > 1) { /* now sort by time order */ - + RegionSortByPosition cmp; rlist->sort (cmp); } @@ -1606,26 +1606,26 @@ Playlist::find_next_transient (nframes64_t from, int dir) (*i)->get_transients (these_points); /* add first frame, just, err, because */ - + these_points.push_back ((*i)->first_frame()); - + points.insert (points.end(), these_points.begin(), these_points.end()); these_points.clear (); } - + if (points.empty()) { return -1; } TransientDetector::cleanup_transients (points, _session.frame_rate(), 3.0); bool reached = false; - + if (dir > 0) { for (AnalysisFeatureList::iterator x = points.begin(); x != points.end(); ++x) { if ((*x) >= from) { reached = true; } - + if (reached && (*x) > from) { return *x; } @@ -1635,7 +1635,7 @@ Playlist::find_next_transient (nframes64_t from, int dir) if ((*x) <= from) { reached = true; } - + if (reached && (*x) < from) { return *x; } @@ -1689,7 +1689,7 @@ Playlist::find_next_region (nframes_t frame, RegionPoint point, int dir) break; default: /* backwards */ - + if (pos < frame) { if ((distance = frame - pos) < closest) { closest = distance; @@ -1721,11 +1721,11 @@ Playlist::find_next_region_boundary (nframes64_t frame, int dir) boost::shared_ptr<Region> r = (*i); nframes64_t distance; - + if (r->first_frame() > frame) { distance = r->first_frame() - frame; - + if (distance < closest) { ret = r->first_frame(); closest = distance; @@ -1733,9 +1733,9 @@ Playlist::find_next_region_boundary (nframes64_t frame, int dir) } if (r->last_frame () > frame) { - + distance = r->last_frame () - frame; - + if (distance < closest) { ret = r->last_frame (); closest = distance; @@ -1746,14 +1746,14 @@ Playlist::find_next_region_boundary (nframes64_t frame, int dir) } else { for (RegionList::reverse_iterator i = regions.rbegin(); i != regions.rend(); ++i) { - + boost::shared_ptr<Region> r = (*i); nframes64_t distance; if (r->last_frame() < frame) { distance = frame - r->last_frame(); - + if (distance < closest) { ret = r->last_frame(); closest = distance; @@ -1761,7 +1761,7 @@ Playlist::find_next_region_boundary (nframes64_t frame, int dir) } if (r->first_frame() < frame) { - + distance = frame - r->first_frame(); if (distance < closest) { @@ -1814,7 +1814,7 @@ Playlist::set_state (const XMLNode& node) for (piter = plist.begin(); piter != plist.end(); ++piter) { prop = *piter; - + if (prop->name() == X_("name")) { _name = prop->value(); } else if (prop->name() == X_("orig_diskstream_id")) { @@ -1825,22 +1825,22 @@ Playlist::set_state (const XMLNode& node) } clear (false); - + nlist = node.children(); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { child = *niter; - + if (child->name() == "Region") { if ((prop = child->property ("id")) == 0) { error << _("region state node has no ID, ignored") << endmsg; continue; } - + ID id = prop->value (); - + if ((region = region_by_id (id))) { Change what_changed = Change (0); @@ -1860,15 +1860,15 @@ Playlist::set_state (const XMLNode& node) // So that layer_op ordering doesn't get screwed up region->set_last_layer_op( region->layer()); - } + } } - + notify_modified (); thaw (); - /* update dependents, which was not done during add_region_internal - due to in_set_state being true + /* update dependents, which was not done during add_region_internal + due to in_set_state being true */ for (RegionList::iterator r = regions.begin(); r != regions.end(); ++r) { @@ -1899,7 +1899,7 @@ Playlist::state (bool full_state) { XMLNode *node = new XMLNode (X_("Playlist")); char buf[64]; - + node->add_property (X_("name"), _name); node->add_property (X_("type"), _type.to_string()); @@ -1958,7 +1958,7 @@ Playlist::_get_maximum_extent () const return max_extent; } -string +string Playlist::bump_name (string name, Session &session) { string newname = name; @@ -1974,7 +1974,7 @@ Playlist::bump_name (string name, Session &session) layer_t Playlist::top_layer() const { - RegionLock rlock (const_cast<Playlist *> (this)); + RegionLock rlock (const_cast<Playlist *> (this)); layer_t top = 0; for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) { @@ -2039,7 +2039,7 @@ Playlist::relayer () } else if (_session.config.get_layer_model() == MoveAddHigher || _session.config.get_layer_model() == AddHigher) { copy.sort (RegionSortByLastLayerOp ()); - + } for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) { @@ -2083,7 +2083,7 @@ Playlist::relayer () /* overlap, so we must use layer j */ break; } - + --j; } @@ -2174,9 +2174,9 @@ Playlist::move_region_to_layer (layer_t target_layer, boost::shared_ptr<Region> { RegionLock rlock (const_cast<Playlist *> (this)); - + for (i = regions.begin(); i != regions.end(); ++i) { - + if (region == *i) { continue; } @@ -2186,7 +2186,7 @@ Playlist::move_region_to_layer (layer_t target_layer, boost::shared_ptr<Region> /* region is moving up, move all regions on intermediate layers down 1 */ - + if ((*i)->layer() > region->layer() && (*i)->layer() <= target_layer) { dest = (*i)->layer() - 1; } else { @@ -2208,12 +2208,12 @@ Playlist::move_region_to_layer (layer_t target_layer, boost::shared_ptr<Region> } LayerInfo newpair; - + newpair.first = *i; newpair.second = dest; - + layerinfo.push_back (newpair); - } + } } /* now reset the layers without holding the region lock */ @@ -2230,10 +2230,10 @@ Playlist::move_region_to_layer (layer_t target_layer, boost::shared_ptr<Region> for (list<LayerInfo>::iterator x = layerinfo.begin(); x != layerinfo.end(); ++x) { check_dependents (x->first, false); } - + check_dependents (region, false); #endif - + return 0; } @@ -2248,7 +2248,7 @@ Playlist::nudge_after (nframes_t start, nframes_t distance, bool forwards) { RegionLock rlock (const_cast<Playlist *> (this)); - + for (i = regions.begin(); i != regions.end(); ++i) { if ((*i)->position() >= start) { @@ -2260,9 +2260,9 @@ Playlist::nudge_after (nframes_t start, nframes_t distance, bool forwards) } else { new_pos = (*i)->position() + distance; } - + } else { - + if ((*i)->position() > distance) { new_pos = (*i)->position() - distance; } else { @@ -2311,7 +2311,7 @@ Playlist::region_by_id (ID id) } return boost::shared_ptr<Region> (); } - + void Playlist::dump () const { @@ -2323,9 +2323,9 @@ Playlist::dump () const for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) { r = *i; - cerr << " " << r->name() << " [" - << r->start() << "+" << r->length() - << "] at " + cerr << " " << r->name() << " [" + << r->start() << "+" << r->length() + << "] at " << r->position() << " on layer " << r->layer () @@ -2362,13 +2362,13 @@ Playlist::shuffle (boost::shared_ptr<Region> region, int dir) { RegionLock rlock (const_cast<Playlist*> (this)); - - + + if (dir > 0) { - + RegionList::iterator next; - for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { + for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { if ((*i) == region) { next = i; ++next; @@ -2408,10 +2408,10 @@ Playlist::shuffle (boost::shared_ptr<Region> region, int dir) } } } else { - + RegionList::iterator prev = regions.end(); - - for (RegionList::iterator i = regions.begin(); i != regions.end(); prev = i, ++i) { + + for (RegionList::iterator i = regions.begin(); i != regions.end(); prev = i, ++i) { if ((*i) == region) { if (prev != regions.end()) { @@ -2435,7 +2435,7 @@ Playlist::shuffle (boost::shared_ptr<Region> region, int dir) region->set_position ((*prev)->position(), this); (*prev)->set_position (new_pos, this); - + /* avoid a full sort */ regions.erase (i); // remove region @@ -2456,17 +2456,17 @@ Playlist::shuffle (boost::shared_ptr<Region> region, int dir) relayer (); check_dependents (region, false); - + notify_modified(); } } bool -Playlist::region_is_shuffle_constrained (boost::shared_ptr<Region>) +Playlist::region_is_shuffle_constrained (boost::shared_ptr<Region>) { RegionLock rlock (const_cast<Playlist*> (this)); - + if (regions.size() > 1) { return true; } @@ -2481,8 +2481,8 @@ Playlist::update_after_tempo_map_change () RegionList copy (regions); freeze (); - - for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) { + + for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) { (*i)->update_position_after_tempo_map_change (); } diff --git a/libs/ardour/playlist_factory.cc b/libs/ardour/playlist_factory.cc index 7088fa67a3..554c36df17 100644 --- a/libs/ardour/playlist_factory.cc +++ b/libs/ardour/playlist_factory.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,7 +33,7 @@ using namespace PBD; sigc::signal<void,boost::shared_ptr<Playlist>, bool> PlaylistFactory::PlaylistCreated; -boost::shared_ptr<Playlist> +boost::shared_ptr<Playlist> PlaylistFactory::create (Session& s, const XMLNode& node, bool hidden, bool unused) { const XMLProperty* type = node.property("type"); @@ -53,8 +53,8 @@ PlaylistFactory::create (Session& s, const XMLNode& node, bool hidden, bool unus return pl; } -boost::shared_ptr<Playlist> -PlaylistFactory::create (DataType type, Session& s, string name, bool hidden) +boost::shared_ptr<Playlist> +PlaylistFactory::create (DataType type, Session& s, string name, bool hidden) { boost::shared_ptr<Playlist> pl; @@ -70,8 +70,8 @@ PlaylistFactory::create (DataType type, Session& s, string name, bool hidden) return pl; } -boost::shared_ptr<Playlist> -PlaylistFactory::create (boost::shared_ptr<const Playlist> old, string name, bool hidden) +boost::shared_ptr<Playlist> +PlaylistFactory::create (boost::shared_ptr<const Playlist> old, string name, bool hidden) { boost::shared_ptr<Playlist> pl; boost::shared_ptr<const AudioPlaylist> apl; @@ -92,13 +92,13 @@ PlaylistFactory::create (boost::shared_ptr<const Playlist> old, string name, boo return pl; } -boost::shared_ptr<Playlist> -PlaylistFactory::create (boost::shared_ptr<const Playlist> old, nframes_t start, nframes_t cnt, string name, bool hidden) +boost::shared_ptr<Playlist> +PlaylistFactory::create (boost::shared_ptr<const Playlist> old, nframes_t start, nframes_t cnt, string name, bool hidden) { boost::shared_ptr<Playlist> pl; boost::shared_ptr<const AudioPlaylist> apl; boost::shared_ptr<const MidiPlaylist> mpl; - + if ((apl = boost::dynamic_pointer_cast<const AudioPlaylist> (old)) != 0) { pl = boost::shared_ptr<Playlist> (new AudioPlaylist (apl, start, cnt, name, hidden)); pl->set_region_ownership (); diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index e94487845e..6778a3af19 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2002 Paul Davis + Copyright (C) 2000-2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -114,7 +114,7 @@ Plugin::get_presets() uint32_t id; std::string unique (unique_id()); - /* XXX problem: AU plugins don't have numeric ID's. + /* XXX problem: AU plugins don't have numeric ID's. Solution: they have a different method of providing presets. XXX sub-problem: implement it. */ @@ -148,7 +148,7 @@ Plugin::load_preset(const string preset_uri) if (defs) { for (uint32_t i = 0; i < (uint32_t) defs->count; ++i) { - // The defs->items[i].pid < defs->count check is to work around + // The defs->items[i].pid < defs->count check is to work around // a bug in liblrdf that saves invalid values into the presets file. if (((uint32_t) defs->items[i].pid < (uint32_t) defs->count) && parameter_is_input (defs->items[i].pid)) { set_parameter(defs->items[i].pid, defs->items[i].value); @@ -168,7 +168,7 @@ Plugin::save_preset (string uri, string domain) uint32_t id; std::string unique (unique_id()); - /* XXX problem: AU plugins don't have numeric ID's. + /* XXX problem: AU plugins don't have numeric ID's. Solution: they have a different method of providing/saving presets. XXX sub-problem: implement it. */ @@ -194,7 +194,7 @@ Plugin::save_preset (string uri, string domain) warning << _("Could not locate HOME. Preset not saved.") << endmsg; return false; } - + string source(string_compose("file:%1/.%2/rdf/ardour-presets.n3", envvar, domain)); map<string,PresetRecord>::const_iterator pr = presets.find(uri); @@ -209,13 +209,13 @@ Plugin::save_preset (string uri, string domain) warning << string_compose(_("Could not create %1. Preset not saved. (%2)"), path, strerror(errno)) << endmsg; return false; } - + path += "/rdf"; if (g_mkdir_with_parents (path.c_str(), 0775)) { warning << string_compose(_("Could not create %1. Preset not saved. (%2)"), path, strerror(errno)) << endmsg; return false; } - + if (lrdf_export_by_source(source.c_str(), source.substr(5).c_str())) { warning << string_compose(_("Error saving presets file %1."), source) << endmsg; return false; @@ -234,7 +234,7 @@ ARDOUR::find_plugin(Session& session, string identifier, PluginType type) case ARDOUR::LADSPA: plugs = mgr->ladspa_plugin_info(); break; - + #ifdef HAVE_SLV2 case ARDOUR::LV2: plugs = mgr->lv2_plugin_info(); @@ -277,7 +277,7 @@ ARDOUR::find_plugin(Session& session, string identifier, PluginType type) } } #endif - + return PluginPtr ((Plugin*) 0); } diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index d00129e9c5..1fff176713 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -107,10 +107,10 @@ PluginInsert::set_count (uint32_t num) bool require_state = !_plugins.empty(); /* this is a bad idea.... we shouldn't do this while active. - only a route holding their redirect_lock should be calling this + only a route holding their redirect_lock should be calling this */ - if (num == 0) { + if (num == 0) { return false; } else if (num > _plugins.size()) { uint32_t diff = num - _plugins.size(); @@ -176,7 +176,7 @@ ChanCount PluginInsert::input_streams() const { ChanCount in = _plugins[0]->get_info()->n_inputs; - + if (in == ChanCount::INFINITE) { return _plugins[0]->input_streams (); } else { @@ -257,7 +257,7 @@ void PluginInsert::activate () { Processor::activate (); - + for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { (*i)->activate (); } @@ -267,7 +267,7 @@ void PluginInsert::deactivate () { Processor::deactivate (); - + for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { (*i)->deactivate (); } @@ -293,22 +293,22 @@ PluginInsert::connect_and_run (BufferSet& bufs, nframes_t nframes, nframes_t off if (with_auto) { uint32_t n = 0; - + for (Controls::iterator li = data().controls().begin(); li != data().controls().end(); ++li, ++n) { - + boost::shared_ptr<AutomationControl> c = boost::dynamic_pointer_cast<AutomationControl>(li->second); if (c->parameter().type() == PluginAutomation && c->automation_playback()) { bool valid; - const float val = c->list()->rt_safe_eval (now, valid); + const float val = c->list()->rt_safe_eval (now, valid); if (valid) { c->set_value(val); } - } + } } } @@ -326,7 +326,7 @@ PluginInsert::connect_and_run (BufferSet& bufs, nframes_t nframes, nframes_t off collect_signal_nframes, _signal_analysis_collected_nframes); // offset is for target buffer } - + } for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { @@ -346,8 +346,8 @@ PluginInsert::connect_and_run (BufferSet& bufs, nframes_t nframes, nframes_t off for (uint32_t i = 0; i < output_streams().n_audio(); ++i) { _signal_analysis_outputs.get_audio(i).read_from( - bufs.get_audio(i), - collect_signal_nframes, + bufs.get_audio(i), + collect_signal_nframes, _signal_analysis_collected_nframes); // offset is for target buffer } @@ -358,7 +358,7 @@ PluginInsert::connect_and_run (BufferSet& bufs, nframes_t nframes, nframes_t off _signal_analysis_collect_nframes_max = 0; _signal_analysis_collected_nframes = 0; - AnalysisDataGathered(&_signal_analysis_inputs, + AnalysisDataGathered(&_signal_analysis_inputs, &_signal_analysis_outputs); } } @@ -377,7 +377,7 @@ PluginInsert::silence (nframes_t nframes) } } } - + void PluginInsert::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t nframes) { @@ -399,7 +399,7 @@ PluginInsert::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_f if (out > in) { /* not active, but something has make up for any channel count increase */ - + for (uint32_t n = out - in; n < out; ++n) { memcpy (bufs.get_audio(n).data(), bufs.get_audio(in - 1).data(), sizeof (Sample) * nframes); } @@ -420,10 +420,10 @@ PluginInsert::set_parameter (Evoral::Parameter param, float val) /* the others will be set from the event triggered by this */ _plugins[0]->set_parameter (param.id(), val); - + boost::shared_ptr<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl>(data().control(param)); - + if (ac) { ac->set_value(val); } else { @@ -458,36 +458,36 @@ PluginInsert::automation_run (BufferSet& bufs, nframes_t nframes) connect_and_run (bufs, nframes, offset, false); return; } - + if (!data().find_next_event (now, end, next_event)) { - - /* no events have a time within the relevant range */ - - connect_and_run (bufs, nframes, offset, true, now); - return; - } - - while (nframes) { + + /* no events have a time within the relevant range */ + + connect_and_run (bufs, nframes, offset, true, now); + return; + } + + while (nframes) { nframes_t cnt = min (((nframes_t) ceil (next_event.when) - now), nframes); - - connect_and_run (bufs, cnt, offset, true, now); - - nframes -= cnt; - offset += cnt; + + connect_and_run (bufs, cnt, offset, true, now); + + nframes -= cnt; + offset += cnt; now += cnt; if (!data().find_next_event (now, end, next_event)) { break; } - } - - /* cleanup anything that is left to do */ - - if (nframes) { - connect_and_run (bufs, nframes, offset, true, now); - } -} + } + + /* cleanup anything that is left to do */ + + if (nframes) { + connect_and_run (bufs, nframes, offset, true, now); + } +} float PluginInsert::default_parameter_value (const Evoral::Parameter& param) @@ -561,11 +561,11 @@ PluginInsert::configure_io (ChanCount in, ChanCount out) // we don't know the analysis window size, so we must work with the // current buffer size here. each request for data fills in these - // buffers and the analyser makes sure it gets enough data for the + // buffers and the analyser makes sure it gets enough data for the // analysis window session().ensure_buffer_set (_signal_analysis_inputs, in); //_signal_analysis_inputs.set_count (in); - + session().ensure_buffer_set (_signal_analysis_outputs, out); //_signal_analysis_outputs.set_count (out); @@ -605,12 +605,12 @@ PluginInsert::can_support_io_configuration (const ChanCount& in, ChanCount& out) } else if (inputs.get(*t) >= in.get(*t)) { can_replicate = false; break; - + // Plugin inputs is not a factor of requested inputs, can not replicate } else if (inputs.get(*t) == 0 || in.get(*t) % inputs.get(*t) != 0) { can_replicate = false; break; - + // Potential factor not set yet } else if (f == 0) { f = in.get(*t) / inputs.get(*t);; @@ -646,7 +646,7 @@ PluginInsert::count_for_configuration (ChanCount in, ChanCount /*out*/) const } // FIXME: take 'out' into consideration - + ChanCount outputs = _plugins[0]->get_info()->n_outputs; ChanCount inputs = _plugins[0]->get_info()->n_inputs; @@ -697,13 +697,13 @@ PluginInsert::state (bool full) /* add port automation state */ //XMLNode *autonode = new XMLNode(port_automation_node_name); set<Evoral::Parameter> automatable = _plugins[0]->automatable(); - + for (set<Evoral::Parameter>::iterator x = automatable.begin(); x != automatable.end(); ++x) { - + /*XMLNode* child = new XMLNode("port"); snprintf(buf, sizeof(buf), "%" PRIu32, *x); child->add_property("number", string(buf)); - + child->add_child_nocopy (automation_list (*x).state (full)); autonode->add_child_nocopy (*child); */ @@ -711,7 +711,7 @@ PluginInsert::state (bool full) } //node.add_child_nocopy (*autonode); - + return node; } @@ -741,7 +741,7 @@ PluginInsert::set_state(const XMLNode& node) << endmsg; return -1; } - + prop = node.property ("unique-id"); if (prop == 0) { error << _("Plugin has no unique ID field") << endmsg; @@ -749,12 +749,12 @@ PluginInsert::set_state(const XMLNode& node) } boost::shared_ptr<Plugin> plugin; - - plugin = find_plugin (_session, prop->value(), type); + + plugin = find_plugin (_session, prop->value(), type); if (plugin == 0) { error << string_compose(_("Found a reference to a plugin (\"%1\") that is unknown.\n" - "Perhaps it was removed or moved since it was last used."), prop->value()) + "Perhaps it was removed or moved since it was last used."), prop->value()) << endmsg; return -1; } @@ -766,14 +766,14 @@ PluginInsert::set_state(const XMLNode& node) } if (_plugins.size() != count) { - + _plugins.push_back (plugin); - + for (uint32_t n=1; n < count; ++n) { _plugins.push_back (plugin_factory (plugin)); } } - + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { if ((*niter)->name() == plugin->state_node_name()) { for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { @@ -781,7 +781,7 @@ PluginInsert::set_state(const XMLNode& node) } break; } - } + } const XMLNode* insert_node = &node; @@ -792,11 +792,11 @@ PluginInsert::set_state(const XMLNode& node) break; } } - + Processor::set_state (*insert_node); /* look for port automation node */ - + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { if ((*niter)->name() != port_automation_node_name) { @@ -809,22 +809,22 @@ PluginInsert::set_state(const XMLNode& node) XMLNode *child; const char *port; uint32_t port_id; - + cnodes = (*niter)->children ("Port"); - + for (iter = cnodes.begin(); iter != cnodes.end(); ++iter) { - + child = *iter; - + if ((cprop = child->property("number")) != 0) { port = cprop->value().c_str(); } else { warning << _("PluginInsert: Auto: no plugin port number") << endmsg; continue; } - + sscanf (port, "%" PRIu32, &port_id); - + if (port_id >= _plugins[0]->parameter_count()) { warning << _("PluginInsert: Auto: port id out of range") << endmsg; continue; @@ -837,7 +837,7 @@ PluginInsert::set_state(const XMLNode& node) c->alist()->set_state (*child->children().front()); } else { if ((cprop = child->property("auto")) != 0) { - + /* old school */ int x; @@ -845,9 +845,9 @@ PluginInsert::set_state(const XMLNode& node) c->alist()->set_automation_state (AutoState (x)); } else { - + /* missing */ - + c->alist()->set_automation_state (Off); } } @@ -857,11 +857,11 @@ PluginInsert::set_state(const XMLNode& node) /* done */ break; - } + } // The name of the PluginInsert comes from the plugin, nothing else _name = plugin->get_info()->name; - + return 0; } @@ -874,7 +874,7 @@ PluginInsert::describe_parameter (Evoral::Parameter param) return _plugins[0]->describe_parameter (param); } -ARDOUR::nframes_t +ARDOUR::nframes_t PluginInsert::signal_latency() const { if (_user_latency) { @@ -894,7 +894,7 @@ PluginInsert::type () #ifdef HAVE_AUDIOUNITS boost::shared_ptr<AUPlugin> ap; #endif - + PluginPtr other = plugin (); if ((lp = boost::dynamic_pointer_cast<LadspaPlugin> (other)) != 0) { @@ -922,12 +922,12 @@ PluginInsert::PluginControl::PluginControl (PluginInsert* p, const Evoral::Param _logarithmic = desc.logarithmic; _toggled = desc.toggled; } - + void PluginInsert::PluginControl::set_value (float val) { /* FIXME: probably should be taking out some lock here.. */ - + if (_toggled) { if (val > 0.5) { val = 1.0; @@ -935,7 +935,7 @@ PluginInsert::PluginControl::set_value (float val) val = 0.0; } } else { - + /*const float range = _list->get_max_y() - _list->get_min_y(); const float lower = _list->get_min_y(); @@ -969,21 +969,21 @@ float PluginInsert::PluginControl::get_value (void) const { /* FIXME: probably should be taking out some lock here.. */ - + float val = _plugin->get_parameter (_list->parameter()); return val; /*if (_toggled) { - + return val; - + } else { - + if (_logarithmic) { val = log(val); } - + return ((val - lower) / range); }*/ } @@ -1007,10 +1007,10 @@ PluginInsert::collect_signal_for_analysis(nframes_t nframes) { // called from outside the audio thread, so this should be safe // only do audio as analysis is (currently) only for audio plugins - _signal_analysis_inputs.ensure_buffers( DataType::AUDIO, input_streams().n_audio(), nframes); - _signal_analysis_outputs.ensure_buffers( DataType::AUDIO, output_streams().n_audio(), nframes); + _signal_analysis_inputs.ensure_buffers( DataType::AUDIO, input_streams().n_audio(), nframes); + _signal_analysis_outputs.ensure_buffers( DataType::AUDIO, output_streams().n_audio(), nframes); _signal_analysis_collected_nframes = 0; - _signal_analysis_collect_nframes_max = nframes; + _signal_analysis_collect_nframes_max = nframes; } diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index bdc4d9e9b5..6ac57400c4 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -81,7 +81,7 @@ PluginManager::PluginManager () load_favorites (); #ifdef HAVE_AUDIOUNITS - ProcessSerialNumber psn = { 0, kCurrentProcess }; + ProcessSerialNumber psn = { 0, kCurrentProcess }; OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication); if( returnCode != 0) { error << _("Cannot become GUI app") << endmsg; @@ -128,7 +128,7 @@ PluginManager::PluginManager () ladspa_plugin_whitelist.push_back (1061); // feedback delay line (max 5s) ladspa_plugin_whitelist.push_back (1216); // gverb ladspa_plugin_whitelist.push_back (2150); // tap pitch shifter - } + } #ifdef HAVE_SLV2 _lv2_world = new LV2World(); @@ -159,45 +159,45 @@ PluginManager::refresh () void PluginManager::ladspa_refresh () { - _ladspa_plugin_info.clear (); - - static const char *standard_paths[] = { - "/usr/local/lib64/ladspa", - "/usr/local/lib/ladspa", - "/usr/lib64/ladspa", - "/usr/lib/ladspa", - "/Library/Audio/Plug-Ins/LADSPA", - "" - }; - - /* allow LADSPA_PATH to augment, not override standard locations */ - - /* Only add standard locations to ladspa_path if it doesn't - * already contain them. Check for trailing '/'s too. - */ - - int i; - for (i = 0; standard_paths[i][0]; i++) { - size_t found = ladspa_path.find(standard_paths[i]); - if (found != ladspa_path.npos) { - switch (ladspa_path[found + strlen(standard_paths[i])]) { - case ':' : - case '\0': - continue; - case '/' : - if (ladspa_path[found + strlen(standard_paths[i]) + 1] == ':' || - ladspa_path[found + strlen(standard_paths[i]) + 1] == '\0') { - continue; - } - } - } - if (!ladspa_path.empty()) - ladspa_path += ":"; - - ladspa_path += standard_paths[i]; - - } - + _ladspa_plugin_info.clear (); + + static const char *standard_paths[] = { + "/usr/local/lib64/ladspa", + "/usr/local/lib/ladspa", + "/usr/lib64/ladspa", + "/usr/lib/ladspa", + "/Library/Audio/Plug-Ins/LADSPA", + "" + }; + + /* allow LADSPA_PATH to augment, not override standard locations */ + + /* Only add standard locations to ladspa_path if it doesn't + * already contain them. Check for trailing '/'s too. + */ + + int i; + for (i = 0; standard_paths[i][0]; i++) { + size_t found = ladspa_path.find(standard_paths[i]); + if (found != ladspa_path.npos) { + switch (ladspa_path[found + strlen(standard_paths[i])]) { + case ':' : + case '\0': + continue; + case '/' : + if (ladspa_path[found + strlen(standard_paths[i]) + 1] == ':' || + ladspa_path[found + strlen(standard_paths[i]) + 1] == '\0') { + continue; + } + } + } + if (!ladspa_path.empty()) + ladspa_path += ":"; + + ladspa_path += standard_paths[i]; + + } + ladspa_discover_from_path (ladspa_path); } @@ -209,14 +209,14 @@ PluginManager::add_ladspa_directory (string path) ladspa_path += ':'; ladspa_path += path; return 0; - } + } return -1; } static bool ladspa_filter (const string& str, void */*arg*/) { /* Not a dotfile, has a prefix before a period, suffix is "so" */ - + return str[0] != '.' && (str.length() > 3 && str.find (".so") == (str.length() - 3)); } @@ -242,7 +242,7 @@ PluginManager::ladspa_discover_from_path (string /*path*/) static bool rdf_filter (const string &str, void */*arg*/) { - return str[0] != '.' && + return str[0] != '.' && ((str.find(".rdf") == (str.length() - 4)) || (str.find(".rdfs") == (str.length() - 5)) || (str.find(".n3") == (str.length() - 3))); @@ -310,7 +310,7 @@ PluginManager::add_lrdf_data (const string &path) vector_delete (rdf_files); } -int +int PluginManager::ladspa_discover (string path) { void *module; @@ -341,7 +341,7 @@ PluginManager::ladspa_discover (string path) if (find (ladspa_plugin_whitelist.begin(), ladspa_plugin_whitelist.end(), descriptor->UniqueID) == ladspa_plugin_whitelist.end()) { continue; } - } + } PluginInfoPtr info(new LadspaPluginInfo); info->name = descriptor->Name; @@ -352,11 +352,11 @@ PluginManager::ladspa_discover (string path) info->n_inputs = ChanCount(); info->n_outputs = ChanCount(); info->type = ARDOUR::LADSPA; - + char buf[32]; snprintf (buf, sizeof (buf), "%lu", descriptor->UniqueID); info->unique_id = buf; - + for (uint32_t n=0; n < descriptor->PortCount; ++n) { if ( LADSPA_IS_PORT_AUDIO (descriptor->PortDescriptors[n]) ) { if ( LADSPA_IS_PORT_INPUT (descriptor->PortDescriptors[n]) ) { @@ -481,7 +481,7 @@ PluginManager::add_vst_directory (string path) vst_path += ':'; vst_path += path; return 0; - } + } return -1; } @@ -530,7 +530,7 @@ PluginManager::vst_discover (string path) finfo->name) << endl; } - + PluginInfoPtr info(new VSTPluginInfo); /* what a joke freeware VST is */ @@ -541,7 +541,7 @@ PluginManager::vst_discover (string path) info->name = finfo->name; } - + snprintf (buf, sizeof (buf), "%d", finfo->UniqueID); info->unique_id = buf; info->category = "VST"; @@ -551,7 +551,7 @@ PluginManager::vst_discover (string path) info->n_inputs.set_audio (finfo->numInputs); info->n_outputs.set_audio (finfo->numOutputs); info->type = ARDOUR::VST; - + _vst_plugin_info.push_back (info); fst_free_info (finfo); @@ -595,7 +595,7 @@ PluginManager::save_favorites () ofs << "VST"; break; } - + ofs << ' ' << (*i).unique_id << endl; } @@ -612,7 +612,7 @@ PluginManager::load_favorites () if (!ifs) { return; } - + std::string stype; std::string id; PluginType type; @@ -642,10 +642,10 @@ PluginManager::load_favorites () << endmsg; continue; } - + add_favorite (type, id); } - + ifs.close (); } diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc index 4b4f0a939a..95073806d6 100644 --- a/libs/ardour/port.cc +++ b/libs/ardour/port.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,11 +46,11 @@ Port::Port (std::string const & n, DataType t, Flags f) /* Unfortunately we have to pass the DataType into this constructor so that we can create the right kind of JACK port; aside from this we'll use the virtual function type () - to establish type. + to establish type. */ assert (_name.find_first_of (':') == std::string::npos); - + if ((_jack_port = jack_port_register (_engine->jack (), _name.c_str (), t.to_jack_type (), _flags, 0)) == 0) { throw failed_constructor (); } @@ -100,7 +100,7 @@ Port::get_connections (std::vector<std::string> & c) const ++n; } } - + return n; } @@ -113,13 +113,13 @@ Port::connect (std::string const & other) std::string const this_shrt = _engine->make_port_name_non_relative (_name); int r = 0; - + if (sends_output ()) { r = jack_connect (_engine->jack (), this_shrt.c_str (), other_shrt.c_str ()); } else { r = jack_connect (_engine->jack (), other_shrt.c_str (), this_shrt.c_str()); } - + if (r == 0) { _connections.insert (other); } @@ -136,17 +136,17 @@ Port::disconnect (std::string const & other) std::string const this_shrt = _engine->make_port_name_non_relative (_name); int r = 0; - + if (sends_output ()) { r = jack_disconnect (_engine->jack (), this_shrt.c_str (), other_shrt.c_str ()); } else { r = jack_disconnect (_engine->jack (), other_shrt.c_str (), this_shrt.c_str ()); } - + if (r == 0) { _connections.erase (other); } - + return r; } @@ -200,9 +200,9 @@ Port::reset () void Port::recompute_total_latency () const { -#ifdef HAVE_JACK_RECOMPUTE_LATENCY +#ifdef HAVE_JACK_RECOMPUTE_LATENCY jack_recompute_total_latency (_engine->jack (), _jack_port); -#endif +#endif } nframes_t @@ -253,7 +253,7 @@ Port::set_name (std::string const & n) int const r = jack_port_set_name (_jack_port, n.c_str()); if (r == 0) { - _name = n; + _name = n; } return r; diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc index a46f7a7da3..61ae4d37e8 100644 --- a/libs/ardour/port_insert.cc +++ b/libs/ardour/port_insert.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000,2007 Paul Davis + Copyright (C) 2000,2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -115,7 +115,7 @@ PortInsert::set_state(const XMLNode& node) error << _("XML node describing port insert is missing the `type' field") << endmsg; return -1; } - + if (prop->value() != "port") { error << _("non-port insert XML used for port plugin insert") << endmsg; return -1; @@ -137,13 +137,13 @@ PortInsert::set_state(const XMLNode& node) break; } } - + Processor::set_state (*insert_node); return 0; } -ARDOUR::nframes_t +ARDOUR::nframes_t PortInsert::signal_latency() const { /* because we deliver and collect within the same cycle, diff --git a/libs/ardour/port_set.cc b/libs/ardour/port_set.cc index 6fdfa763cb..b96e45662b 100644 --- a/libs/ardour/port_set.cc +++ b/libs/ardour/port_set.cc @@ -1,16 +1,16 @@ /* - Copyright (C) 2006 Paul Davis - + Copyright (C) 2006 Paul Davis + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -37,7 +37,7 @@ void PortSet::add(Port* port) { PortVec& v = _ports[port->type()]; - + v.push_back(port); sort(v.begin(), v.end(), sort_ports_by_name); @@ -88,7 +88,7 @@ Port* PortSet::port(size_t n) const { // This is awesome. Awesomely slow. - + size_t size_so_far = 0; for (std::vector<PortVec>::const_iterator l = _ports.begin(); l != _ports.end(); ++l) { diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index 6f32afc925..c8f7a136bb 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -92,8 +92,8 @@ Processor::get_state (void) return state (true); } -/* NODE STRUCTURE - +/* NODE STRUCTURE + <Automation [optionally with visible="...." ]> <parameter-N> <AutomationList id=N> @@ -112,18 +112,18 @@ Processor::state (bool full_state) XMLNode* node = new XMLNode (state_node_name); stringstream sstr; char buf[64]; - + id().print (buf, sizeof (buf)); node->add_property("id", buf); node->add_property("name", _name); - node->add_property("active", active() ? "yes" : "no"); + node->add_property("active", active() ? "yes" : "no"); if (_extra_xml){ node->add_child_copy (*_extra_xml); } - + if (full_state) { - XMLNode& automation = Automatable::get_automation_state(); + XMLNode& automation = Automatable::get_automation_state(); if (!automation.children().empty() || !automation.properties().empty() || !_visible_controls.empty()) { @@ -158,7 +158,7 @@ Processor::set_state (const XMLNode& node) // may not exist for legacy 3.0 sessions if ((prop = node.property ("id")) != 0) { _id = prop->value(); - } + } XMLNodeList nlist = node.children(); XMLNodeIterator niter; @@ -168,7 +168,7 @@ Processor::set_state (const XMLNode& node) if ((*niter)->name() == X_("Automation")) { XMLProperty *prop; - + if ((prop = (*niter)->property ("path")) != 0) { old_set_automation_state (*(*niter)); } else { @@ -180,7 +180,7 @@ Processor::set_state (const XMLNode& node) stringstream sstr; _visible_controls.clear (); - + sstr << prop->value(); while (1) { sstr >> what; @@ -215,7 +215,7 @@ Processor::set_state (const XMLNode& node) if (_active != string_is_affirmative (prop->value())) { _active = !_active; ActiveChanged (); /* EMIT_SIGNAL */ - } + } return 0; } @@ -225,11 +225,11 @@ Processor::configure_io (ChanCount in, ChanCount out) { /* This class assumes 1:1 input:output.static output stream count. Derived classes must override and set _configured_output appropriately - if this is not the case + if this is not the case */ - _configured_input = in; - _configured_output = out; + _configured_input = in; + _configured_output = out; _configured = true; ConfigurationChanged.emit (in, out); diff --git a/libs/ardour/quantize.cc b/libs/ardour/quantize.cc index 7aedb98a4d..97be158bad 100644 --- a/libs/ardour/quantize.cc +++ b/libs/ardour/quantize.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,9 +40,9 @@ using namespace ARDOUR; * 0.25 = quantize to beats/4, etc. */ -Quantize::Quantize (Session& s, QuantizeType /* type */, +Quantize::Quantize (Session& s, QuantizeType /* type */, bool snap_start, bool snap_end, - double start_grid, double end_grid, + double start_grid, double end_grid, float strength, float swing, float threshold) : session (s) , _snap_start (snap_start) @@ -70,35 +70,35 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model, std::vector<Evoral::S even = false; for (Evoral::Sequence<MidiModel::TimeType>::Notes::iterator i = (*s).begin(); i != (*s).end(); ++i) { - - double new_start = round ((*i)->time() / _start_grid) * _start_grid; + + double new_start = round ((*i)->time() / _start_grid) * _start_grid; double new_end = round ((*i)->end_time() / _end_grid) * _end_grid; double delta; - + if (_swing > 0.0 && !even) { - + double next_grid = new_start + _start_grid; - + /* find a spot 2/3 (* swing factor) of the way between the grid point we would put this note at, and the nominal position of the next note. */ - + new_start = new_start + (2.0/3.0 * _swing * (next_grid - new_start)); - + } else if (_swing < 0.0 && !even) { - + double prev_grid = new_start - _start_grid; - + /* find a spot 2/3 (* swing factor) of the way between the grid point we would put this note at, and the nominal position of the previous note. */ - + new_start = new_start - (2.0/3.0 * _swing * (new_start - prev_grid)); - + } - + delta = new_start - (*i)->time(); - + if (fabs (delta) >= _threshold) { if (_snap_start) { delta *= _strength; @@ -106,21 +106,21 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model, std::vector<Evoral::S (*i)->time() + delta); } } - + if (_snap_end) { delta = new_end - (*i)->end_time(); - + if (fabs (delta) >= _threshold) { double new_dur = new_end - new_start; - + if (new_dur == 0.0) { new_dur = _end_grid; } - + cmd->change ((*i), MidiModel::DiffCommand::Length, new_dur); } } - + even = !even; } } diff --git a/libs/ardour/rb_effect.cc b/libs/ardour/rb_effect.cc index b61170da09..99c60d224e 100644 --- a/libs/ardour/rb_effect.cc +++ b/libs/ardour/rb_effect.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004-2007 Paul Davis + Copyright (C) 2004-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -83,7 +83,7 @@ RBEffect::run (boost::shared_ptr<Region> r) cerr << "RBEffect: source region: position = " << region->position() << ", start = " << region->start() - << ", length = " << region->length() + << ", length = " << region->length() << ", ancestral_start = " << region->ancestral_start() << ", ancestral_length = " << region->ancestral_length() << ", stretch " << region->stretch() @@ -91,33 +91,33 @@ RBEffect::run (boost::shared_ptr<Region> r) /* We have two cases to consider: - + 1. The region has not been stretched before. - + In this case, we just want to read region->length() frames from region->start(). - + We will create a new region of region->length() * tsr.time_fraction frames. The new region will have its start set to 0 (because it has a new audio file that begins at the start of the stretched area) and its ancestral_start set to region->start() (so that we know where to begin reading if we want to stretch it again). - + 2. The region has been stretched before. - + The region starts at region->start() frames into its (possibly previously stretched) source file. But we don't want to read from its source file; we want to read from the file it was originally stretched from. - + The region's source begins at region->ancestral_start() frames into its master source file. Thus, we need to start reading at region->ancestral_start() + (region->start() / region->stretch()) frames into the master source. This value will also become the ancestral_start for the new region. - + We cannot use region->ancestral_length() to establish how many frames to read, because it won't be up to date if the region has been trimmed since it was last stretched. We @@ -125,10 +125,10 @@ RBEffect::run (boost::shared_ptr<Region> r) stretch them by tsr.time_fraction * region->stretch(), for a new region of region->length() * tsr.time_fraction frames. - + Case 1 is of course a special case of 2, where region->ancestral_start() == 0 and region->stretch() == 1. - + When we ask to read from a region, we supply a position on the global timeline. The read function calculates the offset into the source as (position - region->position()) + @@ -138,9 +138,9 @@ RBEffect::run (boost::shared_ptr<Region> r) n frames into the master source, we need to provide n - region->start() + region->position() as our position argument to master_read_at(). - + Note that region->ancestral_length() is not used. - + I hope this is clear. */ @@ -158,7 +158,7 @@ RBEffect::run (boost::shared_ptr<Region> r) RubberBandStretcher stretcher (session.frame_rate(), channels, (RubberBandStretcher::Options) tsr.opts, stretch, shift); - + tsr.progress = 0.0f; tsr.done = false; @@ -174,7 +174,7 @@ RBEffect::run (boost::shared_ptr<Region> r) } else if (shift == 1.0) { snprintf (suffix, sizeof (suffix), "@%d", (int) floor (stretch * 100.0f)); } else { - snprintf (suffix, sizeof (suffix), "@%d-%d", + snprintf (suffix, sizeof (suffix), "@%d-%d", (int) floor (stretch * 100.0f), (int) floor (shift * 100.0f)); } @@ -202,18 +202,18 @@ RBEffect::run (boost::shared_ptr<Region> r) avail = 0; done = 0; - try { + try { while (pos < read_duration && !tsr.cancel) { - + nframes_t this_read = 0; for (uint32_t i = 0; i < channels; ++i) { - + this_read = 0; nframes_t this_time; this_time = min(bufsize, read_duration - pos); - + nframes_t this_position; this_position = read_start + pos - region->start() + region->position(); @@ -225,7 +225,7 @@ RBEffect::run (boost::shared_ptr<Region> r) this_position, this_time, i); - + if (this_read != this_time) { error << string_compose (_("tempoize: error reading data from %1 at %2 (wanted %3, got %4)"), @@ -233,7 +233,7 @@ RBEffect::run (boost::shared_ptr<Region> r) goto out; } } - + pos += this_read; done += this_read; @@ -241,16 +241,16 @@ RBEffect::run (boost::shared_ptr<Region> r) stretcher.study(buffers, this_read, pos == read_duration); } - + done = 0; pos = 0; while (pos < read_duration && !tsr.cancel) { - + nframes_t this_read = 0; - + for (uint32_t i = 0; i < channels; ++i) { - + this_read = 0; nframes_t this_time; this_time = min(bufsize, read_duration - pos); @@ -258,7 +258,7 @@ RBEffect::run (boost::shared_ptr<Region> r) nframes_t this_position; this_position = read_start + pos - region->start() + region->position(); - + this_read = region->master_read_at (buffers[i], buffers[i], @@ -266,7 +266,7 @@ RBEffect::run (boost::shared_ptr<Region> r) this_position, this_time, i); - + if (this_read != this_time) { error << string_compose (_("tempoize: error reading data from %1 at %2 (wanted %3, got %4)"), @@ -289,7 +289,7 @@ RBEffect::run (boost::shared_ptr<Region> r) this_read = min(bufsize, uint32_t(avail)); stretcher.retrieve(buffers, this_read); - + for (uint32_t i = 0; i < nsrcs.size(); ++i) { boost::shared_ptr<AudioSource> asrc = boost::dynamic_pointer_cast<AudioSource>(nsrcs[i]); @@ -317,7 +317,7 @@ RBEffect::run (boost::shared_ptr<Region> r) if (!asrc) { continue; } - + if (asrc->write(buffers[i], this_read) != this_read) { error << string_compose (_("error writing tempo-adjusted data to %1"), nsrcs[i]->name()) << endmsg; @@ -372,7 +372,7 @@ RBEffect::run (boost::shared_ptr<Region> r) (*si)->mark_for_remove (); } } - + tsr.done = true; return ret; @@ -381,4 +381,4 @@ RBEffect::run (boost::shared_ptr<Region> r) - + diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc index d39dcb602a..ba9389eec8 100644 --- a/libs/ardour/rc_configuration.cc +++ b/libs/ardour/rc_configuration.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 1999-2006 Paul Davis + Copyright (C) 1999-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ #include <unistd.h> #include <cstdio> /* for snprintf, grrr */ -#include <glib.h> +#include <glib.h> #include <glib/gstdio.h> /* for g_stat() */ #include <glibmm/miscutils.h> @@ -55,7 +55,7 @@ RCConfiguration::RCConfiguration () : /* construct variables */ #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL #define CONFIG_VARIABLE(Type,var,name,value) var (name,value), #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) var (name,value,mutator), #include "ardour/rc_configuration_vars.h" @@ -74,7 +74,7 @@ RCConfiguration::load_state () struct stat statbuf; /* load system configuration first */ - + if (find_file_in_search_path (ardour_search_path() + system_config_search_path(), "ardour_system.rc", system_rc_file) ) { @@ -84,19 +84,19 @@ RCConfiguration::load_state () string rcfile = system_rc_file.to_string(); /* stupid XML Parser hates empty files */ - + if (g_stat (rcfile.c_str(), &statbuf)) { return -1; } if (statbuf.st_size != 0) { cerr << string_compose (_("Loading system configuration file %1"), rcfile) << endl; - + if (!tree.read (rcfile.c_str())) { error << string_compose(_("Ardour: cannot read system configuration file \"%1\""), rcfile) << endmsg; return -1; } - + if (set_state (*tree.root())) { error << string_compose(_("Ardour: system configuration file \"%1\" not loaded successfully."), rcfile) << endmsg; return -1; @@ -126,19 +126,19 @@ RCConfiguration::load_state () if (statbuf.st_size != 0) { cerr << string_compose (_("Loading user configuration file %1"), rcfile) << endl; - + if (!tree.read (rcfile)) { error << string_compose(_("Ardour: cannot read configuration file \"%1\""), rcfile) << endmsg; return -1; } - + if (set_state (*tree.root())) { error << string_compose(_("Ardour: user configuration file \"%1\" not loaded successfully."), rcfile) << endmsg; return -1; } } else { warning << _("your Ardour configuration file is empty. This is not normal.") << endmsg; - } + } } if (!found) @@ -161,7 +161,7 @@ RCConfiguration::save_state() error << "Could not create user configuration directory" << endmsg; return -1; } - + sys::path rcfile_path(user_config_directory()); rcfile_path /= "ardour.rc"; @@ -202,19 +202,19 @@ RCConfiguration::get_state () MIDI::Manager::PortMap::const_iterator i; const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports(); - + for (i = ports.begin(); i != ports.end(); ++i) { root->add_child_nocopy(i->second->get_state()); } - + root->add_child_nocopy (get_variables ()); - + if (_extra_xml) { root->add_child_copy (*_extra_xml); } - + root->add_child_nocopy (ControlProtocolManager::instance().get_state()); - + return *root; } @@ -227,14 +227,14 @@ RCConfiguration::get_variables () node = new XMLNode ("Config"); #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL #define CONFIG_VARIABLE(type,var,Name,value) \ var.add_to_node (*node); #define CONFIG_VARIABLE_SPECIAL(type,var,Name,value,mutator) \ var.add_to_node (*node); #include "ardour/rc_configuration_vars.h" #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL return *node; } @@ -271,9 +271,9 @@ RCConfiguration::set_state (const XMLNode& root) } } else if (node->name() == "Config") { - + set_variables (*node); - + } else if (node->name() == "Extra") { _extra_xml = new XMLNode (*node); @@ -291,7 +291,7 @@ void RCConfiguration::set_variables (const XMLNode& node) { #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL #define CONFIG_VARIABLE(type,var,name,value) \ if (var.set_from_node (node)) { \ ParameterChanged (name); \ @@ -304,16 +304,16 @@ RCConfiguration::set_variables (const XMLNode& node) #include "ardour/rc_configuration_vars.h" #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL - + } void RCConfiguration::map_parameters (sigc::slot<void, std::string> theSlot) { #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL #define CONFIG_VARIABLE(type,var,name,value) theSlot (name); #define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) theSlot (name); #include "ardour/rc_configuration_vars.h" #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL } diff --git a/libs/ardour/recent_sessions.cc b/libs/ardour/recent_sessions.cc index 7d62300e3d..dfe85190b3 100644 --- a/libs/ardour/recent_sessions.cc +++ b/libs/ardour/recent_sessions.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,11 +50,11 @@ ARDOUR::read_recent_sessions (RecentSessions& rs) sys::path recent_file_path(user_config_directory()); recent_file_path /= recent_file_name; - + const string path = recent_file_path.to_string(); ifstream recent (path.c_str()); - + if (!recent) { if (errno != ENOENT) { error << string_compose (_("cannot open recent session file %1 (%2)"), path, strerror (errno)) << endmsg; @@ -73,7 +73,7 @@ ARDOUR::read_recent_sessions (RecentSessions& rs) if (!recent.good()) { break; } - + getline(recent, newpair.second); if (!recent.good()) { @@ -96,7 +96,7 @@ ARDOUR::write_recent_sessions (RecentSessions& rs) sys::path recent_file_path(user_config_directory()); recent_file_path /= recent_file_name; - + const string path = recent_file_path.to_string(); ofstream recent (path.c_str()); @@ -108,10 +108,10 @@ ARDOUR::write_recent_sessions (RecentSessions& rs) for (RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) { recent << (*i).first << '\n' << (*i).second << endl; } - + return 0; } - + int ARDOUR::store_recent_sessions (string name, string path) { @@ -127,7 +127,7 @@ ARDOUR::store_recent_sessions (string name, string path) newpair.second = path; rs.erase(remove(rs.begin(), rs.end(), newpair), rs.end()); - + rs.push_front (newpair); if (rs.size() > 10) { diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 0e0df08284..e1bc5c0883 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2003 Paul Davis + Copyright (C) 2000-2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -62,10 +62,10 @@ Region::Region (Session& s, nframes_t start, nframes_t length, const string& nam : SessionObject(s, name) , _type(type) , _flags(Flag (flags|DoNotSendPropertyChanges)) - , _start(start) - , _length(length) - , _position(0) - , _last_position(0) + , _start(start) + , _length(length) + , _position(0) + , _last_position(0) , _positional_lock_style(AudioTime) , _sync_position(_start) , _layer(layer) @@ -88,10 +88,10 @@ Region::Region (boost::shared_ptr<Source> src, nframes_t start, nframes_t length : SessionObject(src->session(), name) , _type(type) , _flags(Flag (flags|DoNotSendPropertyChanges)) - , _start(start) - , _length(length) - , _position(0) - , _last_position(0) + , _start(start) + , _length(length) + , _position(0) + , _last_position(0) , _positional_lock_style(AudioTime) , _sync_position(_start) , _layer(layer) @@ -121,10 +121,10 @@ Region::Region (const SourceList& srcs, nframes_t start, nframes_t length, const : SessionObject(srcs.front()->session(), name) , _type(type) , _flags(Flag (flags|DoNotSendPropertyChanges)) - , _start(start) - , _length(length) - , _position(0) - , _last_position(0) + , _start(start) + , _length(length) + , _position(0) + , _last_position(0) , _positional_lock_style(AudioTime) , _sync_position(_start) , _layer(layer) @@ -198,15 +198,15 @@ Region::Region (boost::shared_ptr<const Region> other, nframes_t length, const s /* sync pos is relative to start of file. our start-in-file is now zero, so set our sync position to whatever the the difference between - _start and _sync_pos was in the other region. + _start and _sync_pos was in the other region. - result is that our new sync pos points to the same point in our source(s) + result is that our new sync pos points to the same point in our source(s) as the sync in the other region did in its source(s). since we start at zero in our source(s), it is not possible to use a sync point that is before the start. reset it to _start if that was true in the other region. */ - + if (other->flags() & SyncMarked) { if (other->_start < other->_sync_position) { /* sync pos was after the start point of the other region */ @@ -220,7 +220,7 @@ Region::Region (boost::shared_ptr<const Region> other, nframes_t length, const s _flags = Flag (_flags & ~SyncMarked); _sync_position = _start; } - + if (Profile->get_sae()) { /* reset sync point to start if its ended up outside region bounds. @@ -243,10 +243,10 @@ Region::Region (boost::shared_ptr<const Region> other) : SessionObject(other->session(), other->name()) , _type(other->data_type()) , _flags(Flag(other->_flags & ~(Locked|PositionLocked))) - , _start(other->_start) - , _length(other->_length) - , _position(other->_position) - , _last_position(other->_last_position) + , _start(other->_start) + , _length(other->_length) + , _position(other->_position) + , _last_position(other->_last_position) , _positional_lock_style(other->_positional_lock_style) , _sync_position(other->_sync_position) , _layer(other->_layer) @@ -280,10 +280,10 @@ Region::Region (const SourceList& srcs, const XMLNode& node) : SessionObject(srcs.front()->session(), X_("error: XML did not reset this")) , _type(DataType::NIL) // to be loaded from XML , _flags(DoNotSendPropertyChanges) - , _start(0) - , _length(0) - , _position(0) - , _last_position(0) + , _start(0) + , _length(0) + , _position(0) + , _last_position(0) , _positional_lock_style(AudioTime) , _sync_position(_start) , _layer(0) @@ -310,10 +310,10 @@ Region::Region (boost::shared_ptr<Source> src, const XMLNode& node) : SessionObject(src->session(), X_("error: XML did not reset this")) , _type(DataType::NIL) , _flags(DoNotSendPropertyChanges) - , _start(0) - , _length(0) - , _position(0) - , _last_position(0) + , _start(0) + , _length(0) + , _position(0) + , _last_position(0) , _positional_lock_style(AudioTime) , _sync_position(_start) , _layer(0) @@ -331,7 +331,7 @@ Region::Region (boost::shared_ptr<Source> src, const XMLNode& node) if (set_state (node)) { throw failed_constructor(); } - + assert(_type != DataType::NIL); assert(_sources.size() > 0); } @@ -348,7 +348,7 @@ Region::~Region () (*i)->remove_playlist (pl); } } - + notify_callbacks (); GoingAway (); /* EMIT SIGNAL */ } @@ -361,17 +361,17 @@ Region::copy_stuff (boost::shared_ptr<const Region> other, nframes_t /*offset*/, _read_data_count = 0; _valid_transients = false; - _length = length; - _last_length = length; + _length = length; + _last_length = length; _sync_position = other->_sync_position; _ancestral_start = other->_ancestral_start; - _ancestral_length = other->_ancestral_length; + _ancestral_length = other->_ancestral_length; _stretch = other->_stretch; _shift = other->_shift; _name = name; - _last_position = 0; - _position = 0; - _layer = layer; + _last_position = 0; + _position = 0; + _layer = layer; _flags = Flag (flags & ~(Locked|WholeFile|Hidden)); _first_edit = EditChangesNothing; _last_layer_op = 0; @@ -396,11 +396,11 @@ Region::set_playlist (boost::weak_ptr<Playlist> wpl) if (pl) { if (old_playlist) { for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) { - (*i)->remove_playlist (_playlist); + (*i)->remove_playlist (_playlist); (*i)->add_playlist (pl); } for (SourceList::const_iterator i = _master_sources.begin(); i != _master_sources.end(); ++i) { - (*i)->remove_playlist (_playlist); + (*i)->remove_playlist (_playlist); (*i)->add_playlist (pl); } } else { @@ -428,7 +428,7 @@ Region::set_name (const std::string& str) { if (_name != str) { SessionObject::set_name(str); // EMIT SIGNAL NameChanged() - assert(_name == str); + assert(_name == str); send_change (ARDOUR::NameChanged); } @@ -445,7 +445,7 @@ Region::set_length (nframes_t len, void */*src*/) if (_length != len && len != 0) { - /* check that the current _position wouldn't make the new + /* check that the current _position wouldn't make the new length impossible. */ @@ -456,7 +456,7 @@ Region::set_length (nframes_t len, void */*src*/) if (!verify_length (len)) { return; } - + _last_length = _length; _length = len; @@ -503,7 +503,7 @@ Region::at_natural_position () const if (!pl) { return false; } - + boost::shared_ptr<Region> whole_file_region = get_parent(); if (whole_file_region) { @@ -523,18 +523,18 @@ Region::move_to_natural_position (void *src) if (!pl) { return; } - + boost::shared_ptr<Region> whole_file_region = get_parent(); if (whole_file_region) { set_position (whole_file_region->position() + _start, src); } } - + void Region::special_set_position (nframes_t pos) { - /* this is used when creating a whole file region as + /* this is used when creating a whole file region as a way to store its "natural" or "captured" position. */ @@ -556,14 +556,14 @@ Region::set_position_lock_style (PositionLockStyle ps) if (_positional_lock_style == MusicTime) { pl->session().tempo_map().bbt_time (_position, _bbt_time); } - + } void Region::update_position_after_tempo_map_change () { boost::shared_ptr<Playlist> pl (playlist()); - + if (!pl || _positional_lock_style != MusicTime) { return; } @@ -591,7 +591,7 @@ Region::set_position_internal (nframes_t pos, bool allow_bbt_recompute) _position = pos; /* check that the new _position wouldn't make the current - length impossible - if so, change the length. + length impossible - if so, change the length. XXX is this the right thing to do? */ @@ -636,7 +636,7 @@ Region::set_position_on_top (nframes_t pos, void */*src*/) /* do this even if the position is the same. this helps out a GUI that has moved its representation already. */ - + send_change (PositionChanged); } @@ -650,7 +650,7 @@ Region::recompute_position_from_lock_style () } } } - + void Region::nudge_position (nframes64_t n, void */*src*/) { @@ -661,7 +661,7 @@ Region::nudge_position (nframes64_t n, void */*src*/) if (n == 0) { return; } - + _last_position = _position; if (n > 0) { @@ -724,7 +724,7 @@ Region::trim_start (nframes_t new_position, void */*src*/) } nframes_t new_start; int32_t start_shift; - + if (new_position > _position) { start_shift = new_position - _position; } else { @@ -757,7 +757,7 @@ Region::trim_start (nframes_t new_position, void */*src*/) if (new_start == _start) { return; } - + _start = new_start; _flags = Region::Flag (_flags & ~WholeFile); first_edit (); @@ -782,20 +782,20 @@ Region::trim_front (nframes_t new_position, void *src) } if (new_position < end) { /* can't trim it zero or negative length */ - + nframes_t newlen; /* can't trim it back passed where source position zero is located */ - + new_position = max (new_position, source_zero); - - + + if (new_position > _position) { newlen = _length - (new_position - _position); } else { newlen = _length + (_position - new_position); } - + trim_to_internal (new_position, newlen, src); if (!_frozen) { recompute_at_start (); @@ -893,17 +893,17 @@ Region::trim_to_internal (nframes_t position, nframes_t length, void */*src*/) _position = position; what_changed = Change (what_changed|PositionChanged); } - + _flags = Region::Flag (_flags & ~WholeFile); if (what_changed & (StartChanged|LengthChanged)) { first_edit (); - } + } if (what_changed) { send_change (what_changed); } -} +} void Region::set_hidden (bool yn) @@ -982,7 +982,7 @@ Region::set_sync_position (nframes_t absolute_pos) file_pos = _start + (absolute_pos - _position); if (file_pos != _sync_position) { - + _sync_position = file_pos; _flags = Flag (_flags|SyncMarked); @@ -1014,7 +1014,7 @@ Region::sync_offset (int& dir) const if (_flags & SyncMarked) { if (_sync_position > _start) { dir = 1; - return _sync_position - _start; + return _sync_position - _start; } else { dir = -1; return _start - _sync_position; @@ -1025,14 +1025,14 @@ Region::sync_offset (int& dir) const } } -nframes_t +nframes_t Region::adjust_to_sync (nframes_t pos) const { int sync_dir; nframes_t offset = sync_offset (sync_dir); // cerr << "adjusting pos = " << pos << " to sync at " << _sync_position << " offset = " << offset << " with dir = " << sync_dir << endl; - + if (sync_dir > 0) { if (pos > offset) { pos -= offset; @@ -1052,7 +1052,7 @@ nframes_t Region::sync_position() const { if (_flags & SyncMarked) { - return _sync_position; + return _sync_position; } else { return _start; } @@ -1100,7 +1100,7 @@ Region::set_layer (layer_t l) { if (_layer != l) { _layer = l; - + send_change (LayerChanged); } } @@ -1130,7 +1130,7 @@ Region::state (bool /*full_state*/) node->add_property ("stretch", buf); snprintf (buf, sizeof (buf), "%.12g", _shift); node->add_property ("shift", buf); - + switch (_first_edit) { case EditChangesNothing: fe = X_("nothing"); @@ -1178,7 +1178,7 @@ Region::set_live_state (const XMLNode& node, Change& what_changed, bool send) const XMLProperty *prop; nframes_t val; - /* this is responsible for setting those aspects of Region state + /* this is responsible for setting those aspects of Region state that are mutable after construction. */ @@ -1188,7 +1188,7 @@ Region::set_live_state (const XMLNode& node, Change& what_changed, bool send) } _name = prop->value(); - + if ((prop = node.property ("type")) == 0) { _type = DataType::AUDIO; } else { @@ -1198,7 +1198,7 @@ Region::set_live_state (const XMLNode& node, Change& what_changed, bool send) if ((prop = node.property ("start")) != 0) { sscanf (prop->value().c_str(), "%" PRIu32, &val); if (val != _start) { - what_changed = Change (what_changed|StartChanged); + what_changed = Change (what_changed|StartChanged); _start = val; } } else { @@ -1258,7 +1258,7 @@ Region::set_live_state (const XMLNode& node, Change& what_changed, bool send) /* missing BBT info, revert to audio time locking */ _positional_lock_style = AudioTime; } else { - if (sscanf (prop->value().c_str(), "%d|%d|%d", + if (sscanf (prop->value().c_str(), "%d|%d|%d", &_bbt_time.bars, &_bbt_time.beats, &_bbt_time.ticks) != 3) { @@ -1266,13 +1266,13 @@ Region::set_live_state (const XMLNode& node, Change& what_changed, bool send) } } } - + } else { _positional_lock_style = AudioTime; } /* XXX FIRST EDIT !!! */ - + /* these 3 properties never change as a result of any editing */ if ((prop = node.property ("ancestral-start")) != 0) { @@ -1320,11 +1320,11 @@ Region::set_live_state (const XMLNode& node, Change& what_changed, bool send) _extra_xml = 0; for (XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); ++niter) { - + XMLNode *child; - + child = (*niter); - + if (child->name () == "Extra") { _extra_xml = new XMLNode (*child); break; @@ -1352,9 +1352,9 @@ Region::set_state (const XMLNode& node) } _id = prop->value(); - + _first_edit = EditChangesNothing; - + set_live_state (node, what_changed, true); return 0; @@ -1393,10 +1393,10 @@ Region::thaw (const string& /*why*/) if (what_changed & LengthChanged) { if (what_changed & PositionChanged) { recompute_at_start (); - } + } recompute_at_end (); } - + StateChanged (what_changed); } @@ -1408,17 +1408,17 @@ Region::send_change (Change what_changed) if (_frozen) { _pending_changed = Change (_pending_changed|what_changed); return; - } + } } StateChanged (what_changed); - + if (!(_flags & DoNotSendPropertyChanges)) { - + /* Try and send a shared_pointer unless this is part of the constructor. If so, do nothing. */ - + try { boost::shared_ptr<Region> rptr = shared_from_this(); RegionPropertyChanged (rptr); @@ -1426,7 +1426,7 @@ Region::send_change (Change what_changed) /* no shared_ptr available, relax; */ } } - + } void @@ -1531,9 +1531,9 @@ Region::verify_length (nframes_t len) for (uint32_t n=0; n < _sources.size(); ++n) { maxlen = max (maxlen, (nframes_t)source_length(n) - _start); } - + len = min (len, maxlen); - + return true; } @@ -1593,12 +1593,12 @@ Region::get_parent() const if (pl) { boost::shared_ptr<Region> r; boost::shared_ptr<Region const> grrr2 = boost::dynamic_pointer_cast<Region const> (shared_from_this()); - + if (grrr2 && (r = pl->session().find_whole_file_parent (grrr2))) { return boost::static_pointer_cast<Region> (r); } } - + return boost::shared_ptr<Region>(); } @@ -1621,7 +1621,7 @@ void Region::use_sources (SourceList const & s) { set<boost::shared_ptr<Source> > unique_srcs; - + for (SourceList::const_iterator i = s.begin (); i != s.end(); ++i) { _sources.push_back (*i); (*i)->GoingAway.connect (bind (mem_fun (*this, &Region::source_deleted), *i)); @@ -1635,4 +1635,4 @@ Region::use_sources (SourceList const & s) } } } - + diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc index 004321fa9e..6ff4ae2dc1 100644 --- a/libs/ardour/region_factory.cc +++ b/libs/ardour/region_factory.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,8 +36,8 @@ using namespace PBD; sigc::signal<void,boost::shared_ptr<Region> > RegionFactory::CheckNewRegion; boost::shared_ptr<Region> -RegionFactory::create (boost::shared_ptr<Region> region, nframes_t start, - nframes_t length, const std::string& name, +RegionFactory::create (boost::shared_ptr<Region> region, nframes_t start, + nframes_t length, const std::string& name, layer_t layer, Region::Flag flags, bool announce) { boost::shared_ptr<const AudioRegion> other_a; @@ -94,8 +94,8 @@ RegionFactory::create (boost::shared_ptr<const Region> region) } boost::shared_ptr<Region> -RegionFactory::create (boost::shared_ptr<AudioRegion> region, nframes_t start, - nframes_t length, const std::string& name, +RegionFactory::create (boost::shared_ptr<AudioRegion> region, nframes_t start, + nframes_t length, const std::string& name, layer_t layer, Region::Flag flags, bool announce) { return create (boost::static_pointer_cast<Region> (region), start, length, name, layer, flags, announce); @@ -141,8 +141,8 @@ RegionFactory::create (Session& session, XMLNode& node, bool yn) return r; } - -boost::shared_ptr<Region> + +boost::shared_ptr<Region> RegionFactory::create (const SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Region::Flag flags, bool announce) { if (srcs.empty()) { @@ -150,7 +150,7 @@ RegionFactory::create (const SourceList& srcs, nframes_t start, nframes_t length } if (srcs[0]->type() == DataType::AUDIO) { - + AudioRegion* ar = new AudioRegion (srcs, start, length, name, layer, flags); boost::shared_ptr<AudioRegion> arp (ar); boost::shared_ptr<Region> ret (boost::static_pointer_cast<Region> (arp)); @@ -161,7 +161,7 @@ RegionFactory::create (const SourceList& srcs, nframes_t start, nframes_t length return ret; } else if (srcs[0]->type() == DataType::MIDI) { - + MidiRegion* ar = new MidiRegion (srcs, start, length, name, layer, flags); boost::shared_ptr<MidiRegion> mrp (ar); boost::shared_ptr<Region> ret (boost::static_pointer_cast<Region> (mrp)); @@ -174,9 +174,9 @@ RegionFactory::create (const SourceList& srcs, nframes_t start, nframes_t length } return boost::shared_ptr<Region> (); -} +} -boost::shared_ptr<Region> +boost::shared_ptr<Region> RegionFactory::create (SourceList& srcs, const XMLNode& node) { if (srcs.empty()) { @@ -198,7 +198,7 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node) return boost::shared_ptr<Region> (); } -boost::shared_ptr<Region> +boost::shared_ptr<Region> RegionFactory::create (boost::shared_ptr<Source> src, nframes_t start, nframes_t length, const string& name, layer_t layer, Region::Flag flags, bool announce) { boost::shared_ptr<AudioSource> as; diff --git a/libs/ardour/resampled_source.cc b/libs/ardour/resampled_source.cc index cfc5c9f4f1..57811312f1 100644 --- a/libs/ardour/resampled_source.cc +++ b/libs/ardour/resampled_source.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Paul Davis + Copyright (C) 2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,12 +32,12 @@ ResampledImportableSource::ResampledImportableSource (boost::shared_ptr<Importab : source (src) { int err; - + source->seek (0); - + /* Initialize the sample rate converter. */ - - int src_type = SRC_SINC_BEST_QUALITY; + + int src_type = SRC_SINC_BEST_QUALITY; switch (srcq) { case SrcBest: @@ -56,21 +56,21 @@ ResampledImportableSource::ResampledImportableSource (boost::shared_ptr<Importab src_type = SRC_LINEAR; break; } - - if ((src_state = src_new (src_type, source->channels(), &err)) == 0) { + + if ((src_state = src_new (src_type, source->channels(), &err)) == 0) { error << string_compose(_("Import: src_new() failed : %1"), src_strerror (err)) << endmsg ; throw failed_constructor (); } - + src_data.end_of_input = 0 ; /* Set this later. */ - + /* Start with zero to force load in while loop. */ - + src_data.input_frames = 0 ; src_data.data_in = input ; - + src_data.src_ratio = ((float) rate) / source->samplerate(); - + input = new float[blocksize]; } @@ -80,14 +80,14 @@ ResampledImportableSource::~ResampledImportableSource () delete [] input; } -nframes_t +nframes_t ResampledImportableSource::read (Sample* output, nframes_t nframes) { int err; /* If the input buffer is empty, refill it. */ - - if (src_data.input_frames == 0) { + + if (src_data.input_frames == 0) { src_data.input_frames = source->read (input, blocksize); @@ -95,12 +95,12 @@ ResampledImportableSource::read (Sample* output, nframes_t nframes) if ((nframes_t) src_data.input_frames < blocksize) { src_data.end_of_input = true; - } + } src_data.input_frames /= source->channels(); src_data.data_in = input; - } - + } + src_data.data_out = output; if (!src_data.end_of_input) { @@ -112,14 +112,14 @@ ResampledImportableSource::read (Sample* output, nframes_t nframes) if ((err = src_process (src_state, &src_data))) { error << string_compose(_("Import: %1"), src_strerror (err)) << endmsg ; return 0 ; - } - + } + /* Terminate if at end */ - + if (src_data.end_of_input && src_data.output_frames_gen == 0) { return 0; } - + src_data.data_in += src_data.input_frames_used * source->channels(); src_data.input_frames -= src_data.input_frames_used ; diff --git a/libs/ardour/return.cc b/libs/ardour/return.cc index e5af719afd..858d658c9c 100644 --- a/libs/ardour/return.cc +++ b/libs/ardour/return.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ using namespace ARDOUR; using namespace PBD; Return::Return (Session& s, bool internal) - : IOProcessor (s, (internal ? false : true), false, + : IOProcessor (s, (internal ? false : true), false, string_compose (_("return %1"), (_bitslot = s.next_return_id()) + 1)) , _metering (false) { @@ -113,7 +113,7 @@ Return::set_state(const XMLNode& node) // _io->set_automation_state (*(*niter), Evoral::Parameter(GainAutomation)); } } - + IOProcessor::set_state (*insert_node); return 0; @@ -125,7 +125,7 @@ Return::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframe if ((!_active && !_pending_active) || _input->n_ports() == ChanCount::ZERO) { return; } - + _input->collect_input (bufs, nframes, _configured_input); bufs.set_count(_configured_output); @@ -133,7 +133,7 @@ Return::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframe // so that we don't overwrite the main automation data for the route amp // _amp->setup_gain_automation (start_frame, end_frame, nframes); _amp->run (bufs, start_frame, end_frame, nframes); - + if (_metering) { if (_amp->gain_control()->get_value() == 0) { _meter->reset(); @@ -184,7 +184,7 @@ Return::make_unique (XMLNode &state, Session &session) state.property("bitslot")->set_value (buf); std::string const name = string_compose (_("return %1"), bitslot); - + state.property("name")->set_value (name); XMLNode* io = state.child ("IO"); diff --git a/libs/ardour/reverse.cc b/libs/ardour/reverse.cc index ed3970bdfc..a35858ce97 100644 --- a/libs/ardour/reverse.cc +++ b/libs/ardour/reverse.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -83,13 +83,13 @@ Reverse::run (boost::shared_ptr<Region> r) for (n = 0, si = nsrcs.begin(); n < region->n_channels(); ++n, ++si) { /* read it in directly from the source */ - + if (region->audio_source (n)->read (buf, fpos, to_read) != to_read) { goto out; } /* swap memory order */ - + for (nframes_t i = 0; i < to_read/2; ++i) { swap (buf[i],buf[to_read-1-i]); } @@ -124,6 +124,6 @@ Reverse::run (boost::shared_ptr<Region> r) asrc->mark_for_remove (); } } - + return ret; } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 5595ac3972..862dbdece7 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -73,12 +73,12 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type) , _solo_control (new SoloControllable (X_("solo"), *this)) , _mute_master (new MuteMaster (sess, name)) , _default_type (default_type) - + { init (); - + /* add standard processors other than amp (added by ::init()) */ - + _meter.reset (new PeakMeter (_session)); add_processor (_meter, PreFader); @@ -87,7 +87,7 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type) _intreturn.reset (new InternalReturn (_session)); add_processor (_intreturn, PreFader); } - + _main_outs.reset (new Delivery (_session, _output, _mute_master, _name, Delivery::Main)); add_processor (_main_outs, PostFader); @@ -108,7 +108,7 @@ Route::Route (Session& sess, const XMLNode& node, DataType default_type) _set_state (node, false); /* now that we have _meter, its safe to connect to this */ - + _meter_connection = Metering::connect (mem_fun (*this, &Route::meter)); } @@ -131,7 +131,7 @@ Route::init () _pending_declick = true; _remote_control_id = 0; _in_configure_processors = false; - + _route_group = 0; _phase_invert = 0; @@ -141,7 +141,7 @@ Route::init () add_control (_solo_control); add_control (_mute_master); - + /* input and output objects */ _input.reset (new IO (_session, _name, IO::Input, _default_type)); @@ -199,7 +199,7 @@ Route::set_order_key (std::string const & name, long n) for (OrderKeys::iterator x = order_keys.begin(); x != order_keys.end(); ++x) { x->second = n; } - } + } _session.set_dirty (); } @@ -257,14 +257,14 @@ void Route::set_gain (gain_t val, void *src) { if (src != 0 && _route_group && src != _route_group && _route_group->active_property (RouteGroup::Gain)) { - + if (_route_group->is_relative()) { gain_t usable_gain = _amp->gain(); if (usable_gain < 0.000001f) { usable_gain = 0.000001f; } - + gain_t delta = val; if (delta < 0.000001f) { delta = 0.000001f; @@ -290,16 +290,16 @@ Route::set_gain (gain_t val, void *src) return; } } - + _route_group->apply (&Route::inc_gain, factor, _route_group); } else { - + _route_group->apply (&Route::set_gain, val, _route_group); } return; - } + } if (val == _amp->gain()) { return; @@ -311,7 +311,7 @@ Route::set_gain (gain_t val, void *src) /** Process this route for one (sub) cycle (process thread) * * @param bufs Scratch buffers to use for the signal path - * @param start_frame Initial transport frame + * @param start_frame Initial transport frame * @param end_frame Final transport frame * @param nframes Number of frames to output (to ports) * @@ -342,7 +342,7 @@ Route::process_output_buffers (BufferSet& bufs, /* figure out if we're going to use gain automation */ _amp->setup_gain_automation (start_frame, end_frame, nframes); - + /* tell main outs what to do about monitoring */ _main_outs->no_outs_cuz_we_no_monitor (!monitor); @@ -356,20 +356,20 @@ Route::process_output_buffers (BufferSet& bufs, Amp::apply_gain (bufs, nframes, 0.0, 1.0); } else if (declick < 0) { Amp::apply_gain (bufs, nframes, 1.0, 0.0); - } + } _pending_declick = 0; - + /* ------------------------------------------------------------------------------------------- DENORMAL CONTROL/PHASE INVERT ----------------------------------------------------------------------------------------- */ if (_phase_invert) { - + int chn = 0; if (_denormal_protection || Config->get_denormal_protection()) { - + for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i, ++chn) { Sample* const sp = i->data(); @@ -389,19 +389,19 @@ Route::process_output_buffers (BufferSet& bufs, for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i, ++chn) { Sample* const sp = i->data(); - + if (_phase_invert & chn) { for (nframes_t nx = 0; nx < nframes; ++nx) { sp[nx] = -sp[nx]; } - } + } } } } else { if (_denormal_protection || Config->get_denormal_protection()) { - + for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) { Sample* const sp = i->data(); for (nframes_t nx = 0; nx < nframes; ++nx) { @@ -409,7 +409,7 @@ Route::process_output_buffers (BufferSet& bufs, } } - } + } } /* ------------------------------------------------------------------------------------------- @@ -450,29 +450,29 @@ Route::passthru (sframes_t start_frame, sframes_t end_frame, nframes_t nframes, _silent = false; assert (bufs.available() >= _input->n_ports()); - + if (_input->n_ports() == ChanCount::ZERO) { silence (nframes); } - + bufs.set_count (_input->n_ports()); if (is_control() && _session.listening()) { - + /* control/monitor bus ignores input ports when something is feeding the listen "stream". data will "arrive" into the route from the intreturn processor element. */ - + bufs.silence (nframes, 0); } else { - + for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { - + BufferSet::iterator o = bufs.begin(*t); PortSet& ports (_input->ports()); - + for (PortSet::iterator i = ports.begin(*t); i != ports.end(*t); ++i, ++o) { o->read_from (i->get_buffer(nframes), nframes); } @@ -494,7 +494,7 @@ Route::passthru_silence (sframes_t start_frame, sframes_t end_frame, nframes_t n void Route::set_listen (bool yn, void* src) { - if (_control_outs) { + if (_control_outs) { if (yn != _control_outs->active()) { if (yn) { _control_outs->activate (); @@ -533,7 +533,7 @@ Route::set_solo (bool yn, void *src) mod_solo_level (yn ? 1 : -1); solo_changed (src); /* EMIT SIGNAL */ _solo_control->Changed (); /* EMIT SIGNAL */ - } + } } void @@ -569,7 +569,7 @@ Route::set_solo_isolated (bool yn, void *src) /* tell main outs what the solo situation is */ - + _main_outs->set_solo_level (_solo_level); _main_outs->set_solo_isolated (_solo_isolated); @@ -578,7 +578,7 @@ Route::set_solo_isolated (bool yn, void *src) } bool -Route::solo_isolated () const +Route::solo_isolated () const { return _solo_isolated; } @@ -595,10 +595,10 @@ Route::set_mute (bool yn, void *src) _mute_master->mute (yn); mute_changed (src); } -} +} bool -Route::muted() const +Route::muted() const { return _mute_master->muted (); } @@ -682,7 +682,7 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite // Set up processor list channels. This will set processor->[input|output]_streams(), // configure redirect ports properly, etc. - + if (configure_processors_unlocked (err)) { ProcessorList::iterator ploc = loc; @@ -692,16 +692,16 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite cerr << "configure failed\n"; return -1; } - + if ((pi = boost::dynamic_pointer_cast<PluginInsert>(processor)) != 0) { - + if (pi->natural_input_streams() == ChanCount::ZERO) { /* generator plugin */ _have_internal_generator = true; } - + } - + if (_control_outs != processor) { // XXX: do we want to emit the signal here ? change call order. processor->activate (); @@ -710,9 +710,9 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite _output->set_user_latency (0); } - + processors_changed (); /* EMIT SIGNAL */ - + return 0; } @@ -724,23 +724,23 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter if (node.name() != "Processor") { return false; } - + try { if ((prop = node.property ("type")) != 0) { - + boost::shared_ptr<Processor> processor; - if (prop->value() == "ladspa" || prop->value() == "Ladspa" || + if (prop->value() == "ladspa" || prop->value() == "Ladspa" || prop->value() == "lv2" || prop->value() == "vst" || prop->value() == "audiounit") { - + processor.reset (new PluginInsert(_session, node)); - + } else if (prop->value() == "port") { processor.reset (new PortInsert (_session, _mute_master, node)); - + } else if (prop->value() == "send") { processor.reset (new Send (_session, _mute_master, node)); @@ -755,13 +755,13 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter } } - _meter.reset (new PeakMeter (_session, node)); + _meter.reset (new PeakMeter (_session, node)); processor = _meter; - + } else if (prop->value() == "amp") { /* amp always exists */ - + processor = _amp; if (processor->set_state (node)) { return false; @@ -769,13 +769,13 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter /* never any reason to add it */ return true; } - + } else if (prop->value() == "intsend") { processor.reset (new InternalSend (_session, _mute_master, node)); } else if (prop->value() == "intreturn") { - + if (_intreturn) { if (_intreturn->set_state (node)) { return false; @@ -787,7 +787,7 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter processor = _intreturn; } else if (prop->value() == "main-outs") { - + if (_main_outs) { if (_main_outs->set_state (node)) { return false; @@ -803,7 +803,7 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter error << string_compose(_("unknown Processor type \"%1\"; ignored"), prop->value()) << endmsg; return false; } - + if (iter == _processors.end() && processor->visible() && !_processors.empty()) { /* check for invisible processors stacked at the end and leave them there */ ProcessorList::iterator p; @@ -817,7 +817,7 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter } return (add_processor (processor, iter) == 0); - + } else { error << _("Processor XML node has no type property") << endmsg; return false; @@ -871,7 +871,7 @@ Route::add_processors (const ProcessorList& others, ProcessorList::iterator iter ChanCount potential_max_streams = ChanCount::max (_input->n_ports(), _output->n_ports()); for (ProcessorList::const_iterator i = others.begin(); i != others.end(); ++i) { - + // Ensure meter only appears in the list once if (*i == _meter) { ProcessorList::iterator m = find(_processors.begin(), _processors.end(), *i); @@ -879,12 +879,12 @@ Route::add_processors (const ProcessorList& others, ProcessorList::iterator iter _processors.erase(m); } } - + boost::shared_ptr<PluginInsert> pi; - + if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) { pi->set_count (1); - + ChanCount m = max (pi->input_streams(), pi->output_streams()); if (m > potential_max_streams) { @@ -893,20 +893,20 @@ Route::add_processors (const ProcessorList& others, ProcessorList::iterator iter } _processors.insert (iter, *i); - + if (configure_processors_unlocked (err)) { ++existing_end; _processors.erase (existing_end, _processors.end()); configure_processors_unlocked (0); // it worked before we tried to add it ... return -1; } - + (*i)->ActiveChanged.connect (bind (mem_fun (_session, &Session::update_latency_compensation), false, false)); } _output->set_user_latency (0); } - + processors_changed (); /* EMIT SIGNAL */ return 0; @@ -932,10 +932,10 @@ void Route::disable_processors (Placement p) { Glib::RWLock::ReaderLock lm (_processor_lock); - + ProcessorList::iterator start, end; placement_range(p, start, end); - + for (ProcessorList::iterator i = start; i != end; ++i) { (*i)->deactivate (); } @@ -943,17 +943,17 @@ Route::disable_processors (Placement p) _session.set_dirty (); } -/** Turn off all redirects +/** Turn off all redirects */ void Route::disable_processors () { Glib::RWLock::ReaderLock lm (_processor_lock); - + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { (*i)->deactivate (); } - + _session.set_dirty (); } @@ -964,16 +964,16 @@ void Route::disable_plugins (Placement p) { Glib::RWLock::ReaderLock lm (_processor_lock); - + ProcessorList::iterator start, end; placement_range(p, start, end); - + for (ProcessorList::iterator i = start; i != end; ++i) { if (boost::dynamic_pointer_cast<PluginInsert> (*i)) { (*i)->deactivate (); } } - + _session.set_dirty (); } @@ -983,13 +983,13 @@ void Route::disable_plugins () { Glib::RWLock::ReaderLock lm (_processor_lock); - + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if (boost::dynamic_pointer_cast<PluginInsert> (*i)) { (*i)->deactivate (); } } - + _session.set_dirty (); } @@ -998,7 +998,7 @@ void Route::ab_plugins (bool forward) { Glib::RWLock::ReaderLock lm (_processor_lock); - + if (forward) { /* forward = turn off all active redirects, and mark them so that the next time @@ -1035,11 +1035,11 @@ Route::ab_plugins (bool forward) } } } - + _session.set_dirty (); } - - + + /** Remove processors with a given placement. * @param p Placement of processors to remove. */ @@ -1051,7 +1051,7 @@ Route::clear_processors (Placement p) if (!_session.engine().connected()) { return; } - + bool already_deleting = _session.deletion_in_progress(); if (!already_deleting) { _session.set_deletion_in_progress(); @@ -1070,7 +1070,7 @@ Route::clear_processors (Placement p) } if ((*i) == _amp || (*i) == _meter || (*i) == _main_outs) { - + /* you can't remove these */ new_list.push_back (*i); @@ -1187,7 +1187,7 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream for (i = _processors.begin(); i != _processors.end(); ++i) { boost::shared_ptr<PluginInsert> pi; - + if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) { if (pi->is_generator()) { _have_internal_generator = true; @@ -1223,7 +1223,7 @@ Route::remove_processors (const ProcessorList& to_be_deleted, ProcessorStreams* as_we_were = _processors; for (i = _processors.begin(); i != _processors.end(); ) { - + processor = *i; /* these can never be removed */ @@ -1232,9 +1232,9 @@ Route::remove_processors (const ProcessorList& to_be_deleted, ProcessorStreams* ++i; continue; } - + /* see if its in the list of processors to delete */ - + if (find (to_be_deleted.begin(), to_be_deleted.end(), processor) == to_be_deleted.end()) { ++i; continue; @@ -1244,9 +1244,9 @@ Route::remove_processors (const ProcessorList& to_be_deleted, ProcessorStreams* from causing noise as a result of no longer being run. */ - + boost::shared_ptr<IOProcessor> iop; - + if ((iop = boost::dynamic_pointer_cast<IOProcessor> (processor)) != 0) { iop->disconnect (); } @@ -1274,7 +1274,7 @@ Route::remove_processors (const ProcessorList& to_be_deleted, ProcessorStreams* for (i = _processors.begin(); i != _processors.end(); ++i) { boost::shared_ptr<PluginInsert> pi; - + if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) { if (pi->is_generator()) { _have_internal_generator = true; @@ -1323,7 +1323,7 @@ Route::configure_processors_unlocked (ProcessorStreams* err) ChanCount out; list< pair<ChanCount,ChanCount> > configuration; uint32_t index = 0; - + for (ProcessorList::iterator p = _processors.begin(); p != _processors.end(); ++p, ++index) { if ((*p)->can_support_io_configuration(in, out)) { configuration.push_back(make_pair(in, out)); @@ -1337,7 +1337,7 @@ Route::configure_processors_unlocked (ProcessorStreams* err) return -1; } } - + // We can, so configure everything list< pair<ChanCount,ChanCount> >::iterator c = configuration.begin(); for (ProcessorList::iterator p = _processors.begin(); p != _processors.end(); ++p, ++c) { @@ -1366,7 +1366,7 @@ Route::all_processors_flip () } bool first_is_on = _processors.front()->active(); - + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if (first_is_on) { (*i)->deactivate (); @@ -1374,7 +1374,7 @@ Route::all_processors_flip () (*i)->activate (); } } - + _session.set_dirty (); } @@ -1407,7 +1407,7 @@ Route::all_processors_active (Placement p, bool state) } } } - + _session.set_dirty (); } @@ -1454,12 +1454,12 @@ Route::reorder_processors (const ProcessorList& new_order, ProcessorStreams* err ProcessorList as_it_will_be; oiter = _processors.begin(); - niter = new_order.begin(); + niter = new_order.begin(); while (niter != new_order.end()) { - + /* if the next processor in the old list is invisible (i.e. should not be in the new order) - then append it to the temp list. + then append it to the temp list. Otherwise, see if the next processor in the old list is in the new list. if not, its been deleted. If its there, append it to the temp list. @@ -1467,7 +1467,7 @@ Route::reorder_processors (const ProcessorList& new_order, ProcessorStreams* err if (oiter == _processors.end()) { - /* no more elements in the old list, so just stick the rest of + /* no more elements in the old list, so just stick the rest of the new order onto the temp list. */ @@ -1478,7 +1478,7 @@ Route::reorder_processors (const ProcessorList& new_order, ProcessorStreams* err break; } else { - + if (!(*oiter)->visible()) { as_it_will_be.push_back (*oiter); @@ -1495,11 +1495,11 @@ Route::reorder_processors (const ProcessorList& new_order, ProcessorStreams* err ++niter; } } - + /* now remove from old order - its taken care of no matter what */ oiter = _processors.erase (oiter); } - + } _processors.insert (oiter, as_it_will_be.begin(), as_it_will_be.end()); @@ -1508,8 +1508,8 @@ Route::reorder_processors (const ProcessorList& new_order, ProcessorStreams* err _processors = as_it_was_before; processor_max_streams = old_pms; return -1; - } - } + } + } processors_changed (); /* EMIT SIGNAL */ @@ -1554,14 +1554,14 @@ Route::state(bool full_state) } string order_string; - OrderKeys::iterator x = order_keys.begin(); + OrderKeys::iterator x = order_keys.begin(); while (x != order_keys.end()) { order_string += string ((*x).first); order_string += '='; snprintf (buf, sizeof(buf), "%ld", (*x).second); order_string += buf; - + ++x; if (x == order_keys.end()) { @@ -1594,7 +1594,7 @@ Route::state(bool full_state) if (_extra_xml){ node->add_child_copy (*_extra_xml); } - + return *node; } @@ -1621,7 +1621,7 @@ Route::_set_state (const XMLNode& node, bool /*call_base*/) if ((prop = node.property (X_("name"))) != 0) { Route::set_name (prop->value()); - } + } if ((prop = node.property ("id")) != 0) { _id = prop->value (); @@ -1639,28 +1639,28 @@ Route::_set_state (const XMLNode& node, bool /*call_base*/) XMLNode processor_state (X_("processor_state")); for (niter = nlist.begin(); niter != nlist.end(); ++niter){ - + child = *niter; if (child->name() == IO::state_node_name) { if ((prop = child->property (X_("direction"))) == 0) { continue; } - + if (prop->value() == "Input") { _input->set_state (*child); } else if (prop->value() == "Output") { _output->set_state (*child); } } - + if (child->name() == X_("Processor")) { processor_state.add_child_copy (*child); } } set_processor_state (processor_state); - + if ((prop = node.property ("solo_level")) != 0) { _solo_level = 0; // needed for mod_solo_level() to work mod_solo_level (atoi (prop->value())); @@ -1677,7 +1677,7 @@ Route::_set_state (const XMLNode& node, bool /*call_base*/) if ((prop = node.property (X_("denormal-protection"))) != 0) { set_denormal_protection (string_is_affirmative (prop->value())); } - + if ((prop = node.property (X_("active"))) != 0) { bool yn = string_is_affirmative (prop->value()); _active = !yn; // force switch @@ -1695,7 +1695,7 @@ Route::_set_state (const XMLNode& node, bool /*call_base*/) if ((prop = node.property (X_("meter-point"))) != 0) { _meter_point = MeterPoint (string_2_enum (prop->value (), _meter_point)); } - + if ((prop = node.property (X_("route-group"))) != 0) { RouteGroup* route_group = _session.route_group_by_name(prop->value()); if (route_group == 0) { @@ -1751,11 +1751,11 @@ Route::_set_state (const XMLNode& node, bool /*call_base*/) _extra_xml = new XMLNode (*child); } else if (child->name() == X_("Controllable") && (prop = child->property("name")) != 0) { - + if (prop->value() == "solo") { _solo_control->set_state (*child); _session.add_controllable (_solo_control); - } + } } else if (child->name() == X_("RemoteControl")) { if ((prop = child->property (X_("id"))) != 0) { @@ -1815,7 +1815,7 @@ Route::set_processor_state (const XMLNode& node) break; } } - + if (!processorInStateList) { remove_processor (*i); } @@ -1829,7 +1829,7 @@ Route::set_processor_state (const XMLNode& node) i = _processors.begin(); for (niter = nlist.begin(); niter != nlist.end(); ++niter, ++i) { - + XMLProperty* prop = (*niter)->property ("type"); o = i; @@ -1837,14 +1837,14 @@ Route::set_processor_state (const XMLNode& node) // Check whether the next processor in the list is the right one, // except for "amp" which is always there and may not have the // old ID since it is always created anew in every Route - + if (prop->value() != "amp") { while (o != _processors.end()) { XMLProperty* id_prop = (*niter)->property(X_("id")); if (id_prop && (*o)->id() == id_prop->value()) { break; } - + ++o; } } @@ -1898,10 +1898,10 @@ Route::silence (nframes_t nframes) if (!_silent) { _output->silence (nframes); - - { + + { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); - + if (lm.locked()) { for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { boost::shared_ptr<PluginInsert> pi; @@ -1910,7 +1910,7 @@ Route::silence (nframes_t nframes) // skip plugins, they don't need anything when we're not active continue; } - + (*i)->silence (nframes); } @@ -1919,9 +1919,9 @@ Route::silence (nframes_t nframes) } } } - + } -} +} void Route::add_internal_return () @@ -1936,16 +1936,16 @@ BufferSet* Route::get_return_buffer () const { Glib::RWLock::ReaderLock rm (_processor_lock); - + for (ProcessorList::const_iterator x = _processors.begin(); x != _processors.end(); ++x) { boost::shared_ptr<InternalReturn> d = boost::dynamic_pointer_cast<InternalReturn>(*x); - + if (d) { BufferSet* bs = d->get_buffers (); return bs; } } - + return 0; } @@ -1953,10 +1953,10 @@ void Route::release_return_buffer () const { Glib::RWLock::ReaderLock rm (_processor_lock); - + for (ProcessorList::const_iterator x = _processors.begin(); x != _processors.end(); ++x) { boost::shared_ptr<InternalReturn> d = boost::dynamic_pointer_cast<InternalReturn>(*x); - + if (d) { return d->release_buffers (); } @@ -1971,13 +1971,13 @@ Route::listen_via (boost::shared_ptr<Route> route, Placement placement, bool /*a { Glib::RWLock::ReaderLock rm (_processor_lock); - + for (ProcessorList::iterator x = _processors.begin(); x != _processors.end(); ++x) { boost::shared_ptr<InternalSend> d = boost::dynamic_pointer_cast<InternalSend>(*x); if (d && d->target_route() == route) { - + /* if the target is the control outs, then make sure we take note of which i-send is doing that. */ @@ -1987,12 +1987,12 @@ Route::listen_via (boost::shared_ptr<Route> route, Placement placement, bool /*a } /* already listening via the specified IO: do nothing */ - + return 0; } } } - + boost::shared_ptr<InternalSend> listener; try { @@ -2007,9 +2007,9 @@ Route::listen_via (boost::shared_ptr<Route> route, Placement placement, bool /*a } add_processor (listener, placement); - - return 0; -} + + return 0; +} void Route::drop_listen (boost::shared_ptr<Route> route) @@ -2019,12 +2019,12 @@ Route::drop_listen (boost::shared_ptr<Route> route) Glib::RWLock::ReaderLock rl(_processor_lock); rl.acquire (); - + again: for (ProcessorList::iterator x = _processors.begin(); x != _processors.end(); ) { - + boost::shared_ptr<InternalSend> d = boost::dynamic_pointer_cast<InternalSend>(*x); - + if (d && d->target_route() == route) { rl.release (); remove_processor (*x, &err); @@ -2034,8 +2034,8 @@ Route::drop_listen (boost::shared_ptr<Route> route) so start over. */ - goto again; - } + goto again; + } } rl.release (); @@ -2091,9 +2091,9 @@ Route::feeds (boost::shared_ptr<Route> other) } for (ProcessorList::iterator r = _processors.begin(); r != _processors.end(); r++) { - + boost::shared_ptr<IOProcessor> iop; - + if ((iop = boost::dynamic_pointer_cast<IOProcessor>(*r)) != 0) { if (iop->feeds (other)) { // cerr << "\tIOP " << iop->name() << " feeds " << other->name() << endl; @@ -2121,12 +2121,12 @@ Route::handle_transport_stopped (bool /*abort_ignored*/, bool did_locate, bool c } for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - + if (Config->get_plugins_stop_with_transport() && can_flush_processors) { (*i)->deactivate (); (*i)->activate (); } - + (*i)->transport_stopped (now); } } @@ -2146,9 +2146,9 @@ void Route::output_change_handler (IOChange change, void * /*src*/) { if ((change & ConfigurationChanged)) { - + /* XXX resize all listeners to match _main_outs? */ - + // configure_processors (0); } } @@ -2159,12 +2159,12 @@ Route::pans_required () const if (n_outputs().n_audio() < 2) { return 0; } - + return max (n_inputs ().n_audio(), processor_max_streams.n_audio()); } -int -Route::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, +int +Route::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, bool session_state_changing, bool /*can_record*/, bool /*rec_monitors_input*/) { if (n_outputs().n_total() == 0) { @@ -2196,7 +2196,7 @@ Route::check_initial_delay (nframes_t nframes, nframes_t& transport_frame) nframes -= _roll_delay; silence (_roll_delay); - /* we've written _roll_delay of samples into the + /* we've written _roll_delay of samples into the output ports, so make a note of that for future reference. */ @@ -2231,7 +2231,7 @@ Route::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, int silence (nframes); return 0; } - + nframes_t unused = 0; if ((nframes = check_initial_delay (nframes, unused)) == 0) { @@ -2246,7 +2246,7 @@ Route::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, int } int -Route::silent_roll (nframes_t nframes, sframes_t /*start_frame*/, sframes_t /*end_frame*/, +Route::silent_roll (nframes_t nframes, sframes_t /*start_frame*/, sframes_t /*end_frame*/, bool /*can_record*/, bool /*rec_monitors_input*/) { silence (nframes); @@ -2267,18 +2267,18 @@ Route::has_external_redirects () const // FIXME: what about sends? - they don't return a signal back to ardour? boost::shared_ptr<const PortInsert> pi; - + for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { if ((pi = boost::dynamic_pointer_cast<const PortInsert>(*i)) != 0) { for (PortSet::const_iterator port = pi->output()->ports().begin(); port != pi->output()->ports().end(); ++port) { - + string port_name = port->name(); string client_name = port_name.substr (0, port_name.find(':')); /* only say "yes" if the redirect is actually in use */ - + if (client_name != "ardour" && pi->active()) { return true; } @@ -2325,7 +2325,7 @@ Route::set_meter_point (MeterPoint p, void *src) break; } _processors.insert(loc, _meter); - + meter_change (src); /* EMIT SIGNAL */ processors_changed (); /* EMIT SIGNAL */ _session.set_dirty (); @@ -2380,7 +2380,7 @@ Route::update_total_latency () #endif _output->set_port_latency (own_latency); - + if (_output->user_latency() == 0) { /* this (virtual) function is used for pure Routes, @@ -2389,7 +2389,7 @@ Route::update_total_latency () port, not prerecorded material, and therefore we have to take into account any input latency. */ - + own_latency += _input->signal_latency (); } @@ -2397,7 +2397,7 @@ Route::update_total_latency () _output->set_latency_delay (own_latency); signal_latency_changed (); /* EMIT SIGNAL */ } - + #ifdef DEBUG_LATENCY cerr << _name << ": input latency = " << _input->signal_latency() << " total = " << own_latency << endl; @@ -2442,7 +2442,7 @@ Route::automation_snapshot (nframes_t now, bool force) } Route::SoloControllable::SoloControllable (std::string name, Route& r) - : AutomationControl (r.session(), Evoral::Parameter (SoloAutomation), + : AutomationControl (r.session(), Evoral::Parameter (SoloAutomation), boost::shared_ptr<AutomationList>(), name) , route (r) { @@ -2454,7 +2454,7 @@ void Route::SoloControllable::set_value (float val) { bool bval = ((val >= 0.5f) ? true: false); - + route.set_solo (bval, this); } @@ -2464,7 +2464,7 @@ Route::SoloControllable::get_value (void) const return route.soloed() ? 1.0f : 0.0f; } -void +void Route::set_block_size (nframes_t nframes) { for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { @@ -2526,10 +2526,10 @@ Route::shift (nframes64_t /*pos*/, nframes64_t /*frames*/) { Glib::RWLock::ReaderLock lm (redirect_lock); for (RedirectList::iterator i = _redirects.begin (); i != _redirects.end (); ++i) { - + set<uint32_t> a; (*i)->what_has_automation (a); - + for (set<uint32_t>::const_iterator j = a.begin (); j != a.end (); ++j) { AutomationList & al = (*i)->automation_list (*j); XMLNode &before = al.get_state (); @@ -2549,9 +2549,9 @@ Route::save_as_template (const string& path, const string& name) { XMLNode& node (state (false)); XMLTree tree; - + IO::set_name_in_state (*node.children().front(), name); - + tree.set_root (&node); return tree.write (path.c_str()); } @@ -2566,15 +2566,15 @@ Route::set_name (const string& str) name = Route::ensure_track_or_route_name (str, _session); SessionObject::set_name (name); - + ret = (_input->set_name(name) && _output->set_name(name)); if (ret) { - + Glib::RWLock::ReaderLock lm (_processor_lock); - + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - + /* rename all I/O processors that have inputs or outputs */ boost::shared_ptr<IOProcessor> iop = boost::dynamic_pointer_cast<IOProcessor> (*i); @@ -2598,14 +2598,14 @@ Route::internal_send_for (boost::shared_ptr<const Route> target) const for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { boost::shared_ptr<InternalSend> send; - + if ((send = boost::dynamic_pointer_cast<InternalSend>(*i)) != 0) { if (send->target_route() == target) { return send; } } } - + return boost::shared_ptr<Send>(); } @@ -2696,7 +2696,7 @@ Route::get_control (const Evoral::Parameter& param) if (!c) { /* maybe one of our processors does or ... */ - + Glib::RWLock::ReaderLock rm (_processor_lock, Glib::TRY_LOCK); for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if ((c = boost::dynamic_pointer_cast<AutomationControl>((*i)->data().control (param))) != 0) { @@ -2704,7 +2704,7 @@ Route::get_control (const Evoral::Parameter& param) } } } - + if (!c) { /* nobody does so we'll make a new one */ diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc index 26612226a7..5cfc1fb3d0 100644 --- a/libs/ardour/route_group.cc +++ b/libs/ardour/route_group.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2002 Paul Davis + Copyright (C) 2000-2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -68,9 +68,9 @@ RouteGroup::remove_when_going_away (Route *r) { remove (r); } - + int -RouteGroup::remove (Route *r) +RouteGroup::remove (Route *r) { list<Route *>::iterator i; @@ -88,7 +88,7 @@ gain_t RouteGroup::get_min_factor(gain_t factor) { gain_t g; - + for (list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) { g = (*i)->amp()->gain(); @@ -97,9 +97,9 @@ RouteGroup::get_min_factor(gain_t factor) if ( g <= 0.0000003f ) return 0.0f; - + factor = 0.0000003f/g - 1.0f; - } + } return factor; } @@ -107,14 +107,14 @@ gain_t RouteGroup::get_max_factor(gain_t factor) { gain_t g; - + for (list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) { g = (*i)->amp()->gain(); - + // if the current factor woulnd't raise this route above maximum - if ( (g+g*factor) <= 1.99526231f) + if ( (g+g*factor) <= 1.99526231f) continue; - + // if route gain is already at peak, return 0.0f factor if (g>=1.99526231f) return 0.0f; @@ -136,7 +136,7 @@ RouteGroup::get_state (void) return *node; } -int +int RouteGroup::set_state (const XMLNode& node) { const XMLProperty *prop; @@ -152,7 +152,7 @@ RouteGroup::set_state (const XMLNode& node) if ((prop = node.property ("properties")) != 0) { _properties = Property (string_2_enum (prop->value(), _properties)); } - + return 0; } @@ -200,7 +200,7 @@ RouteGroup::set_hidden (bool yn, void *src) _flags = Flag (_flags & ~Active); } } else { - _flags = Flag (_flags & ~Hidden); + _flags = Flag (_flags & ~Hidden); if (Config->get_hiding_groups_deactivates_groups()) { _flags = Flag (_flags | Active); } @@ -210,8 +210,8 @@ RouteGroup::set_hidden (bool yn, void *src) } void -RouteGroup::audio_track_group (set<AudioTrack*>& ats) -{ +RouteGroup::audio_track_group (set<AudioTrack*>& ats) +{ for (list<Route*>::iterator i = routes.begin(); i != routes.end(); ++i) { AudioTrack* at = dynamic_cast<AudioTrack*>(*i); if (at) { @@ -238,7 +238,7 @@ RouteGroup::make_subgroup () for (list<Route*>::iterator i = routes.begin(); i != routes.end(); ++i) { nin = max (nin, (*i)->output()->n_ports().n_audio()); } - + try { /* use master bus etc. to determine default nouts */ rl = _session.new_audio_route (nin, 2, 0, 1); @@ -250,7 +250,7 @@ RouteGroup::make_subgroup () subgroup_bus->set_name (_name); boost::shared_ptr<Bundle> bundle = subgroup_bus->input()->bundle (); - + for (list<Route*>::iterator i = routes.begin(); i != routes.end(); ++i) { (*i)->output()->disconnect (this); (*i)->output()->connect_ports_to_bundle (bundle, this); diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index a90f31c2cf..f01512332e 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -101,7 +101,7 @@ Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_ // we have to copy the input, because deliver_output() may alter the buffers // in-place, which a send must never do. - + BufferSet& sendbufs = _session.get_mix_buffers (bufs.count()); sendbufs.read_from (bufs, nframes); assert(sendbufs.count() == bufs.count()); @@ -118,7 +118,7 @@ Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_ Delivery::run (sendbufs, start_frame, end_frame, nframes); /* consider metering */ - + if (_metering) { if (_amp->gain_control()->get_value() == 0) { _meter->reset(); @@ -166,7 +166,7 @@ Send::set_state(const XMLNode& node) const XMLNode* insert_node = &node; /* XXX need to load automation state & data for amp */ - + Delivery::set_state (*insert_node); return 0; @@ -178,7 +178,7 @@ Send::can_support_io_configuration (const ChanCount& in, ChanCount& out) const /* sends have no impact at all on the channel configuration of the streams passing through the route. so, out == in. */ - + out = in; return true; } @@ -189,13 +189,13 @@ Send::configure_io (ChanCount in, ChanCount out) if (!_amp->configure_io (in, out) || !_meter->configure_io (in, out)) { return false; } - + if (!Processor::configure_io (in, out)) { return false; } reset_panner (); - + return true; } @@ -213,7 +213,7 @@ Send::make_unique (XMLNode &state, Session &session) state.property("bitslot")->set_value (buf); std::string const name = string_compose (_("send %1"), bitslot); - + state.property("name")->set_value (name); XMLNode* io = state.child ("IO"); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index d3acc19319..96bd69eca3 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -563,14 +563,14 @@ Session::when_engine_running () for (int physport = 0; physport < 2; ++physport) { string physical_output = _engine.get_nth_physical_output (DataType::AUDIO, physport); - + if (physical_output.length()) { if (_click_io->add_port (physical_output, this)) { // relax, even though its an error } } } - + if (_click_io->n_ports () > ChanCount::ZERO) { _clicking = Config->get_clicking (); } @@ -596,7 +596,7 @@ Session::when_engine_running () mono and stereo bundles, so that the common cases of mono and stereo tracks get bundles to put in their mixer strip in / out menus. There may be a nicer way of achieving that; - it doesn't really scale that well to higher channel counts + it doesn't really scale that well to higher channel counts */ /* mono output bundles */ @@ -605,11 +605,11 @@ Session::when_engine_running () char buf[32]; snprintf (buf, sizeof (buf), _("out %" PRIu32), np+1); - shared_ptr<Bundle> c (new Bundle (buf, true)); + shared_ptr<Bundle> c (new Bundle (buf, true)); c->add_channel (_("mono")); - c->set_port (0, _engine.get_nth_physical_output (DataType::AUDIO, np)); + c->set_port (0, _engine.get_nth_physical_output (DataType::AUDIO, np)); - add_bundle (c); + add_bundle (c); } /* stereo output bundles */ @@ -634,11 +634,11 @@ Session::when_engine_running () char buf[32]; snprintf (buf, sizeof (buf), _("in %" PRIu32), np+1); - shared_ptr<Bundle> c (new Bundle (buf, false)); + shared_ptr<Bundle> c (new Bundle (buf, false)); c->add_channel (_("mono")); - c->set_port (0, _engine.get_nth_physical_input (DataType::AUDIO, np)); + c->set_port (0, _engine.get_nth_physical_input (DataType::AUDIO, np)); - add_bundle (c); + add_bundle (c); } /* stereo input bundles */ @@ -657,7 +657,7 @@ Session::when_engine_running () add_bundle (c); } } - + BootMessage (_("Setup signal flow and plugins")); hookup_io (); @@ -665,19 +665,19 @@ Session::when_engine_running () if (!no_auto_connect()) { if (_master_out && Config->get_auto_connect_standard_busses()) { - + /* if requested auto-connect the outputs to the first N physical ports. */ uint32_t limit = _master_out->n_outputs().n_total(); - + for (uint32_t n = 0; n < limit; ++n) { Port* p = _master_out->output()->nth (n); string connect_to = _engine.get_nth_physical_output (DataType (p->type()), n); if (!connect_to.empty() && p->connected_to (connect_to) == false) { if (_master_out->output()->connect (p, connect_to, this)) { - error << string_compose (_("cannot connect master output %1 to %2"), n, connect_to) + error << string_compose (_("cannot connect master output %1 to %2"), n, connect_to) << endmsg; break; } @@ -691,21 +691,21 @@ Session::when_engine_running () are undefined, at best. */ - /* control out listens to master bus (but ignores it + /* control out listens to master bus (but ignores it under some conditions) */ uint32_t limit = _control_out->n_inputs().n_audio(); - + if (_master_out) { for (uint32_t n = 0; n < limit; ++n) { AudioPort* p = _control_out->input()->ports().nth_audio_port (n); AudioPort* o = _master_out->output()->ports().nth_audio_port (n); - + if (o) { string connect_to = o->name(); if (_control_out->input()->connect (p, connect_to, this)) { - error << string_compose (_("cannot connect control input %1 to %2"), n, connect_to) + error << string_compose (_("cannot connect control input %1 to %2"), n, connect_to) << endmsg; break; } @@ -713,7 +713,7 @@ Session::when_engine_running () } } - /* if control out is not connected, + /* if control out is not connected, connect control out to physical outs, but use ones after the master if possible */ @@ -727,28 +727,28 @@ Session::when_engine_running () _control_out->output()->connect_ports_to_bundle (b, this); } else { warning << string_compose (_("The preferred I/O for the monitor bus (%1) cannot be found"), - Config->get_monitor_bus_preferred_bundle()) + Config->get_monitor_bus_preferred_bundle()) << endmsg; } } else { /* XXX this logic is wrong for mixed port types */ - + uint32_t shift = _master_out->n_outputs().n_audio(); uint32_t mod = _engine.n_physical_outputs (DataType::AUDIO); limit = _control_out->n_outputs().n_audio(); cerr << "Connecting " << limit << " control out ports, shift is " << shift << " mod is " << mod << endl; - + for (uint32_t n = 0; n < limit; ++n) { - + Port* p = _control_out->output()->nth (n); string connect_to = _engine.get_nth_physical_output (DataType (p->type()), (n+shift) % mod); - + if (!connect_to.empty()) { if (_control_out->output()->connect (p, connect_to, this)) { - error << string_compose (_("cannot connect control output %1 to %2"), n, connect_to) + error << string_compose (_("cannot connect control output %1 to %2"), n, connect_to) << endmsg; break; } @@ -815,14 +815,14 @@ Session::hookup_io () if (_control_out) { boost::shared_ptr<RouteList> r = routes.reader (); - + for (RouteList::iterator x = r->begin(); x != r->end(); ++x) { if ((*x)->is_control() || (*x)->is_master()) { continue; } - (*x)->listen_via (_control_out, + (*x)->listen_via (_control_out, (Config->get_listen_position() == AfterFaderListen ? PostFader : PreFader), false, false); } @@ -878,9 +878,9 @@ bool Session::record_enabling_legal () const { /* this used to be in here, but survey says.... we don't need to restrict it */ - // if (record_status() == Recording) { - // return false; - // } + // if (record_status() == Recording) { + // return false; + // } if (Config->get_all_safe()) { return false; @@ -1254,7 +1254,7 @@ Session::audible_frame () const } else { tf = _transport_frame; } - + ret = tf; if (!non_realtime_work_pending()) { @@ -1273,8 +1273,8 @@ Session::audible_frame () const if (tf < _last_roll_location + offset) { return _last_roll_location; } - } - + } + /* forwards */ ret -= offset; @@ -1759,7 +1759,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod << endmsg; goto failed; } - + if (track->output()->ensure_io (ChanCount(DataType::AUDIO, output_channels), false, this)) { error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"), input_channels, output_channels) @@ -1789,7 +1789,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod for (uint32_t x = 0; x < track->n_outputs().n_audio(); ++x) { port = ""; - + if (Config->get_output_auto_connect() & AutoConnectPhysical) { port = physoutputs[(channels_used+x)%nphysical_out]; } else if (Config->get_output_auto_connect() & AutoConnectMaster) { @@ -1797,7 +1797,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod port = _master_out->input()->nth (x % _master_out->input()->n_ports().n_audio())->name(); } } - + if (port.length() && track->output()->connect (track->output()->nth(x), port, this)) { break; } @@ -1957,11 +1957,11 @@ Session::new_audio_route (int input_channels, int output_channels, RouteGroup* r for (uint32_t x = 0; n_physical_audio_inputs && x < bus->input()->n_ports().n_audio(); ++x) { port = ""; - + if (Config->get_input_auto_connect() & AutoConnectPhysical) { port = physinputs[((n+x)%n_physical_audio_inputs)]; - } - + } + if (port.length() && bus->input()->connect (bus->input()->nth (x), port, this)) { break; } @@ -2036,34 +2036,34 @@ Session::new_route_from_template (uint32_t how_many, const std::string& template while (how_many) { XMLNode node_copy (*node); // make a copy so we can change the name if we need to - + std::string node_name = IO::name_from_state (*node_copy.children().front()); /* generate a new name by adding a number to the end of the template name */ - + do { snprintf (name, sizeof (name), "%s %" PRIu32, node_name.c_str(), number); - + number++; - + if (route_by_name (name) == 0) { break; } - + } while (number < UINT_MAX); - + if (number == UINT_MAX) { fatal << _("Session: UINT_MAX routes? impossible!") << endmsg; /*NOTREACHED*/ } - + IO::set_name_in_state (*node_copy.children().front(), name); Track::zero_diskstream_id_in_xml (node_copy); try { shared_ptr<Route> route (XMLRouteFactory (node_copy)); - + if (route == 0) { error << _("Session: cannot create track/bus from template description") << endmsg; goto out; @@ -2077,23 +2077,23 @@ Session::new_route_from_template (uint32_t how_many, const std::string& template route->input()->changed (IOChange (ConfigurationChanged|ConnectionsChanged), this); route->output()->changed (IOChange (ConfigurationChanged|ConnectionsChanged), this); } - + route->set_remote_control_id (control_id); ++control_id; - + ret.push_back (route); } - + catch (failed_constructor &err) { error << _("Session: could not create new route from template") << endmsg; goto out; } - + catch (AudioEngine::PortRegistrationFailure& pfe) { error << pfe.what() << endmsg; goto out; } - + --how_many; } @@ -2116,7 +2116,7 @@ Session::add_routes (RouteList& new_routes, bool save) /* if there is no control out and we're not in the middle of loading, resort the graph here. if there is a control out, we will resort - toward the end of this method. if we are in the middle of loading, + toward the end of this method. if we are in the middle of loading, we will resort when done. */ @@ -2151,7 +2151,7 @@ Session::add_routes (RouteList& new_routes, bool save) if ((*x)->is_control() || (*x)->is_master()) { continue; } - (*x)->listen_via (_control_out, + (*x)->listen_via (_control_out, (Config->get_listen_position() == AfterFaderListen ? PostFader : PreFader), false, false); } @@ -2412,7 +2412,7 @@ Session::route_solo_changed (void* /*src*/, boost::weak_ptr<Route> wpr) /* now mod the solo level of all other routes except master & control outs so that they will be silent if appropriate. */ - + solo_update_disabled = true; for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { @@ -2775,17 +2775,17 @@ void Session::update_region_name_map (boost::shared_ptr<Region> region) { string::size_type last_period = region->name().find_last_of ('.'); - + if (last_period != string::npos && last_period < region->name().length() - 1) { - + string base = region->name().substr (0, last_period); string number = region->name().substr (last_period+1); map<string,uint32_t>::iterator x; - + /* note that if there is no number, we get zero from atoi, which is just fine */ - + region_name_map[base] = atoi (number); } } @@ -3800,7 +3800,7 @@ shared_ptr<Bundle> Session::bundle_by_name (string name) const { boost::shared_ptr<BundleList> b = _bundles.reader (); - + for (BundleList::const_iterator i = b->begin(); i != b->end(); ++i) { if ((*i)->name() == name) { return* i; @@ -4095,8 +4095,8 @@ Session::freeze (InterThreadInfo& itt) } boost::shared_ptr<Region> -Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end, - bool /*overwrite*/, vector<boost::shared_ptr<Source> >& srcs, +Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end, + bool /*overwrite*/, vector<boost::shared_ptr<Source> >& srcs, InterThreadInfo& itt, bool enable_processing) { boost::shared_ptr<Region> result; @@ -4225,7 +4225,7 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end, /* construct a region to represent the bounced material */ result = RegionFactory::create (srcs, 0, - srcs.front()->length(srcs.front()->timeline_position()), + srcs.front()->length(srcs.front()->timeline_position()), region_name_from_path (srcs.front()->name(), true)); } @@ -4237,7 +4237,7 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end, if (afs) { afs->mark_for_remove (); } - + (*src)->drop_references (); } diff --git a/libs/ardour/session_butler.cc b/libs/ardour/session_butler.cc index 59fe9e29a8..4f8f244c22 100644 --- a/libs/ardour/session_butler.cc +++ b/libs/ardour/session_butler.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 1999-2002 Paul Davis + Copyright (C) 1999-2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -64,7 +64,7 @@ static inline uint32_t next_power_of_two (uint32_t n) } /*--------------------------------------------------------------------------- - BUTLER THREAD + BUTLER THREAD ---------------------------------------------------------------------------*/ int @@ -72,14 +72,14 @@ Session::start_butler_thread () { /* size is in Samples, not bytes */ audio_dstream_buffer_size = (uint32_t) floor (Config->get_audio_track_buffer_seconds() * (float) frame_rate()); - + /* size is in bytes * XXX: Jack needs to tell us the MIDI buffer size * (i.e. how many MIDI bytes we might see in a cycle) */ midi_dstream_buffer_size = (uint32_t) floor (Config->get_midi_track_buffer_seconds() * (float)frame_rate()); MidiDiskstream::set_readahead_frames ((nframes_t) (Config->get_midi_readahead() * (float) frame_rate())); - + Crossfade::set_buffer_size (audio_dstream_buffer_size); butler_should_run = false; @@ -183,13 +183,13 @@ Session::butler_thread_work () while (true) { pfd[0].fd = butler_request_pipe[0]; pfd[0].events = POLLIN|POLLERR|POLLHUP; - + if (poll (pfd, 1, (disk_work_outstanding ? 0 : -1)) < 0) { - + if (errno == EINTR) { continue; } - + error << string_compose (_("poll on butler request pipe failed (%1)"), strerror (errno)) << endmsg; @@ -200,39 +200,39 @@ Session::butler_thread_work () error << string_compose (_("Error on butler thread request pipe: fd=%1 err=%2"), pfd[0].fd, pfd[0].revents) << endmsg; break; } - + if (pfd[0].revents & POLLIN) { char req; - + /* empty the pipe of all current requests */ - + while (1) { size_t nread = ::read (butler_request_pipe[0], &req, sizeof (req)); if (nread == 1) { - + switch ((ButlerRequest::Type) req) { - + case ButlerRequest::Wake: break; case ButlerRequest::Run: butler_should_run = true; break; - + case ButlerRequest::Pause: butler_should_run = false; break; - + case ButlerRequest::Quit: pthread_exit_pbd (0); /*NOTREACHED*/ break; - + default: break; } - + } else if (nread == 0) { break; } else if (errno == EAGAIN) { @@ -267,7 +267,7 @@ Session::butler_thread_work () /* don't read inactive tracks */ boost::shared_ptr<IO> io = ds->io(); - + if (io && !io->active()) { continue; } @@ -280,7 +280,7 @@ Session::butler_thread_work () bytes += ds->read_data_count(); disk_work_outstanding = true; break; - + default: compute_io = false; error << string_compose(_("Butler read ahead failure on dstream %1"), (*i)->name()) << endmsg; @@ -293,13 +293,13 @@ Session::butler_thread_work () /* we didn't get to all the streams */ disk_work_outstanding = true; } - + if (!err && transport_work_requested()) { continue; } if (compute_io) { - end = get_microseconds(); + end = get_microseconds(); if(end-begin > 0) { _read_data_rate = (float) bytes / (float) (end - begin); } else { _read_data_rate = 0; // infinity better @@ -315,7 +315,7 @@ Session::butler_thread_work () /* note that we still try to flush diskstreams attached to inactive routes */ - + switch ((*i)->do_flush (ButlerContext)) { case 0: bytes += (*i)->write_data_count(); @@ -324,12 +324,12 @@ Session::butler_thread_work () bytes += (*i)->write_data_count(); disk_work_outstanding = true; break; - + default: err++; compute_io = false; error << string_compose(_("Butler write-behind failure on dstream %1"), (*i)->name()) << endmsg; - /* don't break - try to flush all streams in case they + /* don't break - try to flush all streams in case they are split across disks. */ } @@ -346,7 +346,7 @@ Session::butler_thread_work () /* we didn't get to all the streams */ disk_work_outstanding = true; } - + if (!err && transport_work_requested()) { continue; } @@ -360,7 +360,7 @@ Session::butler_thread_work () _write_data_rate = 0; // Well, infinity would be better } } - + if (!disk_work_outstanding) { refresh_disk_space (); } diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc index caff7dd1a7..2e7e077ce7 100644 --- a/libs/ardour/session_click.cc +++ b/libs/ardour/session_click.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 20002 Paul Davis + Copyright (C) 20002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,11 +48,11 @@ Session::click (nframes_t start, nframes_t nframes) } Glib::RWLock::WriterLock clickm (click_lock, Glib::TRY_LOCK); - + if (!clickm.locked() || _transport_speed != 1.0 || !_clicking || click_data == 0) { _click_io->silence (nframes); return; - } + } const nframes_t end = start + nframes; @@ -80,11 +80,11 @@ Session::click (nframes_t start, nframes_t nframes) case TempoMap::Bar: if (click_emphasis_data) { clicks.push_back (new Click ((*i).frame, click_emphasis_length, click_emphasis_data)); - } + } break; } } - + run_clicks: memset (buf, 0, sizeof (Sample) * nframes); @@ -98,7 +98,7 @@ Session::click (nframes_t start, nframes_t nframes) clk = *i; next = i; ++next; - + if (clk->start < start) { internal_offset = 0; } else { @@ -106,7 +106,7 @@ Session::click (nframes_t start, nframes_t nframes) } if (nframes < internal_offset) { - /* we've just located or something.. + /* we've just located or something.. effectively going backwards. lets get the flock out of here */ break; @@ -126,7 +126,7 @@ Session::click (nframes_t start, nframes_t nframes) i = next; } - + _click_io->copy_to_outputs (bufs, DataType::AUDIO, nframes, 0); } @@ -139,7 +139,7 @@ Session::setup_click_sounds (int which) clear_clicks(); if ((which == 0 || which == 1)) { - + if (click_data != default_click) { delete [] click_data; click_data = 0; @@ -162,22 +162,22 @@ Session::setup_click_sounds (int which) _clicking = false; return; } - + click_data = new Sample[info.frames]; click_length = info.frames; - + if (sf_read_float (sndfile, click_data, info.frames) != info.frames) { - warning << _("cannot read data from click soundfile") << endmsg; + warning << _("cannot read data from click soundfile") << endmsg; delete click_data; click_data = 0; _clicking = false; } - + sf_close (sndfile); } } - + if ((which == 0 || which == -1)) { if (click_emphasis_data != default_click_emphasis) { @@ -198,20 +198,20 @@ Session::setup_click_sounds (int which) warning << string_compose (_("cannot open click emphasis soundfile %1 (%2)"), path, errbuf) << endmsg; return; } - + click_emphasis_data = new Sample[info.frames]; click_emphasis_length = info.frames; - + if (sf_read_float (sndfile, click_emphasis_data, info.frames) != info.frames) { - warning << _("cannot read data from click emphasis soundfile") << endmsg; + warning << _("cannot read data from click emphasis soundfile") << endmsg; delete click_emphasis_data; click_emphasis_data = 0; } - + sf_close (sndfile); } } -} +} void Session::clear_clicks () diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc index 4af18fcd12..af1286e8f2 100644 --- a/libs/ardour/session_command.cc +++ b/libs/ardour/session_command.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ void Session::register_with_memento_command_factory(PBD::ID id, PBD::StatefulThi { registry[id] = ptr; } - + Command * Session::memento_command_factory(XMLNode *n) { @@ -73,8 +73,8 @@ Session::memento_command_factory(XMLNode *n) before = new XMLNode(*n->children().front()); after = new XMLNode(*n->children().back()); child = before; - } - + } + if (!child) { error << _("Tried to reconstitute a MementoCommand with no contents, failing. id=") << id.to_s() << endmsg; return 0; @@ -102,7 +102,7 @@ Session::memento_command_factory(XMLNode *n) if (boost::shared_ptr<Playlist> pl = playlist_by_name(child->property("name")->value())) { return new MementoCommand<Playlist>(*(pl.get()), before, after); } - } else if (obj_T == typeid (Route).name() || obj_T == typeid (AudioTrack).name() || obj_T == typeid(MidiTrack).name()) { + } else if (obj_T == typeid (Route).name() || obj_T == typeid (AudioTrack).name() || obj_T == typeid(MidiTrack).name()) { if (boost::shared_ptr<Route> r = route_by_id(id)) { return new MementoCommand<Route>(*r, before, after); } else { @@ -133,7 +133,7 @@ Session::global_state_command_factory (const XMLNode& node) error << _("GlobalRouteStateCommand has no \"type\" node, ignoring") << endmsg; return 0; } - + try { if (prop->value() == "solo") { @@ -181,7 +181,7 @@ Session::GlobalRouteStateCommand::set_state (const XMLNode& node) before.clear (); after.clear (); - + for (loop = 0; loop < 2; ++loop) { const char *str; @@ -191,7 +191,7 @@ Session::GlobalRouteStateCommand::set_state (const XMLNode& node) } else { str = "before"; } - + if ((child = node.child (str)) == 0) { warning << string_compose (_("global route state command has no \"%1\" node, ignoring entire command"), str) << endmsg; return -1; @@ -200,24 +200,24 @@ Session::GlobalRouteStateCommand::set_state (const XMLNode& node) nlist = child->children(); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - + RouteBooleanState rbs; boost::shared_ptr<Route> route; ID id; - + prop = (*niter)->property ("id"); id = prop->value (); - + if ((route = sess.route_by_id (id)) == 0) { warning << string_compose (_("cannot find track/bus \"%1\" while rebuilding a global route state command, ignored"), id.to_s()) << endmsg; continue; } - + rbs.first = boost::weak_ptr<Route> (route); - + prop = (*niter)->property ("yn"); rbs.second = (prop->value() == "1"); - + if (loop) { after.push_back (rbs); } else { @@ -277,19 +277,19 @@ Session::GlobalSoloStateCommand::GlobalSoloStateCommand (Session& sess, const XM { } -void +void Session::GlobalSoloStateCommand::mark() { after = sess.get_global_route_boolean(&Route::soloed); } -void +void Session::GlobalSoloStateCommand::operator()() { sess.set_global_solo(after, src); } -void +void Session::GlobalSoloStateCommand::undo() { sess.set_global_solo(before, src); @@ -315,19 +315,19 @@ Session::GlobalMuteStateCommand::GlobalMuteStateCommand (Session& sess, const XM { } -void +void Session::GlobalMuteStateCommand::mark() { after = sess.get_global_route_boolean(&Route::muted); } -void +void Session::GlobalMuteStateCommand::operator()() { sess.set_global_mute(after, src); } -void +void Session::GlobalMuteStateCommand::undo() { sess.set_global_mute(before, src); @@ -342,7 +342,7 @@ Session::GlobalMuteStateCommand::get_state() } // record enable -Session::GlobalRecordEnableStateCommand::GlobalRecordEnableStateCommand(Session &sess, void *src) +Session::GlobalRecordEnableStateCommand::GlobalRecordEnableStateCommand(Session &sess, void *src) : GlobalRouteStateCommand (sess, src) { after = before = sess.get_global_route_boolean(&Route::record_enabled); @@ -353,25 +353,25 @@ Session::GlobalRecordEnableStateCommand::GlobalRecordEnableStateCommand (Session { } -void +void Session::GlobalRecordEnableStateCommand::mark() { after = sess.get_global_route_boolean(&Route::record_enabled); } -void +void Session::GlobalRecordEnableStateCommand::operator()() { sess.set_global_record_enable(after, src); } -void +void Session::GlobalRecordEnableStateCommand::undo() { sess.set_global_record_enable(before, src); } -XMLNode& +XMLNode& Session::GlobalRecordEnableStateCommand::get_state() { XMLNode& node = GlobalRouteStateCommand::get_state(); @@ -380,7 +380,7 @@ Session::GlobalRecordEnableStateCommand::get_state() } // metering -Session::GlobalMeteringStateCommand::GlobalMeteringStateCommand(Session &s, void *p) +Session::GlobalMeteringStateCommand::GlobalMeteringStateCommand(Session &s, void *p) : sess (s), src (p) { after = before = sess.get_global_route_metering(); @@ -394,19 +394,19 @@ Session::GlobalMeteringStateCommand::GlobalMeteringStateCommand (Session& s, con } } -void +void Session::GlobalMeteringStateCommand::mark() { after = sess.get_global_route_metering(); } -void +void Session::GlobalMeteringStateCommand::operator()() { sess.set_global_route_metering(after, src); } -void +void Session::GlobalMeteringStateCommand::undo() { sess.set_global_route_metering(before, src); @@ -427,7 +427,7 @@ Session::GlobalMeteringStateCommand::get_state() child->add_property (X_("id"), r->id().to_s()); const char* meterstr = 0; - + switch (x->second) { case MeterInput: meterstr = X_("input"); @@ -455,7 +455,7 @@ Session::GlobalMeteringStateCommand::get_state() child->add_property (X_("id"), r->id().to_s()); const char* meterstr; - + switch (x->second) { case MeterInput: meterstr = X_("input"); @@ -494,7 +494,7 @@ Session::GlobalMeteringStateCommand::set_state (const XMLNode& node) before.clear (); after.clear (); - + for (loop = 0; loop < 2; ++loop) { const char *str; @@ -504,7 +504,7 @@ Session::GlobalMeteringStateCommand::set_state (const XMLNode& node) } else { str = "before"; } - + if ((child = node.child (str)) == 0) { warning << string_compose (_("global route meter state command has no \"%1\" node, ignoring entire command"), str) << endmsg; return -1; @@ -513,21 +513,21 @@ Session::GlobalMeteringStateCommand::set_state (const XMLNode& node) nlist = child->children(); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - + RouteMeterState rms; boost::shared_ptr<Route> route; ID id; - + prop = (*niter)->property ("id"); id = prop->value (); - + if ((route = sess.route_by_id (id)) == 0) { warning << string_compose (_("cannot find track/bus \"%1\" while rebuilding a global route state command, ignored"), id.to_s()) << endmsg; continue; } - + rms.first = boost::weak_ptr<Route> (route); - + prop = (*niter)->property ("meter"); if (prop->value() == X_("pre")) { @@ -537,7 +537,7 @@ Session::GlobalMeteringStateCommand::set_state (const XMLNode& node) } else { rms.second = MeterInput; } - + if (loop) { after.push_back (rms); } else { diff --git a/libs/ardour/session_configuration.cc b/libs/ardour/session_configuration.cc index 498e91ea20..2cae7021e1 100644 --- a/libs/ardour/session_configuration.cc +++ b/libs/ardour/session_configuration.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ SessionConfiguration::SessionConfiguration () : /* construct variables */ #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL #define CONFIG_VARIABLE(Type,var,name,value) var (name,value), #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) var (name,value,mutator), #include "ardour/session_configuration_vars.h" @@ -37,7 +37,7 @@ SessionConfiguration::SessionConfiguration () #undef CONFIG_VARIABLE_SPECIAL foo (0) { - + } XMLNode& @@ -62,14 +62,14 @@ SessionConfiguration::get_variables () node = new XMLNode ("Config"); #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL #define CONFIG_VARIABLE(type,var,Name,value) \ var.add_to_node (*node); #define CONFIG_VARIABLE_SPECIAL(type,var,Name,value,mutator) \ var.add_to_node (*node); #include "ardour/session_configuration_vars.h" #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL return *node; } @@ -95,7 +95,7 @@ void SessionConfiguration::set_variables (const XMLNode& node) { #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL #define CONFIG_VARIABLE(type,var,name,value) \ if (var.set_from_node (node)) { \ ParameterChanged (name); \ @@ -108,16 +108,16 @@ SessionConfiguration::set_variables (const XMLNode& node) #include "ardour/session_configuration_vars.h" #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL - + } void SessionConfiguration::map_parameters (sigc::slot<void, std::string> theSlot) { #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL #define CONFIG_VARIABLE(type,var,name,value) theSlot (name); #define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) theSlot (name); #include "ardour/session_configuration_vars.h" #undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL +#undef CONFIG_VARIABLE_SPECIAL } diff --git a/libs/ardour/session_directory.cc b/libs/ardour/session_directory.cc index d56998b550..09c2154c30 100644 --- a/libs/ardour/session_directory.cc +++ b/libs/ardour/session_directory.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Tim Mayberry + Copyright (C) 2007 Tim Mayberry This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -140,7 +140,7 @@ SessionDirectory::export_path () const const vector<path> SessionDirectory::sub_directories () const { - vector<path> tmp_paths; + vector<path> tmp_paths; tmp_paths.push_back ( sound_path () ); tmp_paths.push_back ( midi_path () ); diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc index d631eda710..cf6e9f9c51 100644 --- a/libs/ardour/session_events.cc +++ b/libs/ardour/session_events.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 1999-2004 Paul Davis + Copyright (C) 1999-2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -100,8 +100,8 @@ Session::dump_events () const if ((Events::const_iterator) next_event == events.end()) { cerr << "none" << endl; } else { - cerr << "at " << (*next_event)->action_frame << ' ' - << (*next_event)->type << " target = " + cerr << "at " << (*next_event)->action_frame << ' ' + << (*next_event)->type << " target = " << (*next_event)->target_frame << endl; } cerr << "Immediate events pending:\n"; @@ -138,7 +138,7 @@ Session::merge_event (Event* ev) _clear_event_type (ev->type); delete ev; return; - + case Event::Add: break; } @@ -149,7 +149,7 @@ Session::merge_event (Event* ev) process_event (ev); return; } - + switch (ev->type) { case Event::AutoLoop: case Event::StopOnce: @@ -159,7 +159,7 @@ Session::merge_event (Event* ev) default: for (Events::iterator i = events.begin(); i != events.end(); ++i) { if ((*i)->type == ev->type && (*i)->action_frame == ev->action_frame) { - error << string_compose(_("Session: cannot have two events of type %1 at the same frame (%2)."), + error << string_compose(_("Session: cannot have two events of type %1 at the same frame (%2)."), event_names[ev->type], ev->action_frame) << endmsg; return; } @@ -210,7 +210,7 @@ Session::_remove_event (Session::Event* ev) { bool ret = false; Events::iterator i; - + for (i = events.begin(); i != events.end(); ++i) { if ((*i)->type == ev->type && (*i)->action_frame == ev->action_frame) { if ((*i) == ev) { @@ -237,7 +237,7 @@ void Session::_clear_event_type (Event::Type type) { Events::iterator i, tmp; - + for (i = events.begin(); i != events.end(); ) { tmp = i; @@ -276,7 +276,7 @@ Session::set_next_event () if (events.empty()) { next_event = events.end(); return; - } + } if (next_event == events.end()) { next_event = events.begin(); @@ -306,7 +306,7 @@ Session::process_event (Event* ev) */ if (non_realtime_work_pending()) { - + /* except locates, which we have the capability to handle */ if (ev->type != Event::Locate) { @@ -363,7 +363,7 @@ Session::process_event (Event* ev) case Event::SetTransportSpeed: set_transport_speed (ev->speed, ev->yes_or_no); break; - + case Event::PunchIn: // cerr << "PunchIN at " << transport_frame() << endl; if (config.get_punch_in() && record_status() == Enabled) { @@ -372,7 +372,7 @@ Session::process_event (Event* ev) remove = false; del = false; break; - + case Event::PunchOut: // cerr << "PunchOUT at " << transport_frame() << endl; if (config.get_punch_out()) { @@ -398,7 +398,7 @@ Session::process_event (Event* ev) remove = false; del = false; break; - + case Event::RangeLocate: start_locate (ev->target_frame, true, true, false); remove = false; diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index 7982f89507..77f0d89d97 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 1999-2008 Paul Davis + Copyright (C) 1999-2008 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ Session::get_export_handler () if (!export_handler) { export_handler.reset (new ExportHandler (*this)); } - + return export_handler; } @@ -54,7 +54,7 @@ Session::get_export_status () if (!export_status) { export_status.reset (new ExportStatus ()); } - + return export_status; } @@ -88,7 +88,7 @@ Session::pre_export () post_export_position = _transport_frame; Config->set_slave_source (None); - + _exporting = true; export_status->running = true; export_status->Aborting.connect (sigc::hide_return (sigc::mem_fun (*this, &Session::stop_audio_export))); @@ -125,7 +125,7 @@ Session::start_audio_export (nframes_t position, bool realtime) */ _transport_frame = position; - + _exporting_realtime = realtime; export_status->stop = false; @@ -141,7 +141,7 @@ Session::start_audio_export (nframes_t position, bool realtime) post_transport (); /* we are ready to go ... */ - + if (!_engine.connected()) { return -1; } @@ -166,21 +166,21 @@ Session::process_export (nframes_t nframes) stop_audio_export (); return; } - + if (!_exporting_realtime) { /* make sure we've caught up with disk i/o, since we're running faster than realtime c/o JACK. */ - + wait_till_butler_finished (); } - + /* do the usual stuff */ - + process_without_events (nframes); - + /* handle export */ - + ProcessExport (nframes); } catch (ExportFailed e) { @@ -191,7 +191,7 @@ Session::process_export (nframes_t nframes) int Session::process_export_fw (nframes_t nframes) { - process_export (nframes); + process_export (nframes); return 0; } @@ -217,7 +217,7 @@ Session::stop_audio_export () } else { finalize_audio_export (); } - + return 0; } @@ -234,7 +234,7 @@ Session::finalize_audio_export () } /* Clean up */ - + ProcessExport.clear(); ExportReadFinished.clear(); export_freewheel_connection.disconnect(); diff --git a/libs/ardour/session_feedback.cc b/libs/ardour/session_feedback.cc index e6d1086126..6e08fc01b0 100644 --- a/libs/ardour/session_feedback.cc +++ b/libs/ardour/session_feedback.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,4 +46,4 @@ using namespace ARDOUR; //using namespace sigc; - + diff --git a/libs/ardour/session_metadata.cc b/libs/ardour/session_metadata.cc index 8805cf5a0d..e792fd1585 100644 --- a/libs/ardour/session_metadata.cc +++ b/libs/ardour/session_metadata.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis Author: Sakari Bergen This program is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ using namespace Glib; using namespace ARDOUR; SessionMetadata::SessionMetadata () -{ +{ /*** General ***/ map.insert (Property ("comment", "")); map.insert (Property ("copyright", "")); @@ -94,11 +94,11 @@ SessionMetadata::get_xml (const ustring & name) if (value.empty()) { return 0; } - + XMLNode val ("value", value); XMLNode * node = new XMLNode (name); node->add_child_copy (val); - + return node; } @@ -111,7 +111,7 @@ SessionMetadata::get_value (const ustring & name) const std::cerr << "Programming error in SessionMetadata::get_value" << std::endl; return ""; } - + return it->second; } @@ -130,7 +130,7 @@ SessionMetadata::set_value (const ustring & name, const ustring & value) std::cerr << "Programming error in SessionMetadata::set_value" << std::endl; return; } - + it->second = value; } @@ -152,13 +152,13 @@ SessionMetadata::get_state () { XMLNode * node = new XMLNode ("Metadata"); XMLNode * prop; - + for (PropertyMap::const_iterator it = map.begin(); it != map.end(); ++it) { if ((prop = get_xml (it->first))) { node->add_child_nocopy (*prop); } } - + return *node; } @@ -169,20 +169,20 @@ SessionMetadata::set_state (const XMLNode & state) ustring name; ustring value; XMLNode * node; - + for (XMLNodeConstIterator it = children.begin(); it != children.end(); it++) { node = *it; if (node->children().empty()) { continue; } - + name = node->name(); node = *node->children().begin(); value = node->content(); - + set_value (name, value); } - + return 0; } diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 990246aa7c..25807687a8 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -330,7 +330,7 @@ Session::set_trace_midi_input (bool yn, MIDI::Port* port) MIDI::Parser* input_parser; cerr << "enabling tracing: " << yn << " for input port " << port->name() << endl; - + if (port) { if ((input_parser = port->input()) != 0) { input_parser->trace (yn, &cout, "input: "); @@ -354,10 +354,10 @@ Session::set_trace_midi_input (bool yn, MIDI::Port* port) input_parser->trace (yn, &cout, "input: "); } } - - if (_midi_clock_port - && _midi_clock_port != _mmc_port - && _midi_clock_port != _mtc_port + + if (_midi_clock_port + && _midi_clock_port != _mmc_port + && _midi_clock_port != _mtc_port && _midi_clock_port != _midi_port) { if ((input_parser = _midi_clock_port->input()) != 0) { input_parser->trace (yn, &cout, "input: "); diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 2dd68744b4..41f3a52d7d 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 1999-2002 Paul Davis + Copyright (C) 1999-2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -66,11 +66,11 @@ Session::process (nframes_t nframes) if (non_realtime_work_pending()) { if (!transport_work_requested ()) { post_transport (); - } - } + } + } (this->*process_function) (nframes); - + // the ticker is for sending time information like MidiClock nframes_t transport_frames = transport_frame(); BBT_Time transport_bbt; @@ -78,9 +78,9 @@ Session::process (nframes_t nframes) SMPTE::Time transport_smpte; smpte_time(transport_frames, transport_smpte); tick (transport_frames, transport_bbt, transport_smpte); /* EMIT SIGNAL */ - + SendFeedback (); /* EMIT SIGNAL */ - + MIDI::Manager::instance()->cycle_end(); } @@ -112,14 +112,14 @@ Session::no_roll (nframes_t nframes) } for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - + if ((*i)->is_hidden()) { continue; } - + (*i)->set_pending_declick (declick); - - if ((*i)->no_roll (nframes, _transport_frame, end_frame, non_realtime_work_pending(), + + if ((*i)->no_roll (nframes, _transport_frame, end_frame, non_realtime_work_pending(), actively_recording(), declick)) { error << string_compose(_("Session: error in no roll for %1"), (*i)->name()) << endmsg; ret = -1; @@ -172,7 +172,7 @@ Session::process_routes (nframes_t nframes) stop_transport (); return -1; - } + } } return 0; @@ -190,7 +190,7 @@ Session::silent_process_routes (nframes_t nframes) /* force a declick out */ declick = -1; } - + const nframes_t start_frame = _transport_frame; const nframes_t end_frame = _transport_frame + lrintf(nframes * _transport_speed); @@ -203,7 +203,7 @@ Session::silent_process_routes (nframes_t nframes) } if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, record_active, rec_monitors)) < 0) { - + /* we have to do this here. Route::roll() for an AudioTrack will have called AudioDiskstream::process(), and the DS will expect AudioDiskstream::commit() to be called. but we're aborting from that call path, so make sure we release any outstanding locks here before we return failure. @@ -216,7 +216,7 @@ Session::silent_process_routes (nframes_t nframes) stop_transport (); return -1; - } + } } return 0; @@ -235,7 +235,7 @@ Session::commit_diskstreams (nframes_t nframes, bool &needs_butler) if ((*i)->hidden()) { continue; } - + /* force all diskstreams not handled by a Route to call do their stuff. Note: the diskstreams that were handled by a route will just return zero from this call, because they know they were processed. So in fact, this @@ -250,7 +250,7 @@ Session::commit_diskstreams (nframes_t nframes, bool &needs_butler) } else if (dret < 0) { (*i)->recover(); } - + pworst = min (pworst, (*i)->playback_buffer_load()); cworst = min (cworst, (*i)->capture_buffer_load()); } @@ -280,7 +280,7 @@ Session::process_with_events (nframes_t nframes) bool session_needs_butler = false; nframes_t stop_limit; long frames_moved; - + /* make sure the auditioner is silent */ if (auditioner) { @@ -295,7 +295,7 @@ Session::process_with_events (nframes_t nframes) /* if we are not in the middle of a state change, and there are immediate events queued up, - process them. + process them. */ while (!non_realtime_work_pending() && !immediate_events.empty()) { @@ -324,7 +324,7 @@ Session::process_with_events (nframes_t nframes) if (_transport_speed == 1.0) { frames_moved = (long) nframes; - } else { + } else { interpolation.set_target_speed (fabs(_target_transport_speed)); interpolation.set_speed (fabs(_transport_speed)); frames_moved = (long) interpolation.interpolate (0, nframes, 0, 0); @@ -335,23 +335,23 @@ Session::process_with_events (nframes_t nframes) { Event* this_event; Events::iterator the_next_one; - + if (!process_can_proceed()) { _silent = true; return; } - + if (!_exporting && _slave) { if (!follow_slave (nframes)) { return; } - } + } if (_transport_speed == 0) { no_roll (nframes); return; } - + if (!_exporting) { send_midi_time_code_for_cycle (nframes); } @@ -370,14 +370,14 @@ Session::process_with_events (nframes_t nframes) if (maybe_stop (stop_limit)) { no_roll (nframes); return; - } + } this_event = *next_event; the_next_one = next_event; ++the_next_one; /* yes folks, here it is, the actual loop where we really truly - process some audio + process some audio */ while (nframes) { @@ -390,12 +390,12 @@ Session::process_with_events (nframes_t nframes) /* this isn't quite right for reverse play */ frames_moved = (long) (this_event->action_frame - _transport_frame); this_nframes = (nframes_t) abs( floor(frames_moved / _transport_speed) ); - } + } if (this_nframes) { - + click (_transport_frame, this_nframes); - + /* now process frames between now and the first event in this block */ prepare_diskstreams (); @@ -403,11 +403,11 @@ Session::process_with_events (nframes_t nframes) fail_roll (nframes); return; } - + commit_diskstreams (this_nframes, session_needs_butler); nframes -= this_nframes; - + if (frames_moved < 0) { decrement_transport_position (-frames_moved); } else { @@ -419,9 +419,9 @@ Session::process_with_events (nframes_t nframes) } _engine.split_cycle (this_nframes); - + /* now handle this event and all others scheduled for the same time */ - + while (this_event && this_event->action_frame == _transport_frame) { process_event (this_event); @@ -431,7 +431,7 @@ Session::process_with_events (nframes_t nframes) this_event = *the_next_one; ++the_next_one; } - } + } /* if an event left our state changing, do the right thing */ @@ -442,7 +442,7 @@ Session::process_with_events (nframes_t nframes) /* this is necessary to handle the case of seamless looping */ end_frame = _transport_frame + (nframes_t) floor (nframes * _transport_speed); - + } set_next_event (); @@ -488,7 +488,7 @@ Session::follow_slave (nframes_t nframes) Config->set_slave_source (None); goto noroll; } - + _slave->speed_and_position (slave_speed, slave_transport_frame); if (!_slave->locked()) { @@ -509,13 +509,13 @@ Session::follow_slave (nframes_t nframes) if (_slave->is_always_synced() || config.get_timecode_source_is_synced()) { - /* if the TC source is synced, then we assume that its + /* if the TC source is synced, then we assume that its speed is binary: 0.0 or 1.0 */ if (slave_speed != 0.0f) { slave_speed = 1.0f; - } + } } else { @@ -526,17 +526,17 @@ Session::follow_slave (nframes_t nframes) calculate_moving_average_of_slave_delta(dir, this_delta); } - + track_slave_state(slave_speed, slave_transport_frame, this_delta, starting); if (slave_state == Running && !_slave->is_always_synced() && !config.get_timecode_source_is_synced()) { if (_transport_speed != 0.0f) { - - /* - note that average_dir is +1 or -1 + + /* + note that average_dir is +1 or -1 */ - + float delta; #ifdef USE_MOVING_AVERAGE_OF_SLAVE @@ -553,7 +553,7 @@ Session::follow_slave (nframes_t nframes) #endif float adjusted_speed = slave_speed + (delta / float(_current_frame_rate)); - + if (_slave->give_slave_full_control_over_transport_speed()) { request_transport_speed(slave_speed); } else { @@ -567,23 +567,23 @@ Session::follow_slave (nframes_t nframes) << endl; #endif } - + if (abs(average_slave_delta) > (long) _slave->resolution()) { cerr << "average slave delta greater than slave resolution, going to silent motion\n"; goto silent_motion; } } - } - + } + #ifdef DEBUG_SLAVES if (slave_speed != 0.0) cerr << "delta = " << (int) (dir * this_delta) - << " speed = " << slave_speed - << " ts = " << _transport_speed - << " M@ "<< slave_transport_frame << " S@ " << _transport_frame - << " avgdelta = " << average_slave_delta + << " speed = " << slave_speed + << " ts = " << _transport_speed + << " M@ "<< slave_transport_frame << " S@ " << _transport_frame + << " avgdelta = " << average_slave_delta << endl; - #endif + #endif if (!starting && !non_realtime_work_pending()) { /* speed is set, we're locked, and good to go */ @@ -591,15 +591,15 @@ Session::follow_slave (nframes_t nframes) } silent_motion: - #ifdef DEBUG_SLAVES + #ifdef DEBUG_SLAVES cerr << "reached silent_motion:" <<endl; #endif - + follow_slave_silently (nframes, slave_speed); - + noroll: /* don't move at all */ - #ifdef DEBUG_SLAVES + #ifdef DEBUG_SLAVES cerr << "reached no_roll:" <<endl; #endif no_roll (nframes); @@ -617,7 +617,7 @@ Session::calculate_moving_average_of_slave_delta(int dir, nframes_t this_delta) if (delta_accumulator_cnt != 0 || this_delta < _current_frame_rate) { delta_accumulator[delta_accumulator_cnt++] = long(dir) * long(this_delta); } - + if (have_first_delta_accumulator) { average_slave_delta = 0L; for (int i = 0; i < delta_accumulator_size; ++i) { @@ -635,8 +635,8 @@ Session::calculate_moving_average_of_slave_delta(int dir, nframes_t this_delta) void Session::track_slave_state( - float slave_speed, - nframes_t slave_transport_frame, + float slave_speed, + nframes_t slave_transport_frame, nframes_t this_delta, bool starting) { @@ -681,7 +681,7 @@ Session::track_slave_state( #ifdef DEBUG_SLAVES cerr << "waiting at " << slave_transport_frame << endl; - #endif + #endif if (slave_transport_frame >= slave_wait_end) { #ifdef DEBUG_SLAVES cerr << "\tstart at " << _transport_frame << endl; @@ -692,7 +692,7 @@ Session::track_slave_state( nframes_t frame_delta = slave_transport_frame - _transport_frame; boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader(); - + for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if (!(*i)->can_internal_playback_seek (frame_delta)) { ok = false; @@ -705,7 +705,7 @@ Session::track_slave_state( (*i)->internal_playback_seek (frame_delta); } _transport_frame += frame_delta; - + } else { cerr << "cannot micro-seek\n"; /* XXX what? */ @@ -716,14 +716,14 @@ Session::track_slave_state( this_delta = 0; } } - + if (slave_state == Running && _transport_speed == 0.0f) { - + #ifdef DEBUG_SLAVES cerr << "slave starts transport\n"; #endif start_transport (); - } + } } else { // slave_speed is 0 @@ -732,15 +732,15 @@ Session::track_slave_state( if (_transport_speed != 0.0f) { #ifdef DEBUG_SLAVES - cerr << "slave stops transport: " << slave_speed << " frame: " << slave_transport_frame + cerr << "slave stops transport: " << slave_speed << " frame: " << slave_transport_frame << " tf = " << _transport_frame << endl; #endif - + stop_transport(); } if (slave_transport_frame != _transport_frame) { - #ifdef DEBUG_SLAVES + #ifdef DEBUG_SLAVES cerr << "slave stopped, move to " << slave_transport_frame << endl; #endif force_locate (slave_transport_frame, false); @@ -760,7 +760,7 @@ Session::follow_slave_silently (nframes_t nframes, float slave_speed) */ bool need_butler; - + prepare_diskstreams (); silent_process_routes (nframes); commit_diskstreams (nframes, need_butler); @@ -768,17 +768,17 @@ Session::follow_slave_silently (nframes_t nframes, float slave_speed) if (need_butler) { summon_butler (); } - + int32_t frames_moved = (int32_t) floor (_transport_speed * nframes); - + if (frames_moved < 0) { decrement_transport_position (-frames_moved); } else { increment_transport_position (frames_moved); } - + nframes_t stop_limit; - + if (actively_recording()) { stop_limit = max_frames; } else { @@ -809,13 +809,13 @@ Session::process_without_events (nframes_t nframes) if (!follow_slave (nframes)) { return; } - } + } if (_transport_speed == 0) { fail_roll (nframes); return; } - + if (!_exporting) { send_midi_time_code_for_cycle (nframes); } @@ -829,11 +829,11 @@ Session::process_without_events (nframes_t nframes) stop_limit = max_frames; } } - + if (maybe_stop (stop_limit)) { fail_roll (nframes); return; - } + } if (maybe_sync_start (nframes)) { return; @@ -842,10 +842,10 @@ Session::process_without_events (nframes_t nframes) click (_transport_frame, nframes); prepare_diskstreams (); - + if (_transport_speed == 1.0) { frames_moved = (long) nframes; - } else { + } else { interpolation.set_target_speed (fabs(_target_transport_speed)); interpolation.set_speed (fabs(_transport_speed)); frames_moved = (long) interpolation.interpolate (0, nframes, 0, 0); @@ -887,10 +887,10 @@ Session::process_audition (nframes_t nframes) } /* run the auditioner, and if it says we need butler service, ask for it */ - + if (auditioner->play_audition (nframes) > 0) { summon_butler (); - } + } /* handle pending events */ @@ -900,7 +900,7 @@ Session::process_audition (nframes_t nframes) /* if we are not in the middle of a state change, and there are immediate events queued up, - process them. + process them. */ while (!non_realtime_work_pending() && !immediate_events.empty()) { @@ -935,15 +935,15 @@ Session::maybe_sync_start (nframes_t& nframes) nframes -= sync_offset; Port::increment_port_offset (sync_offset); waiting_for_sync_offset = false; - + if (nframes == 0) { return true; // done, nothing left to process } - + } else { /* sync offset point is not within this process() - cycle, so just generate silence. and don't bother + cycle, so just generate silence. and don't bother with any fancy stuff here, just the minimal silence. */ diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 771e3b2bc6..b85f2ac078 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 1999-2002 Paul Davis + Copyright (C) 1999-2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - + */ @@ -145,7 +145,7 @@ Session::first_stage_init (string fullpath, string snapshot_name) _writable = false; } else { cerr << "Session writable based on " << _path << endl; - _writable = true; + _writable = true; } /* these two are just provisional settings. set_state() @@ -234,7 +234,7 @@ Session::first_stage_init (string fullpath, string snapshot_name) /* click sounds are unset by default, which causes us to internal waveforms for clicks. */ - + click_length = 0; click_emphasis_length = 0; _clicking = false; @@ -346,7 +346,7 @@ Session::second_stage_init (bool new_session) } /* handle this one in a different way than all others, so that its clear what happened */ - + catch (AudioEngine::PortRegistrationFailure& err) { error << err.what() << endmsg; return -1; @@ -362,7 +362,7 @@ Session::second_stage_init (bool new_session) _engine.transport_locate (0); deliver_mmc (MIDI::MachineControl::cmdMmcReset, 0); deliver_mmc (MIDI::MachineControl::cmdLocate, 0); - + MidiClockTicker::instance().set_session(*this); MIDI::Name::MidiPatchManager::instance().set_session(*this); @@ -375,7 +375,7 @@ Session::second_stage_init (bool new_session) config.set_end_marker_is_free (new_session); _state_of_the_state = Clean; - + DirtyChanged (); /* EMIT SIGNAL */ if (state_was_pending) { @@ -383,7 +383,7 @@ Session::second_stage_init (bool new_session) remove_pending_capture_state (); state_was_pending = false; } - + BootMessage (_("Session loading complete")); return 0; @@ -397,7 +397,7 @@ Session::raid_path () const for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) { raid_search_path += sys::path((*i).path); } - + return raid_search_path.to_string (); } @@ -407,7 +407,7 @@ Session::setup_raid_path (string path) if (path.empty()) { return; } - + space_and_path sp; string fspath; @@ -454,7 +454,7 @@ Session::ensure_subdirs () error << string_compose(_("Session: cannot create session sounds dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg; return -1; } - + dir = session_directory().midi_path().to_string(); if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) { @@ -523,21 +523,21 @@ Session::create (bool& new_session, const string& mix_template, nframes_t initia return 0; } else { - error << string_compose (_("Could not open %1 for writing mix template"), out_path) + error << string_compose (_("Could not open %1 for writing mix template"), out_path) << endmsg; return -1; } } else { - error << string_compose (_("Could not open mix template %1 for reading"), in_path) + error << string_compose (_("Could not open mix template %1 for reading"), in_path) << endmsg; return -1; } } - + /* Instantiate metadata */ - + _metadata = new SessionMetadata (); /* set initial start + end point */ @@ -561,7 +561,7 @@ Session::load_diskstreams (const XMLNode& node) { XMLNodeList clist; XMLNodeConstIterator citer; - + clist = node.children(); for (citer = clist.begin(); citer != clist.end(); ++citer) { @@ -577,8 +577,8 @@ Session::load_diskstreams (const XMLNode& node) } else { error << _("Session: unknown diskstream type in XML") << endmsg; } - } - + } + catch (failed_constructor& err) { error << _("Session: could not load diskstream via XML state") << endmsg; return -1; @@ -600,7 +600,7 @@ void Session::remove_pending_capture_state () { sys::path pending_state_file_path(_session_dir->root_path()); - + pending_state_file_path /= legalize_for_path (_current_snapshot_name) + pending_suffix; try @@ -697,7 +697,7 @@ Session::save_state (string snapshot_name, bool pending) if (!pending) { /* proper save: use statefile_suffix (.ardour in English) */ - + xml_path /= legalize_for_path (snapshot_name) + statefile_suffix; /* make a backup copy of the old file */ @@ -741,7 +741,7 @@ Session::save_state (string snapshot_name, bool pending) bool was_dirty = dirty(); _state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty); - + if (was_dirty) { DirtyChanged (); /* EMIT SIGNAL */ } @@ -758,7 +758,7 @@ Session::restore_state (string snapshot_name) if (load_state (snapshot_name) == 0) { set_state (*state_tree->root()); } - + return 0; } @@ -781,14 +781,14 @@ Session::load_state (string snapshot_name) if (AskAboutPendingState()) { state_was_pending = true; - } - } + } + } if (!state_was_pending) { xmlpath = _session_dir->root_path(); xmlpath /= legalize_for_path (snapshot_name) + statefile_suffix; } - + if (!sys::exists (xmlpath)) { error << string_compose(_("%1: session state information file \"%2\" doesn't exist!"), _name, xmlpath.to_string()) << endmsg; return 1; @@ -815,7 +815,7 @@ Session::load_state (string snapshot_name) } XMLNode& root (*state_tree->root()); - + if (root.name() != X_("Session")) { error << string_compose (_("Session file %1 is not an Ardour session"), xmlpath.to_string()) << endmsg; delete state_tree; @@ -849,7 +849,7 @@ Session::load_state (string snapshot_name) } info << string_compose (_("Copying old session file %1 to %2\nUse %2 with Ardour versions before 2.0 from now on"), - xmlpath.to_string(), backup_path.to_string()) + xmlpath.to_string(), backup_path.to_string()) << endmsg; try @@ -875,7 +875,7 @@ Session::load_options (const XMLNode& node) config.set_variables (node); - /* now reset MIDI ports because the session can have its own + /* now reset MIDI ports because the session can have its own MIDI configuration. */ @@ -895,9 +895,9 @@ Session::get_template() { /* if we don't disable rec-enable, diskstreams will believe they need to store their capture - sources in their state node. + sources in their state node. */ - + disable_record (false); return state(false); @@ -913,11 +913,11 @@ Session::state(bool full_state) char buf[16]; snprintf(buf, sizeof(buf), "%d.%d.%d", libardour3_major_version, libardour3_minor_version, libardour3_micro_version); node->add_property("version", string(buf)); - + /* store configuration settings */ if (full_state) { - + node->add_property ("name", _name); snprintf (buf, sizeof (buf), "%" PRId32, _nominal_frame_rate); node->add_property ("sample-rate", buf); @@ -946,14 +946,14 @@ Session::state(bool full_state) ++next; ++i; } - + child = node->add_child ("Path"); child->add_content (p); } } /* save the ID counter */ - + snprintf (buf, sizeof (buf), "%" PRIu64, ID::counter()); node->add_property ("id-counter", buf); @@ -969,10 +969,10 @@ Session::state(bool full_state) Glib::Mutex::Lock sl (source_lock); for (SourceMap::iterator siter = sources.begin(); siter != sources.end(); ++siter) { - + /* Don't save information about non-destructive file sources that are empty */ /* FIXME: MIDI breaks if this is made FileSource like it should be... */ - + boost::shared_ptr<AudioFileSource> fs; if ((fs = boost::dynamic_pointer_cast<AudioFileSource> (siter->second)) != 0) { if (!fs->destructive()) { @@ -981,18 +981,18 @@ Session::state(bool full_state) } } } - + child->add_child_nocopy (siter->second->get_state()); } } child = node->add_child ("Regions"); - if (full_state) { + if (full_state) { Glib::Mutex::Lock rl (region_lock); for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) { - + /* only store regions not attached to playlists */ if (i->second->playlist() == 0) { @@ -1003,7 +1003,7 @@ Session::state(bool full_state) child = node->add_child ("DiskStreams"); - { + { boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader(); for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if (!(*i)->hidden()) { @@ -1026,7 +1026,7 @@ Session::state(bool full_state) loc.add (end); node->add_child_nocopy (loc.get_state()); } - + child = node->add_child ("Bundles"); { boost::shared_ptr<BundleList> bundles = _bundles.reader (); @@ -1041,11 +1041,11 @@ Session::state(bool full_state) child = node->add_child ("Routes"); { boost::shared_ptr<RouteList> r = routes.reader (); - + RoutePublicOrderSorter cmp; RouteList public_order (*r); public_order.sort (cmp); - + for (RouteList::iterator i = public_order.begin(); i != public_order.end(); ++i) { if (!(*i)->is_hidden()) { if (full_state) { @@ -1057,7 +1057,7 @@ Session::state(bool full_state) } } - + child = node->add_child ("RouteGroups"); for (list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) { child->add_child_nocopy ((*i)->get_state()); @@ -1088,8 +1088,8 @@ Session::state(bool full_state) } } } - - + + if (_click_io) { child = node->add_child ("Click"); child->add_child_nocopy (_click_io->state (full_state)); @@ -1100,7 +1100,7 @@ Session::state(bool full_state) for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); ++i) { if (full_state) { child->add_child_nocopy ((*i)->get_state()); - } + } } } @@ -1131,7 +1131,7 @@ Session::set_state (const XMLNode& node) int ret = -1; _state_of_the_state = StateOfTheState (_state_of_the_state|CannotSave); - + if (node.name() != X_("Session")){ fatal << _("programming error: Session: incorrect XML node sent to set_state()") << endmsg; return -1; @@ -1168,7 +1168,7 @@ Session::set_state (const XMLNode& node) ID::init_counter (now); } - + IO::disable_connecting (); /* Object loading order: @@ -1270,7 +1270,7 @@ Session::set_state (const XMLNode& node) } else if (load_unused_playlists (*child)) { goto out; } - + if ((child = find_named_node (node, "NamedSelections")) != 0) { if (load_named_selections (*child)) { goto out; @@ -1293,7 +1293,7 @@ Session::set_state (const XMLNode& node) later */ _bundle_xml_node = new XMLNode (*child); } - + if ((child = find_named_node (node, "RouteGroups")) == 0) { error << _("Session: XML state has no route groups section") << endmsg; goto out; @@ -1373,14 +1373,14 @@ Session::XMLRouteFactory (const XMLNode& node) } bool has_diskstream = (node.property ("diskstream") != 0 || node.property ("diskstream-id") != 0); - + DataType type = DataType::AUDIO; const XMLProperty* prop = node.property("default-type"); if (prop) { type = DataType(prop->value()); - } - + } + assert(type != DataType::NIL); if (has_diskstream) { @@ -1430,17 +1430,17 @@ Session::XMLRegionFactory (const XMLNode& node, bool full) const XMLProperty* type = node.property("type"); try { - + if ( !type || type->value() == "audio" ) { return boost::shared_ptr<Region>(XMLAudioRegionFactory (node, full)); - + } else if (type->value() == "midi") { - + return boost::shared_ptr<Region>(XMLMidiRegionFactory (node, full)); } - + } catch (failed_constructor& err) { return boost::shared_ptr<Region> (); } @@ -1458,7 +1458,7 @@ Session::XMLAudioRegionFactory (const XMLNode& node, bool /*full*/) SourceList master_sources; uint32_t nchans = 1; char buf[128]; - + if (node.name() != X_("Region")) { return boost::shared_ptr<AudioRegion>(); } @@ -1471,7 +1471,7 @@ Session::XMLAudioRegionFactory (const XMLNode& node, bool /*full*/) cerr << "no name for this region\n"; abort (); } - + if ((prop = node.property (X_("source-0"))) == 0) { if ((prop = node.property ("source")) == 0) { error << _("Session: XMLNode describing a AudioRegion is incomplete (no source)") << endmsg; @@ -1485,7 +1485,7 @@ Session::XMLAudioRegionFactory (const XMLNode& node, bool /*full*/) error << string_compose(_("Session: XMLNode describing a AudioRegion references an unknown source id =%1"), s_id) << endmsg; return boost::shared_ptr<AudioRegion>(); } - + as = boost::dynamic_pointer_cast<AudioSource>(source); if (!as) { error << string_compose(_("Session: XMLNode describing a AudioRegion references a non-audio source id =%1"), s_id) << endmsg; @@ -1499,14 +1499,14 @@ Session::XMLAudioRegionFactory (const XMLNode& node, bool /*full*/) for (uint32_t n=1; n < nchans; ++n) { snprintf (buf, sizeof(buf), X_("source-%d"), n); if ((prop = node.property (buf)) != 0) { - + PBD::ID id2 (prop->value()); - + if ((source = source_by_id (id2)) == 0) { error << string_compose(_("Session: XMLNode describing a AudioRegion references an unknown source id =%1"), id2) << endmsg; return boost::shared_ptr<AudioRegion>(); } - + as = boost::dynamic_pointer_cast<AudioSource>(source); if (!as) { error << string_compose(_("Session: XMLNode describing a AudioRegion references a non-audio source id =%1"), id2) << endmsg; @@ -1519,14 +1519,14 @@ Session::XMLAudioRegionFactory (const XMLNode& node, bool /*full*/) for (uint32_t n = 0; n < nchans; ++n) { snprintf (buf, sizeof(buf), X_("master-source-%d"), n); if ((prop = node.property (buf)) != 0) { - + PBD::ID id2 (prop->value()); - + if ((source = source_by_id (id2)) == 0) { error << string_compose(_("Session: XMLNode describing a AudioRegion references an unknown source id =%1"), id2) << endmsg; return boost::shared_ptr<AudioRegion>(); } - + as = boost::dynamic_pointer_cast<AudioSource>(source); if (!as) { error << string_compose(_("Session: XMLNode describing a AudioRegion references a non-audio source id =%1"), id2) << endmsg; @@ -1559,7 +1559,7 @@ Session::XMLAudioRegionFactory (const XMLNode& node, bool /*full*/) } return region; - + } catch (failed_constructor& err) { @@ -1575,7 +1575,7 @@ Session::XMLMidiRegionFactory (const XMLNode& node, bool /*full*/) boost::shared_ptr<MidiSource> ms; SourceList sources; uint32_t nchans = 1; - + if (node.name() != X_("Region")) { return boost::shared_ptr<MidiRegion>(); } @@ -1583,7 +1583,7 @@ Session::XMLMidiRegionFactory (const XMLNode& node, bool /*full*/) if ((prop = node.property (X_("channels"))) != 0) { nchans = atoi (prop->value().c_str()); } - + if ((prop = node.property ("name")) == 0) { cerr << "no name for this region\n"; abort (); @@ -1662,7 +1662,7 @@ Session::path_from_region_name (DataType type, string name, string identifier) for (n = 0; n < 999999; ++n) { if (identifier.length()) { - snprintf (buf, sizeof(buf), "%s%s%" PRIu32 "%s", name.c_str(), + snprintf (buf, sizeof(buf), "%s%s%" PRIu32 "%s", name.c_str(), identifier.c_str(), n, ext.c_str()); } else { snprintf (buf, sizeof(buf), "%s-%" PRIu32 "%s", name.c_str(), @@ -1682,7 +1682,7 @@ Session::path_from_region_name (DataType type, string name, string identifier) return ""; } - + int Session::load_sources (const XMLNode& node) @@ -1770,7 +1770,7 @@ Session::save_template (string template_name) } int -Session::rename_template (string old_name, string new_name) +Session::rename_template (string old_name, string new_name) { sys::path old_path (user_template_directory()); old_path /= old_name + template_suffix; @@ -1793,7 +1793,7 @@ Session::rename_template (string old_name, string new_name) } int -Session::delete_template (string name) +Session::delete_template (string name) { sys::path path = user_template_directory(); path /= name + template_suffix; @@ -1818,7 +1818,7 @@ Session::refresh_disk_space () /* get freespace on every FS that is part of the session path */ _total_free_4k_blocks = 0; - + for (i = session_dirs.begin(); i != session_dirs.end(); ++i) { statfs ((*i).path.c_str(), &statfsbuf); @@ -1843,8 +1843,8 @@ Session::get_best_session_directory_for_new_source () } /* OK, here's the algorithm we're following here: - - We want to select which directory to use for + + We want to select which directory to use for the next file source to be created. Ideally, we'd like to use a round-robin process so as to get maximum performance benefits from splitting @@ -1863,15 +1863,15 @@ Session::get_best_session_directory_for_new_source () So, we use a user-configurable space threshold. If there are at least 2 filesystems with more than this - much space available, we use RR selection between them. + much space available, we use RR selection between them. If not, then we pick the filesystem with the most space. This gets a good balance between the two - approaches. + approaches. */ - + refresh_disk_space (); - + int free_enough = 0; for (i = session_dirs.begin(); i != session_dirs.end(); ++i) { @@ -1907,13 +1907,13 @@ Session::get_best_session_directory_for_new_source () /* pick FS with the most freespace (and that seems to actually work ...) */ - + vector<space_and_path> sorted; space_and_path_ascending_cmp cmp; sorted = session_dirs; sort (sorted.begin(), sorted.end(), cmp); - + for (i = sorted.begin(); i != sorted.end(); ++i) { if (create_session_directory ((*i).path)) { result = (*i).path; @@ -1938,7 +1938,7 @@ Session::load_playlists (const XMLNode& node) set_dirty(); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - + if ((playlist = XMLPlaylistFactory (**niter)) == 0) { error << _("Session: cannot create Playlist from XML description.") << endmsg; } @@ -1959,7 +1959,7 @@ Session::load_unused_playlists (const XMLNode& node) set_dirty(); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - + if ((playlist = XMLPlaylistFactory (**niter)) == 0) { error << _("Session: cannot create Playlist from XML description.") << endmsg; continue; @@ -1997,7 +1997,7 @@ Session::load_named_selections (const XMLNode& node) set_dirty(); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - + if ((ns = XMLNamedSelectionFactory (**niter)) == 0) { error << _("Session: cannot create Named Selection from XML description.") << endmsg; } @@ -2033,24 +2033,24 @@ Session::analysis_dir () const int Session::load_bundles (XMLNode const & node) { - XMLNodeList nlist = node.children(); - XMLNodeConstIterator niter; + XMLNodeList nlist = node.children(); + XMLNodeConstIterator niter; - set_dirty(); + set_dirty(); - for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - if ((*niter)->name() == "InputBundle") { + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { + if ((*niter)->name() == "InputBundle") { add_bundle (boost::shared_ptr<UserBundle> (new UserBundle (**niter, true))); - } else if ((*niter)->name() == "OutputBundle") { - add_bundle (boost::shared_ptr<UserBundle> (new UserBundle (**niter, false))); - } else { - error << string_compose(_("Unknown node \"%1\" found in Bundles list from state file"), (*niter)->name()) << endmsg; - return -1; - } - } + } else if ((*niter)->name() == "OutputBundle") { + add_bundle (boost::shared_ptr<UserBundle> (new UserBundle (**niter, false))); + } else { + error << string_compose(_("Unknown node \"%1\" found in Bundles list from state file"), (*niter)->name()) << endmsg; + return -1; + } + } return 0; -} +} int Session::load_route_groups (const XMLNode& node) @@ -2067,9 +2067,9 @@ Session::load_route_groups (const XMLNode& node) rg->set_state (**niter); } } - + return 0; -} +} void Session::auto_save() @@ -2094,12 +2094,12 @@ static string* remove_end(string* state) { string statename(*state); - + string::size_type start,end; if ((start = statename.find_last_of ('/')) != string::npos) { statename = statename.substr (start+1); } - + if ((end = statename.rfind(".ardour")) == string::npos) { end = statename.length(); } @@ -2108,16 +2108,16 @@ remove_end(string* state) } vector<string *> * -Session::possible_states (string path) +Session::possible_states (string path) { PathScanner scanner; vector<string*>* states = scanner (path, state_file_filter, 0, false, false); - + transform(states->begin(), states->end(), states->begin(), remove_end); - + string_cmp cmp; sort (states->begin(), states->end(), cmp); - + return states; } @@ -2198,7 +2198,7 @@ Session::commit_reversible_command(Command *cmd) _current_trans.pop(); } -Session::GlobalRouteBooleanState +Session::GlobalRouteBooleanState Session::get_global_route_boolean (bool (Route::*method)(void) const) { GlobalRouteBooleanState s; @@ -2207,11 +2207,11 @@ Session::get_global_route_boolean (bool (Route::*method)(void) const) for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (!(*i)->is_hidden()) { RouteBooleanState v; - + v.first =* i; Route* r = (*i).get(); v.second = (r->*method)(); - + s.push_back (v); } } @@ -2228,10 +2228,10 @@ Session::get_global_route_metering () for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (!(*i)->is_hidden()) { RouteMeterState v; - + v.first =* i; v.second = (*i)->meter_point(); - + s.push_back (v); } } @@ -2240,7 +2240,7 @@ Session::get_global_route_metering () } void -Session::set_global_route_metering (GlobalRouteMeterState s, void* arg) +Session::set_global_route_metering (GlobalRouteMeterState s, void* arg) { for (GlobalRouteMeterState::iterator i = s.begin(); i != s.end(); ++i) { @@ -2296,7 +2296,7 @@ accept_all_state_files (const string& path, void */*arg*/) return (path.length() > 7 && path.find (".ardour") == (path.length() - 7)); } -int +int Session::find_all_sources (string path, set<string>& result) { XMLTree tree; @@ -2318,7 +2318,7 @@ Session::find_all_sources (string path, set<string>& result) set_dirty(); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - + XMLProperty* prop; if ((prop = (*niter)->property (X_("type"))) == 0) { @@ -2335,7 +2335,7 @@ Session::find_all_sources (string path, set<string>& result) /* external file, ignore */ continue; } - + Glib::ustring found_path; bool is_new; uint16_t chan; @@ -2365,7 +2365,7 @@ Session::find_all_sources_across_snapshots (set<string>& result, bool exclude_th } state_files = scanner (ripped, accept_all_state_files, (void *) 0, false, true); - + if (state_files == 0) { /* impossible! */ return 0; @@ -2394,7 +2394,7 @@ struct RegionCounter { AudioSourceList::iterator iter; boost::shared_ptr<Region> region; uint32_t count; - + RegionCounter() : count (0) {} }; @@ -2402,7 +2402,7 @@ int Session::cleanup_sources (Session::cleanup_report& rep) { // FIXME: needs adaptation to midi - + vector<boost::shared_ptr<Source> > dead_sources; vector<boost::shared_ptr<Playlist> > playlists_tbd; PathScanner scanner; @@ -2415,10 +2415,10 @@ Session::cleanup_sources (Session::cleanup_report& rep) bool used; string spath; int ret = -1; - + _state_of_the_state = (StateOfTheState) (_state_of_the_state | InCleanup); - + /* step 1: consider deleting all unused playlists */ for (PlaylistList::iterator x = unused_playlists.begin(); x != unused_playlists.end(); ++x) { @@ -2456,7 +2456,7 @@ Session::cleanup_sources (Session::cleanup_report& rep) rep.space = 0; for (SourceMap::iterator i = sources.begin(); i != sources.end(); ) { - + SourceMap::iterator tmp; tmp = i; @@ -2466,10 +2466,10 @@ Session::cleanup_sources (Session::cleanup_report& rep) capture files. */ - if (!i->second->used() && i->second->length(i->second->timeline_position()) > 0) { + if (!i->second->used() && i->second->length(i->second->timeline_position()) > 0) { dead_sources.push_back (i->second); i->second->GoingAway(); - } + } i = tmp; } @@ -2491,7 +2491,7 @@ Session::cleanup_sources (Session::cleanup_report& rep) i = nexti; } - /* now do the same thing for the files that ended up in the sounds dir(s) + /* now do the same thing for the files that ended up in the sounds dir(s) but are not referenced as sources in any snapshot. */ @@ -2505,23 +2505,23 @@ Session::cleanup_sources (Session::cleanup_report& rep) state file on disk still references sources we may have already dropped. */ - + find_all_sources_across_snapshots (all_sources, true); /* add our current source list */ - + for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) { boost::shared_ptr<FileSource> fs; - + if ((fs = boost::dynamic_pointer_cast<FileSource> (i->second)) != 0) { all_sources.insert (fs->path()); - } + } } char tmppath1[PATH_MAX+1]; char tmppath2[PATH_MAX+1]; - + for (vector<string*>::iterator x = soundfiles->begin(); x != soundfiles->end(); ++x) { used = false; @@ -2554,7 +2554,7 @@ Session::cleanup_sources (Session::cleanup_report& rep) } string newpath; - + /* don't move the file across filesystems, just stick it in the `dead_sound_dir_name' directory on whichever filesystem it was already on. @@ -2564,14 +2564,14 @@ Session::cleanup_sources (Session::cleanup_report& rep) /* old school, go up 1 level */ - newpath = Glib::path_get_dirname (*x); // "sounds" + newpath = Glib::path_get_dirname (*x); // "sounds" newpath = Glib::path_get_dirname (newpath); // "session-name" } else { /* new school, go up 4 levels */ - - newpath = Glib::path_get_dirname (*x); // "audiofiles" + + newpath = Glib::path_get_dirname (*x); // "audiofiles" newpath = Glib::path_get_dirname (newpath); // "session-name" newpath = Glib::path_get_dirname (newpath); // "interchange" newpath = Glib::path_get_dirname (newpath); // "session-dir" @@ -2587,15 +2587,15 @@ Session::cleanup_sources (Session::cleanup_report& rep) newpath += '/'; newpath += Glib::path_get_basename ((*x)); - + if (access (newpath.c_str(), F_OK) == 0) { - + /* the new path already exists, try versioning */ - + char buf[PATH_MAX+1]; int version = 1; string newpath_v; - + snprintf (buf, sizeof (buf), "%s.%d", newpath.c_str(), version); newpath_v = buf; @@ -2603,7 +2603,7 @@ Session::cleanup_sources (Session::cleanup_report& rep) snprintf (buf, sizeof (buf), "%s.%d", newpath.c_str(), ++version); newpath_v = buf; } - + if (version == 999) { error << string_compose (_("there are already 1000 files with names like %1; versioning discontinued"), newpath) @@ -2611,11 +2611,11 @@ Session::cleanup_sources (Session::cleanup_report& rep) } else { newpath = newpath_v; } - + } else { - + /* it doesn't exist, or we can't read it or something */ - + } if (::rename ((*x).c_str(), newpath.c_str()) != 0) { @@ -2652,7 +2652,7 @@ Session::cleanup_sources (Session::cleanup_report& rep) /* save state so we don't end up a session file referring to non-existent sources. */ - + save_state (""); out: @@ -2665,7 +2665,7 @@ int Session::cleanup_trash_sources (Session::cleanup_report& rep) { // FIXME: needs adaptation for MIDI - + vector<space_and_path>::iterator i; string dead_sound_dir; struct dirent* dentry; @@ -2676,7 +2676,7 @@ Session::cleanup_trash_sources (Session::cleanup_report& rep) rep.space = 0; for (i = session_dirs.begin(); i != session_dirs.end(); ++i) { - + dead_sound_dir = (*i).path; dead_sound_dir += dead_sound_dir_name; @@ -2687,8 +2687,8 @@ Session::cleanup_trash_sources (Session::cleanup_report& rep) while ((dentry = readdir (dead)) != 0) { /* avoid '.' and '..' */ - - if ((dentry->d_name[0] == '.' && dentry->d_name[1] == '\0') || + + if ((dentry->d_name[0] == '.' && dentry->d_name[1] == '\0') || (dentry->d_name[2] == '\0' && dentry->d_name[0] == '.' && dentry->d_name[1] == '.')) { continue; } @@ -2718,7 +2718,7 @@ Session::cleanup_trash_sources (Session::cleanup_report& rep) } closedir (dead); - + } return 0; @@ -2742,7 +2742,7 @@ void Session::set_clean () { bool was_dirty = dirty(); - + _state_of_the_state = Clean; @@ -2775,7 +2775,7 @@ Session::add_controllable (boost::shared_ptr<Controllable> c) Glib::Mutex::Lock lm (controllables_lock); controllables.insert (c); } - + struct null_deleter { void operator()(void const *) const {} }; void @@ -2793,13 +2793,13 @@ Session::remove_controllable (Controllable* c) if (x != controllables.end()) { controllables.erase (x); } -} +} boost::shared_ptr<Controllable> Session::controllable_by_id (const PBD::ID& id) { Glib::Mutex::Lock lm (controllables_lock); - + for (Controllables::iterator i = controllables.begin(); i != controllables.end(); ++i) { if ((*i)->id() == id) { return *i; @@ -2809,7 +2809,7 @@ Session::controllable_by_id (const PBD::ID& id) return boost::shared_ptr<Controllable>(); } -void +void Session::add_instant_xml (XMLNode& node, bool write_to_config) { if (_writable) { @@ -2827,22 +2827,22 @@ Session::instant_xml (const string& node_name) return Stateful::instant_xml (node_name, _path); } -int +int Session::save_history (string snapshot_name) { XMLTree tree; - + if (!_writable) { return 0; - } + } - if (snapshot_name.empty()) { + if (snapshot_name.empty()) { snapshot_name = _current_snapshot_name; } - - const string history_filename = legalize_for_path (snapshot_name) + history_suffix; + + const string history_filename = legalize_for_path (snapshot_name) + history_suffix; const string backup_filename = history_filename + backup_suffix; - const sys::path xml_path = _session_dir->root_path() / history_filename; + const sys::path xml_path = _session_dir->root_path() / history_filename; const sys::path backup_path = _session_dir->root_path() / backup_filename; if (sys::exists (xml_path)) { @@ -2855,13 +2855,13 @@ Session::save_history (string snapshot_name) error << _("could not backup old history file, current history not saved") << endmsg; return -1; } - } + } if (!Config->get_save_history() || Config->get_saved_history_depth() < 0) { return 0; } - tree.set_root (&_history.get_state (Config->get_saved_history_depth())); + tree.set_root (&_history.get_state (Config->get_saved_history_depth())); if (!tree.write (xml_path.to_string())) { @@ -2892,10 +2892,10 @@ Session::restore_history (string snapshot_name) if (snapshot_name.empty()) { snapshot_name = _current_snapshot_name; } - + const string xml_filename = legalize_for_path (snapshot_name) + history_suffix; const sys::path xml_path = _session_dir->root_path() / xml_filename; - + cerr << "Loading history from " << xml_path.to_string() << endmsg; if (!sys::exists (xml_path)) { @@ -2913,67 +2913,67 @@ Session::restore_history (string snapshot_name) // replace history _history.clear(); - for (XMLNodeConstIterator it = tree.root()->children().begin(); it != tree.root()->children().end(); it++) { - - XMLNode *t = *it; - UndoTransaction* ut = new UndoTransaction (); - struct timeval tv; - - ut->set_name(t->property("name")->value()); - stringstream ss(t->property("tv-sec")->value()); - ss >> tv.tv_sec; - ss.str(t->property("tv-usec")->value()); - ss >> tv.tv_usec; - ut->set_timestamp(tv); - - for (XMLNodeConstIterator child_it = t->children().begin(); + for (XMLNodeConstIterator it = tree.root()->children().begin(); it != tree.root()->children().end(); it++) { + + XMLNode *t = *it; + UndoTransaction* ut = new UndoTransaction (); + struct timeval tv; + + ut->set_name(t->property("name")->value()); + stringstream ss(t->property("tv-sec")->value()); + ss >> tv.tv_sec; + ss.str(t->property("tv-usec")->value()); + ss >> tv.tv_usec; + ut->set_timestamp(tv); + + for (XMLNodeConstIterator child_it = t->children().begin(); child_it != t->children().end(); child_it++) - { - XMLNode *n = *child_it; - Command *c; - - if (n->name() == "MementoCommand" || + { + XMLNode *n = *child_it; + Command *c; + + if (n->name() == "MementoCommand" || n->name() == "MementoUndoCommand" || n->name() == "MementoRedoCommand") { - if ((c = memento_command_factory(n))) { - ut->add_command(c); - } - - } else if (n->name() == X_("GlobalRouteStateCommand")) { - - if ((c = global_state_command_factory (*n))) { - ut->add_command (c); - } - - } else if (n->name() == "DeltaCommand") { - PBD::ID id(n->property("midi-source")->value()); - boost::shared_ptr<MidiSource> midi_source = - boost::dynamic_pointer_cast<MidiSource, Source>(source_by_id(id)); - if(midi_source) { - ut->add_command(new MidiModel::DeltaCommand(midi_source->model(), *n)); - } else { - error << "FIXME: Failed to downcast MidiSource for DeltaCommand" << endmsg; - } - } else if (n->name() == "DiffCommand") { - PBD::ID id(n->property("midi-source")->value()); - boost::shared_ptr<MidiSource> midi_source = - boost::dynamic_pointer_cast<MidiSource, Source>(source_by_id(id)); - if(midi_source) { - ut->add_command(new MidiModel::DiffCommand(midi_source->model(), *n)); - } else { - error << "FIXME: Failed to downcast MidiSource for DeltaCommand" << endmsg; - } - - } else { - error << string_compose(_("Couldn't figure out how to make a Command out of a %1 XMLNode."), n->name()) << endmsg; - } - } - - _history.add (ut); - } - - return 0; + if ((c = memento_command_factory(n))) { + ut->add_command(c); + } + + } else if (n->name() == X_("GlobalRouteStateCommand")) { + + if ((c = global_state_command_factory (*n))) { + ut->add_command (c); + } + + } else if (n->name() == "DeltaCommand") { + PBD::ID id(n->property("midi-source")->value()); + boost::shared_ptr<MidiSource> midi_source = + boost::dynamic_pointer_cast<MidiSource, Source>(source_by_id(id)); + if(midi_source) { + ut->add_command(new MidiModel::DeltaCommand(midi_source->model(), *n)); + } else { + error << "FIXME: Failed to downcast MidiSource for DeltaCommand" << endmsg; + } + } else if (n->name() == "DiffCommand") { + PBD::ID id(n->property("midi-source")->value()); + boost::shared_ptr<MidiSource> midi_source = + boost::dynamic_pointer_cast<MidiSource, Source>(source_by_id(id)); + if(midi_source) { + ut->add_command(new MidiModel::DiffCommand(midi_source->model(), *n)); + } else { + error << "FIXME: Failed to downcast MidiSource for DeltaCommand" << endmsg; + } + + } else { + error << string_compose(_("Couldn't figure out how to make a Command out of a %1 XMLNode."), n->name()) << endmsg; + } + } + + _history.add (ut); + } + + return 0; } void @@ -2982,20 +2982,20 @@ Session::config_changed (std::string p, bool ours) if (ours) { set_dirty (); } - + if (p == "seamless-loop") { - + } else if (p == "rf-speed") { - + } else if (p == "auto-loop") { - + } else if (p == "auto-input") { - + if (Config->get_monitoring_model() == HardwareMonitoring && transport_rolling()) { /* auto-input only makes a difference if we're rolling */ - + boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader(); - + for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if ((*i)->record_enabled ()) { (*i)->monitor_input (!config.get_auto_input()); @@ -3006,22 +3006,22 @@ Session::config_changed (std::string p, bool ours) } else if (p == "punch-in") { Location* location; - + if ((location = _locations.auto_punch_location()) != 0) { - + if (config.get_punch_in ()) { replace_event (Event::PunchIn, location->start()); } else { remove_event (location->start(), Event::PunchIn); } } - + } else if (p == "punch-out") { Location* location; - + if ((location = _locations.auto_punch_location()) != 0) { - + if (config.get_punch_out()) { replace_event (Event::PunchOut, location->end()); } else { @@ -3032,7 +3032,7 @@ Session::config_changed (std::string p, bool ours) } else if (p == "edit-mode") { Glib::Mutex::Lock lm (playlist_lock); - + for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) { (*i)->set_edit_mode (Config->get_edit_mode ()); } @@ -3058,7 +3058,7 @@ Session::config_changed (std::string p, bool ours) } } else if (p == "midi-control") { - + //poke_midi_thread (); } else if (p == "raid-path") { @@ -3104,11 +3104,11 @@ Session::config_changed (std::string p, bool ours) } } else if (p == "send-mtc") { - + /* only set the internal flag if we have a port. */ - + if (_mtc_port != 0) { session_send_mtc = Config->get_send_mtc(); if (session_send_mtc) { @@ -3120,24 +3120,24 @@ Session::config_changed (std::string p, bool ours) } } else if (p == "send-mmc") { - + /* only set the internal flag if we have a port. */ - + if (_mmc_port != 0) { session_send_mmc = Config->get_send_mmc(); } else { mmc = 0; - session_send_mmc = false; + session_send_mmc = false; } } else if (p == "midi-feedback") { - + /* only set the internal flag if we have a port. */ - + if (_mtc_port != 0) { session_midi_feedback = Config->get_midi_feedback(); } @@ -3176,7 +3176,7 @@ Session::config_changed (std::string p, bool ours) if (_mmc_port && Config->get_initial_program_change() >= 0) { MIDI::byte buf[2]; - + buf[0] = MIDI::program; // channel zero by default buf[1] = (Config->get_initial_program_change() & 0x7f); @@ -3186,7 +3186,7 @@ Session::config_changed (std::string p, bool ours) if (_mmc_port && Config->get_initial_program_change() >= 0) { MIDI::byte* buf = new MIDI::byte[2]; - + buf[0] = MIDI::program; // channel zero by default buf[1] = (Config->get_initial_program_change() & 0x7f); // deliver_midi (_mmc_port, buf, 2); diff --git a/libs/ardour/session_state_utils.cc b/libs/ardour/session_state_utils.cc index 7f12cb4066..a855072413 100644 --- a/libs/ardour/session_state_utils.cc +++ b/libs/ardour/session_state_utils.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Tim Mayberry + Copyright (C) 2007 Tim Mayberry This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -58,7 +58,7 @@ get_state_files_in_directory (const sys::path & directory_path, vector<sys::path> & result) { Glib::PatternSpec state_file_pattern('*' + string(statefile_suffix)); - + find_matching_files_in_directory (directory_path, state_file_pattern, result); } diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc index 0363c48339..ae8d07e9ee 100644 --- a/libs/ardour/session_time.cc +++ b/libs/ardour/session_time.cc @@ -1,6 +1,6 @@ /* - Copyright (C) 1999-2002 Paul Davis + Copyright (C) 1999-2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,43 +57,43 @@ float Session::smpte_frames_per_second() const { switch (config.get_smpte_format()) { - case smpte_23976: + case smpte_23976: return 23.976; break; - case smpte_24: + case smpte_24: return 24; break; - case smpte_24976: + case smpte_24976: return 24.976; break; - case smpte_25: + case smpte_25: return 25; break; - case smpte_2997: + case smpte_2997: return 29.97; break; - case smpte_2997drop: + case smpte_2997drop: return 29.97; break; - case smpte_30: + case smpte_30: return 30; break; - case smpte_30drop: + case smpte_30drop: return 30; break; - case smpte_5994: + case smpte_5994: return 59.94; break; - case smpte_60: + case smpte_60: return 60; break; @@ -106,43 +106,43 @@ bool Session::smpte_drop_frames() const { switch (config.get_smpte_format()) { - case smpte_23976: + case smpte_23976: return false; break; - case smpte_24: + case smpte_24: return false; break; - case smpte_24976: + case smpte_24976: return false; break; - case smpte_25: + case smpte_25: return false; break; - case smpte_2997: + case smpte_2997: return false; break; - case smpte_2997drop: + case smpte_2997drop: return true; break; - case smpte_30: + case smpte_30: return false; break; - case smpte_30drop: + case smpte_30drop: return true; break; - case smpte_5994: + case smpte_5994: return false; break; - case smpte_60: + case smpte_60: return false; break; @@ -219,9 +219,9 @@ Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset // approx. 0.2 frames too early. This adds up with 0.2 too early for each minute until we are 1.8 // frames too early at 0:9:0:2 (9 * 0.2 = 1.8). The 10th minute brings us 1.8 frames later again // (at end of 0:9:59:29), which sums up to 0 (we are back to zero at 0:10:0:0 :-). - // + // // In table form: - // + // // SMPTE value frames offset subframes offset seconds (rounded) 44100 sample (rounded) // 0:00:00:00 0.0 0 0.000 0 (accurate) // 0:00:59:29 1.8 144 60.027 2647177 @@ -257,20 +257,20 @@ Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset nframes_t exceeding_samples = (nframes_t) rint(exceeding_df_frames * _frames_per_smpte_frame); sample = base_samples + exceeding_samples; } else { - /* - Non drop is easy.. just note the use of + /* + Non drop is easy.. just note the use of rint(smpte.rate) * _frames_per_smpte_frame - (frames per SMPTE second), which is larger than + (frames per SMPTE second), which is larger than frame_rate() in the non-integer SMPTE rate case. */ sample = (nframes_t)rint((((smpte.hours * 60 * 60) + (smpte.minutes * 60) + smpte.seconds) * (rint(smpte.rate) * _frames_per_smpte_frame)) + (smpte.frames * _frames_per_smpte_frame)); } - + if (use_subframes) { sample += (long) (((double)smpte.subframes * _frames_per_smpte_frame) / config.get_subframes_per_frame()); } - + if (use_offset) { if (smpte_offset_negative()) { if (sample >= smpte_offset()) { @@ -317,11 +317,11 @@ Session::sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset, } } } - + double smpte_frames_left_exact; double smpte_frames_fraction; unsigned long smpte_frames_left; - + // Extract whole hours. Do this to prevent rounding errors with // high sample numbers in the calculations that follow. smpte.hours = offset_sample / _frames_per_hour; @@ -331,7 +331,7 @@ Session::sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset, smpte_frames_left_exact = (double) offset_sample / _frames_per_smpte_frame; smpte_frames_fraction = smpte_frames_left_exact - floor( smpte_frames_left_exact ); smpte.subframes = (long) rint(smpte_frames_fraction * config.get_subframes_per_frame()); - + // XXX Not sure if this is necessary anymore... if (smpte.subframes == config.get_subframes_per_frame()) { // This can happen with 24 fps (and 29.97 fps ?) @@ -357,7 +357,7 @@ Session::sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset, exceeding_df_frames -= extra_minutes_minus_1 * 1798; // take away the (extra) minutes just found smpte.minutes += extra_minutes_minus_1 + 1; // update with exceeding minutes } - + // Adjust frame numbering for dropped frames (frame 0 and 1 skipped at start of every minute except every 10th) if (smpte.minutes % 10) { // Every minute except every 10th @@ -414,7 +414,7 @@ Session::smpte_time_subframes (nframes_t when, SMPTE::Time& smpte) smpte = last_smpte; return; } - + sample_to_smpte( when, smpte, true /* use_offset */, true /* use_subframes */ ); last_smpte_when = when; @@ -453,13 +453,13 @@ Session::jack_sync_callback (jack_transport_state_t state, switch (state) { case JackTransportStopped: if (slave && _transport_frame != pos->frame && post_transport_work == 0) { - request_locate (pos->frame, false); + request_locate (pos->frame, false); // cerr << "SYNC: stopped, locate to " << pos->frame << " from " << _transport_frame << endl; return false; } else { return true; } - + case JackTransportStarting: // cerr << "SYNC: starting @ " << pos->frame << " a@ " << _transport_frame << " our work = " << post_transport_work << " pos matches ? " << (_transport_frame == pos->frame) << endl; if (slave) { @@ -479,7 +479,7 @@ Session::jack_sync_callback (jack_transport_state_t state, default: error << string_compose (_("Unknown JACK transport state %1 in sync callback"), state) << endmsg; - } + } return true; } @@ -498,12 +498,12 @@ Session::jack_timebase_callback (jack_transport_state_t /*state*/, pos->valid = JackPositionTimecode; /* BBT info */ - + if (_tempo_map) { TempoMap::Metric metric (_tempo_map->metric_at (_transport_frame)); _tempo_map->bbt_time_with_metric (_transport_frame, bbt, metric); - + pos->bar = bbt.bars; pos->beat = bbt.beats; pos->tick = bbt.ticks; @@ -559,16 +559,16 @@ Session::jack_timebase_callback (jack_transport_state_t /*state*/, } - } + } -#endif +#endif } ARDOUR::nframes_t Session::convert_to_frames_at (nframes_t /*position*/, AnyTime const & any) { double secs; - + switch (any.type) { case AnyTime::BBT: return _tempo_map->frame_time ( any.bbt); @@ -580,7 +580,7 @@ Session::convert_to_frames_at (nframes_t /*position*/, AnyTime const & any) secs += any.smpte.minutes * 60; secs += any.smpte.seconds; secs += any.smpte.frames / smpte_frames_per_second(); - if (_smpte_offset_negative) + if (_smpte_offset_negative) { return (nframes_t) floor (secs * frame_rate()) - _smpte_offset; } diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index a20856b818..ff36e30743 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -213,7 +213,7 @@ Session::butler_transport_work () } if (post_transport_work & PostTransportReverse) { - + clear_clicks(); cumulative_rf_motion = 0; reset_rf_scale (0); @@ -390,7 +390,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) bool const auto_return_enabled = (Config->get_slave_source() == None && config.get_auto_return()); - + if (auto_return_enabled || (post_transport_work & PostTransportLocate) || (_requested_return_frame >= 0) || @@ -442,7 +442,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) } #endif - have_looped = false; + have_looped = false; send_full_time_code (0); deliver_mmc (MIDI::MachineControl::cmdStop, 0); @@ -650,7 +650,7 @@ int Session::micro_locate (nframes_t distance) { boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader(); - + for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if (!(*i)->can_internal_playback_seek (distance)) { return -1; @@ -660,7 +660,7 @@ Session::micro_locate (nframes_t distance) for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { (*i)->internal_playback_seek (distance); } - + _transport_frame += distance; return 0; } @@ -805,7 +805,7 @@ Session::set_transport_speed (double speed, bool abort) /* 8.0 max speed is somewhat arbitrary but based on guestimates regarding disk i/o capability and user needs. We really need CD-style "skip" playback for ffwd and rewind. */ - + if (speed > 0) { speed = min (8.0, speed); } else if (speed < 0) { @@ -981,7 +981,7 @@ Session::start_transport () } transport_sub_state |= PendingDeclickIn; - + _transport_speed = 1.0; _target_transport_speed = 1.0; @@ -1060,9 +1060,9 @@ Session::set_slave_source (SlaveSource src) return; } -// if (src == JACK && Config->get_jack_time_master()) { -// return; -// } +// if (src == JACK && Config->get_jack_time_master()) { +// return; +// } delete _slave; _slave = 0; @@ -1251,7 +1251,7 @@ Session::setup_auto_play () void Session::request_roll_at_and_return (nframes_t start, nframes_t return_to) { - Event *ev = new Event (Event::LocateRollLocate, Event::Add, Event::Immediate, return_to, 1.0); + Event *ev = new Event (Event::LocateRollLocate, Event::Add, Event::Immediate, return_to, 1.0); ev->target2_frame = start; queue_event (ev); } @@ -1260,7 +1260,7 @@ void Session::request_bounded_roll (nframes_t start, nframes_t end) { request_stop (); - Event *ev = new Event (Event::StopOnce, Event::Replace, end, Event::Immediate, 0.0); + Event *ev = new Event (Event::StopOnce, Event::Replace, end, Event::Immediate, 0.0); queue_event (ev); request_locate (start, true); } @@ -1338,7 +1338,7 @@ Session::update_latency_compensation (bool with_stop, bool abort) update_jack = true; } - if (!(*i)->is_hidden() && ((*i)->active())) { + if (!(*i)->is_hidden() && ((*i)->active())) { _worst_track_latency = max (_worst_track_latency, track_latency); } } diff --git a/libs/ardour/session_utils.cc b/libs/ardour/session_utils.cc index d6e7ac20cc..9c367a702f 100644 --- a/libs/ardour/session_utils.cc +++ b/libs/ardour/session_utils.cc @@ -8,7 +8,7 @@ namespace ARDOUR { -using namespace std; +using namespace std; using namespace PBD; bool diff --git a/libs/ardour/session_vst.cc b/libs/ardour/session_vst.cc index 3a158a3e73..7f13d3e18b 100644 --- a/libs/ardour/session_vst.cc +++ b/libs/ardour/session_vst.cc @@ -54,7 +54,7 @@ long Session::vst_callback (AEffect* effect, if (debug_callbacks < 0) { debug_callbacks = (getenv ("ARDOUR_DEBUG_VST_CALLBACKS") != 0); } - + if (effect && effect->user) { plug = (VSTPlugin*) (effect->user); session = &plug->session(); @@ -80,22 +80,22 @@ long Session::vst_callback (AEffect* effect, // vst version, currently 2 (0 for older) return 2; - case audioMasterCurrentId: + case audioMasterCurrentId: SHOW_CALLBACK ("amc: audioMasterCurrentId\n"); // returns the unique id of a plug that's currently // loading return 0; - + case audioMasterIdle: SHOW_CALLBACK ("amc: audioMasterIdle\n"); // call application idle routine (this will - // call effEditIdle for all open editors too) + // call effEditIdle for all open editors too) if (effect) { effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f); } return 0; - case audioMasterPinConnected: + case audioMasterPinConnected: SHOW_CALLBACK ("amc: audioMasterPinConnected\n"); // inquire if an input or output is beeing connected; // index enumerates input or output counting from zero: @@ -120,7 +120,7 @@ long Session::vst_callback (AEffect* effect, _timeInfo.samplePos = session->transport_frame(); _timeInfo.sampleRate = session->frame_rate(); _timeInfo.flags = 0; - + if (value & (kVstTempoValid)) { const Tempo& t (session->tempo_map().tempo_at (session->transport_frame())); _timeInfo.tempo = t.beats_per_minute (); @@ -132,10 +132,10 @@ long Session::vst_callback (AEffect* effect, _timeInfo.timeSigDenominator = m.note_divisor (); _timeInfo.flags |= (kVstBarsValid); } - + if (session->transport_speed() != 0.0f) { _timeInfo.flags |= kVstTransportPlaying; - } + } } return (long)&_timeInfo; @@ -164,7 +164,7 @@ long Session::vst_callback (AEffect* effect, SHOW_CALLBACK ("amc: audioMasterGetNumAutomatableParameters\n"); return 0; - case audioMasterGetParameterQuantization: + case audioMasterGetParameterQuantization: SHOW_CALLBACK ("amc: audioMasterGetParameterQuantization\n"); // returns the integer value for +1.0 representation, // or 1 if full single float precision is maintained @@ -234,7 +234,7 @@ long Session::vst_callback (AEffect* effect, // 4: currently offline processing and thus in user thread // other: not defined, but probably pre-empting user thread. return 0; - + case audioMasterGetAutomationState: SHOW_CALLBACK ("amc: audioMasterGetAutomationState\n"); // returns 0: not supported, 1: off, 2:read, 3:write, 4:read/write @@ -285,42 +285,42 @@ long Session::vst_callback (AEffect* effect, SHOW_CALLBACK ("amc: audioMasterGetVendorVersion\n"); // returns vendor-specific version return 900; - + case audioMasterVendorSpecific: SHOW_CALLBACK ("amc: audioMasterVendorSpecific\n"); // no definition, vendor specific handling return 0; - + case audioMasterSetIcon: SHOW_CALLBACK ("amc: audioMasterSetIcon\n"); // void* in <ptr>, format not defined yet return 0; - + case audioMasterCanDo: SHOW_CALLBACK ("amc: audioMasterCanDo\n"); // string in ptr, see below return 0; - + case audioMasterGetLanguage: SHOW_CALLBACK ("amc: audioMasterGetLanguage\n"); // see enum return 0; - + case audioMasterOpenWindow: SHOW_CALLBACK ("amc: audioMasterOpenWindow\n"); // returns platform specific ptr return 0; - + case audioMasterCloseWindow: SHOW_CALLBACK ("amc: audioMasterCloseWindow\n"); // close window, platform specific handle in <ptr> return 0; - + case audioMasterGetDirectory: SHOW_CALLBACK ("amc: audioMasterGetDirectory\n"); // get plug directory, FSSpec on MAC, else char* return 0; - + case audioMasterUpdateDisplay: SHOW_CALLBACK ("amc: audioMasterUpdateDisplay\n"); // something has changed, update 'multi-fx' display @@ -328,27 +328,27 @@ long Session::vst_callback (AEffect* effect, effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f); } return 0; - + case audioMasterBeginEdit: SHOW_CALLBACK ("amc: audioMasterBeginEdit\n"); // begin of automation session (when mouse down), parameter index in <index> return 0; - + case audioMasterEndEdit: SHOW_CALLBACK ("amc: audioMasterEndEdit\n"); // end of automation session (when mouse up), parameter index in <index> return 0; - + case audioMasterOpenFileSelector: SHOW_CALLBACK ("amc: audioMasterOpenFileSelector\n"); // open a fileselector window with VstFileSelect* in <ptr> return 0; - + default: SHOW_CALLBACK ("VST master dispatcher: undefed: %d\n", opcode); break; - } - + } + return 0; } diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index ec47554243..679f244dbe 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis Written by Dave Robillard, 2006 This program is free software; you can redistribute it and/or modify @@ -60,7 +60,7 @@ SMFSource::SMFSource (Session& s, const ustring& path, bool embedded, Source::Fl if (init(_name, false)) { throw failed_constructor (); } - + if (create(path)) { throw failed_constructor (); } @@ -78,11 +78,11 @@ SMFSource::SMFSource (Session& s, const XMLNode& node, bool must_exist) if (set_state(node)) { throw failed_constructor (); } - + if (init(_name, true)) { throw failed_constructor (); } - + if (open(_path)) { throw failed_constructor (); } @@ -113,7 +113,7 @@ SMFSource::read_unlocked (MidiRingBuffer<nframes_t>& destination, sframes_t sour uint8_t* ev_buffer = 0; size_t scratch_size = 0; // keep track of scratch to minimize reallocs - + BeatsFramesConverter converter(_session, source_start); const uint64_t start_ticks = (uint64_t)(converter.from(start) * ppqn()); @@ -130,7 +130,7 @@ SMFSource::read_unlocked (MidiRingBuffer<nframes_t>& destination, sframes_t sour time += ev_delta_t; // accumulate delta time } } - + _smf_last_read_end = start + duration; while (true) { @@ -138,13 +138,13 @@ SMFSource::read_unlocked (MidiRingBuffer<nframes_t>& destination, sframes_t sour if (ret == -1) { // EOF break; } - + time += ev_delta_t; // accumulate delta time if (ret == 0) { // meta-event (skipped, just accumulate time) continue; } - + ev_type = EventTypeMap::instance().midi_event_type(ev_buffer[0]); #if 0 @@ -159,7 +159,7 @@ SMFSource::read_unlocked (MidiRingBuffer<nframes_t>& destination, sframes_t sour const sframes_t ev_frame_time = converter.to(time / (double)ppqn()) + stamp_offset; #if 0 - cerr << " frames = " << ev_frame_time + cerr << " frames = " << ev_frame_time << " w/offset = " << ev_frame_time - negative_stamp_offset << endl; #endif @@ -178,7 +178,7 @@ SMFSource::read_unlocked (MidiRingBuffer<nframes_t>& destination, sframes_t sour } ev_size = scratch_size; // ensure read_event only allocates if necessary } - + return duration; } @@ -187,14 +187,14 @@ nframes_t SMFSource::write_unlocked (MidiRingBuffer<nframes_t>& source, sframes_t position, nframes_t duration) { _write_data_count = 0; - + nframes_t time; Evoral::EventType type; uint32_t size; size_t buf_capacity = 4; uint8_t* buf = (uint8_t*)malloc(buf_capacity); - + if (_model && ! _model->writing()) { _model->start_write(); } @@ -223,10 +223,10 @@ SMFSource::write_unlocked (MidiRingBuffer<nframes_t>& source, sframes_t position cerr << "ERROR: Read time/size but not buffer, corrupt MIDI ring buffer" << endl; break; } - + assert(time >= position); time -= position; - + ev.set(buf, size, time); ev.set_event_type(EventTypeMap::instance().midi_event_type(ev.buffer()[0])); if (!(ev.is_channel_event() || ev.is_smf_meta_event() || ev.is_sysex())) { @@ -234,7 +234,7 @@ SMFSource::write_unlocked (MidiRingBuffer<nframes_t>& source, sframes_t position << std::hex << int(ev.buffer()[0]) << endl; continue; } - + append_event_unlocked_frames(ev, position); } @@ -249,7 +249,7 @@ SMFSource::write_unlocked (MidiRingBuffer<nframes_t>& source, sframes_t position return duration; } - + /** Append an event with a timestamp in beats (double) */ void @@ -260,20 +260,20 @@ SMFSource::append_event_unlocked_beats (const Evoral::Event<double>& ev) } /*printf("SMFSource: %s - append_event_unlocked_beats time = %lf, size = %u, data = ", - name().c_str(), ev.time(), ev.size()); + name().c_str(), ev.time(), ev.size()); for (size_t i = 0; i < ev.size(); ++i) printf("%X ", ev.buffer()[i]); printf("\n");*/ - + assert(ev.time() >= 0); if (ev.time() < _last_ev_time_beats) { cerr << "SMFSource: Warning: Skipping event with non-monotonic time" << endl; return; } - + _length_beats = max(_length_beats, ev.time()); - + const double delta_time_beats = ev.time() - _last_ev_time_beats; const uint32_t delta_time_ticks = (uint32_t)lrint(delta_time_beats * (double)ppqn()); - + Evoral::SMF::append_event_delta(delta_time_ticks, ev.size(), ev.buffer()); _last_ev_time_beats = ev.time(); @@ -293,18 +293,18 @@ SMFSource::append_event_unlocked_frames (const Evoral::Event<nframes_t>& ev, sfr } /*printf("SMFSource: %s - append_event_unlocked_frames time = %u, size = %u, data = ", - name().c_str(), ev.time(), ev.size()); + name().c_str(), ev.time(), ev.size()); for (size_t i=0; i < ev.size(); ++i) printf("%X ", ev.buffer()[i]); printf("\n");*/ - + if (ev.time() < _last_ev_time_frames) { cerr << "SMFSource: Warning: Skipping event with non-monotonic time" << endl; return; } - + BeatsFramesConverter converter(_session, position); - + _length_beats = max(_length_beats, converter.from(ev.time())); - + const sframes_t delta_time_frames = ev.time() - _last_ev_time_frames; const double delta_time_beats = converter.from(delta_time_frames); const uint32_t delta_time_ticks = (uint32_t)(lrint(delta_time_beats * (double)ppqn())); @@ -338,7 +338,7 @@ SMFSource::set_state (const XMLNode& node) if (MidiSource::set_state (node)) { return -1; } - + if (FileSource::set_state (node)) { return -1; } @@ -363,7 +363,7 @@ SMFSource::mark_streaming_write_completed () if (!writable()) { return; } - + _model->set_edited(false); Evoral::SMF::end_write (); } @@ -380,7 +380,7 @@ SMFSource::load_model (bool lock, bool force_reload) if (_writing) { return; } - + if (lock) { Glib::Mutex::Lock lm (_lock); } @@ -403,9 +403,9 @@ SMFSource::load_model (bool lock, bool force_reload) uint64_t time = 0; /* in SMF ticks */ Evoral::Event<double> ev; - + size_t scratch_size = 0; // keep track of scratch and minimize reallocs - + uint32_t delta_t = 0; uint32_t size = 0; uint8_t* buf = NULL; @@ -423,12 +423,12 @@ SMFSource::load_model (bool lock, bool force_reload) scratch_size = ev.size(); } ev.size() = scratch_size; // ensure read_event only allocates if necessary - + _length_beats = max(_length_beats, ev.time()); } set_default_controls_interpolation(); - + _model->end_write(false); _model->set_edited(false); diff --git a/libs/ardour/sndfile_helpers.cc b/libs/ardour/sndfile_helpers.cc index 56259f0812..057efff48c 100644 --- a/libs/ardour/sndfile_helpers.cc +++ b/libs/ardour/sndfile_helpers.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -125,7 +125,7 @@ sndfile_endian_format_from_string (string str) string sndfile_file_ending_from_string (string str) -{ +{ static vector<string> file_endings; if (file_endings.empty()) { @@ -163,7 +163,7 @@ sndfile_data_width (int format) } } -string +string sndfile_major_format(int format) { static map<int, string> m; @@ -174,12 +174,12 @@ sndfile_major_format(int format) sf_command(0, SFC_GET_FORMAT_MAJOR_COUNT, &count, sizeof (int)); for (int i = 0; i < count; ++i){ format_info.format = i; - sf_command (0, SFC_GET_FORMAT_MAJOR, + sf_command (0, SFC_GET_FORMAT_MAJOR, &format_info, sizeof (format_info)); m[format_info.format & SF_FORMAT_TYPEMASK] = format_info.name; } } - + map<int, string>::iterator p = m.find(format & SF_FORMAT_TYPEMASK); if(p != m.end()){ return m[format & SF_FORMAT_TYPEMASK]; @@ -199,12 +199,12 @@ sndfile_minor_format(int format) sf_command(0, SFC_GET_FORMAT_SUBTYPE_COUNT, &count, sizeof (int)); for (int i = 0; i < count; ++i){ format_info.format = i; - sf_command (0, SFC_GET_FORMAT_SUBTYPE, + sf_command (0, SFC_GET_FORMAT_SUBTYPE, &format_info, sizeof (format_info)); m[format_info.format & SF_FORMAT_SUBMASK] = format_info.name; } } - + map<int, string>::iterator p = m.find(format & SF_FORMAT_SUBMASK); if(p != m.end()){ return m[format & SF_FORMAT_SUBMASK]; diff --git a/libs/ardour/sndfileimportable.cc b/libs/ardour/sndfileimportable.cc index d741dd008b..cc68f3ea01 100644 --- a/libs/ardour/sndfileimportable.cc +++ b/libs/ardour/sndfileimportable.cc @@ -13,8 +13,8 @@ SndFileImportableSource::get_timecode_info (SNDFILE* sf, SF_BROADCAST_INFO* binf if (sf_command (sf, SFC_GET_BROADCAST_INFO, binfo, sizeof (*binfo)) != SF_TRUE) { exists = false; return 0; - } - + } + exists = true; int64_t ret = (uint32_t) binfo->time_reference_high; ret <<= 32; @@ -27,13 +27,13 @@ SndFileImportableSource::SndFileImportableSource (const string& path) memset(&sf_info, 0 , sizeof(sf_info)); in.reset( sf_open(path.c_str(), SFM_READ, &sf_info), sf_close); if (!in) throw failed_constructor(); - + SF_BROADCAST_INFO binfo; bool timecode_exists; memset (&binfo, 0, sizeof (binfo)); timecode = get_timecode_info (in.get(), &binfo, timecode_exists); - + if (!timecode_exists) { timecode = 0; } @@ -44,7 +44,7 @@ SndFileImportableSource::~SndFileImportableSource () } nframes_t -SndFileImportableSource::read (Sample* buffer, nframes_t nframes) +SndFileImportableSource::read (Sample* buffer, nframes_t nframes) { nframes_t per_channel = nframes / sf_info.channels; per_channel = sf_readf_float (in.get(), buffer, per_channel); @@ -52,13 +52,13 @@ SndFileImportableSource::read (Sample* buffer, nframes_t nframes) } uint -SndFileImportableSource::channels () const +SndFileImportableSource::channels () const { return sf_info.channels; } nframes_t -SndFileImportableSource::length () const +SndFileImportableSource::length () const { return sf_info.frames; } diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index f84c0ae14b..1b8b01b85a 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -139,7 +139,7 @@ SndFileSource::SndFileSource (Session& s, const ustring& path, bool embedded, fmt |= SF_FORMAT_PCM_16; break; } - + _info.channels = 1; _info.samplerate = rate; _info.format = fmt; @@ -168,7 +168,7 @@ SndFileSource::SndFileSource (Session& s, const ustring& path, bool embedded, } } -void +void SndFileSource::init_sndfile () { ustring file; @@ -194,7 +194,7 @@ SndFileSource::init_sndfile () _capture_end = false; file_pos = 0; - if (destructive()) { + if (destructive()) { xfade_buf = new Sample[xfade_frames]; _timeline_position = header_position_offset; } @@ -214,7 +214,7 @@ SndFileSource::open () so we don't want to see this message. */ - error << string_compose(_("SndFileSource: cannot open file \"%1\" for %2 (%3)"), + error << string_compose(_("SndFileSource: cannot open file \"%1\" for %2 (%3)"), _path, (writable() ? "read+write" : "reading"), errbuf) << endmsg; #endif return -1; @@ -234,7 +234,7 @@ SndFileSource::open () if (!_broadcast_info) { _broadcast_info = new BroadcastInfo; } - + bool bwf_info_exists = _broadcast_info->load_from_file (sf); set_timeline_position (bwf_info_exists ? _broadcast_info->get_time_reference() : header_position_offset); @@ -274,7 +274,7 @@ SndFileSource::~SndFileSource () } float -SndFileSource::sample_rate () const +SndFileSource::sample_rate () const { return _info.samplerate; } @@ -290,22 +290,22 @@ SndFileSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) const if (start > _length) { /* read starts beyond end of data, just memset to zero */ - + file_cnt = 0; } else if (start + cnt > _length) { - + /* read ends beyond end of data, read some, memset the rest */ - + file_cnt = _length - start; } else { - + /* read is entirely within data */ file_cnt = cnt; } - + if (file_cnt != cnt) { nframes_t delta = cnt - file_cnt; memset (dst+file_cnt, 0, sizeof (Sample) * delta); @@ -319,7 +319,7 @@ SndFileSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) const error << string_compose(_("SndFileSource: could not seek to frame %1 within %2 (%3)"), start, _name.substr (1), errbuf) << endmsg; return 0; } - + if (_info.channels == 1) { nframes_t ret = sf_read_float (sf, dst, file_cnt); _read_data_count = ret * sizeof(float); @@ -335,24 +335,24 @@ SndFileSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) const real_cnt = cnt * _info.channels; Sample* interleave_buf = get_interleave_buffer (real_cnt); - + nread = sf_read_float (sf, interleave_buf, real_cnt); ptr = interleave_buf + _channel; nread /= _info.channels; - + /* stride through the interleaved data */ - + for (int32_t n = 0; n < nread; ++n) { dst[n] = *ptr; ptr += _info.channels; } _read_data_count = cnt * sizeof(float); - + return nread; } -nframes_t +nframes_t SndFileSource::write_unlocked (Sample *data, nframes_t cnt) { if (destructive()) { @@ -362,7 +362,7 @@ SndFileSource::write_unlocked (Sample *data, nframes_t cnt) } } -nframes_t +nframes_t SndFileSource::nondestructive_write_unlocked (Sample *data, nframes_t cnt) { if (!writable()) { @@ -375,7 +375,7 @@ SndFileSource::nondestructive_write_unlocked (Sample *data, nframes_t cnt) /*NOTREACHED*/ return 0; } - + nframes_t oldlen; int32_t frame_pos = _length; @@ -413,28 +413,28 @@ SndFileSource::destructive_write_unlocked (Sample* data, nframes_t cnt) _capture_start = false; _capture_end = false; - + /* move to the correct location place */ file_pos = capture_start_frame - _timeline_position; - + // split cnt in half nframes_t subcnt = cnt / 2; nframes_t ofilepos = file_pos; - + // fade in if (crossfade (data, subcnt, 1) != subcnt) { return 0; } - + file_pos += subcnt; Sample * tmpdata = data + subcnt; - + // fade out subcnt = cnt - subcnt; if (crossfade (tmpdata, subcnt, 0) != subcnt) { return 0; } - + file_pos = ofilepos; // adjusted below } else if (_capture_start) { @@ -445,14 +445,14 @@ SndFileSource::destructive_write_unlocked (Sample* data, nframes_t cnt) _capture_start = false; _capture_end = false; - + /* move to the correct location place */ file_pos = capture_start_frame - _timeline_position; if (crossfade (data, cnt, 1) != cnt) { return 0; } - + } else if (_capture_end) { /* end of capture both occur within the data we are writing, @@ -461,7 +461,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, nframes_t cnt) _capture_start = false; _capture_end = false; - + if (crossfade (data, cnt, 0) != cnt) { return 0; } @@ -483,20 +483,20 @@ SndFileSource::destructive_write_unlocked (Sample* data, nframes_t cnt) } file_pos += cnt; - + return cnt; } int SndFileSource::update_header (sframes_t when, struct tm& now, time_t tnow) -{ +{ set_timeline_position (when); if (_flags & Broadcast) { if (setup_broadcast_info (when, now, tnow)) { return -1; } - } + } return flush_header (); } @@ -525,9 +525,9 @@ SndFileSource::setup_broadcast_info (sframes_t /*when*/, struct tm& now, time_t _broadcast_info->set_originator_ref (_session); _broadcast_info->set_origination_time (&now); - + /* now update header position taking header offset into account */ - + set_header_timeline_position (); if (!_broadcast_info->write_to_file (sf)) { @@ -570,11 +570,11 @@ SndFileSource::write_float (Sample* data, sframes_t frame_pos, nframes_t cnt) error << string_compose (_("%1: cannot seek to %2 (libsndfile error: %3"), _path, frame_pos, errbuf) << endmsg; return 0; } - + if (sf_writef_float (sf, data, cnt) != (ssize_t) cnt) { return 0; } - + return cnt; } @@ -608,7 +608,7 @@ SndFileSource::clear_capture_marks () { _capture_start = false; _capture_end = false; -} +} void SndFileSource::mark_capture_start (sframes_t pos) @@ -650,26 +650,26 @@ SndFileSource::crossfade (Sample* data, nframes_t cnt, int fade_in) } if (fade_position > _length) { - + /* read starts beyond end of data, just memset to zero */ - + file_cnt = 0; } else if (fade_position + xfade > _length) { - + /* read ends beyond end of data, read some, memset the rest */ - + file_cnt = _length - fade_position; } else { - + /* read is entirely within data */ file_cnt = xfade; } if (file_cnt) { - + if ((retval = read_unlocked (xfade_buf, fade_position, file_cnt)) != (ssize_t) file_cnt) { if (retval >= 0 && errno == EAGAIN) { /* XXX - can we really trust that errno is meaningful here? yes POSIX, i'm talking to you. @@ -680,13 +680,13 @@ SndFileSource::crossfade (Sample* data, nframes_t cnt, int fade_in) return 0; } } - } + } if (file_cnt != xfade) { nframes_t delta = xfade - file_cnt; memset (xfade_buf+file_cnt, 0, sizeof (Sample) * delta); } - + if (nofade && !fade_in) { if (write_float (data, file_pos, nofade) != nofade) { error << string_compose(_("SndFileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg; @@ -699,11 +699,11 @@ SndFileSource::crossfade (Sample* data, nframes_t cnt, int fade_in) nframes_t n; /* use the standard xfade curve */ - + if (fade_in) { /* fade new material in */ - + for (n = 0; n < xfade; ++n) { xfade_buf[n] = (xfade_buf[n] * out_coefficient[n]) + (fade_data[n] * in_coefficient[n]); } @@ -712,7 +712,7 @@ SndFileSource::crossfade (Sample* data, nframes_t cnt, int fade_in) /* fade new material out */ - + for (n = 0; n < xfade; ++n) { xfade_buf[n] = (xfade_buf[n] * in_coefficient[n]) + (fade_data[n] * out_coefficient[n]); } @@ -728,7 +728,7 @@ SndFileSource::crossfade (Sample* data, nframes_t cnt, int fade_in) compute_equal_power_fades (xfade, in, out); for (nframes_t n = 0; n < xfade; ++n) { - xfade_buf[n] = (xfade_buf[n] * out[n]) + (fade_data[n] * in[n]); + xfade_buf[n] = (xfade_buf[n] * out[n]) + (fade_data[n] * in[n]); } } else if (xfade) { @@ -743,7 +743,7 @@ SndFileSource::crossfade (Sample* data, nframes_t cnt, int fade_in) return 0; } } - + if (fade_in && nofade) { if (write_float (data + xfade, file_pos + xfade, nofade) != nofade) { error << string_compose(_("SndFileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg; @@ -800,12 +800,12 @@ void SndFileSource::set_timeline_position (int64_t pos) { // destructive track timeline postion does not change - // except at instantion or when header_position_offset + // except at instantion or when header_position_offset // (session start) changes if (!destructive()) { AudioFileSource::set_timeline_position (pos); - } + } } int @@ -817,7 +817,7 @@ SndFileSource::get_soundfile_info (const ustring& path, SoundFileInfo& info, str sf_info.format = 0; // libsndfile says to clear this before sf_open(). - if ((sf = sf_open ((char*) path.c_str(), SFM_READ, &sf_info)) == 0) { + if ((sf = sf_open ((char*) path.c_str(), SFM_READ, &sf_info)) == 0) { char errbuf[256]; error_msg = sf_error_str (0, errbuf, sizeof (errbuf) - 1); return false; diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index d7002f2fe1..45cd1fb904 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -58,7 +58,7 @@ Source::Source (Session& s, DataType type, const string& name, Flag flags) fix_writable_flags (); } -Source::Source (Session& s, const XMLNode& node) +Source::Source (Session& s, const XMLNode& node) : SessionObject(s, "unnamed source") , _type(DataType::AUDIO) , _flags (Flag (Writable|CanRename)) @@ -119,7 +119,7 @@ Source::set_state (const XMLNode& node) } else { return -1; } - + if ((prop = node.property ("id")) != 0) { _id = prop->value (); } else { @@ -133,14 +133,14 @@ Source::set_state (const XMLNode& node) if ((prop = node.property ("timestamp")) != 0) { sscanf (prop->value().c_str(), "%ld", &_timestamp); } - + if ((prop = node.property (X_("flags"))) != 0) { _flags = Flag (string_2_enum (prop->value(), _flags)); } else { _flags = Flag (0); } - + /* old style, from the period when we had DestructiveFileSource */ if ((prop = node.property (X_("destructive"))) != 0) { _flags = Flag (_flags | Destructive); @@ -162,7 +162,7 @@ Source::add_playlist (boost::shared_ptr<Playlist> pl) /* it already existed, bump count */ res.first->second++; } - + pl->GoingAway.connect (bind ( mem_fun (*this, &Source::remove_playlist), boost::weak_ptr<Playlist> (pl))); @@ -209,7 +209,7 @@ Source::set_been_analysed (bool yn) Glib::Mutex::Lock lm (_analysis_lock); _analysed = yn; } - + if (yn) { load_transients (get_transients_path()); AnalysisChanged(); // EMIT SIGNAL @@ -224,7 +224,7 @@ Source::load_transients (const string& path) if (!file) { return -1; } - + transients.clear (); stringstream strstr; @@ -242,14 +242,14 @@ Source::load_transients (const string& path) return 0; } -string +string Source::get_transients_path () const { vector<string> parts; string s; /* old sessions may not have the analysis directory */ - + _session.ensure_subdirs (); s = _session.analysis_dir (); @@ -259,12 +259,12 @@ Source::get_transients_path () const s += '.'; s += TransientDetector::operational_identifier(); parts.push_back (s); - + return Glib::build_filename (parts); } bool -Source::check_for_analysis_data_on_disk () +Source::check_for_analysis_data_on_disk () { /* looks to see if the analysis files for this source are on disk. if so, mark us already analysed. diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index 2438d5f6f9..a0aa24a2d0 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2006 Paul Davis + Copyright (C) 2000-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ Glib::Cond* SourceFactory::PeaksToBuild; Glib::StaticMutex SourceFactory::peak_building_lock = GLIBMM_STATIC_MUTEX_INIT; std::list<boost::weak_ptr<AudioSource> > SourceFactory::files_with_peaks; -static void +static void peak_thread_work () { PBD::notify_gui_about_thread_creation (pthread_self(), string ("peakbuilder-") + to_string (pthread_self(), std::dec)); @@ -62,7 +62,7 @@ peak_thread_work () while (true) { SourceFactory::peak_building_lock.lock (); - + wait: if (SourceFactory::files_with_peaks.empty()) { SourceFactory::PeaksToBuild->wait (SourceFactory::peak_building_lock); @@ -75,7 +75,7 @@ peak_thread_work () boost::shared_ptr<AudioSource> as (SourceFactory::files_with_peaks.front().lock()); SourceFactory::files_with_peaks.pop_front (); SourceFactory::peak_building_lock.unlock (); - + if (!as) { continue; } @@ -143,7 +143,7 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) if (type == DataType::AUDIO) { try { - + boost::shared_ptr<Source> ret (new SndFileSource (s, node)); if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr<Source>(); @@ -151,25 +151,25 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) ret->check_for_analysis_data_on_disk (); SourceCreated (ret); return ret; - } - + } + catch (failed_constructor& err) { #ifdef USE_COREAUDIO_FOR_FILES - + /* this is allowed to throw */ - + boost::shared_ptr<Source> ret (new CoreAudioSource (s, node)); - + if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr<Source>(); } - + ret->check_for_analysis_data_on_disk (); SourceCreated (ret); return ret; #else - throw; // rethrow + throw; // rethrow #endif } @@ -190,25 +190,25 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path, bo if (type == DataType::AUDIO) { if (!(flags & Destructive)) { - + try { - + boost::shared_ptr<Source> ret (new SndFileSource (s, path, embedded, chn, flags)); - + if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr<Source>(); } - + ret->check_for_analysis_data_on_disk (); if (announce) { SourceCreated (ret); } return ret; } - + catch (failed_constructor& err) { #ifdef USE_COREAUDIO_FOR_FILES - + boost::shared_ptr<Source> ret (new CoreAudioSource (s, path, embedded, chn, flags)); if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr<Source>(); @@ -218,7 +218,7 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path, bo SourceCreated (ret); } return ret; - + #else throw; // rethrow #endif @@ -227,11 +227,11 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path, bo } else { // eh? } - + } else if (type == DataType::MIDI) { - + boost::shared_ptr<Source> ret (new SMFSource (s, path, embedded, SMFSource::Flag(0))); - + if (announce) { SourceCreated (ret); } @@ -248,20 +248,20 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat bool destructive, nframes_t rate, bool announce, bool defer_peaks) { /* this might throw failed_constructor(), which is OK */ - + if (type == DataType::AUDIO) { boost::shared_ptr<Source> ret (new SndFileSource (s, path, embedded, s.config.get_native_file_data_format(), s.config.get_native_file_header_format(), rate, (destructive - ? Source::Flag (SndFileSource::default_writable_flags | Source::Destructive) - : SndFileSource::default_writable_flags))); + ? Source::Flag (SndFileSource::default_writable_flags | Source::Destructive) + : SndFileSource::default_writable_flags))); if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr<Source>(); } - + // no analysis data - this is a new file if (announce) { @@ -272,9 +272,9 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat } else if (type == DataType::MIDI) { boost::shared_ptr<Source> ret (new SMFSource (s, path, embedded, Source::Flag(0))); - + // no analysis data - this is a new file - + if (announce) { SourceCreated (ret); } diff --git a/libs/ardour/sse_functions_xmm.cc b/libs/ardour/sse_functions_xmm.cc index dede02303c..c20dbb4e27 100644 --- a/libs/ardour/sse_functions_xmm.cc +++ b/libs/ardour/sse_functions_xmm.cc @@ -1,6 +1,6 @@ /* Copyright (C) 2007 Paul sDavis - Written by Sampo Savolainen + Written by Sampo Savolainen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,7 +38,7 @@ x86_sse_find_peaks(const ARDOUR::Sample* buf, nframes_t nframes, float *min, flo current_min = _mm_min_ps(current_min, work); current_max = _mm_max_ps(current_max, work); - + buf++; nframes--; } @@ -77,7 +77,7 @@ x86_sse_find_peaks(const ARDOUR::Sample* buf, nframes_t nframes, float *min, flo buf+=4; nframes-=4; } - + // work through the rest < 4 samples while ( nframes > 0) { @@ -86,7 +86,7 @@ x86_sse_find_peaks(const ARDOUR::Sample* buf, nframes_t nframes, float *min, flo current_min = _mm_min_ps(current_min, work); current_max = _mm_max_ps(current_max, work); - + buf++; nframes--; } diff --git a/libs/ardour/st_pitch.cc b/libs/ardour/st_pitch.cc index 6138249e61..307a41cbf7 100644 --- a/libs/ardour/st_pitch.cc +++ b/libs/ardour/st_pitch.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004-2007 Paul Davis + Copyright (C) 2004-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/st_stretch.cc b/libs/ardour/st_stretch.cc index 5adf8ad6d1..369ed95279 100644 --- a/libs/ardour/st_stretch.cc +++ b/libs/ardour/st_stretch.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004-2007 Paul Davis + Copyright (C) 2004-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,8 +41,8 @@ STStretch::STStretch (Session& s, TimeFXRequest& req) { float percentage; - /* the soundtouch code wants a *tempo* change percentage, which is - of opposite sign to the length change. + /* the soundtouch code wants a *tempo* change percentage, which is + of opposite sign to the length change. */ percentage = -tsr.time_fraction; @@ -52,7 +52,7 @@ STStretch::STStretch (Session& s, TimeFXRequest& req) st.setTempoChange (percentage); st.setPitchSemiTones (0); st.setRateChange (0); - + st.setSetting(SETTING_USE_QUICKSEEK, tsr.quick_seek); st.setSetting(SETTING_USE_AA_FILTER, tsr.antialias); @@ -79,7 +79,7 @@ STStretch::run (boost::shared_ptr<Region> a_region) tsr.progress = 0.0f; tsr.done = false; - + boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion>(a_region); total_frames = region->length() * region->n_channels(); @@ -88,11 +88,11 @@ STStretch::run (boost::shared_ptr<Region> a_region) /* the name doesn't need to be super-precise, but allow for 2 fractional digits just to disambiguate close but not identical stretches. */ - + snprintf (suffix, sizeof (suffix), "@%d", (int) floor (tsr.time_fraction * 100.0f)); /* create new sources */ - + if (make_new_sources (region, nsrcs, suffix)) { goto out; } @@ -115,26 +115,26 @@ STStretch::run (boost::shared_ptr<Region> a_region) while (!tsr.cancel && pos < region->length()) { nframes_t this_time; - + this_time = min (bufsize, region->length() - pos); - /* read from the master (original) sources for the region, - not the ones currently in use, in case it's already been - subject to timefx. + /* read from the master (original) sources for the region, + not the ones currently in use, in case it's already been + subject to timefx. */ if ((this_read = region->master_read_at (buffer, buffer, gain_buffer, pos + region->position(), this_time)) != this_time) { error << string_compose (_("tempoize: error reading data from %1"), asrc->name()) << endmsg; goto out; } - + pos += this_read; done += this_read; tsr.progress = (float) done / total_frames; - + st.putSamples (buffer, this_read); - + while ((this_read = st.receiveSamples (buffer, bufsize)) > 0 && !tsr.cancel) { if (asrc->write (buffer, this_read) != this_read) { error << string_compose (_("error writing tempo-adjusted data to %1"), asrc->name()) << endmsg; @@ -142,11 +142,11 @@ STStretch::run (boost::shared_ptr<Region> a_region) } } } - + if (!tsr.cancel) { st.flush (); } - + while (!tsr.cancel && (this_read = st.receiveSamples (buffer, bufsize)) > 0) { if (asrc->write (buffer, this_read) != this_read) { error << string_compose (_("error writing tempo-adjusted data to %1"), asrc->name()) << endmsg; @@ -182,7 +182,7 @@ STStretch::run (boost::shared_ptr<Region> a_region) nframes_t start; nframes_t length; - // note: tsr.fraction is a percentage of original length. 100 = no change, + // note: tsr.fraction is a percentage of original length. 100 = no change, // 50 is half as long, 200 is twice as long, etc. float stretch = (*x)->stretch() * (tsr.time_fraction/100.0); @@ -203,7 +203,7 @@ STStretch::run (boost::shared_ptr<Region> a_region) (*si)->mark_for_remove (); } } - + tsr.done = true; return ret; diff --git a/libs/ardour/strip_silence.cc b/libs/ardour/strip_silence.cc index dbb36735dd..256e06eccf 100644 --- a/libs/ardour/strip_silence.cc +++ b/libs/ardour/strip_silence.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ using namespace ARDOUR; * @param minimum_length Minimum length of silence period to recognise, in samples. * @param fade_length Length of fade in/out to apply to trimmed regions, in samples. */ - + StripSilence::StripSilence (Session & s, double threshold, nframes_t minimum_length, nframes_t fade_length) : Filter (s), _threshold (threshold), _minimum_length (minimum_length), _fade_length (fade_length) { @@ -42,7 +42,7 @@ int StripSilence::run (boost::shared_ptr<Region> r) { results.clear (); - + /* we only operate on AudioRegions, for now, though this could be adapted to MIDI as well I guess */ boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (r); @@ -75,7 +75,7 @@ StripSilence::run (boost::shared_ptr<Region> r) region->set_name (session.new_region_name (region->name ())); boost::shared_ptr<AudioRegion> last_region = region; results.push_back (region); - + if (s->first == 0) { /* the region starts with some silence */ @@ -83,7 +83,7 @@ StripSilence::run (boost::shared_ptr<Region> r) ** to set_start will fail */ region->set_length (region->length() - s->second + _fade_length, 0); region->set_start (start + s->second - _fade_length, 0); - region->set_position (pos + s->second - _fade_length, 0); + region->set_position (pos + s->second - _fade_length, 0); region->set_fade_in_active (true); region->set_fade_in (AudioRegion::Linear, _fade_length); s++; diff --git a/libs/ardour/tape_file_matcher.cc b/libs/ardour/tape_file_matcher.cc index bedb7e629b..0f8594d731 100644 --- a/libs/ardour/tape_file_matcher.cc +++ b/libs/ardour/tape_file_matcher.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2007 Tim Mayberry + Copyright (C) 2007 Tim Mayberry This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,9 +40,9 @@ TapeFileMatcher::TapeFileMatcher() tape_file_regex_string, REG_EXTENDED|REG_NOSUB))) { char msg[256]; - + regerror (err, &m_compiled_pattern, msg, sizeof (msg)); - + PBD::error << string_compose (_("Cannot compile tape track regexp for use (%1)"), msg) << endmsg; // throw } diff --git a/libs/ardour/template_utils.cc b/libs/ardour/template_utils.cc index a0daca713d..aa0a583af4 100644 --- a/libs/ardour/template_utils.cc +++ b/libs/ardour/template_utils.cc @@ -80,14 +80,14 @@ find_session_templates (vector<TemplateInfo>& template_names) spath += user_template_directory (); templates = scanner (spath.to_string(), template_filter, 0, false, true); - + if (!templates) { cerr << "Found nothing along " << spath.to_string() << endl; return; } cerr << "Found " << templates->size() << " along " << spath.to_string() << endl; - + for (vector<string*>::iterator i = templates->begin(); i != templates->end(); ++i) { string fullpath = *(*i); @@ -117,11 +117,11 @@ find_route_templates (vector<TemplateInfo>& template_names) spath += user_route_template_directory (); templates = scanner (spath.to_string(), template_filter, 0, false, true); - + if (!templates) { return; } - + for (vector<string*>::iterator i = templates->begin(); i != templates->end(); ++i) { string fullpath = *(*i); @@ -132,7 +132,7 @@ find_route_templates (vector<TemplateInfo>& template_names) } XMLNode* root = tree.root(); - + TemplateInfo rti; rti.name = IO::name_from_state (*root->children().front()); diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 2ee0e456fc..623dd21627 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2002 Paul Davis + Copyright (C) 2000-2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -91,7 +91,7 @@ TempoSection::TempoSection (const XMLNode& node) error << _("TempoSection XML node has an illegal \"beats_per_minute\" value") << endmsg; throw failed_constructor(); } - + if ((prop = node.property ("note-type")) == 0) { /* older session, make note type be quarter by default */ _note_type = 4.0; @@ -117,7 +117,7 @@ TempoSection::get_state() const char buf[256]; LocaleGuard lg (X_("POSIX")); - snprintf (buf, sizeof (buf), "%" PRIu32 "|%" PRIu32 "|%" PRIu32, + snprintf (buf, sizeof (buf), "%" PRIu32 "|%" PRIu32 "|%" PRIu32, start().bars, start().beats, start().ticks); @@ -172,7 +172,7 @@ MeterSection::MeterSection (const XMLNode& node) error << _("MeterSection XML node has no \"note-type\" property") << endmsg; throw failed_constructor(); } - + if (sscanf (prop->value().c_str(), "%lf", &_note_type) != 1 || _note_type < 0.0) { error << _("MeterSection XML node has an illegal \"note-type\" value") << endmsg; throw failed_constructor(); @@ -193,7 +193,7 @@ MeterSection::get_state() const char buf[256]; LocaleGuard lg (X_("POSIX")); - snprintf (buf, sizeof (buf), "%" PRIu32 "|%" PRIu32 "|%" PRIu32, + snprintf (buf, sizeof (buf), "%" PRIu32 "|%" PRIu32 "|%" PRIu32, start().bars, start().beats, start().ticks); @@ -222,7 +222,7 @@ TempoMap::TempoMap (nframes_t fr) _frame_rate = fr; last_bbt_valid = false; BBT_Time start; - + start.bars = 1; start.beats = 1; start.ticks = 0; @@ -234,7 +234,7 @@ TempoMap::TempoMap (nframes_t fr) m->set_movable (false); /* note: frame time is correct (zero) for both of these */ - + metrics->push_back (t); metrics->push_back (m); } @@ -262,7 +262,7 @@ TempoMap::move_metric_section (MetricSection& section, const BBT_Time& when) nframes_t prev_frame = round_to_type (frame, -1, Beat); nframes_t next_frame = round_to_type (frame, 1, Beat); - + // cerr << "previous beat at " << prev_frame << " next at " << next_frame << endl; /* use the closest beat */ @@ -272,7 +272,7 @@ TempoMap::move_metric_section (MetricSection& section, const BBT_Time& when) } else { frame = next_frame; } - + // cerr << "actual frame time = " << frame << endl; section.set_frame (frame); // cerr << "frame time = " << section.frame() << endl; @@ -369,7 +369,7 @@ TempoMap::do_insert (MetricSection* section, bool with_bbt) Metrics::iterator i; for (i = metrics->begin(); i != metrics->end(); ++i) { - + if (with_bbt) { if ((*i)->start() < section->start()) { continue; @@ -377,19 +377,19 @@ TempoMap::do_insert (MetricSection* section, bool with_bbt) } else { if ((*i)->frame() < section->frame()) { continue; - } + } } metrics->insert (i, section); break; } - + if (i == metrics->end()) { metrics->insert (metrics->end(), section); } - + timestamp_metrics (with_bbt); -} +} void TempoMap::add_tempo (const Tempo& tempo, BBT_Time where) @@ -398,9 +398,9 @@ TempoMap::add_tempo (const Tempo& tempo, BBT_Time where) Glib::RWLock::WriterLock lm (lock); /* new tempos always start on a beat */ - + where.ticks = 0; - + do_insert (new TempoSection (where, tempo.beats_per_minute(), tempo.note_type()), true); } @@ -423,10 +423,10 @@ TempoMap::replace_tempo (TempoSection& existing, const Tempo& replacement) { bool replaced = false; - { + { Glib::RWLock::WriterLock lm (lock); Metrics::iterator i; - + for (i = metrics->begin(); i != metrics->end(); ++i) { TempoSection *ts; @@ -441,7 +441,7 @@ TempoMap::replace_tempo (TempoSection& existing, const Tempo& replacement) } } } - + if (replaced) { StateChanged (Change (0)); } @@ -466,7 +466,7 @@ TempoMap::add_meter (const Meter& meter, BBT_Time where) } /* new meters *always* start on a beat. */ - + where.ticks = 0; do_insert (new MeterSection (where, meter.beats_per_bar(), meter.note_divisor()), true); @@ -491,14 +491,14 @@ TempoMap::replace_meter (MeterSection& existing, const Meter& replacement) { bool replaced = false; - { + { Glib::RWLock::WriterLock lm (lock); Metrics::iterator i; - + for (i = metrics->begin(); i != metrics->end(); ++i) { MeterSection *ms; if ((ms = dynamic_cast<MeterSection*>(*i)) != 0 && ms == &existing) { - + *((Meter*) ms) = replacement; replaced = true; @@ -507,7 +507,7 @@ TempoMap::replace_meter (MeterSection& existing, const Meter& replacement) } } } - + if (replaced) { StateChanged (Change (0)); } @@ -625,17 +625,17 @@ TempoMap::timestamp_metrics (bool use_bbt) BBT_Time end; for (i = metrics->begin(); i != metrics->end(); ++i) { - + end = (*i)->start(); - + section_frames = count_frames_between_metrics (*meter, *tempo, start, end); - + current += section_frames; - + start = end; - + (*i)->set_frame (current); - + if ((t = dynamic_cast<TempoSection*>(*i)) != 0) { tempo = t; } else if ((m = dynamic_cast<MeterSection*>(*i)) != 0) { @@ -657,7 +657,7 @@ TempoMap::timestamp_metrics (bool use_bbt) BBT_Time bbt; Metric metric (*meter, *tempo); - + if (prev) { metric.set_start (prev->start()); metric.set_frame (prev->frame()); @@ -665,20 +665,20 @@ TempoMap::timestamp_metrics (bool use_bbt) // metric will be at frames=0 bbt=1|1|0 by default // which is correct for our purpose } - + bbt_time_with_metric ((*i)->frame(), bbt, metric); // cerr << "timestamp @ " << (*i)->frame() << " with " << bbt.bars << "|" << bbt.beats << "|" << bbt.ticks << " => "; - + if (first) { first = false; } else { - + if (bbt.ticks > Meter::ticks_per_beat/2) { /* round up to next beat */ bbt.beats += 1; - } + } bbt.ticks = 0; @@ -688,9 +688,9 @@ TempoMap::timestamp_metrics (bool use_bbt) bbt.beats = 1; } } - + //s cerr << bbt.bars << "|" << bbt.beats << "|" << bbt.ticks << endl; - + (*i)->set_start (bbt); if ((t = dynamic_cast<TempoSection*>(*i)) != 0) { @@ -742,7 +742,7 @@ TempoMap::metric_at (nframes_t frame) const m.set_frame ((*i)->frame ()); m.set_start ((*i)->start ()); } - + return m; } @@ -773,7 +773,7 @@ TempoMap::metric_at (BBT_Time bbt) const } else if ((meter = dynamic_cast<const MeterSection*>(*i)) != 0) { m.set_meter (*meter); } - + m.set_frame ((*i)->frame ()); m.set_start (section_start); } @@ -842,10 +842,10 @@ TempoMap::bbt_time_with_metric (nframes_t frame, BBT_Time& bbt, const Metric& me // cerr << "-----\t RETURN " << bbt << endl; } -nframes_t +nframes_t TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) const { - /* for this to work with fractional measure types, start and end have to be "legal" BBT types, + /* for this to work with fractional measure types, start and end have to be "legal" BBT types, that means that the beats and ticks should be inside a bar */ @@ -857,17 +857,17 @@ TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) con uint32_t bar_offset = start.bars - m.start().bars; - double beat_offset = bar_offset*m.meter().beats_per_bar() - (m.start().beats-1) + (start.beats -1) + double beat_offset = bar_offset*m.meter().beats_per_bar() - (m.start().beats-1) + (start.beats -1) + start.ticks/Meter::ticks_per_beat; start_frame = m.frame() + (nframes_t) rint( beat_offset * m.tempo().frames_per_beat(_frame_rate, m.meter())); - m = metric_at(end); + m = metric_at(end); bar_offset = end.bars - m.start().bars; - beat_offset = bar_offset * m.meter().beats_per_bar() - (m.start().beats -1) + (end.beats - 1) + beat_offset = bar_offset * m.meter().beats_per_bar() - (m.start().beats -1) + (end.beats - 1) + end.ticks/Meter::ticks_per_beat; end_frame = m.frame() + (nframes_t) rint(beat_offset * m.tempo().frames_per_beat(_frame_rate, m.meter())); @@ -875,13 +875,13 @@ TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) con frames = end_frame - start_frame; return frames; - -} -nframes_t +} + +nframes_t TempoMap::count_frames_between_metrics (const Meter& meter, const Tempo& tempo, const BBT_Time& start, const BBT_Time& end) const { - /* this is used in timestamping the metrics by actually counting the beats */ + /* this is used in timestamping the metrics by actually counting the beats */ nframes_t frames = 0; uint32_t bar = start.bars; @@ -896,7 +896,7 @@ TempoMap::count_frames_between_metrics (const Meter& meter, const Tempo& tempo, frames = 0; while (bar < end.bars || (bar == end.bars && beat < end.beats)) { - + if (beat >= beats_per_bar) { beat = 1; ++bar; @@ -905,7 +905,7 @@ TempoMap::count_frames_between_metrics (const Meter& meter, const Tempo& tempo, if (beat > beats_per_bar) { /* this is a fractional beat at the end of a fractional bar - so it should only count for the fraction + so it should only count for the fraction */ beats_counted -= (ceil(beats_per_bar) - beats_per_bar); @@ -917,18 +917,18 @@ TempoMap::count_frames_between_metrics (const Meter& meter, const Tempo& tempo, } } - // cerr << "Counted " << beats_counted << " from " << start << " to " << end - // << " bpb were " << beats_per_bar + // cerr << "Counted " << beats_counted << " from " << start << " to " << end + // << " bpb were " << beats_per_bar // << " fpb was " << beat_frames // << endl; - + frames = (nframes_t) floor (beats_counted * beat_frames); return frames; - -} -nframes_t +} + +nframes_t TempoMap::frame_time (const BBT_Time& bbt) const { BBT_Time start ; /* 1|1|0 */ @@ -936,7 +936,7 @@ TempoMap::frame_time (const BBT_Time& bbt) const return count_frames_between ( start, bbt); } -nframes_t +nframes_t TempoMap::bbt_duration_at (nframes_t pos, const BBT_Time& bbt, int dir) const { nframes_t frames = 0; @@ -952,7 +952,7 @@ TempoMap::bbt_duration_at (nframes_t pos, const BBT_Time& bbt, int dir) const return frames; } -nframes_t +nframes_t TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, int dir) const { @@ -960,7 +960,7 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i double beats_per_bar; BBT_Time result; - + result.bars = max(1U, when.bars + dir * bbt.bars) ; result.beats = 1; result.ticks = 0; @@ -970,13 +970,13 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i - /*reduce things to legal bbt values + /*reduce things to legal bbt values we have to handle possible fractional=shorter beats at the end of measures and things like 0|11|9000 as a duration in a 4.5/4 measure - the musical decision is that the fractional beat is also a beat , although a shorter one + the musical decision is that the fractional beat is also a beat , although a shorter one */ - + if (dir >= 0) { result.beats = when.beats + bbt.beats; result.ticks = when.ticks + bbt.ticks; @@ -986,9 +986,9 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i result.beats -= (uint32_t) ceil(beats_per_bar); metric = metric_at(result); // maybe there is a meter change beats_per_bar = metric.meter().beats_per_bar(); - + } - /*we now counted the beats and landed in the target measure, now deal with ticks + /*we now counted the beats and landed in the target measure, now deal with ticks this seems complicated, but we want to deal with the corner case of a sequence of time signatures like 0.2/4-0.7/4 and with request like bbt = 3|2|9000 ,so we repeat the same loop but add ticks */ @@ -997,7 +997,7 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i */ uint32_t ticks_at_beat = (uint32_t) ( result.beats == ceil(beats_per_bar) ? - (1 - (ceil(beats_per_bar) - beats_per_bar))* Meter::ticks_per_beat + (1 - (ceil(beats_per_bar) - beats_per_bar))* Meter::ticks_per_beat : Meter::ticks_per_beat ); while (result.ticks >= ticks_at_beat) { @@ -1010,30 +1010,30 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i beats_per_bar = metric.meter().beats_per_bar(); } ticks_at_beat= (uint32_t) ( result.beats == ceil(beats_per_bar) ? - (1 - (ceil(beats_per_bar) - beats_per_bar) ) * Meter::ticks_per_beat + (1 - (ceil(beats_per_bar) - beats_per_bar) ) * Meter::ticks_per_beat : Meter::ticks_per_beat); } - + } else { uint32_t b = bbt.beats; /* count beats */ while( b > when.beats ) { - + result.bars = max(1U,result.bars-- ) ; metric = metric_at(result); // maybe there is a meter change beats_per_bar = metric.meter().beats_per_bar(); if (b >= ceil(beats_per_bar)) { - + b -= (uint32_t) ceil(beats_per_bar); } else { b = (uint32_t) ceil(beats_per_bar) - b + when.beats ; } } result.beats = when.beats - b; - + /*count ticks */ if (bbt.ticks <= when.ticks) { @@ -1055,9 +1055,9 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i result.beats --; ticks_at_beat = (uint32_t) Meter::ticks_per_beat; } - + if (t <= ticks_at_beat) { - result.ticks = ticks_at_beat - t; + result.ticks = ticks_at_beat - t; } else { t-= ticks_at_beat; } @@ -1111,14 +1111,14 @@ TempoMap::round_to_beat_subdivision (nframes_t fr, int sub_num, int dir) ticks_one_subdivisions_worth = (uint32_t)Meter::ticks_per_beat / sub_num; ticks_one_half_subdivisions_worth = ticks_one_subdivisions_worth / 2; - + if (dir > 0) { - + /* round to next */ uint32_t mod = the_beat.ticks % ticks_one_subdivisions_worth; - if (mod == 0) { + if (mod == 0) { /* right on the subdivision, so the difference is just the subdivision ticks */ difference = ticks_one_subdivisions_worth; @@ -1132,7 +1132,7 @@ TempoMap::round_to_beat_subdivision (nframes_t fr, int sub_num, int dir) the_beat.beats++; the_beat.ticks += difference; the_beat.ticks -= (uint32_t)Meter::ticks_per_beat; - } else { + } else { the_beat.ticks += difference; } @@ -1142,7 +1142,7 @@ TempoMap::round_to_beat_subdivision (nframes_t fr, int sub_num, int dir) uint32_t mod = the_beat.ticks % ticks_one_subdivisions_worth; - if (mod == 0) { + if (mod == 0) { /* right on the subdivision, so the difference is just the subdivision ticks */ difference = ticks_one_subdivisions_worth; cerr << "On the sub, move by 1 sub = " << difference << endl; @@ -1163,12 +1163,12 @@ TempoMap::round_to_beat_subdivision (nframes_t fr, int sub_num, int dir) << (uint32_t)Meter::ticks_per_beat - difference << endl; the_beat.beats--; the_beat.ticks = (uint32_t)Meter::ticks_per_beat - difference; - } else { + } else { cerr << " reduce ticks\n"; the_beat.ticks -= difference; } - } else { + } else { /* round to nearest */ if (the_beat.ticks % ticks_one_subdivisions_worth > ticks_one_half_subdivisions_worth) { @@ -1177,7 +1177,7 @@ TempoMap::round_to_beat_subdivision (nframes_t fr, int sub_num, int dir) the_beat.beats++; the_beat.ticks += difference; the_beat.ticks -= (uint32_t)Meter::ticks_per_beat; - } else { + } else { the_beat.ticks += difference; } } else { @@ -1217,7 +1217,7 @@ TempoMap::round_to_type (nframes_t frame, int dir, BBTPointType type) bbt.beats = 1; bbt.ticks = 0; break; - + case Beat: if (dir < 0) { if (bbt.beats > 1) { @@ -1240,15 +1240,15 @@ TempoMap::round_to_type (nframes_t frame, int dir, BBTPointType type) } bbt.ticks = 0; break; - + } - + /* cerr << "for " << frame << " round to " << bbt << " using " << metric.start() << endl; */ - + return metric.frame() + count_frames_between (metric.start(), bbt); } @@ -1293,7 +1293,7 @@ TempoMap::get_points (nframes_t lower, nframes_t upper) const } /* We now have: - + meter -> the Meter for "lower" tempo -> the Tempo for "lower" i -> for first new metric after "lower", possibly metrics->end() @@ -1304,7 +1304,7 @@ TempoMap::get_points (nframes_t lower, nframes_t upper) const 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, *meter); - + if (meter->frame() > tempo->frame()) { bar = meter->start().bars; beat = meter->start().beats; @@ -1319,7 +1319,7 @@ TempoMap::get_points (nframes_t lower, nframes_t upper) const lower frame bound passed in. assumes that current is initialized above to be on a beat. */ - + delta_bars = (lower-current) / frames_per_bar; delta_beats = modf(delta_bars, &dummy) * beats_per_bar; current += (floor(delta_bars) * frames_per_bar) + (floor(delta_beats) * beat_frames); @@ -1329,21 +1329,21 @@ TempoMap::get_points (nframes_t lower, nframes_t upper) const beat += (uint32_t) (floor(delta_beats)); points = new BBTPointList; - + do { if (i == metrics->end()) { limit = upper; // cerr << "== limit set to end of request @ " << limit << endl; } else { - // cerr << "== limit set to next metric @ " << (*i)->frame() << endl; + // cerr << "== limit set to next metric @ " << (*i)->frame() << endl; limit = (*i)->frame(); } limit = min (limit, upper); while (current < limit) { - + /* if we're at the start of a bar, add bar point */ if (beat == 1) { @@ -1365,7 +1365,7 @@ TempoMap::get_points (nframes_t lower, nframes_t upper) const } beat_frame += beat_frames; current+= beat_frames; - + beat++; } @@ -1386,8 +1386,8 @@ TempoMap::get_points (nframes_t lower, nframes_t upper) const just filled had 10 beat marks, but the bar end is 1/2 beat before the last beat mark. - And it is also possible that a tempo - change occured in the middle of a bar, + And it is also possible that a tempo + change occured in the middle of a bar, so we subtract the possible extra fraction from the current */ @@ -1402,8 +1402,8 @@ TempoMap::get_points (nframes_t lower, nframes_t upper) const } bar++; beat = 1; - } - + } + } /* if we're done, then we're done */ @@ -1432,14 +1432,14 @@ TempoMap::get_points (nframes_t lower, nframes_t upper) const 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, *meter); - + ++i; } } while (1); return points; -} +} const TempoSection& TempoMap::tempo_section_at (nframes_t frame) @@ -1447,7 +1447,7 @@ TempoMap::tempo_section_at (nframes_t frame) Glib::RWLock::ReaderLock lm (lock); Metrics::iterator i; TempoSection* prev = 0; - + for (i = metrics->begin(); i != metrics->end(); ++i) { TempoSection* t; @@ -1508,32 +1508,32 @@ TempoMap::set_state (const XMLNode& node) XMLNodeList nlist; XMLNodeConstIterator niter; Metrics old_metrics (*metrics); - + metrics->clear(); nlist = node.children(); - + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { XMLNode* child = *niter; - + if (child->name() == TempoSection::xml_state_node_name) { - + try { metrics->push_back (new TempoSection (*child)); } - + catch (failed_constructor& err){ error << _("Tempo map: could not set new state, restoring old one.") << endmsg; *metrics = old_metrics; break; } - + } else if (child->name() == MeterSection::xml_state_node_name) { - + try { metrics->push_back (new MeterSection (*child)); } - + catch (failed_constructor& err) { error << _("Tempo map: could not set new state, restoring old one.") << endmsg; *metrics = old_metrics; @@ -1541,15 +1541,15 @@ TempoMap::set_state (const XMLNode& node) } } } - + if (niter == nlist.end()) { - + MetricSectionSorter cmp; metrics->sort (cmp); timestamp_metrics (true); } } - + StateChanged (Change (0)); return 0; @@ -1560,14 +1560,14 @@ TempoMap::dump (std::ostream& o) const { const MeterSection* m; const TempoSection* t; - + for (Metrics::const_iterator i = metrics->begin(); i != metrics->end(); ++i) { if ((t = dynamic_cast<const TempoSection*>(*i)) != 0) { o << "Tempo @ " << *i << ' ' << t->beats_per_minute() << " BPM (denom = " << t->note_type() << ") at " << t->start() << " frame= " << t->frame() << " (move? " << t->movable() << ')' << endl; } else if ((m = dynamic_cast<const MeterSection*>(*i)) != 0) { - o << "Meter @ " << *i << ' ' << m->beats_per_bar() << '/' << m->note_divisor() << " at " << m->start() << " frame= " << m->frame() + o << "Meter @ " << *i << ' ' << m->beats_per_bar() << '/' << m->note_divisor() << " at " << m->start() << " frame= " << m->frame() << " (move? " << m->movable() << ')' << endl; } } @@ -1613,6 +1613,6 @@ TempoMap::insert_time (nframes_t where, nframes_t amount) } timestamp_metrics (false); - + StateChanged (Change (0)); } diff --git a/libs/ardour/tempo_map_importer.cc b/libs/ardour/tempo_map_importer.cc index 457f8c7b53..1d37383fb5 100644 --- a/libs/ardour/tempo_map_importer.cc +++ b/libs/ardour/tempo_map_importer.cc @@ -39,11 +39,11 @@ TempoMapImportHandler::TempoMapImportHandler (XMLTree const & source, Session & { XMLNode const * root = source.root(); XMLNode const * tempo_map; - + if (!(tempo_map = root->child (X_("TempoMap")))) { throw failed_constructor(); } - + elements.push_back (ElementPtr ( new TempoMapImporter (source, session, *tempo_map))); } @@ -54,7 +54,7 @@ TempoMapImportHandler::get_info () const } /*** TempoMapImporter ***/ -TempoMapImporter::TempoMapImporter (XMLTree const & source, Session & session, XMLNode const & node) : +TempoMapImporter::TempoMapImporter (XMLTree const & source, Session & session, XMLNode const & node) : ElementImporter (source, session), xml_tempo_map (node) { @@ -68,7 +68,7 @@ TempoMapImporter::get_info () const unsigned int tempos = 0; unsigned int meters = 0; XMLNodeList children = xml_tempo_map.children(); - + for (XMLNodeIterator it = children.begin(); it != children.end(); it++) { if ((*it)->name() == "Tempo") { tempos++; @@ -76,10 +76,10 @@ TempoMapImporter::get_info () const meters++; } } - + // return info oss << _("Tempo marks: ") << tempos << _("\nMeter marks: ") << meters; - + return oss.str(); } diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc index de42683c15..6f831e8808 100644 --- a/libs/ardour/ticker.cc +++ b/libs/ardour/ticker.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Hans Baier + Copyright (C) 2008 Hans Baier This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,25 +26,25 @@ namespace ARDOUR { -void Ticker::set_session(Session& s) +void Ticker::set_session(Session& s) { _session = &s; - + if(_session) { _session->tick.connect(mem_fun (*this, &Ticker::tick)); _session->GoingAway.connect(mem_fun (*this, &Ticker::going_away)); } } -void MidiClockTicker::set_session(Session& s) +void MidiClockTicker::set_session(Session& s) { Ticker::set_session(s); - + if(_session) { _session->MIDIClock_PortChanged.connect(mem_fun (*this, &MidiClockTicker::update_midi_clock_port)); _session->TransportStateChange .connect(mem_fun (*this, &MidiClockTicker::transport_state_changed)); - _session->PositionChanged .connect(mem_fun (*this, &MidiClockTicker::position_changed)); - _session->TransportLooped .connect(mem_fun (*this, &MidiClockTicker::transport_looped)); + _session->PositionChanged .connect(mem_fun (*this, &MidiClockTicker::position_changed)); + _session->TransportLooped .connect(mem_fun (*this, &MidiClockTicker::transport_looped)); update_midi_clock_port(); } } @@ -60,18 +60,18 @@ void MidiClockTicker::transport_state_changed() /* no midi clock during export, for now */ return; } - + float speed = _session->transport_speed(); nframes_t position = _session->transport_frame(); -#ifdef DEBUG_MIDI_CLOCK +#ifdef DEBUG_MIDI_CLOCK cerr << "Transport state change, speed:" << speed << "position:" << position<< " play loop " << _session->get_play_loop() << endl; -#endif +#endif if (speed == 1.0f) { _last_tick = position; - - if (!Config->get_send_midi_clock()) + + if (!Config->get_send_midi_clock()) return; - + if (_session->get_play_loop()) { assert(_session->locations()->auto_loop_location()); if (position == _session->locations()->auto_loop_location()->start()) { @@ -84,24 +84,24 @@ void MidiClockTicker::transport_state_changed() } else { send_continue_event(0); } - + send_midi_clock_event(0); - + } else if (speed == 0.0f) { - if (!Config->get_send_midi_clock()) + if (!Config->get_send_midi_clock()) return; - + send_stop_event(0); } - + tick(position, *((ARDOUR::BBT_Time *) 0), *((SMPTE::Time *)0)); } void MidiClockTicker::position_changed(nframes_t position) { -#ifdef DEBUG_MIDI_CLOCK +#ifdef DEBUG_MIDI_CLOCK cerr << "Position changed:" << position << endl; -#endif +#endif _last_tick = position; } @@ -110,15 +110,15 @@ void MidiClockTicker::transport_looped() Location* loop_location = _session->locations()->auto_loop_location(); assert(loop_location); -#ifdef DEBUG_MIDI_CLOCK +#ifdef DEBUG_MIDI_CLOCK cerr << "Transport looped, position:" << _session->transport_frame() << " loop start " << loop_location->start( ) << " loop end " << loop_location->end( ) << " play loop " << _session->get_play_loop() << endl; #endif - - // adjust _last_tick, so that the next MIDI clock message is sent + + // adjust _last_tick, so that the next MIDI clock message is sent // in due time (and the tick interval is still constant) nframes_t elapsed_since_last_tick = loop_location->end() - _last_tick; _last_tick = loop_location->start() - elapsed_since_last_tick; @@ -132,25 +132,25 @@ void MidiClockTicker::tick(const nframes_t& transport_frames, const BBT_Time& /* MIDI::JACK_MidiPort* jack_port = dynamic_cast<MIDI::JACK_MidiPort*>(_midi_port); assert(jack_port); - + while (true) { double next_tick = _last_tick + one_ppqn_in_frames(transport_frames); nframes_t next_tick_offset = nframes_t(next_tick) - transport_frames; - -#ifdef DEBUG_MIDI_CLOCK - cerr << "Transport:" << transport_frames - << ":Last tick time:" << _last_tick << ":" - << ":Next tick time:" << next_tick << ":" + +#ifdef DEBUG_MIDI_CLOCK + cerr << "Transport:" << transport_frames + << ":Last tick time:" << _last_tick << ":" + << ":Next tick time:" << next_tick << ":" << "Offset:" << next_tick_offset << ":" - << "cycle length:" << jack_port->nframes_this_cycle() - << endl; -#endif - + << "cycle length:" << jack_port->nframes_this_cycle() + << endl; +#endif + if (next_tick_offset >= jack_port->nframes_this_cycle()) return; - + send_midi_clock_event(next_tick_offset); - + _last_tick = next_tick; } #endif // WITH_JACK_MIDI @@ -175,7 +175,7 @@ void MidiClockTicker::send_midi_clock_event(nframes_t offset) #ifdef WITH_JACK_MIDI assert (MIDI::JACK_MidiPort::is_process_thread()); #endif // WITH_JACK_MIDI -#ifdef DEBUG_MIDI_CLOCK +#ifdef DEBUG_MIDI_CLOCK cerr << "Tick with offset " << offset << endl; #endif // DEBUG_MIDI_CLOCK static uint8_t _midi_clock_tick[1] = { MIDI_CMD_COMMON_CLOCK }; diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 62639c8d3e..bf5737f29d 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2006 Paul Davis + Copyright (C) 2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -95,7 +95,7 @@ Track::update_total_latency () { nframes_t old = _output->effective_latency(); nframes_t own_latency = _output->user_latency(); - + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if ((*i)->active ()) { own_latency += (*i)->signal_latency (); @@ -108,7 +108,7 @@ Track::update_total_latency () #endif _output->set_port_latency (own_latency); - + if (old != own_latency) { _output->set_latency_delay (own_latency); signal_latency_changed (); /* EMIT SIGNAL */ @@ -166,7 +166,7 @@ Track::can_record() return will_record; } - + void Track::set_record_enable (bool yn, void *src) { @@ -187,7 +187,7 @@ Track::set_record_enable (bool yn, void *src) if (!_diskstream->record_enabled()) { _saved_meter_point = _meter_point; } - + _diskstream->set_record_enabled (yn); if (_diskstream->record_enabled()) { @@ -215,7 +215,7 @@ Track::set_name (const string& str) } /* save state so that the statefile fully reflects any filename changes */ - + if ((ret = Route::set_name (str)) == 0) { _session.save_state (""); } @@ -238,8 +238,8 @@ Track::zero_diskstream_id_in_xml (XMLNode& node) } } -int -Track::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, +int +Track::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, bool session_state_changing, bool can_record, bool /*rec_monitors_input*/) { if (n_outputs().n_total() == 0) { @@ -262,7 +262,7 @@ Track::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, diskstream()->check_record_status (start_frame, nframes, can_record); bool send_silence; - + if (_have_internal_generator) { /* since the instrument has no input streams, there is no reason to send any signal @@ -271,9 +271,9 @@ Track::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, send_silence = true; } else { if (!Config->get_tape_machine_mode()) { - /* - ADATs work in a strange way.. - they monitor input always when stopped.and auto-input is engaged. + /* + ADATs work in a strange way.. + they monitor input always when stopped.and auto-input is engaged. */ if ((Config->get_monitoring_model() == SoftwareMonitoring) && (_session.config.get_auto_input () || _diskstream->record_enabled())) { @@ -282,10 +282,10 @@ Track::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, send_silence = true; } } else { - /* + /* Other machines switch to input on stop if the track is record enabled, - regardless of the auto input setting (auto input only changes the - monitoring state when the transport is rolling) + regardless of the auto input setting (auto input only changes the + monitoring state when the transport is rolling) */ if ((Config->get_monitoring_model() == SoftwareMonitoring) && _diskstream->record_enabled()) { @@ -299,11 +299,11 @@ Track::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, _amp->apply_gain_automation(false); if (send_silence) { - + /* if we're sending silence, but we want the meters to show levels for the signal, meter right here. */ - + if (_have_internal_generator) { passthru_silence (start_frame, end_frame, nframes, 0); } else { @@ -314,8 +314,8 @@ Track::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, } } else { - - /* we're sending signal, but we may still want to meter the input. + + /* we're sending signal, but we may still want to meter the input. */ passthru (start_frame, end_frame, nframes, false); @@ -327,7 +327,7 @@ Track::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, } int -Track::silent_roll (nframes_t nframes, sframes_t /*start_frame*/, sframes_t /*end_frame*/, +Track::silent_roll (nframes_t nframes, sframes_t /*start_frame*/, sframes_t /*end_frame*/, bool can_record, bool rec_monitors_input) { if (n_outputs().n_total() == 0 && _processors.empty()) { diff --git a/libs/ardour/transient_detector.cc b/libs/ardour/transient_detector.cc index da167e4bd6..1eca79e67d 100644 --- a/libs/ardour/transient_detector.cc +++ b/libs/ardour/transient_detector.cc @@ -16,9 +16,9 @@ TransientDetector::TransientDetector (float sr) /* update the op_id */ _op_id = X_("libardourvampplugins:percussiononsets"); - + // XXX this should load the above-named plugin and get the current version - + _op_id += ":2"; } @@ -48,13 +48,13 @@ TransientDetector::use_features (Plugin::FeatureSet& features, ostream* out) const Plugin::FeatureList& fl (features[0]); for (Plugin::FeatureList::const_iterator f = fl.begin(); f != fl.end(); ++f) { - + if ((*f).hasTimestamp) { if (out) { (*out) << (*f).timestamp.toString() << endl; - } - + } + current_results->push_back (RealTime::realTime2Frame ((*f).timestamp, (nframes_t) floor(sample_rate))); } } @@ -86,23 +86,23 @@ TransientDetector::cleanup_transients (AnalysisFeatureList& t, float sr, float g } t.sort (); - + /* remove duplicates or other things that are too close */ - + AnalysisFeatureList::iterator i = t.begin(); AnalysisFeatureList::iterator f, b; const nframes64_t gap_frames = (nframes64_t) floor (gap_msecs * (sr / 1000.0)); - + while (i != t.end()) { // move front iterator to just past i, and back iterator the same place - + f = i; ++f; b = f; // move f until we find a new value that is far enough away - + while ((f != t.end()) && (((*f) - (*i)) < gap_frames)) { ++f; } diff --git a/libs/ardour/uri_map.cc b/libs/ardour/uri_map.cc index 82869de134..35308b02f4 100644 --- a/libs/ardour/uri_map.cc +++ b/libs/ardour/uri_map.cc @@ -1,15 +1,15 @@ /* This file is part of Ingen. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> - * + * * Ingen is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -24,7 +24,7 @@ using namespace std; namespace ARDOUR { - + URIMap::URIMap() : next_uri_id(1) @@ -35,7 +35,7 @@ URIMap::URIMap() uri_map_feature.data = &uri_map_feature_data; } - + uint32_t URIMap::uri_to_id(const char* map, const char* uri) @@ -50,7 +50,7 @@ URIMap::uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data, const char* uri) { // TODO: map ignored, < UINT16_MAX assumed - + URIMap* me = (URIMap*)callback_data; uint32_t ret = 0; @@ -61,7 +61,7 @@ URIMap::uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data, ret = me->next_uri_id++; me->uri_map.insert(make_pair(string(uri), ret)); } - + /*cout << "URI MAP (" << (map ? (void*)map : NULL) << "): " << uri << " -> " << ret << endl;*/ diff --git a/libs/ardour/user_bundle.cc b/libs/ardour/user_bundle.cc index 1abb3fba87..e2d46ab6e0 100644 --- a/libs/ardour/user_bundle.cc +++ b/libs/ardour/user_bundle.cc @@ -27,7 +27,7 @@ int ARDOUR::UserBundle::set_state (XMLNode const & node) { XMLProperty const * name; - + if ((name = node.property ("name")) == 0) { PBD::error << _("Node for Bundle has no \"name\" property") << endmsg; return -1; @@ -49,7 +49,7 @@ ARDOUR::UserBundle::set_state (XMLNode const & node) PBD::error << _("Node for Channel has no \"name\" property") << endmsg; return -1; } - + add_channel (name->value ()); XMLNodeList const ports = (*i)->children (); @@ -63,8 +63,8 @@ ARDOUR::UserBundle::set_state (XMLNode const & node) if ((name = (*j)->property ("name")) == 0) { PBD::error << _("Node for Port has no \"name\" property") << endmsg; return -1; - } - + } + add_port_to_channel (n, name->value ()); } @@ -78,7 +78,7 @@ XMLNode& ARDOUR::UserBundle::get_state () { XMLNode *node; - + if (ports_are_inputs ()) { node = new XMLNode ("InputBundle"); } else { @@ -93,13 +93,13 @@ ARDOUR::UserBundle::get_state () for (std::vector<Channel>::iterator i = _channel.begin(); i != _channel.end(); ++i) { XMLNode* c = new XMLNode ("Channel"); c->add_property ("name", i->name); - + for (PortList::iterator j = i->ports.begin(); j != i->ports.end(); ++j) { XMLNode* p = new XMLNode ("Port"); p->add_property ("name", *j); c->add_child_nocopy (*p); } - + node->add_child_nocopy (*c); } } diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 1ecaba55e5..f7a4e14316 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -210,7 +210,7 @@ path_is_paired (ustring path, ustring& pair_base) path = path.substr(pos+1); } - /* remove filename suffixes etc. */ + /* remove filename suffixes etc. */ if ((pos = path.find_last_of ('.')) != string::npos) { path = path.substr (0, pos); @@ -425,7 +425,7 @@ meter_falloff_from_float (float val) } else if (val <= METER_FALLOFF_FASTER) { return MeterFalloffFaster; - } + } else { return MeterFalloffFastest; } diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 0aca137150..81e9674f1a 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -74,15 +74,15 @@ VSTPlugin::VSTPlugin (AudioEngine& e, Session& session, FSTHandle* h) /* set rate and blocksize */ - _plugin->dispatcher (_plugin, effSetSampleRate, 0, 0, NULL, + _plugin->dispatcher (_plugin, effSetSampleRate, 0, 0, NULL, (float) session.frame_rate()); - _plugin->dispatcher (_plugin, effSetBlockSize, 0, + _plugin->dispatcher (_plugin, effSetBlockSize, 0, session.get_block_size(), NULL, 0.0f); - + /* set program to zero */ _plugin->dispatcher (_plugin, effSetProgram, 0, 0, NULL, 0.0f); - + // Plugin::setup_controls (); } @@ -95,7 +95,7 @@ VSTPlugin::VSTPlugin (const VSTPlugin &other) throw failed_constructor(); } _plugin = _fst->plugin; - + // Plugin::setup_controls (); } @@ -118,7 +118,7 @@ float VSTPlugin::default_value (uint32_t port) { return 0; -} +} void VSTPlugin::set_parameter (uint32_t which, float val) @@ -131,7 +131,7 @@ float VSTPlugin::get_parameter (uint32_t which) const { return _plugin->getParameter (_plugin, which); - + } uint32_t @@ -156,10 +156,10 @@ VSTPlugin::get_state() if (_plugin->flags & 32 /* effFlagsProgramsChunks */) { /* fetch the current chunk */ - + guchar* data; long data_size; - + if ((data_size = _plugin->dispatcher (_plugin, 23 /* effGetChunk */, 0, 0, &data, false)) == 0) { return *root; } @@ -173,7 +173,7 @@ VSTPlugin::get_state() g_free (encoded_data); root->add_child_nocopy (*chunk_node); - + } else { XMLNode* parameters = new XMLNode ("parameters"); @@ -210,7 +210,7 @@ VSTPlugin::set_state(const XMLNode& node) XMLNode* child; int ret = -1; - + if ((child = find_named_node (node, X_("chunk"))) != 0) { XMLPropertyList::const_iterator i; @@ -228,7 +228,7 @@ VSTPlugin::set_state(const XMLNode& node) } } else if ((child = find_named_node (node, X_("parameters"))) != 0) { - + XMLPropertyList::const_iterator i; for (i = child->properties().begin(); i != child->properties().end(); ++i) { @@ -274,28 +274,28 @@ VSTPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc) desc.lower = 0; desc.upper = 1.0; } - + if (prop.flags & kVstParameterUsesIntStep) { - + desc.step = prop.stepInteger; desc.smallstep = prop.stepInteger; desc.largestep = prop.stepInteger; - + } else if (prop.flags & kVstParameterUsesFloatStep) { - + desc.step = prop.stepFloat; desc.smallstep = prop.smallStepFloat; desc.largestep = prop.largeStepFloat; - + } else { - + float range = desc.upper - desc.lower; - + desc.step = range / 100.0f; desc.smallstep = desc.step / 2.0f; desc.largestep = desc.step * 10.0f; } - + desc.toggled = prop.flags & kVstParameterIsSwitch; desc.logarithmic = false; desc.sr_dependent = false; @@ -402,10 +402,10 @@ VSTPlugin::connect_and_run (BufferSet& bufs, outs[i] = bufs.get_audio(min((uint32_t) out_index, nbufs - 1)).data() + offset; /* unbelievably, several VST plugins still rely on Cubase - behaviour and do not silence the buffer in processReplacing + behaviour and do not silence the buffer in processReplacing when they have no output. */ - + // memset (outs[i], 0, sizeof (Sample) * nframes); out_index++; } @@ -414,7 +414,7 @@ VSTPlugin::connect_and_run (BufferSet& bufs, /* we already know it can support processReplacing */ _plugin->processReplacing (_plugin, ins, outs, nframes); - + return 0; } @@ -504,9 +504,9 @@ VSTPluginInfo::load (Session& session) if (Config->get_use_vst()) { FSTHandle* handle; - + handle = fst_load(path.c_str()); - + if ( (int)handle == -1) { error << string_compose(_("VST: cannot load module from \"%1\""), path) << endmsg; } else { @@ -519,7 +519,7 @@ VSTPluginInfo::load (Session& session) plugin->set_info(PluginInfoPtr(new VSTPluginInfo(*this))); return plugin; - } + } catch (failed_constructor &err) { return PluginPtr ((Plugin*) 0); diff --git a/libs/evoral/evoral/Control.hpp b/libs/evoral/evoral/Control.hpp index 806125d973..d79ef25b5a 100644 --- a/libs/evoral/evoral/Control.hpp +++ b/libs/evoral/evoral/Control.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -38,7 +38,7 @@ public: virtual void set_float(float val, bool to_list=false, FrameTime frame=0); virtual float get_float(bool from_list=false, FrameTime frame=0) const; - + /** Get the latest user-set value * (which may not equal get_value() when automation is playing back). diff --git a/libs/evoral/evoral/ControlList.hpp b/libs/evoral/evoral/ControlList.hpp index ce5a98261b..b4c8590cb6 100644 --- a/libs/evoral/evoral/ControlList.hpp +++ b/libs/evoral/evoral/ControlList.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -38,7 +38,7 @@ struct ControlEvent { : when (w), value (v), coeff (0) {} - ControlEvent (const ControlEvent& other) + ControlEvent (const ControlEvent& other) : when (other.when), value (other.value), coeff (0) { if (other.coeff) { @@ -49,11 +49,11 @@ struct ControlEvent { } ~ControlEvent() { if (coeff) delete[] coeff; } - + void create_coeffs() { if (!coeff) coeff = new double[4]; - + coeff[0] = coeff[1] = coeff[2] = coeff[3] = 0.0; } @@ -88,12 +88,12 @@ public: ControlList (const ControlList&); ControlList (const ControlList&, double start, double end); virtual ~ControlList(); - + virtual boost::shared_ptr<ControlList> create(Parameter id); - + ControlList& operator= (const ControlList&); bool operator== (const ControlList&); - + void freeze(); void thaw (); @@ -133,7 +133,7 @@ public: void clear (iterator, iterator); bool paste (ControlList&, double position, float times); - + void set_yrange (double min, double max) { _min_yval = min; _max_yval = max; @@ -180,7 +180,7 @@ public: } } - static inline bool time_comparator (const ControlEvent* a, const ControlEvent* b) { + static inline bool time_comparator (const ControlEvent* a, const ControlEvent* b) { return a->when < b->when; } @@ -209,7 +209,7 @@ public: /** Called by locked entry point and various private * locations where we already hold the lock. - * + * * FIXME: Should this be private? Curve needs it.. */ double unlocked_eval (double x) const; @@ -222,7 +222,7 @@ public: Curve& curve() { assert(_curve); return *_curve; } const Curve& curve() const { assert(_curve); return *_curve; } - + virtual void mark_dirty () const; enum InterpolationStyle { @@ -237,7 +237,7 @@ public: protected: /** Called by unlocked_eval() to handle cases of 3 or more control points. */ - double multipoint_eval (double x) const; + double multipoint_eval (double x) const; void build_search_cache_if_necessary(double start, double end) const; @@ -248,7 +248,7 @@ protected: bool erase_range_internal (double start, double end, EventList &); virtual void maybe_signal_changed (); - + void _x_scale (double factor); mutable LookupCache _lookup_cache; diff --git a/libs/evoral/evoral/ControlSet.hpp b/libs/evoral/evoral/ControlSet.hpp index e039332920..39c3eba344 100644 --- a/libs/evoral/evoral/ControlSet.hpp +++ b/libs/evoral/evoral/ControlSet.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -37,10 +37,10 @@ class ControlSet : public boost::noncopyable { public: ControlSet(); virtual ~ControlSet() {} - + virtual boost::shared_ptr<Evoral::Control> control_factory(const Evoral::Parameter& id) = 0; - + boost::shared_ptr<Control> control (const Parameter& id, bool create_if_missing=false); @@ -57,12 +57,12 @@ public: virtual void add_control(boost::shared_ptr<Control>); bool find_next_event(FrameTime start, FrameTime end, ControlEvent& ev) const; - + virtual bool controls_empty() const { return _controls.size() == 0; } virtual void clear_controls(); void what_has_data(std::set<Parameter>&) const; - + Glib::Mutex& control_lock() const { return _control_lock; } protected: diff --git a/libs/evoral/evoral/Curve.hpp b/libs/evoral/evoral/Curve.hpp index 7cfc6bcb69..096ace6c81 100644 --- a/libs/evoral/evoral/Curve.hpp +++ b/libs/evoral/evoral/Curve.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -35,7 +35,7 @@ public: void get_vector (double x0, double x1, float *arg, int32_t veclen); void solve (); - + void mark_dirty() const { _dirty = true; } private: diff --git a/libs/evoral/evoral/Event.hpp b/libs/evoral/evoral/Event.hpp index cc24ac87f7..2f53185c09 100644 --- a/libs/evoral/evoral/Event.hpp +++ b/libs/evoral/evoral/Event.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -29,7 +29,7 @@ /** If this is not defined, all methods of MidiEvent are RT safe * but MidiEvent will never deep copy and (depending on the scenario) - * may not be usable in STL containers, signals, etc. + * may not be usable in STL containers, signals, etc. */ #define EVORAL_EVENT_ALLOC 1 @@ -44,15 +44,15 @@ template<typename Time> struct Event { #ifdef EVORAL_EVENT_ALLOC Event(EventType type=0, Time time=0, uint32_t size=0, uint8_t* buf=NULL, bool alloc=false); - + /** Copy \a copy. - * + * * If \a alloc is true, the buffer will be copied and this method * is NOT REALTIME SAFE. Otherwise both events share a buffer and * memory management semantics are the caller's problem. */ Event(const Event& copy, bool alloc); - + ~Event(); inline const Event& operator=(const Event& copy) { @@ -90,7 +90,7 @@ struct Event { _size = copy._size; _buf = copy._buf; } - + inline void set(uint8_t* buf, uint32_t size, Time t) { if (_owns_buf) { if (_size < size) { @@ -128,11 +128,11 @@ struct Event { return true; } - + inline bool operator!=(const Event& other) const { return ! operator==(other); } inline bool owns_buffer() const { return _owns_buf; } - + inline void set_buffer(uint32_t size, uint8_t* buf, bool own) { if (_owns_buf) { free(_buf); @@ -154,7 +154,7 @@ struct Event { _size = size; } - + inline void clear() { _type = 0; _original_time = 0; diff --git a/libs/evoral/evoral/EventRingBuffer.hpp b/libs/evoral/evoral/EventRingBuffer.hpp index 1ff1a8fe15..714d8d6f4c 100644 --- a/libs/evoral/evoral/EventRingBuffer.hpp +++ b/libs/evoral/evoral/EventRingBuffer.hpp @@ -1,15 +1,15 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -44,7 +44,7 @@ public: {} size_t capacity() const { return _size; } - + bool peek_time(Time* time); uint32_t write(Time time, EventType type, uint32_t size, const uint8_t* buf); @@ -72,7 +72,7 @@ EventRingBuffer<Time>::read(Time* time, EventType* type, uint32_t* size, uint8_t success = RingBuffer<uint8_t>::full_read(sizeof(uint32_t), (uint8_t*)size); if (success) success = RingBuffer<uint8_t>::full_read(*size, buf); - + return success; } diff --git a/libs/evoral/evoral/EventSink.hpp b/libs/evoral/evoral/EventSink.hpp index 2fd2e7591a..3c44095816 100644 --- a/libs/evoral/evoral/EventSink.hpp +++ b/libs/evoral/evoral/EventSink.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/libs/evoral/evoral/MIDIEvent.hpp b/libs/evoral/evoral/MIDIEvent.hpp index f7df4980fe..fee07a41d7 100644 --- a/libs/evoral/evoral/MIDIEvent.hpp +++ b/libs/evoral/evoral/MIDIEvent.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -40,7 +40,7 @@ struct MIDIEvent : public Event<Time> { MIDIEvent(EventType type=0, Time time=0, uint32_t size=0, uint8_t* buf=NULL, bool alloc=false) : Event<Time>(type, time, size, buf, alloc) {} - + MIDIEvent(const Event<Time>& copy, bool alloc) : Event<Time>(copy, alloc) {} @@ -48,7 +48,7 @@ struct MIDIEvent : public Event<Time> { #ifdef EVORAL_MIDI_XML /** Event from XML ala http://www.midi.org/dtds/MIDIEvents10.dtd */ MIDIEvent(const XMLNode& event); - + /** Event to XML ala http://www.midi.org/dtds/MIDIEvents10.dtd */ boost::shared_ptr<XMLNode> to_xml() const; #endif @@ -70,7 +70,7 @@ struct MIDIEvent : public Event<Time> { inline uint8_t note() const { return (this->_buf[1]); } inline uint8_t velocity() const { return (this->_buf[2]); } inline void set_velocity(uint8_t value) { this->_buf[2] = value; } - inline void scale_velocity(float factor) { + inline void scale_velocity(float factor) { if (factor < 0) factor = 0; this->_buf[2] = (uint8_t) lrintf (this->_buf[2]*factor); if (this->_buf[2] > 127) this->_buf[2] = 127; diff --git a/libs/evoral/evoral/MIDIParameters.hpp b/libs/evoral/evoral/MIDIParameters.hpp index 1375100929..e1f11202a5 100644 --- a/libs/evoral/evoral/MIDIParameters.hpp +++ b/libs/evoral/evoral/MIDIParameters.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/libs/evoral/evoral/Note.hpp b/libs/evoral/evoral/Note.hpp index b636df46e2..6110ad42fe 100644 --- a/libs/evoral/evoral/Note.hpp +++ b/libs/evoral/evoral/Note.hpp @@ -1,22 +1,22 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef EVORAL_NOTE_HPP +#ifndef EVORAL_NOTE_HPP #define EVORAL_NOTE_HPP #include <stdint.h> @@ -38,9 +38,9 @@ public: const Note<Time>& operator=(const Note<Time>& copy); inline bool operator==(const Note<Time>& other) { - return musical_time_equal (time(), other.time()) && - note() == other.note() && - musical_time_equal (length(), other.length()) && + return musical_time_equal (time(), other.time()) && + note() == other.note() && + musical_time_equal (length(), other.length()) && velocity() == other.velocity() && channel() == other.channel(); } @@ -51,8 +51,8 @@ public: inline uint8_t velocity() const { return _on_event.velocity(); } inline Time length() const { return _off_event.time() - _on_event.time(); } inline uint8_t channel() const { - assert(_on_event.channel() == _off_event.channel()); - return _on_event.channel(); + assert(_on_event.channel() == _off_event.channel()); + return _on_event.channel(); } inline void set_time(Time t) { _off_event.time() = t + length(); _on_event.time() = t; } @@ -77,8 +77,8 @@ private: template<typename Time> std::ostream& operator<<(std::ostream& o, const Evoral::Note<Time>& n) { o << "Note: pitch = " << (int) n.note() - << " @ " << n.time() << " .. " << n.end_time() - << " velocity " << (int) n.velocity() + << " @ " << n.time() << " .. " << n.end_time() + << " velocity " << (int) n.velocity() << " chn " << (int) n.channel(); return o; } diff --git a/libs/evoral/evoral/OldSMF.hpp b/libs/evoral/evoral/OldSMF.hpp index 6f265cc313..0a92ac323d 100644 --- a/libs/evoral/evoral/OldSMF.hpp +++ b/libs/evoral/evoral/OldSMF.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright(C) 2008 Dave Robillard <http://drobilla.net> * Copyright(C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or(at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -20,7 +20,7 @@ #define EVORAL_OLD_SMF_HPP namespace Evoral { - + template<typename Time> class Event; template<typename Time> class EventRingBuffer; @@ -34,17 +34,17 @@ public: virtual ~SMF(); void seek_to_start() const; - + uint16_t ppqn() const { return _ppqn; } bool is_empty() const { return _empty; } bool eof() const { return feof(_fd); } - + Time last_event_time() const { return _last_ev_time; } - + void begin_write(); void append_event_delta(uint32_t delta_t, const Event<Time>& ev); void end_write() THROW_FILE_ERROR; - + void flush(); int flush_header(); int flush_footer(); @@ -52,13 +52,13 @@ public: protected: int open(const std::string& path) THROW_FILE_ERROR; void close() THROW_FILE_ERROR; - + int read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const; private: /** Used by flush_footer() to find the position to write the footer */ void seek_to_footer_position(); - + /** Write the track footer at the current seek position */ void write_footer(); diff --git a/libs/evoral/evoral/Parameter.hpp b/libs/evoral/evoral/Parameter.hpp index 48701c876f..8ffa5d30c7 100644 --- a/libs/evoral/evoral/Parameter.hpp +++ b/libs/evoral/evoral/Parameter.hpp @@ -2,16 +2,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -45,9 +45,9 @@ public: Parameter(uint32_t type, uint8_t channel=0, uint32_t id=0) : _type(type), _id(id), _channel(channel) {} - + virtual ~Parameter() {} - + inline uint32_t type() const { return _type; } inline uint8_t channel() const { return _channel; } inline uint32_t id() const { return _id; } @@ -60,26 +60,26 @@ public: inline bool operator==(const Parameter& id) const { return (_type == id._type && _channel == id._channel && _id == id._id ); } - + /** Strict weak ordering * See: http://www.sgi.com/tech/stl/StrictWeakOrdering.html * Sort Parameters first according to type then to id and lastly to channel. - * + * * Proof: * <ol> * <li>Irreflexivity: f(x, x) is false because of the irreflexivity of \c < in each branch.</li> - * <li>Antisymmetry: given x != y, f(x, y) implies !f(y, x) because of the same + * <li>Antisymmetry: given x != y, f(x, y) implies !f(y, x) because of the same * property of \c < in each branch and the symmetry of operator==. </li> * <li>Transitivity: let f(x, y) and f(y, z) => f(x, z) be true. * We prove by contradiction, assuming the contrary: - * f(x, y) and f(x, z) hold => !f(x, z) - * + * f(x, y) and f(x, z) hold => !f(x, z) + * * That implies one of the following: * <ol> * <li> x == z which contradicts the assumption f(x, y) and f(y, x) * because of antisymmetry. * </li> - * <li> f(z, x) is true. That would imply that one of the ivars (we call it i) + * <li> f(z, x) is true. That would imply that one of the ivars (we call it i) * of x is greater than the same ivar in z while all "previous" ivars * are equal. That would imply that also in y all those "previous" * ivars are equal and because if x.i > z.i it is impossible @@ -87,7 +87,7 @@ public: * time which contradicts the assumption. * </li> * Therefore f(x, z) is true (transitivity) - * </ol> + * </ol> * </li> * </ol> */ @@ -99,12 +99,12 @@ public: } else if (_type == other._type && _channel == other._channel && _id < other._id ) { return true; } - + return false; } - + inline operator bool() const { return (_type != 0); } - + /** Not used in indentity/comparison */ struct Metadata { Metadata(double low=0.0, double high=1.0, double mid=0.0) @@ -114,11 +114,11 @@ public: double max; double normal; }; - + inline static void set_range(uint32_t type, double min, double max, double normal) { _type_metadata[type] = Metadata(min, max, normal); } - + inline void set_range(double min, double max, double normal) { _metadata = boost::shared_ptr<Metadata>(new Metadata(min, max, normal)); } @@ -136,12 +136,12 @@ public: protected: // Default copy constructor is ok - + // ID (used in comparison) uint32_t _type; uint32_t _id; uint8_t _channel; - + boost::shared_ptr<Metadata> _metadata; typedef std::map<uint32_t, Metadata> TypeMetadata; diff --git a/libs/evoral/evoral/RingBuffer.hpp b/libs/evoral/evoral/RingBuffer.hpp index 3e47042679..37a7096511 100644 --- a/libs/evoral/evoral/RingBuffer.hpp +++ b/libs/evoral/evoral/RingBuffer.hpp @@ -1,15 +1,15 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -43,7 +43,7 @@ public: assert(read_space() == 0); assert(write_space() == size - 1); } - + virtual ~RingBuffer() { delete[] _buf; } @@ -61,7 +61,7 @@ public: size_t write_space() const { const size_t w = g_atomic_int_get(&_write_ptr); const size_t r = g_atomic_int_get(&_read_ptr); - + if (w > r) { return ((r - w + _size) % _size) - 1; } else if (w < r) { @@ -70,13 +70,13 @@ public: return _size - 1; } } - + /** Calculate how much still can be read */ size_t read_space() const { const size_t w = g_atomic_int_get(&_write_ptr); const size_t r = g_atomic_int_get(&_read_ptr); - + if (w > r) { return w - r; } else { @@ -89,7 +89,7 @@ public: size_t capacity() const { return _size; } /** Peek at the ringbuffer (read w/o advancing read pointer). - * @return how much has been peeked (read cannot exceed the end + * @return how much has been peeked (read cannot exceed the end * of the buffer): * <pre> * |-------------------------R=============================| @@ -109,7 +109,7 @@ public: bool full_peek(size_t size, Time* dst); /** Read from the ringbuffer. (advances read pointer) - * @return how much has been read (read cannot exceed the end + * @return how much has been read (read cannot exceed the end * of the buffer): */ size_t read(size_t size, Time* dst); @@ -123,13 +123,13 @@ public: /** Advance read pointer by size */ bool skip(size_t size); - + void write(size_t size, const Time* src); protected: mutable int _write_ptr; mutable int _read_ptr; - + size_t _size; ///< Size (capacity) in bytes Time* _buf; ///< size, event, size, event... }; @@ -138,7 +138,7 @@ protected: /** Peek at the ringbuffer (read w/o advancing read pointer). * * Note that a full read may not be done if the data wraps around. - * Caller must check return value and call again if necessary, or use the + * Caller must check return value and call again if necessary, or use the * full_peek method which does this automatically. */ template<typename Time> @@ -150,7 +150,7 @@ RingBuffer<Time>::peek(size_t size, Time* dst) const size_t read_size = (priv_read_ptr + size < _size) ? size : _size - priv_read_ptr; - + memcpy(dst, &_buf[priv_read_ptr], read_size); return read_size; @@ -166,7 +166,7 @@ RingBuffer<Time>::full_peek(size_t size, Time* dst) } const size_t read_size = peek(size, dst); - + if (read_size < size) { peek(size - read_size, dst + read_size); } @@ -178,7 +178,7 @@ RingBuffer<Time>::full_peek(size_t size, Time* dst) /** Read from the ringbuffer. * * Note that a full read may not be done if the data wraps around. - * Caller must check return value and call again if necessary, or use the + * Caller must check return value and call again if necessary, or use the * full_read method which does this automatically. */ template<typename Time> @@ -190,9 +190,9 @@ RingBuffer<Time>::read(size_t size, Time* dst) const size_t read_size = (priv_read_ptr + size < _size) ? size : _size - priv_read_ptr; - + memcpy(dst, &_buf[priv_read_ptr], read_size); - + g_atomic_int_set(&_read_ptr, (priv_read_ptr + read_size) % _size); return read_size; @@ -208,7 +208,7 @@ RingBuffer<Time>::full_read(size_t size, Time* dst) } const size_t read_size = read(size, dst); - + if (read_size < size) { read(size - read_size, dst + read_size); } @@ -225,7 +225,7 @@ RingBuffer<Time>::skip(size_t size) std::cerr << "WARNING: Attempt to skip past end of MIDI ring buffer" << std::endl; return false; } - + const size_t priv_read_ptr = g_atomic_int_get(&_read_ptr); g_atomic_int_set(&_read_ptr, (priv_read_ptr + size) % _size); @@ -238,7 +238,7 @@ inline void RingBuffer<Time>::write(size_t size, const Time* src) { const size_t priv_write_ptr = g_atomic_int_get(&_write_ptr); - + if (priv_write_ptr + size <= _size) { memcpy(&_buf[priv_write_ptr], src, size); g_atomic_int_set(&_write_ptr, (priv_write_ptr + size) % _size); @@ -252,7 +252,7 @@ RingBuffer<Time>::write(size_t size, const Time* src) } } - + } // namespace Evoral #endif // EVORAL_RING_BUFFER_HPP diff --git a/libs/evoral/evoral/SMF.hpp b/libs/evoral/evoral/SMF.hpp index b921a80e6d..e9c4a0fc49 100644 --- a/libs/evoral/evoral/SMF.hpp +++ b/libs/evoral/evoral/SMF.hpp @@ -2,16 +2,16 @@ * Copyright(C) 2008 Dave Robillard <http://drobilla.net> * Copyright(C) 2000-2008 Paul Davis * Author: Hans Baier - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or(at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -28,7 +28,7 @@ typedef smf_struct smf_t; typedef smf_track_struct smf_track_t; namespace Evoral { - + #define THROW_FILE_ERROR throw(FileError) /** Standard Midi File. @@ -42,26 +42,26 @@ public: SMF() : _smf(0), _smf_track(0), _empty(true) {}; virtual ~SMF(); - + int open(const std::string& path, int track=1) THROW_FILE_ERROR; int create(const std::string& path, int track=1, uint16_t ppqn=19200) THROW_FILE_ERROR; void close() THROW_FILE_ERROR; - + const std::string& file_path() const { return _file_path; }; void seek_to_start() const; int seek_to_track(int track); - + int read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const; - + uint16_t num_tracks() const; uint16_t ppqn() const; bool is_empty() const { return _empty; } - + void begin_write(); void append_event_delta(uint32_t delta_t, uint32_t size, const uint8_t* buf); void end_write() THROW_FILE_ERROR; - + void flush() {}; double round_to_file_precision (double val) const; diff --git a/libs/evoral/evoral/SMFReader.hpp b/libs/evoral/evoral/SMFReader.hpp index b977f71dca..7009ca16b1 100644 --- a/libs/evoral/evoral/SMFReader.hpp +++ b/libs/evoral/evoral/SMFReader.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright(C) 2008 Dave Robillard <http://drobilla.net> * Copyright(C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or(at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -49,21 +49,21 @@ public: bool open(const std::string& filename) throw (std::logic_error, UnsupportedTime); bool seek_to_track(unsigned track) throw (std::logic_error); - + const std::string& filename() const { return _filename; }; uint16_t type() const { return _type; } uint16_t ppqn() const { return _ppqn; } uint16_t num_tracks() const { return _num_tracks; } - + int read_event(size_t buf_len, uint8_t* buf, uint32_t* ev_size, uint32_t* ev_delta_time) throw (std::logic_error, PrematureEOF, CorruptFile); - + void close(); - + static uint32_t read_var_len(FILE* fd) throw (PrematureEOF); protected: diff --git a/libs/evoral/evoral/Sequence.hpp b/libs/evoral/evoral/Sequence.hpp index df8c48a1b6..026a8ab74f 100644 --- a/libs/evoral/evoral/Sequence.hpp +++ b/libs/evoral/evoral/Sequence.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -58,11 +58,11 @@ public: /** This is a higher level view of events, with separate representations for * notes (instead of just unassociated note on/off events) and controller data. * Controller data is represented as a list of time-stamped float values. */ -template<typename Time> +template<typename Time> class Sequence : virtual public ControlSet { public: Sequence(const TypeMap& type_map, size_t size=0); - + void write_lock(); void write_unlock(); @@ -80,7 +80,7 @@ public: /** Resizes vector if necessary (NOT realtime safe) */ void append(const Event<Time>& ev); - + inline const boost::shared_ptr< const Note<Time> > note_at(size_t i) const { return _notes[i]; } inline const boost::shared_ptr< Note<Time> > note_at(size_t i) { return _notes[i]; } @@ -88,14 +88,14 @@ public: inline bool empty() const { return _notes.size() == 0 && ControlSet::controls_empty(); } inline static bool note_time_comparator(const boost::shared_ptr< const Note<Time> >& a, - const boost::shared_ptr< const Note<Time> >& b) { + const boost::shared_ptr< const Note<Time> >& b) { return a->time() < b->time(); } struct LaterNoteComparator { typedef const Note<Time>* value_type; inline bool operator()(const boost::shared_ptr< const Note<Time> > a, - const boost::shared_ptr< const Note<Time> > b) const { + const boost::shared_ptr< const Note<Time> > b) const { return a->time() > b->time(); } }; @@ -103,7 +103,7 @@ public: struct LaterNoteEndComparator { typedef const Note<Time>* value_type; inline bool operator()(const boost::shared_ptr< const Note<Time> > a, - const boost::shared_ptr< const Note<Time> > b) const { + const boost::shared_ptr< const Note<Time> > b) const { return a->end_time() > b->end_time(); } }; @@ -131,10 +131,10 @@ public: const_iterator(); const_iterator(const Sequence<Time>& seq, Time t); ~const_iterator(); - + inline bool valid() const { return !_is_end && _event; } inline bool locked() const { return _locked; } - + void invalidate(); const Event<Time>& operator*() const { return *_event; } @@ -145,12 +145,12 @@ public: bool operator==(const const_iterator& other) const; bool operator!=(const const_iterator& other) const { return ! operator==(other); } - + const_iterator& operator=(const const_iterator& other); private: friend class Sequence<Time>; - + typedef std::vector<ControlIterator> ControlIterators; enum MIDIMessageType { NIL, NOTE_ON, NOTE_OFF, CONTROL, SYSEX }; @@ -165,28 +165,28 @@ public: ControlIterators _control_iters; ControlIterators::iterator _control_iter; }; - + const_iterator begin(Time t=0) const { return const_iterator(*this, t); } const const_iterator& end() const { return _end_iter; } - + bool control_to_midi_event(boost::shared_ptr< Event<Time> >& ev, const ControlIterator& iter) const; - + bool edited() const { return _edited; } void set_edited(bool yn) { _edited = yn; } void add_note_unlocked(const boost::shared_ptr< Note<Time> > note); void remove_note_unlocked(const boost::shared_ptr< const Note<Time> > note); - + uint8_t lowest_note() const { return _lowest_note; } uint8_t highest_note() const { return _highest_note; } - + protected: bool _edited; private: friend class const_iterator; - + void append_note_on_unlocked(uint8_t chan, Time time, uint8_t note, uint8_t velocity); void append_note_off_unlocked(uint8_t chan, Time time, uint8_t note); void append_control_unlocked(const Parameter& param, Time time, double value); @@ -195,14 +195,14 @@ private: mutable Glib::RWLock _lock; const TypeMap& _type_map; - + Notes _notes; SysExes _sysexes; - + typedef std::vector<size_t> WriteNotes; WriteNotes _write_notes[16]; bool _writing; - + typedef std::vector< boost::shared_ptr<const ControlList> > ControlLists; ControlLists _dirty_controls; diff --git a/libs/evoral/evoral/TimeConverter.hpp b/libs/evoral/evoral/TimeConverter.hpp index eabe0e4762..9c53d0370c 100644 --- a/libs/evoral/evoral/TimeConverter.hpp +++ b/libs/evoral/evoral/TimeConverter.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2009 Dave Robillard <http://drobilla.net> * Copyright (C) 2009 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -33,7 +33,7 @@ public: /** Convert A time to B time (A to B) */ virtual B to(A a) const = 0; - + /** Convert B time to A time (A from B) */ virtual A from(B b) const = 0; }; diff --git a/libs/evoral/evoral/TypeMap.hpp b/libs/evoral/evoral/TypeMap.hpp index 642735134d..baf9b2b487 100644 --- a/libs/evoral/evoral/TypeMap.hpp +++ b/libs/evoral/evoral/TypeMap.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -41,11 +41,11 @@ public: * parameter, or 0 if parameter can not be expressed as a MIDI event */ virtual uint8_t parameter_midi_type(const Parameter& param) const = 0; - + /** The type ID for a MIDI event with the given status byte */ virtual uint32_t midi_event_type(uint8_t status) const = 0; - + /** Return true iff parameter should be locked to integer boundaries */ virtual bool is_integer(const Evoral::Parameter& param) const = 0; diff --git a/libs/evoral/evoral/midi_util.h b/libs/evoral/evoral/midi_util.h index 6dee894546..27049f5c8a 100644 --- a/libs/evoral/evoral/midi_util.h +++ b/libs/evoral/evoral/midi_util.h @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright(C) 2008 Dave Robillard <http://drobilla.net> * Copyright(C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or(at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -64,7 +64,7 @@ midi_event_size(uint8_t status) case MIDI_CMD_COMMON_SENSING: case MIDI_CMD_COMMON_RESET: return 1; - + case MIDI_CMD_COMMON_SYSEX: return -1; } @@ -79,7 +79,7 @@ static inline int midi_event_size(const uint8_t* buffer) { uint8_t status = buffer[0]; - + // Mask off channel if applicable if (status >= 0x80 && status < 0xF0) { status &= 0xF0; diff --git a/libs/evoral/evoral/types.hpp b/libs/evoral/evoral/types.hpp index 9e48a68e3c..06f29b341e 100644 --- a/libs/evoral/evoral/types.hpp +++ b/libs/evoral/evoral/types.hpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -33,13 +33,13 @@ typedef double MusicalTime; static inline bool musical_time_equal (MusicalTime a, MusicalTime b) { /* acceptable tolerance is 1 tick. Nice if there was no magic number here */ - return fabs (a - b) <= (1.0/1920.0); + return fabs (a - b) <= (1.0/1920.0); } /** Type of an event (opaque, mapped by application) */ typedef uint32_t EventType; -/** Type to describe the movement of a time range */ +/** Type to describe the movement of a time range */ template<typename T> struct RangeMove { RangeMove (T f, FrameTime l, T t) : from (f), length (l), to (t) {} diff --git a/libs/evoral/src/Control.cpp b/libs/evoral/src/Control.cpp index 079bd2929e..6824dc7f5a 100644 --- a/libs/evoral/src/Control.cpp +++ b/libs/evoral/src/Control.cpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -48,7 +48,7 @@ void Control::set_float(float value, bool to_list, FrameTime frame) { _user_value = value; - + if (to_list) _list->add(frame, value); } diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp index 82cd87ed1e..bb348625e6 100644 --- a/libs/evoral/src/ControlList.cpp +++ b/libs/evoral/src/ControlList.cpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -38,7 +38,7 @@ ControlList::ControlList (const Parameter& id) : _parameter(id) , _interpolation(Linear) , _curve(0) -{ +{ _frozen = 0; _changed_when_thawed = false; _min_yval = id.min(); @@ -72,7 +72,7 @@ ControlList::ControlList (const ControlList& other) for (const_iterator i = other._events.begin(); i != other._events.end(); ++i) { _events.push_back (new ControlEvent (**i)); } - + mark_dirty (); } @@ -101,7 +101,7 @@ ControlList::ControlList (const ControlList& other, double start, double end) _events.push_back (new ControlEvent ((*i)->when, (*i)->value)); } } - + mark_dirty (); } @@ -130,18 +130,18 @@ ControlList& ControlList::operator= (const ControlList& other) { if (this != &other) { - + _events.clear (); - + for (const_iterator i = other._events.begin(); i != other._events.end(); ++i) { _events.push_back (new ControlEvent (**i)); } - + _min_yval = other._min_yval; _max_yval = other._max_yval; _max_xval = other._max_xval; _default_value = other._default_value; - + mark_dirty (); maybe_signal_changed (); } @@ -166,7 +166,7 @@ void ControlList::maybe_signal_changed () { mark_dirty (); - + if (_frozen) _changed_when_thawed = true; } @@ -265,16 +265,16 @@ ControlList::rt_add (double when, double value) where = after; } - + iterator previous = _rt_insertion_point; --previous; - + if (_rt_insertion_point != _events.begin() && (*_rt_insertion_point)->value == value && (*previous)->value == value) { (*_rt_insertion_point)->when = when; done = true; - + } - + } else { where = lower_bound (_events.begin(), _events.end(), &cp, time_comparator); @@ -290,7 +290,7 @@ ControlList::rt_add (double when, double value) if (!done) { _rt_insertion_point = _events.insert (where, new ControlEvent (when, value)); } - + _new_value = false; mark_dirty (); } @@ -325,7 +325,7 @@ ControlList::add (double when, double value) (*insertion_point)->value = value; insert = false; break; - } + } if ((*insertion_point)->when >= when) { break; @@ -333,11 +333,11 @@ ControlList::add (double when, double value) } if (insert) { - + _events.insert (insertion_point, new ControlEvent (when, value)); reposition_for_rt_add (0); - } + } mark_dirty (); } @@ -367,7 +367,7 @@ ControlList::erase (iterator start, iterator end) mark_dirty (); } maybe_signal_changed (); -} +} void ControlList::reset_range (double start, double endt) @@ -379,7 +379,7 @@ ControlList::reset_range (double start, double endt) ControlEvent cp (start, 0.0f); iterator s; iterator e; - + if ((s = lower_bound (_events.begin(), _events.end(), &cp, time_comparator)) != _events.end()) { cp.when = endt; @@ -388,7 +388,7 @@ ControlList::reset_range (double start, double endt) for (iterator i = s; i != e; ++i) { (*i)->value = _default_value; } - + reset = true; mark_dirty (); @@ -413,7 +413,7 @@ ControlList::erase_range (double start, double endt) reposition_for_rt_add (0); mark_dirty (); } - + } if (erased) { @@ -448,7 +448,7 @@ ControlList::slide (iterator before, double distance) if (before == _events.end()) { return; } - + while (before != _events.end()) { (*before)->when += distance; ++before; @@ -500,7 +500,7 @@ ControlList::control_points_adjacent (double xval) ret.second = _events.end(); for (i = lower_bound (_events.begin(), _events.end(), &cp, time_comparator); i != _events.end(); ++i) { - + if (ret.first == _events.end()) { if ((*i)->when >= xval) { if (i != _events.begin()) { @@ -510,8 +510,8 @@ ControlList::control_points_adjacent (double xval) return ret; } } - } - + } + if ((*i)->when > xval) { ret.second = i; break; @@ -552,7 +552,7 @@ ControlList::thaw () } } -void +void ControlList::mark_dirty () const { _lookup_cache.left = -1; @@ -579,7 +579,7 @@ ControlList::truncate_end (double last_coordinate) } if (last_coordinate > _events.back()->when) { - + /* extending end: */ @@ -607,7 +607,7 @@ ControlList::truncate_end (double last_coordinate) iterator penultimate = _events.end(); --penultimate; /* points at last point */ --penultimate; /* points at the penultimate point */ - + if (_events.back()->value == (*penultimate)->value) { _events.back()->when = last_coordinate; } else { @@ -622,13 +622,13 @@ ControlList::truncate_end (double last_coordinate) last_val = unlocked_eval (last_coordinate); last_val = max ((double) _min_yval, last_val); last_val = min ((double) _max_yval, last_val); - + i = _events.rbegin(); - + /* make i point to the last control point */ - + ++i; - + /* now go backwards, removing control points that are beyond the new last coordinate. */ @@ -636,23 +636,23 @@ ControlList::truncate_end (double last_coordinate) // FIXME: SLOW! (size() == O(n)) uint32_t sz = _events.size(); - + while (i != _events.rend() && sz > 2) { ControlList::reverse_iterator tmp; - + tmp = i; ++tmp; - + if ((*i)->when < last_coordinate) { break; } - + _events.erase (i.base()); --sz; i = tmp; } - + _events.back()->when = last_coordinate; _events.back()->value = last_val; } @@ -674,14 +674,14 @@ ControlList::truncate_start (double overall_length) double first_legal_coordinate; assert(!_events.empty()); - + if (overall_length == _events.back()->when) { /* no change in overall length */ return; } - + if (overall_length > _events.back()->when) { - + /* growing at front: duplicate first point. shift all others */ double shift = overall_length - _events.back()->when; @@ -705,7 +705,7 @@ ControlList::truncate_start (double overall_length) iterator second = _events.begin(); ++second; /* points at the second point */ - + if (_events.front()->value == (*second)->value) { /* first segment is flat, just move start point back to zero */ _events.front()->when = 0; @@ -718,7 +718,7 @@ ControlList::truncate_start (double overall_length) } else { /* shrinking at front */ - + first_legal_coordinate = _events.back()->when - overall_length; first_legal_value = unlocked_eval (first_legal_coordinate); first_legal_value = max (_min_yval, first_legal_value); @@ -727,35 +727,35 @@ ControlList::truncate_start (double overall_length) /* remove all events earlier than the new "front" */ i = _events.begin(); - + while (i != _events.end() && !_events.empty()) { ControlList::iterator tmp; - + tmp = i; ++tmp; - + if ((*i)->when > first_legal_coordinate) { break; } - + _events.erase (i); - + i = tmp; } - + /* shift all remaining points left to keep their same relative position */ - + for (i = _events.begin(); i != _events.end(); ++i) { (*i)->when -= first_legal_coordinate; } /* add a new point for the interpolated new value */ - + _events.push_front (new ControlEvent (0, first_legal_value)); - } + } reposition_for_rt_add (0); @@ -787,7 +787,7 @@ ControlList::unlocked_eval (double x) const case 1: return _events.front()->value; - + case 2: if (x >= _events.back()->when) { return _events.back()->value; @@ -799,7 +799,7 @@ ControlList::unlocked_eval (double x) const lval = _events.front()->value; upos = _events.back()->when; uval = _events.back()->value; - + if (_interpolation == Discrete) { return lval; } @@ -828,7 +828,7 @@ ControlList::multipoint_eval (double x) const double upos, lpos; double uval, lval; double fraction; - + /* "Stepped" lookup (no interpolation) */ /* FIXME: no cache. significant? */ if (_interpolation == Discrete) { @@ -847,15 +847,15 @@ ControlList::multipoint_eval (double x) const /* Only do the range lookup if x is in a different range than last time * this was called (or if the lookup cache has been marked "dirty" (left<0) */ if ((_lookup_cache.left < 0) || - ((_lookup_cache.left > x) || - (_lookup_cache.range.first == _events.end()) || + ((_lookup_cache.left > x) || + (_lookup_cache.range.first == _events.end()) || ((*_lookup_cache.range.second)->when < x))) { const ControlEvent cp (x, 0); - + _lookup_cache.range = equal_range (_events.begin(), _events.end(), &cp, time_comparator); } - + pair<const_iterator,const_iterator> range = _lookup_cache.range; if (range.first == range.second) { @@ -873,7 +873,7 @@ ControlList::multipoint_eval (double x) const // return _default_value; return _events.front()->value; } - + if (range.second == _events.end()) { /* we're after the last point */ return _events.back()->value; @@ -881,7 +881,7 @@ ControlList::multipoint_eval (double x) const upos = (*range.second)->when; uval = (*range.second)->value; - + /* linear interpolation betweeen the two points on either side of x */ @@ -889,7 +889,7 @@ ControlList::multipoint_eval (double x) const fraction = (double) (x - lpos) / (double) (upos - lpos); return lval + (fraction * (uval - lval)); - } + } /* x is a control point in the data */ _lookup_cache.left = -1; @@ -936,7 +936,7 @@ ControlList::rt_safe_earliest_event(double start, double end, double& x, double& } return rt_safe_earliest_event_unlocked(start, end, x, y, inclusive); -} +} /** Get the earliest event between \a start and \a end, using the current interpolation style. @@ -953,7 +953,7 @@ ControlList::rt_safe_earliest_event_unlocked(double start, double end, double& x return rt_safe_earliest_event_discrete_unlocked(start, end, x, y, inclusive); else return rt_safe_earliest_event_linear_unlocked(start, end, x, y, inclusive); -} +} /** Get the earliest event between \a start and \a end (Discrete (lack of) interpolation) @@ -993,7 +993,7 @@ ControlList::rt_safe_earliest_event_discrete_unlocked (double start, double end, } else { return false; } - + /* No points in range */ } else { return false; @@ -1021,7 +1021,7 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double end, d // Hack to avoid infinitely repeating the same event build_search_cache_if_necessary(start, end); - + pair<const_iterator,const_iterator> range = _search_cache.range; if (range.first != _events.end()) { @@ -1046,7 +1046,7 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double end, d first = *prev; next = *range.first; } - + if (inclusive && first->when == start) { x = first->when; y = first->value; @@ -1057,7 +1057,7 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double end, d assert(x >= start); return true; } - + if (fabs(first->value - next->value) <= 1) { if (next->when <= end && (next->when > start)) { x = next->when; @@ -1085,9 +1085,9 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double end, d y = floor(y); x = first->when + (y - first->value) / (double)slope; - + while ((inclusive && x < start) || (x <= start && y != next->value)) { - + if (first->value < next->value) // ramping up y += 1.0; else // ramping down @@ -1103,7 +1103,7 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double end, d assert( (y >= first->value && y <= next->value) || (y <= first->value && y >= next->value) ); - + const bool past_start = (inclusive ? x >= start : x > start); if (past_start && x < end) { /* Move left of cache to this point @@ -1114,7 +1114,7 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double end, d } else { return false; } - + /* No points in the future, so no steps (towards them) in the future */ } else { return false; @@ -1131,13 +1131,13 @@ ControlList::cut (iterator start, iterator end) for (iterator x = start; x != end; ) { iterator tmp; - + tmp = x; ++tmp; - + nal->_events.push_back (new ControlEvent (**x)); _events.erase (x); - + reposition_for_rt_add (0); x = tmp; @@ -1158,7 +1158,7 @@ ControlList::cut_copy_clear (double start, double end, int op) iterator s, e; ControlEvent cp (start, 0.0); bool changed = false; - + { Glib::Mutex::Lock lm (_lock); @@ -1175,16 +1175,16 @@ ControlList::cut_copy_clear (double start, double end, int op) for (iterator x = s; x != e; ) { iterator tmp; - + tmp = x; ++tmp; changed = true; - + /* adjust new points to be relative to start, which has been set to zero. */ - + if (op != 2) { nal->_events.push_back (new ControlEvent ((*x)->when - start, (*x)->value)); } @@ -1192,7 +1192,7 @@ ControlList::cut_copy_clear (double start, double end, int op) if (op != 1) { _events.erase (x); } - + x = tmp; } @@ -1220,15 +1220,15 @@ ControlList::copy (iterator start, iterator end) { Glib::Mutex::Lock lm (_lock); - + for (iterator x = start; x != end; ) { iterator tmp; - + tmp = x; ++tmp; - + nal->_events.push_back (new ControlEvent (**x)); - + x = tmp; } } @@ -1274,9 +1274,9 @@ ControlList::paste (ControlList& alist, double pos, float /*times*/) _events.insert (where, new ControlEvent( (*i)->when+pos,( *i)->value)); end = (*i)->when + pos; } - - - /* move all points after the insertion along the timeline by + + + /* move all points after the insertion along the timeline by the correct amount. */ diff --git a/libs/evoral/src/ControlSet.cpp b/libs/evoral/src/ControlSet.cpp index 4a583b5a55..0ccefdc284 100644 --- a/libs/evoral/src/ControlSet.cpp +++ b/libs/evoral/src/ControlSet.cpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -72,22 +72,22 @@ ControlSet::control (const Parameter& parameter, bool create_if_missing) bool ControlSet::find_next_event (FrameTime now, FrameTime end, ControlEvent& next_event) const { - Controls::const_iterator li; + Controls::const_iterator li; next_event.when = std::numeric_limits<FrameTime>::max(); - + for (li = _controls.begin(); li != _controls.end(); ++li) { ControlList::const_iterator i; boost::shared_ptr<const ControlList> alist (li->second->list()); ControlEvent cp (now, 0.0f); - + for (i = lower_bound (alist->begin(), alist->end(), &cp, ControlList::time_comparator); i != alist->end() && (*i)->when < end; ++i) { if ((*i)->when > now) { - break; + break; } } - + if (i != alist->end() && (*i)->when < end) { if ((*i)->when < next_event.when) { next_event.when = (*i)->when; diff --git a/libs/evoral/src/Curve.cpp b/libs/evoral/src/Curve.cpp index 2ae79a3917..92633688ac 100644 --- a/libs/evoral/src/Curve.cpp +++ b/libs/evoral/src/Curve.cpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -48,9 +48,9 @@ Curve::solve () if (!_dirty) { return; } - + if ((npoints = _list.events().size()) > 2) { - + /* Compute coefficients needed to efficiently compute a constrained spline curve. See "Constrained Cubic Spline Interpolation" by CJC Kruger (www.korf.co.uk/spline.pdf) for more details. @@ -80,7 +80,7 @@ Curve::solve () double fplast = 0; for (i = 0, xx = _list.events().begin(); xx != _list.events().end(); ++xx, ++i) { - + double xdelta; /* gcc is wrong about possible uninitialized use */ double xdelta2; /* ditto */ double ydelta; /* ditto */ @@ -94,11 +94,11 @@ Curve::solve () } /* compute (constrained) first derivatives */ - + if (i == 0) { /* first segment */ - + fplast = ((3 * (y[1] - y[0]) / (2 * (x[1] - x[0]))) - (fpone * 0.5)); /* we don't store coefficients for i = 0 */ @@ -110,7 +110,7 @@ Curve::solve () /* last segment */ fpi = ((3 * ydelta) / (2 * xdelta)) - (fplast * 0.5); - + } else { /* all other segments */ @@ -124,32 +124,32 @@ Curve::solve () } else { fpi = 2 / (slope_before + slope_after); } - + } /* compute second derivative for either side of control point `i' */ - + fppL = (((-2 * (fpi + (2 * fplast))) / (xdelta))) + ((6 * ydelta) / xdelta2); - + fppR = (2 * ((2 * fpi) + fplast) / xdelta) - ((6 * ydelta) / xdelta2); - + /* compute polynomial coefficients */ double b, c, d; - d = (fppR - fppL) / (6 * xdelta); + d = (fppR - fppL) / (6 * xdelta); c = ((x[i] * fppL) - (x[i-1] * fppR))/(2 * xdelta); - + double xim12, xim13; double xi2, xi3; - + xim12 = x[i-1] * x[i-1]; /* "x[i-1] squared" */ xim13 = xim12 * x[i-1]; /* "x[i-1] cubed" */ xi2 = x[i] * x[i]; /* "x[i] squared" */ xi3 = xi2 * x[i]; /* "x[i] cubed" */ - + b = (ydelta - (c * (xi2 - xim12)) - (d * (xi3 - xim13))) / xdelta; /* store */ @@ -162,7 +162,7 @@ Curve::solve () fplast = fpi; } - + } _dirty = false; @@ -220,13 +220,13 @@ Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen) if (x0 < min_x) { - /* fill some beginning section of the array with the - initial (used to be default) value + /* fill some beginning section of the array with the + initial (used to be default) value */ double frac = (min_x - x0) / (x1 - x0); int32_t subveclen = (int32_t) floor (veclen * frac); - + subveclen = min (subveclen, veclen); for (i = 0; i < subveclen; ++i) { @@ -246,7 +246,7 @@ Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen) int32_t subveclen = (int32_t) floor (original_veclen * frac); float val; - + subveclen = min (subveclen, veclen); val = _list.events().back()->value; @@ -265,42 +265,42 @@ Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen) } if (npoints == 1 ) { - + for (i = 0; i < veclen; ++i) { vec[i] = _list.events().front()->value; } return; } - - + + if (npoints == 2) { - + /* linear interpolation between 2 points */ - + /* XXX I'm not sure that this is the right thing to do here. but its not a common case for the envisaged uses. */ - + if (veclen > 1) { dx = (hx - lx) / (veclen - 1) ; } else { dx = 0; // not used } - - double slope = (_list.events().back()->value - _list.events().front()->value)/ + + double slope = (_list.events().back()->value - _list.events().front()->value)/ (_list.events().back()->when - _list.events().front()->when); double yfrac = dx*slope; - + vec[0] = _list.events().front()->value + slope * (lx - _list.events().front()->when); - + for (i = 1; i < veclen; ++i) { vec[i] = vec[i-1] + yfrac; } - + return; } - + if (_dirty) { solve (); } @@ -331,16 +331,16 @@ Curve::unlocked_eval (double x) double Curve::multipoint_eval (double x) -{ +{ pair<ControlList::EventList::const_iterator,ControlList::EventList::const_iterator> range; ControlList::LookupCache& lookup_cache = _list.lookup_cache(); if ((lookup_cache.left < 0) || - ((lookup_cache.left > x) || - (lookup_cache.range.first == _list.events().end()) || + ((lookup_cache.left > x) || + (lookup_cache.range.first == _list.events().end()) || ((*lookup_cache.range.second)->when < x))) { - + ControlEvent cp (x, 0.0); lookup_cache.range = equal_range (_list.events().begin(), _list.events().end(), &cp, ControlList::time_comparator); @@ -348,21 +348,21 @@ Curve::multipoint_eval (double x) range = lookup_cache.range; - /* EITHER - + /* EITHER + a) x is an existing control point, so first == existing point, second == next point OR b) x is between control points, so range is empty (first == second, points to where to insert x) - + */ if (range.first == range.second) { /* x does not exist within the list as a control point */ - + lookup_cache.left = x; if (range.first == _list.events().begin()) { @@ -370,7 +370,7 @@ Curve::multipoint_eval (double x) // return default_value; _list.events().front()->value; } - + if (range.second == _list.events().end()) { /* we're after the last point */ return _list.events().back()->value; @@ -380,7 +380,7 @@ Curve::multipoint_eval (double x) ControlEvent* ev = *range.second; return ev->coeff[0] + (ev->coeff[1] * x) + (ev->coeff[2] * x2) + (ev->coeff[3] * x2 * x); - } + } /* x is a control point in the data */ /* invalidate the cached range because its not usable */ @@ -392,7 +392,7 @@ Curve::multipoint_eval (double x) extern "C" { -void +void curve_get_vector_from_c (void *arg, double x0, double x1, float* vec, int32_t vecsize) { static_cast<Evoral::Curve*>(arg)->get_vector (x0, x1, vec, vecsize); diff --git a/libs/evoral/src/Event.cpp b/libs/evoral/src/Event.cpp index d70ba1a04b..b64ab7347c 100644 --- a/libs/evoral/src/Event.cpp +++ b/libs/evoral/src/Event.cpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/libs/evoral/src/MIDIEvent.cpp b/libs/evoral/src/MIDIEvent.cpp index 4af451a3b1..9793b31476 100644 --- a/libs/evoral/src/MIDIEvent.cpp +++ b/libs/evoral/src/MIDIEvent.cpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -29,16 +29,16 @@ namespace Evoral { #ifdef EVORAL_MIDI_XML template<typename Time> -MIDIEvent<Time>::MIDIEvent(const XMLNode& event) +MIDIEvent<Time>::MIDIEvent(const XMLNode& event) : Event<Time>() { string name = event.name(); - + if (name == "ControlChange") { this->_buf = (uint8_t*) ::malloc(3); this->_owns_buf = true; set_type(MIDI_CMD_CONTROL); - + set_cc_number(atoi(event.property("Control")->value().c_str())); set_cc_value (atoi(event.property("Value")->value().c_str())); } else if (name == "ProgramChange") { @@ -52,11 +52,11 @@ MIDIEvent<Time>::MIDIEvent(const XMLNode& event) template<typename Time> -boost::shared_ptr<XMLNode> +boost::shared_ptr<XMLNode> MIDIEvent<Time>::to_xml() const { XMLNode *result = 0; - + switch (type()) { case MIDI_CMD_CONTROL: result = new XMLNode("ControlChange"); @@ -64,18 +64,18 @@ MIDIEvent<Time>::to_xml() const result->add_property("Control", cc_number()); result->add_property("Value", cc_value()); break; - + case MIDI_CMD_PGM_CHANGE: result = new XMLNode("ProgramChange"); result->add_property("Channel", channel()); result->add_property("Number", pgm_number()); break; - + default: // The implementation is continued as needed break; } - + return boost::shared_ptr<XMLNode>(result); } diff --git a/libs/evoral/src/Note.cpp b/libs/evoral/src/Note.cpp index d97cfef429..ead5d1eff5 100644 --- a/libs/evoral/src/Note.cpp +++ b/libs/evoral/src/Note.cpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -33,11 +33,11 @@ Note<Time>::Note(uint8_t chan, Time t, Time l, uint8_t n, uint8_t v) _on_event.buffer()[0] = MIDI_CMD_NOTE_ON + chan; _on_event.buffer()[1] = n; _on_event.buffer()[2] = v; - + _off_event.buffer()[0] = MIDI_CMD_NOTE_OFF + chan; _off_event.buffer()[1] = n; _off_event.buffer()[2] = 0x40; - + assert(time() == t); assert(musical_time_equal (length(), l)); assert(note() == n); @@ -58,7 +58,7 @@ Note<Time>::Note(const Note<Time>& copy) assert(copy._on_event.size == 3); _on_event.buffer = _on_event_buffer; memcpy(_on_event_buffer, copy._on_event_buffer, 3); - + assert(copy._off_event.size == 3); _off_event.buffer = _off_event_buffer; memcpy(_off_event_buffer, copy._off_event_buffer, 3); @@ -84,7 +84,7 @@ Note<Time>::operator=(const Note<Time>& other) { _on_event = other._on_event; _off_event = other._off_event; - + assert(time() == other.time()); assert(end_time() == other.end_time()); assert(note() == other.note()); @@ -92,7 +92,7 @@ Note<Time>::operator=(const Note<Time>& other) assert(length() == other.length()); assert(_on_event.channel() == _off_event.channel()); assert(channel() == other.channel()); - + return *this; } diff --git a/libs/evoral/src/OldSMF.cpp b/libs/evoral/src/OldSMF.cpp index 7fc079aaed..622c8d534f 100644 --- a/libs/evoral/src/OldSMF.cpp +++ b/libs/evoral/src/OldSMF.cpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -87,7 +87,7 @@ SMF<Time>::open(const std::string& path) THROW_FILE_ERROR flush_header(); flush_footer(); } - + return (_fd == 0) ? -1 : 0; } @@ -115,7 +115,7 @@ void SMF<Time>::seek_to_footer_position() { uint8_t buffer[4]; - + // Check if there is a track end marker at the end of the data fseek(_fd, -4, SEEK_END); size_t read_bytes = fread(buffer, sizeof(uint8_t), 4, _fd); @@ -145,7 +145,7 @@ int SMF<Time>::flush_header() { // FIXME: write timeline position somehow? - + //cerr << path() << " SMF Flushing header\n"; assert(_fd); @@ -163,7 +163,7 @@ SMF<Time>::flush_header() //assert(_fd); fseek(_fd, 0, SEEK_SET); write_chunk("MThd", 6, data); - write_chunk_header("MTrk", _track_size); + write_chunk_header("MTrk", _track_size); fflush(_fd); @@ -224,7 +224,7 @@ SMF<Time>::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const } catch (...) { return -1; // Premature EOF } - + if (feof(_fd)) { return -1; // Premature EOF } @@ -249,7 +249,7 @@ SMF<Time>::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const return 0; } } - + int event_size = midi_event_size((unsigned char)status); if (event_size <= 0) { if ((status & 0xff) == MIDI_CMD_COMMON_SYSEX) { @@ -259,11 +259,11 @@ SMF<Time>::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const return 0; } } - + // Make sure we have enough scratch buffer if (*size < (unsigned)event_size) *buf = (uint8_t*)realloc(*buf, event_size); - + *size = event_size; (*buf)[0] = (unsigned char)status; @@ -275,7 +275,7 @@ SMF<Time>::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const printf("%X ", (*buf)[i]); } printf("\n");*/ - + return (int)*size; } @@ -285,7 +285,7 @@ SMF<Time>::append_event_delta(uint32_t delta_t, const Event<Time>& ev) { if (ev.size() == 0) return; - + size_t stamp_size = write_var_len(delta_t); if (ev.buffer()[0] == MIDI_CMD_COMMON_SYSEX) { fputc(MIDI_CMD_COMMON_SYSEX, _fd); @@ -333,7 +333,7 @@ void SMF<Time>::write_chunk(const char id[4], uint32_t length, void* data) { write_chunk_header(id, length); - + fwrite(data, 1, length, _fd); } diff --git a/libs/evoral/src/SMF.cpp b/libs/evoral/src/SMF.cpp index 424b4d46f2..7055bb2e14 100644 --- a/libs/evoral/src/SMF.cpp +++ b/libs/evoral/src/SMF.cpp @@ -2,16 +2,16 @@ * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis * Author: Hans Baier - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -32,12 +32,12 @@ using namespace std; namespace Evoral { SMF::~SMF() -{ +{ if (_smf) { smf_delete(_smf); _smf = 0; _smf_track = 0; - } + } } uint16_t @@ -77,10 +77,10 @@ int SMF::open(const std::string& path, int track) THROW_FILE_ERROR { assert(track >= 1); - if (_smf) { + if (_smf) { smf_delete(_smf); } - + _file_path = path; _smf = smf_load(_file_path.c_str()); if (_smf == NULL) { @@ -99,7 +99,7 @@ SMF::open(const std::string& path, int track) THROW_FILE_ERROR _smf_track->next_event_number = 1; _empty = false; } - + return 0; } @@ -114,21 +114,21 @@ int SMF::create(const std::string& path, int track, uint16_t ppqn) THROW_FILE_ERROR { assert(track >= 1); - if (_smf) { + if (_smf) { smf_delete(_smf); } - + _file_path = path; _smf = smf_new(); if (smf_set_ppqn(_smf, ppqn) != 0) { throw FileError(); } - + if (_smf == NULL) { return -1; } - + for (int i = 0; i < track; ++i) { _smf_track = smf_track_new(); assert(_smf_track); @@ -141,7 +141,7 @@ SMF::create(const std::string& path, int track, uint16_t ppqn) THROW_FILE_ERROR _smf_track->next_event_number = 0; _empty = true; - + return 0; } @@ -182,34 +182,34 @@ int SMF::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const { smf_event_t* event; - + assert(delta_t); assert(size); assert(buf); - + if ((event = smf_track_get_next_event(_smf_track)) != NULL) { if (smf_event_is_metadata(event)) { return 0; } *delta_t = event->delta_time_pulses; - + int event_size = event->midi_buffer_length; assert(event_size > 0); - + // Make sure we have enough scratch buffer if (*size < (unsigned)event_size) { *buf = (uint8_t*)realloc(*buf, event_size); } memcpy(*buf, event->midi_buffer, size_t(event_size)); *size = event_size; - + assert(midi_event_is_valid(*buf, *size)); /* printf("SMF::read_event @ %u: ", *delta_t); for (size_t i = 0; i < *size; ++i) { printf("%X ", (*buf)[i]); } printf("\n") */ - + return event_size; } else { return -1; @@ -222,7 +222,7 @@ SMF::append_event_delta(uint32_t delta_t, uint32_t size, const uint8_t* buf) if (size == 0) { return; } - + /* printf("SMF::append_event_delta @ %u:", delta_t); for (size_t i = 0; i < size; ++i) { printf("%X ", buf[i]); @@ -237,7 +237,7 @@ SMF::append_event_delta(uint32_t delta_t, uint32_t size, const uint8_t* buf) event = smf_event_new_from_pointer(buf, size); assert(event != NULL); - + assert(_smf_track); smf_track_add_event_delta_pulses(_smf_track, event, delta_t); _empty = false; @@ -248,10 +248,10 @@ SMF::begin_write() { assert(_smf_track); smf_track_delete(_smf_track); - + _smf_track = smf_track_new(); assert(_smf_track); - + smf_add_track(_smf, _smf_track); assert(_smf->number_of_tracks == 1); } diff --git a/libs/evoral/src/SMFReader.cpp b/libs/evoral/src/SMFReader.cpp index e992514191..b5b456348d 100644 --- a/libs/evoral/src/SMFReader.cpp +++ b/libs/evoral/src/SMFReader.cpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright(C) 2008 Dave Robillard <http://drobilla.net> * Copyright(C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or(at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -71,7 +71,7 @@ SMFReader::open(const string& filename) throw (logic_error, UnsupportedTime) _fd = NULL; return false; } - + // Read type (bytes 8..9) fseek(_fd, 8, SEEK_SET); uint16_t type_be = 0; @@ -87,20 +87,20 @@ SMFReader::open(const string& filename) throw (logic_error, UnsupportedTime) uint16_t ppqn_be = 0; fread(&ppqn_be, 2, 1, _fd); _ppqn = GUINT16_FROM_BE(ppqn_be); - + // TODO: Absolute (SMPTE seconds) time support if ((_ppqn & 0x8000) != 0) throw UnsupportedTime(); seek_to_track(1); - + return true; } else { return false; } } - + /** Seek to the start of a given track, starting from 1. * Returns true if specified track was found. */ @@ -148,7 +148,7 @@ SMFReader::seek_to_track(unsigned track) throw (std::logic_error) } } - + /** Read an event from the current position in file. * * File position MUST be at the beginning of a delta time, or this will die very messily. @@ -234,14 +234,14 @@ SMFReader::read_event(size_t buf_len, // Read event, return size if (ferror(_fd)) throw CorruptFile(); - + fread(buf+1, 1, *ev_size - 1, _fd); - + if ((buf[0] & 0xF0) == 0x90 && buf[2] == 0) { buf[0] = (0x80 | (buf[0] & 0x0F)); buf[2] = 0x40; } - + return *ev_size; } } diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp index 91943c03a6..124a0acd4c 100644 --- a/libs/evoral/src/Sequence.cpp +++ b/libs/evoral/src/Sequence.cpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2000-2008 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -92,7 +92,7 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t , _control_iter(_control_iters.end()) { DUMP(format("Created Iterator @ %1% (is end: %2%)\n)") % t % _is_end); - + if (_is_end) { return; } @@ -108,7 +108,7 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t } } assert(_note_iter == seq.notes().end() || (*_note_iter)->time() >= t); - + // Find first sysex event after t for (typename Sequence<Time>::SysExes::const_iterator i = seq.sysexes().begin(); i != seq.sysexes().end(); ++i) { @@ -142,7 +142,7 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t << "], event ignored" << endl; continue; } - + DUMP(format("Iterator: CC %1% added (%2%, %3%)\n") % i->first.id() % x % y); const ControlIterator new_iter(i->second->list(), x, y); @@ -161,7 +161,7 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t } else { _control_iter = _control_iters.end(); } - + // Now find the earliest event overall and point to it Time earliest_t = t; @@ -169,7 +169,7 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t _type = NOTE_ON; earliest_t = (*_note_iter)->time(); } - + if (_sysex_iter != seq.sysexes().end() && (*_sysex_iter)->time() < earliest_t) { _type = SYSEX; earliest_t = (*_sysex_iter)->time(); @@ -181,7 +181,7 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t _type = CONTROL; earliest_t = earliest_control.x; } - + switch (_type) { case NOTE_ON: DUMP(format("Starting at note on event @ %1%\n") % earliest_t); @@ -252,10 +252,10 @@ Sequence<Time>::const_iterator::operator++() if (_is_end) { throw std::logic_error("Attempt to iterate past end of Sequence"); } - + DUMP("Sequence::const_iterator++\n"); assert(_event && _event->buffer() && _event->size() > 0); - + const MIDIEvent<Time>& ev = *((MIDIEvent<Time>*)_event.get()); if (!( ev.is_note() @@ -267,11 +267,11 @@ Sequence<Time>::const_iterator::operator++() cerr << "WARNING: Unknown event (type " << _type << "): " << hex << int(ev.buffer()[0]) << int(ev.buffer()[1]) << int(ev.buffer()[2]) << endl; } - + double x = 0.0; double y = 0.0; bool ret = false; - + // Increment past current event switch (_type) { case NOTE_ON: @@ -292,7 +292,7 @@ Sequence<Time>::const_iterator::operator++() _control_iter->x = DBL_MAX; _control_iter->y = DBL_MAX; } - + // Find the controller with the next earliest event time _control_iter = _control_iters.begin(); for (ControlIterators::iterator i = _control_iters.begin(); @@ -334,7 +334,7 @@ Sequence<Time>::const_iterator::operator++() earliest_t = _control_iter->x; } } - + // Use the next earliest SysEx iff it's earlier than the controller if (_sysex_iter != _seq->sysexes().end()) { if (_type == NIL || (*_sysex_iter)->time() < earliest_t) { @@ -413,7 +413,7 @@ Sequence<Time>::const_iterator::operator=(const const_iterator& other) _note_iter = other._note_iter; _sysex_iter = other._sysex_iter; _control_iters = other._control_iters; - + if (other._control_iter == other._control_iters.end()) { _control_iter = _control_iters.end(); } else { @@ -455,12 +455,12 @@ Sequence<Time>::control_to_midi_event( { assert(iter.list.get()); const uint32_t event_type = iter.list->parameter().type(); - + // initialize the event pointer with a new event, if necessary if (!ev) { ev = boost::shared_ptr< Event<Time> >(new Event<Time>(event_type, 0, 3, NULL, true)); } - + uint8_t midi_type = _type_map.parameter_midi_type(iter.list->parameter()); ev->set_event_type(_type_map.midi_event_type(midi_type)); switch (midi_type) { @@ -469,7 +469,7 @@ Sequence<Time>::control_to_midi_event( assert(iter.list->parameter().channel() < 16); assert(iter.list->parameter().id() <= INT8_MAX); assert(iter.y <= INT8_MAX); - + ev->time() = iter.x; ev->realloc(3); ev->buffer()[0] = MIDI_CMD_CONTROL + iter.list->parameter().channel(); @@ -481,7 +481,7 @@ Sequence<Time>::control_to_midi_event( assert(iter.list.get()); assert(iter.list->parameter().channel() < 16); assert(iter.y <= INT8_MAX); - + ev->time() = iter.x; ev->realloc(2); ev->buffer()[0] = MIDI_CMD_PGM_CHANGE + iter.list->parameter().channel(); @@ -492,7 +492,7 @@ Sequence<Time>::control_to_midi_event( assert(iter.list.get()); assert(iter.list->parameter().channel() < 16); assert(iter.y < (1<<14)); - + ev->time() = iter.x; ev->realloc(3); ev->buffer()[0] = MIDI_CMD_BENDER + iter.list->parameter().channel(); @@ -591,7 +591,7 @@ Sequence<Time>::end_write(bool delete_stuck) for (ControlLists::const_iterator i = _dirty_controls.begin(); i != _dirty_controls.end(); ++i) { (*i)->mark_dirty(); } - + _writing = false; write_unlock(); } @@ -608,7 +608,7 @@ Sequence<Time>::append(const Event<Time>& event) { write_lock(); _edited = true; - + const MIDIEvent<Time>& ev = (const MIDIEvent<Time>&)event; assert(_notes.empty() || ev.time() >= _notes.back()->time()); diff --git a/libs/evoral/src/midi_util.cpp b/libs/evoral/src/midi_util.cpp index 5f088cb925..4076337137 100644 --- a/libs/evoral/src/midi_util.cpp +++ b/libs/evoral/src/midi_util.cpp @@ -1,16 +1,16 @@ /* This file is part of Evoral. * Copyright (C) 2008 Dave Robillard <http://drobilla.net> * Copyright (C) 2009 Paul Davis - * + * * Evoral is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. - * + * * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -45,7 +45,7 @@ midi_note_name (uint8_t val) int octave = val/12; static char buf[8]; - + val -= octave*12; snprintf (buf, sizeof (buf), "%s%d", notes[val], octave); |