Пример #1
0
bool EngineDeck::isActive() {
    if (m_bPassthroughWasActive && !m_bPassthroughIsActive) {
        return true;
    }

    return (m_pBuffer->isTrackLoaded() || isPassthroughActive());
}
Пример #2
0
bool EngineDeck::isActive() {
    bool active = false;
    if (m_bPassthroughWasActive && !m_bPassthroughIsActive) {
        active = true;
    } else {
        active = m_pBuffer->isTrackLoaded() || isPassthroughActive();
    }

    if (!active && m_wasActive) {
        m_pVUMeter->reset();
    }
    m_wasActive = active;
    return active;
}
Пример #3
0
void EngineDeck::process(const CSAMPLE*, CSAMPLE* pOut, const int iBufferSize) {
    CSAMPLE* pOutput = const_cast<CSAMPLE*>(pOut);
    
    // Feed the incoming audio through if passthrough is active
    if (isPassthroughActive()) {
        int samplesRead = m_sampleBuffer.read(pOut, iBufferSize);
        if (samplesRead < iBufferSize) {
            // Buffer underflow. There aren't getting samples fast enough. This
            // shouldn't happen since PortAudio should feed us samples just as fast
            // as we consume them, right?
            qWarning() << "ERROR: Buffer overflow in EngineDeck. Playing silence.";
            SampleUtil::applyGain(pOut + samplesRead, 0.0, iBufferSize - samplesRead);
        }
        m_bPassthroughWasActive = true;
    } else {
        // If passthrough is no longer enabled, zero out the buffer
        if (m_bPassthroughWasActive) {
            SampleUtil::applyGain(pOut, 0.0, iBufferSize);
            m_sampleBuffer.skip(iBufferSize);
            m_bPassthroughWasActive = false;
            return;
        }

        // Process the raw audio
        m_pBuffer->process(0, pOut, iBufferSize);
        // Emulate vinyl sounds
        m_pVinylSoundEmu->process(pOut, pOut, iBufferSize);
        m_bPassthroughWasActive = false;
    }

    // Apply pregain
    m_pPregain->process(pOut, pOut, iBufferSize);
    // Filter the channel with EQs
    m_pFilter->process(pOut, pOut, iBufferSize);
    m_pFlanger->process(pOut, pOut, iBufferSize);
    m_pFilterEffect->process(pOut, pOut, iBufferSize);
    // Process effects enabled for this channel
    m_pEffectsManager->process(getGroup(), pOut, pOutput, iBufferSize);
    // Apply clipping
    m_pClipping->process(pOut, pOut, iBufferSize);
    // Update VU meter
    m_pVUMeter->process(pOut, pOut, iBufferSize);
}
Пример #4
0
void EngineDeck::process(CSAMPLE* pOut, const int iBufferSize) {
    GroupFeatureState features;
    // Feed the incoming audio through if passthrough is active
    const CSAMPLE* sampleBuffer = m_sampleBuffer; // save pointer on stack
    if (isPassthroughActive() && sampleBuffer) {
        SampleUtil::copy(pOut, sampleBuffer, iBufferSize);
        m_bPassthroughWasActive = true;
        m_sampleBuffer = NULL;
        m_pPregain->setSpeed(1);
        m_pPregain->setScratching(false);
    } else {
        // If passthrough is no longer enabled, zero out the buffer
        if (m_bPassthroughWasActive) {
            SampleUtil::clear(pOut, iBufferSize);
            m_bPassthroughWasActive = false;
            return;
        }

        // Process the raw audio
        m_pBuffer->process(pOut, iBufferSize);
        m_pBuffer->collectFeatures(&features);
        m_pPregain->setSpeed(m_pBuffer->getSpeed());
        m_pPregain->setScratching(m_pBuffer->getScratching());
        m_bPassthroughWasActive = false;
    }

    // Apply pregain
    m_pPregain->process(pOut, iBufferSize);
    // Process effects enabled for this channel
    if (m_pEngineEffectsManager != NULL) {
        // This is out of date by a callback but some effects will want the RMS
        // volume.
        m_pVUMeter->collectFeatures(&features);
        m_pEngineEffectsManager->process(
                getHandle(), pOut, iBufferSize,
                static_cast<unsigned int>(m_pSampleRate->get()), features);
    }
    // Update VU meter
    m_pVUMeter->process(pOut, iBufferSize);
}
Пример #5
0
void EngineDeck::process(CSAMPLE* pOut, const int iBufferSize) {
    GroupFeatureState features;
    // Feed the incoming audio through if passthrough is active
    const CSAMPLE* sampleBuffer = m_sampleBuffer; // save pointer on stack
    if (isPassthroughActive() && sampleBuffer) {
        memcpy(pOut, sampleBuffer, iBufferSize * sizeof(pOut[0]));
        m_bPassthroughWasActive = true;
        m_sampleBuffer = NULL;
    } else {
        // If passthrough is no longer enabled, zero out the buffer
        if (m_bPassthroughWasActive) {
            SampleUtil::clear(pOut, iBufferSize);
            m_bPassthroughWasActive = false;
            return;
        }

        // Process the raw audio
        m_pBuffer->process(pOut, iBufferSize);
        m_pBuffer->collectFeatures(&features);
        // Emulate vinyl sounds
        m_pVinylSoundEmu->setSpeed(m_pBuffer->getSpeed());
        m_pVinylSoundEmu->process(pOut, iBufferSize);
        m_bPassthroughWasActive = false;
    }

    // Apply pregain
    m_pPregain->process(pOut, iBufferSize);
    // Filter the channel with EQs
    m_pFilter->process(pOut, iBufferSize);
    // Process effects enabled for this channel
    if (m_pEngineEffectsManager != NULL) {
        // This is out of date by a callback but some effects will want the RMS
        // volume.
        m_pVUMeter->collectFeatures(&features);
        m_pEngineEffectsManager->process(getGroup(), pOut, iBufferSize,
                                         features);
    }
    // Update VU meter
    m_pVUMeter->process(pOut, iBufferSize);
}