chromium/third_party/blink/renderer/platform/audio/audio_bus.cc

/*
 * Copyright (C) 2010 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 * 2.  Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 *     its contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#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/platform/audio/audio_bus.h"

#include <assert.h>
#include <math.h>
#include <algorithm>
#include <memory>
#include <utility>

#include "base/ranges/algorithm.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_audio_bus.h"
#include "third_party/blink/renderer/platform/audio/denormal_disabler.h"
#include "third_party/blink/renderer/platform/audio/sinc_resampler.h"
#include "third_party/blink/renderer/platform/audio/vector_math.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"

namespace blink {

Vadd;
Vsma;

const unsigned kMaxBusChannels =;

scoped_refptr<AudioBus> AudioBus::Create(unsigned number_of_channels,
                                         uint32_t length,
                                         bool allocate) {}

AudioBus::AudioBus(unsigned number_of_channels, uint32_t length, bool allocate)
    :{}

void AudioBus::SetChannelMemory(unsigned channel_index,
                                float* storage,
                                uint32_t length) {}

void AudioBus::ResizeSmaller(uint32_t new_length) {}

void AudioBus::Zero() {}

AudioChannel* AudioBus::ChannelByType(unsigned channel_type) {}

const AudioChannel* AudioBus::ChannelByType(unsigned type) const {}

// Returns true if the channel count and frame-size match.
bool AudioBus::TopologyMatches(const AudioBus& bus) const {}

scoped_refptr<AudioBus> AudioBus::CreateBufferFromRange(
    const AudioBus* source_buffer,
    unsigned start_frame,
    unsigned end_frame) {}

float AudioBus::MaxAbsValue() const {}

void AudioBus::Normalize() {}

void AudioBus::Scale(float scale) {}

void AudioBus::CopyFrom(const AudioBus& source_bus,
                        ChannelInterpretation channel_interpretation) {}

void AudioBus::SumFrom(const AudioBus& source_bus,
                       ChannelInterpretation channel_interpretation) {}

void AudioBus::DiscreteSumFrom(const AudioBus& source_bus) {}

void AudioBus::SumFromByUpMixing(const AudioBus& source_bus) {}

void AudioBus::SumFromByDownMixing(const AudioBus& source_bus) {}

void AudioBus::CopyWithGainFrom(const AudioBus& source_bus, float gain) {}

void AudioBus::CopyWithSampleAccurateGainValuesFrom(
    const AudioBus& source_bus,
    float* gain_values,
    unsigned number_of_gain_values) {}

scoped_refptr<AudioBus> AudioBus::CreateBySampleRateConverting(
    const AudioBus* source_bus,
    bool mix_to_mono,
    double new_sample_rate) {}

scoped_refptr<AudioBus> AudioBus::CreateByMixingToMono(
    const AudioBus* source_bus) {}

bool AudioBus::IsSilent() const {}

void AudioBus::ClearSilentFlag() {}

scoped_refptr<AudioBus> DecodeAudioFileData(const char* data, size_t size) {}

scoped_refptr<AudioBus> AudioBus::GetDataResource(int resource_id,
                                                  float sample_rate) {}

scoped_refptr<AudioBus> AudioBus::CreateBusFromInMemoryAudioFile(
    const void* data,
    size_t data_size,
    bool mix_to_mono,
    float sample_rate) {}

}  // namespace blink