add VU and IEC meter DSP (from jmeters)
[ardour.git] / gtk2_ardour / audio_streamview.cc
index 6d24dff2ca745927e97efdcf74725cb680c8269b..088eec17e5b7bb39fd42c5ac4584ff070a3f5f28 100644 (file)
 #include "ardour/rc_configuration.h"
 #include "ardour/session.h"
 
+#include "canvas/rectangle.h"
+
 #include "audio_streamview.h"
 #include "audio_region_view.h"
 #include "tape_region_view.h"
 #include "audio_time_axis.h"
-#include "canvas-waveview.h"
-#include "canvas-simplerect.h"
 #include "region_selection.h"
 #include "selection.h"
 #include "public_editor.h"
@@ -98,19 +98,19 @@ AudioStreamView::create_region_view (boost::shared_ptr<Region> r, bool wait_for_
        case Normal:
                if (recording) {
                        region_view = new AudioRegionView (_canvas_group, _trackview, region,
-                                       _samples_per_unit, region_color, recording, TimeAxisViewItem::Visibility(
-                                                       TimeAxisViewItem::ShowFrame |
-                                                       TimeAxisViewItem::HideFrameRight |
-                                                       TimeAxisViewItem::HideFrameLeft |
-                                                       TimeAxisViewItem::HideFrameTB));
+                                                          _samples_per_pixel, region_color, recording, TimeAxisViewItem::Visibility(
+                                                                  TimeAxisViewItem::ShowFrame |
+                                                                  TimeAxisViewItem::HideFrameRight |
+                                                                  TimeAxisViewItem::HideFrameLeft |
+                                                                  TimeAxisViewItem::HideFrameTB));
                } else {
                        region_view = new AudioRegionView (_canvas_group, _trackview, region,
-                                       _samples_per_unit, region_color);
+                                       _samples_per_pixel, region_color);
                }
                break;
        case Destructive:
                region_view = new TapeAudioRegionView (_canvas_group, _trackview, region,
-                               _samples_per_unit, region_color);
+                               _samples_per_pixel, region_color);
                break;
        default:
                fatal << string_compose (_("programming error: %1"), "illegal track mode in ::add_region_view_internal") << endmsg;
@@ -263,7 +263,7 @@ AudioStreamView::setup_rec_box ()
 
                        at = _trackview.audio_track(); /* we know what it is already */
                        framepos_t const frame_pos = at->current_capture_start ();
-                       gdouble xstart = _trackview.editor().frame_to_pixel (frame_pos);
+                       gdouble xstart = _trackview.editor().sample_to_pixel (frame_pos);
                        gdouble xend;
                        uint32_t fill_color;
 
@@ -271,12 +271,12 @@ AudioStreamView::setup_rec_box ()
                        case Normal:
                        case NonLayered:
                                xend = xstart;
-                               fill_color = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
+                               fill_color = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
                                break;
 
                        case Destructive:
                                xend = xstart + 2;
-                               fill_color = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
+                               fill_color = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
                                /* make the recording rect translucent to allow
                                   the user to see the peak data coming in, etc.
                                */
@@ -284,14 +284,14 @@ AudioStreamView::setup_rec_box ()
                                break;
                        }
 
-                       ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*_canvas_group);
-                       rec_rect->property_x1() = xstart;
-                       rec_rect->property_y1() = 1.0;
-                       rec_rect->property_x2() = xend;
-                       rec_rect->property_y2() = child_height ();
-                       rec_rect->property_outline_what() = 0x0;
-                       rec_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
-                       rec_rect->property_fill_color_rgba() = fill_color;
+                       ArdourCanvas::Rectangle * rec_rect = new ArdourCanvas::Rectangle (_canvas_group);
+                       rec_rect->set_x0 (xstart);
+                       rec_rect->set_y0 (1);
+                       rec_rect->set_x1 (xend);
+                       rec_rect->set_y1 (child_height ());
+                       rec_rect->set_outline_what (0);
+                       rec_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame());
+                       rec_rect->set_fill_color (fill_color);
                        rec_rect->lower_to_bottom();
 
                        RecBoxInfo recbox;
@@ -397,7 +397,7 @@ AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt)
 
                assert (n < rec_rects.size());
 
-               if (!canvas_item_visible (rec_rects[n].rectangle)) {
+               if (!rec_rects[n].rectangle->visible()) {
                        /* rect already hidden, this region is done */
                        iter = tmp;
                        continue;
@@ -434,9 +434,9 @@ AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt)
                                        check_record_layers (region, (region->position() - region->start() + start + cnt));
 
                                        /* also update rect */
-                                       ArdourCanvas::SimpleRect * rect = rec_rects[n].rectangle;
-                                       gdouble xend = _trackview.editor().frame_to_pixel (region->position() + region->length());
-                                       rect->property_x2() = xend;
+                                       ArdourCanvas::Rectangle * rect = rec_rects[n].rectangle;
+                                       gdouble xend = _trackview.editor().sample_to_pixel (region->position() + region->length());
+                                       rect->set_x1 (xend);
                                }
 
                        } else {
@@ -529,15 +529,15 @@ AudioStreamView::color_handler ()
 {
        //case cAudioTrackBase:
        if (_trackview.is_track()) {
-               canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioTrackBase.get();
+               canvas_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_AudioTrackBase());
        }
 
        //case cAudioBusBase:
        if (!_trackview.is_track()) {
                if (Profile->get_sae() && _trackview.route()->is_master()) {
-                       canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioMasterBusBase.get();
+                       canvas_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_AudioMasterBusBase());
                } else {
-                       canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioBusBase.get();
+                       canvas_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_AudioBusBase());
                }
        }
 }