TimeSliceField generic class.
More...
#include <TimeSliceField.h>
|
| | TimeSliceField (float period) |
| | 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 | period (float period) |
| | Sets period over which the time slice occurs.
|
| |
|
float | period () const |
| | Returns period.
|
| |
|
float | atIndex (size_t index) |
| | Returns value at given index.
|
| |
|
size_t | count () const |
| | Returns count.
|
| |
|
bool | updated () |
| | Returns true if the field has been updated and is ready to be used.
|
| |
|
bool | isFull () |
| | Returns true if the field is full.
|
| |
|
void | reset () |
| | Resets the field.
|
| |
| void | setRolling (bool rolling) |
| | Sets rolling mode.
|
| |
|
void | rolling () |
| | Activates rolling mode.
|
| |
|
void | noRolling () |
| | Deactivates rolling mode.
|
| |
|
bool | isRolling () const |
| | Returns true if rolling mode is active.
|
| |
|
virtual void | onUpdate (EventCallback callback) |
| | Registers event callback on update event.
|
| |
| 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 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.
|
| |
|
|
void | _updateBuffer () |
| |
| virtual void | step () override |
| |
| virtual bool | eventTriggered (EventType eventType) |
| | Returns true iff an event of a certain type has been triggered.
|
| |
|
virtual void | begin () |
| |
|
virtual void | onEvent (EventCallback callback, EventType eventType) |
| | Registers event callback.
|
| |
|
Engine * | engine () const |
| | Returns the engine that owns this unit.
|
| |
|
|
float | _buffer [COUNT] = {} |
| |
|
size_t | _index |
| |
|
size_t | _previousIndex |
| |
|
float | _period |
| |
|
float | _lastValue |
| |
|
float | _currentSumValuesStep |
| |
|
uint16_t | _nValuesStep |
| |
|
q0_32u_t | _phase32 |
| |
|
bool | _full: 1 |
| |
|
bool | _rolling: 1 |
| |
|
bool | _changed: 1 |
| |
|
uint8_t | _unused: 5 |
| |
|
|
static constexpr size_t | LAST_INDEX = COUNT - 1 |
| |
template<size_t COUNT>
class pq::TimeSliceField< COUNT >
TimeSliceField generic class.
- Template Parameters
-
| COUNT | the size of the buffer |
◆ TimeSliceField()
Constructor.
- Parameters
-
| period | the period in seconds |
◆ at()
Returns value at given proportion in [0, 1].
- Parameters
-
| proportion | the proportion of the field to read |
- Returns
- the value
Implements pq::AbstractField.
◆ eventTriggered()
Returns true iff an event of a certain type has been triggered.
Reimplemented from pq::Unit.
◆ get()
◆ mapTo()
| virtual float pq::Chainable::mapTo |
( |
float |
toLow, |
|
|
float |
toHigh |
|
) |
| |
|
inlinevirtualinherited |
◆ period()
Sets period over which the time slice occurs.
- Parameters
-
| period | the new period (in seconds) |
◆ 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
-
| array | the array to read into |
| size | the size of the array |
| wrap | if true, the array is considered to be a circular buffer that wraps around |
◆ put()
Pushes value into the unit.
- Parameters
-
| value | the value sent to the unit |
- Returns
- the new value of the unit
Reimplemented from pq::Chainable.
◆ setRolling()
Sets rolling mode.
- Parameters
-
◆ step()
template<size_t COUNT>
|
|
inlineoverrideprotectedvirtual |
The documentation for this class was generated from the following file: