Example #1
0
void
AudioNode::SendInt32ParameterToStream(uint32_t aIndex, int32_t aValue)
{
  AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
  MOZ_ASSERT(ns, "How come we don't have a stream here?");
  ns->SetInt32Parameter(aIndex, aValue);
}
void
AudioBufferSourceNode::SendBufferParameterToStream(JSContext* aCx)
{
    AudioNodeStream* ns = mStream;
    if (!ns) {
        return;
    }

    if (mBuffer) {
        RefPtr<ThreadSharedFloatArrayBufferList> data =
            mBuffer->GetThreadSharedChannelsForRate(aCx);
        ns->SetBuffer(data.forget());

        if (mStartCalled) {
            SendOffsetAndDurationParametersToStream(ns);
        }
    } else {
        ns->SetInt32Parameter(BUFFEREND, 0);
        ns->SetBuffer(nullptr);

        MarkInactive();
    }
}