Esempio n. 1
0
void AVFEqualizerBand::ApplyFilter(double *inSource, double *inDest, int frameCount, int channel) {
    if (mBypass && mEQ->GetSampleRate() > 0.0) {
        // Have a sample rate now, can recalculate
        RecalculateParams();
    }

    if (mBypass || channel < 0) {
        return;
    }

    // We may have more channels now than when we were initialized
    if (channel > mChannels) {
        mChannels = mEQ->GetChannelCount();
        SetChannelCount(mChannels);
    }

    if (mChannels > 0 && mHistory != NULL) {
        // copy source and dest history
        inSource[1] = mHistory[channel].x1;
        inSource[0] = mHistory[channel].x2;
        inDest[1] = mHistory[channel].y1;
        inDest[0] = mHistory[channel].y2;

        vDSP_deq22D(inSource, 1, mCoefficients, inDest, 1, frameCount);

        // update history
        mHistory[channel].x1 = inSource[frameCount+1];
        mHistory[channel].x2 = inSource[frameCount];
        mHistory[channel].y1 = inDest[frameCount+1];
        mHistory[channel].y2 = inDest[frameCount];
    }
}
Esempio n. 2
0
void Adc_t::Init() {
    rccEnableADC1(FALSE);   // Enable digital clock
    SetupClk(adcDiv4);      // Setup ADCCLK
    SetChannelCount(ADC_CHANNEL_CNT);
    for(uint8_t i = 0; i < ADC_CHANNEL_CNT; i++) ChannelConfig(AdcChannels[i]);
    // ==== DMA ====
    // Here only unchanged parameters of the DMA are configured.
    dmaStreamAllocate     (ADC_DMA, IRQ_PRIO_LOW, AdcTxIrq, NULL);
    dmaStreamSetPeripheral(ADC_DMA, &ADC1->DR);
    dmaStreamSetMode      (ADC_DMA, ADC_DMA_MODE);
}
svlFilterSourceVideoFile::svlFilterSourceVideoFile(unsigned int channelcount) :
    svlFilterSourceBase(false),  // manual timestamp management
    OutputImage(0),
    FirstTimestamp(-1.0),
    NativeFramerate(-1.0)
{
    CreateInterfaces();

    AddOutput("output", true);
    SetAutomaticOutputType(false);
    SetChannelCount(channelcount);
}
Esempio n. 4
0
AVFEqualizerBand::AVFEqualizerBand(AVFAudioEqualizer *eq, double frequency, double bandwidth, double gain) :
    CEqualizerBand(bandwidth, gain),
    mEQ(eq),
    mBypass(true),
    mChannels(0),
    mHistory(NULL),
    mFrequency(frequency),
    mFilterType(Peak)  // set later by the EQ, can be changed if band moves
{
    // we may not have an audio unit yet
    int channels = mEQ->GetChannelCount();
    if (channels > 0) {
        SetChannelCount(channels);
    }
    RecalculateParams();
}
Esempio n. 5
0
void VellemanOut::outputDMX(quint32 output, const QByteArray& universe)
{
    if (output != 0)
        return;

    if (m_currentlyOpen == false)
    {
        StartDevice();
        m_currentlyOpen = true;
    }

    int32_t channelCount = (int32_t) universe.size();
    SetChannelCount(channelCount);

    int32_t values [512]; //Set up array to pass to SetAllData.
    for (int32_t channelLoop = 0; channelLoop < channelCount; channelLoop++)
    {
        //Write the value to our temporary array.
        values[channelLoop] = (quint32) universe[channelLoop];
    }

    SetAllData(values);
}