Commit Graph

34974 Commits

Author SHA1 Message Date
Robin Gareus 9cac17ea7d
Speed up silence-stripping when there are many silent chunks
Previously every region fragment was added one at a time,
with each emitting signals and updating the GUI. If there are a
few thousand regions Ardour can freeze for a significant amount
of time.

There is still the issue that the GUI freezes after the progress-bar
reached the end: consolidate overlapping ranges after analysis, then
add regions.

And Playlist::flush_notifications still emits
RegionFactory::CheckNewRegion() for every region individually
and RegionListBase::add_region becomes the bottleneck.

But at least adding 7k regions now returns in under 5 minutes
instead of taking over an hour.
2022-03-08 16:31:47 +01:00
Robin Gareus 4965c83ef3
Do not allow to remove the triggerbox processor 2022-03-07 23:32:02 +01:00
Robin Gareus c29471373b
Expose show-grid-rulers ui preference 2022-03-07 05:55:29 +01:00
Robin Gareus 2cffca4c40
Restore rulers as saved with the session
This fixes an issue with the videotimeline not being shown
when reloading a session. Editor::set_state() restores the grid,
which in turn changes ruler visibility. This triggers
store_ruler_visibility() and the saved session state was lost.
2022-03-07 05:55:26 +01:00
Robin Gareus fbce2d73a8
Retain sidechain ports into unknown processors
This fixes an issue when loading sessions in "safe mode".
Internal side-chain sends are removed if the target port
does not exist. Also other port connections are lost if the
target port does not exist.
2022-03-06 17:13:56 +01:00
Robin Gareus e51e2c57c6
NO-OP: remove dead code 2022-03-06 17:13:35 +01:00
Paul Davis 81531d5763 triggerbox: improve some commented debug output 2022-03-05 11:49:55 -07:00
Paul Davis 5525c8b667 triggerbox: fix crash when using audio sample esstimated to be less than 1 beat 2022-03-05 11:48:52 -07:00
Robin Gareus ecb1d33c02
Remove Region::position remnants (see cc6c0f1263) 2022-03-04 22:38:41 +01:00
Robin Gareus 1462590ace
Fix setting session-range when regions move
Since cc6c0f1263 there is no Properties::position event
when a region is moved. So notify_region_moved() or
notify_region_start_trimmed() was never emitted and
Session::maybe_update_session_range() was not called.
2022-03-04 22:37:28 +01:00
Robin Gareus 6c4c827575
Fix snap, PH to prev/next grid 2022-03-04 20:47:44 +01:00
Robin Gareus 2c769e9f23
Fix Beats::rount_to.. Bar rounding 2022-03-04 19:41:25 +01:00
Robin Gareus ab3a7dc721
Fix bbt_subtract math
When r.ticks is already negative, add the negative value
(not subtract), likewise handle negative beat offset correctly.
2022-03-04 19:40:30 +01:00
Robin Gareus 080bfdc2d0
Simplify grid next/prev logic
Round[Up/Down]Always does not need an offset to avoid snapping
to the same position.
2022-03-04 19:39:02 +01:00
Robin Gareus 9dabe047f1
NO-OP: clean up and consolidate PH next/prev grid code 2022-03-04 18:29:43 +01:00
Robin Gareus 90770a2788
Consolidate get_grid_beat/music_divisions
This fixes "snap to bar" which previously snapped to beats
2022-03-04 17:51:21 +01:00
Robin Gareus bc1be2fc24
Fix stem export alignment
When a track's output is not connected, but the track feeds
other tracks via sends (common case in Mixbus) the stem
export of the track was not correctly aligned.

The track is correctly latency compensated (due to sends), but
the unconnected port's latency is not set.
However stem-export uses the private latency of the port as alignment.
2022-03-04 01:40:29 +01:00
Ben Loftis 2323b08502 triggerbox: better handling for the special case of tempo=0
* audio files can be named "0bpm" to make them un-stretchable
* however they still need a sensible beatcnt, and therefore tempo
* assume tempo 120bpm and assign a beatcnt based on the file's length
* the user might later enable stretch, and we need to be sensible about it
2022-03-03 16:49:28 -06:00
Ben Loftis 618226d2bb triggerbox: avoid ridiculously small tempo settings for stretch
*this should not be possible after , but just in case....
2022-03-03 16:49:28 -06:00
Ben Loftis 58f2c074a6 triggerbox: fix another case where UIState must be cached to retain settings 2022-03-03 16:49:28 -06:00
Ben Loftis 7cc3fbaccf editor_ops: bounce to trigger: warn user when they try to bounce a range to an already-populated trigger slot 2022-03-03 16:49:28 -06:00
Robin Gareus e33d131174
Fix deadlock when creating VCAs
VCAManager::create_vca sets PI::order while holding the
VCAManager:lock mutex. PI order changes emit a "changed" signal
which in turn can result in querying a list of all strips
(reassign_track_numbers) which requires the VCA mutex:

See also 729ff35faf

```
#2  Glib::Threads::Mutex::Lock::Lock(Glib::Threads::Mutex&) (this=0x7fffffffb070, mutex=...) at /usr/include/glibmm-2.4/glibmm/threads.h:687
#3  ARDOUR::VCAManager::vcas[abi:cxx11]() const (this=0x5555599b6d10) at ../libs/ardour/vca_manager.cc:77
#4  ARDOUR::Session::get_stripables(std::__cxx11::list<boost::shared_ptr<ARDOUR::Stripable>, std::allocator<boost::shared_ptr<ARDOUR::Stripable> > >&, ARDOUR::PresentationInfo::Flag) const (this=0x55555bf03910, sl=std::__cxx11::list = {...}, fl=127) at ../libs/ardour/session.cc:3949
#5  ARDOUR::Session::ensure_stripable_sort_order() (this=0x55555bf03910) at ../libs/ardour/session.cc:2634
#6  ARDOUR::Session::notify_presentation_info_change(PBD::PropertyChange const&) (this=0x55555bf03910, what_changed=...) at ../libs/ardour/session.cc:7016
[ .. connect same thread ..]
#13 ARDOUR::PresentationInfo::send_static_change(PBD::PropertyChange const&) (what_changed=...) at ../libs/ardour/presentation_info.cc:113
#14 ARDOUR::PresentationInfo::set_order(unsigned int) (this=0x5555619ceca0, order=5) at ../libs/ardour/presentation_info.cc:288
#15 ARDOUR::Stripable::set_presentation_order(unsigned int) (this=0x5555619ce8a0, order=5) at ../libs/ardour/stripable.cc:55
#16 ARDOUR::VCAManager::create_vca(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    (this=0x5555599b6d10, howmany=1, name_template="VCA %n") at ../libs/ardour/vca_manager.cc:105
```
2022-03-03 17:43:37 +01:00
Robin Gareus 84c51a1411
Fix BaseUI x-thread signal vs thread-start race
Control surfaces c'tor usually subscribe to signals e.g.
PortConnectedOrDisconnected. This happens after the parent BaseUI
is created, but before set_active() -> BaseUI::run() is called.

At this point in time there is no run_loop thread.

There are two options to handle AbstractUI::call_slot():

 A. Queue the event in the event-loop, using the thread-local
    request buffer of the caller. Then hope the BaseUI
    thread is started, and calls ::handle_ui_requests() before
    the memory pool runs out of space.

 B. Handle the event in the calling thread. -- This may not be
    rt-safe and may call functions with locks held by the caller.
    It will however not accumulate events.

This takes approach (B). If _run_loop_thread is NULL, directly
handle the signal.

In the past, prior to 50abcc74b5, approach (A) was taken.
NULL never matched Glib::Threads::Thread::self().

This also reverts a prior attempt (e417495505) to address this issue.
2022-03-02 21:19:12 +01:00
Robin Gareus 4fb8dd805f
Don't allow dropdown scroll for patch-banks
Changing banks refills the dropdown. This cannot be avoided
since unnamed banks are not in the dropdown, and the dropdown
content can change dynamically. Scroll-wheel does not work reliably.
2022-03-02 18:26:23 +01:00
Robin Gareus bff55cc881
Fix crash when deleting MIDI trigger
The Model must be destroyed after the iterator, otherwise
the iterator's d'tor will cause memory corruption trying to lock
the model:

```
Invalid read of size 4
   at pthread_rwlock_unlock (pthread_rwlock_unlock.c:39)
   by Glib::Threads::RWLock::ReaderLock::~ReaderLock() (threads.h:828)
   by void boost::checked_delete<Glib::Threads::RWLock::ReaderLock>(Glib::Threads::RWLock::ReaderLock*) (checked_delete.hpp:36)
   by boost::detail::sp_counted_impl_p<Glib::Threads::RWLock::ReaderLock>::dispose() (sp_counted_impl.hpp:89)
   by boost::detail::sp_counted_base::release() (sp_counted_base_gcc_atomic.hpp:120)
   by boost::detail::shared_count::~shared_count() (shared_count.hpp:432)
   by boost::shared_ptr<Glib::Threads::RWLock::ReaderLock>::~shared_ptr() (shared_ptr.hpp:335)
   by Evoral::Sequence<Temporal::Beats>::const_iterator::~const_iterator() (Sequence.h:224)
   by ARDOUR::MIDITrigger::~MIDITrigger() (triggerbox.cc:2037)
   by ARDOUR::MIDITrigger::~MIDITrigger() (triggerbox.cc:2039)
   by ARDOUR::TriggerBoxThread::delete_trigger(ARDOUR::Trigger*) (triggerbox.cc:4386)
   by ARDOUR::TriggerBoxThread::thread_work() (triggerbox.cc:4314)
   by ARDOUR::TriggerBoxThread::_thread_work(void*) (triggerbox.cc:4285)
   by fake_thread_start(void*) (pthread_utils.cc:101)
   by start_thread (pthread_create.c:477)
   by clone (clone.S:95)
 Address 0x28229798 is 24 bytes inside a block of size 56 free'd
   at free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
   by Glib::Threads::RWLock::~RWLock() (in /usr/lib/x86_64-linux-gnu/libglibmm-2.4.so.1.3.0)
   by Evoral::Sequence<Temporal::Beats>::~Sequence() (Sequence.h:68)
   by ARDOUR::AutomatableSequence<Temporal::Beats>::~AutomatableSequence() (automatable_sequence.h:31)
   by ARDOUR::MidiModel::~MidiModel() (midi_model.h:58)
   by ARDOUR::MidiModel::~MidiModel() (midi_model.h:58)
   by void boost::checked_delete<ARDOUR::MidiModel>(ARDOUR::MidiModel*) (checked_delete.hpp:36)
   by boost::detail::sp_counted_impl_p<ARDOUR::MidiModel>::dispose() (sp_counted_impl.hpp:89)
   by boost::detail::sp_counted_base::release() (sp_counted_base_gcc_atomic.hpp:120)
   by boost::detail::shared_count::~shared_count() (shared_count.hpp:432)
   by boost::shared_ptr<ARDOUR::MidiModel>::~shared_ptr() (shared_ptr.hpp:335)
   by ARDOUR::MIDITrigger::~MIDITrigger() (triggerbox.cc:2037)
   by ARDOUR::MIDITrigger::~MIDITrigger() (triggerbox.cc:2039)
   by ARDOUR::TriggerBoxThread::delete_trigger(ARDOUR::Trigger*) (triggerbox.cc:4386)
   by ARDOUR::TriggerBoxThread::thread_work() (triggerbox.cc:4314)
   by ARDOUR::TriggerBoxThread::_thread_work(void*) (triggerbox.cc:4285)
   by fake_thread_start(void*) (pthread_utils.cc:101)
   by start_thread (pthread_create.c:477)
   by clone (clone.S:95)
```
2022-03-02 18:12:50 +01:00
Alexandre Prokoudine 26159ef168
Rename file extension to get Akai MPK249 map to be picked up by waf 2022-03-01 23:11:46 +01:00
Robin Gareus 57bf5be609
Fix use of uninitialized variable 2022-03-01 22:16:01 +01:00
Robin Gareus 75ec5ee87d
Terminate Peak file threads at exit 2022-03-01 18:20:40 +01:00
Robin Gareus 183f00bbed
NO-OP: cleanup and lang-format 2022-03-01 18:00:20 +01:00
Robin Gareus 370adfa322
Add option to hide cue rec/play toolbar buttons 2022-03-01 17:53:11 +01:00
Robin Gareus e417495505
Fix possible race (BaseUI creation vs x-thread signal-emission)
When a BaseUI is being created, signals can arrive before the
_run_loop_thread is running, which can trigger an assert in
BaseUI::caller_is_self().
2022-03-01 17:19:20 +01:00
Ben Loftis 638af32902 clip_picker: tweak .smf file info text 2022-03-01 10:11:14 -06:00
Ben Loftis 082339e9c0 patch_change_widget: only show tabs for the channels that a slot is using 2022-03-01 10:11:14 -06:00
Ben Loftis a1374c7a82 triggerbox: we no longer need to store Triggerbox::estimated_tempo in the snapshot file
* estimated tempo is cached in the SegmentDescriptor
* storing it in the Source's SD allows us to skip minibpm if we find a tempo there
2022-03-01 10:11:14 -06:00
Ben Loftis 2dd078aabe triggerbox: call copy_to_ui_state() after audio|midi state is recalled 2022-03-01 10:11:14 -06:00
Ben Loftis 2821ea7fc6 triggerbox: implement 'replace midi-file PGMs with the triggerbox PGMs"
* intercept {pgm|bank}-change messages, and replace them with triggerbox values
* check is_set() extensively; we have arrays of pgms but most are unused
2022-03-01 10:11:14 -06:00
Ben Loftis b62f5e2cf7 triggerbox: estimate_midi_patches tries to retain patch info across domains
* initialize patches to GM standard (drums on 10) in case file has none
* in the case where file had none, check the Auditioner to see if user set any
* in the case where a file has patches, use those instead

* also stash the UsedChannels so we can show only the used chans in the UI
2022-03-01 10:11:14 -06:00
Ben Loftis e932afaf26 triggerbox: maintain UsedChannels and Patch Change data 2022-03-01 10:11:14 -06:00
Ben Loftis ed07b26d76 auditioner: do not reset my patches when changing files
* if a file has program-changes, then it will set() my patches
* if a file does *not* have PCs, the user might choose one (which sets() it)
* if the next file does *not* have PCs, we should preserve the user's selection
* if the next file has PCs, it will set() it (losing the user selection)
2022-03-01 10:11:14 -06:00
Ben Loftis 849526b7e7 utils: re-implement used_channels_as_string to use UsedChannels (bitset) 2022-03-01 10:11:14 -06:00
Ben Loftis eced764480 smf_source: implement SMF::UsedChannels as a bitset; move midi screening into load_model()
we screen midi files for some aggregate info:
 used channels, used patches, and note-count

you can't do this from open() because there are cases (after importing)
 when the source exists but it is not yet written to disk
2022-03-01 10:11:14 -06:00
Ben Loftis b96b97c439 PatchChange: fix set_channel() 2022-03-01 10:11:14 -06:00
Ben Loftis fc3abecca0 PatchChange: yet more checks to keep patch state in sync (is_set())
* fix the case for creating an empty, unset patch
* fix is_set() for bank changes: 2nd byte is the one that gets 'set'
2022-03-01 10:11:14 -06:00
Ben Loftis 5d6dfeacf6 add DEBUG flag: miditriggers 2022-03-01 10:11:14 -06:00
Robin Gareus 566596e383
Fix Dnd from clip-picker on macOS
On macOS, `context->get_targets ()` may be empty when dragging.
In this case the Clip-Picker assumed that a slot is about to
be dropped and switched to the local clip library.

This in turn cleared selection and it was no lnger possible
to drag any clip out of the library.
2022-03-01 16:33:39 +01:00
Robin Gareus 5c701a3673
NO-OP: clang-format 2022-03-01 16:22:50 +01:00
Robin Gareus a5ae5855bb
Terminate Analysis thread at exit
This prevents a crash at exit if the analyzer is still analyzing
when Ardour terminates. A possible downside is that an ongoing
analysis will keep the application running for a bit longer.
2022-03-01 16:22:32 +01:00
Robin Gareus 1c100152cd
Fix bundling 3rd party content with windows binaries 2022-03-01 04:14:20 +01:00
Robin Gareus 07cf40c734
Fix ToggleRoll (<space>) when auditioning
When auditioning is started, transport controls are disabled
via `set_transport_sensitivity(false)`.
This prevents <space> from being handled:

DEBUG::Bindings: binding for Key 32 (space) state 0 : Transport/ToggleRoll - insensitive, skipped

So the key event is passed on, and can reach the clip-picker treeview
where <space> selects and/or activates a row, which re-starts
audition.

ARDOUR_UI::toggle_roll() cancels audition when audition is active,
so this action should be sensitive, even while auditioning.
2022-03-01 03:49:36 +01:00
Matthijs van Otterdijk 3050fe24e5 use backend_client_name parsed from options when initializing backend 2022-03-01 02:36:11 +01:00