X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Faudio_region_view.cc;h=bd311d7e06fb03931f39fcc57bb768b804e30f34;hb=dab0dacc66dcc190b4408ba75e3807973582cbd6;hp=5a28a2f4847baace870812babb8db41158179a38;hpb=7c9c3b8f6ccc4c0ebf963b05c2df400864ba46f0;p=ardour.git diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 5a28a2f484..bd311d7e06 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -27,7 +27,6 @@ #include "ardour/playlist.h" #include "ardour/audioregion.h" #include "ardour/audiosource.h" -#include "ardour/audio_diskstream.h" #include "ardour/profile.h" #include "ardour/session.h" @@ -111,7 +110,6 @@ AudioRegionView::AudioRegionView (const AudioRegionView& other) , _amplitude_above_axis(1.0) , _flags(0) , fade_color(0) - { Gdk::Color c; int r,g,b,a; @@ -133,7 +131,6 @@ AudioRegionView::AudioRegionView (const AudioRegionView& other, boost::shared_pt , _amplitude_above_axis(1.0) , _flags(0) , fade_color(0) - { Gdk::Color c; int r,g,b,a; @@ -165,7 +162,8 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd) store_flags (); } - if (trackview.editor().new_regionviews_display_gain()) { + /* make envelope visible if it has anything interesting in it */ + if (audio_region()->envelope()->size() > 2) { _flags |= EnvelopeVisible; } @@ -252,6 +250,10 @@ AudioRegionView::~AudioRegionView () gnome_canvas_waveview_cache_destroy (*cache); } + for (vector::iterator i = _data_ready_connections.begin(); i != _data_ready_connections.end(); ++i) { + delete *i; + } + /* all waveviews etc will be destroyed when the group is destroyed */ delete gain_line; @@ -498,7 +500,7 @@ AudioRegionView::set_height (gdouble height) } } - gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE)); + gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE) - 2); } manage_zero_line (); @@ -773,20 +775,6 @@ AudioRegionView::set_colors () } } -void -AudioRegionView::show_region_editor () -{ - if (editor == 0) { - editor = new AudioRegionEditor (trackview.session(), audio_region(), *this); - // GTK2FIX : how to ensure float without realizing - // editor->realize (); - // trackview.editor.ensure_float (*editor); - } - - editor->present (); - editor->show_all(); -} - void AudioRegionView::set_waveform_visible (bool yn) { @@ -847,11 +835,11 @@ AudioRegionView::create_waves () // cerr << "AudioRegionView::create_waves() called on " << this << endl;//DEBUG RouteTimeAxisView& atv (*(dynamic_cast(&trackview))); // ick - if (!atv.get_diskstream()) { + if (!atv.track()) { return; } - ChanCount nchans = atv.get_diskstream()->n_channels(); + ChanCount nchans = atv.track()->n_channels(); // cerr << "creating waves for " << _region->name() << " with wfd = " << wait_for_data // << " and channels = " << nchans.n_audio() << endl; @@ -861,6 +849,16 @@ AudioRegionView::create_waves () tmp_waves.push_back (0); } + for (vector::iterator i = _data_ready_connections.begin(); i != _data_ready_connections.end(); ++i) { + delete *i; + } + + _data_ready_connections.clear (); + + for (uint32_t i = 0; i < nchans.n_audio(); ++i) { + _data_ready_connections.push_back (0); + } + for (uint32_t n = 0; n < nchans.n_audio(); ++n) { if (n >= audio_region()->n_channels()) { @@ -872,7 +870,7 @@ AudioRegionView::create_waves () // cerr << "\tchannel " << n << endl; if (wait_for_data) { - if (audio_region()->audio_source(n)->peaks_ready (boost::bind (&AudioRegionView::peaks_ready_handler, this, n), data_ready_connection, gui_context())) { + if (audio_region()->audio_source(n)->peaks_ready (boost::bind (&AudioRegionView::peaks_ready_handler, this, n), &_data_ready_connections[n], gui_context())) { // cerr << "\tData is ready\n"; create_one_wave (n, true); } else { @@ -894,7 +892,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/) { //cerr << "AudioRegionView::create_one_wave() called which: " << which << " this: " << this << endl;//DEBUG RouteTimeAxisView& atv (*(dynamic_cast(&trackview))); // ick - uint32_t nchans = atv.get_diskstream()->n_channels().n_audio(); + uint32_t nchans = atv.track()->n_channels().n_audio(); uint32_t n; uint32_t nwaves = std::min (nchans, audio_region()->n_channels()); gdouble ht; @@ -968,7 +966,8 @@ 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 (); + delete _data_ready_connections[which]; + _data_ready_connections[which] = 0; #if 0 if (!zero_line) { @@ -1163,7 +1162,7 @@ AudioRegionView::add_ghost (TimeAxisView& tv) AudioGhostRegion* ghost = new AudioGhostRegion (tv, trackview, unit_position); uint32_t nchans; - nchans = rtv->get_diskstream()->n_channels().n_audio(); + nchans = rtv->track()->n_channels().n_audio(); for (uint32_t n = 0; n < nchans; ++n) { @@ -1374,3 +1373,14 @@ AudioRegionView::update_coverage_frames (LayerDisplay d) fade_in_handle->raise_to_top (); fade_out_handle->raise_to_top (); } + +void +AudioRegionView::show_region_editor () +{ + if (editor == 0) { + editor = new AudioRegionEditor (trackview.session(), audio_region()); + } + + editor->present (); + editor->show_all(); +}