13
0
Commit Graph

615 Commits

Author SHA1 Message Date
c0aa738395 expose SMF tempo information in Evoral::SMF 2016-12-16 10:43:52 +00:00
2378e7b60c add function to get number of tempos found in SMF tempo map 2016-12-16 10:43:41 +00:00
fe0761d404 unused but slightly tricky code to add track name/instrument to an SMF file when saved 2016-12-16 09:36:52 +00:00
76dca432f0 add comments about limitations for Evoral::SMF and tracks 2016-12-16 09:36:52 +00:00
d2fd01c241 add API to Evoral::SMF to retrieve all track/instrument names for use when importing 2016-12-14 11:46:26 +00:00
7e0dbd06db extract track and instrument names from SMF while loading 2016-12-14 11:46:26 +00:00
24160a3b85 add braces and warning for unlikely error 2016-12-14 11:46:26 +00:00
ff6f8ca6c4 fix incorrect test for textual meta events in libsmf 2016-12-14 11:46:26 +00:00
54ef5fadc2 braces please 2016-12-14 11:46:26 +00:00
d5074be4f1 braces, please 2016-12-14 11:46:26 +00:00
8002a0c66e free track name/instrument string memory when necessary 2016-12-14 11:46:26 +00:00
28caef7d81 add track and instrument name members to smf_track_t 2016-12-14 11:46:26 +00:00
f04c1ca4db I can't find a source file called MIDIXML.cpp (??) 2016-12-08 13:55:11 +00:00
fe45f9bc21 Set MidiPgmChangeAutomation control value 2016-12-07 12:45:01 +01:00
388765e8ce Remove boost_system test kludge 2016-12-04 19:15:29 -05:00
5ab2e34b2c Update evoral test suite 2016-12-04 18:49:56 -05:00
9a848d5ba6 Fix configuration 2016-12-04 18:26:30 -05:00
1438191938 Improve coverage of evoral tests 2016-12-04 15:40:21 -05:00
9dbc524060 Improve coverage of evoral tests 2016-12-04 15:17:08 -05:00
9aac954744 Add missing include 2016-12-04 15:16:08 -05:00
b51321bd7d Make libpbd and evoral capable of standalone build
Just an update to slightly rotten wscripts, shouldn't be any changes during an
ardour build.  Motivation being a short development cycle for working on evoral
and/or its test suite.
2016-12-04 15:15:11 -05:00
7d2ed46b63 Remove dead/annoying/unsafe code
Note the old Note::operator= was unsafe, since it made shallow copies of the on
and off events, which results in a double delete of events when the notes are
destructed.
2016-12-04 15:10:05 -05:00
454df30ae5 Fix Sequence test 2016-12-03 15:49:13 -05:00
d17f58e531 Remove dead code 2016-12-03 15:28:23 -05:00
398a318934 Fix event type and parameter type confusion
I'm not sure if this is really the best way to do event types (should it
just be a completely static enum in evoral, or completely dynamic and
provided by the type map, or a mix like currently?), but previously the
event type was frequently set to either total garbage, or parameter
types, which are a different thing.

This fixes all those cases, and makes Evoral::EventType an enum so the
compiler will warn about implicit conversions from int.
2016-12-03 15:28:19 -05:00
08fffeffec Remove Evoral::MIDIEvent
It is slightly questionable whether type specific methods like
velocity() belong on Event at all, these may be better off as free
functions.  However the code currently uses them as methods in many
places, and it seems like a step in the right direction, since, for
example, we might some day have events that have a velocity but aren't
stored as MIDI messages (e.g. if Ardour uses an internal musical model
that is more expressive).

In any case, the former inheritance and plethora of sloppy casts is
definitely not the right thing.
2016-12-03 15:18:21 -05:00
875b1367b2 Factor out and extend MIDIXML implementation 2016-12-03 15:18:20 -05:00
0f5a73a7fd Fix Sequence/Event const-correctness issues 2016-12-03 15:18:20 -05:00
2f30d763ed Fix loading, recording & saving MIDI with PolyKeyPressure events.
GUI still does not handle this (neither automation lane, nor List Editor),
but the file loads, plays and exports correctly.
2016-11-27 17:25:42 +01:00
7c8ab05c09 Don't add initial points for MIDI-CC
eg. import a .mid that has a CC later in the file.
Arodur wrongly added an initial point, effectively moving the event
backwards to "0" (no virgin territory)
2016-10-23 14:21:24 +02:00
4d66c89b83 SMF add support for type-0 files (count channels, not tracks) 2016-10-05 20:08:26 +02:00
e05cb11bb0 extend Evoral::Range<T> to offer ::length() and ::squish()
The latter maps a T into a range, using loop semantics
2016-09-13 14:11:29 -05:00
0ff233d234 Update our MSVC project files to generate the most recent Ardour session file format (ver 5) rather than the older v3 format 2016-08-30 07:15:00 +01:00
d6691a80e9 attempt to handle poly-pressure (polyphonic aftertouch) similarly to other MIDI messages 2016-08-19 08:32:44 -04:00
eec294a97e the endless quest to plug memory leaks -- episode 378 2016-07-25 17:16:32 +02:00
cf52d6e4b4 enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h 2016-07-14 14:45:23 -04:00
22de00b247 Remove a (no longer needed) source file from our MSVC project (evoral) 2016-07-14 09:42:55 +01:00
a6ee94ac52 remove old midi-note name API 2016-07-12 23:02:46 +02:00
b0200b23f2 Accommodate the fact that 'msvc_resources.rc.in' got moved to a new path 2016-05-21 10:33:18 +01:00
c23be46c15 use g_fopen() to avoid i18n errors with file paths/names 2016-05-10 15:55:45 -04:00
f5e4d3b032 NO-OP; document some more parameters.
Since headers only provide the declaration, function
parameters need to be documented.
2016-04-12 11:06:35 +02:00
09202249e1 NO-OP document Evoral::ControlList 2016-04-10 20:55:59 +02:00
2972fe0fc2 leave a ToDo note 2016-03-28 21:42:46 +02:00
eaca325ce8 Trim dependence on evoral types.hpp and Beats.hpp 2016-03-21 18:58:31 -04:00
ba78359129 prepare for update to waf 1.8
uselib is no longer implicit (inherited by .use). This is still incomplete,
some uselibs for non-linux variants may be missing.

bld.is_defined("HAVE_XXX") also no longer works and will have to be
changed (I think to bld.env["HAVE_XXX"]) in countless places.
2016-02-28 21:16:44 +01:00
f3179cc5e3 Modify the MSVC build project (for libevoral) such that it can find pthread.h
libevoral itself doesn't seem to need libpthread - but by some mechanism it #includes <pbd/event_loop.h> (which now does #include <pthread.h>). So let's make sure it can be found.
2015-12-30 10:17:55 +00:00
8d45eecd45 somewhat better solution to prev commit.
parse up to 32bit VLQs, match smf_format_vlq()
2015-12-27 03:40:48 +01:00
2c197fd89a work around midi-event counter 4 byte overflow. 2015-12-27 02:09:54 +01:00
nick_m
fcc626132e Handle paste from non-toggled to boolean automation track.
- sort-of fixes #6431
2015-10-31 03:54:18 +11:00
nick_m
4dcd22fadf Update ContrilList debug output. 2015-10-20 00:53:29 +11:00
nick_m
cc7de475f2 Amend last connit - don't use a bool to represent a double. 2015-10-20 00:53:28 +11:00
nick_m
ff2f934977 Fix incorrect initial point when recording toggled automation. 2015-10-20 00:53:28 +11:00
nick_m
9c102fa8d2 Make automation record undo per pass rather than per touch. 2015-10-20 00:53:28 +11:00
nick_m
17294ab9ec Make control point selection more consistent.
- disallow simultaneous events via ControlList::editor_add ()
	- clicking on an automation line selects the points that define it.
	- don't 'flash' a region selection when using mousedraw mode.
	- cp click selection resembles region selection.
	- region gain points respect snap modifier (a la automation points).
2015-10-20 00:53:27 +11:00
96b45d4909 only subdivide plugin-cycle when automation is playing
PluginInsert::automation_run() subdivides plugin-run on every
control-port automation event (without splitting the process cycle).

libevoral has no automation-control context, hence this function
must be implemented by Automatable.
2015-10-07 14:21:29 +02:00
22b07e0233 NOOP, remove trailing tabs/whitespace. 2015-10-05 16:17:49 +02:00
4178db5f63 globally remove all trailing whitespace from .cpp and .hpp files missed by previous commit 2015-10-04 15:11:15 -04:00
4dc63966f0 globally remove all trailing whitespace from ardour code base.
Paul Davis was responsible for introducing almost all of this.
2015-10-04 14:51:05 -04:00
e4adb99e06 Add some casting to keep MSVC happy 2015-09-24 09:06:19 +01:00
555ef50521 no c99 2015-09-19 01:22:14 +02:00
7648824773 speed-up smf_track_delete() from O(N^2) to O(n) 2015-09-19 00:38:32 +02:00
21b720fddc Midi CC events have no event-ID
Prior to this change the last iterator's ID was used. (event's ID was
not updated for CCs)
2015-09-18 17:37:03 +02:00
8b2fb88f15 fix ever increasing MIDI event IDs
Iterating over a const Midi-Sequence calls Evoral::Sequence::set_event(),
which in turn used Evoral::Event::operator=()  which always created
a new event-ID (create copy of the event).

Issues fixed:
 - Saving *unmodified* MIDI produced new event-IDs on every save;
   files changed with every save. - greetings to Deva.
 - all [GUI] operations that use IDs to refer to notes e.g. undo.
   invalid undo-history.

Also clarify assignment operator name. Prefer explicit assign() over =.
2015-09-18 17:36:15 +02:00
fc74894def another note-off fix.
For nearly coincident note-on the sequence does not matter,
but note-off must be sent before a new note-on in strict
order (could be the same note).
2015-09-15 17:50:27 +02:00
e63c3d028a note-off ordering - fixes #6340
Evoral::Beats::operator>() rounds to (1.0 / PPQN), hardcoded 1/1920.0.

If the time difference between two events is smaller than 1/PPQN,
Beats::operator>()  and  Beats::operator<()  produce ambiguous results.
The same pair of values is both "less than" and "greater than" depending
which operator is used.

While it's fine for some cases to ignore the order of nearly concurent
events, the std::priority_queue must be strictly ordered.
2015-09-14 04:55:01 +02:00
d83889079b hack around a bug in cppunit/mingw/windows. 2015-09-13 20:23:12 +02:00
e45db26d97 adjust precision to specified value, avoid "0". 2015-09-13 20:12:10 +02:00
8e8f8d92c2 allow to run unit-test under wine from srcdir. 2015-09-13 15:30:00 +02:00
ca0c9b3636 Replace "%z" modifier with glib macro for portability. 2015-07-30 17:00:03 +02:00
46c8369328 merge fix 2015-07-16 16:13:24 -05:00
438f3e5141 remove const warning in SMF C code by changing function parameter argument qualifier 2015-06-29 14:18:15 -04:00
0a433b2d07 Revert "add operator bool() to Evoral::Beats"
This reverts commit f8b5263af5e4d5088f1d5551e999679515add432.

OS X compiler gets confused by this change.
2015-06-29 14:18:14 -04:00
16c34acc88 add operator bool() to Evoral::Beats 2015-06-29 14:18:14 -04:00
nick_m
6ecbeed8e8 Fix ControlList::editor_add () wrt guard points. 2015-06-18 10:03:18 +10:00
nick_m
15819f0896 Automation -use editor_add in gui, record straight lines with fewer points.
- don't keep setting/unsetting write pass when transport frame
	  remains the same (think larger jack buffer sizes)
	- insert guards are now 64 frames after when.
	- refactor previous approach.
2015-06-17 09:54:22 +10:00
nick_m
57ce447fd1 Fix some workflow problems wrt automation.
- clearing automation points sets control to "off" rather than touch.
	- multiple touches on the same pass acts consistently (no more
	  fader jumps on mouse button press
	- use actual value for initial point rather than some arbitrary
	  default. clarify new semantics of add () (with_default->with_initial).
	- clean some whitespace
	- add guard points as needed in stop.
	- catch grab broken signal (i can't trigger it, but the docs seem
	  to think it is essential).
2015-06-17 09:54:22 +10:00
cc543280d9 We were 2 more debug "bits" away from overflow, so recast PBD::DEBUG mechanism away from a 64bit integer and toward std::bitset.
Clean up a few minor related PBD::DEBUG issues along the way
2015-06-12 18:14:09 -04:00
801af5df9e Add the new (UINTSDEFINED) preprocessor directive to all out MSVC projects (just to be on the safe side) 2015-06-09 13:18:42 +01:00
nick_m
92b69a17da Make Evoral::Event ids unique always.
- probably fixes a lot of cases where note ids are assumed to be
	  unique (they weren't for copies and some others).
	- wrong branch, but it needs testing.
2015-05-24 01:53:34 +10:00
Nils Philippsen
1e5c5e6bdf don't install static library libsmf.a 2015-05-03 19:50:36 +02:00
63ac1b1464 SMF::end_write() is a no-op if there is no _smf structure 2015-04-20 22:46:39 -04:00
d263cf7ded remove _file_path member from Evoral::SMF 2015-04-20 15:44:20 -04:00
96ce9c304e Replace control list locks with RWLocks
towards fixing #6238 and #6096.


GUI thread:
#2  Glib::Threads::Mutex::Lock::Lock
#3  Evoral::ControlList::eval 
#4  Evoral::Control::get_double 
#5  ARDOUR::AutomationControl::get_value
#6  ProcessorEntry::Control::control_changed
..
#15 PBD::Timer::timeout_handler


at the same time: Audio Thread (try-lock, fails)

#0  Evoral::Curve::rt_safe_get_vector
#1  ARDOUR::Amp::setup_gain_automation
#2  ARDOUR::Route::process_output_buffers

Due to the failed try-lock.. AMP::_apply_gain_automation
is false. and Amp::run() uses a different gain factor.
-> click.
2015-04-15 18:13:56 +02:00
7e2c8ace4b Follow MIDI control values with automation faders.
Fixes bug #6166 (except record).

This attempts to follow the "current" control value somewhat aggressively:

* On locate, slider is set to the value from the top region at the new
  transport position.

* Playback or MIDI input is followed "live".

* Whenever the slider is moved (including automatically), that value is emitted
  as an immediate event to keep external gear in sync.

General idea is that the Ardour slider should act as a mirror of an external
hardware knob, and both should be synced to whatever the control is at the
current transport position.  Since we lack real playback/touch/etc modes for
these for now, we must choose one behaviour, and this seems like the most
reasonable one.

Follow is handled in the audio thread, which is probably not ideal, but since
these controls have no lists and do not record, should be fine.  Probably.
2015-03-26 00:47:34 -04:00
99260742d2 mingw: all code is position independent 2015-03-11 14:58:02 +01:00
4b401d9e34 Add a missing 'typename' specifier to the declaration for 'Evoral::Sequence::set_notes()' 2015-03-07 12:29:15 +00:00
a8aae56d92 Handle edits while playing precisely.
This avoids stuck notes if active notes are edited, but without stopping all
active notes in the region on any edit as before.

This implementation injects note ons in places that aren't actually note
starts.  Depending on how percussive the instrument is, this may not be
desired.  In the future, an option for this would be an improvement, but there
are other places where "start notes in the middle" is a reasonable option.  I
think that should be handled universally if we're to do it at all, so not
considering it a part of this fix for now.
2015-03-05 17:30:31 -05:00
b68a4e5cdc Normalize notes on all channels.
Probably.
2015-02-19 20:23:11 -05:00
450291adfc Fix record/import of note ons with velocity 0.
Best to just do this as early as possible to avoid having to deal with this
situation all over the code.

Also fixes violation of LV2 MIDI specification, which requires no such events
are delivered to plugins.
2015-02-19 18:38:30 -05:00
6fb4bd578e Don't allocate then discard notes on note off.
Silly to make a junk Note just to pass to append_note_off_unlocked, which just
uses the fields that are on the MIDIEvent anyway then throws it away.

Also explicitly dispatch to append_note_off_unlocked in the caller for note ons
with velocity 0 rather than make append_note_on_unlocked deal with it.
2015-02-19 18:38:30 -05:00
6a033a093b Remove unused ifdef gunk. 2015-02-19 18:38:30 -05:00
cb3961d953 Add a test for the constrained cubic interpolation of Evoral::Curve
Add a test, based on the worked example in www.korf.co.uk/spline.pdf, for
the constrained cubic spline interpolation.

The delta values for the float comparisons are rather arbitrary, I'm sorry
to say: they're basically chosen so that everything passes.
2015-02-13 12:25:51 +00:00
9c992fa97c few more basic ControList/Curve Tests 2015-01-20 00:46:58 +01:00
Guido Aulisi
c6e71a683e Curve::_get_vector: fix return value when veclen == 1
When the crossfade length is only 1 frame, I got strange
gain coefficients from get_vector (63 in my case).
The function wrongly returned the x axis value.
2015-01-19 23:55:52 +01:00
5190cbc9b2 2-point Curve Linear Interpolation Test 2015-01-19 23:55:52 +01:00
2a7389d8df minimalistic Evoral::Curve Unit Test. 2015-01-19 22:15:28 +01:00
2abd8b8f06 Add a newly introduced header file to our MSVC project (libevoral)
This change is MSVC specific and shouldn't affect the other builds.
2015-01-10 11:58:58 +00:00
2a251b4570 MusicalTime => Beats. 2015-01-07 00:12:07 -05:00
b56905b9a7 Fix MIDI file descriptor leaks.
Pretty sure this is the cause of MIDI data going missing on save for optimized
builds.  Introduced in 294b99aabf.
2015-01-05 15:50:30 -05:00
07c08e4673 fix incorrect test for valid MIDI events.
Only channel messages have the form <statusbyte>{<nonstatusbyte>..}
2014-12-31 10:32:50 -05:00