diff options
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/analysis_window.cc | 135 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/canvas-waveview.c | 4 | ||||
-rw-r--r-- | gtk2_ardour/canvas-waveview.h | 143 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/gain_meter.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/nsm.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/route_params_ui.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/step_entry.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/tempo_lines.cc | 8 |
12 files changed, 224 insertions, 82 deletions
diff --git a/gtk2_ardour/analysis_window.cc b/gtk2_ardour/analysis_window.cc index e93fad887c..998ab8ab12 100644 --- a/gtk2_ardour/analysis_window.cc +++ b/gtk2_ardour/analysis_window.cc @@ -235,7 +235,7 @@ AnalysisWindow::analyze() } void -AnalysisWindow::analyze_data (Gtk::Button */*button*/) +AnalysisWindow::analyze_data (Gtk::Button * /*button*/) { track_list_ready = false; { @@ -251,29 +251,29 @@ AnalysisWindow::analyze_data (Gtk::Button */*button*/) 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()); - if (!pl) - continue; + // if timeSelection + if (source_selection_ranges_rb.get_active()) { + TimeSelection ts = s.time; - RouteUI *rui = dynamic_cast<RouteUI *>(*i); - int n_inputs = rui->route()->n_inputs().n_audio(); // FFT is audio only + for (TrackSelection::iterator i = s.tracks.begin(); i != s.tracks.end(); ++i) { + boost::shared_ptr<AudioPlaylist> pl + = boost::dynamic_pointer_cast<AudioPlaylist>((*i)->playlist()); - // Busses don't have playlists, so we need to check that we actually are working with a playlist - if (!pl || !rui) - continue; + if (!pl) + continue; - FFTResult *res = fft_graph.prepareResult(rui->color(), rui->route()->name()); + RouteUI *rui = dynamic_cast<RouteUI *>(*i); + int n_inputs = rui->route()->n_inputs().n_audio(); // FFT is audio only - // if timeSelection - if (source_selection_ranges_rb.get_active()) { -// cerr << "Analyzing ranges on track " << *&rui->route().name() << endl; + // Busses don't have playlists, so we need to check that we actually are working with a playlist + if (!pl || !rui) + continue; + // std::cerr << "Analyzing ranges on track " << rui->route()->name() << std::endl; + + FFTResult *res = fft_graph.prepareResult(rui->color(), rui->route()->name()); for (std::list<AudioRange>::iterator j = ts.begin(); j != ts.end(); ++j) { int n; @@ -303,67 +303,72 @@ 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; - -// cerr << " - " << (*j)->region().name() << ": " << (*j)->region().length() << " samples starting at " << (*j)->region().position() << endl; - int n; - for (int channel = 0; channel < n_inputs; channel++) { - - framecnt_t x = 0; + 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; + } + } else if (source_selection_regions_rb.get_active()) { + RegionSelection ars = s.regions; + // std::cerr << "Analyzing selected regions" << std::endl; + + 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; + + // std::cerr << " - " << (*j)->region().name() << ": " << (*j)->region().length() << " samples starting at " << (*j)->region().position() << std::endl; + RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView *>(&arv->get_time_axis_view()); + if (!rtav) { + /* shouldn't happen... */ + continue; + } + FFTResult *res = fft_graph.prepareResult(rtav->color(), arv->get_item_name()); + int n; + for (unsigned int channel = 0; channel < arv->region()->n_channels(); channel++) { - framecnt_t length = arv->region()->length(); + framecnt_t x = 0; + framecnt_t length = arv->region()->length(); - while (x < length) { - // TODO: What about stereo+ channels? composite all to one, I guess + while (x < length) { + // TODO: What about stereo+ channels? composite all to one, I guess - n = fft_graph.windowSize(); - if (x + n >= length ) { - n = length - x; - } + n = fft_graph.windowSize(); + if (x + n >= length ) { + n = length - x; + } - memset (buf, 0, n * sizeof (Sample)); - n = arv->audio_region()->read_at(buf, mixbuf, gain, arv->region()->position() + x, n, channel); + memset (buf, 0, n * sizeof (Sample)); + n = arv->audio_region()->read_at(buf, mixbuf, gain, arv->region()->position() + x, n, channel); - if (n == 0) - break; + if (n == 0) + break; - if ( n < fft_graph.windowSize()) { - for (int j = n; j < fft_graph.windowSize(); j++) { - buf[j] = 0.0; - } + if ( n < fft_graph.windowSize()) { + for (int j = n; j < fft_graph.windowSize(); j++) { + buf[j] = 0.0; } - - res->analyzeWindow(buf); - - x += n; } - } -// cerr << "Found: " << (*j)->get_item_name() << endl; + res->analyzeWindow(buf); + x += n; + } } + // std::cerr << "Found: " << (*j)->get_item_name() << std::endl; + res->finalize(); - } - res->finalize(); + Gtk::TreeModel::Row newrow = *(tlmodel)->append(); + newrow[tlcols.trackname] = arv->get_item_name(); + newrow[tlcols.visible] = true; + newrow[tlcols.color] = rtav->color(); + newrow[tlcols.graph] = res; + } - 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; } diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 1022acee2d..8484ffff36 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -689,7 +689,6 @@ ARDOUR_UI::startup () // nsm requires these actions disabled vector<string> action_names; - action_names.push_back("Snapshot"); action_names.push_back("SaveAs"); action_names.push_back("Rename"); action_names.push_back("New"); diff --git a/gtk2_ardour/canvas-waveview.c b/gtk2_ardour/canvas-waveview.c index 108952454a..2080b208d8 100644 --- a/gtk2_ardour/canvas-waveview.c +++ b/gtk2_ardour/canvas-waveview.c @@ -39,7 +39,7 @@ #define POSIX_FUNC_PTR_CAST(type, object) *((type*) &(object)) #endif // _POSIX_VERSION -extern void c_stacktrace(); +extern void c_stacktrace(void); enum { PROP_0, @@ -338,7 +338,7 @@ gnome_canvas_waveview_set_gradient_waveforms (int yn) } GnomeCanvasWaveViewCache* -gnome_canvas_waveview_cache_new () +gnome_canvas_waveview_cache_new (void) { GnomeCanvasWaveViewCache *c; diff --git a/gtk2_ardour/canvas-waveview.h b/gtk2_ardour/canvas-waveview.h new file mode 100644 index 0000000000..daa907e110 --- /dev/null +++ b/gtk2_ardour/canvas-waveview.h @@ -0,0 +1,143 @@ +/* libgnomecanvas/gnome-canvas-waveview.h: GnomeCanvas item for displaying wave data + * + * Copyright (C) 2001 Paul Davis <pbd@op.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library 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, USA. + * + */ + +#ifndef __GNOME_CANVAS_WAVEVIEW_H__ +#define __GNOME_CANVAS_WAVEVIEW_H__ + +#include <stdint.h> + +#include <libgnomecanvas/libgnomecanvas.h> + +G_BEGIN_DECLS + +/* Wave viewer item for canvas. + */ + +#define GNOME_TYPE_CANVAS_WAVEVIEW (gnome_canvas_waveview_get_type ()) +#define GNOME_CANVAS_WAVEVIEW(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_CANVAS_WAVEVIEW, GnomeCanvasWaveView)) +#define GNOME_CANVAS_WAVEVIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_WAVEVIEW, GnomeCanvasWaveViewClass)) +#define GNOME_IS_CANVAS_WAVEVIEW(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_WAVEVIEW)) +#define GNOME_IS_CANVAS_WAVEVIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_WAVEVIEW)) +#define GNOME_CANVAS_WAVEVIEW_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GNOME_TYPE_CANVAS_WAVEVIEW, GnomeCanvasWaveViewClass)) + +typedef struct _GnomeCanvasWaveView GnomeCanvasWaveView; +typedef struct _GnomeCanvasWaveViewClass GnomeCanvasWaveViewClass; +typedef struct _GnomeCanvasWaveViewChannelInfo GnomeCanvasWaveViewChannelInfo; +typedef struct _GnomeCanvasWaveViewCacheEntry GnomeCanvasWaveViewCacheEntry; +typedef struct _GnomeCanvasWaveViewCache GnomeCanvasWaveViewCache; + +/* XXX this needs to be synced with ardour/source.h PeakData */ + +struct _GnomeCanvasWaveViewCacheEntry +{ + float min; + float max; +}; + +struct _GnomeCanvasWaveViewCache +{ + GnomeCanvasWaveViewCacheEntry* data; + guint32 allocated; + guint64 data_size; + gulong start; + gulong end; +}; + +GnomeCanvasWaveViewCache* gnome_canvas_waveview_cache_new (void); +void gnome_canvas_waveview_cache_destroy (GnomeCanvasWaveViewCache*); + +void gnome_canvas_waveview_set_gradient_waveforms (int); + +typedef gulong (*waveview_length_function_t)(void*); +typedef gulong (*waveview_sourcefile_length_function_t)(void*, double); +typedef void (*waveview_gain_curve_function_t)(void *arg, double start, double end, float* vector, gint64 veclen); +typedef void (*waveview_peak_function_t)(void*,gulong,gulong,gulong,gpointer,guint32,double); + +struct _GnomeCanvasWaveView +{ + GnomeCanvasItem item; + + GnomeCanvasWaveViewCache *cache; + gboolean cache_updater; + gint screen_width; + + void *data_src; + guint32 channel; + waveview_peak_function_t peak_function; + waveview_length_function_t length_function; + waveview_sourcefile_length_function_t sourcefile_length_function; + waveview_gain_curve_function_t gain_curve_function; + void *gain_src; + + /** 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. + * + * larger values will expand the vertical scale, cutting off the peaks/troughs. + * smaller values will decrease the vertical scale, moving peaks/troughs toward + * the middle of the area assigned to the waveview. + */ + double amplitude_above_axis; + + double x; + double y; + double height; + double half_height; + uint32_t wave_color; + uint32_t clip_color; + uint32_t zero_color; + uint32_t fill_color; + + char filled; + 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(). + */ + + int32_t bbox_ulx; + int32_t bbox_uly; + int32_t bbox_lrx; + int32_t bbox_lry; + unsigned char wave_r, wave_g, wave_b, wave_a; + unsigned char clip_r, clip_g, clip_b, clip_a; + unsigned char fill_r, fill_g, fill_b, fill_a; + uint32_t samples; + uint32_t region_start; + int32_t reload_cache_in_render; +}; + +struct _GnomeCanvasWaveViewClass { + GnomeCanvasItemClass parent_class; +}; + +GType gnome_canvas_waveview_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __GNOME_CANVAS_WAVEVIEW_H__ */ diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 194c344241..7f49c56d7b 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -4871,7 +4871,7 @@ Editor::add_routes (RouteList& routes) for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) { boost::shared_ptr<Route> route = (*x); - if (route->is_hidden() || route->is_monitor()) { + if (route->is_auditioner() || route->is_monitor()) { continue; } diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 6c241ac4a5..73d2ce648b 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -186,7 +186,7 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r, setup_gain_adjustment (); - if (!_route || !_route->is_hidden()) { + if (!_route || !_route->is_auditioner()) { using namespace Menu_Helpers; @@ -926,7 +926,7 @@ GainMeter::set_controls (boost::shared_ptr<Route> r, hbox.pack_start (meter_alignment, true, true); -// if (r && !r->is_hidden()) { +// if (r && !r->is_auditioner()) { // fader_vbox->pack_start (gain_automation_state_button, false, false, 0); // } diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 10345428b1..74556c8eda 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -321,7 +321,7 @@ Mixer_UI::add_strips (RouteList& routes) for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) { boost::shared_ptr<Route> route = (*x); - if (route->is_hidden()) { + if (route->is_auditioner()) { continue; } diff --git a/gtk2_ardour/nsm.cc b/gtk2_ardour/nsm.cc index 7c5fcfbf6e..08c1636025 100644 --- a/gtk2_ardour/nsm.cc +++ b/gtk2_ardour/nsm.cc @@ -51,7 +51,6 @@ NSM_Client::command_open(const char *name, ARDOUR_COMMAND_LINE::session_name = name; ARDOUR_COMMAND_LINE::jack_client_name = client_id; - ARDOUR_COMMAND_LINE::no_connect_ports = true; if (ARDOUR_UI::instance()->get_session_parameters(true, false, "")) { return ERR_GENERAL; diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index 5f06555f28..56ed380404 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -165,7 +165,7 @@ RouteParams_UI::add_routes (RouteList& routes) for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) { boost::shared_ptr<Route> route = (*x); - if (route->is_hidden()) { + if (route->is_auditioner()) { return; } diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 2d83dbd4e7..d9b96066d3 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -122,7 +122,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt) set_height (preset_height (HeightNormal)); } - if (!_route->is_hidden()) { + if (!_route->is_auditioner()) { if (gui_property ("visible").empty()) { set_gui_property ("visible", true); } diff --git a/gtk2_ardour/step_entry.cc b/gtk2_ardour/step_entry.cc index fd53fd55ff..927c6f0324 100644 --- a/gtk2_ardour/step_entry.cc +++ b/gtk2_ardour/step_entry.cc @@ -470,6 +470,8 @@ StepEntry::StepEntry (StepEditor& seditor) r = RefPtr<RadioAction>::cast_dynamic (act); assert (r); r->set_active (true); + + set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG); } StepEntry::~StepEntry() diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc index 208ba4af13..9a9619c826 100644 --- a/gtk2_ardour/tempo_lines.cc +++ b/gtk2_ardour/tempo_lines.cc @@ -129,7 +129,6 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin, //cout << endl << "*** LINE CACHE MISS" << endl; - bool inserted_last_time = true; bool invalidated = false; for (i = begin; i != end; ++i) { @@ -162,7 +161,7 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin, ++li; line->set_outline_color (color); - inserted_last_time = false; // don't search next time + // Use existing line, moving if necessary } else if (!exhausted) { Lines::iterator steal = _lines.end(); @@ -178,7 +177,6 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin, line->set_x1 (xpos); line->set_outline_color (color); _lines.insert(make_pair(xpos, line)); - inserted_last_time = true; // search next time invalidated = true; // Shift clean range left @@ -192,7 +190,6 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin, //cout << "*** EXISTING LINE" << endl; li = existing; li->second->set_outline_color (color); - inserted_last_time = false; // don't search next time } else { //cout << "*** MOVING LINE" << endl; const double x1 = line->x0(); @@ -206,7 +203,6 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin, line->set_x0 (xpos); line->set_x1 (xpos); _lines.insert(make_pair(xpos, line)); - inserted_last_time = true; // search next time } } @@ -222,7 +218,6 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin, line->set_y1 (_height); line->set_outline_color (color); _lines.insert(make_pair(xpos, line)); - inserted_last_time = true; } // Steal from the left @@ -237,7 +232,6 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin, line->set_x0 (xpos); line->set_x1 (xpos); _lines.insert(make_pair(xpos, line)); - inserted_last_time = true; // search next time invalidated = true; // Shift clean range right |