From a4d9d09af5853f769e1143c2353806bfb7d89f58 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 16 Aug 2010 19:58:34 +0000 Subject: forward port 2.X changes up to and including rev 6714 git-svn-id: svn://localhost/ardour2/branches/3.0@7635 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/about.cc | 2 +- gtk2_ardour/ardour.menus.in | 6 +++-- gtk2_ardour/ardour_ui.cc | 14 ++++++++++++ gtk2_ardour/ardour_ui.h | 5 ++++ gtk2_ardour/io_selector.cc | 22 ++++++++++++++++-- gtk2_ardour/io_selector.h | 3 +++ libs/ardour/ardour/delivery.h | 2 +- libs/ardour/ardour/internal_return.h | 2 +- libs/ardour/ardour/internal_send.h | 2 +- libs/ardour/ardour/ladspa_plugin.h | 2 +- libs/ardour/ardour/lv2_plugin.h | 2 +- libs/ardour/ardour/plugin.h | 4 +++- libs/ardour/ardour/plugin_insert.h | 3 ++- libs/ardour/ardour/port_insert.h | 1 + libs/ardour/ardour/processor.h | 4 +++- libs/ardour/ardour/session.h | 2 +- libs/ardour/ardour/vst_plugin.h | 2 +- libs/ardour/audioengine.cc | 4 ++++ libs/ardour/audiofilesource.cc | 37 +++++++++++++++++++++--------- libs/ardour/caimportable.cc | 4 +++- libs/ardour/delivery.cc | 2 +- libs/ardour/internal_return.cc | 3 ++- libs/ardour/internal_send.cc | 3 ++- libs/ardour/midi_model.cc | 7 ++++++ libs/ardour/midi_track.cc | 2 +- libs/ardour/plugin_insert.cc | 18 ++++++++++++--- libs/ardour/port_insert.cc | 33 +++++++++++++++++++++++++++ libs/ardour/route.cc | 4 ++-- libs/ardour/session.cc | 23 ++++++++++++++----- libs/ardour/track.cc | 2 +- libs/ardour/vst_plugin.cc | 3 ++- libs/evoral/src/Sequence.cpp | 1 + libs/gtkmm2ext/barcontroller.cc | 44 +++++++++++++++++------------------- libs/pbd/pbd/whitespace.h | 5 ++++ libs/pbd/whitespace.cc | 9 ++++++++ 35 files changed, 215 insertions(+), 67 deletions(-) diff --git a/gtk2_ardour/about.cc b/gtk2_ardour/about.cc index 317be6f403..babc5db4bb 100644 --- a/gtk2_ardour/about.cc +++ b/gtk2_ardour/about.cc @@ -182,7 +182,7 @@ static const char* translators[] = { N_("Greek:\n\t Klearchos Gourgourinis \n"), N_("Swedish:\n\t Petter Sundlöf \n"), N_("Polish:\n\t Piotr Zaryk \n"), - N_("Czech:\n\t Pavel Frich\n"), + N_("Czech:\n\t Pavel Fric \n"), N_("Norwegian:\n\t Eivind Ødegård\n"), 0 }; diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index 8d6950b90b..9aaada247b 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -29,10 +29,11 @@ +#ifndef GTKOSX +#endif - -#ifdef GTKOSX +#ifndef GTKOSX #endif @@ -265,6 +266,7 @@ + diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index b28bccbc94..72adc4305b 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -732,6 +732,19 @@ ARDOUR_UI::check_memory_locking () } +void +ARDOUR_UI::queue_finish () +{ + Glib::signal_idle().connect (mem_fun (*this, &ARDOUR_UI::idle_finish)); +} + +bool +ARDOUR_UI::idle_finish () +{ + finish (); + return false; /* do not call again */ +} + void ARDOUR_UI::finish() { @@ -772,6 +785,7 @@ If you still wish to quit, please use the\n\n\ point_oh_five_second_connection.disconnect (); point_zero_one_second_connection.disconnect(); + _session->set_clean (); // _session->set_deletion_in_progress (); _session->remove_pending_capture_state (); delete _session; diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index b960af2074..cc81faee3a 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -699,6 +699,11 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr PBD::ScopedConnectionList forever_connections; void step_edit_status_change (bool); + + /* these are used only in response to a platform-specific "ShouldQuit" signal + */ + bool idle_finish (); + void queue_finish (); }; #endif /* __ardour_gui_h__ */ diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index 9399a6aaa7..2bf112ef8e 100644 --- a/gtk2_ardour/io_selector.cc +++ b/gtk2_ardour/io_selector.cc @@ -159,7 +159,7 @@ IOSelector::get_state (ARDOUR::BundleChannel c[2]) const ARDOUR::Bundle::PortList const & our_ports = c[_ours].bundle->channel_ports (c[_ours].channel); ARDOUR::Bundle::PortList const & other_ports = c[_other].bundle->channel_ports (c[_other].channel); - if (our_ports.empty() || other_ports.empty()) { + if (!_session || our_ports.empty() || other_ports.empty()) { /* we're looking at a bundle with no parts associated with this channel, so nothing to connect */ return PortMatrixNode::NOT_ASSOCIATED; @@ -286,9 +286,26 @@ PortInsertUI::PortInsertUI (Gtk::Window* parent, ARDOUR::Session* sess, boost::s pack_start (output_selector, true, true); pack_start (input_selector, true, true); + update_latency_display (); + latency_button.signal_toggled().connect (mem_fun (*this, &PortInsertUI::latency_button_toggled)); } + +void +PortInsertUI::update_latency_display () +{ + nframes_t sample_rate = input_selector.session()->engine().frame_rate(); + if (sample_rate == 0) { + latency_display.set_text (_("Disconnected from audio engine")); + } else { + char buf[64]; + snprintf (buf, sizeof (buf), "%10.3lf frames %10.3lf ms", + (float)_pi->latency(), (float)_pi->latency() * 1000.0f/sample_rate); + latency_display.set_text(buf); + } +} + bool PortInsertUI::check_latency_measurement () { @@ -304,7 +321,7 @@ PortInsertUI::check_latency_measurement () mtdm->resolve (); } - char buf[64]; + char buf[128]; nframes_t sample_rate = AudioEngine::instance()->frame_rate(); if (sample_rate == 0) { @@ -329,6 +346,7 @@ PortInsertUI::check_latency_measurement () if (solid) { _pi->set_measured_latency ((nframes_t) rint (mtdm->del())); + latency_button.set_active (false); strcat (buf, " (set)"); } diff --git a/gtk2_ardour/io_selector.h b/gtk2_ardour/io_selector.h index 32946fb1b7..653d8834a1 100644 --- a/gtk2_ardour/io_selector.h +++ b/gtk2_ardour/io_selector.h @@ -38,6 +38,8 @@ class IOSelector : public PortMatrix std::string disassociation_verb () const; std::string channel_noun () const; + ARDOUR::Session* session() const { return _session; } + uint32_t n_io_ports () const; boost::shared_ptr const io () { return _io; } void setup_ports (int); @@ -109,6 +111,7 @@ class PortInsertUI : public Gtk::HBox bool check_latency_measurement (); void latency_button_toggled (); + void update_latency_display (); }; class PortInsertWindow : public ArdourDialog diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h index bb07b9ab25..ec808a9820 100644 --- a/libs/ardour/ardour/delivery.h +++ b/libs/ardour/ardour/delivery.h @@ -70,7 +70,7 @@ public: /* supplemental method used with MIDI */ - void flush (nframes_t nframes, nframes64_t time); + void flush_buffers (nframes_t nframes, nframes64_t time); void transport_stopped (); void no_outs_cuz_we_no_monitor(bool); diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h index 25aba5415d..2b8e618337 100644 --- a/libs/ardour/ardour/internal_return.h +++ b/libs/ardour/ardour/internal_return.h @@ -41,7 +41,7 @@ class InternalReturn : public Return void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool); bool configure_io (ChanCount in, ChanCount out); bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const; - void set_block_size (nframes_t); + int set_block_size (nframes_t); BufferSet* get_buffers(); void release_buffers(); diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h index eabe263013..0764982a93 100644 --- a/libs/ardour/ardour/internal_send.h +++ b/libs/ardour/ardour/internal_send.h @@ -43,7 +43,7 @@ class InternalSend : public Send bool feeds (boost::shared_ptr other) const; bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const; bool configure_io (ChanCount in, ChanCount out); - void set_block_size (nframes_t); + int set_block_size (nframes_t); boost::shared_ptr target_route() const { return _send_to; } const PBD::ID& target_id() const { return _send_to_id; } diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index bdad8009f5..f4da2bf0a0 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -81,7 +81,7 @@ class LadspaPlugin : public ARDOUR::Plugin _descriptor->cleanup (_handle); } - void set_block_size (nframes_t /*nframes*/) {} + int set_block_size (nframes_t /*nframes*/) { return 0; } int connect_and_run (BufferSet& bufs, ChanMapping in, ChanMapping out, diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index d42c34a546..329af1151f 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -94,7 +94,7 @@ class LV2Plugin : public ARDOUR::Plugin _instance = NULL; } - void set_block_size (nframes_t /*nframes*/) {} + int set_block_size (nframes_t /*nframes*/) { return 0; } int connect_and_run (BufferSet& bufs, ChanMapping in, ChanMapping out, diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 8731697906..328f657b57 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -110,7 +110,9 @@ class Plugin : public PBD::StatefulDestructible, public Latent virtual uint32_t nth_parameter (uint32_t which, bool& ok) const = 0; virtual void activate () = 0; virtual void deactivate () = 0; - virtual void set_block_size (nframes_t nframes) = 0; + virtual void flush () { deactivate(); activate(); } + + virtual int set_block_size (nframes_t nframes) = 0; virtual int connect_and_run (BufferSet& bufs, ChanMapping in, ChanMapping out, diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 6656f755cf..e4487eb6c0 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -57,8 +57,9 @@ class PluginInsert : public Processor void activate (); void deactivate (); + void flush (); - void set_block_size (nframes_t nframes); + int set_block_size (nframes_t nframes); ChanCount output_streams() const; ChanCount input_streams() const; diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index 097c96eb94..d30edc7162 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -69,6 +69,7 @@ class PortInsert : public IOProcessor MTDM* mtdm () const { return _mtdm; } void set_measured_latency (nframes_t); + nframes_t latency() const; private: /* disallow copy construction */ diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 7d815c4f1c..e95bd57adf 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -65,7 +65,8 @@ class Processor : public SessionObject, public Automatable, public Latent virtual void transport_stopped (sframes_t /*frame*/) {} - virtual void set_block_size (nframes_t /*nframes*/) {} + virtual int set_block_size (nframes_t /*nframes*/) { return 0; } + virtual bool requires_fixed_sized_buffers() const { return false; } /** @param result_required true if, on return from this method, bufs is required to contain valid data; * if false, the method need not bother writing to bufs if it doesn't want to. @@ -75,6 +76,7 @@ class Processor : public SessionObject, public Automatable, public Latent virtual void activate () { _pending_active = true; ActiveChanged(); } virtual void deactivate () { _pending_active = false; ActiveChanged(); } + virtual void flush() {} virtual bool configure_io (ChanCount in, ChanCount out); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 5a7a692691..4e3b025a4b 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -576,7 +576,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi /* flattening stuff */ - boost::shared_ptr write_one_track (AudioTrack&, nframes_t start, nframes_t end, + boost::shared_ptr write_one_track (AudioTrack&, framepos_t start, framepos_t end, bool overwrite, std::vector >&, InterThreadInfo& wot, bool enable_processing = true); int freeze_all (InterThreadInfo&); diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 07417baa81..a06c3667f5 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -64,7 +64,7 @@ class VSTPlugin : public ARDOUR::Plugin uint32_t nth_parameter (uint32_t port, bool& ok) const; void activate (); void deactivate (); - void set_block_size (nframes_t nframes); + int set_block_size (nframes_t nframes); int connect_and_run (BufferSet&, ChanMapping in, ChanMapping out, diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 301b3e3ce2..12f0254ec2 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -266,6 +266,10 @@ AudioEngine::stop (bool forever) } } + if (forever) { + stop_metering_thread (); + } + return _running ? -1 : 0; } diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index c783b47b9b..0ccbaf3154 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -339,27 +339,42 @@ bool AudioFileSource::safe_audio_file_extension(const ustring& file) { const char* suffixes[] = { - ".wav", ".WAV", - ".aiff", ".AIFF", - ".caf", ".CAF", ".aif", ".AIF", + ".aifc", ".AIFC", + ".aiff", ".AIFF", ".amb", ".AMB", - ".snd", ".SND", ".au", ".AU", - ".raw", ".RAW", - ".sf", ".SF", + ".caf", ".CAF", ".cdr", ".CDR", + ".flac", ".FLAC", + ".htk", ".HTK", + ".iff", ".IFF", + ".mat", ".MAT", + ".oga", ".OGA", + ".ogg", ".OGG", + ".paf", ".PAF", + ".pvf", ".PVF", + ".sf", ".SF", ".smp", ".SMP", + ".snd", ".SND", ".maud", ".MAUD", + ".voc", ".VOC" ".vwe", ".VWE", - ".paf", ".PAF", - ".voc", ".VOC", - ".ogg", ".OGG", - ".flac", ".FLAC", + ".w64", ".W64", + ".wav", ".WAV", #ifdef HAVE_COREAUDIO - ".mp3", ".MP3", ".aac", ".AAC", + ".adts", ".ADTS", + ".ac3", ".AC3", + ".amr", ".AMR", + ".mpa", ".MPA", + ".mpeg", ".MPEG", + ".mp1", ".MP1", + ".mp2", ".MP2", + ".mp3", ".MP3", ".mp4", ".MP4", + ".m4a", ".M4A", + ".sd2", ".SD2", // libsndfile supports sd2 also, but the resource fork is required to open. #endif // HAVE_COREAUDIO }; diff --git a/libs/ardour/caimportable.cc b/libs/ardour/caimportable.cc index f5a70a5f6a..71927c95e5 100644 --- a/libs/ardour/caimportable.cc +++ b/libs/ardour/caimportable.cc @@ -24,7 +24,9 @@ CAImportableSource::CAImportableSource (const string& path) af.SetClientFormat (client_format); } catch (CAXException& cax) { - error << string_compose ("CAImportable: %1", cax.mOperation) << endmsg; + //Don't report an error here since there is one higher up in import. + //Since libsndfile gets tried second, any failures here may show as + //invalid errors in the Error log. throw failed_constructor (); } diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index e6c93e5297..d5c982c0cc 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -441,7 +441,7 @@ Delivery::transport_stopped (sframes_t frame) } void -Delivery::flush (nframes_t nframes, nframes64_t time) +Delivery::flush_buffers (nframes_t nframes, nframes64_t time) { /* io_lock, not taken: function must be called from Session::process() calltree */ diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc index 280568131f..e1f39b79a3 100644 --- a/libs/ardour/internal_return.cc +++ b/libs/ardour/internal_return.cc @@ -62,10 +62,11 @@ InternalReturn::configure_io (ChanCount in, ChanCount out) return true; } -void +int InternalReturn::set_block_size (nframes_t nframes) { allocate_buffers (nframes); + return 0; } void diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc index 3662171740..a1425e3059 100644 --- a/libs/ardour/internal_send.cc +++ b/libs/ardour/internal_send.cc @@ -145,10 +145,11 @@ InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, _active = _pending_active; } -void +int InternalSend::set_block_size (nframes_t nframes) { mixbufs.ensure_buffers (_configured_input, nframes); + return 0; } bool diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index 39daaacdea..c93993aef8 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -909,6 +909,8 @@ MidiModel::resolve_overlaps_unlocked (const NotePtr note, void* arg) TimeType note_time = note->time(); TimeType note_length = note->length(); + DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 checking overlaps for note %2 @ %3\n", this, (int)note->note(), note->time())); + for (Pitches::const_iterator i = p.lower_bound (search_note); i != p.end() && (*i)->note() == note->note(); ++i) { @@ -916,6 +918,7 @@ MidiModel::resolve_overlaps_unlocked (const NotePtr note, void* arg) TimeType eb = (*i)->end_time(); OverlapType overlap = OverlapNone; + if ((sb > sa) && (eb <= ea)) { overlap = OverlapInternal; } else if ((eb >= sa) && (eb <= ea)) { @@ -929,7 +932,11 @@ MidiModel::resolve_overlaps_unlocked (const NotePtr note, void* arg) continue; } + DEBUG_TRACE (DEBUG::Sequence, string_compose ("\toverlap is %1 for (%2,%3) vs (%4,%5)\n", enum_2_string(overlap), + sa, ea, sb, eb)); + if (insert_merge_policy() == InsertMergeReject) { + DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 just reject\n", this)); return -1; } diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index 780243f18b..25418ec968 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -375,7 +375,7 @@ MidiTrack::roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame } - _main_outs->flush (nframes, end_frame - start_frame - 1); + _main_outs->flush_buffers (nframes, end_frame - start_frame - 1); return 0; } diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index d1f09dd0a8..73655b24b1 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -221,12 +221,16 @@ PluginInsert::parameter_changed (Evoral::Parameter which, float val) } } -void +int PluginInsert::set_block_size (nframes_t nframes) { + int ret = 0; for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { - (*i)->set_block_size (nframes); + if ((*i)->set_block_size (nframes) != 0) { + ret = -1; + } } + return ret; } void @@ -249,6 +253,14 @@ PluginInsert::deactivate () } } +void +PluginInsert::flush () +{ + for (vector >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { + (*i)->flush (); + } +} + void PluginInsert::connect_and_run (BufferSet& bufs, nframes_t nframes, nframes_t offset, bool with_auto, nframes_t now) { @@ -436,7 +448,7 @@ PluginInsert::automation_run (BufferSet& bufs, nframes_t nframes) return; } - if (!find_next_event (now, end, next_event)) { + if (!find_next_event (now, end, next_event) || requires_fixed_sized_buffers()) { /* no events have a time within the relevant range */ diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc index 7a484e2e67..087d2577ad 100644 --- a/libs/ardour/port_insert.cc +++ b/libs/ardour/port_insert.cc @@ -83,6 +83,23 @@ PortInsert::set_measured_latency (nframes_t n) _measured_latency = n; } +nframes_t +PortInsert::latency() const +{ + /* because we deliver and collect within the same cycle, + all I/O is necessarily delayed by at least frames_per_cycle(). + + if the return port for insert has its own latency, we + need to take that into account too. + */ + + if (_measured_latency == 0) { + return _session.engine().frames_per_cycle() + _input->latency(); + } else { + return _measured_latency; + } +} + void PortInsert::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool) { @@ -149,6 +166,10 @@ PortInsert::state (bool full) node.add_property ("type", "port"); snprintf (buf, sizeof (buf), "%" PRIu32, bitslot); node.add_property ("bitslot", buf); + snprintf (buf, sizeof (buf), "%u", _measured_latency); + node.add_property("latency", buf); + snprintf (buf, sizeof (buf), "%u", _session.get_block_size()); + node.add_property("block_size", buf); return node; } @@ -183,6 +204,18 @@ PortInsert::set_state (const XMLNode& node, int version) return -1; } + uint32_t blocksize = 0; + if ((prop = node.property ("block_size")) != 0) { + sscanf (prop->value().c_str(), "%u", &blocksize); + } + + //if the jack period is the same as when the value was saved, we can recall our latency.. + if ( (_session.get_block_size() == blocksize) && (prop = node.property ("latency")) != 0) { + uint32_t latency = 0; + sscanf (prop->value().c_str(), "%u", &latency); + _measured_latency = latency; + } + if ((prop = node.property ("bitslot")) == 0) { bitslot = _session.next_insert_id(); } else { diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 51ceead688..0f9e7ba241 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2635,6 +2635,7 @@ Route::handle_transport_stopped (bool /*abort_ignored*/, bool did_locate, bool c if (Config->get_plugins_stop_with_transport() && can_flush_processors) { (*i)->deactivate (); (*i)->activate (); + (*i)->flush (); } (*i)->transport_stopped (now); @@ -2827,8 +2828,7 @@ Route::flush_processors () Glib::RWLock::ReaderLock lm (_processor_lock); for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - (*i)->deactivate (); - (*i)->activate (); + (*i)->flush (); } } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 2989e14afa..ea4ae4c12c 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -3532,7 +3532,7 @@ Session::freeze_all (InterThreadInfo& itt) } boost::shared_ptr -Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end, +Session::write_one_track (AudioTrack& track, framepos_t start, framepos_t end, bool /*overwrite*/, vector >& srcs, InterThreadInfo& itt, bool enable_processing) { @@ -3542,13 +3542,14 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end, uint32_t x; char buf[PATH_MAX+1]; ChanCount nchans(track.n_channels()); - nframes_t position; - nframes_t this_chunk; - nframes_t to_do; + framepos_t position; + framecnt_t this_chunk; + framepos_t to_do; BufferSet buffers; SessionDirectory sdir(get_best_session_directory_for_new_source ()); const string sound_dir = sdir.sound_path().to_string(); - nframes_t len = end - start; + framepos_t len = end - start; + bool need_block_size_reset = false; string ext; if (end <= start) { @@ -3557,7 +3558,7 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end, return result; } - const nframes_t chunk_size = (256 * 1024)/4; + const framecnt_t chunk_size = (256 * 1024)/4; // block all process callback handling @@ -3604,6 +3605,11 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end, srcs.push_back (fsource); } + /* tell redirects that care that we are about to use a much larger blocksize */ + + need_block_size_reset = true; + track.set_block_size (chunk_size); + /* XXX need to flush all redirects */ position = start; @@ -3694,6 +3700,11 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end, } } + + if (need_block_size_reset) { + track.set_block_size (get_block_size()); + } + unblock_processing (); return result; diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 0e1248db49..2e7290b77a 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -328,7 +328,7 @@ Track::no_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, passthru (start_frame, end_frame, nframes, false); } - _main_outs->flush (nframes, end_frame - start_frame - 1); + _main_outs->flush_buffers (nframes, end_frame - start_frame - 1); return 0; } diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index e3953314b6..b978c7993a 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -107,12 +107,13 @@ VSTPlugin::~VSTPlugin () fst_close (_fst); } -void +int VSTPlugin::set_block_size (nframes_t nframes) { deactivate (); _plugin->dispatcher (_plugin, effSetBlockSize, 0, nframes, NULL, 0.0f); activate (); + return 0; } float diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp index 81f72dd7ff..96e9211217 100644 --- a/libs/evoral/src/Sequence.cpp +++ b/libs/evoral/src/Sequence.cpp @@ -599,6 +599,7 @@ Sequence