#include <iso_synth_rhythm_unit.h>
Inherits iso::synth::InputUnit.
Inheritance diagram for iso::synth::RhythmUnit:
Public Member Functions | |
RhythmUnit () | |
default constructor | |
RhythmUnit (const String &pName) | |
parameter based contructor | |
RhythmUnit (unsigned int pChannelCount) | |
parameter based contructor | |
RhythmUnit (const String &pName, unsigned int pChannelCount) | |
parameter based contructor | |
RhythmUnit (unsigned int pFrameCount, unsigned int pChannelCount, unsigned int pRate) throw (SynthException) | |
parameter based contructor | |
RhythmUnit (const String &pName, unsigned int pFrameCount, unsigned int pChannelCount, unsigned int pRate) throw (SynthException) | |
name and parameter based contructor | |
RhythmUnit (const RhythmUnit &pUnit) | |
copy constructor | |
RhythmUnit (const String &pName, const RhythmUnit &pUnit) | |
name & copy constructor | |
RhythmUnit (const data::Values &pValues) throw (SynthException) | |
values based constructor | |
~RhythmUnit () | |
destructor | |
virtual void | process (Buffer *pBuffer) throw (SynthException) |
processes buffer | |
virtual String | info (bool pPropagate=false, bool pShowPorts=true) const |
obtain textual unit information | |
void | setInterval (Frame pIntervals) |
set multiple intervals | |
void | setRaster (Frame pRaster) |
set raster as a frame | |
void | setRasterLength (Frame pRasterLength) |
set all raster lengths at once | |
void | setCycleLock (Frame pCycleLock) |
set the cycle lock flag | |
Static Public Attributes | |
static const String | sClassName |
default name | |
Protected Member Functions | |
void | init () |
initializes wavetable and control ports | |
Protected Attributes | |
ControlPort * | mAmplitude |
pulse amplitude control port | |
Frame | mIntervalCounter |
interval counter (intervals in milisecs) | |
sample | mMili2FrameScale |
milisecs to frame scale factor | |
sample | mSampleDuration |
frame to milisecs scale factor | |
QVector< sample > | mIntervals |
intervals | |
QVector< sample > | mNextIntervals |
next intervals | |
QVector< Channel * > | mRasters |
current raster storage - vector:channels frame groove data | |
QVector< unsigned int > | mRasterLengths |
current raster lengths | |
QVector< Channel * > | mNextRasters |
next rasters | |
QVector< bool > | mCycleLock |
cycle lock flag. "true" = will only apply a new raster at the begin of a cycle. "false" = new rasters allowed on every beat | |
Channel * | mTempRaster |
temp raster switching pointer; | |
QVector< unsigned int > | mNextRasterLenghts |
next raster lengths | |
QVector< bool > | mIntervalHasChanged |
interval has changed | |
QVector< bool > | mRasterHasChanged |
flags that inform of the receival of a new raster | |
QVector< bool > | mRasterLenHasChanged |
flags that inform of the change in raster lengths | |
QVector< unsigned int > | mRasterCounter |
interval counter (intervals in milisecs) | |
Static Protected Attributes | |
static unsigned int | sUnitCount |
total number of units created so far | |
Friends | |
std::ostream & | operator<< (std::ostream &pOstream, const RhythmUnit &pUnit) |
print unit information |
class
This unit creates sample wide pulses that follow a rhythm raster.
These pulses are not bandlimited.
The main application of this unit is not in generating sound but in triggering events that need to be sample accurate.
It therefore acts as a complement to the normal event system.
This unit can be connected to a PulseToValue unit, which transforms the pulses into values that can for example be used to adjust control ports.
It also serves as a grain trigger system of the GranularUnit in granular synthesis. Furthermore it has proven very successful together with TriggerSampleUnit
Please note, since this unit is built towards an independant multichannel use, most of the switchports need to be set using a Frame. e.g. Frame(3, 1.0, NaN, 0.0) will set three channels (ch0: 1.0, ch1: ignored, ch2: 0.0)
ControlPorts
name: amplitude defaultValue: 1.0
SwitchPorts:
name: interval channelCount: n defaultValue: 120.0 (ms) resizable: true function: setInterval
name: active channelCount: 1 defaultValue: 1.0 resizable: false function: setActive
name: raster channelCount: n default: Channel(1, 0.0) resizable: true function: setRaster
name: rasterLength channelCount: n default: 1 resizable: true function: setRasterLength
name: cycleLock channelCount: n default: false resizable: true (if set, will only allow changes (raster/len/interval) at the begin of a new cycle
Created by John Flury & Daniel Bisig on 22/02/08.
RhythmUnit::RhythmUnit | ( | ) |
default constructor
RhythmUnit::RhythmUnit | ( | const String & | pName | ) |
parameter based contructor
pName | unit name |
RhythmUnit::RhythmUnit | ( | unsigned int | pChannelCount | ) |
parameter based contructor
pChannelCount | number of channels |
RhythmUnit::RhythmUnit | ( | const String & | pName, | |
unsigned int | pChannelCount | |||
) |
parameter based contructor
pName | unit name | |
pChannelCount | number of channels |
RhythmUnit::RhythmUnit | ( | unsigned int | pFrameCount, | |
unsigned int | pChannelCount, | |||
unsigned int | pRate | |||
) | throw (SynthException) |
parameter based contructor
pFrameCount | number of frames | |
pChannelCount | number of channels | |
pRate | samping rate |
RhythmUnit::RhythmUnit | ( | const String & | pName, | |
unsigned int | pFrameCount, | |||
unsigned int | pChannelCount, | |||
unsigned int | pRate | |||
) | throw (SynthException) |
name and parameter based contructor
pName | unit name | |
pFrameCount | number of frames | |
pChannelCount | number of channels | |
pRate | samping rate |
RhythmUnit::RhythmUnit | ( | const RhythmUnit & | pUnit | ) |
copy constructor
pUnit | unit to copy properties from |
RhythmUnit::RhythmUnit | ( | const String & | pName, | |
const RhythmUnit & | pUnit | |||
) |
name & copy constructor
pName | unit name | |
pUnit | unit to copy properties from |
RhythmUnit::RhythmUnit | ( | const data::Values & | pValues | ) | throw (SynthException) |
values based constructor
pValues | unit values |
SynthException | failed to create unit |
RhythmUnit::~RhythmUnit | ( | ) |
destructor
void RhythmUnit::process | ( | Buffer * | pBuffer | ) | throw (SynthException) [virtual] |
String RhythmUnit::info | ( | bool | pPropagate = false , |
|
bool | pShowPorts = true | |||
) | const [virtual] |
obtain textual unit information
pPropagate | if true, the unit calls the info methods of its input ports | |
pShowPorts | print port information |
Reimplemented from iso::synth::InputUnit.
void RhythmUnit::setInterval | ( | Frame | pIntervals | ) |
set multiple intervals
pIntervals | ( containing the new intervals: e.g. Frame(3, 120.0, 60.0, NaN) ) |
void RhythmUnit::setRaster | ( | Frame | pRaster | ) |
set raster as a frame
pRaster | ( holding a raster for a single channel: ) Structure: Frame(chan_idx_double, val0double, val1double, val2double, ..., valndouble) -> e.g. Frame(4, 0.0, 1.0, 0.0, 1.0, 0.4) - this value is prestored and activated at the next raster cycle start positive values will trigger an event at the given amplitude, 0 doesn't do anything and negative values will stop trigger a release, the greater the negative val the steeper the release, -1.0 is 20 ms |
void RhythmUnit::setRasterLength | ( | Frame | pRasterLength | ) |
set all raster lengths at once
pRasterLength | (NUM_CHAN, CH_1, CH_2, ..., CH_N), e.g. (Frame(4, 16.0, NaN, 8.0, 4.0) will set chan 1 to a 16-beat cycle length, chan 2 will NOT be changed, chan 3 to 8-beats, and chan 4 to 4 beats. Channels 5+ are not affected by this example instruction. |
void RhythmUnit::setCycleLock | ( | Frame | pCycleLock | ) |
set the cycle lock flag
pCycleLock | cycle lock flag for all channels. use "NAN" for the frame values that should be ignored. e.g. Frame(4, NAN, NAN, 1.0, NAN) will only set the third channel to true (cycle lock active) |
void RhythmUnit::init | ( | ) | [protected] |
initializes wavetable and control ports
std::ostream& operator<< | ( | std::ostream & | pOstream, | |
const RhythmUnit & | pUnit | |||
) | [friend] |
print unit information
const String RhythmUnit::sClassName [static] |
unsigned int RhythmUnit::sUnitCount [static, protected] |
ControlPort* iso::synth::RhythmUnit::mAmplitude [protected] |
pulse amplitude control port
Frame iso::synth::RhythmUnit::mIntervalCounter [protected] |
interval counter (intervals in milisecs)
sample iso::synth::RhythmUnit::mMili2FrameScale [protected] |
milisecs to frame scale factor
sample iso::synth::RhythmUnit::mSampleDuration [protected] |
frame to milisecs scale factor
QVector<sample> iso::synth::RhythmUnit::mIntervals [protected] |
intervals
QVector<sample> iso::synth::RhythmUnit::mNextIntervals [protected] |
next intervals
QVector<Channel*> iso::synth::RhythmUnit::mRasters [protected] |
current raster storage - vector:channels frame groove data
QVector<unsigned int> iso::synth::RhythmUnit::mRasterLengths [protected] |
current raster lengths
QVector<Channel*> iso::synth::RhythmUnit::mNextRasters [protected] |
next rasters
QVector<bool> iso::synth::RhythmUnit::mCycleLock [protected] |
cycle lock flag. "true" = will only apply a new raster at the begin of a cycle. "false" = new rasters allowed on every beat
Channel* iso::synth::RhythmUnit::mTempRaster [protected] |
temp raster switching pointer;
QVector<unsigned int> iso::synth::RhythmUnit::mNextRasterLenghts [protected] |
next raster lengths
QVector<bool> iso::synth::RhythmUnit::mIntervalHasChanged [protected] |
interval has changed
QVector<bool> iso::synth::RhythmUnit::mRasterHasChanged [protected] |
flags that inform of the receival of a new raster
QVector<bool> iso::synth::RhythmUnit::mRasterLenHasChanged [protected] |
flags that inform of the change in raster lengths
QVector<unsigned int> iso::synth::RhythmUnit::mRasterCounter [protected] |
interval counter (intervals in milisecs)