pl-nk v0.4.5
Plonk|Plink|Plank are a set of cross-platform C/C++ frameworks for audio software development
Public Member Functions | Static Public Member Functions
BlockSize Class Reference

A specialised Variable<int> for handling block sizes. More...

Inherits Variable< int >.

Inherited by BlockSizeDefault, and BlockSizeNoPreference.

List of all members.

Public Member Functions

 BlockSize (SampleRate const &sampleRate) throw ()
 To catch a potential programming error.
 BlockSize (const int initValue) throw ()
 Create BlockSize with an int.
 BlockSize (IntVariable const &initValue) throw ()
 Create BlockSize from an IntVariable.
 BlockSize (BlockSize const &copy) throw ()
 Copy constructor.
template<class OtherType >
 BlockSize (OtherType const &initValue) throw ()
 Create a block size converting from another type.

Static Public Member Functions

static BlockSizegetDefault () throw ()
 Gets the default block size.
static BlockSizegetControlRateBlockSize () throw ()
 Gets the default control rate block size.
static const BlockSize getFractionOfDefault (IntVariable const &divisor) throw ()
 Create a block size that is a fraction of the default block size.
static const BlockSize getMultipleOfDefault (IntVariable const &factor) throw ()
 Create a block size that is a multiple of the default block size.
static const BlockSizenoPreference () throw ()
 A dummy block size used to indicate no preference.
static const BlockSizegetBlockSize1 () throw ()
 Get a block size of 1.
static BlockSize decide (BlockSize const &inputBlockSize, BlockSize const &preferredBlockSize) throw ()
 Select a block size based on a unit's preference and its inputs.

Detailed Description

A specialised Variable<int> for handling block sizes.

One or more BlockSize objects store the block size for different parts of the graph. For most applications there can be just one, default block size which is used by the enitre graph (plus a global block size of 1 being available for things like constants and other "control rate" channels). All channels register themsleves as a BlockSize::Receiver so they can be notified of block size changes and resize their output buffers accordingly. There are accessors to get the default block size, and a "no preference" block size (which is equal to 0). Generators (e.g., oscillators) should have a preference (e.g., the default block size) but processors should commonly specify no preference (thus, their block size will be decided according to the block size of their inputs).

See also:
SampleRate

Constructor & Destructor Documentation

BlockSize::BlockSize ( SampleRate const &  sampleRate) throw ()

To catch a potential programming error.

BlockSize::BlockSize ( const int  initValue) throw ()

Create BlockSize with an int.

BlockSize::BlockSize ( IntVariable const &  initValue) throw ()

Create BlockSize from an IntVariable.

BlockSize::BlockSize ( BlockSize const &  copy) throw ()

Copy constructor.

template<class OtherType >
BlockSize::BlockSize ( OtherType const &  initValue) throw () [inline]

Create a block size converting from another type.

This is useful for setting up ratios for both SampleRate and BlockSize objects where former holds a double type and the latter holds an integer type.


Member Function Documentation

BlockSize BlockSize::decide ( BlockSize const &  inputBlockSize,
BlockSize const &  preferredBlockSize 
) throw () [static]

Select a block size based on a unit's preference and its inputs.

Here the preferredBlockSize will be return UNLESS it indicates "no preference". If the inputs have "no preference" then the default block size is returned.

const BlockSize & BlockSize::getBlockSize1 ( ) throw () [static]

Get a block size of 1.

NB This is currently the same size as the default control rate block size but are two separate copies.

BlockSize & BlockSize::getControlRateBlockSize ( ) throw () [static]

Gets the default control rate block size.

This is currently 1.

BlockSize & BlockSize::getDefault ( ) throw () [static]

Gets the default block size.

In most situations this will be the hardware block size. This defaults to 512, to update it you should do this early in your initialisation code (before creating any units).

const BlockSize BlockSize::getFractionOfDefault ( IntVariable const &  divisor) throw () [static]

Create a block size that is a fraction of the default block size.

This will automatically update when/if the default block size is changed.

const BlockSize BlockSize::getMultipleOfDefault ( IntVariable const &  factor) throw () [static]

Create a block size that is a multiple of the default block size.

This will automatically update when/if the default block size is changed.

const BlockSize & BlockSize::noPreference ( ) throw () [static]

A dummy block size used to indicate no preference.

Usually this will mean a unit being initialised with "no preference" on block size will use the largest block size it finds in its inputs.


The documentation for this class was generated from the following files:
 All Classes Functions Typedefs Enumerations Enumerator Properties