#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"
, _amplitude_above_axis(1.0)
, _flags(0)
, fade_color(0)
-
{
Gdk::Color c;
int r,g,b,a;
, _amplitude_above_axis(1.0)
, _flags(0)
, fade_color(0)
-
{
Gdk::Color c;
int r,g,b,a;
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;
}
region_muted ();
region_sync_changed ();
- region_resized (BoundsChanged);
+
+ region_resized (ARDOUR::bounds_change);
set_waveview_data_src();
region_locked ();
envelope_active_changed ();
gnome_canvas_waveview_cache_destroy (*cache);
}
+ for (vector<ScopedConnection*>::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;
}
void
-AudioRegionView::region_changed (Change what_changed)
+AudioRegionView::region_changed (const PropertyChange& what_changed)
{
- ENSURE_GUI_THREAD (*this, &AudioRegionView::region_changed, what_changed)
- //cerr << "AudioRegionView::region_changed() called" << endl;
+ ENSURE_GUI_THREAD (*this, &AudioRegionView::region_changed, what_changed);
+ // cerr << "AudioRegionView::region_changed() called" << endl;
- RegionView::region_changed(what_changed);
+ RegionView::region_changed (what_changed);
- if (what_changed & AudioRegion::ScaleAmplitudeChanged) {
+ if (what_changed.contains (ARDOUR::Properties::scale_amplitude)) {
region_scale_amplitude_changed ();
}
- if (what_changed & AudioRegion::FadeInChanged) {
- fade_in_changed ();
+ if (what_changed.contains (ARDOUR::Properties::fade_in)) {
+ fade_in_changed ();
}
- if (what_changed & AudioRegion::FadeOutChanged) {
+ if (what_changed.contains (ARDOUR::Properties::fade_out)) {
fade_out_changed ();
}
- if (what_changed & AudioRegion::FadeInActiveChanged) {
+ if (what_changed.contains (ARDOUR::Properties::fade_in_active)) {
fade_in_active_changed ();
}
- if (what_changed & AudioRegion::FadeOutActiveChanged) {
+ if (what_changed.contains (ARDOUR::Properties::fade_out_active)) {
fade_out_active_changed ();
}
- if (what_changed & AudioRegion::EnvelopeActiveChanged) {
+ if (what_changed.contains (ARDOUR::Properties::envelope_active)) {
envelope_active_changed ();
}
}
}
void
-AudioRegionView::region_resized (Change what_changed)
+AudioRegionView::region_resized (const PropertyChange& what_changed)
{
AudioGhostRegion* agr;
RegionView::region_resized(what_changed);
+ PropertyChange interesting_stuff;
- if (what_changed & Change (StartChanged|LengthChanged)) {
+ interesting_stuff.add (ARDOUR::Properties::start);
+ interesting_stuff.add (ARDOUR::Properties::length);
+
+ if (what_changed.contains (interesting_stuff)) {
for (uint32_t n = 0; n < waves.size(); ++n) {
waves[n]->property_region_start() = _region->start();
// FIXME: ick
height -= 2;
- _height = height;
-
- for (uint32_t n=0; n < wcnt; ++n) {
+ for (uint32_t n = 0; n < wcnt; ++n) {
gdouble ht;
if ((height) < NAME_HIGHLIGHT_THRESH) {
- ht = ((height-2*wcnt) / (double) wcnt);
+ ht = ((height - 2 * wcnt) / (double) wcnt);
} else {
- ht = (((height-2*wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt);
+ ht = (((height - 2 * wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt);
}
- gdouble yoff = n * (ht+1);
+ gdouble yoff = n * (ht + 1);
waves[n]->property_height() = ht;
waves[n]->property_y() = yoff + 2;
}
if (gain_line) {
+
if ((height/wcnt) < NAME_HIGHLIGHT_THRESH) {
gain_line->hide ();
} else {
gain_line->show ();
}
}
- gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE - 2));
+
+ gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE) - 2);
}
manage_zero_line ();
if (name_pixbuf) {
name_pixbuf->raise_to_top();
}
-
}
void
}
}
-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)
{
// cerr << "AudioRegionView::create_waves() called on " << this << endl;//DEBUG
RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&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;
tmp_waves.push_back (0);
}
+ for (vector<ScopedConnection*>::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()) {
// 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)) {
+ 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 {
{
//cerr << "AudioRegionView::create_one_wave() called which: " << which << " this: " << this << endl;//DEBUG
RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&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;
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) {
void
AudioRegionView::peaks_ready_handler (uint32_t which)
{
- Gtkmm2ext::UI::instance()->call_slot (boost::bind (&AudioRegionView::create_one_wave, this, which, false));
+ Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&AudioRegionView::create_one_wave, this, which, false));
// cerr << "AudioRegionView::peaks_ready_handler() called on " << which << " this: " << this << endl;
}
gain_line->view_to_model_coord (x, y);
+ /* XXX STATEFUL: can't convert to stateful diff until we
+ can represent automation data with it.
+ */
+
trackview.session()->begin_reversible_command (_("add gain control point"));
XMLNode &before = audio_region()->envelope()->get_state();
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) {
ghost->set_colors();
ghosts.push_back (ghost);
- ghost->GoingAway.connect (boost::bind (&RegionView::remove_ghost, this, _1));
-
return ghost;
}
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();
+}