Loading...
Searching...
No Matches
juce_AudioSource.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
//==============================================================================
struct JUCE_API AudioSourceChannelInfo
{
AudioSourceChannelInfo() = default;
AudioSourceChannelInfo (AudioBuffer<float>* bufferToUse,
int startSampleOffset, int numSamplesToUse) noexcept
: buffer (bufferToUse),
startSample (startSampleOffset),
numSamples (numSamplesToUse)
{
}
explicit AudioSourceChannelInfo (AudioBuffer<float>& bufferToUse) noexcept
: buffer (&bufferToUse),
startSample (0),
numSamples (bufferToUse.getNumSamples())
{
}
AudioBuffer<float>* buffer;
int startSample;
int numSamples;
void clearActiveBufferRegion() const
{
if (buffer != nullptr)
buffer->clear (startSample, numSamples);
}
};
//==============================================================================
class JUCE_API AudioSource
{
protected:
//==============================================================================
AudioSource() = default;
public:
virtual ~AudioSource() = default;
//==============================================================================
virtual void prepareToPlay (int samplesPerBlockExpected,
double sampleRate) = 0;
virtual void releaseResources() = 0;
virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
};
} // namespace juce
juce::AudioBuffer
Definition juce_AudioSampleBuffer.h:34
juce::AudioSource::releaseResources
virtual void releaseResources()=0
juce::AudioSource::AudioSource
AudioSource()=default
juce::AudioSource::prepareToPlay
virtual void prepareToPlay(int samplesPerBlockExpected, double sampleRate)=0
juce::AudioSource::~AudioSource
virtual ~AudioSource()=default
juce::AudioSource::getNextAudioBlock
virtual void getNextAudioBlock(const AudioSourceChannelInfo &bufferToFill)=0
juce::AudioSourceChannelInfo
Definition juce_AudioSource.h:33
juce::AudioSourceChannelInfo::AudioSourceChannelInfo
AudioSourceChannelInfo(AudioBuffer< float > *bufferToUse, int startSampleOffset, int numSamplesToUse) noexcept
Definition juce_AudioSource.h:38
juce::AudioSourceChannelInfo::numSamples
int numSamples
Definition juce_AudioSource.h:81
juce::AudioSourceChannelInfo::clearActiveBufferRegion
void clearActiveBufferRegion() const
Definition juce_AudioSource.h:84
juce::AudioSourceChannelInfo::buffer
AudioBuffer< float > * buffer
Definition juce_AudioSource.h:73
juce::AudioSourceChannelInfo::AudioSourceChannelInfo
AudioSourceChannelInfo(AudioBuffer< float > &bufferToUse) noexcept
Definition juce_AudioSource.h:50
juce::AudioSourceChannelInfo::AudioSourceChannelInfo
AudioSourceChannelInfo()=default
juce::AudioSourceChannelInfo::startSample
int startSample
Definition juce_AudioSource.h:77