2 Copyright (C) 2006 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <gtkmm2ext/gtk_ui.h>
28 #include <ardour/playlist.h>
29 #include <ardour/audioregion.h>
30 #include <ardour/audiosource.h>
31 #include <ardour/audio_diskstream.h>
33 #include "taperegionview.h"
34 #include "audio_time_axis.h"
35 #include "gui_thread.h"
40 using namespace ARDOUR;
42 using namespace Editing;
43 using namespace ArdourCanvas;
45 TapeAudioRegionView::TapeAudioRegionView (ArdourCanvas::Group *parent, AudioTimeAxisView &tv,
48 Gdk::Color& basic_color)
50 : AudioRegionView (parent, tv, r, spu, basic_color,
51 TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowNameHighlight|
52 TimeAxisViewItem::ShowFrame|
53 TimeAxisViewItem::HideFrameLR|
54 TimeAxisViewItem::FullWidthNameHighlight))
59 TapeAudioRegionView::init (double amplitude_above_axis, Gdk::Color& basic_color, bool wfw)
65 in_destructor = false;
66 _amplitude_above_axis = amplitude_above_axis;
73 if ((node = region.extra_xml ("GUI")) != 0) {
76 _flags = WaveformVisible;
85 compute_colors (basic_color);
89 name_highlight->set_data ("regionview", this);
91 reset_width_dependent_items ((double) region.length() / samples_per_unit);
93 set_height (trackview.height);
96 region_resized (BoundsChanged);
97 set_waveview_data_src();
100 /* no events, no state changes */
104 // ColorChanged.connect (mem_fun (*this, &AudioRegionView::color_handler));
106 /* every time the wave data changes and peaks are ready, redraw */
109 for (uint32_t n = 0; n < region.n_channels(); ++n) {
110 region.source(n).PeaksReady.connect (bind (mem_fun(*this, &TapeAudioRegionView::update), n));
115 TapeAudioRegionView::~TapeAudioRegionView()
120 TapeAudioRegionView::update (uint32_t n)
122 /* check that all waves are build and ready */
124 if (!tmp_waves.empty()) {
128 ENSURE_GUI_THREAD (bind (mem_fun(*this, &TapeAudioRegionView::update), n));
130 /* this triggers a cache invalidation and redraw in the waveview */
132 waves[n]->property_data_src() = ®ion;
136 TapeAudioRegionView::set_frame_color ()
139 TimeAxisViewItem::set_frame_color ();