Ardour  9.0-pre0-582-g084a23a80d
ARDOUR::MidiModel Class Reference

#include <midi_model.h>

Inheritance diagram for ARDOUR::MidiModel:
[legend]

Classes

class  DiffCommand
 
class  NoteDiffCommand
 
class  PatchChangeDiffCommand
 
class  SysExDiffCommand
 
struct  WriteLockImpl
 

Public Types

typedef Temporal::Beats TimeType
 
- Public Types inherited from Evoral::ControlSet
typedef std::map< Parameter, std::shared_ptr< Control > > Controls
 
- Public Types inherited from Evoral::Sequence< Temporal::Beats >
enum  StuckNoteOption
 
enum  NoteOperator
 
enum  OverlapPitchResolution
 
typedef std::shared_ptr< Evoral::Note< Temporal::Beats > > NotePtr
 
typedef std::weak_ptr< Evoral::Note< Temporal::Beats > > WeakNotePtr
 
typedef std::shared_ptr< const Evoral::Note< Temporal::Beats > > constNotePtr
 
typedef std::set< WeakNotePtr, std::owner_less< WeakNotePtr > > WeakActiveNotes
 
typedef std::shared_ptr< Glib::Threads::RWLock::ReaderLock > ReadLock
 
typedef std::shared_ptr< WriteLockImpl > WriteLock
 
typedef std::multiset< NotePtr, EarlierNoteComparator > Notes
 
typedef std::shared_ptr< Event< Temporal::Beats > > SysExPtr
 
typedef std::shared_ptr< const Event< Temporal::Beats > > constSysExPtr
 
typedef std::multiset< SysExPtr, EarlierSysExComparator > SysExes
 
typedef std::shared_ptr< PatchChange< Temporal::Beats > > PatchChangePtr
 
typedef std::shared_ptr< const PatchChange< Temporal::Beats > > constPatchChangePtr
 
typedef std::multiset< PatchChangePtr, EarlierPatchChangeComparator > PatchChanges
 

Public Member Functions

 MidiModel (MidiSource &)
 
 MidiModel (MidiModel const &other, MidiSource &)
 
void create_mapping_stash (Temporal::Beats const &offset)
 
void rebuild_from_mapping_stash (Temporal::Beats const &offset)
 
MidiModel::NoteDiffCommandnew_note_diff_command (const std::string &name="midi edit")
 
MidiModel::SysExDiffCommandnew_sysex_diff_command (const std::string &name="midi edit")
 
MidiModel::PatchChangeDiffCommandnew_patch_change_diff_command (const std::string &name="midi edit")
 
void apply_diff_command_as_commit (PBD::HistoryOwner &, PBD::Command *cmd)
 
void apply_diff_command_as_commit (PBD::HistoryOwner *history, PBD::Command *cmd)
 
void apply_diff_command_as_subcommand (PBD::HistoryOwner &, PBD::Command *cmd)
 
void apply_diff_command_only (PBD::Command *cmd)
 
bool sync_to_source (const Source::WriterLock &source_lock)
 
bool write_to (std::shared_ptr< MidiSource > source, const Source::WriterLock &source_lock)
 
bool write_section_to (std::shared_ptr< MidiSource > source, const Source::WriterLock &source_lock, Temporal::Beats begin=Temporal::Beats(), Temporal::Beats end=std::numeric_limits< Temporal::Beats >::max(), bool offset_events=false)
 
XMLNodeget_state () const
 
int set_state (const XMLNode &)
 
std::shared_ptr< Evoral::Note< TimeType > > find_note (NotePtr)
 
PatchChangePtr find_patch_change (Evoral::event_id_t)
 
std::shared_ptr< Evoral::Note< TimeType > > find_note (Evoral::event_id_t)
 
std::shared_ptr< Evoral::Event< TimeType > > find_sysex (Evoral::event_id_t)
 
InsertMergePolicy insert_merge_policy () const
 
void set_insert_merge_policy (InsertMergePolicy)
 
std::shared_ptr< Evoral::Controlcontrol_factory (const Evoral::Parameter &id)
 
void insert_silence_at_start (TimeType)
 
void transpose (NoteDiffCommand *, const NotePtr, int)
 
void track_state (timepos_t const &when, MidiStateTracker &) const
 
void render (const ReadLock &lock, Evoral::EventSink< Temporal::Beats > &dst)
 
WriteLock edit_lock ()
 
- Public Member Functions inherited from ARDOUR::AutomatableSequence< Temporal::Beats >
 AutomatableSequence (Session &s, Temporal::TimeDomainProvider const &tdp)
 
 AutomatableSequence (const AutomatableSequence< Temporal::Beats > &other)
 
- Public Member Functions inherited from ARDOUR::Automatable
 Automatable (Session &, Temporal::TimeDomainProvider const &)
 
 Automatable (const Automatable &other)
 
virtual ~Automatable ()
 
virtual void automatables (PBD::ControllableSet &) const
 
std::shared_ptr< AutomationControlautomation_control (PBD::ID const &id) const
 
virtual std::shared_ptr< AutomationControlautomation_control_recurse (PBD::ID const &id) const
 
std::shared_ptr< AutomationControlautomation_control (const Evoral::Parameter &id)
 
std::shared_ptr< AutomationControlautomation_control (const Evoral::Parameter &id, bool create_if_missing)
 
std::shared_ptr< const AutomationControlautomation_control (const Evoral::Parameter &id) const
 
virtual void add_control (std::shared_ptr< Evoral::Control >)
 
virtual bool find_next_event (Temporal::timepos_t const &start, Temporal::timepos_t const &end, Evoral::ControlEvent &ev, bool only_active=true) const
 
void clear_controls ()
 
virtual void non_realtime_locate (samplepos_t now)
 
virtual void non_realtime_transport_stop (samplepos_t now, bool flush)
 
virtual void automation_run (samplepos_t, pframes_t, bool only_active=false)
 
virtual std::string describe_parameter (Evoral::Parameter param)
 
AutoState get_parameter_automation_state (Evoral::Parameter param)
 
virtual void set_parameter_automation_state (Evoral::Parameter param, AutoState)
 
void protect_automation ()
 
const std::set< Evoral::Parameter > & what_can_be_automated () const
 
std::vector< Evoral::Parameterall_automatable_params () const
 
void what_has_existing_automation (std::set< Evoral::Parameter > &) const
 
int set_automation_xml_state (const XMLNode &, Evoral::Parameter default_param)
 
XMLNodeget_automation_xml_state () const
 
void start_domain_bounce (Temporal::DomainBounceInfo &)
 
void finish_domain_bounce (Temporal::DomainBounceInfo &)
 
- Public Member Functions inherited from Evoral::ControlSet
 ControlSet ()
 
 ControlSet (const ControlSet &)
 
virtual ~ControlSet ()
 
std::shared_ptr< Controlcontrol (const Parameter &id, bool create_if_missing=false)
 
std::shared_ptr< const Controlcontrol (const Parameter &id) const
 
Controlscontrols ()
 
const Controlscontrols () const
 
virtual bool controls_empty () const
 
void what_has_data (std::set< Parameter > &) const
 
Glib::Threads::Mutex & control_lock () const
 
void start_domain_bounce (Temporal::DomainBounceInfo &)
 
void finish_domain_bounce (Temporal::DomainBounceInfo &)
 
- Public Member Functions inherited from Temporal::TimeDomainSwapper
virtual ~TimeDomainSwapper ()
 
- Public Member Functions inherited from PBD::Destructible
virtual ~Destructible ()
 
virtual void drop_references ()
 
- Public Member Functions inherited from ARDOUR::Slavable
 Slavable ()
 
virtual ~Slavable ()
 
XMLNodeget_state () const
 
int set_state (XMLNode const &, int)
 
virtual void assign (std::shared_ptr< VCA >)
 
void unassign (std::shared_ptr< VCA >)
 
std::vector< std::shared_ptr< VCA > > masters (VCAManager *) const
 
bool assigned_to (VCAManager *, std::shared_ptr< VCA >) const
 
- Public Member Functions inherited from Temporal::TimeDomainProvider
 TimeDomainProvider ()
 
 TimeDomainProvider (TimeDomain td)
 
 TimeDomainProvider (TimeDomain td, TimeDomainProvider const &p)
 
 TimeDomainProvider (TimeDomainProvider const &other)
 
 TimeDomainProvider (TimeDomainProvider const &parnt, bool)
 
virtual ~TimeDomainProvider ()
 
XMLNodeget_state () const
 
int set_state (const XMLNode &, int version)
 
TimeDomainProvideroperator= (TimeDomainProvider const &other)
 
TimeDomain time_domain () const
 
bool has_own_time_domain () const
 
void clear_time_domain ()
 
void set_time_domain (TimeDomain td)
 
TimeDomainProvider const * time_domain_parent () const
 
bool has_time_domain_parent () const
 
void clear_time_domain_parent ()
 
void set_time_domain_parent (TimeDomainProvider const &p)
 
virtual void time_domain_changed ()
 
- Public Member Functions inherited from Evoral::Sequence< Temporal::Beats >
 Sequence (const TypeMap &type_map)
 
 Sequence (const Sequence< Temporal::Beats > &other)
 
virtual ReadLock read_lock () const
 
virtual WriteLock write_lock ()
 
void clear ()
 
void start_write ()
 
bool writing () const
 
void end_write (StuckNoteOption, Temporal::Beats when=Temporal::Beats())
 
void append (const Event< Temporal::Beats > &ev, Evoral::event_id_t evid)
 
const TypeMaptype_map () const
 
size_t n_notes () const
 
bool empty () const
 
Notesnotes ()
 
const Notesnotes () const
 
void get_notes (Notes &, NoteOperator, uint8_t val, int chan_mask=0) const
 
void remove_overlapping_notes ()
 
void trim_overlapping_notes ()
 
void remove_duplicate_notes ()
 
bool overlapping_pitches_accepted () const
 
void overlapping_pitches_accepted (bool yn)
 
OverlapPitchResolution overlap_pitch_resolution () const
 
void set_overlap_pitch_resolution (OverlapPitchResolution opr)
 
void set_notes (const typename Sequence< Temporal::Beats >::Notes &n)
 
SysExessysexes ()
 
const SysExessysexes () const
 
PatchChangespatch_changes ()
 
const PatchChangespatch_changes () const
 
const_iterator begin (Temporal::Beats t=Temporal::Beats(), bool force_discrete=false, const std::set< Evoral::Parameter > &f=std::set< Evoral::Parameter >(), WeakActiveNotes const *active_notes=0) const
 
const const_iteratorend () const
 
void dump (std::ostream &, const_iterator x, uint32_t limit=0) const
 
Notes::const_iterator note_lower_bound (Temporal::Beats t) const
 
Notes::iterator note_lower_bound (Temporal::Beats t)
 
PatchChanges::const_iterator patch_change_lower_bound (Temporal::Beats t) const
 
PatchChanges::iterator patch_change_lower_bound (Temporal::Beats t)
 
SysExes::const_iterator sysex_lower_bound (Temporal::Beats t) const
 
SysExes::iterator sysex_lower_bound (Temporal::Beats t)
 
bool control_to_midi_event (std::shared_ptr< Event< Temporal::Beats > > &ev, const ControlIterator &iter) const
 
bool edited () const
 
void set_edited (bool yn)
 
bool contains (const NotePtr &ev) const
 
bool add_note_unlocked (const NotePtr note, void *arg=0)
 
void remove_note_unlocked (const constNotePtr note)
 
void add_patch_change_unlocked (const PatchChangePtr)
 
void remove_patch_change_unlocked (const constPatchChangePtr)
 
void add_sysex_unlocked (const SysExPtr)
 
void remove_sysex_unlocked (const SysExPtr)
 
uint8_t lowest_note () const
 
uint8_t highest_note () const
 
Temporal::Beats duration () const
 
void set_duration (Temporal::Beats const &)
 

Public Attributes

PBD::Signal< void()> ContentsChanged
 
PBD::Signal< void(Temporal::timecnt_t)> ContentsShifted
 
- Public Attributes inherited from ARDOUR::Automatable
PBD::Signal< void()> AutomationStateChanged
 
- Public Attributes inherited from PBD::Destructible
PBD::Signal< void()> Destroyed
 
PBD::Signal< void()> DropReferences
 
- Public Attributes inherited from ARDOUR::Slavable
PBD::Signal< void(std::shared_ptr< VCA >, bool)> AssignmentChange
 
- Public Attributes inherited from Temporal::TimeDomainProvider
PBD::Signal< void()> TimeDomainChanged
 

Protected Member Functions

int resolve_overlaps_unlocked (const NotePtr, void *arg=0)
 
MidiSourcemidi_source () const
 
- 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 &)
 
SlavableAutomationControlList slavables () const
 
- Protected Member Functions inherited from Temporal::TimeDomainProvider
void listen ()
 
- Protected Member Functions inherited from Evoral::Sequence< Temporal::Beats >
Pitchespitches (uint8_t chan)
 
const Pitchespitches (uint8_t chan) const
 

Private Types

typedef std::map< void *, superclock_tTempoMappingStash
 

Private Member Functions

void source_interpolation_changed (Evoral::Parameter const &, AutomationList::InterpolationStyle)
 
void source_automation_state_changed (Evoral::Parameter const &, AutoState)
 
void control_list_interpolation_changed (Evoral::Parameter const &, AutomationList::InterpolationStyle)
 
void automation_list_automation_state_changed (Evoral::Parameter const &, AutoState)
 
void control_list_marked_dirty ()
 

Private Attributes

PBD::ScopedConnectionList _midi_source_connections
 
MidiSource_midi_source
 
InsertMergePolicy _insert_merge_policy
 
TempoMappingStash tempo_mapping_stash
 

Friends

class NoteDiffCommand
 
class SysExDiffCommand
 
class PatchChangeDiffCommand
 
class DeltaCommand
 

Additional Inherited Members

- Static Public Member Functions inherited from ARDOUR::Automatable
static void find_next_ac_event (std::shared_ptr< AutomationControl >, Temporal::timepos_t const &start, Temporal::timepos_t const &end, Evoral::ControlEvent &ev)
 
static void find_prev_ac_event (std::shared_ptr< AutomationControl >, Temporal::timepos_t const &start, Temporal::timepos_t const &end, Evoral::ControlEvent &ev)
 
- Static Public Member Functions inherited from Evoral::Sequence< Temporal::Beats >
static bool note_time_comparator (const std::shared_ptr< const Note< Temporal::Beats > > &a, const std::shared_ptr< const Note< Temporal::Beats > > &b)
 
- Static Public Attributes inherited from ARDOUR::Automatable
static bool skip_saving_automation
 
static const std::string xml_node_name
 
- Static Public Attributes inherited from ARDOUR::Slavable
static std::string xml_node_name
 
static PBD::Signal< void(VCAManager *)> Assign
 
- Protected Types inherited from Evoral::Sequence< Temporal::Beats >
typedef std::multiset< NotePtr, NoteNumberComparator > Pitches
 
- Protected Attributes inherited from ARDOUR::Automatable
Session_a_session
 
SerializedRCUManager< AutomationControlList_automated_controls
 
std::set< Evoral::Parameter_can_automate_list
 
samplepos_t _last_automation_snapshot
 
- Protected Attributes inherited from Evoral::ControlSet
Glib::Threads::Mutex _control_lock
 
Controls _controls
 
PBD::ScopedConnectionList _list_connections
 
- Protected Attributes inherited from Evoral::Sequence< Temporal::Beats >
bool _edited
 
bool _overlapping_pitches_accepted
 
OverlapPitchResolution _overlap_pitch_resolution
 
Glib::Threads::RWLock _lock
 
bool _writing
 

Detailed Description

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 62 of file midi_model.h.

Member Typedef Documentation

◆ TempoMappingStash

typedef std::map<void*,superclock_t> ARDOUR::MidiModel::TempoMappingStash
private

Definition at line 374 of file midi_model.h.

◆ TimeType

Definition at line 64 of file midi_model.h.

Constructor & Destructor Documentation

◆ MidiModel() [1/2]

ARDOUR::MidiModel::MidiModel ( MidiSource )

◆ MidiModel() [2/2]

ARDOUR::MidiModel::MidiModel ( MidiModel const &  other,
MidiSource  
)

Member Function Documentation

◆ apply_diff_command_as_commit() [1/2]

void ARDOUR::MidiModel::apply_diff_command_as_commit ( PBD::HistoryOwner ,
PBD::Command cmd 
)

Apply a command.

Ownership of cmd is taken, it must not be deleted by the caller. This STARTS and COMMITS an undo command. The command will constitute one item on the undo stack.

◆ apply_diff_command_as_commit() [2/2]

void ARDOUR::MidiModel::apply_diff_command_as_commit ( PBD::HistoryOwner history,
PBD::Command cmd 
)
inline

Definition at line 284 of file midi_model.h.

◆ apply_diff_command_as_subcommand()

void ARDOUR::MidiModel::apply_diff_command_as_subcommand ( PBD::HistoryOwner ,
PBD::Command cmd 
)

Add 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 be incorporated into the current command.

◆ apply_diff_command_only()

void ARDOUR::MidiModel::apply_diff_command_only ( PBD::Command cmd)

Apply the midi diff, but without any effect on undo

Ownership of cmd is not changed.

◆ automation_list_automation_state_changed()

void ARDOUR::MidiModel::automation_list_automation_state_changed ( Evoral::Parameter const &  ,
AutoState   
)
privatevirtual

Reimplemented from ARDOUR::Automatable.

◆ control_factory()

std::shared_ptr<Evoral::Control> ARDOUR::MidiModel::control_factory ( const Evoral::Parameter id)
virtual

Reimplemented from ARDOUR::Automatable.

◆ control_list_interpolation_changed()

void ARDOUR::MidiModel::control_list_interpolation_changed ( Evoral::Parameter const &  ,
AutomationList::InterpolationStyle   
)
privatevirtual

Reimplemented from Evoral::ControlSet.

◆ control_list_marked_dirty()

void ARDOUR::MidiModel::control_list_marked_dirty ( )
privatevirtual

◆ create_mapping_stash()

void ARDOUR::MidiModel::create_mapping_stash ( Temporal::Beats const &  offset)

◆ edit_lock()

WriteLock ARDOUR::MidiModel::edit_lock ( )

◆ find_note() [1/2]

std::shared_ptr<Evoral::Note<TimeType> > ARDOUR::MidiModel::find_note ( Evoral::event_id_t  )

◆ find_note() [2/2]

std::shared_ptr<Evoral::Note<TimeType> > ARDOUR::MidiModel::find_note ( NotePtr  )

◆ find_patch_change()

PatchChangePtr ARDOUR::MidiModel::find_patch_change ( Evoral::event_id_t  )

◆ find_sysex()

std::shared_ptr<Evoral::Event<TimeType> > ARDOUR::MidiModel::find_sysex ( Evoral::event_id_t  )

◆ get_state()

XMLNode& ARDOUR::MidiModel::get_state ( ) const

◆ insert_merge_policy()

InsertMergePolicy ARDOUR::MidiModel::insert_merge_policy ( ) const

◆ insert_silence_at_start()

void ARDOUR::MidiModel::insert_silence_at_start ( TimeType  )

◆ midi_source()

MidiSource& ARDOUR::MidiModel::midi_source ( ) const
inlineprotected

Definition at line 342 of file midi_model.h.

◆ new_note_diff_command()

MidiModel::NoteDiffCommand* ARDOUR::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_diff_command_* is called and ownership is taken.

◆ new_patch_change_diff_command()

MidiModel::PatchChangeDiffCommand* ARDOUR::MidiModel::new_patch_change_diff_command ( const std::string &  name = "midi edit")

Start a new PatchChangeDiff command

◆ new_sysex_diff_command()

MidiModel::SysExDiffCommand* ARDOUR::MidiModel::new_sysex_diff_command ( const std::string &  name = "midi edit")

Start a new SysExDiff command

◆ rebuild_from_mapping_stash()

void ARDOUR::MidiModel::rebuild_from_mapping_stash ( Temporal::Beats const &  offset)

◆ render()

void ARDOUR::MidiModel::render ( const ReadLock lock,
Evoral::EventSink< Temporal::Beats > &  dst 
)

◆ resolve_overlaps_unlocked()

int ARDOUR::MidiModel::resolve_overlaps_unlocked ( const  NotePtr,
void *  arg = 0 
)
protectedvirtual

◆ set_insert_merge_policy()

void ARDOUR::MidiModel::set_insert_merge_policy ( InsertMergePolicy  )

◆ set_state()

int ARDOUR::MidiModel::set_state ( const XMLNode )
inline

Definition at line 313 of file midi_model.h.

◆ source_automation_state_changed()

void ARDOUR::MidiModel::source_automation_state_changed ( Evoral::Parameter const &  ,
AutoState   
)
private

◆ source_interpolation_changed()

void ARDOUR::MidiModel::source_interpolation_changed ( Evoral::Parameter const &  ,
AutomationList::InterpolationStyle   
)
private

◆ sync_to_source()

bool ARDOUR::MidiModel::sync_to_source ( const Source::WriterLock source_lock)

◆ track_state()

void ARDOUR::MidiModel::track_state ( timepos_t const &  when,
MidiStateTracker  
) const

◆ transpose()

void ARDOUR::MidiModel::transpose ( NoteDiffCommand ,
const  NotePtr,
int   
)

◆ write_section_to()

bool ARDOUR::MidiModel::write_section_to ( std::shared_ptr< MidiSource source,
const Source::WriterLock source_lock,
Temporal::Beats  begin = Temporal::Beats(),
Temporal::Beats  end = std::numeric_limits< Temporal::Beats >::max(),
bool  offset_events = false 
)

◆ write_to()

bool ARDOUR::MidiModel::write_to ( std::shared_ptr< MidiSource source,
const Source::WriterLock source_lock 
)

Friends And Related Function Documentation

◆ DeltaCommand

friend class DeltaCommand
friend

Definition at line 360 of file midi_model.h.

◆ NoteDiffCommand

friend class NoteDiffCommand
friend

Definition at line 338 of file midi_model.h.

◆ PatchChangeDiffCommand

friend class PatchChangeDiffCommand
friend

Definition at line 340 of file midi_model.h.

◆ SysExDiffCommand

friend class SysExDiffCommand
friend

Definition at line 339 of file midi_model.h.

Member Data Documentation

◆ _insert_merge_policy

InsertMergePolicy ARDOUR::MidiModel::_insert_merge_policy
private

Definition at line 372 of file midi_model.h.

◆ _midi_source

MidiSource& ARDOUR::MidiModel::_midi_source
private

Definition at line 371 of file midi_model.h.

◆ _midi_source_connections

PBD::ScopedConnectionList ARDOUR::MidiModel::_midi_source_connections
private

Definition at line 369 of file midi_model.h.

◆ ContentsChanged

PBD::Signal<void()> ARDOUR::MidiModel::ContentsChanged

Definition at line 315 of file midi_model.h.

◆ ContentsShifted

PBD::Signal<void(Temporal::timecnt_t)> ARDOUR::MidiModel::ContentsShifted

Definition at line 316 of file midi_model.h.

◆ tempo_mapping_stash

TempoMappingStash ARDOUR::MidiModel::tempo_mapping_stash
private

Definition at line 375 of file midi_model.h.


The documentation for this class was generated from the following file: