ardour
|
#include <midi_model.h>
Classes | |
class | DiffCommand |
class | NoteDiffCommand |
class | PatchChangeDiffCommand |
class | SysExDiffCommand |
struct | WriteLockImpl |
Public Attributes | |
PBD::Signal0< void > | ContentsChanged |
Public Attributes inherited from ARDOUR::Automatable | |
PBD::Signal0< void > | AutomationStateChanged |
Protected Member Functions | |
int | resolve_overlaps_unlocked (const NotePtr, void *arg=0) |
Protected Member Functions inherited from ARDOUR::Automatable | |
void | can_automate (Evoral::Parameter) |
int | load_automation (const std::string &path) |
int | old_set_automation_state (const XMLNode &) |
Protected Member Functions inherited from Evoral::Sequence< Evoral::Beats > | |
Pitches & | pitches (uint8_t chan) |
const Pitches & | pitches (uint8_t chan) const |
Private Attributes | |
PBD::ScopedConnectionList | _midi_source_connections |
boost::weak_ptr< MidiSource > | _midi_source |
InsertMergePolicy | _insert_merge_policy |
std::set< WeakNotePtr > | _active_notes |
Friends | |
class | DeltaCommand |
This is a higher level (than MidiBuffer) model of MIDI data, with separate representations for notes (instead of just unassociated note on/off events) and controller data. Controller data is represented as part of the Automatable base (i.e. in a map of AutomationList, keyed by Parameter). Because of this MIDI controllers and automatable controllers/widgets/etc are easily interchangeable.
Definition at line 55 of file midi_model.h.
Definition at line 57 of file midi_model.h.
MidiModel::MidiModel | ( | boost::shared_ptr< MidiSource > | s | ) |
Definition at line 49 of file midi_model.cc.
|
inline |
Definition at line 292 of file midi_model.h.
Apply a command.
Ownership of cmd is taken, it must not be deleted by the caller. The command will constitute one item on the undo stack.
Definition at line 97 of file midi_model.cc.
Apply a command as part of a larger reversible transaction
Ownership of cmd is taken, it must not be deleted by the caller. The command will constitute one item on the undo stack.
Definition at line 111 of file midi_model.cc.
|
privatevirtual |
Reimplemented from ARDOUR::Automatable.
Definition at line 1895 of file midi_model.cc.
|
virtual |
Reimplemented from ARDOUR::Automatable.
Definition at line 1903 of file midi_model.cc.
|
privatevirtual |
A ControlList has signalled that its interpolation style has changed. Again, in order to keep MidiSource and ControlList interpolation state in sync, we pass this change onto our MidiSource.
Reimplemented from Evoral::ControlSet.
Definition at line 1878 of file midi_model.cc.
|
privatevirtual |
Reimplemented from Evoral::Sequence< Evoral::Beats >.
Definition at line 2027 of file midi_model.cc.
MidiModel::WriteLock MidiModel::edit_lock | ( | ) |
Lock and invalidate the source. This should be used by commands and editing things
Definition at line 1618 of file midi_model.cc.
Evoral::Sequence< MidiModel::TimeType >::NotePtr MidiModel::find_note | ( | NotePtr | other | ) |
Definition at line 1550 of file midi_model.cc.
Evoral::Sequence< MidiModel::TimeType >::NotePtr MidiModel::find_note | ( | gint | note_id | ) |
Definition at line 1571 of file midi_model.cc.
MidiModel::PatchChangePtr MidiModel::find_patch_change | ( | Evoral::event_id_t | id | ) |
Definition at line 1587 of file midi_model.cc.
boost::shared_ptr< Evoral::Event< MidiModel::TimeType > > MidiModel::find_sysex | ( | gint | sysex_id | ) |
Definition at line 1599 of file midi_model.cc.
XMLNode & MidiModel::get_state | ( | void | ) |
Definition at line 1543 of file midi_model.cc.
InsertMergePolicy MidiModel::insert_merge_policy | ( | ) | const |
Definition at line 1828 of file midi_model.cc.
void MidiModel::insert_silence_at_start | ( | TimeType | t | ) |
Moves notes, patch changes, controllers and sys-ex to insert silence at the start of the model. Adds commands to the session's current undo stack to reflect the movements.
Definition at line 1934 of file midi_model.cc.
boost::shared_ptr< const MidiSource > MidiModel::midi_source | ( | ) |
Definition at line 1925 of file midi_model.cc.
MidiModel::NoteDiffCommand * MidiModel::new_note_diff_command | ( | const std::string | name = "midi edit" | ) |
Start a new NoteDiff command.
This has no side-effects on the model or Session, the returned command can be held on to for as long as the caller wishes, or discarded without formality, until apply_command is called and ownership is taken.
Definition at line 62 of file midi_model.cc.
MidiModel::PatchChangeDiffCommand * MidiModel::new_patch_change_diff_command | ( | const std::string | name = "midi edit" | ) |
Start a new PatchChangeDiff command
Definition at line 82 of file midi_model.cc.
MidiModel::SysExDiffCommand * MidiModel::new_sysex_diff_command | ( | const std::string | name = "midi edit" | ) |
Start a new SysExDiff command
Definition at line 72 of file midi_model.cc.
|
inline |
Definition at line 61 of file midi_model.h.
|
protectedvirtual |
Reimplemented from Evoral::Sequence< Evoral::Beats >.
Definition at line 1636 of file midi_model.cc.
void ARDOUR::MidiModel::set_insert_merge_policy | ( | InsertMergePolicy | ) |
void MidiModel::set_midi_source | ( | boost::shared_ptr< MidiSource > | s | ) |
Definition at line 1838 of file midi_model.cc.
|
inline |
Definition at line 62 of file midi_model.h.
|
inline |
Definition at line 272 of file midi_model.h.
|
private |
Definition at line 1887 of file midi_model.cc.
|
private |
The source has signalled that the interpolation style for a parameter has changed. In order to keep MidiSource and ControlList interpolation state the same, we pass this change onto the appropriate ControlList.
The idea is that MidiSource and the MidiModel's ControlList states are kept in sync, and one or the other is listened to by the GUI.
Definition at line 1868 of file midi_model.cc.
bool MidiModel::sync_to_source | ( | const Glib::Threads::Mutex::Lock & | source_lock | ) |
very similar to ::write_to() but writes to the model's own existing midi_source, without making it call MidiSource::drop_model(). the caller is a MidiSource that needs to catch up with the state of the model.
Definition at line 1443 of file midi_model.cc.
Transpose notes in a time range by a given number of semitones. Notes will be clamped at 0 and 127 if the transposition would make them exceed that range.
from | Start time. |
end | End time. |
semitones | Number of semitones to transpose by (+ve is higher, -ve is lower). |
Definition at line 1995 of file midi_model.cc.
bool MidiModel::write_section_to | ( | boost::shared_ptr< MidiSource > | source, |
const Glib::Threads::Mutex::Lock & | source_lock, | ||
Evoral::Beats | begin_time = Evoral::MinBeats , |
||
Evoral::Beats | end_time = Evoral::MaxBeats |
||
) |
Write part or all of the model to a MidiSource (i.e. save the model). This is different from manually using read to write to a source in that note off events are written regardless of the track mode. This is so the user can switch a recorded track (with note durations from some instrument) to percussive, save, reload, then switch it back to sustained without destroying the original note durations.
Definition at line 1483 of file midi_model.cc.
bool MidiModel::write_to | ( | boost::shared_ptr< MidiSource > | source, |
const Glib::Threads::Mutex::Lock & | source_lock | ||
) |
Write all of the model to a MidiSource (i.e. save the model). This is different from manually using read to write to a source in that note off events are written regardless of the track mode. This is so the user can switch a recorded track (with note durations from some instrument) to percussive, save, reload, then switch it back to sustained without destroying the original note durations.
Similarly, control events are written without interpolation (as with the `Discrete' mode).
Definition at line 1414 of file midi_model.cc.
|
friend |
Definition at line 313 of file midi_model.h.
|
private |
Definition at line 328 of file midi_model.h.
|
private |
Definition at line 326 of file midi_model.h.
|
private |
Definition at line 325 of file midi_model.h.
|
private |
Definition at line 322 of file midi_model.h.
PBD::Signal0<void> ARDOUR::MidiModel::ContentsChanged |
Definition at line 274 of file midi_model.h.