ardour
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
ARDOUR::Transform Class Reference

#include <transform.h>

Inheritance diagram for ARDOUR::Transform:
ARDOUR::MidiOperator

Classes

struct  Context
 
struct  Operation
 
struct  Program
 
struct  Value
 

Public Types

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

Public Member Functions

 Transform (const Program &prog)
 
Commandoperator() (boost::shared_ptr< ARDOUR::MidiModel > model, Evoral::Beats position, std::vector< Notes > &seqs)
 
std::string name () const
 
- Public Member Functions inherited from ARDOUR::MidiOperator
 MidiOperator ()
 
virtual ~MidiOperator ()
 
virtual Commandoperator() (boost::shared_ptr< ARDOUR::MidiModel >, Evoral::Beats, std::vector< Evoral::Sequence< Evoral::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 51 of file transform.h.

Member Typedef Documentation

Definition at line 53 of file transform.h.

Definition at line 54 of file transform.h.

Definition at line 55 of file transform.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file transform.cc.

Member Function Documentation

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

Implements ARDOUR::MidiOperator.

Definition at line 138 of file transform.h.

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

Definition at line 123 of file transform.cc.

Member Data Documentation

const Program ARDOUR::Transform::_prog
private

Definition at line 141 of file transform.h.


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