diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-06-20 18:50:38 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-06-20 18:50:38 +0000 |
commit | be362ae53c1d191e23d8a084d0327044bce4544c (patch) | |
tree | fb64f8276c64a495a0fdcf99e772d983af7725c0 | |
parent | c03dbd7568322d553ff681cb7f0bbd3452abd6cf (diff) |
fixes for libsndfile conversion issues, tape track waveform display and overloaded virtual functions
git-svn-id: svn://localhost/ardour2/trunk@624 d708f5d6-7413-0410-9779-e7cbd77b26cf
34 files changed, 117 insertions, 137 deletions
diff --git a/SConstruct b/SConstruct index 9b4144f51c..157d7c0b8f 100644 --- a/SConstruct +++ b/SConstruct @@ -408,10 +408,6 @@ libraries['pbd3'] = LibraryInfo (LIBS='pbd', LIBPATH='#libs/pbd3', CPPPATH='# libraries['gtkmm2ext'] = LibraryInfo (LIBS='gtkmm2ext', LIBPATH='#libs/gtkmm2ext', CPPPATH='#libs/gtkmm2ext') #libraries['cassowary'] = LibraryInfo(LIBS='cassowary', LIBPATH='#libs/cassowary', CPPPATH='#libs/cassowary') -libraries['fst'] = LibraryInfo() -if env['VST']: - libraries['fst'].ParseConfig('pkg-config --cflags --libs libfst') - # # Check for libusb @@ -532,6 +528,9 @@ if env['SYSLIBS']: 'libs/ardour' ] + if env['VST']: + subdirs = ['libs/fst'] + subdirs + ['vst'] + gtk_subdirs = [ # 'libs/flowcanvas', 'libs/gtkmm2ext', @@ -585,6 +584,9 @@ else: 'libs/ardour' ] + if env['VST']: + subdirs = ['libs/fst'] + subdirs + ['vst'] + gtk_subdirs = [ 'libs/glibmm2', 'libs/gtkmm2/pango', @@ -787,10 +789,11 @@ if env['DEBUG'] == 1: else: env.Append(CCFLAGS=" ".join (opt_flags)) -env.Append(CCFLAGS="-Wall") +# +# warnings flags +# -if env['VST']: - env.Append(CCFLAGS="-DVST_SUPPORT") +env.Append(CCFLAGS="-Wall -Woverloaded-virtual") if env['LIBLO']: env.Append(CCFLAGS="-DHAVE_LIBLO") diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index b670a6d969..99c97d20a4 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -58,9 +58,6 @@ if gtkardour['FFT_ANALYSIS']: gtkardour.Merge ([libraries['fftw3f']]) gtkardour.Append(CCFLAGS='-DFFT_ANALYSIS') -if gtkardour['VST']: - gtkardour.Merge ([ libraries['fst']]) - skipped_files=Split(""" connection_editor.cc """) @@ -203,15 +200,16 @@ itest.cc """) extra_sources = [] + vst_files = [ 'vst_pluginui.cc' ] if env['VST']: - extra_sources += vst_files - + extra_sources += vst_files + gtkardour.Append (CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst") + if env['FFT_ANALYSIS']: extra_sources += fft_analysis_files - intl_files += extra_sources gtkardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE") @@ -226,6 +224,8 @@ gtkardour.VersionBuild(['version.cc','version.h'], 'SConscript') executable = 'ardour.bin' ardour = gtkardour.Program(target = executable, source = gtkardour_files + extra_sources) +ardourlib = gtkardour.SharedLibrary(target = 'ardourgtk', source = gtkardour_files + extra_sources) + mtest = gtkardour.Program(target = 'mtest', source = mtest_files) itest = gtkardour.Program(target = 'itest', source = itest_files) @@ -235,21 +235,28 @@ my_subst_dict['%INSTALL_PREFIX%'] = install_prefix ardoursh = env.SubstInFile ('ardour.sh','ardour.sh.in', SUBST_DICT = my_subst_dict); env.AddPostAction (ardoursh, Chmod ('$TARGET', 0755)) -Default(ardour) +if env['VST']: + Default(ardourlib) + # the library - into the library dir + env.Alias('install', env.Install(os.path.join(install_prefix, 'lib/ardour2'), ardourlib)) +else: + + if env['VERSIONED']: + Default (env.VersionedExecutable ('tagged_executable', ardour)) + else: + Default(ardour) -if env['VERSIONED']: - Default (env.VersionedExecutable ('tagged_executable', ardour)) + #install + + # the executable - into the library dir + env.Alias('install', env.Install(os.path.join(install_prefix, 'lib/ardour2'), ardour)) + # the script - into the bin dir + env.Alias('install', env.InstallAs(os.path.join(install_prefix, 'bin')+'/ardour2', ardoursh)) if env['NLS']: - Export('gtkardour', 'intl_files') - SConscript ('po/SConscript') + Export('gtkardour', 'intl_files') + SConscript ('po/SConscript') -#install - -# the executable - into the library dir -env.Alias('install', env.Install(os.path.join(install_prefix, 'lib/ardour2'), ardour)) -# the script - into the bin dir -env.Alias('install', env.InstallAs(os.path.join(install_prefix, 'bin')+'/ardour2', ardoursh)) # configuration files env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour2_ui.rc')) env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.menus')) @@ -259,6 +266,7 @@ env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour env.Alias('install', env.Install(os.path.join(install_prefix, 'share/ardour2'), 'splash.ppm')) env.Alias('install', env.Install(os.path.join(install_prefix, 'share/ardour2/pixmaps'), pixmap_files)) + #dist env.Alias ('tarball', env.Distribute (env['DISTTREE'], [ 'SConscript', diff --git a/gtk2_ardour/axis_view.h b/gtk2_ardour/axis_view.h index 38deece11a..12b7d32188 100644 --- a/gtk2_ardour/axis_view.h +++ b/gtk2_ardour/axis_view.h @@ -28,6 +28,7 @@ #include <pbd/xml++.h> #include "prompter.h" +#include "selectable.h" namespace ARDOUR { class Session; @@ -37,7 +38,7 @@ namespace ARDOUR { * AxisView defines the abstract base class for time-axis trackviews and routes. * */ -class AxisView : public virtual sigc::trackable +class AxisView : public virtual Selectable { public: /** @@ -51,12 +52,6 @@ class AxisView : public virtual sigc::trackable virtual string name() const = 0; - virtual void set_selected (bool yn) { - if (yn != _selected) { - _selected = yn; - } - } - virtual bool marked_for_display() const { return _marked_for_display; } virtual void set_marked_for_display (bool yn) { @@ -65,7 +60,6 @@ class AxisView : public virtual sigc::trackable } } - virtual bool selected() const { return _selected; } sigc::signal<void> Hiding; sigc::signal<void> GoingAway; diff --git a/gtk2_ardour/canvas-waveview.c b/gtk2_ardour/canvas-waveview.c index 34b64770a6..3e4a14d86a 100644 --- a/gtk2_ardour/canvas-waveview.c +++ b/gtk2_ardour/canvas-waveview.c @@ -389,7 +389,11 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ /* but make sure it doesn't extend beyond the end of the source material */ rf3 = (gulong) (waveview->sourcefile_length_function (waveview->data_src, waveview->samples_per_unit)) + 1; - rf3 -= new_cache_start; + if (rf3 < new_cache_start) { + rf3 = 0; + } else { + rf3 -= new_cache_start; + } #if DEBUG_CACHE fprintf (stderr, "\n\nAVAILABLE FRAMES = %lu of %lu, start = %lu, sstart = %lu, cstart = %lu\n", @@ -405,8 +409,8 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ #if DEBUG_CACHE fprintf (stderr, "new cache = %lu - %lu\n", new_cache_start, new_cache_end); - fprintf(stderr,"required_cach_entries = %lu, samples_per_unit = %f\n", - required_cache_entries,waveview->samples_per_unit); + fprintf(stderr,"required_cach_entries = %lu, samples_per_unit = %f req frames = %lu\n", + required_cache_entries,waveview->samples_per_unit, required_frames); #endif if (required_cache_entries > cache->allocated) { @@ -514,8 +518,8 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ // fprintf(stderr,"length == %lu\n",waveview->length_function (waveview->data_src)); // required_frames = MIN (waveview->length_function (waveview->data_src) - new_cache_start, required_frames); + npeaks = (gulong) floor (required_frames / waveview->samples_per_unit); - npeaks = MAX (1, npeaks); required_frames = npeaks * waveview->samples_per_unit; #if DEBUG_CACHE @@ -532,11 +536,15 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_ // start_sample, end_sample); #endif - waveview->peak_function (waveview->data_src, npeaks, new_cache_start, required_frames, cache->data + offset, waveview->channel,waveview->samples_per_unit); - - /* take into account any copied peaks */ + if (required_frames) { + waveview->peak_function (waveview->data_src, npeaks, new_cache_start, required_frames, cache->data + offset, waveview->channel,waveview->samples_per_unit); - npeaks += copied; + /* take into account any copied peaks */ + + npeaks += copied; + } else { + npeaks = copied; + } if (npeaks < cache->allocated) { #if DEBUG_CACHE diff --git a/gtk2_ardour/crossfade_view.cc b/gtk2_ardour/crossfade_view.cc index aef54f2c5d..4545837dfa 100644 --- a/gtk2_ardour/crossfade_view.cc +++ b/gtk2_ardour/crossfade_view.cc @@ -50,7 +50,7 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent, AudioRegionView& rview) - : TimeAxisViewItem ("xf.name()", *parent, tv, spu, basic_color, xf.position(), + : TimeAxisViewItem ("xfade" /*xf.name()*/, *parent, tv, spu, basic_color, xf.position(), xf.overlap_length(), TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowFrame)), crossfade (xf), left_view (lview), @@ -91,13 +91,6 @@ CrossfadeView::~CrossfadeView () GoingAway (this) ; /* EMIT_SIGNAL */ } -std::string -CrossfadeView::get_item_name () -{ - return "xfade"; -// return crossfade.name(); -} - void CrossfadeView::reset_width_dependent_items (double pixel_width) { diff --git a/gtk2_ardour/crossfade_view.h b/gtk2_ardour/crossfade_view.h index b4931c94c0..403edfe297 100644 --- a/gtk2_ardour/crossfade_view.h +++ b/gtk2_ardour/crossfade_view.h @@ -46,7 +46,6 @@ struct CrossfadeView : public TimeAxisViewItem AudioRegionView& left_view; // and these too AudioRegionView& right_view; - std::string get_item_name(); void set_height (double); bool valid() const { return _valid; } diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 991a1b1443..c140213bb2 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -195,7 +195,7 @@ Editor::set_mouse_mode (MouseMode m, bool force) */ for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { - if ((*i)->selected()) { + if ((*i)->get_selected()) { (*i)->show_selection (selection->time); } } diff --git a/gtk2_ardour/imageframe_socket_handler.cc b/gtk2_ardour/imageframe_socket_handler.cc index 4f08954a8d..f649eddef7 100644 --- a/gtk2_ardour/imageframe_socket_handler.cc +++ b/gtk2_ardour/imageframe_socket_handler.cc @@ -1091,7 +1091,7 @@ ImageFrameSocketHandler::handle_item_selected(const char* msg) } else { - ifv->set_selected(true, this) ; + ifv->set_selected(true) ; ifta->get_view()->set_selected_imageframe_view(iftag, ifv) ; thePublicEditor.scroll_timeaxis_to_imageframe_item(ifv) ; diff --git a/gtk2_ardour/imageframe_time_axis_view.cc b/gtk2_ardour/imageframe_time_axis_view.cc index e00c399e7f..a725082863 100644 --- a/gtk2_ardour/imageframe_time_axis_view.cc +++ b/gtk2_ardour/imageframe_time_axis_view.cc @@ -365,11 +365,11 @@ ImageFrameTimeAxisView::set_selected_imageframe_view(ImageFrameTimeAxisGroup* if if(selected_imageframe_view) { - selected_imageframe_view->set_selected(false, this) ; + selected_imageframe_view->set_selected(false) ; } selected_imageframe_view = ifv ; - selected_imageframe_view->set_selected(true, this) ; + selected_imageframe_view->set_selected(true) ; } /** @@ -386,7 +386,7 @@ ImageFrameTimeAxisView::clear_selected_imageframe_item(bool clear_group) if(selected_imageframe_view) { - selected_imageframe_view->set_selected(false, this) ; + selected_imageframe_view->set_selected(false) ; } selected_imageframe_view = 0 ; } diff --git a/gtk2_ardour/imageframe_view.cc b/gtk2_ardour/imageframe_view.cc index e8ff878486..ac17a7cc1a 100644 --- a/gtk2_ardour/imageframe_view.cc +++ b/gtk2_ardour/imageframe_view.cc @@ -172,16 +172,15 @@ delete imageframe; * @return true if the position change was a success, false otherwise */ bool -ImageFrameView::set_position(jack_nframes_t pos, void* src) +ImageFrameView::set_position(jack_nframes_t pos, void* src, double* delta) { jack_nframes_t old_pos = frame_position ; // do the standard stuff - bool ret = TimeAxisViewItem::set_position(pos, src) ; + bool ret = TimeAxisViewItem::set_position(pos, src, delta) ; // everything went ok with the standard stuff? - if(ret) - { + if (ret) { /* move each of our associated markers with this ImageFrameView */ for (MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i) { diff --git a/gtk2_ardour/imageframe_view.h b/gtk2_ardour/imageframe_view.h index c599082580..5ae8aaded6 100644 --- a/gtk2_ardour/imageframe_view.h +++ b/gtk2_ardour/imageframe_view.h @@ -91,7 +91,7 @@ class ImageFrameView : public TimeAxisViewItem * @param src the identity of the object that initiated the change * @return true if the position change was a success, false otherwise */ - virtual bool set_position(jack_nframes_t pos, void* src) ; + virtual bool set_position(jack_nframes_t pos, void* src, double* delta = 0) ; /** * Sets the duration of this item diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index dc30690611..2bbae39568 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -361,6 +361,7 @@ To create it from the command line, start ardour as \"ardour --new %1"), path) return true; } + int main (int argc, char *argv[]) { diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index cc66d1128a..3a8881916c 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -125,7 +125,6 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) output_button.set_name ("MixerIOButton"); output_label.set_name ("MixerIOButtonLabel"); - _route.meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed)); meter_point_button.add (meter_point_label); meter_point_button.set_name ("MixerStripMeterPreButton"); diff --git a/gtk2_ardour/panner2d.cc b/gtk2_ardour/panner2d.cc index c6b2bad6c9..36f7aab252 100644 --- a/gtk2_ardour/panner2d.cc +++ b/gtk2_ardour/panner2d.cc @@ -127,7 +127,7 @@ Panner2d::reset (uint32_t n_inputs) } void -Panner2d::on_size_allocate (Gtk::Allocation alloc) +Panner2d::on_size_allocate (Gtk::Allocation& alloc) { width = alloc.get_width(); height = alloc.get_height(); diff --git a/gtk2_ardour/panner2d.h b/gtk2_ardour/panner2d.h index ff81ea3987..1bf8879ba5 100644 --- a/gtk2_ardour/panner2d.h +++ b/gtk2_ardour/panner2d.h @@ -78,7 +78,7 @@ class Panner2d : public Gtk::DrawingArea bool on_button_press_event (GdkEventButton *); bool on_button_release_event (GdkEventButton *); bool on_motion_notify_event (GdkEventMotion *); - void on_size_allocate (Gtk::Allocation alloc); + void on_size_allocate (Gtk::Allocation& alloc); private: struct Target { diff --git a/gtk2_ardour/redirect_automation_line.h b/gtk2_ardour/redirect_automation_line.h index 3933359db0..ad39f6625c 100644 --- a/gtk2_ardour/redirect_automation_line.h +++ b/gtk2_ardour/redirect_automation_line.h @@ -53,8 +53,6 @@ class RedirectAutomationLine : public AutomationLine void view_to_model_y (double&); void model_to_view_y (double&); - void change_model (uint32_t, double x, double y); - void change_model_range (uint32_t, uint32_t, double delta); }; #endif /* __ardour_gtk_region_gain_line_h__ */ diff --git a/gtk2_ardour/regionview.cc b/gtk2_ardour/regionview.cc index ad012b3483..4d73b64fe7 100644 --- a/gtk2_ardour/regionview.cc +++ b/gtk2_ardour/regionview.cc @@ -1234,12 +1234,6 @@ AudioRegionView::set_waveform_shape (WaveformShape shape) } } -std::string -AudioRegionView::get_item_name () -{ - return region.name(); -} - void AudioRegionView::move (double x_delta, double y_delta) { diff --git a/gtk2_ardour/regionview.h b/gtk2_ardour/regionview.h index cb71a8f3a7..f49b46aea4 100644 --- a/gtk2_ardour/regionview.h +++ b/gtk2_ardour/regionview.h @@ -63,7 +63,6 @@ class AudioRegionView : public TimeAxisViewItem bool is_valid() const { return valid; } void set_valid (bool yn) { valid = yn; } - std::string get_item_name(); void set_height (double); void set_samples_per_unit (double); bool set_duration (jack_nframes_t, void*); diff --git a/gtk2_ardour/selectable.h b/gtk2_ardour/selectable.h index fdd6f7ff9f..b4be7090e2 100644 --- a/gtk2_ardour/selectable.h +++ b/gtk2_ardour/selectable.h @@ -21,7 +21,9 @@ #ifndef __ardour_gtk_selectable_h__ #define __ardour_gtk_selectable_h__ -class Selectable +#include <sigc++/signal.h> + +class Selectable : public virtual sigc::trackable { public: Selectable() { @@ -30,10 +32,20 @@ class Selectable virtual ~Selectable() {} - virtual void set_selected (bool) { - _selected = true; + virtual void set_selected (bool yn) { + if (yn != _selected) { + _selected = true; + Selected (_selected); /* EMIT_SIGNAL */ + } + } + + bool get_selected() const { + return _selected; } + /** Emitted when the selected status of this Selectable changes */ + sigc::signal<void, bool> Selected ; + protected: bool _selected; }; diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 70c06b1db7..e95411a498 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -548,7 +548,7 @@ StreamView::set_selected_regionviews (AudioRegionSelection& regions) } // cerr << "\tregion " << (*i)->region.name() << " selected = " << selected << endl; - (*i)->set_selected (selected, this); + (*i)->set_selected (selected); } } diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index f54688ddfb..c333a8acb3 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -484,26 +484,14 @@ TimeAxisViewItem::get_item_name() const * @param src the identity of the object that initiated the change */ void -TimeAxisViewItem::set_selected(bool yn, void* src) +TimeAxisViewItem::set_selected(bool yn) { if (_selected != yn) { - _selected = yn ; + Selectable::set_selected (yn); set_frame_color (); - Selected (_selected) ; /* EMIT_SIGNAL */ } } -/** - * Returns whether this item is currently selected. - * - * @return true if this item is currently selected, false otherwise - */ -bool -TimeAxisViewItem::get_selected() const -{ - return (_selected) ; -} - void TimeAxisViewItem::set_should_show_selection (bool yn) { diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h index c9e4fd5dd5..b23350eef7 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -21,8 +21,6 @@ #ifndef __gtk_ardour_time_axis_view_item_h__ #define __gtk_ardour_time_axis_view_item_h__ -#include <sigc++/signal.h> - #include <jack/jack.h> #include <string> @@ -38,7 +36,7 @@ class TimeAxisView; * A base class for 'items' that may appear upon a TimeAxisView * */ -class TimeAxisViewItem : public sigc::trackable, public Selectable +class TimeAxisViewItem : public Selectable { public: virtual ~TimeAxisViewItem() ; @@ -170,9 +168,8 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable * Set to true to indicate that this item is currently selected * * @param yn true if this item is currently selected - * @param src the identity of the object that initiated the change */ - virtual void set_selected(bool yn, void* src) ; + virtual void set_selected(bool yn) ; /** * Set to true to indicate that this item should show its selection status @@ -181,13 +178,6 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable */ virtual void set_should_show_selection (bool yn) ; - /** - * Returns whether this item is currently selected. - * - * @return true if this item is currently selected, false otherwise - */ - bool get_selected() const ; - //---------------------------------------------------------------------------------------// // Parent Component Methods @@ -319,10 +309,6 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable /** Emitted when the mionimum item duration is changed */ sigc::signal<void,jack_nframes_t,void*> MinDurationChanged ; - /** Emitted when the selected status of this item changes */ - sigc::signal<void, bool> Selected ; - - protected: enum Visibility { diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript index 7f4ee15eee..5361354962 100644 --- a/libs/ardour/SConscript +++ b/libs/ardour/SConscript @@ -103,6 +103,7 @@ extra_sources = [ ] if ardour['VST']: extra_sources += vst_files + ardour.Append(CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst") if ardour['LIBLO']: extra_sources += osc_files diff --git a/libs/ardour/ardour/destructive_filesource.h b/libs/ardour/ardour/destructive_filesource.h index 49a1e3b48a..c92a0762ee 100644 --- a/libs/ardour/ardour/destructive_filesource.h +++ b/libs/ardour/ardour/destructive_filesource.h @@ -48,7 +48,7 @@ class DestructiveFileSource : public SndFileSource { static void setup_standard_crossfades (jack_nframes_t sample_rate); protected: - jack_nframes_t write_unlocked (Sample *src, jack_nframes_t start, jack_nframes_t cnt, char * workbuf); + jack_nframes_t write_unlocked (Sample *src, jack_nframes_t cnt, char * workbuf); private: static jack_nframes_t xfade_frames; diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index c80a7abfaa..8ae45fe65c 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -321,7 +321,6 @@ public: Change restore_state (State&); StateManager::State* state_factory (std::string why) const; - void send_state_changed(); bool get_midi_node_info (XMLNode * node, MIDI::eventType & ev, MIDI::channel_t & chan, MIDI::byte & additional); bool set_midi_node_info (XMLNode * node, MIDI::eventType ev, MIDI::channel_t chan, MIDI::byte additional); diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 3c94dad6fd..aae776625e 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -233,7 +233,6 @@ class Region : public Stateful, public StateManager /* state management */ void send_change (Change); - void send_state_changed (); /* derived classes need these during their own state management calls */ diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 5699d9ef14..5686dfc908 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -95,7 +95,7 @@ class Route : public IO virtual bool can_record() const { return false; } virtual void set_record_enable (bool yn, void *src) {} virtual bool record_enabled() const { return false; } - virtual void transport_stopped (bool abort, bool did_locate, bool flush_redirects); + virtual void handle_transport_stopped (bool abort, bool did_locate, bool flush_redirects); virtual void set_pending_declick (int); /* end of vfunc-based API */ diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index 46596ad64f..add9364cad 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -792,7 +792,9 @@ AudioSource::do_build_peak (jack_nframes_t first_frame, jack_nframes_t cnt) frames_to_read = min (frames_per_peak, cnt); - if ((frames_read = read_unlocked (buf, current_frame, frames_to_read, workbuf)) != frames_to_read) { + /* lock for every read */ + + if ((frames_read = read (buf, current_frame, frames_to_read, workbuf)) != frames_to_read) { error << string_compose(_("%1: could not write read raw data for peak computation (%2)"), _name, strerror (errno)) << endmsg; goto out; } diff --git a/libs/ardour/destructive_filesource.cc b/libs/ardour/destructive_filesource.cc index 00fabba445..306b377320 100644 --- a/libs/ardour/destructive_filesource.cc +++ b/libs/ardour/destructive_filesource.cc @@ -255,7 +255,7 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in, } jack_nframes_t -DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) +DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t cnt, char * workbuf) { jack_nframes_t old_file_pos; @@ -319,9 +319,7 @@ DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t start, jack_ } old_file_pos = file_pos; - if (file_pos + cnt > _length) { - _length = file_pos + cnt; - } + update_length (file_pos, cnt); file_pos += cnt; if (_build_peakfiles) { diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 9f4c3cd9e3..2f04b7eaca 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -2443,12 +2443,6 @@ IO::state_factory (std::string why) const return state; } -void -IO::send_state_changed () -{ - return; -} - /** Update the peak meters. diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 93fbb85e49..2ed0659485 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2002,7 +2002,7 @@ Route::set_active (bool yn) } void -Route::transport_stopped (bool abort_ignored, bool did_locate, bool can_flush_redirects) +Route::handle_transport_stopped (bool abort_ignored, bool did_locate, bool can_flush_redirects) { jack_nframes_t now = _session.transport_frame(); diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 4a1f7a182b..60fa3dd94d 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -1198,8 +1198,8 @@ Session::update_latency_compensation (bool with_stop, bool abort) for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { if (with_stop) { - (*i)->transport_stopped (abort, (post_transport_work & PostTransportLocate), - (!(post_transport_work & PostTransportLocate) || pending_locate_flush)); + (*i)->handle_transport_stopped (abort, (post_transport_work & PostTransportLocate), + (!(post_transport_work & PostTransportLocate) || pending_locate_flush)); } jack_nframes_t old_latency = (*i)->signal_latency (); diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 6929385141..6ea0929ae0 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -81,8 +81,6 @@ SndFileSource::SndFileSource (string idstr, SampleFormat sfmt, HeaderFormat hf, init (idstr); - cerr << "creating " << idstr << " hf = " << hf << endl; - switch (hf) { case CAF: fmt = SF_FORMAT_CAF; @@ -174,7 +172,7 @@ SndFileSource::SndFileSource (string idstr, SampleFormat sfmt, HeaderFormat hf, } if (_build_peakfiles) { - if (initialize_peakfile (false, _path)) { + if (initialize_peakfile (true, _path)) { sf_close (sf); sf = 0; throw failed_constructor (); @@ -187,14 +185,6 @@ SndFileSource::SndFileSource (string idstr, SampleFormat sfmt, HeaderFormat hf, HeaderPositionOffsetChanged.connect (mem_fun (*this, &AudioFileSource::handle_header_position_change)); } - if (_build_peakfiles) { - if (initialize_peakfile (false, _path)) { - sf_close (sf); - sf = 0; - throw failed_constructor (); - } - } - AudioSourceCreated (this); /* EMIT SIGNAL */ } @@ -310,7 +300,7 @@ SndFileSource::read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t if (file_cnt) { - if (sf_seek (sf, (off_t) start, SEEK_SET) < 0) { + if (sf_seek (sf, (sf_count_t) start, SEEK_SET|SFM_READ) != (sf_count_t) start) { char errbuf[256]; sf_error_str (0, errbuf, sizeof (errbuf) - 1); error << string_compose(_("SndFileSource: could not seek to frame %1 within %2 (%3)"), start, _name.substr (1), errbuf) << endmsg; @@ -505,7 +495,7 @@ SndFileSource::set_header_timeline_position () jack_nframes_t SndFileSource::write_float (Sample* data, jack_nframes_t frame_pos, jack_nframes_t cnt) { - if (sf_seek (sf, frame_pos, SEEK_SET) != frame_pos) { + if (sf_seek (sf, frame_pos, SEEK_SET|SFM_WRITE) != frame_pos) { error << string_compose (_("%1: cannot seek to %2"), _path, frame_pos) << endmsg; return 0; } diff --git a/libs/libsndfile/src/sndfile.c b/libs/libsndfile/src/sndfile.c index c30d7b61b4..b627c88ffe 100644 --- a/libs/libsndfile/src/sndfile.c +++ b/libs/libsndfile/src/sndfile.c @@ -1150,7 +1150,7 @@ sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence) ** it makes sense. */ if (((whence & SFM_MASK) == SFM_WRITE && psf->mode == SFM_READ) || - ((whence & SFM_MASK) == SFM_WRITE && psf->mode == SFM_WRITE)) + ((whence & SFM_MASK) == SFM_READ && psf->mode == SFM_WRITE)) { psf->error = SFE_WRONG_SEEK ; return PSF_SEEK_ERROR ; } ; @@ -1210,10 +1210,25 @@ sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence) if (psf->error) return PSF_SEEK_ERROR ; +#ifdef ECDL_ORIGINAL# if (seek_from_start < 0 || seek_from_start > psf->sf.frames) { psf->error = SFE_BAD_SEEK ; return PSF_SEEK_ERROR ; } ; +#else + if (((whence & SFM_MASK) == SFM_WRITE) || (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)) + { if (seek_from_start < 0 /* || (seek_from_start > psf->sf.frames && post-audio chunks exist) */ ) + { psf->error = SFE_BAD_SEEK ; + return PSF_SEEK_ERROR ; + } + } + else /* seek for reading */ + { if (seek_from_start < 0 || seek_from_start > psf->sf.frames) + { psf->error = SFE_BAD_SEEK ; + return PSF_SEEK_ERROR ; + } + } +#endif if (psf->seek) { int new_mode = (whence & SFM_MASK) ? (whence & SFM_MASK) : psf->mode ; @@ -1234,6 +1249,7 @@ sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence) break ; } ; + psf->last_op = new_mode ; return retval ; |