Logo Search packages:      
Sourcecode: vamp-plugin-sdk version File versions  Download package

bool PercussionOnsetDetector::initialise ( size_t  inputChannels,
size_t  stepSize,
size_t  blockSize 
) [virtual]

Initialise a plugin to prepare it for use with the given number of input channels, step size (window increment, in sample frames) and block size (window size, in sample frames).

The input sample rate should have been already specified at construction time.

Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.

Implements Vamp::Plugin.

Definition at line 113 of file PercussionOnsetDetector.cpp.

References Vamp::Plugin::getMaxChannelCount(), and Vamp::Plugin::getMinChannelCount().

    if (channels < getMinChannelCount() ||
      channels > getMaxChannelCount()) return false;

    m_stepSize = stepSize;
    m_blockSize = blockSize;

    m_priorMagnitudes = new float[m_blockSize/2];

    for (size_t i = 0; i < m_blockSize/2; ++i) {
        m_priorMagnitudes[i] = 0.f;

    m_dfMinus1 = 0.f;
    m_dfMinus2 = 0.f;

    return true;

Generated by  Doxygen 1.6.0   Back to index