mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added 64-bit double methods to FloatVectorOperations. Refactored some of the min/max methods in FloatVectorOperations to return a Range instead of getting the results as parameters.
This commit is contained in:
parent
98c77f85e9
commit
d74bf3dca8
6 changed files with 589 additions and 410 deletions
|
|
@ -487,17 +487,14 @@ void AudioSampleBuffer::reverse (int startSample, int numSamples) const noexcept
|
|||
reverse (i, startSample, numSamples);
|
||||
}
|
||||
|
||||
void AudioSampleBuffer::findMinMax (const int channel,
|
||||
const int startSample,
|
||||
int numSamples,
|
||||
float& minVal,
|
||||
float& maxVal) const noexcept
|
||||
Range<float> AudioSampleBuffer::findMinMax (const int channel,
|
||||
const int startSample,
|
||||
int numSamples) const noexcept
|
||||
{
|
||||
jassert (isPositiveAndBelow (channel, numChannels));
|
||||
jassert (startSample >= 0 && startSample + numSamples <= size);
|
||||
|
||||
FloatVectorOperations::findMinAndMax (channels [channel] + startSample,
|
||||
numSamples, minVal, maxVal);
|
||||
return FloatVectorOperations::findMinAndMax (channels [channel] + startSample, numSamples);
|
||||
}
|
||||
|
||||
float AudioSampleBuffer::getMagnitude (const int channel,
|
||||
|
|
@ -507,10 +504,9 @@ float AudioSampleBuffer::getMagnitude (const int channel,
|
|||
jassert (isPositiveAndBelow (channel, numChannels));
|
||||
jassert (startSample >= 0 && startSample + numSamples <= size);
|
||||
|
||||
float mn, mx;
|
||||
findMinMax (channel, startSample, numSamples, mn, mx);
|
||||
const Range<float> r (findMinMax (channel, startSample, numSamples));
|
||||
|
||||
return jmax (mn, -mn, mx, -mx);
|
||||
return jmax (r.getStart(), -r.getStart(), r.getEnd(), -r.getEnd());
|
||||
}
|
||||
|
||||
float AudioSampleBuffer::getMagnitude (int startSample, int numSamples) const noexcept
|
||||
|
|
|
|||
|
|
@ -392,19 +392,15 @@ public:
|
|||
float endGain) noexcept;
|
||||
|
||||
|
||||
/** Finds the highest and lowest sample values in a given range.
|
||||
/** Returns a Range indicating the lowest and highest sample values in a given section.
|
||||
|
||||
@param channel the channel to read from
|
||||
@param startSample the start sample within the channel
|
||||
@param numSamples the number of samples to check
|
||||
@param minVal on return, the lowest value that was found
|
||||
@param maxVal on return, the highest value that was found
|
||||
*/
|
||||
void findMinMax (int channel,
|
||||
int startSample,
|
||||
int numSamples,
|
||||
float& minVal,
|
||||
float& maxVal) const noexcept;
|
||||
Range<float> findMinMax (int channel,
|
||||
int startSample,
|
||||
int numSamples) const noexcept;
|
||||
|
||||
/** Finds the highest absolute sample value within a region of a channel. */
|
||||
float getMagnitude (int channel,
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -38,48 +38,90 @@ public:
|
|||
/** Clears a vector of floats. */
|
||||
static void JUCE_CALLTYPE clear (float* dest, int numValues) noexcept;
|
||||
|
||||
/** Clears a vector of doubles. */
|
||||
static void JUCE_CALLTYPE clear (double* dest, int numValues) noexcept;
|
||||
|
||||
/** Copies a repeated value into a vector of floats. */
|
||||
static void JUCE_CALLTYPE fill (float* dest, float valueToFill, int numValues) noexcept;
|
||||
|
||||
/** Copies a repeated value into a vector of doubles. */
|
||||
static void JUCE_CALLTYPE fill (double* dest, double valueToFill, int numValues) noexcept;
|
||||
|
||||
/** Copies a vector of floats. */
|
||||
static void JUCE_CALLTYPE copy (float* dest, const float* src, int numValues) noexcept;
|
||||
|
||||
/** Copies a vector of doubles. */
|
||||
static void JUCE_CALLTYPE copy (double* dest, const double* src, int numValues) noexcept;
|
||||
|
||||
/** Copies a vector of floats, multiplying each value by a given multiplier */
|
||||
static void JUCE_CALLTYPE copyWithMultiply (float* dest, const float* src, float multiplier, int numValues) noexcept;
|
||||
|
||||
/** Copies a vector of doubles, multiplying each value by a given multiplier */
|
||||
static void JUCE_CALLTYPE copyWithMultiply (double* dest, const double* src, double multiplier, int numValues) noexcept;
|
||||
|
||||
/** Adds a fixed value to the destination values. */
|
||||
static void JUCE_CALLTYPE add (float* dest, float amount, int numValues) noexcept;
|
||||
static void JUCE_CALLTYPE add (float* dest, float amountToAdd, int numValues) noexcept;
|
||||
|
||||
/** Adds a fixed value to the destination values. */
|
||||
static void JUCE_CALLTYPE add (double* dest, double amountToAdd, int numValues) noexcept;
|
||||
|
||||
/** Adds the source values to the destination values. */
|
||||
static void JUCE_CALLTYPE add (float* dest, const float* src, int numValues) noexcept;
|
||||
|
||||
/** Adds the source values to the destination values. */
|
||||
static void JUCE_CALLTYPE add (double* dest, const double* src, int numValues) noexcept;
|
||||
|
||||
/** Subtracts the source values from the destination values. */
|
||||
static void JUCE_CALLTYPE subtract (float* dest, const float* src, int numValues) noexcept;
|
||||
|
||||
/** Subtracts the source values from the destination values. */
|
||||
static void JUCE_CALLTYPE subtract (double* dest, const double* src, int numValues) noexcept;
|
||||
|
||||
/** Multiplies each source value by the given multiplier, then adds it to the destination value. */
|
||||
static void JUCE_CALLTYPE addWithMultiply (float* dest, const float* src, float multiplier, int numValues) noexcept;
|
||||
|
||||
/** Multiplies each source value by the given multiplier, then adds it to the destination value. */
|
||||
static void JUCE_CALLTYPE addWithMultiply (double* dest, const double* src, double multiplier, int numValues) noexcept;
|
||||
|
||||
/** Multiplies the destination values by the source values. */
|
||||
static void JUCE_CALLTYPE multiply (float* dest, const float* src, int numValues) noexcept;
|
||||
|
||||
/** Multiplies the destination values by the source values. */
|
||||
static void JUCE_CALLTYPE multiply (double* dest, const double* src, int numValues) noexcept;
|
||||
|
||||
/** Multiplies each of the destination values by a fixed multiplier. */
|
||||
static void JUCE_CALLTYPE multiply (float* dest, float multiplier, int numValues) noexcept;
|
||||
|
||||
/** Multiplies each of the destination values by a fixed multiplier. */
|
||||
static void JUCE_CALLTYPE multiply (double* dest, double multiplier, int numValues) noexcept;
|
||||
|
||||
/** Copies a source vector to a destination, negating each value. */
|
||||
static void JUCE_CALLTYPE negate (float* dest, const float* src, int numValues) noexcept;
|
||||
|
||||
/** Copies a source vector to a destination, negating each value. */
|
||||
static void JUCE_CALLTYPE negate (double* dest, const double* src, int numValues) noexcept;
|
||||
|
||||
/** Converts a stream of integers to floats, multiplying each one by the given multiplier. */
|
||||
static void JUCE_CALLTYPE convertFixedToFloat (float* dest, const int* src, float multiplier, int numValues) noexcept;
|
||||
|
||||
/** Finds the miniumum and maximum values in the given array. */
|
||||
static void JUCE_CALLTYPE findMinAndMax (const float* src, int numValues, float& minResult, float& maxResult) noexcept;
|
||||
static Range<float> JUCE_CALLTYPE findMinAndMax (const float* src, int numValues) noexcept;
|
||||
|
||||
/** Finds the miniumum and maximum values in the given array. */
|
||||
static Range<double> JUCE_CALLTYPE findMinAndMax (const double* src, int numValues) noexcept;
|
||||
|
||||
/** Finds the miniumum value in the given array. */
|
||||
static float JUCE_CALLTYPE findMinimum (const float* src, int numValues) noexcept;
|
||||
|
||||
/** Finds the miniumum value in the given array. */
|
||||
static double JUCE_CALLTYPE findMinimum (const double* src, int numValues) noexcept;
|
||||
|
||||
/** Finds the maximum value in the given array. */
|
||||
static float JUCE_CALLTYPE findMaximum (const float* src, int numValues) noexcept;
|
||||
|
||||
/** Finds the maximum value in the given array. */
|
||||
static double JUCE_CALLTYPE findMaximum (const double* src, int numValues) noexcept;
|
||||
|
||||
/** On Intel CPUs, this method enables or disables the SSE flush-to-zero mode.
|
||||
Effectively, this is a wrapper around a call to _MM_SET_FLUSH_ZERO_MODE
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue