Commit Graph

1614 Commits

Author SHA1 Message Date
Robin Gareus b2f0d31630
Cont'd work on concurrent Signal, Connection destruction
see also 992c727959
and 7580d6aba7

Spin to prevent race between d'tor setting `in_dtor`
and acquiring Signal::_mutex.
2021-11-21 04:12:24 +01:00
Robin Gareus 992c727959
Cont'd work on concurrent Signal, Connection destruction
See also 7580d6aba7
2021-11-21 03:27:50 +01:00
Robin Gareus 7580d6aba7
Fix race condition when ~Signal and ~ScopedConnection run concurrently
Previously a deadlock was possible:

Thread 1:
  ~ScopedConnection ()
  -> Connection::disconnect ()
     takes Connection::_mutex             <<<< 1
  -> _signal->disconnect (shared_from_this ())
  -> Signal::disconnect ()
     takes Signal::_mutex                 <<<< 2

Thread 2:
 ~Signal ()
     takes Signal::_mutex                 <<<< 2
  -> Connection::signal_going_away ()
     takes Connection::_mutex             <<<< 1
2021-11-20 23:14:59 +01:00
Paul Davis 9e763c2672 remove all dangling event-loop-precall code 2021-10-11 17:48:53 -06:00
Robin Gareus a2a36de98f
Fix minor memory leak when querying Windows registry 2021-10-11 18:20:07 +02:00
Robin Gareus ba2a2cb654
Implement natural-sort spaceship operator 2021-10-08 04:12:32 +02:00
Paul Davis 64db1367bb Change name of Stateful::apply_changes (PropertyBase) to the singular form.
Makes it slightly easier to read+parse what is happening. Yes, for a
Sequence property, the call could apply several changes, but overwhelmingly
it is used to apply a single change.
2021-09-25 16:49:51 -06:00
Paul Davis 2ed1bdd243 Remove PropertyTemplate::call() and replace with code that uses ::set()
This makes undo/redo work correctly.
2021-09-25 16:49:51 -06:00
Robin Gareus 5a1201f05b
Fix duplicate libs 2021-09-19 23:39:51 +02:00
Robin Gareus cb81b06a5d
Revert "Fix div/zero, allow switching backends"
This reverts commit 1288262ca7.
2021-09-15 17:52:53 +02:00
Robin Gareus 1288262ca7
Fix div/zero, allow switching backends
When switching backends, the effective sample-rate is zero.
This only affects the butler thread (the only active thread when
stopped). The actual issue here is the butler calling
"non-realtime-stop" without a backend. However fixing 0/0
generally seems appropriate.
```
#0 in int_div_round<long>(long, long) (x=0, y=0) at ../libs/pbd/pbd/integer_division.h:36
#1 in Temporal::samples_to_superclock(int64_t, int) (samples=0, sr=0) at ../libs/temporal/temporal/superclock.h:39
#2 in Temporal::timepos_t::timepos_t(long) (this=0x7f94bc0a5890, s=0) at ../libs/temporal/temporal/timeline.h:55
#3 in ARDOUR::Automatable::non_realtime_locate(long) (this=0x55a12a980cc8, now=0) at ../libs/ardour/automatable.cc:421
#4 in ARDOUR::Route::non_realtime_locate(long) (this=0x55a12a980ae0, pos=0) at ../libs/ardour/route.cc:5462
#5 in ARDOUR::Session::non_realtime_stop(bool, int, bool&) (this=0x55a12e0cd000, abort=false, on_entry=1, finished=@0x7f94bc0a5e0f: true) at ../libs/ardour/session_transport.cc:1487
#6 in ARDOUR::Session::butler_transport_work(bool) (this=0x55a12e0cd000, have_process_lock=false) at ../libs/ardour/session_transport.cc:1153
#7 in ARDOUR::Butler::thread_work() (this=0x55a12f3b7000) at ../libs/ardour/butler.cc:222
#8 in ARDOUR::Butler::_thread_work(void*) (arg=0x55a12f3b7000) at ../libs/ardour/butler.cc:16
```
2021-09-11 04:54:40 +02:00
Paul Davis e057088195 remove unused, empty glib event source/callback code (was from an experiment during nutempo2 development) 2021-09-04 07:39:27 -06:00
John Emmas dda7612479 A few visibility changes needed for linking to libpbd (when building with MSVC) 2021-09-04 12:35:44 +01:00
Robin Gareus b4b4745bd4
Amend 55211b8d (PRNG seed, use local address) 2021-08-16 04:59:10 +02:00
Robin Gareus baf5a13f17
Update atomic/volatile compat
With glib 2.64, volatile gint produce annoying Wcast-qual
compiler warnings with mingw/gcc-8.

Even though the the build succeeds, and only glib 2.68+
requires non-volatile atomics this results in a much
cleaner build-log.
2021-08-16 04:26:55 +02:00
Robin Gareus a3b28b4114
Move PCG RNG implementation out of header, update API 2021-08-15 16:03:01 +02:00
Robin Gareus 79baf356b9
Add realtime safe random number generator 2021-08-14 01:03:37 +02:00
Paul Davis b42727b92a temporal: fix use of std::abs on 64 bit value 2021-08-13 12:51:34 -06:00
Paul Davis 25ecc54208 possible minor optimizations of atomic loads in int62_t class 2021-08-13 12:51:34 -06:00
Paul Davis b96a2b1757 libpbd: provide a way to abort an RCU-based write_copy()->update() sequence 2021-08-13 12:51:32 -06:00
Paul Davis 170541deb7 libpbd: fix implementation of int62_t::operator== and ::operator!=
Reversed logic error
2021-08-13 12:51:31 -06:00
Paul Davis bed76798f3 manual fixups after rebase against master (general libs edition) 2021-08-13 12:51:31 -06:00
Paul Davis 4f6befea83 fix in62_t equality/inequality operators when used with mismatched arguments 2021-08-13 12:51:30 -06:00
Paul Davis b7d22508fa Add blib event callback to BaseUI, with a virtual method to be overridden by derived classes. 2021-08-13 12:51:30 -06:00
Paul Davis 179f2b2624 change value of int62_t::max to avoid flag bit being set 2021-08-13 12:51:30 -06:00
Paul Davis 8dbbc1df54 library changes to get libtemporal setup at application startup 2021-08-13 12:51:30 -06:00
Paul Davis 27c98adda9 alter API for MementoCommandBinder to allow future flexibility 2021-08-13 12:51:30 -06:00
Paul Davis 09c84d1de8 add new GSource-derived object that can be attached to a Glib::MainContext to execute code before other sources have their dispatch() method invoked 2021-08-13 12:51:29 -06:00
Paul Davis b2a4fe1b50 likely temporary change to visibility inside PBD::int62.h 2021-08-13 12:51:29 -06:00
Paul Davis 111f10638d gcc 6.x requires <typeinfo> for typeid, it seems 2021-08-13 12:51:29 -06:00
Paul Davis 0534d1fbb2 more improvements for int62_h based on rgareus' review 2021-08-13 12:51:28 -06:00
Paul Davis b7b4c99bc9 Temporal: add new arithmetic operators allowing more inter-operability of int64_t/int62_t; make operator int64_t explicit to avoid hidden use 2021-08-13 12:51:28 -06:00
Paul Davis 788cd5456e add additional methods allowing direct arithmetic operator expressions to be used with PBD::Property 2021-08-13 12:51:28 -06:00
Paul Davis 709df7a08f add operators for self-typed arithmetic 2021-08-13 12:51:28 -06:00
Paul Davis cb78984c63 add new int62.h header, which implements a generic 62bit-int-plus-flagbit type 2021-08-13 12:51:28 -06:00
Paul Davis c043156089 new header with an efficient implementation of integer division-rounding-to-nearest 2021-08-13 12:51:28 -06:00
Robin Gareus 8a41931ff4
Print note when stacktrace is too short 2021-07-23 01:43:18 +02:00
Robin Gareus c5e5659022
Fix crash when demangled symbol is n/a
std::string foo (NULL) can throw a std::__throw_logic_error
which was not caught.
2021-07-19 18:26:22 +02:00
John Emmas 12e1c960b6 Add an extra dependency lib which was previously only needed for Debug builds 2021-07-15 09:30:08 +01:00
Robin Gareus c92dfed706
Fix windows builds (stacktrace pthread debug) 2021-07-14 16:04:07 +02:00
Robin Gareus 46251c2068
Fix Windows debug builds 2021-07-14 15:07:26 +02:00
Robin Gareus 4651ec8382
Unconditionally enable stacktrace for windows builds
This also fixes an issue introduced 7d39205350
(duplicate variable name "levels".
2021-07-13 13:47:26 +02:00
Robin Gareus 7d39205350
Allow to skip top stacktrace frames
This is useful to hide the call of `PBD::stacktrace` itself.
2021-07-12 04:01:07 +02:00
Robin Gareus a74b4e8ef0
No more wine 2021-07-03 19:07:25 +02:00
Robin Gareus bf43c8d2d4
Set thread names 2021-06-30 17:15:27 +02:00
Paul Davis 775f46315f remove debugging output from timing.h 2021-06-29 17:46:03 -06:00
Paul Davis a36ab0c562 avoid timing stats calculation with <= values from get_microseconds() 2021-06-29 11:13:59 -06:00
Paul Davis a9f285b82b debugging timing stats by showing how max values are computed 2021-06-29 09:46:46 -06:00
Paul Davis 24ea6c4d30 make it possible to debug one of the RAII TimingStats objects 2021-06-29 09:25:38 -06:00
Paul Davis b20a541d7e change PBD::microseconds_t to a signed type and check for -1 in TimingStats::update
This may help a Windows issue with the return value of QueryPerformanceCounter
2021-06-28 14:47:48 -06:00
John Emmas 09589c3c94 Add/remove source(s) in our MSVC project (libpbd) 2021-06-28 10:37:54 +01:00
Paul Davis 4fd639eca9 NOOP: remove incomplete comment 2021-06-27 12:48:29 -06:00
Paul Davis a261d399e0 microsoft docs say that only windows.h is required for QueryPerformance* 2021-06-27 12:17:51 -06:00
Paul Davis e2f2d0cb0f fix inadvertent typo that would cause compilation failure on windows 2021-06-27 10:53:31 -06:00
Paul Davis 857a9b14d7 more macOS cleanup for microseconds.cc 2021-06-27 10:39:51 -06:00
Paul Davis 347ca5c2fe clean up locally-created mess in libs/pbd/microseconds.cc 2021-06-27 10:28:53 -06:00
Paul Davis 412b6a922d macOS: slight speed up for ::get_microseconds()
Move timebase initialization into microsecond_timer_init() and drop conditional
2021-06-27 10:23:44 -06:00
Paul Davis db0691d236 macOS: fix compilation warnings on macOS versions where clock_gettime() is finally implemented 2021-06-27 08:24:59 -06:00
Robin Gareus 738b0ad21b
Fix OSX builds (amend 04df26244, a2b5962b6) 2021-06-27 05:09:07 +02:00
Paul Davis b904fdea5d switch PBD::Timing* to use PBD::get_microseconds() 2021-06-26 20:15:12 -06:00
Paul Davis 2678366555 window compilation fix 2021-06-26 18:53:28 -06:00
Paul Davis 228231d914 window compilation fix 2021-06-26 18:47:08 -06:00
Paul Davis 5c8df87205 window compilation fix 2021-06-26 18:43:17 -06:00
Paul Davis 5289d44821 window compilation fix 2021-06-26 18:40:44 -06:00
Paul Davis d1967827ca compilation error fix for windows 2021-06-26 18:35:14 -06:00
Paul Davis b9a85c7dcd compilation error fix for windows 2021-06-26 18:34:46 -06:00
Paul Davis 4c1dcb70bb compilation error fix for windows 2021-06-26 18:33:27 -06:00
Paul Davis a2b5962b6c add new files for PBD::get_microseconds() 2021-06-26 18:30:11 -06:00
Paul Davis 9e598548f7 put get_microseconds() into PBD namsepace
This implementation is a blend of the two previously in libs/ardour/globals.cc
and libs/pbd/window_timer_utils.cc
2021-06-26 18:25:02 -06:00
Paul Davis 995137aeb3 add PBD::WaitTimerRAII with reverse semantics from PBD::TimerRAII 2021-06-26 11:24:59 -06:00
Robin Gareus 1e5ccd4acc
Use poll timeout workaround on macOS only
Other systems implement proper poll according
to POSIX and return when the pipe is closed.
2021-06-21 03:48:04 +02:00
Robin Gareus f4166fb61d Fix endless poll on macOS #8753
Harvid daemonizes and does not write anything
to stdout/err. as opposed to select(), poll() on
macOS does not return when the child process
terminates or is killed.

However poll() on an invalid FD does throw an
error and POLLNVAL is set.
2021-06-21 01:58:40 +02:00
Robin Gareus 95f8a3aace
Explicitly prevent unsigned int wrap-around
This is a NOOP (0 - 1) + 2 == (0 + 2) - 1 but avoids
a unsigned int wrap-wrap around for good measure.
2021-06-14 00:43:08 +02:00
Paul Davis a89ad7a265 add queue-reset method to PBD::TimingStats 2021-06-13 10:28:51 -06:00
Paul Davis 7980ea4d27 add a method to SerializedRCUManager to release the lock when no update is required 2021-06-13 07:58:45 -06:00
Paul Davis 182801b8d7 complete manual reversion of 7bce9899c0 2021-06-11 20:56:33 -06:00
Paul Davis 1b505ddcb1 Revert "modify PBD::TimingStats to discard the first 1000 recorded values to avoid too much influence from chaotic startup conditions"
This reverts commit 7bce9899c0.

1000 at 8192 samples @ 44.1 is > 3 mins; counter may have overflowed. Not a necessary change.
2021-06-11 18:55:25 -06:00
Paul Davis 462352102c add a new update() method to PBD::TimingStats to allow use of an already-computed interval 2021-06-11 18:55:24 -06:00
Paul Davis ef72afb963 add PBD::TimerRAII class for easy management of TimingStats in scope contexts with multiple return points 2021-06-11 13:09:52 -06:00
Paul Davis 7bce9899c0 modify PBD::TimingStats to discard the first 1000 recorded values to avoid too much influence from chaotic startup conditions 2021-06-11 13:09:52 -06:00
Robin Gareus 7ce43739e8
Tweak sched priorities use given and 4 levels below. 2021-06-10 14:38:45 +02:00
Robin Gareus 6e82f3669f
Correctly set ctrl-surface thread priority 2021-06-10 03:17:55 +02:00
Robin Gareus 89a0040f1b
Allow to override rt priority for internal backends 2021-06-10 03:17:53 +02:00
Robin Gareus 0e570d15ae
Amend 3a7ea6b, do not kill child after 10 sec w/o output
This fixes video-timeline issues (harvid has no output), as well
as ALSA device reservation and xjadeo (when idle).
2021-06-08 23:23:31 +02:00
Robin Gareus bed992d55f
Minimize false sharing of MPMC queue variables 2021-06-07 23:40:29 +02:00
Robin Gareus 5cec55da2e
Micro-optimization: std::atomic<> vs glib
glib atomic operations include a complete act as a full
compiler and (where appropriate) hardware memory barrier.

std::atomic<> allows dedicated acquire and release barrier
semantics which are not available with glib.
2021-06-07 20:44:29 +02:00
Robin Gareus 1eb6b82b9f
Prevent L1 cache line evicion in MPMC queue
This reduces cache coherence overhead of the queue
2021-06-07 16:05:42 +02:00
Todd Naugle 1a1e67f595 Use Posix style return values for sem wait when on windows.
0 on success, -1 on error
2021-05-27 15:17:15 -05:00
Todd Naugle be6d0fa95c Do not use named semaphores on Windows since they are system wide
https://docs.microsoft.com/en-us/dotnet/standard/threading/semaphore-and-semaphoreslim#named-semaphores

Running multiple instances of Ardour or Ardour/Mixbus would fail in very
odd ways since they would signal each other. Unnamed sems are
correct for this use case.
2021-05-27 15:13:40 -05:00
Robin Gareus 28619fe71b
Fix window process thread priorities
While POSIX defines a single contiguous range of numbers that
determine a thread's priority. Win32 defines priority classes
and priority levels relative to these classes.

pthread maps those to -15 .. +15 with the top six ones
corresponding to REALTIME_PRIORITY_CLASS and max being
THREAD_PRIORITY_TIME_CRITICAL

Note that the PA backend can USE_MMCSS_THREAD_PRIORITIES
and PBD::MMCSS::set_thread_characteristics() directly for
the I/O threads.
2021-05-14 01:59:20 +02:00
John Emmas 952416c596 Accommodate some changes to 'ssize_t' in VS2019
In more recent versions of MSVC, ssize_t equates to 'long' (for a 32-bit build) or '__int64' (for 64-bit)
2021-05-11 14:06:25 +01:00
Robin Gareus 98f5224d4c
Fix incorrect port lists due to custom sort
Previously the following were treated as equal
 "MIDI_foo" == "MIDI bar"
So std::map<> PortManager::_ports and PortEngineSharedImpl:_ports
could only have either. This resulted in missing ports
and missing calls to existing ports in cycle_start().

This mainly affected MIDI tracks with imported files, since there
is "MIDI Clock in", and imported files result in tracks
"MIDI_file-name".

This issue was introduced in 6.6-200-g60ff3ef764
2021-05-07 04:24:32 +02:00
Paul Davis ade679f162 move <poll.h> inside an appropriate #ifdef, since it does not exist on Windows 2021-05-06 14:45:56 -06:00
Paul Davis 3a7ea6b217 use poll(2) rather than select(2) for reading output from an exec'ed process
select(2) can only handle file descriptors up to 1024, and there are fairly easy to reproduce
cases where the file descriptor used here is larger than that.
2021-05-06 14:41:28 -06:00
Robin Gareus fc54ab48ec
Remove unused function, fix optimized builds 2021-05-06 15:27:26 +02:00
John Emmas a222292e68 Emulate exp2f() for older MS compilers where it wasn't available 2021-05-05 17:50:41 +01:00
Robin Gareus 5957e14259
Remove unused #include<> (2/2)
PBD::stacktrace() is not used nor needed by default.
It should be used sparingly.
2021-05-05 17:57:16 +02:00
Robin Gareus 438b1e5eab
Cont'd work to improve macOS rt priority 2021-05-02 20:24:10 +02:00
Robin Gareus 53e710bc5f
macOS: apply time scaling for rt constraints 2021-05-01 02:49:06 +02:00
Robin Gareus 58557e88c9
Do not move automation when inserting regions
RegionInsertDrag or Consolidate Range or any other operation
calling Playlist::add_region() previously triggered RangesMoved()
which resulted in DiskReader::move_processor_automation()

NB. insert + ripple still moves automation correctly.
2021-04-29 23:26:24 +02:00
Robin Gareus b23f260d21
Move glib include out of PBD namespace
strictly speaking the include is not needed here since
g_atomic_compat.h includes glib.h. However it is idempotent,
the file does use glib methods, and g_atomic_compat.h may
one day be removed again.
2021-04-16 17:43:31 +02:00
Robin Gareus a1d53c1d2e
Fix linking unit-tests with lld
ld.lld: error: libs/pbd/libpbd.so: undefined reference to dlopen [--no-allow-shlib-undefined]
2021-04-13 23:29:02 +02:00
Robin Gareus 8f5c3fcddb
Fix non-layered record-undo
Previously an empty RegionList was used (auto-partition
changes were never collected at rec-stop), furthermore
auto-partitioned regions do not have an old ARDOUR::AutomationList
(fade in/out) property (_have_old is false).
2021-04-12 23:14:13 +02:00
Robin Gareus bc1d19ab39
Increase process-thread stack size (same value as jack2) 2021-04-09 22:00:11 +02:00
Robin Gareus ea01ec5988
Correctly detect glib volatile atomic
see also https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1919
2021-03-30 15:29:53 +02:00
Robin Gareus 60ff3ef764
Work around ffado port-name idiosyncrasies 2021-03-26 17:18:23 +01:00
Robin Gareus cc7b8b1bc5
gcc-11 compat, volatile atomic variables (1/2)
"While 'atomic' has a volatile qualifier, this is a historical
artifact and the pointer passed to it should not be volatile."

Furthermore "It is very important that all accesses to a
particular integer or pointer be performed using only this API"
(from https://developer.gnome.org/glib/2.68/glib-Atomic-Operations.html)

Hence initialization of atomic variables is changed to also use
this API, instead of directly initializing the value.

This also fixes a few cases where atomic variables were
accessed directly.

see also libs/pbd/pbd/g_atomic_compat.h
2021-03-22 15:30:07 +01:00
Robin Gareus d08b9eaa8d
Fix debug message: missing newline 2021-03-21 22:31:40 +01:00
John Emmas 15f12bd3a9 A few minor changes to keep VS2019 happy 2021-02-09 10:52:37 +00:00
Robin Gareus 7e74f9eb1e
Keep track of recently touched Controllable 2021-02-09 02:11:04 +01:00
John Emmas b496a71d2e Some preliminary changes needed to support building with VS2019
(these get me about as far as 'libardour' )
2021-01-30 13:55:25 +00:00
John Emmas ef7a5e1b00 For 64-bit compilation, MSVC no longer supports inline assembly 2021-01-07 09:22:43 +00:00
Ayan Shafqat 407882d23d
Add support for Intel/AMD's FMA extension
By supporting FMA extension, the number of instruction needed
for multiply accumulate to mix channels are reduced. Since,
this extension has been around since middle of 2012, more
computers have this instruction set available.
2021-01-01 21:05:16 +01:00
Robin Gareus 1db219b3d8
Fix compilation with mingw/gcc-8 2020-12-10 20:21:29 +01:00
Robin Gareus 13e6fdb6b3
Ensure ringbuffers are never copy-constructed 2020-12-07 02:54:51 +01:00
Robin Gareus a974a3135e
Prevent duplicate search paths
This fixes an issue with VST3 plugins being listed up multiple times
if a user also explicitly adds standard built-in search paths.
2020-12-02 21:34:52 +01:00
David Robillard 0404876d7b Fix reliance on deprecated implicit assignment operators
Either both, or neither, a copy constructor and assignment operator should be
defined.  This fixes Wdeprecated-copy warnings.
2020-12-01 12:03:38 +01:00
Robin Gareus ff7bd23661
NO-OP: comments 2020-11-10 19:31:25 +01:00
Robin Gareus 512b47c878
micro-optimization (skip atomic test) 2020-11-10 19:31:09 +01:00
Robin Gareus 01cdaa49b4
Fix gcc-4.x/C++98 builds (amend f87de76b9f)
This resolves error: invalid use of 'unary *' on pointer to member
error: 'volatile gint RCUManager<std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::shared_ptr<ARDOUR::Port>, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::shared_ptr<ARDOUR::Port> > > > >::active_reads' is protected
2020-11-10 18:41:27 +01:00
Robin Gareus b1846a578d
NO-OP: whitespace, doxygen formatting and naming 2020-11-10 17:05:22 +01:00
Hector Martin f87de76b9f
RCU: Fix race condition between writer/reader
This uses an atomic counter and spins only on the writer side, which
preserves realtime behavior on the reader side. The spinning yields (by
using the same Boost function from Boost spinlocks) to be
scheduler-friendly.

Fixing this bug also lets us be able to confidently drop garbage early
in the writer if appropriate, so do that and avoid keeping dead wood if
possible.

This reverts commit f95439a502275e656c17ea5d6d39f71e6ff57056:
"add spinlock to RCU manager to protect concurrent reader() and update() calls"
2020-11-10 17:05:16 +01:00
John Emmas 5f082e2c9d Add an extra option when querying Windows registry keys
(this option will be needed when 32-bit Ardour is running in 64-bit Windows)
2020-11-09 11:35:35 +00:00
Paul Davis f95439a502 add spinlock to RCU manager to protect concurrent reader() and update() calls 2020-11-08 11:28:10 -07:00
Robin Gareus 01f9332458
Fix RCU Unit-test on macOS/X
Apple's pthread does not implement barriers
2020-11-07 10:37:52 +01:00
Robin Gareus 88fc0ed392
Add RCU unit test 2020-11-05 02:24:54 +01:00
Robin Gareus cf0904f752
Handle vfork/exec failure
Don't call atexit, exit without cleanup.
2020-10-31 22:33:10 +01:00
Robin Gareus a9bd7b2848
Remove unused compile-time option to not use vfork 2020-10-31 22:30:45 +01:00
Robin Gareus 7896c30508
Fix cmdline parameter escape 2020-10-31 13:42:14 +01:00
Robin Gareus f509a7e003
Extend convenience API to query windows registry 2020-10-30 13:15:06 +01:00
Robin Gareus 54829492ca
Fix glib/glibmm includes 2020-10-24 04:14:38 +02:00
Robin Gareus 8852069ead
Consolidate code: add library method to query Windows registry 2020-10-24 03:56:47 +02:00
Robin Gareus 1fa05b4764
Generate header before building dependency graph 2020-10-16 02:35:51 +02:00
Robin Gareus fe8a05d6c9
libpbd signals.h depends on signals_generated.h
This fixes building with large concurrency where signals_generated.h
may otherwise be generated to late.
2020-10-15 05:45:51 +02:00
Robin Gareus 547032afac
Fix alignment unit-tests and ARM/NEON alignment 2020-10-15 03:55:42 +02:00
Robin Gareus e4e94e77c9
Transmitter::Debug implementation 1/2
This also sorts switch() and listen_to() statements in order
of severity: debug, info, warning, error, fatal, throw.
2020-10-13 21:58:26 +02:00
Robin Gareus 9a4237ba83
Add debug transmitter
This is in preparation to conveniently duplicate debug messages
to Window > Log. For cases where stdout/err is not easily accessible.
2020-10-13 21:27:16 +02:00
Robin Gareus 140e03bb7d
Make windows-console setup code re-usable 2020-09-20 19:57:08 +02:00
mx 262281bc1f
Use soundtouch for vocal audio time stretching (1/2) 2020-08-26 19:04:58 +02:00
Robin Gareus 34159e4594
Fix ARM runtime NEON detection 2020-08-24 22:03:28 +02:00
Robin Gareus a0a4477c84
Fix aarch64 builds 2020-08-24 21:26:38 +02:00
Ayan Shafqat 1f878636c8
Adding NEON detection during runtime 2020-08-24 02:06:35 +02:00
Emilio Norrmann d21337a3a4
fixed typo 2020-08-19 19:02:37 +02:00
Robin Gareus d3685784aa
Fix numeric sort: use decimal or hex (but not octal)
This fixes sort order of plugin-presets or parameter
scale-points with leading zeros.
2020-08-09 14:45:39 +02:00
Robin Gareus c2618903ae
Allow to overload drop_references()
This is useful in cases where an object owns child objects
which in turn hold a reference to the parent.

In this case PluginInsert has-a Plugin, which may have a reference
to the insert or the Route.
2020-08-05 22:35:35 +02:00
Ben Loftis a2f4521e77 Short-circuit gain interpolation if the change is negligibly small 2020-07-21 18:37:32 -05:00
Robin Gareus fa495b7727
Account for additional TLS on macOS/X
On GLIBC systems pbd_stack_size() adds __pthread_get_minstack,
this is no available on mac systems, causing issues with some
libraries used by plugins.
2020-07-21 23:10:01 +02:00
Robin Gareus 6d950d15ba
Use signed int for atomic operations -- #8314 2020-07-16 16:13:21 +02:00
John Emmas 8cea355906 Moving Controllable::set_interface() into a 'cc' file makes it easier to fix our MSVC build issue (with min + max) 2020-06-20 09:38:00 +01:00
Paul Davis 71f088dbbd move virtual method requiring std::min from header into .cc
The method is virtual so it could never have been inlined anyway
2020-06-18 16:26:44 -06:00
Paul Davis 0d8fac079d The presence of "using std::***" in any header file is not acceptable. Do not revert or change this.
Revert "Partially revert commit #23feb0491e"

This reverts commit 3b5546cfce.
2020-06-18 16:19:18 -06:00
John Emmas 3b5546cfce Partially revert commit #23feb0491e
For MSVC, the 'using std::' statements are needed when building anything which #includes 'pbd/controllable.h' (never quite figured out why...)
2020-06-18 12:46:05 +01:00
Robin Gareus 23feb0491e
Remove using std::min/max from header 2020-06-18 01:05:48 +02:00
Robin Gareus c424e4d61c
Allow to set group-override with common set_interface() API 2020-06-18 00:42:09 +02:00
Matthias von Faber e3dcd1f5d7
Only try using __pthread_get_minstack on glibc
This is a glibc-only extension, so don't bother on other platforms.
Also, according to POSIX, PTHREAD_STACK_MIN is defined in limits.h, so
include climits just to be safe.
2020-06-09 17:39:24 +02:00
Robin Gareus c7bce4b685
NO-OP: whitespace 2020-06-07 18:25:18 +02:00
Robin Gareus 21b8885fe9
Remove debug output (also fix some builds, missing stdio.h) 2020-06-07 18:18:58 +02:00
Robin Gareus 27e45c585f
Fix another stupid typo 2020-06-06 23:03:21 +02:00
Robin Gareus e0548fa798
Offset stack-size by current TLS #8200
Some libraries use thread locals and hence increase the min
requirement.

This is seen on void-linux for example:

> linking a minimal program against cairo gives a
> __static_tls_size of 43008 bytes.
> Doing the same on Ubuntu focal and Debian bullseye,
> __static_tls_size is only 4608.
2020-06-06 19:04:26 +02:00
Robin Gareus 515ffbdfe2
Add API to create threads with given stacksize 2020-06-06 18:32:09 +02:00
Paul Davis a660077c97 PlaybackBuffer: extend API to include write_ptr()
It's just useful
2020-05-13 23:55:02 -06:00
Paul Davis 98d56d6b21 Add API to PlaybackBuffer to compute amount of data that can overwritten
The distance is between a given offset in the buffer (probably a
read position at some point in time) and the write ptr. Any data after
the write ptr is "old" and not readable, and thus not worth overwriting
since we would not read it anyway.
2020-05-12 11:34:37 -06:00
Robin Gareus dbcbfd7b5b
Fix builds, missing include 2020-04-24 01:53:59 +02:00
Robin Gareus afad873a22
Fix parsing XML with blanks from memory
This is needed when the butler thread loads a plugin with
MIDNAM. xmlKeepBlanksDefault() setting is per thread.

see also df3a4ed9c6
2020-04-23 02:28:48 +02:00
Robin Gareus 705ac7bfc5
Prevent huge stack allocations for MIDNAM files
xmlParseMemory() uses a c-pointer char*.
Previously MIDNAM data on the heap were wrapped inside
a std::string only to be later accessed via c_str().
2020-04-23 02:25:38 +02:00
Robin Gareus 3d166c7789
Consolidate stack-size and priority of rt-threads 2020-04-23 01:28:58 +02:00
Robin Gareus ea2bda6668
Fix playback alignment when adding/removing channels
The disk-reader assumes that all playback ringbuffers are in sync
and have the same fill_level.
2020-04-14 03:57:26 +02:00
Paul Davis feff57d29a prefer initialization to assignment 2020-04-08 19:56:08 -06:00
Johannes Mueller c74cc2675e Extend FileArchive to import archive entries individually
This is needed primarily for a workaround for #7971. When importing a template
that has been exported on Ardour5 on MacOS we need to fix the paths of the
archive entries.

Later we can use this functionality also to handle imported templates if
templates with the same name already exist.

This commit only adds methods and members to FileArchive, it does not modify
anything to make regressions unlikely. This, however, leads to some duplicated
code. Eventually we should consolidate this a bit.
2020-04-05 16:34:48 +02:00
Robin Gareus c365c6cdb2
Set thread-names (libs) 2020-03-29 14:56:22 +02:00
Robin Gareus d6a38d5450
Set public thread name
This allows to identify Ardour thread using standard unix
tools (ps, htop) and inspect priorities, CPU load etc.
2020-03-29 13:55:20 +02:00
John Emmas 4dd3d4effe Some initial changes (currently for libpbd only) to help a new contributer who's trying to build with MSVC2017
These changes compile okay for me (using VS2019) although they wouldn't link to my older-built libraries. Hopefully he'll be okay if he builds everything with the same compiler.
2020-03-26 10:40:36 +00:00
Paul Davis 3d6eaf8e69 remove old, undocumented mechanism to set PBD::DEBUG flags from environment variable
An app-level mechanism now exists in main(), via ARDOUR_DEBUG_FLAGS, and will do the same thing
2020-03-25 10:36:10 -06:00
Paul Davis 3e962da4bb improve debug flag setting message 2020-03-25 10:30:40 -06:00
Robin Gareus 28f15d3fa6
Add flag to explicitly hide a control
Eventually this is to replace a literal name "hidden" that is
currently used as hack throughout Ardour's codebase.
2020-03-18 18:16:29 +01:00
Robin Gareus 26b6b8d840
mingw/gcc-8: use glib's stat(), drop hardlink support 2020-03-13 01:21:51 +01:00
Paul Davis 96daa4036a fix apparent free-ordering issue reported in #7926 2020-03-11 08:50:29 -06:00
Robin Gareus d979c9d09c
Fix win32, mingw/gcc-8.3 builds 2020-03-11 07:20:00 +01:00
Robin Gareus 2b17ded785
Add convenience ControlFlags operators
Explicit functions for operator&=~ and operator|=
2020-03-10 20:55:50 +01:00
Robin Gareus 379115a20e
Fix MacOS 10.11 (clang-8.0.0) builds
gcc, and recent clang-10 can construct new objects
using references as arguments.

However clang-8 (and MSVC?) do not:
   "error: no matching function for call to 'operator new'"

The compiler apparently does not expand the template
  class A  <-> `A*`  vs. `A const&`
for different cases.
2020-03-09 18:33:11 +01:00
Robin Gareus 50556db405
Add a STL Allocator using the stack (for rt safety)
This is a dumb stack allocator using LIFO allocation/free, with
a fallback to new/delete. This works well for small STL containers
in particular std::vector, but it's also suitable for std::map<>,
in particular copy constructing small POD maps (plugin pin mappings).

Eventually this could be combined with TLSF for a flexible
memory arena management. This is however not currently needed
for any the planned use-cases.

This code is ANSI C++98 compatible, and yet also works with
modern C++11, C++14
2020-03-06 19:13:44 +01:00
John Emmas a4449aa0f6 Fix 'samples / frames' typo in PBD::stacktrace() 2020-02-29 14:38:58 +00:00
Robin Gareus 016eaddad7
NO-OP: whitespace, re-indent 2020-02-28 06:08:26 +01:00
Robin Gareus 4b28e4ee3c
Fix some recursive undo removal
~StatefulDiffCommand() may trigger UndoTransaction::command_death()
which may delete the StatefulDiffCommand() that's just being destroyed.

This depends on the signal-connection order, which is undefined.
In any case when a shared_ptr<> object is being destroyed it means
that all references to it are already gone. There's no need to
emit drop_references from the d'tor.
2020-02-28 06:06:44 +01:00
Robin Gareus 73c5bdd3cb
Fix double free of undo commands (amend 9e6435ff14)
This fixes a case when deleting a plugin, deletes all automation
undo/redo events:
  <UndoTransaction name="add automation event">
    <MementoCommand type-name="ARDOUR::AutomationList">
   ...


`delete this;` calls the d'tor which emits drop_references(),
that leads to UndoTransaction::command_death() destroying the
object, whichh causes a double free.
2020-02-28 02:09:58 +01:00
Robin Gareus 9e6435ff14
Fix mem-leak, Playlist/Region SessionHandleRef
When a playlist is deleted and drops_references(), any
undo/redo StatefulDiffCommand referncing playlist invoke
Destructible::drop_references() of the Command.

This leads to command_death(). As opposed to UndoTransaction::clear()
the StatefulDiffCommand was not destroyed.

In case of playlists StatefulDiffCommand::_changes contains
PBD::SequenceProperty<std::list<boost::shared_ptr<Region> > >
and shared pointer reference of the playlist regions were kept
indefinitely.

This fixes the following scenario:
New session, import an file, delete the created track,
clean up unused sources (delete unused playlists)[, quit].

A reference to the imported region was kept, because of the
playlist's undo command (insert region). Yet the source file
was deleted.


PS. Most playlist changes are accompanied by GUI zoom/selection
MementoCommands. Those are currently never directly dropped.
command_death() leaves those in place.
2020-02-25 21:45:07 +01:00
Robin Gareus aa3f7f2414
Remove undo function from global namespace 2020-02-25 20:09:47 +01:00
Robin Gareus 7532571fb2
NO-OP: whitespace 2020-02-25 17:55:51 +01:00
Robin Gareus 4f8777e968
Tweak mach thread priority debug msg 2020-02-24 05:29:56 +01:00
Robin Gareus e737a9b000 Fix setting CoreAudio RT-priority 2020-02-24 04:38:49 +01:00
Robin Gareus 587fc50059
Fix Inline-control visibility state
This fixes an issue when copy/pasting plugins or aux-sends from
one track to another. After copying the processor, the state
is copied, however the Controllable state did save
the InlineControl flag, so this as lost.

(amend 93180ceea)
2020-02-20 23:06:55 +01:00
Ben Loftis 4f5076a81a controllable::{get_set}_interface() are convenience wrappers for funcs that need the Rotary flag set 2020-02-20 12:25:51 -06:00
Paul Davis ca3714bccf NOOP: fix brace/newline use 2020-02-20 00:09:32 -07:00
Paul Davis d1b335b36e expose PlaybackBuffer::reservation and make the member const 2020-02-19 23:10:13 -07:00
Paul Davis 58123c969b remove unused method 2020-02-19 23:09:51 -07:00
Robin Gareus f62fb6dd98
Remove unused dummy control class
PBD::IgnorableControllable() is no longer used.
It also was problematic, because in every case where a
Controllable is required, min/max range and usually also
get/set value are significant.
2020-02-19 17:03:46 +01:00
John Emmas 40cca52bbb Changes needed for building with MSVC
Mostly these are to do with TLSF which I hadn't in fact been building!! Hopefully there won't be any problems for the gcc builds.
2020-02-07 11:27:22 +00:00
Robin Gareus 5c789547cb
Fix building unit-tests 2020-01-27 17:43:37 +01:00
David Runge 2e9ac80e99
Towards waf python 2+3 support 2020-01-25 04:07:37 +01:00
Robin Gareus bca825e515
NO-OP: whitespace 2020-01-14 00:52:24 +01:00