#include <Labeller.h>

Inheritance diagram for Labeller:
Inheritance graph
Collaboration diagram for Labeller:
Collaboration graph

Public Types

enum  ValueType {
  ValueNone, ValueFromSimpleCounter, ValueFromCyclicalCounter, ValueFromTwoLevelCounter,
  ValueFromFrameNumber, ValueFromRealTime, ValueFromDurationFromPrevious, ValueFromDurationToNext,
  ValueFromTempoFromPrevious, ValueFromTempoToNext, ValueFromExistingNeighbour, ValueFromLabel
}
 
enum  Application { AppliesToThisEvent, AppliesToPreviousEvent }
 
typedef std::map< ValueType, QString > TypeNameMap
 
typedef std::pair< Application, EventRelabelling
 
typedef std::pair< Application, EventRevaluing
 

Public Member Functions

 Labeller (ValueType type=ValueNone)
 
 Labeller (const Labeller &l)
 
virtual ~Labeller ()
 
TypeNameMap getTypeNames () const
 
ValueType getType () const
 
void setType (ValueType type)
 
int getCounterValue () const
 
void setCounterValue (int v)
 
int getSecondLevelCounterValue () const
 
void setSecondLevelCounterValue (int v)
 
int getCounterCycleSize () const
 
void setCounterCycleSize (int s)
 
void setSampleRate (sv_samplerate_t rate)
 
void resetCounters ()
 
void incrementCounter ()
 
Relabelling label (Event e, const Event *prev=nullptr)
 Return a labelled event based on the given event, previous event if supplied, and internal labeller state. More...
 
Revaluing revalue (Event e, const Event *prev=nullptr)
 Return an event with a value following the labelling scheme, based on the given event, previous event if supplied, and internal labeller state. More...
 
CommandlabelAll (int editableId, MultiSelection *ms, const EventVector &allEvents)
 Relabel all events in the given event vector that lie within the given multi-selection, according to the labelling properties of this labeller. More...
 
Commandsubdivide (int editableId, MultiSelection *ms, const EventVector &allEvents, int n)
 For each event in the given event vector (except the last), if that event lies within the given multi-selection, add n-1 new events at equally spaced intervals between it and the following event. More...
 
Commandwinnow (int editableId, MultiSelection *ms, const EventVector &allEvents, int n)
 The opposite of subdivide. More...
 
bool requiresPrevPoint () const
 
bool actingOnPrevEvent () const
 

Protected Member Functions

float getValueFor (Event p, const Event *prev)
 

Protected Attributes

ValueType m_type
 
int m_counter
 
int m_counter2
 
int m_cycle
 
int m_dp
 
sv_samplerate_t m_rate
 

Detailed Description

Definition at line 29 of file Labeller.h.

Member Typedef Documentation

typedef std::map<ValueType, QString> Labeller::TypeNameMap

Definition at line 88 of file Labeller.h.

Definition at line 161 of file Labeller.h.

typedef std::pair<Application, Event> Labeller::Revaluing

Definition at line 162 of file Labeller.h.

Member Enumeration Documentation

Enumerator
ValueNone 
ValueFromSimpleCounter 
ValueFromCyclicalCounter 
ValueFromTwoLevelCounter 
ValueFromFrameNumber 
ValueFromRealTime 
ValueFromDurationFromPrevious 
ValueFromDurationToNext 
ValueFromTempoFromPrevious 
ValueFromTempoToNext 
ValueFromExistingNeighbour 
ValueFromLabel 

Definition at line 34 of file Labeller.h.

Enumerator
AppliesToThisEvent 
AppliesToPreviousEvent 

Definition at line 157 of file Labeller.h.

Constructor & Destructor Documentation

Labeller::Labeller ( ValueType  type = ValueNone)
inline

Definition at line 69 of file Labeller.h.

Labeller::Labeller ( const Labeller l)
inline

Definition at line 77 of file Labeller.h.

virtual Labeller::~Labeller ( )
inlinevirtual

Definition at line 86 of file Labeller.h.

Member Function Documentation

ValueType Labeller::getType ( ) const
inline

Definition at line 118 of file Labeller.h.

References m_type.

void Labeller::setType ( ValueType  type)
inline

Definition at line 119 of file Labeller.h.

References m_type.

int Labeller::getCounterValue ( ) const
inline

Definition at line 121 of file Labeller.h.

References m_counter.

void Labeller::setCounterValue ( int  v)
inline

Definition at line 122 of file Labeller.h.

References m_counter.

int Labeller::getSecondLevelCounterValue ( ) const
inline

Definition at line 124 of file Labeller.h.

References m_counter2.

void Labeller::setSecondLevelCounterValue ( int  v)
inline

Definition at line 125 of file Labeller.h.

References m_counter2.

int Labeller::getCounterCycleSize ( ) const
inline

Definition at line 127 of file Labeller.h.

References m_cycle.

void Labeller::setCounterCycleSize ( int  s)
inline

Definition at line 128 of file Labeller.h.

References m_counter, m_cycle, and m_dp.

void Labeller::setSampleRate ( sv_samplerate_t  rate)
inline

Definition at line 138 of file Labeller.h.

References m_rate.

void Labeller::resetCounters ( )
inline

Definition at line 140 of file Labeller.h.

References m_counter, m_counter2, and m_cycle.

void Labeller::incrementCounter ( )
inline

Definition at line 146 of file Labeller.h.

References m_counter, m_counter2, m_cycle, m_type, ValueFromCyclicalCounter, and ValueFromTwoLevelCounter.

Referenced by getValueFor(), and label().

Relabelling Labeller::label ( Event  e,
const Event prev = nullptr 
)
inline

Return a labelled event based on the given event, previous event if supplied, and internal labeller state.

The returned event replaces either the event provided or the previous event, depending on the Application value in the returned pair.

Definition at line 171 of file Labeller.h.

References actingOnPrevEvent(), AppliesToPreviousEvent, AppliesToThisEvent, Event::getFrame(), Event::getLabel(), getValueFor(), incrementCounter(), m_counter, m_counter2, m_type, ValueFromFrameNumber, ValueFromTwoLevelCounter, ValueNone, and Event::withLabel().

Referenced by labelAll().

Revaluing Labeller::revalue ( Event  e,
const Event prev = nullptr 
)
inline

Return an event with a value following the labelling scheme, based on the given event, previous event if supplied, and internal labeller state.

The returned event replaces either the event provided or the previous event, depending on the Application value in the returned pair.

Definition at line 203 of file Labeller.h.

References actingOnPrevEvent(), AppliesToPreviousEvent, AppliesToThisEvent, Event::getValue(), getValueFor(), m_type, ValueFromExistingNeighbour, and Event::withValue().

Command* Labeller::labelAll ( int  editableId,
MultiSelection ms,
const EventVector allEvents 
)
inline

Relabel all events in the given event vector that lie within the given multi-selection, according to the labelling properties of this labeller.

Return a command that has been executed but not yet added to the history. The id must be that of a type that can be retrieved from the AnyById store and dynamic_cast to EventEditable.

Definition at line 232 of file Labeller.h.

References AppliesToThisEvent, Selection::contains(), MultiSelection::getContainingSelection(), and label().

Command* Labeller::subdivide ( int  editableId,
MultiSelection ms,
const EventVector allEvents,
int  n 
)
inline

For each event in the given event vector (except the last), if that event lies within the given multi-selection, add n-1 new events at equally spaced intervals between it and the following event.

Return a command that has been executed but not yet added to the history. The id must be that of a type that can be retrieved from the AnyById store and dynamic_cast to EventEditable.

Definition at line 279 of file Labeller.h.

References Selection::contains(), MultiSelection::getContainingSelection(), Event::getFrame(), Event::getLabel(), Event::withFrame(), and Event::withLabel().

Command* Labeller::winnow ( int  editableId,
MultiSelection ms,
const EventVector allEvents,
int  n 
)
inline

The opposite of subdivide.

Given an event vector, a multi-selection, and a number n, remove all but every nth event from the vector within the extents of the multi-selection. Return a command that has been executed but not yet added to the history. The id must be that of a type that can be retrieved from the AnyById store and dynamic_cast to EventEditable.

Definition at line 330 of file Labeller.h.

References Selection::contains(), and MultiSelection::getContainingSelection().

bool Labeller::requiresPrevPoint ( ) const
inline
bool Labeller::actingOnPrevEvent ( ) const
inline

Definition at line 371 of file Labeller.h.

References m_type, ValueFromDurationToNext, and ValueFromTempoToNext.

Referenced by label(), and revalue().

Member Data Documentation

ValueType Labeller::m_type
protected
int Labeller::m_counter
protected
int Labeller::m_counter2
protected
int Labeller::m_cycle
protected
int Labeller::m_dp
protected

Definition at line 454 of file Labeller.h.

Referenced by getValueFor(), and setCounterCycleSize().

sv_samplerate_t Labeller::m_rate
protected

Definition at line 455 of file Labeller.h.

Referenced by getValueFor(), and setSampleRate().


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