#include <juce_AudioDataConverters.h>
template<typename SampleFormat, typename Endianness, typename InterleavingType, typename Constness>
class AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >
A pointer to a block of audio data with a particular encoding.
This object can be used to read and write from blocks of encoded audio samples. To create one, you specify the audio format as a series of template parameters, e.g.
float firstSampleAsFloat = pointer.getAsFloat();
int32 firstSampleAsInt = pointer.getAsInt32();
++pointer;
pointer += 3;
The convertSamples() method lets you copy a range of samples from one format to another, automatically converting its format.
- See also
- AudioData::Converter
◆ Pointer() [1/3]
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::Pointer |
( |
typename Constness::VoidType * |
sourceData | ) |
|
|
inlinenoexcept |
Creates a non-interleaved pointer from some raw data in the appropriate format. This constructor is only used if you've specified the AudioData::NonInterleaved option - for interleaved formats, use the constructor that also takes a number of channels.
◆ Pointer() [2/3]
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::Pointer |
( |
typename Constness::VoidType * |
sourceData, |
|
|
int |
numInterleaved |
|
) |
| |
|
inlinenoexcept |
Creates a pointer from some raw data in the appropriate format with the specified number of interleaved channels. For non-interleaved data, use the other constructor.
◆ Pointer() [3/3]
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::Pointer |
( |
const Pointer< SampleFormat, Endianness, InterleavingType, Constness > & |
other | ) |
|
|
inlinenoexcept |
Creates a copy of another pointer.
◆ clearSamples()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
void AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::clearSamples |
( |
int |
numSamples | ) |
const |
|
inlinenoexcept |
Sets a number of samples to zero.
◆ convertSamples() [1/2]
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
void AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::convertSamples |
( |
Pointer< SampleFormat, Endianness, InterleavingType, Constness > |
source, |
|
|
int |
numSamples |
|
) |
| const |
|
inlinenoexcept |
Writes a stream of samples into this pointer from another pointer. This will copy the specified number of samples, converting between formats appropriately.
◆ convertSamples() [2/2]
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
template<class OtherPointerType >
void AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::convertSamples |
( |
OtherPointerType |
source, |
|
|
int |
numSamples |
|
) |
| const |
|
inlinenoexcept |
Writes a stream of samples into this pointer from another pointer. This will copy the specified number of samples, converting between formats appropriately.
◆ findMinAndMax() [1/2]
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
Range<float> AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::findMinAndMax |
( |
size_t |
numSamples | ) |
const |
|
inlinenoexcept |
Scans a block of data, returning the lowest and highest levels as floats
◆ findMinAndMax() [2/2]
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
void AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::findMinAndMax |
( |
size_t |
numSamples, |
|
|
float & |
minValue, |
|
|
float & |
maxValue |
|
) |
| const |
|
inlinenoexcept |
Scans a block of data, returning the lowest and highest levels as floats
◆ get32BitResolution()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
static int AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::get32BitResolution |
( |
| ) |
|
|
inlinestaticnoexcept |
Returns the accuracy of this format when represented as a 32-bit integer. This is the smallest number above 0 that can be represented in the sample format, converted to a 32-bit range. E,g. if the format is 8-bit, its resolution is 0x01000000; if the format is 24-bit, its resolution is 0x100.
◆ getAsFloat()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
float AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::getAsFloat |
( |
| ) |
const |
|
inlinenoexcept |
Returns the value of the first sample as a floating point value. The value will be in the range -1.0 to 1.0 for integer formats. For floating point formats, the value could be outside that range, although -1 to 1 is the standard range.
◆ getAsInt32()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
Returns the value of the first sample as a 32-bit integer. The value returned will be in the range 0x80000000 to 0x7fffffff, and shorter values will be shifted to fill this range (e.g. if you're reading from 24-bit data, the values will be shifted up by 8 bits when returned here). If the source data is floating point, values beyond -1.0 to 1.0 will be clipped so that -1.0 maps onto -0x7fffffff and 1.0 maps to 0x7fffffff.
◆ getBytesPerSample()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
static int AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::getBytesPerSample |
( |
| ) |
|
|
inlinestaticnoexcept |
Returns the number of bytes in each sample (ignoring the number of interleaved channels).
◆ getNumBytesBetweenSamples()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
int AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::getNumBytesBetweenSamples |
( |
| ) |
const |
|
inlinenoexcept |
Returns the number of bytes between the start address of each sample.
◆ getNumInterleavedChannels()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
int AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::getNumInterleavedChannels |
( |
| ) |
const |
|
inlinenoexcept |
Returns the number of interleaved channels in the format.
◆ getRawData()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
const void* AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::getRawData |
( |
| ) |
const |
|
inlinenoexcept |
Returns a pointer to the underlying data.
◆ isBigEndian()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
static bool AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::isBigEndian |
( |
| ) |
|
|
inlinestaticnoexcept |
Returns true if the format is big-endian.
◆ isFloatingPoint()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
static bool AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::isFloatingPoint |
( |
| ) |
|
|
inlinestaticnoexcept |
Returns true if the pointer is using a floating-point format.
◆ operator++()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
Moves the pointer along to the next sample.
◆ operator+=()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
Adds a number of samples to the pointer's position.
◆ operator--()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
Moves the pointer back to the previous sample.
◆ operator=()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
Pointer& AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::operator= |
( |
const Pointer< SampleFormat, Endianness, InterleavingType, Constness > & |
other | ) |
|
|
inlinenoexcept |
◆ setAsFloat()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
void AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::setAsFloat |
( |
float |
newValue | ) |
|
|
inlinenoexcept |
Sets the value of the first sample as a floating point value.
(This method can only be used if the AudioData::NonConst option was used). The value should be in the range -1.0 to 1.0 - for integer formats, values outside that range will be clipped. For floating point formats, any value passed in here will be written directly, although -1 to 1 is the standard range.
◆ setAsInt32()
template<typename SampleFormat , typename Endianness , typename InterleavingType , typename Constness >
Sets the value of the first sample as a 32-bit integer. This will be mapped to the range of the format that is being written - see getAsInt32().
The documentation for this class was generated from the following file: