Ardour  9.0-pre0-582-g084a23a80d
ArdourWaveView::WaveView Class Reference

#include <wave_view.h>

Inheritance diagram for ArdourWaveView::WaveView:
[legend]

Classes

struct  LineTips
 

Public Types

enum  Shape { Normal , Rectified }
 
- Public Types inherited from ArdourCanvas::Fill
typedef std::vector< std::pair< double, Gtkmm2ext::Color > > StopList
 

Public Member Functions

std::string debug_name () const
 
 WaveView (ArdourCanvas::Canvas *, std::shared_ptr< ARDOUR::AudioRegion >)
 
 WaveView (Item *, std::shared_ptr< ARDOUR::AudioRegion >)
 
 ~WaveView ()
 
virtual void prepare_for_render (ArdourCanvas::Rect const &window_area) const
 
virtual void render (ArdourCanvas::Rect const &area, Cairo::RefPtr< Cairo::Context >) const
 
void compute_bounding_box () const
 
void set_samples_per_pixel (double)
 
void set_height (ArdourCanvas::Distance)
 
void set_channel (int)
 
void set_region_start (ARDOUR::sampleoffset_t)
 
void set_start_shift (double pixels)
 
void set_fill_color (Gtkmm2ext::Color)
 
void set_outline_color (Gtkmm2ext::Color)
 
void region_resized ()
 
void gain_changed ()
 
void set_show_zero_line (bool)
 
bool show_zero_line () const
 
void set_zero_color (Gtkmm2ext::Color)
 
void set_clip_color (Gtkmm2ext::Color)
 
void set_logscaled (bool)
 
void set_gradient_depth (double)
 
double gradient_depth () const
 
void set_shape (Shape)
 
void set_always_get_image_in_thread (bool yn)
 
void set_amplitude_above_axis (double v)
 
double amplitude_above_axis () const
 
- Public Member Functions inherited from ArdourCanvas::Item
 Item (Canvas *)
 
 Item (Item *)
 
 Item (Item *, Duple const &p)
 
virtual ~Item ()
 
void redraw () const
 
virtual void add_items_at_point (Duple point, std::vector< Item const * > &items) const
 
virtual bool covers (Duple const &point) const
 
void grab ()
 
void ungrab ()
 
void unparent ()
 
void reparent (Item *, bool already_added=false)
 
Itemparent () const
 
uint32_t depth () const
 
const Itemclosest_ancestor_with (const Item &other) const
 
bool common_ancestor_within (uint32_t, const Item &other) const
 
bool is_ancestor_of (const Item &candidate) const
 
bool is_descendant_of (const Item &candidate) const
 
void set_position (Duple)
 
void set_x_position (Coord)
 
void set_y_position (Coord)
 
void move (Duple)
 
Duple position () const
 
Duple window_origin () const
 
Duple canvas_origin () const
 
ScrollGroupscroll_parent () const
 
virtual void size_request (double &w, double &h) const
 
void set_size_request (double w, double h)
 
void set_size_request_to_display_given_text (const std::vector< std::string > &strings, gint hpadding, gint vpadding)
 
void size_allocate (Rect const &)
 
virtual void _size_allocate (Rect const &)
 
virtual void size_allocate_children (Rect const &r)
 
Rect allocation () const
 
void set_layout_sensitive (bool)
 
bool layout_sensitive () const
 
Rect bounding_box () const
 
Coord height () const
 
Coord width () const
 
Duple item_to_parent (Duple const &) const
 
Rect item_to_parent (Rect const &) const
 
Duple parent_to_item (Duple const &) const
 
Rect parent_to_item (Rect const &) const
 
void canvas_to_item (Coord &, Coord &) const
 
void item_to_canvas (Coord &, Coord &) const
 
Duple canvas_to_item (Duple const &) const
 
Rect item_to_canvas (Rect const &) const
 
Duple item_to_canvas (Duple const &) const
 
Rect canvas_to_item (Rect const &) const
 
Duple item_to_window (Duple const &, bool rounded=true) const
 
Duple window_to_item (Duple const &) const
 
Rect item_to_window (Rect const &, bool rounded=true) const
 
Rect window_to_item (Rect const &) const
 
void raise_to_top ()
 
void raise (int)
 
void lower_to_bottom ()
 
virtual void hide ()
 
virtual void show ()
 
void block_change_notifications ()
 
void unblock_change_notifications ()
 
bool self_visible () const
 
bool visible () const
 
Canvascanvas () const
 
void set_ignore_events (bool)
 
bool ignore_events () const
 
void set_data (std::string const &, void *)
 
void * get_data (std::string const &) const
 
virtual void add (Item *)
 
virtual void add_front (Item *)
 
virtual void remove (Item *)
 
void clear (bool with_delete=false)
 
std::list< Item * > const & items () const
 
void raise_child_to_top (Item *)
 
void raise_child (Item *, int)
 
void lower_child_to_bottom (Item *)
 
virtual void child_changed (bool bbox_changed)
 
PackOptions pack_options () const
 
void set_pack_options (PackOptions)
 
std::string whoami () const
 
const std::string & tooltip () const
 
void set_tooltip (const std::string &)
 
void start_tooltip_timeout ()
 
void stop_tooltip_timeout ()
 
virtual void dump (std::ostream &) const
 
std::string whatami () const
 
bool resize_queued () const
 
void queue_resize ()
 
bool scroll_translation () const
 
void disable_scroll_translation ()
 
virtual void layout ()
 
Duple position_offset () const
 
- Public Member Functions inherited from ArdourCanvas::Fill
 Fill (Item &self)
 
 Fill (const Fill &)=delete
 
Filloperator= (const Fill &)=delete
 
virtual ~Fill ()
 
virtual void set_fill (bool)
 
Gtkmm2ext::Color fill_color () const
 
bool fill () const
 
void set_gradient (StopList const &stops, bool is_vertical)
 
void set_pattern (Cairo::RefPtr< Cairo::Pattern >)
 
- Public Member Functions inherited from ArdourCanvas::Outline
 Outline (Item &self)
 
 Outline (const Outline &)=delete
 
Outlineoperator= (const Outline &)=delete
 
virtual ~Outline ()
 
Gtkmm2ext::Color outline_color () const
 
Distance outline_width () const
 
virtual void set_outline_width (Distance)
 
bool outline () const
 
virtual void set_outline (bool)
 

Static Public Member Functions

static void set_global_gradient_depth (double)
 
static void set_global_logscaled (bool)
 
static void set_global_shape (Shape)
 
static void set_global_show_waveform_clipping (bool)
 
static void clear_cache ()
 
static double global_gradient_depth ()
 
static bool global_logscaled ()
 
static Shape global_shape ()
 
static void set_clip_level (double dB)
 
static void start_drawing_thread ()
 
static void stop_drawing_thread ()
 
static void set_image_cache_size (uint64_t)
 

Static Public Attributes

static PBD::Signal< void()> ClipLevelChanged
 
- Static Public Attributes inherited from ArdourCanvas::Item
static int default_items_per_cell
 

Private Member Functions

ARDOUR::samplecnt_t region_length () const
 
ARDOUR::samplepos_t region_end () const
 
bool rendered () const
 
bool draw_image_in_gui_thread () const
 
void init ()
 
void handle_visual_property_change ()
 
void handle_clip_level_change ()
 
ARDOUR::samplecnt_t optimal_image_width_samples () const
 
void set_image (std::shared_ptr< WaveViewImage > img) const
 
bool get_item_and_draw_rect_in_window_coords (ArdourCanvas::Rect const &canvas_rect, ArdourCanvas::Rect &item_area, ArdourCanvas::Rect &draw_rect) const
 
std::shared_ptr< WaveViewDrawRequestcreate_draw_request (WaveViewProperties const &) const
 
void queue_draw_request (std::shared_ptr< WaveViewDrawRequest > const &) const
 
std::shared_ptr< WaveViewCacheGroupget_cache_group () const
 
void reset_cache_group ()
 

Static Private Member Functions

static ArdourCanvas::Coord y_extent (double, Shape const, double const height)
 
static void compute_tips (ARDOUR::PeakData const &peak, LineTips &tips, double const effective_height)
 
static void draw_image (Cairo::RefPtr< Cairo::ImageSurface > &, ARDOUR::PeakData *, int n_peaks, std::shared_ptr< WaveViewDrawRequest >)
 
static void draw_absent_image (Cairo::RefPtr< Cairo::ImageSurface > &, ARDOUR::PeakData *, int)
 
static void process_draw_request (std::shared_ptr< WaveViewDrawRequest >)
 

Private Attributes

std::shared_ptr< ARDOUR::AudioRegion_region
 
const std::unique_ptr< WaveViewProperties_props
 
std::shared_ptr< WaveViewImage_image
 
std::shared_ptr< WaveViewCacheGroup_cache_group
 
bool _shape_independent
 
bool _logscaled_independent
 
bool _gradient_depth_independent
 
bool _draw_image_in_gui_thread
 
bool _always_draw_image_in_gui_thread
 
std::shared_ptr< WaveViewDrawRequestcurrent_request
 
PBD::ScopedConnectionList invalidation_connection
 

Static Private Attributes

static double _global_gradient_depth
 
static bool _global_logscaled
 
static Shape _global_shape
 
static bool _global_show_waveform_clipping
 
static double _global_clip_level
 
static PBD::Signal< void()> VisualPropertiesChanged
 

Friends

class WaveViewThreadClient
 
class WaveViewThreads
 

Additional Inherited Members

- Public Attributes inherited from ArdourCanvas::Item
sigc::signal1< bool, GdkEvent *, EventAccumulator< bool > > Event
 
bool _resize_queued
 
double _requested_width
 
double _requested_height
 
- Protected Member Functions inherited from ArdourCanvas::Item
void begin_change ()
 
void end_change ()
 
void begin_visual_change ()
 
void end_visual_change ()
 
void set_bbox_clean () const
 
void set_bbox_dirty () const
 
bool bbox_dirty () const
 
void invalidate_lut () const
 
void clear_items (bool with_delete)
 
void ensure_lut () const
 
void add_child_bounding_boxes (bool include_hidden=false) const
 
void render_children (Rect const &area, Cairo::RefPtr< Cairo::Context > context) const
 
void prepare_for_render_children (Rect const &area) const
 
Duple scroll_offset () const
 
- Protected Member Functions inherited from ArdourCanvas::Fill
void setup_fill_context (Cairo::RefPtr< Cairo::Context >) const
 
void setup_gradient_context (Cairo::RefPtr< Cairo::Context >, Rect const &, Duple const &) const
 
- Protected Member Functions inherited from ArdourCanvas::Outline
void setup_outline_context (Cairo::RefPtr< Cairo::Context >) const
 
- Protected Attributes inherited from ArdourCanvas::Item
Canvas_canvas
 
Item_parent
 
ScrollGroup_scroll_parent
 
Duple _position
 
bool _visible
 
Rect _pre_change_bounding_box
 
Rect _bounding_box
 
PackOptions _pack_options
 
Rect _allocation
 
bool _layout_sensitive
 
std::map< std::string, void * > _data
 
LookupTable_lut
 
std::list< Item * > _items
 
- Protected Attributes inherited from ArdourCanvas::Fill
Item_self
 
Gtkmm2ext::Color _fill_color
 
bool _fill
 
bool _transparent
 
StopList _stops
 
bool _vertical_gradient
 
Cairo::RefPtr< Cairo::Pattern > _pattern
 
- Protected Attributes inherited from ArdourCanvas::Outline
Item_self
 
Gtkmm2ext::Color _outline_color
 
Distance _outline_width
 
bool _outline
 

Detailed Description

Definition at line 49 of file wave_view.h.

Member Enumeration Documentation

◆ Shape

Enumerator
Normal 
Rectified 

Definition at line 52 of file wave_view.h.

Constructor & Destructor Documentation

◆ WaveView() [1/2]

ArdourWaveView::WaveView::WaveView ( ArdourCanvas::Canvas ,
std::shared_ptr< ARDOUR::AudioRegion  
)

◆ WaveView() [2/2]

ArdourWaveView::WaveView::WaveView ( Item ,
std::shared_ptr< ARDOUR::AudioRegion  
)

◆ ~WaveView()

ArdourWaveView::WaveView::~WaveView ( )

Member Function Documentation

◆ amplitude_above_axis()

double ArdourWaveView::WaveView::amplitude_above_axis ( ) const

◆ clear_cache()

static void ArdourWaveView::WaveView::clear_cache ( )
static

◆ compute_bounding_box()

void ArdourWaveView::WaveView::compute_bounding_box ( ) const
virtual

Update _bounding_box and _bounding_box_dirty

Implements ArdourCanvas::Item.

◆ compute_tips()

static void ArdourWaveView::WaveView::compute_tips ( ARDOUR::PeakData const &  peak,
LineTips tips,
double const  effective_height 
)
staticprivate

◆ create_draw_request()

std::shared_ptr<WaveViewDrawRequest> ArdourWaveView::WaveView::create_draw_request ( WaveViewProperties const &  ) const
private

◆ debug_name()

std::string ArdourWaveView::WaveView::debug_name ( ) const

◆ draw_absent_image()

static void ArdourWaveView::WaveView::draw_absent_image ( Cairo::RefPtr< Cairo::ImageSurface > &  ,
ARDOUR::PeakData ,
int   
)
staticprivate

◆ draw_image()

static void ArdourWaveView::WaveView::draw_image ( Cairo::RefPtr< Cairo::ImageSurface > &  ,
ARDOUR::PeakData ,
int  n_peaks,
std::shared_ptr< WaveViewDrawRequest  
)
staticprivate

◆ draw_image_in_gui_thread()

bool ArdourWaveView::WaveView::draw_image_in_gui_thread ( ) const
private

◆ gain_changed()

void ArdourWaveView::WaveView::gain_changed ( )

◆ get_cache_group()

std::shared_ptr<WaveViewCacheGroup> ArdourWaveView::WaveView::get_cache_group ( ) const
private

◆ get_item_and_draw_rect_in_window_coords()

bool ArdourWaveView::WaveView::get_item_and_draw_rect_in_window_coords ( ArdourCanvas::Rect const &  canvas_rect,
ArdourCanvas::Rect item_area,
ArdourCanvas::Rect draw_rect 
) const
private

◆ global_gradient_depth()

static double ArdourWaveView::WaveView::global_gradient_depth ( )
inlinestatic

Definition at line 129 of file wave_view.h.

◆ global_logscaled()

static bool ArdourWaveView::WaveView::global_logscaled ( )
inlinestatic

Definition at line 131 of file wave_view.h.

◆ global_shape()

static Shape ArdourWaveView::WaveView::global_shape ( )
inlinestatic

Definition at line 133 of file wave_view.h.

◆ gradient_depth()

double ArdourWaveView::WaveView::gradient_depth ( ) const

◆ handle_clip_level_change()

void ArdourWaveView::WaveView::handle_clip_level_change ( )
private

◆ handle_visual_property_change()

void ArdourWaveView::WaveView::handle_visual_property_change ( )
private

◆ init()

void ArdourWaveView::WaveView::init ( )
private

◆ optimal_image_width_samples()

ARDOUR::samplecnt_t ArdourWaveView::WaveView::optimal_image_width_samples ( ) const
private

◆ prepare_for_render()

virtual void ArdourWaveView::WaveView::prepare_for_render ( ArdourCanvas::Rect const &  area) const
virtual

Item has changed will be rendered in next render pass so give item a chance to perhaps schedule work in another thread etc.

Parameters
areaArea to draw, in window coordinates

Reimplemented from ArdourCanvas::Item.

◆ process_draw_request()

static void ArdourWaveView::WaveView::process_draw_request ( std::shared_ptr< WaveViewDrawRequest )
staticprivate

◆ queue_draw_request()

void ArdourWaveView::WaveView::queue_draw_request ( std::shared_ptr< WaveViewDrawRequest > const &  ) const
private

◆ region_end()

ARDOUR::samplepos_t ArdourWaveView::WaveView::region_end ( ) const
private

Under almost conditions, this is going to return _region->start() + _region->length(), but if region_start has been reset, then we need to use this modified computation.

◆ region_length()

ARDOUR::samplecnt_t ArdourWaveView::WaveView::region_length ( ) const
private

Under almost conditions, this is going to return _region->length(), but if region_start has been reset, then we need to use this modified computation.

◆ region_resized()

void ArdourWaveView::WaveView::region_resized ( )

◆ render()

virtual void ArdourWaveView::WaveView::render ( ArdourCanvas::Rect const &  area,
Cairo::RefPtr< Cairo::Context >   
) const
virtual

Render this item to a Cairo context.

Parameters
areaArea to draw, in window coordinates

Items must convert their own coordinates into window coordinates because Cairo is limited to a fixed point coordinate space that does not extend as far as the Ardour timeline. All rendering must be done using coordinates that do not exceed the (rough) limits of the canvas' window, to avoid odd errors within Cairo as it converts doubles into its fixed point format and then tesselates the results.

Implements ArdourCanvas::Item.

◆ rendered()

bool ArdourWaveView::WaveView::rendered ( ) const
inlineprivate

_image stays non-null after the first time it is set

Definition at line 178 of file wave_view.h.

◆ reset_cache_group()

void ArdourWaveView::WaveView::reset_cache_group ( )
private

Notify the Cache that we are dropping our reference to the CacheGroup so it can also do so if it is the only reference holder of the cache group.

◆ set_always_get_image_in_thread()

void ArdourWaveView::WaveView::set_always_get_image_in_thread ( bool  yn)

◆ set_amplitude_above_axis()

void ArdourWaveView::WaveView::set_amplitude_above_axis ( double  v)

◆ set_channel()

void ArdourWaveView::WaveView::set_channel ( int  )

◆ set_clip_color()

void ArdourWaveView::WaveView::set_clip_color ( Gtkmm2ext::Color  )

◆ set_clip_level()

static void ArdourWaveView::WaveView::set_clip_level ( double  dB)
static

◆ set_fill_color()

void ArdourWaveView::WaveView::set_fill_color ( Gtkmm2ext::Color  )
virtual

Reimplemented from ArdourCanvas::Fill.

◆ set_global_gradient_depth()

static void ArdourWaveView::WaveView::set_global_gradient_depth ( double  )
static

◆ set_global_logscaled()

static void ArdourWaveView::WaveView::set_global_logscaled ( bool  )
static

◆ set_global_shape()

static void ArdourWaveView::WaveView::set_global_shape ( Shape  )
static

◆ set_global_show_waveform_clipping()

static void ArdourWaveView::WaveView::set_global_show_waveform_clipping ( bool  )
static

◆ set_gradient_depth()

void ArdourWaveView::WaveView::set_gradient_depth ( double  )

◆ set_height()

void ArdourWaveView::WaveView::set_height ( ArdourCanvas::Distance  )

◆ set_image()

void ArdourWaveView::WaveView::set_image ( std::shared_ptr< WaveViewImage img) const
private

◆ set_image_cache_size()

static void ArdourWaveView::WaveView::set_image_cache_size ( uint64_t  )
static

◆ set_logscaled()

void ArdourWaveView::WaveView::set_logscaled ( bool  )

◆ set_outline_color()

void ArdourWaveView::WaveView::set_outline_color ( Gtkmm2ext::Color  )
virtual

Reimplemented from ArdourCanvas::Outline.

◆ set_region_start()

void ArdourWaveView::WaveView::set_region_start ( ARDOUR::sampleoffset_t  )

◆ set_samples_per_pixel()

void ArdourWaveView::WaveView::set_samples_per_pixel ( double  )

◆ set_shape()

void ArdourWaveView::WaveView::set_shape ( Shape  )

◆ set_show_zero_line()

void ArdourWaveView::WaveView::set_show_zero_line ( bool  )

◆ set_start_shift()

void ArdourWaveView::WaveView::set_start_shift ( double  pixels)

Change the first position drawn by pixels . pixels must be positive. This is used by AudioRegionViews in Ardour to avoid drawing the first pixel of a waveform, and exists in case there are uses for WaveView where we do not want this behaviour.

◆ set_zero_color()

void ArdourWaveView::WaveView::set_zero_color ( Gtkmm2ext::Color  )

◆ show_zero_line()

bool ArdourWaveView::WaveView::show_zero_line ( ) const

◆ start_drawing_thread()

static void ArdourWaveView::WaveView::start_drawing_thread ( )
static

◆ stop_drawing_thread()

static void ArdourWaveView::WaveView::stop_drawing_thread ( )
static

◆ y_extent()

static ArdourCanvas::Coord ArdourWaveView::WaveView::y_extent ( double  ,
Shape const  ,
double const  height 
)
staticprivate

Friends And Related Function Documentation

◆ WaveViewThreadClient

friend class WaveViewThreadClient
friend

Definition at line 148 of file wave_view.h.

◆ WaveViewThreads

friend class WaveViewThreads
friend

Definition at line 149 of file wave_view.h.

Member Data Documentation

◆ _always_draw_image_in_gui_thread

bool ArdourWaveView::WaveView::_always_draw_image_in_gui_thread
private

If true, calls to render() will render a missing wave image in the GUI thread. Set true for waveviews we expect to keep updating (e.g. while recording)

Definition at line 191 of file wave_view.h.

◆ _cache_group

std::shared_ptr<WaveViewCacheGroup> ArdourWaveView::WaveView::_cache_group
mutableprivate

Definition at line 157 of file wave_view.h.

◆ _draw_image_in_gui_thread

bool ArdourWaveView::WaveView::_draw_image_in_gui_thread
mutableprivate

If true, calls to render() will render a missing wave image in the GUI thread. Generally set to false, but true after a call to set_height().

Definition at line 185 of file wave_view.h.

◆ _global_clip_level

double ArdourWaveView::WaveView::_global_clip_level
staticprivate

Definition at line 203 of file wave_view.h.

◆ _global_gradient_depth

double ArdourWaveView::WaveView::_global_gradient_depth
staticprivate

Definition at line 199 of file wave_view.h.

◆ _global_logscaled

bool ArdourWaveView::WaveView::_global_logscaled
staticprivate

Definition at line 200 of file wave_view.h.

◆ _global_shape

Shape ArdourWaveView::WaveView::_global_shape
staticprivate

Definition at line 201 of file wave_view.h.

◆ _global_show_waveform_clipping

bool ArdourWaveView::WaveView::_global_show_waveform_clipping
staticprivate

Definition at line 202 of file wave_view.h.

◆ _gradient_depth_independent

bool ArdourWaveView::WaveView::_gradient_depth_independent
private

Definition at line 161 of file wave_view.h.

◆ _image

std::shared_ptr<WaveViewImage> ArdourWaveView::WaveView::_image
mutableprivate

Definition at line 155 of file wave_view.h.

◆ _logscaled_independent

bool ArdourWaveView::WaveView::_logscaled_independent
private

Definition at line 160 of file wave_view.h.

◆ _props

const std::unique_ptr<WaveViewProperties> ArdourWaveView::WaveView::_props
private

Definition at line 153 of file wave_view.h.

◆ _region

std::shared_ptr<ARDOUR::AudioRegion> ArdourWaveView::WaveView::_region
private

Definition at line 151 of file wave_view.h.

◆ _shape_independent

bool ArdourWaveView::WaveView::_shape_independent
private

Definition at line 159 of file wave_view.h.

◆ ClipLevelChanged

PBD::Signal<void()> ArdourWaveView::WaveView::ClipLevelChanged
static

Definition at line 140 of file wave_view.h.

◆ current_request

std::shared_ptr<WaveViewDrawRequest> ArdourWaveView::WaveView::current_request
mutableprivate

Definition at line 195 of file wave_view.h.

◆ invalidation_connection

PBD::ScopedConnectionList ArdourWaveView::WaveView::invalidation_connection
private

Definition at line 197 of file wave_view.h.

◆ VisualPropertiesChanged

PBD::Signal<void()> ArdourWaveView::WaveView::VisualPropertiesChanged
staticprivate

Definition at line 205 of file wave_view.h.


The documentation for this class was generated from the following file: