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

#include <transform.h>

Inheritance diagram for ARDOUR::Transform:
[legend]

Classes

struct  Context
 
struct  Operation
 
struct  Program
 
struct  Value
 

Public Types

typedef Evoral::Sequence< Temporal::Beats >::NotePtr NotePtr
 
typedef Evoral::Sequence< Temporal::Beats >::Notes Notes
 
typedef ARDOUR::MidiModel::NoteDiffCommand::Property Property
 

Public Member Functions

 Transform (const Program &prog)
 
PBD::Commandoperator() (std::shared_ptr< ARDOUR::MidiModel > model, Temporal::Beats position, std::vector< Notes > &seqs)
 
std::string name () const
 
- Public Member Functions inherited from ARDOUR::MidiOperator
 MidiOperator ()
 
virtual ~MidiOperator ()
 
virtual PBD::Commandoperator() (std::shared_ptr< ARDOUR::MidiModel >, Temporal::Beats, std::vector< Evoral::Sequence< Temporal::Beats >::Notes > &)=0
 

Private Attributes

const Program _prog
 

Detailed Description

Transform notes with a user-defined transformation.

This is essentially an interpreter for a simple concatenative note transformation language (as an AST only, no source code). A "program" calculates a note property value from operations on literal values, and/or values from the current or previous note in the sequence. This allows simple things like "set all notes' velocity to 64" or transitions over time like "set velocity to the previous note's velocity + 10".

The language is forth-like: everything is on a stack, operations pop their arguments from the stack and push their result back on to it.

This is a sweet spot between simplicity and power, it should be simple to use this (with perhaps some minor extensions) to do most "linear-ish" transformations, though it could be extended to have random access and more special values as the need arises.

Definition at line 50 of file transform.h.

Member Typedef Documentation

◆ NotePtr

◆ Notes

◆ Property

Constructor & Destructor Documentation

◆ Transform()

ARDOUR::Transform::Transform ( const Program prog)

Member Function Documentation

◆ name()

std::string ARDOUR::Transform::name ( ) const
inlinevirtual

Implements ARDOUR::MidiOperator.

Definition at line 137 of file transform.h.

◆ operator()()

PBD::Command* ARDOUR::Transform::operator() ( std::shared_ptr< ARDOUR::MidiModel model,
Temporal::Beats  position,
std::vector< Notes > &  seqs 
)

Member Data Documentation

◆ _prog

const Program ARDOUR::Transform::_prog
private

Definition at line 140 of file transform.h.


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