Commit Graph

218 Commits

Author SHA1 Message Date
Paul Davis f7fd015cb3 no, really, no Pitches handling (extends previous commit) 2023-08-15 11:29:52 -06:00
Paul Davis 4246009864 no need for domain bouncing for "pitches" in a MIDI model
The Pitches representation is just an optimization in Evoral::Sequence, and just
represents note data differently
2023-08-15 11:25:54 -06:00
Paul Davis a50f38d164 domain bounce handling for sysex and patch changes 2023-08-15 10:27:21 -06:00
Paul Davis 457b94ba65 fix computation of note length after tempo mapping 2023-08-15 00:04:19 -06:00
Paul Davis 71d27e7d81 add a couple of #warnings 2023-08-14 23:42:08 -06:00
Paul Davis 076cb86912 next iteration of changes to handle time domain bounces as undoable 2023-08-14 23:42:08 -06:00
Paul Davis 3b565693c8 objects don't have a time domain, they have a time domain provider (libs) 2023-08-02 15:22:52 -06:00
Paul Davis fa225846af new Temporal API to allow keeping MIDI notes in position after a map-tempo operation 2023-08-02 14:11:06 -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
Paul Davis b0c162879d fix error with saving MIDI after forking MIDI region
when we save a MidiModel to a new MIDI source, that does not
change the edited status of the Model.
2022-10-25 12:51:08 -06:00
Robin Gareus 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
Ben Loftis f50d5507c3 midi_model: rename some midi diff functions, to (try to) avoid confusion
syntax for beginning and ending a diff command is:
 "new_diff_command"  ->  "apply_diff_command"

syntax for applying a diff_command is:
 "_as_commit" :  Begins and Commits a standalone undo Command
 "_as_subcommand" :  adds to undo but does not Begin or Commit a Command
 "_only" : (new) applies the note_diff but does not have any effect on undo
2022-05-10 15:47:20 -05:00
Paul Davis 7bf89ce109 Constification: make Stateful::get_state() const, with all other required const-ness added (libs) 2022-04-06 21:56:59 -06:00
Paul Davis bc38f8d424 MidiSource: change thread mutual exclusion object from Mutex to a RWLock
This allows two reader threads to proceed without blocking each other, as can
happen when the butler renders a MIDI track into an RT-safe buffer while the
GUI reads the same MidiModel/Source for visual display.
2022-04-05 20:52:09 -06:00
Paul Davis 54597bd803 change the type of reference held by a MidiModel to its MidiSource
This also requires a change in the type of reference held by
a MidiAutomationListBinder.

Both the MidiSource and MidiModel have a reference to each other, and it is
important that we avoid circular references to avoid problems with object
destruction. We had been accomplishing this by having the Model hold a
weak_ptr<MidiSource>. However, the lifetime of a MidiSource and its MidiModel
are coincident and there's really no need to use a smart ptr at all. A normal
reference is just fine. However, due to constructors that accept a serialized
state, we cannot use an actual reference (we cannot set the constructor in the
initializer list), so we use a bare ptr instead.

This forces a similar change in MidiAutomationListBinder, which also maintains
a reference to the Source. However, the only purpose of this object is to
ensure that if the Source is destroyed, relevant commands will be removed from
the undo/redo history, and so all that matters here is that the binder connects
to the Destroyed signal of the source, and arranges for its own destruction
when received.

Note that the previous construction of the binder, actually holding a
shared_ptr<MidiSource> would appear have prevented the Destroyed signal from
ever being emitted (from ~Destructible), and so this may also be a bug fix that
allows MidiSources to actually be deleted (the memory object, not the file).
2022-04-05 20:52:09 -06:00
Paul Davis 3454353aa3 remove concept of "note-mode" from Evoral::Sequence (and thus ARDOUR::MidiModel)
This note-mode had no effect on anything at all, at least as far back
as 5.12. There is a note-mode in the GUI which affects the duration of notes
added using the GUI, and that remains in place. It is not clear
if the _percussive member of Evoral::Sequence ever had any effect on
the actual MIDI event stream the Sequence could generate.
2022-04-05 20:52:09 -06:00
Paul Davis 1ab49bcc32 change MidiStateTracker to MidiNoteTracker
The old name will become a bigger class/object that tracks all MIDI state,
not just notes
2022-02-01 18:06:40 -07:00
Paul Davis 7c10cf1d54 Automatable now requires (and owns) a time domain to be used by automation data 2021-08-13 12:51:32 -06:00
Paul Davis f66a6c779e adapt to DoubleableBeats and so forth (libs edition) 2021-08-13 12:51:32 -06:00
Paul Davis eae9d276fe libardour: conversion to use timeline types (mega-commit) 2021-08-13 12:51:29 -06:00
Robin Gareus 4887350e0d
API consistency, prefer typedef'ed event_id_t 2021-03-19 06:29:03 +01:00
Robin Gareus fc7dd5115d
Fix some clang-scan warnings 2020-01-27 03:31:49 +01:00
Robin Gareus f76c897f04
Directly apply MIDI automation state changes
Previously "play/off" and "discrete/linear" changes had no effect
until the MIDI playlist was edited and MIDI re-read into RAM.
2019-12-17 17:17:27 +01:00
Paul Davis a855119bdd rename all Evoral source from .(hpp|cpp)$ to .(h|cc) 2019-11-02 16:32:18 -06:00
Robin Gareus 08644d8f2a
No-OP: move doxygen doc into header files 2019-08-29 17:57:22 +02:00
Robin Gareus a22f918d9d
Update libardour GPL boilerplate and (C) from git log 2019-08-03 15:53:16 +02:00
Paul Davis 7db12f6b12 convert codebase to use Temporal for various time types 2017-09-24 12:03:54 -04:00
Tim Mayberry adc4bfd5db Use XMLNode::get/set_property API in ARDOUR::MidiModel class 2017-04-19 09:36:52 +10:00
nick_m e8b5b4fcf3 offset linked regions to compensate for negative start after trim drag.
- should fix 7105
2017-03-04 11:28:49 +11:00
Paul Davis 4a03572cd9 NO-OP: add a few spaces before function args 2017-01-23 21:58:02 +01:00
David Robillard 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
David Robillard c61373212a Support multiple readers for MIDI source/model
Fixes the multiple reader issue #6541 properly without resorting to a
linear search kludge.

All the read state has been pulled out into a MidiCursor which the
caller is required to pass.  The playlist keeps cursors for all the
regions it is reading, any number of cursors are allowed at a time.

MidiCursor should probably be made a smarter and more fool-proof
object (and/or possibly merged with some of the other tracker/fixer
stuff) but for now I wanted to keep it simple.
2016-11-08 20:34:45 -05:00
Robin Gareus 712440a48c proper C++ const API (possible fix for MSVC builds) 2016-10-07 19:08:39 +02:00
Julien "_FrnchFrgg_" RIVAUD 728e6027d1 Make MidiModel::write_section_to able to offset event times
MidiModel::write_section_to() only wrote events to the given source if
those events had a time in the given range. Make it able to optionally
offset event times so that the start of the written range corresponds to
time 0 in the source.
2016-07-20 02:01:40 +02:00
Julien "_FrnchFrgg_" RIVAUD 2bad0e5c55 Make MidiModel::write_section_to() more type-independant
Replace hard-coded Evoral::Beats by TimeType which is currently the same
thing but might change in the future.
2016-07-20 02:01:40 +02:00
Paul Davis cf52d6e4b4 enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h 2016-07-14 14:45:23 -04:00
Paul Davis 17ace643e4 OMNIBUS COMMIT: prefer const XMLNode::property method (and provide a real one) 2016-05-04 23:09:45 -04:00
Nil Geisweiller 742d176479 Fix overlapping resolution (see issue #177)
It assumes that a note ending at the same time of another one starting
is not considered overlapping.
2015-12-22 04:52:50 +01:00
André Nusser a958770abd Remove all the now unused functions in the MidiModel class. 2015-10-17 22:12:55 -04:00
André Nusser 66f18914b2 Split transpose in MidiModel into two functions. 2015-10-17 22:12:54 -04:00
Robin Gareus 22b07e0233 NOOP, remove trailing tabs/whitespace. 2015-10-05 16:17:49 +02:00
Paul Davis 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
David Robillard 4d2d693190 Fix stuck notes on save during MIDI playback. 2015-05-12 20:10:23 -04:00
David Robillard 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
nick_m 63935a86a4 Rework previous commit to avoid extra property lookup (fwiw). 2015-02-06 01:09:04 +11:00
nick_m 2d8b7c352b Make sure we have the property rather than the value of patch change id.
(don't crash whenever someone adds a patch change and reloads the session).
2015-02-06 00:53:12 +11:00
David Robillard 2a251b4570 MusicalTime => Beats. 2015-01-07 00:12:07 -05:00
David Robillard c35e94a3c8 Fix some mangled whitespace (noop). 2014-12-30 14:41:22 -05:00
David Robillard 54c085d931 Fix occasional crash when saving MIDI.
I can't figure out why a change has a NULL note; that shouldn't happen, but it
does.  Worse case scenario is some undo loss, so better to print something
informative and soldier on than crash.  Hopefully this will help track down the
real cause with more testing.
2014-12-29 22:01:41 -05:00
Paul Davis a42b9ff86e fix a few compiler warnings 2014-12-29 18:17:26 -05:00