Plaquette
 
Loading...
Searching...
No Matches
pq::PivotField Class Reference
Inheritance diagram for pq::PivotField:
Collaboration diagram for pq::PivotField:

Public Member Functions

 PivotField ()
 Constructor.
 
virtual float at (float proportion) override
 Returns value at given proportion in [0, 1].
 
virtual float get () override
 Returns value.
 
virtual float put (float value) override
 Pushes value into the unit.
 
void mode (PivotFieldMode mode)
 Sets mode to use.
 
PivotFieldMode mode () const
 Returns mode.
 
void easing (easing_function easing)
 Sets easing function to apply to ramp.
 
void noEasing ()
 Remove easing function (linear/no easing).
 
void rampWidth (float rampWidth)
 Sets ramp width as % of field range.
 
void noRampWidth ()
 Removes ramp width.
 
float rampWidth () const
 Returns ramp width.
 
void rampShift (float rampShift)
 Sets ramp shift in [0, 1] (default: 0.5 = center).
 
float rampShift () const
 Returns ramp shift.
 
void bumpWidth (float bumpWidth)
 Sets bump width as % of field range.
 
float bumpWidth () const
 Returns bump width.
 
void center (float center)
 Sets center of the ramp in [0, 1].
 
float center () const
 Returns center of the ramp.
 
template<typename T >
void populate (T *array, size_t size, bool wrap=false)
 Fills an array with values from this field.
 
virtual void clearEvents ()
 
float seconds () const
 Returns engine time in seconds.
 
uint32_t milliSeconds () const
 Returns engine time in milliseconds.
 
uint64_t microSeconds () const
 Returns engine time in microseconds.
 
unsigned long nSteps () const
 Returns number of engine steps.
 
float sampleRate () const
 Returns engine sample rate.
 
float samplePeriod () const
 Returns enginesample period.
 
 operator float ()
 Object can be used directly to access its value.
 
virtual float mapTo (float toLow, float toHigh)
 Maps value to new range.
 
 operator bool ()
 Operator that allows usage in conditional expressions.
 

Static Public Member Functions

static bool analogToDigital (float f)
 Converts analog (float) value to digital (bool) value.
 
static float digitalToAnalog (bool b)
 Converts digital (bool) value to analog (float) value.
 

Protected Member Functions

float _ramp (float proportion, float value)
 
virtual void begin ()
 
virtual void step ()
 
virtual bool eventTriggered (EventType eventType)
 Returns true iff an event of a certain type has been triggered.
 
virtual void onEvent (EventCallback callback, EventType eventType)
 Registers event callback.
 
Engineengine () const
 Returns the engine that owns this unit.
 

Protected Attributes

PivotFieldMode _mode
 
float _value
 
float _rampWidth
 
float _rampShift
 
float _halfBumpWidth
 
float _center
 
easing_function _easing
 
float _invRampWidth
 
float _rampShiftFactor
 

Member Function Documentation

◆ at()

float pq::PivotField::at ( float  proportion)
overridevirtual

Returns value at given proportion in [0, 1].

Parameters
proportionthe proportion of the field to read
Returns
the value

Implements pq::AbstractField.

◆ bumpWidth()

void pq::PivotField::bumpWidth ( float  bumpWidth)

Sets bump width as % of field range.

Only applies to PIVOT_BUMP and PIVOT_NOTCH modes.

Parameters
bumpWidththe bump width in [0, 1]

◆ center()

void pq::PivotField::center ( float  center)
inline

Sets center of the ramp in [0, 1].

Parameters
centerthe center in [0, 1]

◆ easing()

void pq::PivotField::easing ( easing_function  easing)
inline

Sets easing function to apply to ramp.

Parameters
easingthe easing function

◆ eventTriggered()

virtual bool pq::Unit::eventTriggered ( EventType  eventType)
inlineprotectedvirtualinherited

Returns true iff an event of a certain type has been triggered.

Reimplemented in pq::AbstractWave, pq::Alarm, pq::Metronome, pq::PeakDetector, pq::DigitalSource, pq::Ramp, pq::StreamIn, and pq::TimeSliceField< COUNT >.

◆ get()

virtual float pq::PivotField::get ( )
inlineoverridevirtual

Returns value.

Reimplemented from pq::Chainable.

◆ mapTo()

virtual float pq::Chainable::mapTo ( float  toLow,
float  toHigh 
)
inlinevirtualinherited

Maps value to new range.

This function guarantees that the value is within [toLow, toHigh]. If the unit's values are unbounded, returns get() constrained to [toLow, toHigh].

Reimplemented in pq::Normalizer, pq::DigitalUnit, pq::AnalogSource, pq::AnalogIn, pq::Ramp, pq::StreamIn, and pq::StreamOut.

◆ mode()

void pq::PivotField::mode ( PivotFieldMode  mode)
inline

Sets mode to use.

Parameters
modethe mode to set

◆ populate()

template<typename T >
void pq::AbstractField::populate ( T *  array,
size_t  size,
bool  wrap = false 
)
inlineinherited

Fills an array with values from this field.

Parameters
arraythe array to read into
sizethe size of the array
wrapif true, the array is considered to be a circular buffer that wraps around

◆ put()

virtual float pq::PivotField::put ( float  value)
inlineoverridevirtual

Pushes value into the unit.

Parameters
valuethe value sent to the unit
Returns
the new value of the unit

Reimplemented from pq::Chainable.

◆ rampShift()

void pq::PivotField::rampShift ( float  rampShift)

Sets ramp shift in [0, 1] (default: 0.5 = center).

Parameters
rampShiftthe ramp shift in [0, 1]

◆ rampWidth()

void pq::PivotField::rampWidth ( float  rampWidth)

Sets ramp width as % of field range.

Parameters
rampWidththe ramp width in [0, 1]

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