void DefaultAudioDestinationHandler::setChannelCount(
    unsigned long channelCount,
    ExceptionState& exceptionState) {
  // The channelCount for the input to this node controls the actual number of
  // channels we send to the audio hardware. It can only be set depending on the
  // maximum number of channels supported by the hardware.

  DCHECK(isMainThread());

  if (!maxChannelCount() || channelCount > maxChannelCount()) {
    exceptionState.throwDOMException(
        IndexSizeError,
        ExceptionMessages::indexOutsideRange<unsigned>(
            "channel count", channelCount, 1, ExceptionMessages::InclusiveBound,
            maxChannelCount(), ExceptionMessages::InclusiveBound));
    return;
  }

  unsigned long oldChannelCount = this->channelCount();
  AudioHandler::setChannelCount(channelCount, exceptionState);

  if (!exceptionState.hadException() &&
      this->channelCount() != oldChannelCount && isInitialized()) {
    // Re-create destination.
    m_destination->stop();
    createDestination();
    m_destination->start();
  }
}
void OutputDestinationMaker::createDestinationsForAllOutput(Simulation *simulation) {
    QList<Output*> outputs = find<Output*>("*", simulation);

    for (QList<Output*>::iterator ou = outputs.begin(); ou != outputs.end(); ++ou) {
        createDestination(*ou);
    }
}
void DefaultAudioDestinationHandler::initialize() {
  DCHECK(isMainThread());
  if (isInitialized())
    return;

  createDestination();
  AudioHandler::initialize();
}
void DefaultAudioDestinationNode::initialize()
{
    if (isInitialized())
        return;

    createDestination();
    AudioNode::initialize();
}
Exemple #5
0
void DefaultAudioDestinationNode::initialize()
{
    ASSERT(isMainThread()); 
    if (isInitialized())
        return;

    createDestination(String());
    AudioNode::initialize();
}
Exemple #6
0
void DefaultAudioDestinationNode::enableInput(const String& inputDeviceId)
{
    ASSERT(isMainThread());
    if (m_numberOfInputChannels != EnabledInputChannels) {
        m_numberOfInputChannels = EnabledInputChannels;

        if (isInitialized()) {
            // Re-create destination.
            m_destination->stop();
            createDestination(inputDeviceId);
            m_destination->start();
        }
    }
}
void DefaultAudioDestinationNode::setChannelCount(ContextGraphLock& g, unsigned long channelCount)
{
    // The channelCount for the input to this node controls the actual number of channels we
    // send to the audio hardware. It can only be set depending on the maximum number of
    // channels supported by the hardware.
    
    ASSERT(g.context());
    
    if (!maxChannelCount() || channelCount > maxChannelCount())
    {
        throw std::invalid_argument("Max channel count invalid");
    }
    
    unsigned long oldChannelCount = this->channelCount();
    AudioNode::setChannelCount(g, channelCount);
    
    if (this->channelCount() != oldChannelCount && isInitialized())
    {
        // Re-create destination.
        m_destination->stop();
        createDestination();
        m_destination->start();
    }
}