Commit Graph

1612 Commits

Author SHA1 Message Date
Robin Gareus 5b9e4fff63
Parallelize Disk I/O and RegionFx processing 2024-04-30 03:46:39 +02:00
Robin Gareus 44610c7877
Fix RCU race condition (see source for details) 2024-04-12 00:26:51 +02:00
Robin Gareus 2fe22eeab5
Fix header include, potential fix for #9649 2024-02-29 03:09:00 +01:00
Robin Gareus a8c26dbfa4
Fix localtime_r check (#9554) 2023-11-28 17:05:03 +01:00
Nils Philippsen e995daa375 Fix failure to build with libxml2 version 2.12
This declared some xmlError pointers const, which probably was always
assumed, but not made explicit.

Signed-off-by: Nils Philippsen <nils@tiptoe.de>
2023-11-25 00:30:04 +01:00
Mads Kiilerich 88cecdfaef wscript: drop repeated autowaf.set_options - it is enough to set at top level 2023-10-15 10:47:16 -06:00
Mads Kiilerich 1c686f4d63 wscript: drop additional configure statements already present in the top level wscript
Missed in 8bb91099c5.
2023-10-15 10:47:16 -06:00
John Emmas ea8742b030 #include <sys/utime.h> when building with MSVC 2023-09-27 09:36:26 +01:00
Robin Gareus 6494214622
Add option to prefer file timestamps with recursive copy 2023-09-27 02:22:22 +02:00
Mads Kiilerich c5e7e5c4df pbd: clarify int62_t comments 2023-09-20 12:51:52 -06:00
Mads Kiilerich f1bb18ae53 wscript: drop unused path_prefix
It is not referenced anywhere, and also not set consistently.
2023-09-17 07:34:55 -06:00
Mads Kiilerich d220f477ed wscript: drop unused "mandatory variables" 'top' and 'out' in libs
Variables by these names are only used from the local wscript and when
running "waf configure", which already for other reasons only can run at
the top-level.

These variables are thus not mandatory and not used.
2023-09-17 07:34:55 -06:00
Mads Kiilerich a0916ef368 wscript: drop unused APPNAME assignment in libs
https://waf.io/book/ says
  By default, the project name and version are set to noname and 1.0. To
  change them, it is necessary to provide two additional variables in
  the top-level project file

- and waf code inspection confirms that waf itself only will use the top
level APPNAME.

Also, the 'waf dist' comment doesn't seem relevant - especially after
this change - and is removed too.

(Note: libs/evoral/wscript and libs/temporal/wscript still use APPNAME
for other purposes.)
2023-09-17 07:34:55 -06:00
Mads Kiilerich 3b4cf9191c wscript: drop unused VERSION assignment in libs
https://waf.io/book/ says
  By default, the project name and version are set to noname and 1.0. To
  change them, it is necessary to provide two additional variables in the
  top-level project file

- and waf code inspection confirms that waf itself only will use the top
  level VERSION.

Some wscripts will use
  bld.env['VERSION']
but that will also just use the value set in the top wscript.
2023-09-17 07:34:55 -06:00
Mads Kiilerich 7737c17d52 wscript: drop unused imports, scripted
Done with ad hoc scripting hacks processing unused imports found by pyflakes:

for f in $( find * -name wscript ); do echo; pyflakes $f; done | grep 'waflib.Logs.* but unused' | cut -d: -f1 | while read f; do sed -i 's/^import waflib.Logs as Logs,/import/g' $f; done
for f in $( find * -name wscript ); do echo; pyflakes $f; done | grep 'waflib.Options.* but unused' | cut -d: -f1 | while read f; do sed -i 's/import waflib.Options as Options, /import /g' $f; done
for f in $( find * -name wscript ); do echo; pyflakes $f; done | grep 'waflib.Options.* but unused' | cut -d: -f1 | while read f; do sed -i 's/^from waflib import Options,/from waflib import/g' $f; done
for f in $( find * -name wscript ); do echo; pyflakes $f; done | grep ' imported but unused$' | sed "s/^\([^:]*\):[0-9]*:[0-9]* '\(.*\)'.*/\1 \2/g" | while read f lib; do sed -i "/^import $lib$/d" $f; done
for f in $( find * -name wscript ); do echo; pyflakes $f; done | grep 'waflib.Options.* but unused' | cut -d: -f1 | while read f; do sed -i '/from waflib import Options$/d' $f; done
for f in $( find * -name wscript ); do echo; pyflakes $f; done | grep 'waflib.TaskGen.* but unused' | cut -d: -f1 | while read f; do sed -i '/from waflib import TaskGen$/d' $f; done
for f in $( find * -name wscript ); do echo; pyflakes $f; done | grep 'waflib.Task.Task.* but unused' | cut -d: -f1 | while read f; do sed -i '/^from waflib.Task import Task$/d' $f; done
for f in $( find * -name wscript ); do echo; pyflakes $f; done | grep 'waflib.Tools.winres.* but unused' | cut -d: -f1 | while read f; do sed -i '/^from waflib.Tools import winres$/d' $f; done
for f in $( find * -name wscript ); do echo; pyflakes $f; done | grep 'waflib.Utils.* but unused' | cut -d: -f1 | while read f; do sed -i '/^import waflib.Utils as Utils$/d' $f; done
2023-09-17 07:34:55 -06:00
Paul Davis 4969fb9e0b libpbd: tweak for printing pthread ID (windows is int/*nix is ptr) 2023-08-31 10:34:48 -06:00
Paul Davis bc7f25e52c libpbd: AbstractUI must call & destroy sigc::trackable callbacks in its destructor
AbstractUI IS-A BaseUI IS-A EventLoop
                       IS-A sigc::trackable

If we have sent a call_slot() request to an EventLoop that has not executed
when the object involved in the call_slot() functor is destroyed, we need to
ensure that the request is invalidated.

To do this, We register "notify" callbacks with the sigc::trackable that is a
base class of the object involved in the functor given to
call_slot(). sigc::trackable will call these "notify" callbacks from its
destructor.

So when the call_slot() functor's relevant object dies, and its sigc::trackable
base class is destroyed, it will invoke all of its the "notify" callbacks, which will
in turn call EventLoop::invalidate_request() and this hopefully marks all the
queued call_slot() functors as "do not call".

However, invalidate_request() requires a lock, and access to the lock is
granted via a pure virtual, EventLoop::slot_invalidation_lock(). In the
heirarchy cited above, this is implemented by AbstractUI.

When we destroy an AbstractUI, ~AbstractUI() is called first, and this destroys
the lock and changes the VTT so that ::slot_invalidation_lock() becomes a pure
virtual again.

Eventually we will call ~trackable() which in turns runs all the "notify"
callbacks, and then removes them. But when these callbacks end up in
EventLoop::invalidate_request(), we try to call ::slot_invalidation_lock() and
C++ will abort because of its (now) pure virtual status.

Therefore, we must invoke the "notify" callbacks before the
::slot_invalidation_lock() becomes pure, and that means inside ~AbstractUI, as
an explicit call to trackable::notify_callbacks().

This has not appeared before (remarkably), but became an issue when the
Launchpad Pro support code's main object (derived from MIDISurface and hence
from AbstractUI) "failed" to use sub-objects for its various methods. So when
it connects to, for example, the Session::RouteAddedOrRemoved signal, it is
connecting itself (derived from a sigc::trackable). When the Launchpad Pro
object is destroyed, it tries to invalidate all the call_slot() requests, but
this requires access to an event loop lock - owned by the Launchpad Pro event
loop, which is already destroyed!

Other surfaces have generally avoided this by using other objects to provide
methods of dealing with signals from libardour objects.
2023-08-30 16:06:14 -06:00
Paul Davis d5ad9ff033 libpbd/guis: move __invalidator() into PBD::EventLoop
we allow use of/dependency on sigc::trackable there, so this is
both legal but also sensible.

Leave the macro definition of invalidator(x) in gtkmm2ext/gui_thread.h
because it doesn't hurt and makes some sense for it to be there. No
reason for a source module that needs invalidator(x) to load EventLoop
decl.
2023-08-30 16:06:14 -06:00
Paul Davis f65e0b85a8 libpbd: add operator<< for PropertyChange 2023-08-30 16:06:13 -06:00
Paul Davis 7130deafdf fix AbstractUI redefine of DEBUG_TRACE to still use PBD::debug_print-ish stuff 2023-08-30 16:06:13 -06:00
Paul Davis 37f859197b use PBD::DEBUG::Threads as a toggle to show thread ID/name with debug output 2023-08-30 16:06:13 -06:00
Paul Davis a59c217205 extend PBD::Debug API to provide a method that doesn't send to debug Transmitter 2023-08-30 16:06:13 -06:00
Paul Davis 076cb86912 next iteration of changes to handle time domain bounces as undoable 2023-08-14 23:42:08 -06:00
Paul Davis 0223be5312 pbd: fairly unconscionable that Undo stuff in libpbd is not namespaced, so now it is 2023-08-07 16:33:16 -06:00
Paul Davis afe5331a0b pbd: fairly unconscionable that Command in libpbd is not namespaced, so now it is 2023-08-07 16:33:16 -06:00
Robin Gareus 2d5ac04ae1
pthread_setname_np is available with GNU/mingw 2023-06-17 23:49:47 +02:00
Robin Gareus c9929698ee
Implement FileArchive progress/cancel
* Use PBD::Progress API
* Allow to cancel extraction and compression
* Fix querying download size
2023-05-19 03:08:22 +02:00
Robin Gareus 65f2be76f6
Move Ardour::Progress to PBD::Progress
This will allow PBD::Filearchive to properly report progress.
It is also a generally useful API and deserves to be in libpbd.

Temporarily keep Ardour::Progress as alias
2023-05-19 00:35:20 +02:00
Robin Gareus 4b77ecbe83
Sanitize XML values to be valid UTF-8 (#9317)
This prevents any non UTF-8 strings to leak into
Ardour XML files, which can make the session unloadable.
2023-04-26 17:43:52 +02:00
Robin Gareus df298c6046
Add API to sanitize UTF-8 strings 2023-04-26 17:25:24 +02:00
John Emmas 40738b2bee A couple of extra requirements for DEBUG_THREAD_PRINT 2023-04-24 14:51:04 +01:00
John Emmas 81d7a51498 Minor change to commit #35b5861195 2023-04-24 12:40:36 +01:00
Paul Davis 35b5861195 try to avoid output pthread_t as-is, due to MSVC etc. 2023-04-23 11:26:00 -06:00
Paul Davis 8cc16f2b81 convert std::cerr output to DEBUG_TRACE 2023-04-22 14:38:44 -06:00
Paul Davis 2aee4765e9 don't try to print pthread_self() 2023-04-21 15:38:40 -06:00
Paul Davis f718279949 surfaces & event loops: i really mean no more request buffer factories 2023-04-21 13:55:58 -06:00
Paul Davis b0586763ba libpbd: changes to pre-registration of signal emitting threads
There is no need to preallocate request buffers for these threads - the event
loops that require them can allocate them when they discover and register the
pre-registered threads. This also means that event loops do not need to
register request buffer factories.
2023-04-21 13:43:46 -06:00
Paul Davis 7ad0deff10 abstractui: don't register self as a sending thread
if thread A emits a signal that is handled by thread A, no request buffers are
involved.
2023-04-21 12:16:37 -06:00
Paul Davis 4a2c27ed6d abstractui: provide a message if an event loop wakes but finds no work
(this only occurs for debug builds)
2023-04-21 12:16:37 -06:00
Paul Davis 6e65e9c82f abstractUI: pseudo-no-op: debug trace message expansion, and some reformatting 2023-04-21 12:16:37 -06:00
Paul Davis 5d023b4c60 libpbd: fix an important thinko for cross-thread signal architecture
The old code assumed that the thread that created a request buffer for a given
signal-emitting thread would be the latter thread, and thus a thread-local
pointer to the request buffer could be used. This turns out not to be true: the
GUI thread tends to be responsible for constructing the request buffers for
pre-registered threads.

That mechanism has been replaced by using a RWLock protected map using
pthread_t as the key and the request buffer as the value. This allows any
thread to create and register the request buffers used between any other pair
of threads (because the lookup always uses a pthread_t).

The symptoms of this problem were a signal emitted in an audioengine thread
that was propagated to the target thread, but when the target thread scans its
request buffers for requests, it finds nothing (because it didn't know about
the request buffer). In a sense, the signal was successfully delivered to the
target thread, but no meaningful work (i.e the signal handler) is performed.
2023-04-21 12:16:37 -06:00
Paul Davis 074516cdb4 libpbd: provide access from a ScopedConnection to the underlying UnscopedConnection 2023-04-21 12:16:37 -06:00
Paul Davis 5dc75694f0 libpbd: fix return type of Signal<>::size() 2023-04-21 12:16:37 -06:00
Nil Geisweiller 57a5f96a98
NO-OP: use Tab to indent 2023-04-21 01:00:41 +02:00
Robin Gareus 295dbd8e1e
Make RCU reader return a const pointer (omnibus commit) 2023-04-08 00:15:37 +02:00
Robin Gareus 0b8d5d3dc5
Tweak Window system-exec, wait for process to terminate 2023-04-05 00:16:37 +02:00
Robin Gareus 473f575a05
Catch Glib::ConvertError when checking for files
This fixes some edge-cases when scanning recent sessions
in get_state_files_in_directory() and likely some other
places that use run_functor_for_paths in case the folder
contains files with non UTF-8 names.
2023-04-03 22:10:11 +02:00
Robin Gareus 3715154a8e
Allow concurrent child processes
When multiple child processes are running, closing the
stdin of one child did not send EOF or cause POLLNVAL,
as long as a dup()'ed filedes still existed.

This fixes an issue when running an mp3 encoder while the
video monitor is visible, and will allow to concurrently
run multiple mp3 encoders or other child processes.

Previously this caused Ardour to hang indefinitely in CmdPipeWriter
```
 _proc->close_stdin();
 _proc->wait(); // << here
```
2023-03-25 06:43:46 +01:00
Robin Gareus 8075b55919 Fix amiguity in atomic load
operator _Tp() const volatile _NOEXCEPT {return load();}
operator _Tp() const _NOEXCEPT  {return load();}
2023-03-25 00:07:56 +01:00
Paul Davis 45490bf43f more functional tempo mapping 2023-03-24 14:19:16 -06:00