Commit Graph

902 Commits

Author SHA1 Message Date
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
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
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
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
Paul Davis
4137271188 int62_t: use explicit memory order for all loads and stores
Also, improve implementation of CAS loops for operator <X>=.

Ideally, we ought to test this on ARM, both before and after.
2023-03-24 14:19:15 -06:00
Paul Davis
fe17b98079 use explicit memory order for rcu reader/write exclusion 2023-03-24 14:19:15 -06:00
Paul Davis
a486fba3e9 std::atomic - 2nd batch of changes to convert from glib to std::atomic 2023-03-24 14:19:15 -06:00
Paul Davis
4ba4cd69ff switch from glib atomic to std::atomic (libs edition) 2023-03-24 14:19:15 -06:00
Paul Davis
945c19b8b4 libpbd: make RCU more C++-ish 2023-03-24 14:19:15 -06:00
Paul Davis
b35518e212 switch from boost::{shared,weak}_ptr to std::{shared,weak}_ptr
This is mostly a simple lexical search+replace but the absence of operator< for
std::weak_ptr<T> leads to some complications, particularly with Evoral::Sequence
and ExportPortChannel.
2023-03-24 14:19:15 -06:00
Paul Davis
39ed528e25 std-ize: convert all boost shared/weak ptr includes to <memory>
Also fix stdint.h -> cstdint and alphabetically order std includes
2023-03-24 14:19:15 -06:00
Ayan Shafqat
bf8fced073 Add CPU detection 2023-02-04 23:07:17 +01:00
John Emmas
2ff05d9e9d class 'PBD::Configuration' now needs to be exportable 2023-01-28 17:44:11 +00:00
Paul Davis
68f4c7ce8e add upcase() method; remove upcase version of internationalize() 2023-01-27 15:13:27 -07:00
Paul Davis
3c1c6e7b68 continued work on use of Metadata in various Configuration objects (libs edition) 2023-01-27 15:13:27 -07:00
Paul Davis
f7387a5d77 infrastructure for PBD::Configuration to deliver metadata 2023-01-27 15:13:27 -07:00
Paul Davis
d982507085 move match_search_strings() function from plugin utils to PBD 2023-01-22 17:41:43 -07:00
Robin Gareus
117cfc844b Fix 128 bit integer math rounding (#9057)
The previous code only used the 1st multiplicand was use to
determine the direction of rounding, breaking commutative property

`muldiv_round (1, 3, 4) != muldiv_round (3, 1, 4)`
2023-01-12 16:08:53 +01:00
Robin Gareus
4f3b8a9776 Allow to override default stack limit for background processes 2022-11-13 03:01:57 +01:00
David Robillard
bdacfb8724 Fix invalid use of Doxygen "@param" command
This is never for inline references to parameters, only for starting parameter
documentation blocks.  The "@p" command is for this, although unfortunately
Doxygen doesn't actually do anything with it and it's just an alias for code
text.
2022-10-30 20:44:28 -04:00
Mads Kiilerich
004b32b91e Update tracker/reference URLs to prefer HTTPs 2022-10-24 04:59:20 +02:00
Robin Gareus
14da117bc8 Add explicit round/floor integer multiply/divide
This fixes various rounding issues. Notably superclock to sample
conversion must always round down when playing forward.

`::process (start, end, speed = 1)` uses exclusive end.
Processing begins at `start` and end ends just before `end`.
Next cycle will begin with the current end.

One example where this failed:
 - New session at 48kHz
 - Change tempo to 130 BPM
 - Enable snap to 1/8 note
 - Snap playhead to 1|3|0
 - Enable Metronome
 - Play

`assert (superclock_to_samples ((*i).sclock(), sample_rate()) < end);`

end = 177231 samples == superclock 1042118280
A grid point is found at superclock 1042116920 (that is < 1042118280).
However converting it back to samples rounded it to sample 177231 == end,
while actual location is 1360 super-clock ticks before end.

The metronome click has to be started this cycle, since the same
position will not be found at the beginning of the next cycle, with
start = 177232.

Similarly a samplecnt_t t, converted to music-time and back must not be
later than the given sample.

```
timepos_t tsc (t);
assert (timepos_t::from_ticks (tsc.ticks ()).samples () <= t);
```

IOW. When playing forward, all super-clock time between 1|1|0 and 1|1|1
should round down to 1|1|0. "We have not yet reached the first tick".
2022-10-22 02:10:05 +02:00
Robin Gareus
5016c950d0 Move ControllableSet up in PBD's namespace
This is in preparation to supersede AutomationControlSet
with a lower level generic std::set usable in any relevant
context.
2022-10-18 00:08:21 +02:00
Robin Gareus
ebf59d4426 Insert_or_assign properties, allow to override properties
This allows to copy a property list and then selectively
replace various properties. e.g.

```
PropertyList plist (region->properties ());
plist.add (Properties::length, len);
plist.remove (Properties::start);
```

See also 8b0ab38675
and 97f0fac7d5
This also fixes the issue referenced in
8c83149c4c
2022-10-07 00:32:14 +02:00
Paul Davis
be24b51a6b downloader: remove unnecessary header 2022-09-13 14:15:24 -06:00
Paul Davis
d087cd9465 downloader: use PBD::Thread instead of std::thread 2022-09-13 14:14:53 -06:00
Paul Davis
375daf4810 libpbd: new threader Inflater and Downlaoder classes 2022-09-13 13:53:45 -06:00
Paul Davis
2061c3780d FileArchive: minor fixes to get progress reporting working 2022-09-13 13:53:45 -06:00
Paul Davis
73331ae46a libpbd: fix decl of remove_extra_whitespaces 2022-09-07 17:56:52 -06:00
Paul Davis
5563117a1b add remove_extra_whitespace() to libpbd 2022-09-07 17:03:08 -06:00
Paul Davis
26b5700957 filearchive: extend API 2022-09-07 17:03:08 -06:00
Robin Gareus
2a7d528c5d Update and consolidate gettext.h
This fixes compilation with --no-nls on modern systems
2022-09-07 00:09:54 +02:00
Robin Gareus
effc209070 Place Pool in PBD namespace
A public class named "Pool" in the global namespace just
calls for symbol name conflicts.
2022-07-07 05:21:54 +02:00
Robin Gareus
8418e7c954 NO-OP: clang-format 2022-07-07 05:21:49 +02:00
Robin Gareus
1694c71cd5 Implement memory-pool debug-dump
This will allow to trace "POOL OUT OF MEMORY" and see
which events fill up the event/memory pool.
2022-07-07 05:21:31 +02:00