当前位置: 首页>>代码示例>>C++>>正文


C++ AudioInput::getType方法代码示例

本文整理汇总了C++中AudioInput::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioInput::getType方法的具体用法?C++ AudioInput::getType怎么用?C++ AudioInput::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AudioInput的用法示例。


在下文中一共展示了AudioInput::getType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onInputDisconnected

void EngineMicrophone::onInputDisconnected(AudioInput input) {
    if (input.getType() != AudioPath::MICROPHONE ||
        AudioInput::channelsNeededForType(input.getType()) != 1) {
        // This is an error!
        qWarning() << "EngineMicrophone connected to AudioInput for a non-Microphone type or a non-mono buffer!";
        return;
    }
    m_sampleBuffer.clear();
    m_pEnabled->set(0.0f);
}
开发者ID:AlbanBedel,项目名称:mixxx,代码行数:10,代码来源:enginemicrophone.cpp

示例2: onInputUnconfigured

void EngineDeck::onInputUnconfigured(AudioInput input) {
    if (input.getType() != AudioPath::VINYLCONTROL) {
        // This is an error!
        qDebug() << "WARNING: EngineDeck connected to AudioInput for a non-vinylcontrol type!";
        return;
    }
    m_sampleBuffer = NULL;
}
开发者ID:Vicentecarrillo,项目名称:mixxx,代码行数:8,代码来源:enginedeck.cpp

示例3: onInputUnconfigured

void EngineMicrophone::onInputUnconfigured(AudioInput input) {
    if (input.getType() != AudioPath::MICROPHONE) {
        // This is an error!
        qWarning() << "EngineMicrophone connected to AudioInput for a non-Microphone type!";
        return;
    }
    m_sampleBuffer = NULL;
    m_pEnabled->set(0.0);
}
开发者ID:amoghpc,项目名称:mixxx,代码行数:9,代码来源:enginemicrophone.cpp

示例4: onInputUnconfigured

void EngineAux::onInputUnconfigured(AudioInput input) {
    if (input.getType() != AudioPath::AUXILIARY) {
        // This is an error!
        qDebug() << "WARNING: EngineAux connected to AudioInput for a non-auxiliary type!";
        return;
    }
    m_sampleBuffer = NULL;
    m_pEnabled->set(0.0);
}
开发者ID:PimpinFou,项目名称:mixxx,代码行数:9,代码来源:engineaux.cpp

示例5: receiveBuffer

void EngineMicrophone::receiveBuffer(AudioInput input, const CSAMPLE* pBuffer,
                                     unsigned int nFrames) {
    if (!isTalkover()) {
        return;
    }

    if (input.getType() != AudioPath::MICROPHONE) {
        // This is an error!
        qWarning() << "EngineMicrophone receieved an AudioInput for a non-Microphone type!";
        return;
    }

    const unsigned int iChannels = input.getChannelGroup().getChannelCount();

    // Check that the number of mono frames doesn't exceed MAX_BUFFER_LEN/2
    // because thats our conversion buffer size.
    if (nFrames > MAX_BUFFER_LEN / iChannels) {
        qWarning() << "Dropping microphone samples because the input buffer is too large.";
        nFrames = MAX_BUFFER_LEN / iChannels;
    }

    const CSAMPLE* pWriteBuffer = NULL;
    unsigned int samplesToWrite = 0;

    if (iChannels == 1) {
        // Do mono -> stereo conversion.
        for (unsigned int i = 0; i < nFrames; ++i) {
            m_pConversionBuffer[i*2 + 0] = pBuffer[i];
            m_pConversionBuffer[i*2 + 1] = pBuffer[i];
        }
        pWriteBuffer = m_pConversionBuffer;
        samplesToWrite = nFrames * 2;
    } else if (iChannels == 2) {
        // Already in stereo. Use pBuffer as-is.
        pWriteBuffer = pBuffer;
        samplesToWrite = nFrames * iChannels;
    } else {
        qWarning() << "EngineMicrophone got greater than stereo input. Not currently handled.";
    }

    if (pWriteBuffer != NULL) {
        // TODO(rryan) do we need to verify the input is the one we asked for?
        // Oh well.
        unsigned int samplesWritten = m_sampleBuffer.write(pWriteBuffer,
                                                           samplesToWrite);
        if (samplesWritten < samplesToWrite) {
            // Buffer overflow. We aren't processing samples fast enough. This
            // shouldn't happen since the mic spits out samples just as fast as they
            // come in, right?
            qWarning() << "ERROR: Buffer overflow in EngineMicrophone. Dropping samples on the floor.";
        }
    }
}
开发者ID:redreamality,项目名称:mixxx,代码行数:53,代码来源:enginemicrophone.cpp

示例6: receiveBuffer

void EngineMicrophone::receiveBuffer(AudioInput input, const short* pBuffer, unsigned int nFrames) {

    if (input.getType() != AudioPath::MICROPHONE ||
        AudioInput::channelsNeededForType(input.getType()) != 1) {
        // This is an error!
        qWarning() << "EngineMicrophone receieved an AudioInput for a non-Microphone type or a non-mono buffer!";
        return;
    }

    // Use the conversion buffer to both convert from short and double into
    // stereo.

    // Check that the number of mono frames doesn't exceed MAX_BUFFER_LEN/2
    // because thats our conversion buffer size.
    if (nFrames > MAX_BUFFER_LEN / 2) {
        qWarning() << "Dropping microphone samples because the input buffer is too large.";
        nFrames = MAX_BUFFER_LEN / 2;
    }

    // There isn't a suitable SampleUtil method that can do mono->stereo and
    // short->float in one pass.
    // SampleUtil::convert(m_pConversionBuffer, pBuffer, iNumSamples);
    for (unsigned int i = 0; i < nFrames; ++i) {
        m_pConversionBuffer[i*2 + 0] = pBuffer[i];
        m_pConversionBuffer[i*2 + 1] = pBuffer[i];
    }

    // m_pConversionBuffer is now stereo, so double the number of samples
    const unsigned int iNumSamples = nFrames * 2;

    // TODO(rryan) do we need to verify the input is the one we asked for? Oh well.
    unsigned int samplesWritten = m_sampleBuffer.write(m_pConversionBuffer, iNumSamples);
    if (samplesWritten < iNumSamples) {
        // Buffer overflow. We aren't processing samples fast enough. This
        // shouldn't happen since the mic spits out samples just as fast as they
        // come in, right?
        qWarning() << "ERROR: Buffer overflow in EngineMicrophone. Dropping samples on the floor.";
    }
}
开发者ID:AlbanBedel,项目名称:mixxx,代码行数:39,代码来源:enginemicrophone.cpp

示例7: onInputDisconnected

void EngineMaster::onInputDisconnected(AudioInput input) {
    switch (input.getType()) {
      case AudioInput::MICROPHONE:
          m_pNumMicsConfigured->set(m_pNumMicsConfigured->get() - 1);
          break;
      case AudioInput::AUXILIARY:
          // We don't track enabled auxiliary inputs.
          break;
      case AudioInput::VINYLCONTROL:
          // We don't track enabled vinyl control inputs.
          break;
      case AudioInput::RECORD_BROADCAST:
          m_bExternalRecordBroadcastInputConnected = false;
          break;
      default:
          break;
    }
}
开发者ID:PeteDevoy,项目名称:mixxx,代码行数:18,代码来源:enginemaster.cpp


注:本文中的AudioInput::getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。