chromium/third_party/blink/renderer/modules/webaudio/audio_buffer_source_handler.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/modules/webaudio/audio_buffer_source_handler.h"

#include <algorithm>

#include "base/numerics/safe_conversions.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_audio_buffer_source_options.h"
#include "third_party/blink/renderer/modules/webaudio/audio_graph_tracer.h"
#include "third_party/blink/renderer/modules/webaudio/audio_node_output.h"
#include "third_party/blink/renderer/modules/webaudio/base_audio_context.h"
#include "third_party/blink/renderer/platform/audio/audio_utilities.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
#include "third_party/fdlibm/ieee754.h"

namespace blink {

namespace {

constexpr double kDefaultGrainDuration =;  // 20ms

// Arbitrary upper limit on playback rate.
// Higher than expected rates can be useful when playing back oversampled
// buffers to minimize linear interpolation aliasing.
constexpr double kMaxRate =;

// Default to mono. A call to setBuffer() will set the number of output
// channels to that of the buffer.
constexpr unsigned kDefaultNumberOfOutputChannels =;

}  // namespace

AudioBufferSourceHandler::AudioBufferSourceHandler(
    AudioNode& node,
    float sample_rate,
    AudioParamHandler& playback_rate,
    AudioParamHandler& detune)
    :{}

scoped_refptr<AudioBufferSourceHandler> AudioBufferSourceHandler::Create(
    AudioNode& node,
    float sample_rate,
    AudioParamHandler& playback_rate,
    AudioParamHandler& detune) {}

AudioBufferSourceHandler::~AudioBufferSourceHandler() {}

void AudioBufferSourceHandler::Process(uint32_t frames_to_process) {}

// Returns true if we're finished.
bool AudioBufferSourceHandler::RenderSilenceAndFinishIfNotLooping(
    AudioBus*,
    unsigned index,
    uint32_t frames_to_process) {}

bool AudioBufferSourceHandler::RenderFromBuffer(
    AudioBus* bus,
    unsigned destination_frame_offset,
    uint32_t number_of_frames,
    double start_time_offset) {}

void AudioBufferSourceHandler::SetBuffer(AudioBuffer* buffer,
                                         ExceptionState& exception_state) {}

unsigned AudioBufferSourceHandler::NumberOfChannels() {}

void AudioBufferSourceHandler::ClampGrainParameters(
    const SharedAudioBuffer* buffer) {}

base::WeakPtr<AudioScheduledSourceHandler>
AudioBufferSourceHandler::AsWeakPtr() {}

void AudioBufferSourceHandler::Start(double when,
                                     ExceptionState& exception_state) {}

void AudioBufferSourceHandler::Start(double when,
                                     double grain_offset,
                                     ExceptionState& exception_state) {}

void AudioBufferSourceHandler::Start(double when,
                                     double grain_offset,
                                     double grain_duration,
                                     ExceptionState& exception_state) {}

void AudioBufferSourceHandler::StartSource(double when,
                                           double grain_offset,
                                           double grain_duration,
                                           bool is_duration_given,
                                           ExceptionState& exception_state) {}

void AudioBufferSourceHandler::SetLoop(bool looping) {}

void AudioBufferSourceHandler::SetLoopStart(double loop_start) {}

void AudioBufferSourceHandler::SetLoopEnd(double loop_end) {}

double AudioBufferSourceHandler::ComputePlaybackRate() {}

double AudioBufferSourceHandler::GetMinPlaybackRate() {}

bool AudioBufferSourceHandler::PropagatesSilence() const {}

void AudioBufferSourceHandler::HandleStoppableSourceNode() {}

}  // namespace blink