diff options
author | Robin Gareus <robin@gareus.org> | 2017-07-17 20:12:33 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-07-17 21:06:04 +0200 |
commit | beb73edf553dadbbef7a02727c04f51294b0f4e6 (patch) | |
tree | c706e536fb07e69bb2f050f9541784a41d65366c | |
parent | 601c317d70a03190257577bd867cefc2c70d3275 (diff) |
Purify libcanvas, remove libardour dependency
A canvas is just a canvas. Move WaveView into its own library.
29 files changed, 266 insertions, 292 deletions
diff --git a/gtk2_ardour/ardev_common.sh.in b/gtk2_ardour/ardev_common.sh.in index 0904e143c0..4a96798e70 100644 --- a/gtk2_ardour/ardev_common.sh.in +++ b/gtk2_ardour/ardev_common.sh.in @@ -36,7 +36,7 @@ export ARDOUR_DLL_PATH=$libs export GTK_PATH=~/.ardour3:$libs/clearlooks-newer export VAMP_PATH=$libs/vamp-plugins${VAMP_PATH:+:$VAMP_PATH} -export LD_LIBRARY_PATH=$libs/ptformat:$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/widgets:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/audiographer:$libs/timecode:$libs/libltc:$libs/canvas:$libs/ardouralsautil${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} +export LD_LIBRARY_PATH=$libs/ptformat:$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/widgets:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/audiographer:$libs/timecode:$libs/libltc:$libs/canvas:$libs/waveview:$libs/ardouralsautil${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} # DYLD_LIBRARY_PATH is for darwin. export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index 638743897b..14a8695c8b 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -25,12 +25,11 @@ #include "pbd/stacktrace.h" #include "pbd/unwind.h" -#include <gtkmm2ext/utils.h> - #include "ardour/rc_configuration.h" #include "ardour/session.h" -#include "canvas/wave_view.h" +#include "gtkmm2ext/utils.h" +#include "waveview/wave_view.h" #include "audio_clock.h" #include "ardour_ui.h" @@ -476,7 +475,7 @@ ARDOUR_UI::parameter_changed (std::string p) Gtkmm2ext::disable_tooltips (); } } else if (p == "waveform-gradient-depth") { - ArdourCanvas::WaveView::set_global_gradient_depth (UIConfiguration::instance().get_waveform_gradient_depth()); + ArdourWaveView::WaveView::set_global_gradient_depth (UIConfiguration::instance().get_waveform_gradient_depth()); } else if (p == "show-mini-timeline") { repack_transport_hbox (); } else if (p == "show-toolbar-recpunch") { @@ -490,17 +489,17 @@ ARDOUR_UI::parameter_changed (std::string p) } else if (p == "show-secondary-clock") { update_clock_visibility (); } else if (p == "waveform-scale") { - ArdourCanvas::WaveView::set_global_logscaled (UIConfiguration::instance().get_waveform_scale() == Logarithmic); + ArdourWaveView::WaveView::set_global_logscaled (UIConfiguration::instance().get_waveform_scale() == Logarithmic); } else if (p == "widget-prelight") { CairoWidget::set_widget_prelight (UIConfiguration::instance().get_widget_prelight()); } else if (p == "waveform-shape") { - ArdourCanvas::WaveView::set_global_shape (UIConfiguration::instance().get_waveform_shape() == Rectified - ? ArdourCanvas::WaveView::Rectified : ArdourCanvas::WaveView::Normal); + ArdourWaveView::WaveView::set_global_shape (UIConfiguration::instance().get_waveform_shape() == Rectified + ? ArdourWaveView::WaveView::Rectified : ArdourWaveView::WaveView::Normal); } else if (p == "show-waveform-clipping") { - ArdourCanvas::WaveView::set_global_show_waveform_clipping (UIConfiguration::instance().get_show_waveform_clipping()); + ArdourWaveView::WaveView::set_global_show_waveform_clipping (UIConfiguration::instance().get_show_waveform_clipping()); } else if (p == "waveform-cache-size") { /* GUI option has units of megabytes; image cache uses units of bytes */ - ArdourCanvas::WaveView::set_image_cache_size (UIConfiguration::instance().get_waveform_cache_size() * 1048576); + ArdourWaveView::WaveView::set_image_cache_size (UIConfiguration::instance().get_waveform_cache_size() * 1048576); } else if (p == "use-wm-visibility") { VisibilityTracker::set_use_window_manager_visibility (UIConfiguration::instance().get_use_wm_visibility()); } else if (p == "action-table-columns") { @@ -516,9 +515,9 @@ ARDOUR_UI::parameter_changed (std::string p) } else if (p == "layered-record-mode") { layered_button.set_active (_session->config.get_layered_record_mode ()); } else if (p == "show-waveform-clipping") { - ArdourCanvas::WaveView::set_global_show_waveform_clipping (UIConfiguration::instance().get_show_waveform_clipping()); + ArdourWaveView::WaveView::set_global_show_waveform_clipping (UIConfiguration::instance().get_show_waveform_clipping()); } else if (p == "waveform-gradient-depth") { - ArdourCanvas::WaveView::set_global_gradient_depth (UIConfiguration::instance().get_waveform_gradient_depth()); + ArdourWaveView::WaveView::set_global_gradient_depth (UIConfiguration::instance().get_waveform_gradient_depth()); } else if (p == "flat-buttons") { bool flat = UIConfiguration::instance().get_flat_buttons(); if (ArdourButton::flat_buttons () != flat) { diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index e81043588c..fd35f23645 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -48,6 +48,8 @@ #include "canvas/xfade_curve.h" #include "canvas/debug.h" +#include "waveview/debug.h" + #include "streamview.h" #include "audio_region_view.h" #include "audio_time_axis.h" @@ -427,7 +429,7 @@ AudioRegionView::region_resized (const PropertyChange& what_changed) for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { if ((agr = dynamic_cast<AudioGhostRegion*>(*i)) != 0) { - for (vector<WaveView*>::iterator w = agr->waves.begin(); w != agr->waves.end(); ++w) { + for (vector<ArdourWaveView::WaveView*>::iterator w = agr->waves.begin(); w != agr->waves.end(); ++w) { (*w)->region_resized (); } } @@ -1139,7 +1141,7 @@ AudioRegionView::delete_waves () } _data_ready_connections.clear (); - for (vector<WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) { + for (vector<ArdourWaveView::WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) { group->remove(*w); } waves.clear(); @@ -1237,7 +1239,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/) gdouble yoff = which * ht; - WaveView *wave = new WaveView (group, audio_region ()); + ArdourWaveView::WaveView *wave = new ArdourWaveView::WaveView (group, audio_region ()); CANVAS_DEBUG_NAME (wave, string_compose ("wave view for chn %1 of %2", which, get_item_name())); wave->set_channel (which); @@ -1252,15 +1254,15 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/) switch (UIConfiguration::instance().get_waveform_shape()) { case Rectified: - wave->set_shape (WaveView::Rectified); + wave->set_shape (ArdourWaveView::WaveView::Rectified); break; default: - wave->set_shape (WaveView::Normal); + wave->set_shape (ArdourWaveView::WaveView::Normal); } wave->set_logscaled (UIConfiguration::instance().get_waveform_scale() == Logarithmic); - vector<ArdourCanvas::WaveView*> v; + vector<ArdourWaveView::WaveView*> v; v.push_back (wave); set_some_waveform_colors (v); @@ -1426,7 +1428,7 @@ AudioRegionView::add_ghost (TimeAxisView& tv) break; } - WaveView *wave = new WaveView (ghost->group, audio_region()); + ArdourWaveView::WaveView *wave = new ArdourWaveView::WaveView (ghost->group, audio_region()); CANVAS_DEBUG_NAME (wave, string_compose ("ghost wave for %1", get_item_name())); wave->set_channel (n); @@ -1546,7 +1548,7 @@ AudioRegionView::set_waveform_colors () } void -AudioRegionView::set_some_waveform_colors (vector<ArdourCanvas::WaveView*>& waves_to_color) +AudioRegionView::set_some_waveform_colors (vector<ArdourWaveView::WaveView*>& waves_to_color) { Gtkmm2ext::Color fill; Gtkmm2ext::Color outline; @@ -1578,7 +1580,7 @@ AudioRegionView::set_some_waveform_colors (vector<ArdourCanvas::WaveView*>& wave } } - for (vector<ArdourCanvas::WaveView*>::iterator w = waves_to_color.begin(); w != waves_to_color.end(); ++w) { + for (vector<ArdourWaveView::WaveView*>::iterator w = waves_to_color.begin(); w != waves_to_color.end(); ++w) { (*w)->set_fill_color (fill); (*w)->set_outline_color (outline); (*w)->set_clip_color (clip); diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index cc0ab0500e..8841ee2e43 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -29,9 +29,10 @@ #include "ardour/audioregion.h" #include "canvas/fwd.h" -#include "canvas/wave_view.h" #include "canvas/xfade_curve.h" +#include "waveview/wave_view.h" + #include "region_view.h" #include "time_axis_view_item.h" #include "automation_line.h" @@ -151,8 +152,8 @@ protected: WaveformLogScaled = 0x10, }; - std::vector<ArdourCanvas::WaveView *> waves; - std::vector<ArdourCanvas::WaveView *> tmp_waves; ///< see ::create_waves() + std::vector<ArdourWaveView::WaveView *> waves; + std::vector<ArdourWaveView::WaveView *> tmp_waves; ///< see ::create_waves() std::list<std::pair<framepos_t, ArdourCanvas::Line*> > feature_lines; @@ -209,7 +210,7 @@ private: void parameter_changed (std::string const &); void setup_waveform_visibility (); - void set_some_waveform_colors (std::vector<ArdourCanvas::WaveView*>& waves_to_color); + void set_some_waveform_colors (std::vector<ArdourWaveView::WaveView*>& waves_to_color); /** A ScopedConnection for each PeaksReady callback (one per channel). Each member * may be 0 if no connection exists. diff --git a/gtk2_ardour/color_theme_manager.cc b/gtk2_ardour/color_theme_manager.cc index f43d8ff2de..c9ee7ac308 100644 --- a/gtk2_ardour/color_theme_manager.cc +++ b/gtk2_ardour/color_theme_manager.cc @@ -26,9 +26,6 @@ #include "pbd/gstdio_compat.h" -#include "gtkmm2ext/cell_renderer_color_selector.h" -#include "gtkmm2ext/utils.h" - #include "pbd/compose.h" #include "pbd/file_utils.h" #include "pbd/replace_all.h" @@ -36,10 +33,14 @@ #include "ardour/filesystem_paths.h" #include "ardour/profile.h" +#include "gtkmm2ext/cell_renderer_color_selector.h" +#include "gtkmm2ext/utils.h" + #include "canvas/container.h" #include "canvas/rectangle.h" #include "canvas/scroll_group.h" -#include "canvas/wave_view.h" + +#include "waveview/wave_view.h" #include "ardour_dialog.h" #include "color_theme_manager.h" diff --git a/gtk2_ardour/crossfade_edit.h b/gtk2_ardour/crossfade_edit.h index 911b9a7df6..f18b26ae8a 100644 --- a/gtk2_ardour/crossfade_edit.h +++ b/gtk2_ardour/crossfade_edit.h @@ -44,6 +44,9 @@ namespace ArdourCanvas { class Rectangle; class Line; class Polygon; +} + +namespace ArdourWaveview { class WaveView; } @@ -119,7 +122,7 @@ private: std::list<Point*> points; ARDOUR::AutomationList normative_curve; /* 0 - 1.0, linear */ ARDOUR::AutomationList gain_curve; /* 0 - 2.0, gain mapping */ - std::vector<ArdourCanvas::WaveView*> waves; + std::vector<ArdourWaveView::WaveView*> waves; Half(); }; diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc index 799e53d3ca..b531bd9aa8 100644 --- a/gtk2_ardour/ghostregion.cc +++ b/gtk2_ardour/ghostregion.cc @@ -17,15 +17,17 @@ */ +#include "evoral/Note.hpp" + #include "ardour/parameter_descriptor.h" -#include "evoral/Note.hpp" #include "canvas/container.h" #include "canvas/polygon.h" #include "canvas/rectangle.h" -#include "canvas/wave_view.h" #include "canvas/debug.h" +#include "waveview/wave_view.h" + #include "automation_time_axis.h" #include "ghostregion.h" #include "midi_streamview.h" @@ -126,7 +128,7 @@ AudioGhostRegion::AudioGhostRegion(RegionView& rv, void AudioGhostRegion::set_samples_per_pixel (double fpp) { - for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) { + for (vector<ArdourWaveView::WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) { (*i)->set_samples_per_pixel (fpp); } } @@ -134,7 +136,7 @@ AudioGhostRegion::set_samples_per_pixel (double fpp) void AudioGhostRegion::set_height () { - vector<WaveView*>::iterator i; + vector<ArdourWaveView::WaveView*>::iterator i; uint32_t n; GhostRegion::set_height(); diff --git a/gtk2_ardour/ghostregion.h b/gtk2_ardour/ghostregion.h index 7192538394..d8cff83143 100644 --- a/gtk2_ardour/ghostregion.h +++ b/gtk2_ardour/ghostregion.h @@ -24,7 +24,7 @@ #include <boost/unordered_map.hpp> #include "pbd/signals.h" -namespace ArdourCanvas { +namespace ArdourWaveView { class WaveView; } @@ -76,7 +76,7 @@ public: void set_height(); void set_colors(); - std::vector<ArdourCanvas::WaveView*> waves; + std::vector<ArdourWaveView::WaveView*> waves; }; class MidiGhostRegion : public GhostRegion { diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index b69cddf89e..91ceba039e 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -51,7 +51,7 @@ #include "ardour/plugin_manager.h" #include "control_protocol/control_protocol.h" -#include "canvas/wave_view.h" +#include "waveview/wave_view.h" #include "widgets/paths_dialog.h" #include "widgets/tooltips.h" @@ -1198,7 +1198,7 @@ private: { UIConfiguration::instance().set_waveform_clip_level (_clip_level_adjustment.get_value()); /* XXX: should be triggered from the parameter changed signal */ - ArdourCanvas::WaveView::set_clip_level (_clip_level_adjustment.get_value()); + ArdourWaveView::WaveView::set_clip_level (_clip_level_adjustment.get_value()); } Adjustment _clip_level_adjustment; diff --git a/gtk2_ardour/tape_region_view.cc b/gtk2_ardour/tape_region_view.cc index 284ba62eab..1e3c31f565 100644 --- a/gtk2_ardour/tape_region_view.cc +++ b/gtk2_ardour/tape_region_view.cc @@ -91,10 +91,10 @@ TapeAudioRegionView::update (uint32_t /*n*/) #if 0 /* deadlock: -#1 0x00007f9570ebd77c in g_mutex_lock_slowpath (mutex=0x7f9575157760 <ArdourCanvas::WaveView::current_image_lock>) at ././glib/gthread-posix.c:1313 +#1 0x00007f9570ebd77c in g_mutex_lock_slowpath (mutex=0x7f9575157760 <ArdourWaveView::WaveView::current_image_lock>) at ././glib/gthread-posix.c:1313 #2 0x000055f6f8d1aac0 in Glib::Threads::Mutex::Lock::Lock(Glib::Threads::Mutex&) (this=0x7ffc4d905aa0, mutex=...) at /usr/include/glibmm-2.4/glibmm/threads.h:688 -#3 0x00007f9574f05054 in ArdourCanvas::WaveView::invalidate_image_cache() (this=0x55f6fdf341a0) at ../libs/canvas/wave_view.cc:275 -#4 0x00007f9574f0b1b0 in ArdourCanvas::WaveView::gain_changed() (this=0x55f6fdf341a0) at ../libs/canvas/wave_view.cc:1329 +#3 0x00007f9574f05054 in ArdourWaveView::WaveView::invalidate_image_cache() (this=0x55f6fdf341a0) at ../libs/canvas/wave_view.cc:275 +#4 0x00007f9574f0b1b0 in ArdourWaveView::WaveView::gain_changed() (this=0x55f6fdf341a0) at ../libs/canvas/wave_view.cc:1329 #5 0x000055f6f96eb1b8 in TapeAudioRegionView::update(unsigned int) (this=0x55f6fdf32640) at ../gtk2_ardour/tape_region_view.cc:102 #6 0x000055f6f96eba9f in boost::_mfi::mf1<void, TapeAudioRegionView, unsigned int>::operator()(TapeAudioRegionView*, unsigned int) const (this=0x55f6fa74ce10, p=0x55f6fdf32640, a1=0) at /usr/include/boost/bind/mem_fn_template.hpp:165 @@ -125,12 +125,12 @@ TapeAudioRegionView::update (uint32_t /*n*/) #25 0x00007f957394eb15 in ARDOUR::AudioSource::read_peaks(ARDOUR::PeakData*, long, long, long, double) const (this=0x55f6fd359140, peaks=0x55f700da6b80, npeaks=1356, start=113190, cnt=447480, samples_per_visual_peak=330) at ../libs/ardour/audiosource.cc:337 #26 0x00007f957393a905 in ARDOUR::AudioRegion::read_peaks(ARDOUR::PeakData*, long, long, long, unsigned int, double) const (this= 0x55f6fd84c3b0, buf=0x55f700da6b80, npeaks=1356, offset=113190, cnt=447480, chan_n=0, frames_per_pixel=330) at ../libs/ardour/audioregion.cc:431 -#27 0x00007f9574f09caa in ArdourCanvas::WaveView::generate_image(boost::shared_ptr<ArdourCanvas::WaveViewThreadRequest>, bool) const (this=0x55f6fdf341a0, req=..., in_render_thread=false) +#27 0x00007f9574f09caa in ArdourWaveView::WaveView::generate_image(boost::shared_ptr<ArdourWaveView::WaveViewThreadRequest>, bool) const (this=0x55f6fdf341a0, req=..., in_render_thread=false) at ../libs/canvas/wave_view.cc:1005 -#28 0x00007f9574f08e99 in ArdourCanvas::WaveView::get_image(long, long, bool&) const (this=0x55f6fdf341a0, start=225060, end=448800, full_image=@0x7ffc4d9070c7: false) +#28 0x00007f9574f08e99 in ArdourWaveView::WaveView::get_image(long, long, bool&) const (this=0x55f6fdf341a0, start=225060, end=448800, full_image=@0x7ffc4d9070c7: false) ---Type <return> to continue, or q <return> to quit--- at ../libs/canvas/wave_view.cc:870 -#29 0x00007f9574f0a6e8 in ArdourCanvas::WaveView::render(ArdourCanvas::Rect const&, Cairo::RefPtr<Cairo::Context>) const (this=0x55f6fdf341a0, area=..., context=...) +#29 0x00007f9574f0a6e8 in ArdourWaveView::WaveView::render(ArdourCanvas::Rect const&, Cairo::RefPtr<Cairo::Context>) const (this=0x55f6fdf341a0, area=..., context=...) at ../libs/canvas/wave_view.cc:1180 */ @@ -145,7 +145,7 @@ TapeAudioRegionView::update (uint32_t /*n*/) /* this is a quick hack to draw something (abuse gain_changed to force * an image-cache invalidation. * - * TODO: ArdourCanvas::WaveView needs an API to look up the specific channel "n" + * TODO: ArdourWaveView::WaveView needs an API to look up the specific channel "n" * and a special case to not only invalidate the cache but re-expose the * waveform. e.g. * diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index 6b0b4037c4..7df4ba2721 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -481,6 +481,7 @@ def build(bld): 'libmidipp', 'libgtkmm2ext', 'libcanvas', + 'libwaveview', 'libwidgets', 'libptformat', ] @@ -553,6 +554,7 @@ def build(bld): 'libgtk2_ardour', 'libgtkmm2ext', 'libcanvas', + 'libwaveview', 'libwidgets', 'libptformat', ] @@ -599,6 +601,7 @@ def build(bld): 'libmidipp', 'libgtkmm2ext', 'libcanvas', + 'libwaveview', 'libwidgets', 'libptformat', ] diff --git a/libs/canvas/canvas/debug.h b/libs/canvas/canvas/debug.h index ecf7eee46f..b0797531b0 100644 --- a/libs/canvas/canvas/debug.h +++ b/libs/canvas/canvas/debug.h @@ -33,7 +33,6 @@ namespace PBD { LIBCANVAS_API extern DebugBits CanvasEvents; LIBCANVAS_API extern DebugBits CanvasRender; LIBCANVAS_API extern DebugBits CanvasEnterLeave; - LIBCANVAS_API extern DebugBits WaveView; } } diff --git a/libs/canvas/canvas/fwd.h b/libs/canvas/canvas/fwd.h index 61cab3c9d2..bae8ef20fb 100644 --- a/libs/canvas/canvas/fwd.h +++ b/libs/canvas/canvas/fwd.h @@ -22,18 +22,17 @@ #define __canvas_canvas_fwd_h__ namespace ArdourCanvas { - class WaveView; class Line; - class LineSet; + class LineSet; class Rectangle; - class Ruler; + class Ruler; class Polygon; class PolyLine; class GtkCanvas; class GtkCanvasViewport; class Text; class Curve; - class ScrollGroup; + class ScrollGroup; } #endif /* __canvas_canvas_fwd_h__ */ diff --git a/libs/canvas/debug.cc b/libs/canvas/debug.cc index 086c69b7a7..e958678d7d 100644 --- a/libs/canvas/debug.cc +++ b/libs/canvas/debug.cc @@ -29,7 +29,6 @@ PBD::DebugBits PBD::DEBUG::CanvasItemsDirtied = PBD::new_debug_bit ("canvasitems PBD::DebugBits PBD::DEBUG::CanvasEvents = PBD::new_debug_bit ("canvasevents"); PBD::DebugBits PBD::DEBUG::CanvasRender = PBD::new_debug_bit ("canvasrender"); PBD::DebugBits PBD::DEBUG::CanvasEnterLeave = PBD::new_debug_bit ("canvasenterleave"); -PBD::DebugBits PBD::DEBUG::WaveView = PBD::new_debug_bit ("waveview"); struct timeval ArdourCanvas::epoch; map<string, struct timeval> ArdourCanvas::last_time; diff --git a/libs/canvas/fill.cc b/libs/canvas/fill.cc index 9fe1d5b4e7..32af6bd74b 100644 --- a/libs/canvas/fill.cc +++ b/libs/canvas/fill.cc @@ -19,8 +19,6 @@ #include <cairomm/cairomm.h> -#include "ardour/utils.h" - #include "pbd/compose.h" #include "pbd/convert.h" diff --git a/libs/canvas/item.cc b/libs/canvas/item.cc index 98fe6362db..c941e8e980 100644 --- a/libs/canvas/item.cc +++ b/libs/canvas/item.cc @@ -21,8 +21,6 @@ #include "pbd/demangle.h" #include "pbd/convert.h" -#include "ardour/utils.h" - #include "canvas/canvas.h" #include "canvas/debug.h" #include "canvas/item.h" diff --git a/libs/canvas/outline.cc b/libs/canvas/outline.cc index 4f26de693b..fcb7b75d40 100644 --- a/libs/canvas/outline.cc +++ b/libs/canvas/outline.cc @@ -22,8 +22,6 @@ #include "pbd/compose.h" #include "pbd/convert.h" -#include "ardour/utils.h" - #include "canvas/item.h" #include "canvas/outline.h" #include "canvas/debug.h" diff --git a/libs/canvas/test/wave_view.cc b/libs/canvas/test/wave_view.cc deleted file mode 100644 index de7118b90c..0000000000 --- a/libs/canvas/test/wave_view.cc +++ /dev/null @@ -1,164 +0,0 @@ -#include <gtkmm/main.h> -#include "pbd/textreceiver.h" -#include "gtkmm2ext/utils.h" -#include "midi++/manager.h" -#include "ardour/session.h" -#include "ardour/audioengine.h" -#include "ardour/source_factory.h" -#include "ardour/audiosource.h" -#include "ardour/audiofilesource.h" -#include "ardour/region_factory.h" -#include "ardour/audioregion.h" -#include "canvas/wave_view.h" -#include "canvas/canvas.h" -#include "wave_view.h" - -using namespace std; -using namespace PBD; -using namespace ARDOUR; -using namespace ArdourCanvas; - -CPPUNIT_TEST_SUITE_REGISTRATION (WaveViewTest); - -TextReceiver text_receiver ("test"); - -void -WaveViewTest::setUp () -{ - init (false, true); - Gtkmm2ext::init (); - SessionEvent::create_per_thread_pool ("test", 512); - - Gtk::Main kit (); - Gtk::Main::init_gtkmm_internals (); - - text_receiver.listen_to (error); - text_receiver.listen_to (info); - text_receiver.listen_to (fatal); - text_receiver.listen_to (warning); - - AudioFileSource::set_build_peakfiles (true); - AudioFileSource::set_build_missing_peakfiles (true); - - AudioEngine engine ("test", ""); - MIDI::Manager::create (engine.jack ()); - CPPUNIT_ASSERT (engine.start () == 0); - - Session session (engine, "tmp_session", "tmp_session"); - engine.set_session (&session); - - char buf[256]; - getcwd (buf, sizeof (buf)); - string const path = string_compose ("%1/../../libs/canvas/test/sine.wav", buf); - - boost::shared_ptr<Source> source = SourceFactory::createReadable ( - DataType::AUDIO, session, path, 0, (Source::Flag) 0, false, true - ); - - boost::shared_ptr<AudioFileSource> audio_file_source = boost::dynamic_pointer_cast<AudioFileSource> (source); - - audio_file_source->setup_peakfile (); - - PBD::PropertyList properties; - properties.add (Properties::position, 128); - properties.add (Properties::length, audio_file_source->readable_length ()); - _region = RegionFactory::create (source, properties, false); - _audio_region = boost::dynamic_pointer_cast<AudioRegion> (_region); -} - -void -WaveViewTest::make_canvas () -{ - /* this leaks various things, but hey ho */ - - _canvas = new ImageCanvas (Duple (256, 256)); - _wave_view = new WaveView (_canvas->root(), _audio_region); - _wave_view->set_frames_per_pixel ((double) (44100 / 1000) / 64); - _wave_view->set_height (64); -} - -void -WaveViewTest::all () -{ - /* XXX: we run these all from the same method so that the setUp code only - gets called once; there are various singletons etc. in Ardour which don't - like being recreated. - */ - - render_all_at_once (); - render_in_pieces (); - cache (); -} - -void -WaveViewTest::render_all_at_once () -{ - make_canvas (); - - _canvas->render_to_image (Rect (0, 0, 256, 256)); - _canvas->write_to_png ("waveview_1.png"); - - /* XXX: doesn't check the result! */ -} - -void -WaveViewTest::render_in_pieces () -{ - make_canvas (); - - cout << "\n\n--------------> PIECES\n"; - _canvas->render_to_image (Rect (0, 0, 128, 256)); - _canvas->render_to_image (Rect (128, 0, 256, 256)); - _canvas->write_to_png ("waveview_2.png"); - cout << "\n\n<-------------- PIECES\n"; - - /* XXX: doesn't check the result! */ -} - -void -WaveViewTest::cache () -{ - make_canvas (); - - /* Whole of the render area needs caching from scratch */ - - _wave_view->invalidate_whole_cache (); - - Rect whole (0, 0, 256, 256); - _canvas->render_to_image (whole); - - CPPUNIT_ASSERT (_wave_view->_cache.size() == 1); - CPPUNIT_ASSERT (_wave_view->_cache.front()->start() == 0); - CPPUNIT_ASSERT (_wave_view->_cache.front()->end() == 256); - - _wave_view->invalidate_whole_cache (); - - /* Render a bit in the middle */ - - Rect part1 (128, 0, 196, 256); - _canvas->render_to_image (part1); - - CPPUNIT_ASSERT (_wave_view->_cache.size() == 1); - CPPUNIT_ASSERT (_wave_view->_cache.front()->start() == 128); - CPPUNIT_ASSERT (_wave_view->_cache.front()->end() == 196); - - /* Now render the whole thing and check that the cache sorts itself out */ - - _canvas->render_to_image (whole); - - CPPUNIT_ASSERT (_wave_view->_cache.size() == 3); - - list<WaveView::CacheEntry*>::iterator i = _wave_view->_cache.begin (); - - CPPUNIT_ASSERT ((*i)->start() == 0); - CPPUNIT_ASSERT ((*i)->end() == 128); - ++i; - - CPPUNIT_ASSERT ((*i)->start() == 128); - CPPUNIT_ASSERT ((*i)->end() == 196); - ++i; - - CPPUNIT_ASSERT ((*i)->start() == 196); - CPPUNIT_ASSERT ((*i)->end() == 256); - ++i; -} diff --git a/libs/canvas/test/wave_view.h b/libs/canvas/test/wave_view.h deleted file mode 100644 index 69f7ce772f..0000000000 --- a/libs/canvas/test/wave_view.h +++ /dev/null @@ -1,26 +0,0 @@ -#include <cppunit/TestFixture.h> -#include <cppunit/extensions/HelperMacros.h> - -class WaveViewTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE (WaveViewTest); - CPPUNIT_TEST (all); - CPPUNIT_TEST_SUITE_END (); - -public: - void setUp (); - void all (); - -private: - void make_canvas (); - void render_all_at_once (); - void render_in_pieces (); - void cache (); - - ArdourCanvas::ImageCanvas* _canvas; - ArdourCanvas::WaveView* _wave_view; - boost::shared_ptr<ARDOUR::Region> _region; - boost::shared_ptr<ARDOUR::AudioRegion> _audio_region; -}; - - diff --git a/libs/canvas/wscript b/libs/canvas/wscript index 0d99e6856d..d92695d6fd 100644 --- a/libs/canvas/wscript +++ b/libs/canvas/wscript @@ -60,8 +60,6 @@ canvas_sources = [ 'tracking_text.cc', 'types.cc', 'utils.cc', - 'wave_view.cc', - 'wave_view_private.cc', 'widget.cc', 'xfade_curve.cc', ] @@ -88,7 +86,7 @@ def build(bld): obj.export_includes = ['.'] obj.includes = ['.'] obj.uselib = 'SIGCPP CAIROMM GTKMM BOOST XML' - obj.use = [ 'libpbd', 'libevoral', 'libardour', 'libgtkmm2ext', 'libevoral' ] + obj.use = [ 'libpbd', 'libgtkmm2ext' ] obj.name = 'libcanvas' obj.target = 'canvas' obj.vnum = CANVAS_LIB_VERSION @@ -113,7 +111,7 @@ def build(bld): unit_testobj.includes = obj.includes + ['test', '../pbd'] unit_testobj.uselib = 'CPPUNIT SIGCPP CAIROMM GTKMM' - unit_testobj.uselib_local = 'libcanvas libevoral libardour libgtkmm2ext' + unit_testobj.uselib_local = 'libcanvas libgtkmm2ext' unit_testobj.name = 'libcanvas-unit-tests' unit_testobj.target = 'run-tests' unit_testobj.install_path = '' @@ -138,7 +136,7 @@ def build(bld): manual_testobj.source = t manual_testobj.includes = obj.includes + ['test', '../pbd'] manual_testobj.uselib = 'CPPUNIT SIGCPP CAIROMM GTKMM' - manual_testobj.uselib_local = 'libcanvas libevoral libardour libgtkmm2ext' + manual_testobj.uselib_local = 'libcanvas libgtkmm2ext' manual_testobj.name = 'libcanvas-manual-test-%s' % name manual_testobj.target = target manual_testobj.install_path = '' @@ -157,7 +155,7 @@ def build(bld): manual_testobj.source = [ t, 'benchmark/benchmark.cc' ] manual_testobj.includes = obj.includes + ['test', '../pbd'] manual_testobj.uselib = 'CPPUNIT SIGCPP CAIROMM GTKMM' - manual_testobj.uselib_local = 'libcanvas libevoral libardour libgtkmm2ext' + manual_testobj.uselib_local = 'libcanvas libgtkmm2ext' manual_testobj.name = 'libcanvas-benchmark-%s' % name manual_testobj.target = target manual_testobj.install_path = '' diff --git a/libs/waveview/debug.cc b/libs/waveview/debug.cc new file mode 100644 index 0000000000..c0a897e8f2 --- /dev/null +++ b/libs/waveview/debug.cc @@ -0,0 +1,23 @@ +/* + Copyright (C) 2011 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "pbd/debug.h" +#include "waveview/debug.h" + +PBD::DebugBits PBD::DEBUG::WaveView = PBD::new_debug_bit ("waveview"); diff --git a/libs/canvas/wave_view.cc b/libs/waveview/wave_view.cc index 8024b2655d..80292ce53d 100644 --- a/libs/canvas/wave_view.cc +++ b/libs/waveview/wave_view.cc @@ -26,9 +26,7 @@ #include <cairomm/cairomm.h> #include <glibmm/threads.h> - -#include "gtkmm2ext/utils.h" -#include "gtkmm2ext/gui_thread.h" +#include <gdkmm/general.h> #include "pbd/base_ui.h" #include "pbd/compose.h" @@ -43,21 +41,22 @@ #include "ardour/audiosource.h" #include "ardour/session.h" -#include "canvas/canvas.h" #include "gtkmm2ext/colors.h" -#include "canvas/debug.h" -#include "canvas/wave_view.h" -#include "canvas/wave_view_private.h" +#include "gtkmm2ext/gui_thread.h" +#include "gtkmm2ext/utils.h" -#include <gdkmm/general.h> +#include "canvas/canvas.h" +#include "canvas/debug.h" -#include "gtkmm2ext/gui_thread.h" +#include "waveview/wave_view.h" +#include "waveview/wave_view_private.h" using namespace std; -using namespace ARDOUR; using namespace PBD; -using namespace ArdourCanvas; +using namespace ARDOUR; using namespace Gtkmm2ext; +using namespace ArdourCanvas; +using namespace ArdourWaveView; double WaveView::_global_gradient_depth = 0.6; bool WaveView::_global_logscaled = false; diff --git a/libs/canvas/wave_view_private.cc b/libs/waveview/wave_view_private.cc index a788eb9c6f..716ef09bdd 100644 --- a/libs/canvas/wave_view_private.cc +++ b/libs/waveview/wave_view_private.cc @@ -20,14 +20,14 @@ #include <cmath> #include "ardour/lmath.h" -#include "canvas/wave_view_private.h" - #include "pbd/cpus.h" #include "ardour/audioregion.h" #include "ardour/audiosource.h" -namespace ArdourCanvas { +#include "waveview/wave_view_private.h" + +namespace ArdourWaveView { WaveViewProperties::WaveViewProperties (boost::shared_ptr<ARDOUR::AudioRegion> region) : region_start (region->start ()) @@ -455,4 +455,4 @@ WaveViewDrawingThread::run () } } -} // namespace ArdourCanvas +} diff --git a/libs/waveview/waveview/debug.h b/libs/waveview/waveview/debug.h new file mode 100644 index 0000000000..df93085721 --- /dev/null +++ b/libs/waveview/waveview/debug.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2011-2013 Paul Davis + Author: Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _WAVEVIEW_DEBUG_H_ +#define _WAVEVIEW_DEBUG_H_ + +#include <sys/time.h> +#include <map> +#include "pbd/debug.h" + +#include "waveview/visibility.h" + +namespace PBD { + namespace DEBUG { + LIBWAVEVIEW_API extern DebugBits WaveView; + } +} + +#endif diff --git a/libs/waveview/waveview/visibility.h b/libs/waveview/waveview/visibility.h new file mode 100644 index 0000000000..827ffd5f0e --- /dev/null +++ b/libs/waveview/waveview/visibility.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2013 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __libwaveview_visibility_h__ +#define __libwaveview_visibility_h__ + +#if defined(COMPILER_MSVC) + #define LIBWAVEVIEW_DLL_IMPORT __declspec(dllimport) + #define LIBWAVEVIEW_DLL_EXPORT __declspec(dllexport) + #define LIBWAVEVIEW_DLL_LOCAL +#else + #define LIBWAVEVIEW_DLL_IMPORT __attribute__ ((visibility ("default"))) + #define LIBWAVEVIEW_DLL_EXPORT __attribute__ ((visibility ("default"))) + #define LIBWAVEVIEW_DLL_LOCAL __attribute__ ((visibility ("hidden"))) +#endif + +#ifdef LIBWAVEVIEW_STATIC // libcanvas is not a DLL +#define LIBWAVEVIEW_API +#define LIBWAVEVIEW_LOCAL +#else + #ifdef LIBWAVEVIEW_DLL_EXPORTS // defined if we are building the libcanvas DLL (instead of using it) + #define LIBWAVEVIEW_API LIBWAVEVIEW_DLL_EXPORT + #else + #define LIBWAVEVIEW_API LIBWAVEVIEW_DLL_IMPORT + #endif + #define LIBWAVEVIEW_LOCAL LIBWAVEVIEW_DLL_LOCAL +#endif + +#endif /* __libwaveview_visibility_h__ */ diff --git a/libs/canvas/canvas/wave_view.h b/libs/waveview/waveview/wave_view.h index 1767262151..4b1c8eb42b 100644 --- a/libs/canvas/canvas/wave_view.h +++ b/libs/waveview/waveview/wave_view.h @@ -19,18 +19,17 @@ */ -#ifndef __CANVAS_WAVE_VIEW_H__ -#define __CANVAS_WAVE_VIEW_H__ +#ifndef _WAVEVIEW_WAVE_VIEW_H_ +#define _WAVEVIEW_WAVE_VIEW_H_ #include <boost/shared_ptr.hpp> #include <boost/scoped_ptr.hpp> -#include "ardour/types.h" - #include <glibmm/refptr.h> -#include "canvas/visibility.h" +#include "ardour/types.h" #include "canvas/item.h" +#include "waveview/visibility.h" namespace ARDOUR { class AudioRegion; @@ -40,9 +39,7 @@ namespace Gdk { class Pixbuf; } -class WaveViewTest; - -namespace ArdourCanvas { +namespace ArdourWaveView { class WaveViewCacheGroup; class WaveViewDrawRequest; @@ -51,7 +48,7 @@ class WaveViewImage; class WaveViewProperties; class WaveViewDrawingThread; -class LIBCANVAS_API WaveView : public Item, public sigc::trackable +class LIBWAVEVIEW_API WaveView : public ArdourCanvas::Item, public sigc::trackable { public: enum Shape { Normal, Rectified }; @@ -76,18 +73,18 @@ public: other view parameters). */ - WaveView (Canvas*, boost::shared_ptr<ARDOUR::AudioRegion>); + WaveView (ArdourCanvas::Canvas*, boost::shared_ptr<ARDOUR::AudioRegion>); WaveView (Item*, boost::shared_ptr<ARDOUR::AudioRegion>); ~WaveView (); - virtual void prepare_for_render (Rect const& window_area) const; + virtual void prepare_for_render (ArdourCanvas::Rect const& window_area) const; - virtual void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) 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 (Distance); + void set_height (ArdourCanvas::Distance); void set_channel (int); void set_region_start (ARDOUR::frameoffset_t); @@ -161,7 +158,6 @@ private: #endif private: - friend class ::WaveViewTest; friend class WaveViewThreadClient; friend class WaveViewDrawingThread; @@ -247,8 +243,9 @@ private: void set_image (boost::shared_ptr<WaveViewImage> img) const; // @return true if item area intersects with draw area - bool get_item_and_draw_rect_in_window_coords (Rect const& canvas_rect, Rect& item_area, - Rect& draw_rect) const; + bool get_item_and_draw_rect_in_window_coords (ArdourCanvas::Rect const& canvas_rect, + ArdourCanvas::Rect& item_area, + ArdourCanvas::Rect& draw_rect) const; boost::shared_ptr<WaveViewDrawRequest> create_draw_request (WaveViewProperties const&) const; @@ -266,6 +263,6 @@ private: void reset_cache_group (); }; -} // namespace ArdourCanvas +} /* namespace */ -#endif // __CANVAS_WAVE_VIEW_H__ +#endif diff --git a/libs/canvas/canvas/wave_view_private.h b/libs/waveview/waveview/wave_view_private.h index d870300998..b1e5ace844 100644 --- a/libs/canvas/canvas/wave_view_private.h +++ b/libs/waveview/waveview/wave_view_private.h @@ -17,18 +17,18 @@ */ -#ifndef __CANVAS_WAVE_VIEW_PRIVATE_H__ -#define __CANVAS_WAVE_VIEW_PRIVATE_H__ +#ifndef _WAVEVIEW_WAVE_VIEW_PRIVATE_H_ +#define _WAVEVIEW_WAVE_VIEW_PRIVATE_H_ #include <deque> -#include "canvas/wave_view.h" +#include "waveview/wave_view.h" namespace ARDOUR { class AudioRegion; } -namespace ArdourCanvas { +namespace ArdourWaveView { struct WaveViewProperties { @@ -360,6 +360,6 @@ private: }; -} // namespace ArdourCanvas +} /* namespace */ -#endif // __CANVAS_WAVE_VIEW_PRIVATE_H__ +#endif diff --git a/libs/waveview/wscript b/libs/waveview/wscript new file mode 100644 index 0000000000..35311fac17 --- /dev/null +++ b/libs/waveview/wscript @@ -0,0 +1,64 @@ +#!/usr/bin/env python +from waflib.extras import autowaf as autowaf +from waflib import Options +from waflib import TaskGen +import os + +# Version of this package (even if built as a child) +MAJOR = '0' +MINOR = '0' +MICRO = '0' +WAVEVIEW_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO) + +# Library version (UNIX style major, minor, micro) +# major increment <=> incompatible changes +# minor increment <=> compatible changes (additions) +# micro increment <=> no interface changes +WAVEVIEW_LIB_VERSION = '0.0.0' + +# Variables for 'waf dist' +APPNAME = 'waveview' +VERSION = WAVEVIEW_VERSION +I18N_PACKAGE = 'libwaveview' + +# Mandatory variables +top = '.' +out = 'build' + +waveview_sources = [ + 'debug.cc', + 'wave_view.cc', + 'wave_view_private.cc', +] + +def options(opt): + autowaf.set_options(opt) + +def configure(conf): + conf.load ('compiler_cxx') + autowaf.configure(conf) + autowaf.check_pkg(conf, 'cairomm-1.0', uselib_store='CAIROMM', atleast_version='1.8.4') + +def build(bld): + # Library + if bld.is_defined ('INTERNAL_SHARED_LIBS'): + obj = bld.shlib(features = 'cxx cxxshlib', source=waveview_sources) + obj.defines = [ 'LIBWAVEVIEW_DLL_EXPORTS=1' ] + else: + obj = bld.stlib(features = 'cxx cxxstlib', source=waveview_sources) + obj.cxxflags = [ '-fPIC' ] + obj.cflags = [ '-fPIC' ] + obj.defines = [ ] + + obj.export_includes = ['.'] + obj.includes = ['.'] + obj.uselib = 'SIGCPP CAIROMM GTKMM BOOST XML' + obj.use = [ 'libpbd', 'libcanvas', 'libardour', 'libgtkmm2ext' ] + obj.name = 'libwaveview' + obj.target = 'waveview' + obj.vnum = WAVEVIEW_LIB_VERSION + obj.install_path = bld.env['LIBDIR'] + obj.defines += [ 'PACKAGE="' + I18N_PACKAGE + '"' ] + +def shutdown(): + autowaf.shutdown() @@ -221,6 +221,7 @@ children = [ 'libs/audiographer', 'libs/canvas', 'libs/widgets', + 'libs/waveview', 'libs/plugins/reasonablesynth.lv2', 'libs/plugins/a-comp.lv2', 'libs/plugins/a-delay.lv2', |