Commit Graph

19667 Commits

Author SHA1 Message Date
991ab1f8f8 Handle tempo-map changes in sync from the calling thread
This is required to collect relevent undo/redo information, notably
automation-data changes from Playlist::update_after_tempo_map_change and
DiskReader::playlist_ranges_moved.

The realtime thread should not move regions to begin with, and debug
builds woudl also assert since no undo operation was started.
2022-10-23 23:24:12 +02:00
0504db2a67 Update region delta-time API
This is the first step to fix various MIDI edit issues for sessions with
tempo-changes.

The old code, using .earlier returned an absolute position when
calculating a relative distance. This is only valid if the session has a
fixed tempo, and the origin is irrelevant when converting the timepos.

This resulted in follow up issues since there is a difference when
summing two positions (each with an origin) vs adding an offset to a
position.

Note: this API changes breaks compilation until the GUI is updated.
2022-10-23 19:05:48 +02:00
33348f6332
Fix Windows builds 2022-10-23 06:17:29 +02:00
cc30495ba0
Properly convert v6 MusicTime locked MIDI regions 2022-10-22 05:36:23 +02:00
30ec62a953 This is clearly broken
Partially revert previous commit. Otherwise snap to bar/beat
clocks-displays display rounded down X|Y|1919 instead of X|Y+1|0
2022-10-22 03:09:32 +02:00
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
e9bafde628
Catch manual removal of subgroup bus (#9022) 2022-10-21 20:40:27 +02:00
2e860cd10d
Move SimpleExport to libardour, add Lua bindings
This allows to export a session from the commandline tool

```Lua
AudioEngine:set_backend("None (Dummy)", "", "")
s = load_session ("/path/to/session", "snapshot")
assert (s);
e = s:simple_export()
assert (e:check_outputs ())
e:run_export ()
e = nil
```
2022-10-21 19:50:26 +02:00
03642d3707
Mark window invisible after deleting it
This fixes an issue when destroying VST plugin UIs
rather than hiding them. Even though is hidden before destroying it,
the vistracker is also destroyed in the same function call, before
the event can be processed. The window state remains visible="1"
2022-10-21 18:11:19 +02:00
d69a2c3c13 small change to Locations::clear_cue_markers() API to bring it into line with other clear_* methods 2022-10-21 07:51:53 -06:00
a327e01ff3
Fix copy/paste (is_cue_marker Lua binding) 2022-10-21 13:06:22 +02:00
6a55146fdc
Fix music-time parameter automation #9019
Music-time has a significantly reduced resolution.
When evaluating parameter automation using sample-time, different
samples can be mapped back to the same beat-tick. This can result in
endless loops.

The same automation event is found again:

```
start: 112640 next_event.when: b13334 -> dist a5892029@a662323200 in dist.samples: 1002
start: 113642 next_event.when: b13334 -> dist a269@a668214960 dist.samples: 0
```

Note this fix may not be correct, since time-domains are mixed.
"end" is using sample-time. Furthermore The loop is only entered
if there is an event found using  timepos_t(start).

Further work will be required (ideally use the same resolution for
all time-domains, or force everything that is evaluated in RT-context
to a single time-domain)
2022-10-21 12:40:30 +02:00
506528a70c
Add API to query current export preset 2022-10-20 21:38:40 +02:00
63677347c9 change pingback URL and no longer send OS release or machine info 2022-10-19 20:26:39 -06:00
9914732004
Potential fix for C++20 std::set::* ambiguity
(until C++20) bool empty() const noexcept;
(since C++20) [[nodiscard]] bool empty() const noexcept;
2022-10-19 16:06:47 +02:00
22829e96b1
Fix MIDI Clock sync
This fixes a deadlock, because tempo-map write copy
was not released. A later call to TempoMap::write_copy
will deadlock and in this case also hold the process lock.

This can happen if there is more than one tempo on the
timeline or if the tempo-difference is too large.
2022-10-18 20:44:16 +02:00
b52ef52ddf
Allow to filter MixerScene restore by AutomationType 2022-10-18 00:08:35 +02:00
5352f5516e
Remove AutomationControlSet 2022-10-18 00:08:35 +02:00
08a10b7e84
Replace AutomationControlSet with ControllableSet (1/2) 2022-10-18 00:08:27 +02:00
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
46b14498f8
Prepare Lua bindings for std::set::insert 2022-10-17 23:09:04 +02:00
f6cc01d4f5
Implement cycle profiling for ppc64
Thanks to Frédéric Bonnard <frediz@debian.org>
2022-10-17 16:02:12 +02:00
aaddf5f385 Add API to restore mixer scenes for given set or Routes only 2022-10-17 06:44:29 +02:00
800d07a633 Add API to query all AutomationControls from an Automtable
This is in preparation for selective MixerScene restore.
2022-10-17 06:42:49 +02:00
Mads Kiilerich
0b27d6e652
Fix proximity threshold for polyline
I'm not good with a mouse, so I found it hard to edit animation lines.
The mouse position has to be quite precise, with only a small threshold.

Looking at the code, AutomationLine sets the threshold for the PolyLine
to 4.0 . That seems to be a distance, and better for me than what I
experience.

The actual code in PolyLine is however comparing it directly to the
squared distance, making it more sensitive than expected.

Fixed by computing the squared threshold - also including the line
width.
2022-10-17 00:09:25 +02:00
Mads Kiilerich
d1265b5a02
Fix mouse events on clamped automation lines
This fixes the following problem:
When automation lines with significant change are zoomed in time, the
slope gets smaller (towards horizontal) as the control points moves
further away from the visible area. That was rendered correctly, but the
corresponding mouse events happened as if the line had a steeper slope.

The problem was caused by the X value being clamped to the visible area,
without scaling the Y value correspondingly. It has apparently been like
that for a decode, since introduced in c4f0063a68.

The problem is fixed by introducing a clamp2 function that scales the Y
value if clamping the X value.

Note: An old comment says that math goes wrong unless clamping below
COORD_MAX. It is not clear to me what math it refers to, and especially
why we don't need similar clamping on the lower bounds.

And while rarely a real problem, I guess it would be more correct and a
slight optimization to skip all lines where both ends are outside the
same bound. In theory, as it is now, the mouse could catch an invisible
line close to the border.
2022-10-17 00:09:25 +02:00
23010a910d
Be liberal about what to accept
This addressee a bug where ardour 6 was able to write negative
duration `length="-1"` `length-beats="-3.3650500597559585e-05"`

Ideally timecnt_t::string_to should check for invalid,
negative, duration. But this also catches a more generic case.

```
exception at str.substr (1)
#3 Temporal::timepos_t::string_to (this=0x7fffffff7bb0, str="") at libs/temporal/timeline.cc:904
#4 Temporal::timecnt_t::string_to (this=0x7fffffff7ba0, str="-2") at libs/temporal/timeline.cc:294
#5 PBD::string_to<Temporal::timecnt_t> (str="-2") at libs/ardour/ardour/types_convert.h:131
```
2022-10-16 22:30:35 +02:00
31cf2dfa1b
Do not constrain bundle names to 32 chars 2022-10-16 21:45:09 +02:00
8240875379
Prevent overflow for huge time values (fix 99h clock limit @96kHz)
The default clock-limit is 99:59:59:00, just under 360000 seconds
(see ARDOUR_UI::parameter_changed, clock-display-limit).

AudioClock calculates this limit pos as
`timepos_t (limit_sec * _session->sample_rate())`

This caused an overflow leading to a negative value:
```
   timepos_t (359999 * 96000)
   samples_to_superclock (359999 * 96000, 96000)
   int_div_round (359999 * 96000 * 282240000, 96000)
```

Ideally this will be optimized, here the sample-rate cancels out,
so we could use a c'tor usin seconds.
In other cases we could cache the pre-calculated sc_per_sample:
`superclock_ticks_per_second() / superclock_t (sr)` which is an
integer for all commonly used sample-rates.
2022-10-16 18:46:36 +02:00
061d44feff
PortInsert: remove old API to query latency 2022-10-14 02:21:50 +02:00
40ea071873
PortInsert: emit signal when latency changes, cache I/O latency 2022-10-14 02:21:50 +02:00
0213fa6cc7
Implement PortInsert send/return gain contols 2022-10-14 02:21:50 +02:00
2939ed3164
Add dedicated InsertReturnLevel type
This is preparation for PortInsert Send and Return
level control.
2022-10-14 02:21:49 +02:00
f3423b8a77
Consolidate send/delivery gain control
This moves the _amp from send to delivery (which already
applies gain for the master-bus normalization). This generalizes
the use of a gain stage for use in port-inserts.
2022-10-14 02:21:49 +02:00
e665d456c3
Optimize RB stretch/pitch, set max-process size hint 2022-10-14 02:21:49 +02:00
a7a8783bb4 increase superclock_ticks_per_second to provide integer handling for NTSC (following Facebook "flicks") 2022-10-13 18:05:49 -06:00
38a40d7c06
Session drop graph-nodes before ~Session
Previously active Routes were retained until the end of
Session d'tor and not dropped during Session::destroy.

While most resources were explicitly cleaned up via DropReferences,
Processor UIs are kept around until the actual destructor runs.
Likewise some controllable are kept around while the GraphNode (Route)
owning it is not released.
2022-10-13 17:49:34 +02:00
8d866f58a2 fix mis-use of locally-scopped variable name in auto for loop 2022-10-12 16:51:04 -06:00
392210270c
Fix pitch-shift producing partially silent regions
It can happen that with a scaling factor of 1.0, rubberband
produces slightly fewer samples than the original.

Region::set_length (region->length * 1.0) is idempotent and
does not shorten it as appropriate to the longest source
via Region::verify_length(), which leads to various issues.
2022-10-12 22:25:10 +02:00
396013bf5a
Set and create clip-library folder if needed
Direct calls to `Config->get_clip_library_dir` may return
"@default@". The path is OS specific and may also not
yet exist, so indirection is required.
2022-10-12 16:11:50 +02:00
d69dfc26a6 no whole file regions in triggerbox slots 2022-10-11 12:56:41 -06:00
5324c9092e
Clean up LADSPA preset path
* Allow to bundle presets
* Do not use /usr/[local] on Windows
(This may need further work, for Windows, since default user
presets are in `file://$HOME/.ladspa/rdf/`)
2022-10-11 16:39:17 +02:00
340a260b30
Remove old LRDF VST presets
Ardour has not been using RDF for VST2 presets since at least
10 years.
2022-10-11 16:23:20 +02:00
0aa5a8674c
Remove accidentally commited file 2022-10-11 03:28:18 +02:00
0bf8e7d8cf
Make clock mode settings session independent
Much like the edit-tool and grid-types, clock-modes are UI state.

Saving the UI state separately allows them to be used
consistently for new sessions. Previously clock-modes were set
initially (at application start) and when loading sessions.

The clock modes of newly created sessions was different
depending on loading another session prior to creating the
session. This is now no longer the case.
2022-10-10 21:03:45 +02:00
c04b05f497
Remove misleading export quality comments 2022-10-10 02:23:55 +02:00
830fe4da2f
Add preference enum for plugin GUI unmap behavior 2022-10-08 18:44:16 +02:00
f89845e64a
Prevent duplicate signal emission
Re-assigning a sigc::connection does not disconnect
any previously connected signals.

WindowProxy::setup may be called multiple times. Notably plugin
windows can change the managed _window (generic/custom), which
requires a call to setup.
2022-10-08 17:12:10 +02:00
88396347e6 increment/decrement name changes ... out with old in with the new (libs 2022-10-07 17:30:35 -06:00
be9fdd9873 libs: use {de,in}crement_by_domain() instead of {de,in} (libs) 2022-10-07 16:24:46 -06:00