mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
various work waveview amplitude mgmt; fix playhead cursor drag from timebar click
This commit is contained in:
parent
9727a23111
commit
ec102f94e1
13 changed files with 95 additions and 55 deletions
|
|
@ -326,10 +326,8 @@ AudioRegionView::fade_out_active_changed ()
|
||||||
void
|
void
|
||||||
AudioRegionView::region_scale_amplitude_changed ()
|
AudioRegionView::region_scale_amplitude_changed ()
|
||||||
{
|
{
|
||||||
double g = audio_region()->scale_amplitude ();
|
|
||||||
|
|
||||||
for (uint32_t n = 0; n < waves.size(); ++n) {
|
for (uint32_t n = 0; n < waves.size(); ++n) {
|
||||||
waves[n]->set_amplitude (g);
|
waves[n]->gain_changed ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -729,10 +727,10 @@ AudioRegionView::set_samples_per_pixel (gdouble fpp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioRegionView::set_amplitude_above_axis (gdouble spp)
|
AudioRegionView::set_amplitude_above_axis (gdouble a)
|
||||||
{
|
{
|
||||||
for (uint32_t n=0; n < waves.size(); ++n) {
|
for (uint32_t n=0; n < waves.size(); ++n) {
|
||||||
waves[n]->property_amplitude_above_axis() = spp;
|
waves[n]->set_amplitude_above_axis (a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -895,7 +893,6 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
|
||||||
wave->set_y_position (yoff);
|
wave->set_y_position (yoff);
|
||||||
wave->set_height (ht);
|
wave->set_height (ht);
|
||||||
wave->set_samples_per_pixel (samples_per_pixel);
|
wave->set_samples_per_pixel (samples_per_pixel);
|
||||||
wave->property_amplitude_above_axis() = _amplitude_above_axis;
|
|
||||||
|
|
||||||
if (_recregion) {
|
if (_recregion) {
|
||||||
wave->set_outline_color (_region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_RecWaveForm(), MUTED_ALPHA) : ARDOUR_UI::config()->get_canvasvar_RecWaveForm());
|
wave->set_outline_color (_region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_RecWaveForm(), MUTED_ALPHA) : ARDOUR_UI::config()->get_canvasvar_RecWaveForm());
|
||||||
|
|
@ -1075,7 +1072,7 @@ AudioRegionView::add_ghost (TimeAxisView& tv)
|
||||||
wave->set_channel (n);
|
wave->set_channel (n);
|
||||||
wave->set_x_position (0);
|
wave->set_x_position (0);
|
||||||
wave->set_samples_per_pixel (samples_per_pixel);
|
wave->set_samples_per_pixel (samples_per_pixel);
|
||||||
wave->property_amplitude_above_axis() = _amplitude_above_axis;
|
wave->set_amplitude_above_axis (_amplitude_above_axis);
|
||||||
wave->set_region_start (_region->start());
|
wave->set_region_start (_region->start());
|
||||||
|
|
||||||
ghost->waves.push_back(wave);
|
ghost->waves.push_back(wave);
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,7 @@ EditorCursor::set_position (framepos_t frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_pos != _track_canvas_item.x0 ()) {
|
if (new_pos != _track_canvas_item.x0 ()) {
|
||||||
_track_canvas_item.set_x0 (new_pos);
|
_track_canvas_item.set_x (new_pos, new_pos);
|
||||||
_track_canvas_item.set_x1 (new_pos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_current_frame = frame;
|
_current_frame = frame;
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,10 @@ class EditorCursor {
|
||||||
return _track_canvas_item;
|
return _track_canvas_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArdourCanvas::Arrow& time_bar_canvas_item () {
|
||||||
|
return _time_bars_canvas_item;
|
||||||
|
}
|
||||||
|
|
||||||
PBD::Signal1<void, framepos_t> PositionChanged;
|
PBD::Signal1<void, framepos_t> PositionChanged;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -2335,9 +2335,10 @@ TempoMarkerDrag::aborted (bool moved)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CursorDrag::CursorDrag (Editor* e, ArdourCanvas::Item* i, bool s)
|
CursorDrag::CursorDrag (Editor* e, EditorCursor& c, bool s)
|
||||||
: Drag (e, i),
|
: Drag (e, &c.time_bar_canvas_item())
|
||||||
_stop (s)
|
, _cursor (c)
|
||||||
|
, _stop (s)
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::Drags, "New CursorDrag\n");
|
DEBUG_TRACE (DEBUG::Drags, "New CursorDrag\n");
|
||||||
}
|
}
|
||||||
|
|
@ -2376,6 +2377,10 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
|
||||||
|
|
||||||
Session* s = _editor->session ();
|
Session* s = _editor->session ();
|
||||||
|
|
||||||
|
/* grab the track canvas item as well */
|
||||||
|
|
||||||
|
_cursor.track_canvas_item().grab();
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
if (_was_rolling && _stop) {
|
if (_was_rolling && _stop) {
|
||||||
s->request_stop ();
|
s->request_stop ();
|
||||||
|
|
@ -2419,6 +2424,8 @@ CursorDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||||
{
|
{
|
||||||
_editor->_dragging_playhead = false;
|
_editor->_dragging_playhead = false;
|
||||||
|
|
||||||
|
_cursor.track_canvas_item().ungrab();
|
||||||
|
|
||||||
if (!movement_occurred && _stop) {
|
if (!movement_occurred && _stop) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2436,6 +2443,8 @@ CursorDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||||
void
|
void
|
||||||
CursorDrag::aborted (bool)
|
CursorDrag::aborted (bool)
|
||||||
{
|
{
|
||||||
|
_cursor.track_canvas_item().ungrab();
|
||||||
|
|
||||||
if (_editor->_dragging_playhead) {
|
if (_editor->_dragging_playhead) {
|
||||||
_editor->session()->request_resume_timecode_transmission ();
|
_editor->session()->request_resume_timecode_transmission ();
|
||||||
_editor->_dragging_playhead = false;
|
_editor->_dragging_playhead = false;
|
||||||
|
|
|
||||||
|
|
@ -626,7 +626,7 @@ private:
|
||||||
class CursorDrag : public Drag
|
class CursorDrag : public Drag
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CursorDrag (Editor *, ArdourCanvas::Item *, bool);
|
CursorDrag (Editor *, EditorCursor&, bool);
|
||||||
|
|
||||||
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
|
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
|
||||||
void motion (GdkEvent *, bool);
|
void motion (GdkEvent *, bool);
|
||||||
|
|
@ -648,6 +648,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void fake_locate (framepos_t);
|
void fake_locate (framepos_t);
|
||||||
|
|
||||||
|
EditorCursor& _cursor;
|
||||||
bool _stop; ///< true to stop the transport on starting the drag, otherwise false
|
bool _stop; ///< true to stop the transport on starting the drag, otherwise false
|
||||||
double _grab_zoom; ///< editor frames per unit when our grab started
|
double _grab_zoom; ///< editor frames per unit when our grab started
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -708,7 +708,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||||
|
|
||||||
switch (item_type) {
|
switch (item_type) {
|
||||||
case PlayheadCursorItem:
|
case PlayheadCursorItem:
|
||||||
_drags->set (new CursorDrag (this, item, true), event);
|
_drags->set (new CursorDrag (this, *playhead_cursor, true), event);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MarkerItem:
|
case MarkerItem:
|
||||||
|
|
@ -766,7 +766,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||||
case TempoBarItem:
|
case TempoBarItem:
|
||||||
case MeterBarItem:
|
case MeterBarItem:
|
||||||
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
||||||
_drags->set (new CursorDrag (this, &playhead_cursor->track_canvas_item (), false), event);
|
_drags->set (new CursorDrag (this, *playhead_cursor, false), event);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -774,7 +774,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||||
|
|
||||||
case RangeMarkerBarItem:
|
case RangeMarkerBarItem:
|
||||||
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
||||||
_drags->set (new CursorDrag (this, &playhead_cursor->track_canvas_item (), false), event);
|
_drags->set (new CursorDrag (this, *playhead_cursor, false), event);
|
||||||
} else {
|
} else {
|
||||||
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateRangeMarker), event);
|
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateRangeMarker), event);
|
||||||
}
|
}
|
||||||
|
|
@ -783,7 +783,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||||
|
|
||||||
case CdMarkerBarItem:
|
case CdMarkerBarItem:
|
||||||
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
||||||
_drags->set (new CursorDrag (this, &playhead_cursor->track_canvas_item (), false), event);
|
_drags->set (new CursorDrag (this, *playhead_cursor, false), event);
|
||||||
} else {
|
} else {
|
||||||
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateCDMarker), event);
|
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateCDMarker), event);
|
||||||
}
|
}
|
||||||
|
|
@ -792,7 +792,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||||
|
|
||||||
case TransportMarkerBarItem:
|
case TransportMarkerBarItem:
|
||||||
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
|
||||||
_drags->set (new CursorDrag (this, &playhead_cursor->track_canvas_item (), false), event);
|
_drags->set (new CursorDrag (this, *playhead_cursor, false), event);
|
||||||
} else {
|
} else {
|
||||||
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateTransportMarker), event);
|
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateTransportMarker), event);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ Editor::ruler_button_press (GdkEventButton* ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* playhead cursor */
|
/* playhead cursor */
|
||||||
_drags->set (new CursorDrag (this, &playhead_cursor->track_canvas_item (), false), reinterpret_cast<GdkEvent *> (ev));
|
_drags->set (new CursorDrag (this, *playhead_cursor, false), reinterpret_cast<GdkEvent *> (ev));
|
||||||
_dragging_playhead = true;
|
_dragging_playhead = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "canvas/polygon.h"
|
#include "canvas/polygon.h"
|
||||||
#include "canvas/text.h"
|
#include "canvas/text.h"
|
||||||
#include "canvas/canvas.h"
|
#include "canvas/canvas.h"
|
||||||
|
#include "canvas/debug.h"
|
||||||
|
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
/*
|
/*
|
||||||
|
|
@ -252,9 +253,8 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
|
||||||
/* adjust to properly locate the tip */
|
/* adjust to properly locate the tip */
|
||||||
|
|
||||||
mark = new ArdourCanvas::Polygon (group);
|
mark = new ArdourCanvas::Polygon (group);
|
||||||
#ifdef CANVAS_DEBUG
|
CANVAS_DEBUG_NAME (mark, string_compose ("Marker::mark for %1", annotation));
|
||||||
mark->name = string_compose ("Marker::mark for %1", annotation);
|
|
||||||
#endif
|
|
||||||
mark->set (*points);
|
mark->set (*points);
|
||||||
set_color_rgba (rgba);
|
set_color_rgba (rgba);
|
||||||
|
|
||||||
|
|
@ -270,12 +270,9 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
|
||||||
Gtkmm2ext::get_ink_pixel_size (layout, width, name_height);
|
Gtkmm2ext::get_ink_pixel_size (layout, width, name_height);
|
||||||
|
|
||||||
_name_item = new ArdourCanvas::Text (group);
|
_name_item = new ArdourCanvas::Text (group);
|
||||||
|
CANVAS_DEBUG_NAME (_name_item, string_compose ("Marker::_name_item for %1", annotation));
|
||||||
_name_item->set_font_description (name_font);
|
_name_item->set_font_description (name_font);
|
||||||
_name_item->set_color (RGBA_TO_UINT (0,0,0,255));
|
_name_item->set_color (RGBA_TO_UINT (0,0,0,255));
|
||||||
|
|
||||||
#ifdef CANVAS_DEBUG
|
|
||||||
_name_item->name = string_compose ("Marker::_name_item for %1", annotation);
|
|
||||||
#endif
|
|
||||||
_name_item->set_position (ArdourCanvas::Duple (_label_offset, (13.0 / 2.0) - (name_height / 2.0)));
|
_name_item->set_position (ArdourCanvas::Duple (_label_offset, (13.0 / 2.0) - (name_height / 2.0)));
|
||||||
|
|
||||||
set_name (annotation.c_str());
|
set_name (annotation.c_str());
|
||||||
|
|
@ -292,7 +289,6 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
|
||||||
if (handle_events) {
|
if (handle_events) {
|
||||||
group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), group, this));
|
group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), group, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Marker::~Marker ()
|
Marker::~Marker ()
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,18 @@ Canvas::render (Rect const & area, Cairo::RefPtr<Cairo::Context> const & context
|
||||||
|
|
||||||
context->save ();
|
context->save ();
|
||||||
|
|
||||||
|
#ifdef CANVAS_DEBUG
|
||||||
|
if (getenv ("ARDOUR_REDRAW_CANVAS")) {
|
||||||
|
/* light up the canvas to show redraws */
|
||||||
|
context->set_source_rgba (random()%255 / 255.0,
|
||||||
|
random()%255 / 255.0,
|
||||||
|
random()%255 / 255.0,
|
||||||
|
255);
|
||||||
|
context->rectangle (area.x0, area.y0, area.width(), area.height());
|
||||||
|
context->stroke ();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* clip to the requested area */
|
/* clip to the requested area */
|
||||||
context->rectangle (area.x0, area.y0, area.width(), area.height());
|
context->rectangle (area.x0, area.y0, area.width(), area.height());
|
||||||
context->clip ();
|
context->clip ();
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ public:
|
||||||
void set_y0 (Coord);
|
void set_y0 (Coord);
|
||||||
void set_x1 (Coord);
|
void set_x1 (Coord);
|
||||||
void set_y1 (Coord);
|
void set_y1 (Coord);
|
||||||
|
void set_x (Coord, Coord);
|
||||||
|
|
||||||
Coord x0 () const {
|
Coord x0 () const {
|
||||||
return _points[0].x;
|
return _points[0].x;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,17 +65,17 @@ public:
|
||||||
void set_outline_color (Color);
|
void set_outline_color (Color);
|
||||||
|
|
||||||
void region_resized ();
|
void region_resized ();
|
||||||
|
void gain_changed ();
|
||||||
|
|
||||||
void set_show_zero_line (bool);
|
void set_show_zero_line (bool);
|
||||||
bool show_zero_line() const { return _show_zero; }
|
bool show_zero_line() const { return _show_zero; }
|
||||||
void set_zero_color (Color);
|
void set_zero_color (Color);
|
||||||
void set_clip_color (Color);
|
void set_clip_color (Color);
|
||||||
void set_amplitude (double);
|
|
||||||
void set_logscaled (bool);
|
void set_logscaled (bool);
|
||||||
void set_gradient_depth (double);
|
void set_gradient_depth (double);
|
||||||
double gradient_depth() const { return _gradient_depth; }
|
double gradient_depth() const { return _gradient_depth; }
|
||||||
void set_shape (Shape);
|
void set_shape (Shape);
|
||||||
double amplitude() const { return _amplitude; }
|
|
||||||
|
|
||||||
/* currently missing because we don't need them (yet):
|
/* currently missing because we don't need them (yet):
|
||||||
set_shape_independent();
|
set_shape_independent();
|
||||||
|
|
@ -90,6 +90,9 @@ public:
|
||||||
static bool global_logscaled() { return _global_logscaled; }
|
static bool global_logscaled() { return _global_logscaled; }
|
||||||
static Shape global_shape() { return _global_shape; }
|
static Shape global_shape() { return _global_shape; }
|
||||||
|
|
||||||
|
void set_amplitude_above_axis (double v);
|
||||||
|
double amplitude_above_axis () const { return _amplitude_above_axis; }
|
||||||
|
|
||||||
#ifdef CANVAS_COMPATIBILITY
|
#ifdef CANVAS_COMPATIBILITY
|
||||||
void*& property_gain_src () {
|
void*& property_gain_src () {
|
||||||
return _foo_void;
|
return _foo_void;
|
||||||
|
|
@ -97,15 +100,9 @@ public:
|
||||||
void*& property_gain_function () {
|
void*& property_gain_function () {
|
||||||
return _foo_void;
|
return _foo_void;
|
||||||
}
|
}
|
||||||
double& property_amplitude_above_axis () {
|
|
||||||
return _foo_double;
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
void* _foo_void;
|
void* _foo_void;
|
||||||
bool _foo_bool;
|
|
||||||
int _foo_int;
|
|
||||||
Color _foo_uint;
|
|
||||||
double _foo_double;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class CacheEntry
|
class CacheEntry
|
||||||
|
|
@ -157,10 +154,10 @@ private:
|
||||||
bool _logscaled;
|
bool _logscaled;
|
||||||
Shape _shape;
|
Shape _shape;
|
||||||
double _gradient_depth;
|
double _gradient_depth;
|
||||||
double _amplitude;
|
|
||||||
bool _shape_independent;
|
bool _shape_independent;
|
||||||
bool _logscaled_independent;
|
bool _logscaled_independent;
|
||||||
bool _gradient_depth_independent;
|
bool _gradient_depth_independent;
|
||||||
|
double _amplitude_above_axis;
|
||||||
|
|
||||||
/** The `start' value to use for the region; we can't use the region's
|
/** The `start' value to use for the region; we can't use the region's
|
||||||
* value as the crossfade editor needs to alter it.
|
* value as the crossfade editor needs to alter it.
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,20 @@ Line::set (Duple a, Duple b)
|
||||||
DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: line change\n");
|
DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: line change\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Line::set_x (Coord x0, Coord x1)
|
||||||
|
{
|
||||||
|
begin_change ();
|
||||||
|
|
||||||
|
_points[0].x = x0;
|
||||||
|
_points[1].x = x1;
|
||||||
|
|
||||||
|
_bounding_box_dirty = true;
|
||||||
|
end_change ();
|
||||||
|
|
||||||
|
DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: line change\n");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Line::set_x0 (Coord x0)
|
Line::set_x0 (Coord x0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,10 @@ WaveView::WaveView (Group* parent, boost::shared_ptr<ARDOUR::AudioRegion> region
|
||||||
, _logscaled (_global_logscaled)
|
, _logscaled (_global_logscaled)
|
||||||
, _shape (_global_shape)
|
, _shape (_global_shape)
|
||||||
, _gradient_depth (_global_gradient_depth)
|
, _gradient_depth (_global_gradient_depth)
|
||||||
, _amplitude (1.0)
|
|
||||||
, _shape_independent (false)
|
, _shape_independent (false)
|
||||||
, _logscaled_independent (false)
|
, _logscaled_independent (false)
|
||||||
, _gradient_depth_independent (false)
|
, _gradient_depth_independent (false)
|
||||||
|
, _amplitude_above_axis (1.0)
|
||||||
, _region_start (0)
|
, _region_start (0)
|
||||||
{
|
{
|
||||||
VisualPropertiesChanged.connect_same_thread (invalidation_connection, boost::bind (&WaveView::handle_visual_property_change, this));
|
VisualPropertiesChanged.connect_same_thread (invalidation_connection, boost::bind (&WaveView::handle_visual_property_change, this));
|
||||||
|
|
@ -252,21 +252,26 @@ WaveView::set_channel (int channel)
|
||||||
void
|
void
|
||||||
WaveView::invalidate_whole_cache ()
|
WaveView::invalidate_whole_cache ()
|
||||||
{
|
{
|
||||||
|
begin_visual_change ();
|
||||||
for (list<CacheEntry*>::iterator i = _cache.begin(); i != _cache.end(); ++i) {
|
for (list<CacheEntry*>::iterator i = _cache.begin(); i != _cache.end(); ++i) {
|
||||||
delete *i;
|
delete *i;
|
||||||
}
|
}
|
||||||
|
|
||||||
_cache.clear ();
|
_cache.clear ();
|
||||||
_canvas->item_visual_property_changed (this);
|
|
||||||
|
end_visual_change ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WaveView::invalidate_image_cache ()
|
WaveView::invalidate_image_cache ()
|
||||||
{
|
{
|
||||||
|
begin_visual_change ();
|
||||||
|
|
||||||
for (list<CacheEntry*>::iterator i = _cache.begin(); i != _cache.end(); ++i) {
|
for (list<CacheEntry*>::iterator i = _cache.begin(); i != _cache.end(); ++i) {
|
||||||
(*i)->clear_image ();
|
(*i)->clear_image ();
|
||||||
}
|
}
|
||||||
_canvas->item_visual_property_changed (this);
|
|
||||||
|
end_visual_change ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -285,12 +290,9 @@ WaveView::set_logscaled (bool yn)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WaveView::set_amplitude (double a)
|
WaveView::gain_changed ()
|
||||||
{
|
{
|
||||||
if (_amplitude != a) {
|
invalidate_whole_cache ();
|
||||||
_amplitude = a;
|
|
||||||
invalidate_image_cache ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -329,6 +331,15 @@ WaveView::set_shape (Shape s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
WaveView::set_amplitude_above_axis (double a)
|
||||||
|
{
|
||||||
|
if (_amplitude_above_axis != a) {
|
||||||
|
_amplitude_above_axis = a;
|
||||||
|
invalidate_image_cache ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WaveView::set_global_shape (Shape s)
|
WaveView::set_global_shape (Shape s)
|
||||||
{
|
{
|
||||||
|
|
@ -410,7 +421,6 @@ WaveView::CacheEntry::image ()
|
||||||
|
|
||||||
context->begin_new_path();
|
context->begin_new_path();
|
||||||
|
|
||||||
|
|
||||||
if (_wave_view->_shape == WaveView::Rectified) {
|
if (_wave_view->_shape == WaveView::Rectified) {
|
||||||
|
|
||||||
/* top edge of waveform is based on max (fabs (peak_min, peak_max))
|
/* top edge of waveform is based on max (fabs (peak_min, peak_max))
|
||||||
|
|
@ -418,13 +428,12 @@ WaveView::CacheEntry::image ()
|
||||||
|
|
||||||
if (_wave_view->_logscaled) {
|
if (_wave_view->_logscaled) {
|
||||||
for (int i = 0; i < _n_peaks; ++i) {
|
for (int i = 0; i < _n_peaks; ++i) {
|
||||||
context->line_to (i + 0.5, position (_wave_view->amplitude() *
|
context->line_to (i + 0.5, position (alt_log_meter (fast_coefficient_to_dB (
|
||||||
alt_log_meter (fast_coefficient_to_dB (
|
|
||||||
max (fabs (_peaks[i].max), fabs (_peaks[i].min))))));
|
max (fabs (_peaks[i].max), fabs (_peaks[i].min))))));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < _n_peaks; ++i) {
|
for (int i = 0; i < _n_peaks; ++i) {
|
||||||
context->line_to (i + 0.5, position (_wave_view->amplitude() * max (fabs (_peaks[i].max), fabs (_peaks[i].min))));
|
context->line_to (i + 0.5, position (max (fabs (_peaks[i].max), fabs (_peaks[i].min))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -433,16 +442,16 @@ WaveView::CacheEntry::image ()
|
||||||
for (int i = 0; i < _n_peaks; ++i) {
|
for (int i = 0; i < _n_peaks; ++i) {
|
||||||
Coord y = _peaks[i].max;
|
Coord y = _peaks[i].max;
|
||||||
if (y > 0.0) {
|
if (y > 0.0) {
|
||||||
context->line_to (i + 0.5, position (_wave_view->amplitude() * alt_log_meter (fast_coefficient_to_dB (y))));
|
context->line_to (i + 0.5, position (alt_log_meter (fast_coefficient_to_dB (y))));
|
||||||
} else if (y < 0.0) {
|
} else if (y < 0.0) {
|
||||||
context->line_to (i + 0.5, position (_wave_view->amplitude() * -alt_log_meter (fast_coefficient_to_dB (-y))));
|
context->line_to (i + 0.5, position (alt_log_meter (fast_coefficient_to_dB (-y))));
|
||||||
} else {
|
} else {
|
||||||
context->line_to (i + 0.5, position (0.0));
|
context->line_to (i + 0.5, position (0.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < _n_peaks; ++i) {
|
for (int i = 0; i < _n_peaks; ++i) {
|
||||||
context->line_to (i + 0.5, position (_wave_view->amplitude() * _peaks[i].max));
|
context->line_to (i + 0.5, position (_peaks[i].max));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -469,16 +478,16 @@ WaveView::CacheEntry::image ()
|
||||||
for (int i = _n_peaks-1; i >= 0; --i) {
|
for (int i = _n_peaks-1; i >= 0; --i) {
|
||||||
Coord y = _peaks[i].min;
|
Coord y = _peaks[i].min;
|
||||||
if (y > 0.0) {
|
if (y > 0.0) {
|
||||||
context->line_to (i + 0.5, position (_wave_view->amplitude() * alt_log_meter (fast_coefficient_to_dB (y))));
|
context->line_to (i + 0.5, position (alt_log_meter (fast_coefficient_to_dB (y))));
|
||||||
} else if (y < 0.0) {
|
} else if (y < 0.0) {
|
||||||
context->line_to (i + 0.5, position (_wave_view->amplitude() * -alt_log_meter (fast_coefficient_to_dB (-y))));
|
context->line_to (i + 0.5, position (-alt_log_meter (fast_coefficient_to_dB (-y))));
|
||||||
} else {
|
} else {
|
||||||
context->line_to (i + 0.5, position (0.0));
|
context->line_to (i + 0.5, position (0.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = _n_peaks-1; i >= 0; --i) {
|
for (int i = _n_peaks-1; i >= 0; --i) {
|
||||||
context->line_to (i + 0.5, position (_wave_view->amplitude() * _peaks[i].min));
|
context->line_to (i + 0.5, position (_peaks[i].min));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue