CLAM-Development
1.4.0
|
This processing is a particular control-to-data converter that takes in MIDI control events and converts them into a MIDIMelody processing data. More...
#include <MIDI2Melody.hxx>
Public Member Functions | |
MIDI2Melody () | |
virtual | ~MIDI2Melody () |
![]() | |
Control2Data (const Config &c=Config()) | |
virtual | ~Control2Data () |
bool | Do () |
Already implemented Do operation. | |
const ProcessingConfig & | GetConfig () const |
Returns internal configuration method. | |
![]() | |
bool | Configure (const ProcessingConfig &config) |
Configuration change method. | |
void | Start (void) |
Method to turn the object into running state. | |
void | Stop (void) |
Method to put the object out of running state When in execution mode, this method must be called before any further call to Configure() methods. | |
Processing () | |
virtual | ~Processing () |
virtual bool | CanProcessInplace () |
Override this method if your processing cannot process inplace. | |
bool | CanConsumeAndProduce () |
Check that Supervised Do() can be safely called. | |
void | ConsumeAndProduce () |
Acknoledges data tokens in published ports as read/writen by calling Produce() for all registered OutPorts and Consume() to all registered InPorts. | |
std::string | GetExecStateString () const |
bool | IsConfigured () const |
bool | IsRunning () const |
void | RegisterOutPort (OutPortBase *out) |
void | RegisterInPort (InPortBase *in) |
void | RegisterOutControl (OutControlBase *out) |
void | RegisterInControl (InControlBase *in) |
void | SetParent (Processing *p) |
void | SetNetworkBackLink (Network *network) |
virtual bool | ModifiesPortsAndControlsAtConfiguration () |
This method is used to determine if a given processing can change its interface of ports/controls after its construction (i.e. | |
bool | HasInPort (const std::string &name) |
bool | HasOutPort (const std::string &name) |
bool | HasInControl (const std::string &name) |
bool | HasOutControl (const std::string &name) |
InPortBase & | GetInPort (const std::string &name) |
OutPortBase & | GetOutPort (const std::string &name) |
InControlBase & | GetInControl (const std::string &name) |
OutControlBase & | GetOutControl (const std::string &name) |
InPortBase & | GetInPort (unsigned index) |
OutPortBase & | GetOutPort (unsigned index) |
InControlBase & | GetInControl (unsigned index) |
OutControlBase & | GetOutControl (unsigned index) |
unsigned | GetNInPorts () const |
unsigned | GetNOutPorts () const |
unsigned | GetNInControls () const |
unsigned | GetNOutControls () const |
const std::string & | GetConfigErrorMessage () const |
Returns a string describing configuration errors if any. | |
virtual bool | IsSyncSource () const |
Wether the processing is a sync source such as audio i/o device, or an audio callback hook (i.e. | |
virtual bool | SupportsVariableAudioSize () const |
This method reports whether the processing supports dynamic buffer-size host. |
Public Attributes | |
OutPort< MIDIMelody > | mOutput |
Concrete output port of type MIDIMelody. | |
FloatInControl | mTime |
Special input control for keeping trace of the time. |
Protected Member Functions | |
bool | GenerateOutputData (int id, TControlData val) |
Particular implementation of this operation to generate data from enqueued controls. | |
bool | ConcreteConfigure (const ProcessingConfig &c) |
Concrete configuration, we hardcode the number of controls to use and pass it to the configuration of the base Control2Data configuration method. | |
int | FindNote (int key) |
Finds the given note (according to key number) in internal container. | |
void | AddNote (int key, int velocity, int time) |
Adds a note to internal container. | |
void | DeleteNote (int key) |
Deletes note from internal container using MIDI key. | |
void | DeleteNoteFromIndex (int index) |
Deletes note in given position in internal container. | |
void | ModifyVelocity (int key, int newVelocity) |
Modifies midi velocity for given midi note. | |
![]() | |
void | BufferQueueInit (int ncontrols) |
Initialization for queues of control events. | |
void | EnqueueControl (unsigned id, TControlData data) |
Add new control event to internal queue. | |
TControlData | PopControl (unsigned id) |
Read and remove last control event for a given control id. | |
bool | Empty (unsigned id) |
Whether the queue for a particular event is empty or not. | |
IdxList | GetQueues () |
Returns list of controls that are being enqueued. | |
void | ControlCallbackId (int id, TControlData val) |
Callback that will be called when a particular control receives an event and that will be in charge of enqueing the event. | |
const char * | GetClassName () const |
Compulsory method for Processing derived classes. | |
![]() | |
virtual bool | ConcreteStart () |
Processing objects have to redefine this method when starting them implies some internal changes. | |
virtual bool | ConcreteStop () |
Processing objects have to redefine this method when stoping them implies some internal changes. | |
unsigned | BackendBufferSize () |
Given by the NetworkPlayer (backend) if exists. | |
unsigned | BackendSampleRate () |
Given by the NetworkPlayer (backend) if exists. | |
InControlRegistry & | GetInControls () |
Accessor to published Controls manager. | |
OutControlRegistry & | GetOutControls () |
Accessor to published Controls manager. | |
InPortRegistry & | GetInPorts () |
Accessor to published Ports manager. | |
OutPortRegistry & | GetOutPorts () |
Accessor to published Portss manager. | |
bool | AddConfigErrorMessage (const std::string &msg) |
Use this method to append a configuration errors to the processing when implementing ConcreteConfigure. | |
bool | AbleToExecute (void) const |
In debug-mode checks that the processing is configured and started. | |
template<typename ConcreteConfig > | |
void | CopyAsConcreteConfig (ConcreteConfig &concrete, const ProcessingConfig &abstract) const |
Helper template to convert a reference to a ProcessingConfig to the concrete ProcessingConfig specified on the first parameter. | |
void | SetExecState (ExecState state) |
Protected Attributes | |
Array< int > | mKeys |
Contains an array of midi keys active at a given moment. | |
Array< int > | mVelocities |
Array of Midi velocities corresponding to the active midi notes. | |
Array< int > | mBeginTimes |
Array of begin times in milliseconds corresponding to the active midi notes. | |
int | mLastKey |
Last key added to internal container. | |
![]() | |
InControlArray | mInArray |
Array of input control arrays that is initialized in the ConcreteConfigure method. | |
FloatInControl | mStop |
Special input control to be able to stop the process in response to an external control event. | |
Config | mConfig |
Internal configuration. | |
std::vector< TQueue > | mDataQueues |
Vector of queues containing events for each control. | |
Mutex | mDataMutex |
Mutex object for ensuring multithread capabilities. | |
Mutex | mControl2DataDoMutex |
Mutex object for ensuring multithread capabilities. | |
![]() | |
ProcessingComposite * | mpParent |
Pointer to the parent (composite) processing object, or 0. | |
Network * | _network |
The parent network if any. |
Additional Inherited Members | |
![]() | |
typedef Control2DataConfig | Config |
![]() | |
enum | ExecState { Unconfigured = 0, Ready, Running } |
Processing Object possible execution states. More... | |
![]() | |
typedef std::queue< TControlData > | TQueue |
typedef used for convenience | |
typedef std::list< int > | IdxList |
typedef used for convenience |
This processing is a particular control-to-data converter that takes in MIDI control events and converts them into a MIDIMelody processing data.
Definition at line 37 of file MIDI2Melody.hxx.
CLAM::MIDI2Melody::MIDI2Melody | ( | ) |
Definition at line 26 of file MIDI2Melody.cxx.
References ConcreteConfigure().
|
inlinevirtual |
Definition at line 41 of file MIDI2Melody.hxx.
Adds a note to internal container.
Definition at line 114 of file MIDI2Melody.cxx.
References CLAM::Array< T >::AddElem(), mBeginTimes, mKeys, and mVelocities.
Referenced by GenerateOutputData().
|
protectedvirtual |
Concrete configuration, we hardcode the number of controls to use and pass it to the configuration of the base Control2Data configuration method.
Reimplemented from CLAM::Control2Data.
Definition at line 90 of file MIDI2Melody.cxx.
Referenced by MIDI2Melody().
|
protected |
Deletes note from internal container using MIDI key.
Definition at line 121 of file MIDI2Melody.cxx.
References DeleteNoteFromIndex(), and FindNote().
|
protected |
Deletes note in given position in internal container.
Definition at line 126 of file MIDI2Melody.cxx.
References CLAM::Array< T >::DeleteElem(), mBeginTimes, mKeys, and mVelocities.
Referenced by DeleteNote(), and GenerateOutputData().
Finds the given note (according to key number) in internal container.
Definition at line 100 of file MIDI2Melody.cxx.
References mKeys, and CLAM::Array< T >::Size().
Referenced by DeleteNote(), GenerateOutputData(), and ModifyVelocity().
|
protectedvirtual |
Particular implementation of this operation to generate data from enqueued controls.
Implements CLAM::Control2Data.
Definition at line 33 of file MIDI2Melody.cxx.
References AddNote(), CLAM_ASSERT, DeleteNoteFromIndex(), FindNote(), CLAM::OutPort< Token >::GetData(), CLAM::InControl< ControlDataType >::GetLastValue(), mBeginTimes, mLastKey, ModifyVelocity(), mOutput, mTime, mVelocities, and CLAM::DynamicType::UpdateData().
Modifies midi velocity for given midi note.
Definition at line 133 of file MIDI2Melody.cxx.
References FindNote(), and mVelocities.
Referenced by GenerateOutputData().
Array of begin times in milliseconds corresponding to the active midi notes.
Definition at line 80 of file MIDI2Melody.hxx.
Referenced by AddNote(), DeleteNoteFromIndex(), and GenerateOutputData().
Contains an array of midi keys active at a given moment.
Definition at line 76 of file MIDI2Melody.hxx.
Referenced by AddNote(), DeleteNoteFromIndex(), and FindNote().
|
protected |
Last key added to internal container.
Definition at line 82 of file MIDI2Melody.hxx.
Referenced by GenerateOutputData().
OutPort<MIDIMelody> CLAM::MIDI2Melody::mOutput |
Concrete output port of type MIDIMelody.
Definition at line 41 of file MIDI2Melody.hxx.
Referenced by GenerateOutputData().
FloatInControl CLAM::MIDI2Melody::mTime |
Special input control for keeping trace of the time.
Definition at line 46 of file MIDI2Melody.hxx.
Referenced by GenerateOutputData().
Array of Midi velocities corresponding to the active midi notes.
Definition at line 78 of file MIDI2Melody.hxx.
Referenced by AddNote(), DeleteNoteFromIndex(), GenerateOutputData(), and ModifyVelocity().