along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id$
*/
#include <cmath>
{
}
+
+AudioRegionView::AudioRegionView (const AudioRegionView& other)
+ : RegionView (other)
+ , zero_line(0)
+ , fade_in_shape(0)
+ , fade_out_shape(0)
+ , fade_in_handle(0)
+ , fade_out_handle(0)
+ , gain_line(0)
+ , _amplitude_above_axis(1.0)
+ , _flags(0)
+ , fade_color(0)
+
+{
+ Gdk::Color c;
+ int r,g,b,a;
+
+ 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);
+}
+
void
AudioRegionView::init (Gdk::Color& 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);
-
+ RegionView::init(basic_color, false);
+
XMLNode *node;
_amplitude_above_axis = 1.0;
{
reset_fade_out_shape ();
}
-
-void
-AudioRegionView::set_fade_in_active (bool yn)
-{
- audio_region()->set_fade_in_active (yn);
-}
-
-void
-AudioRegionView::set_fade_out_active (bool yn)
-{
- audio_region()->set_fade_out_active (yn);
-}
-
void
AudioRegionView::fade_in_active_changed ()
{
{
RegionView::set_samples_per_unit (spu);
- for (uint32_t n=0; n < waves.size(); ++n) {
- waves[n]->property_samples_per_unit() = spu;
+ if (_flags & WaveformVisible) {
+ for (uint32_t n=0; n < waves.size(); ++n) {
+ waves[n]->property_samples_per_unit() = spu;
+ }
}
if (gain_line) {
gain_line->reset ();
}
+
reset_fade_shapes ();
}
} else {
waves[n]->property_wave_color() = color_map[cWaveForm];
}
+
+ waves[n]->property_clip_color() = color_map[cWaveFormClip];
+ waves[n]->property_zero_color() = color_map[cZeroLine];
}
}
// trackview.editor.ensure_float (*editor);
}
- editor->show_all ();
- editor->get_window()->raise();
+ editor->present ();
+ editor->show_all();
}
void
if (((_flags & WaveformVisible) != yn)) {
if (yn) {
for (uint32_t n=0; n < waves.size(); ++n) {
+ /* make sure the zoom level is correct, since we don't update
+ this when waveforms are hidden.
+ */
+ waves[n]->property_samples_per_unit() = samples_per_unit;
waves[n]->show();
}
_flags |= WaveformVisible;
void
AudioRegionView::create_waves ()
{
- bool create_zero_line = true;
-
RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick
if (!atv.get_diskstream()) {
for (uint32_t n = 0; n < nchans; ++n) {
tmp_waves.push_back (0);
}
-
+
for (uint32_t n = 0; n < nchans; ++n) {
if (n >= audio_region()->n_channels()) {
if (audio_region()->source(n)->peaks_ready (bind (mem_fun(*this, &AudioRegionView::peaks_ready_handler), n), data_ready_connection)) {
create_one_wave (n, true);
} else {
- create_zero_line = false;
}
} else {
create_one_wave (n, true);
}
}
-
- if (create_zero_line) {
- if (zero_line) {
- delete zero_line;
- }
- zero_line = new ArdourCanvas::SimpleLine (*group);
- zero_line->property_x1() = (gdouble) 1.0;
- zero_line->property_x2() = (gdouble) (_region->length() / samples_per_unit) - 1.0;
- zero_line->property_color_rgba() = (guint) color_map[cZeroLine];
- manage_zero_line ();
- }
}
void
wave->property_samples_per_unit() = samples_per_unit;
wave->property_amplitude_above_axis() = _amplitude_above_axis;
wave->property_wave_color() = _region->muted() ? color_map[cMutedWaveForm] : color_map[cWaveForm];
+ wave->property_clip_color() = color_map[cWaveFormClip];
+ wave->property_zero_color() = color_map[cZeroLine];
wave->property_region_start() = _region->start();
+ wave->property_rectified() = (bool) (_flags & WaveformRectified);
+ wave->property_logscaled() = (bool) (_flags & WaveformLogScaled);
if (!(_flags & WaveformVisible)) {
wave->hide();
break;
}
}
-
+
if (n == nwaves && waves.empty()) {
/* all waves are ready */
tmp_waves.resize(nwaves);
waves = tmp_waves;
tmp_waves.clear ();
+ /* all waves created, don't hook into peaks ready anymore */
+ data_ready_connection.disconnect ();
+
+ if(0)
if (!zero_line) {
zero_line = new ArdourCanvas::SimpleLine (*group);
zero_line->property_x1() = (gdouble) 1.0;
AudioRegionView::peaks_ready_handler (uint32_t which)
{
Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &AudioRegionView::create_one_wave), which, false));
-
- if (!waves.empty()) {
- /* all waves created, don't hook into peaks ready anymore */
- data_ready_connection.disconnect ();
- }
}
void
node->add_property ("waveform-visible", (_flags & WaveformVisible) ? "yes" : "no");
node->add_property ("envelope-visible", (_flags & EnvelopeVisible) ? "yes" : "no");
+ node->add_property ("waveform-rectified", (_flags & WaveformRectified) ? "yes" : "no");
+ node->add_property ("waveform-logscaled", (_flags & WaveformLogScaled) ? "yes" : "no");
_region->add_extra_xml (*node);
}
_flags |= EnvelopeVisible;
}
}
+
+ if ((prop = node->property ("waveform-rectified")) != 0) {
+ if (prop->value() == "yes") {
+ _flags |= WaveformRectified;
+ }
+ }
+
+ if ((prop = node->property ("waveform-logscaled")) != 0) {
+ if (prop->value() == "yes") {
+ _flags |= WaveformLogScaled;
+ }
+ }
}
void
} else {
_flags &= ~WaveformRectified;
}
+ store_flags ();
+ }
+}
+
+void
+AudioRegionView::set_waveform_scale (WaveformScale scale)
+{
+ bool yn = (scale == LogWaveform);
+
+ if (yn != (bool) (_flags & WaveformLogScaled)) {
+ for (vector<WaveView *>::iterator wave = waves.begin(); wave != waves.end() ; ++wave) {
+ (*wave)->property_logscaled() = yn;
+ }
+
+ if (yn) {
+ _flags |= WaveformLogScaled;
+ } else {
+ _flags &= ~WaveformLogScaled;
+ }
+ store_flags ();
}
}
+
GhostRegion*
AudioRegionView::add_ghost (AutomationTimeAxisView& atv)
{
wave->property_samples_per_unit() = samples_per_unit;
wave->property_amplitude_above_axis() = _amplitude_above_axis;
wave->property_wave_color() = color_map[cGhostTrackWave];
+ wave->property_clip_color() = color_map[cGhostTrackWaveClip];
+ wave->property_zero_color() = color_map[cGhostTrackZeroLine];
wave->property_region_start() = _region->start();
ghost->waves.push_back(wave);
switch (id) {
case cMutedWaveForm:
case cWaveForm:
+ case cWaveFormClip:
+ case cZeroLine:
set_colors ();
break;
case cGainLine:
envelope_active_changed();
break;
-
- case cZeroLine:
- if (zero_line) {
- zero_line->property_color_rgba() = (guint) color_map[cZeroLine];
- }
- break;
-
- case cGhostTrackWave:
- break;
default:
break;