Commit Graph

907 Commits

Author SHA1 Message Date
Ben Loftis 6c68817b26 add a user config var for preferred time domain (libardour part)
(as opposed to default_time_domain which is the per-session default)
2023-10-01 13:57:28 -05:00
Mads Kiilerich 80ffa58c81 temporal: introduce Temporal::reset() with TempoMap initialization
Ardour uses some global variables and singletons. These global variables
can be initialized with a value prior to program execution (especially
if they are const), but some of the static variables are modified, and
it is crucial that they always are reset when switching to another
session. To keep things simple and explicit and consistent, we thus
introduce Temporal::reset() to reset TempoMap (and later on also the
superclock rate). This is somewhat similar to Temporal::init(), which
usually only is invoked once (on program start) to initialize singletons
(such as the TempoMap).

9964f20c added TempoMap initialization to Session::create() ... but only
when not using a template. This create method is mainly preparing the
filesystem for a new session, and TempoMap initialization doesn't seem
like a perfect fit for it. It also seemed odd that it only initialized
TempoMap for clean new sessions, while existing sessions and templates
initialized it elsewhere.

Instead, invoke the TempoMap initialization early in the Session
creation process. This might introduce an extra and unnecessary TempoMap
initialization when loading an existing session or using a template, but
that will be cheap and do no harm, while providing a guarantee that we
always use the same default value.
2023-09-20 12:30:53 -06:00
Paul Davis c7e5f38aa5 remove debug output 2023-09-11 10:26:54 -06:00
Paul Davis 4eb58e104c remove double-macro'ed debug of undo history; use nullptr
Also, prefer early return to conditionalized function body
2023-09-11 10:26:54 -06:00
Paul Davis 511c3ef048 remove debug output 2023-09-10 18:20:35 -06:00
Paul Davis c5a0c0f6e0 remove some debug output 2023-08-16 09:33:16 -06:00
Paul Davis 076cb86912 next iteration of changes to handle time domain bounces as undoable 2023-08-14 23:42:08 -06:00
Ben Loftis 8cd69a633b
region groups: save and restore the group-id counter for this session 2023-08-10 16:55:25 +02:00
Paul Davis 1b9f4999df locations now follow session time domain, always (probably) 2023-08-02 15:23:42 -06:00
Paul Davis 1a83860016 forward propagate session default time domain changes 2023-08-02 15:22:52 -06:00
Robin Gareus b61f84e872
Print messages for each possible session-load failure 2023-07-16 16:16:59 +02:00
Robin Gareus 76ba032d3c
Fix creating session from template
bug was introduced in a36ddb72dd
2023-07-10 16:47:00 +02:00
Robin Gareus a36ddb72dd
Correctly set sample-rate of plugins when loading a different session
Directly loading a new session (Session > Recent) stops the engine
when the sample-rate mismatches. All is fine.

When closing a session (Session > Close), the engine is kept running.
Loading a different session with different sample-rate shows
the "SR mismatch" dialog. Reconfiguring the engine then does not call
`Session::immediately_post_engine` again.
2023-07-03 00:13:20 +02:00
Robin Gareus f95c9216b1
Fix playlist use-count 2/2
* Use an atomic reference count since the freeze-thread
  can call use_playlist.
* Remove explicit argument to construct unused playlist
  because playlists are unused by default. This also
  lead to use-count becoming negative (or rather UINT32_MAX)
2023-06-10 03:33:51 +02:00
Robin Gareus 193b35e885
Ignore Apple/HFS+ `._` meta-data files with statefile suffix.
Those files may otherwise show up in the Recent Session
dialog as possible states to load.
2023-05-31 16:02:39 +02:00
Robin Gareus 2041979f85
Add more session-archive error messages, abort if encoding fails 2023-05-19 16:15:05 +02:00
Robin Gareus 25f8eea162
Allow to cancel session archive process 2023-05-19 03:08:37 +02:00
Robin Gareus 92fbab32c6
Update codebase to use PBD::Progress (1/2) 2023-05-19 00:37:49 +02:00
Robin Gareus 25234702fe
Prepare libardour for FileArchive progress API update 2023-05-19 00:35:14 +02:00
Robin Gareus b3d3944451
Add session-archive error messages 2023-05-18 18:54:46 +02:00
Robin Gareus 295dbd8e1e
Make RCU reader return a const pointer (omnibus commit) 2023-04-08 00:15:37 +02:00
Robin Gareus 8b59bf47df
Add a dedicated PlaylistSet type
This is to consolidate various locations that use
`typedef std::set<std::shared_ptr<Playlist>>`
throughout the codebase.
2023-04-06 02:12:32 +02:00
Paul Davis bcc1aeeb86 change MidiClockTicker to use Session& not Session* 2023-03-24 14:19:16 -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 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
Robin Gareus 054e1c3c12
Retain pending state after recovery (#9215)
After recovering from a crash, the user still needs to
retain the option to ignore the changes that were done
just before the crash after investigating them (or save them
into a snapshot).

Previously crash recovery unconditionally overwrote the
session file (see discussion on bug tracker).
2023-02-03 07:50:32 +01:00
Robin Gareus 1434789103
Allow to profile session-state save (again)
This was removed in
 bf0a525647
 2316df357b

"SaveState" was chosen because "State" prefix overlaps with
"Stateful", and "SessionState" overlaps with "SessionEvent"
debug names. `-DState` or `-DSession` overlap respectively
with unrelated debug output.
2023-02-03 07:32:50 +01:00
Robin Gareus 72995741bb
Adjust resampler quality when sample-rate mismatches
This also ensures that engine/session resampling is possible
when the config `port-resampler-quality` is 0.
2023-01-31 01:07:04 +01:00
Robin Gareus d89162745f
Consolidate base and nominal SR
Now that mismatched sample-rates are resampled, there is
no distinction between base and nominal sample-rate.
2023-01-31 00:54:28 +01:00
Paul Davis 3c1c6e7b68 continued work on use of Metadata in various Configuration objects (libs edition) 2023-01-27 15:13:27 -07:00
Robin Gareus 79033d8ee5 Resample when engine and session sample-rates mismatch 2023-01-22 20:51:44 +01:00
Robin Gareus 23a0efc286
Indicate error when parsing session fails 2022-11-29 20:00:15 +01:00
Robin Gareus 842f4517de
Fix session-archive of stereo files #9122
Archiving creates a dedicated mono file for each Source.
When the original session has (embedded) stereo files, the
channel needs to be temporarily set to 0.
2022-11-28 00:40:17 +01:00
Paul Davis d7895ab1d2 triggers: remove sidechain and use global port for trigger control 2022-11-19 10:22:16 -07:00
Paul Davis fc611232d2 redesign and reimplement save/restore of MIDI learn for triggers 2022-11-18 14:04:59 -07:00
Robin Gareus c84073e5cf
Print reversible command debug output
Debug builds will assert, the PBD::warning will not
be readable anywhere after that, so long it to stderr.
2022-11-02 00:47:09 +01:00
Robin Gareus 292cff7cfc
Prevent undo transaction crashes in optimized builds
Worst case this will lead to undo operations not being
saved rather than segfault (debug builds will still assert).
2022-11-02 00:45:06 +01:00
Paul Davis bf0a525647 remove unused variable 2022-09-27 09:32:19 -06:00
Paul Davis 2316df357b remove some debug output 2022-09-21 09:13:17 -06:00
Robin Gareus 44bacae43d
Allow for silent session format updates 2022-09-14 02:44:44 +02:00
Robin Gareus 58c2de2d71
Fix typo 2022-08-23 16:01:18 +02:00
Robin Gareus 9453802248
Fix "when refilling, cannot write" disk-reader bug
This happened initially during session load.
The GUI thread performed a direct refill (blocking wait)

`Session::post_engine_init() -> Track::seek() -> DiskReader::seek() -> DiskReader::do_refill_with_alloc()`

while concurrently the butler thread does the same:

```
Session::butler_transport_work() -> Track::non_realtime_locate() -> Route::non_realtime_locate()
-> DiskIOProcessor::non_realtime_locate() -> DiskReader::seek() -> DiskReader::do_refill_with_alloc()
-> DiskReader::refill_audio()
```

We do not want the GUI to wait, so now we just request a locate
and let refill happen in the background.
2022-08-11 19:14:51 +02:00
Robin Gareus 6ce804b4c9
Fix session-archives on macOS
When an archive are saved, a new folder in interchange/ is created,
named after the archive. However session-archive also retains files
in the session-folder that Ardour does not know about.

This can cause that the the original interchange folder is retained.
It will be empty with just the .DS_Store file in it. The result is
that the session may not load if there is an ambiguity.
2022-08-08 23:09:56 +02:00
Robin Gareus f1226b6735
Fix session-archive, include Triggerbox Regions and Sources
This also consolidates code to collect used sources by checking
all playlists and all Triggerboxen, which have no playlists.
2022-08-08 23:03:53 +02:00
Robin Gareus 20c942bb48
Fix endless loop when using "load session anyway"
Fixes a while-loop `break`, vs switch `break`.
2022-08-08 16:26:16 +02:00
Robin Gareus a10f001c97
Sync session and engine settings after reconfiguration 2022-08-07 18:57:46 +02:00
Robin Gareus 06717e9f84
Set TempoMap after sample-rate (map uses engine-rate) 2022-08-07 18:03:03 +02:00
Robin Gareus 93e6f5a882
Prepare to allow engine reconfiguration when SR mismatches
Rather than fail to load the session or load with mismatching
sample-rate, this will allow a user to reconfigure the engine
and retry.
2022-08-06 22:32:02 +02:00
Robin Gareus e04311b647
Work around cleanup unused regions removing trigger-regions
This workaround bypasses RegionMap and SessionPlaylist APIs
(region_use_count, destroy_region) which are not directly
applicable to Triggerboxes. There are likely various edge
cases until TriggerBoxes integrate with Session Playlist.

e.g. whole file regions generated for regions/source used by
triggerboxes are cleaned up.
2022-08-01 20:48:02 +02:00