Commit Graph

757 Commits

Author SHA1 Message Date
06e9bf6ca4 domain swaps for MIDI CC and other controls 2023-08-16 09:06:10 -06:00
f92dcfa068 domain bouncing for Automatable/ControlLists 2023-08-15 08:34:42 -06:00
3b565693c8 objects don't have a time domain, they have a time domain provider (libs) 2023-08-02 15:22:52 -06:00
459659d229 ControlList: do not handle mis-ordered OrderedPoints 2023-07-10 14:23:17 -06:00
9c590c1ed1 syntactic tweak 2023-07-10 14:17:10 -06:00
64dc7557cf automation drawing: some code cleanup and thinko fixes for ::editor_add_ordered() 2023-07-10 14:05:27 -06:00
45b02538e6 Evoral: extend ControlList API with ::editor_ordered_points()
Much more efficient than adding points 1 by 1
2023-07-10 11:20:47 -06:00
4ba1ccc09b
NO-OP: use Tab to indent 2023-04-01 17:21:32 +02:00
a6401763a3
Fix interpolation when iterating over sequence (#9288)
When a control-point is exactly at tick (N * 8), iterating
over the List (Sequence<Time>::const_iterator::operator++)
skipped the point.

Sequence::time_between_interpolated_controller_outputs == 8.
2023-04-01 17:21:04 +02:00
4ba4cd69ff switch from glib atomic to std::atomic (libs edition) 2023-03-24 14:19:15 -06:00
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
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
4796a3643d use C++11 auto iterator 2023-02-06 21:04:17 -07:00
c24c210cce Use Controllist's time-domain for guard-point delta
This fixes copy/paste of pan automation (amongst other things).
2023-01-23 04:02:08 +01:00
John Emmas
7433ca7e8b Correct a couple of typos when calling 'g_fopen()' 2023-01-17 10:32:36 +00:00
58594e2554
Fix SMF read/write when compiled on Windows 2023-01-16 22:57:03 +01:00
ae321721cf
Also thin automation after touch/latch
AutomationList::start_touch must not start a write-pass.
That function is also called when the transport is no rolling.
A write-pass is started via AutomationWatch::add_automation_watch.
2022-12-18 01:45:04 +01:00
a5f36bbbbf
Fix thinning (normalize parameter value)
This fixes thinning of MIDI data (range 0..127) and
other parameters with range other than 0..1.
2022-12-18 00:55:12 +01:00
95544a86a0
Convert SMF track names to UTF-8 2022-12-15 00:30:18 +01:00
30efb2f178
NO-OP: clang-format 2022-12-03 14:46:45 +01:00
2338e25d31
Fix automation thinning
For consistency, samples need to be used a unit.
Currently the calculated area is orders of magnitude larger
than the default thinning_factor (20).
2022-12-03 14:46:45 +01:00
3567a7f610
Parse MIDI Lyrics meta-events (import w/markers) 2022-11-21 21:53:15 +01:00
705386842b
Require prefix for libardour library header location 2022-11-19 01:12:51 +01:00
Gon Solo
c3d4453bdf
Remove superfluous wscript lines. 2022-11-17 03:21:29 +01:00
f4a57f83e6 evoral: Sequence::clear() needs to remove patch changes and sysexes too 2022-10-31 14:22:17 -06:00
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
fa858a0386
Fix pan automation
The time-domains need to match in order to use the
raw underlying .val() as double for interpolation.
2022-10-27 04:28:07 +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
b269a1298c
Fix memory leak for invalid SMF event 2022-10-04 03:29:52 +02:00
04647d5ae5 More unit-tests updates
* move RangeTest to libtemporal tests
* remove BeatsTest,  already converted from
  Evoral to temporal/BeatTest.cc
2022-10-01 16:57:12 +02:00
a520adff62 Better version for d70ebde (compare timepos_t directly) 2022-09-30 04:57:09 +02:00
d70ebde1dc
Fix compilation of evoral unit-test
Some of these tests should be moved to libtemoral.
On 64bit Linux the tests pass, except various RangeTests.
2022-09-30 04:04:48 +02:00
0457646387
Allow to scan midi file during file read
This partially reverts eced764480. In many places Ardour uses
SMF directly, without loading the MIDI model in a libardour SMFSource.

In this case no information (track, channel-count) was available,
after eced764480, and worse various members were not initialized
and showed random numbers.

This fixes various import options.
2022-09-25 02:46:09 +02:00
ffc9239de5 ControlList: replace code use to interpolate MIDI CC curves
Original code is of questionable historical provenance, and
was needlessly (it seems) complexity. New code is relatively
simple arithmetic linear interpolation.
2022-08-17 20:55:17 -06:00
b03e9b4c10 NOOP: add helpful explanatory comment 2022-08-12 09:21:23 -06:00
610b5dddbf ControlList: GUARD_POINT_DELTA needs to take time domain into account 2022-08-11 15:26:42 -06:00
5f5f4599f2
Fix MIDISource event-interpolation state save
The actual goal here is to use direct InterpolationStyle serialization
in MidiSource (identical to AutomationList). enum_2_string()
does not work for Evoral types.

As side-effect virtual base-classes have been changed to pass
Parameters as const references
2022-07-22 03:38:41 +02:00
0d70be3a05 miscellaneous fixes for warnings from -Wconversion 2022-07-04 22:01:48 -06:00
ca49bc00f0
Remove old "user" API, use consistent get/set_double() 2022-06-29 01:39:02 +02:00
3623b39168
Replace ::user_double() with ::get_double() 1/2 2022-06-29 01:39:02 +02:00
a4a241c738
Prepare replacing ::user_double() with ::get_double()
Automation Controls (and controls in general) are now
only updated in realtime context. Either via automation-playback,
or via SessioEvent. This directly sets the Control:_user_value
(before emitting the Changed signal).

The GUI does not need to evaluate the control at a given point
in time, so the API call can be removed and unified.

This commit first removes all calls to "get_double" to ensure
that no special cases exist.
2022-06-29 01:39:02 +02:00
0d9656ef82 use new macros to cleanup #ifndef NDEBUG as much as possible (libs edition) 2022-06-22 13:31:08 -06:00
9b80d6558a fix optimized unused variable warning 2022-06-22 13:31:08 -06:00
ad8e1c1cfd fix optimized unused variable warnings 2022-06-22 13:31:08 -06:00
ac18b84351 remove always-true-condition from if() to avoid compiler warning 2022-06-21 17:34:09 -06:00
c8feef51ab convert use of operator* for tim::line types with ::scale(ratio_t) 2022-05-27 12:47:44 -06:00
60e5b84d78 temporal: alternative solution to overflow in timeline operator*()
This uses boost::multiprecision::int512_t when multiplying and dividing by the numerator
and denominator of a ratio_t. 128 bits would be sufficient but for some reason, the boost
docs show the 512 bit variant being very slightly faster.

This is a better solution than using a double, which although it will prevent overflow
has fairly limited resolution.
2022-05-24 21:46:10 -06:00
Mads Kiilerich
c1c95f538f evoral: fix ControlList::_x_scale to avoid ratio overflow when adjusting fade length
Region fades would sometimes get in a mode with weird behaviour. They
would be drawn in 2d with crossing lines, mainly moving back and forth
horizontally - not as a function of time. It would sound as it looked.
The fade would sometimes jump around when resizing. It could be worked
around by resetting the fade shape. It turned out the problem could be
reproduced by making minute long fades.

This change fixes or works around the problem.

Back story:

timepos_t (in temporal/timeline.h) uses 62 bit for integer value and the
max value is thus 4611686018427387904 ~ 5e18. timepos_t counts
superclocks, where superclock_ticks_per_second is 56448000 ~ 6e7. It can
thus store up to 8e10 seconds - thousands of years.

ratio_t (in temporal/types.h) can represent fractions as 64 bit (signed)
numerator and denominator. timepos_t avoids floating point operations,
but has operator* with ratio_t. To avoid crazy loss of precision it will
multiply the superclock count with the numerator before dividing with
the denominator.

Audio region fade in and out uses a number of increasing timepos_t
values (in a ControlList) up to the length of fade. When dragging to
resize, these values are (in_x_scale) multiplied with the ratio_t of the
new and old fade length. The problem is that the 62 bits will overflow
if using fades more than sqrt(5e18) ~ 2e9 superclock ticks ~ 38 seconds.
It will overflow into the "beat" flag and (at 58 seconds) into the sign
bit. The timepos_t values in the fade will thus jump and can be negative
or change to count beats.

To work around that problem, this changeset just use floating point
values for scaling the timepos_t values. All scaled values are stored as
integer anyway, so it should not make any actual difference for this use
case. There might however be other uses of ControlList where it matters.

As an implementation detail of this "workaround" of using double, it
could perhaps also be nice to implement timepos_t operator* (or
operator*=) for double. But I'm not sure we want floating point support
in timepos_t.

An alternative (and better) solution would be to convince the fraction
multiplication to use 128 bits. It is essential to avoid overflow -
mainly in static analysis, alternatively as runtime checks or asserts.
2022-05-24 17:15:37 -06:00
cd332a2af0 when pasting a Range of automation, first add guard points,
so the automation data before and after this range is retained
2022-05-16 07:16:25 -05:00