JUCE
|
Classes | |
struct | TypeHelpers::ParameterType< Type > |
The ParameterType struct is used to find the best type to use when passing some kind of object as a parameter. More... | |
struct | TypeHelpers::SmallestFloatType< Type > |
These templates are designed to take a type, and if it's a double, they return a double type; for anything else, they return a float type. More... | |
struct | TypeHelpers::SmallestFloatType< double > |
Namespaces | |
TypeHelpers | |
This namespace contains a few template classes for helping work out class type variations. | |
Macros | |
#define | JUCE_UNDENORMALISE(x) { (x) += 0.1f; (x) -= 0.1f; } |
This macro can be applied to a float variable to check whether it contains a denormalised value, and to normalise it if necessary. More... | |
#define | PARAMETER_TYPE(a) typename TypeHelpers::ParameterType<a>::type |
A helpful macro to simplify the use of the ParameterType template. More... | |
Typedefs | |
typedef signed char | int8 |
A platform-independent 8-bit signed integer type. More... | |
typedef unsigned char | uint8 |
A platform-independent 8-bit unsigned integer type. More... | |
typedef signed short | int16 |
A platform-independent 16-bit signed integer type. More... | |
typedef unsigned short | uint16 |
A platform-independent 16-bit unsigned integer type. More... | |
typedef signed int | int32 |
A platform-independent 32-bit signed integer type. More... | |
typedef unsigned int | uint32 |
A platform-independent 32-bit unsigned integer type. More... | |
typedef long long | int64 |
A platform-independent 64-bit integer type. More... | |
typedef unsigned long long | uint64 |
A platform-independent 64-bit unsigned integer type. More... | |
typedef int | pointer_sized_int |
A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. More... | |
typedef unsigned int | pointer_sized_uint |
An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. More... | |
Functions | |
template<typename Type > | |
Type | jmax (const Type a, const Type b) |
Returns the larger of two values. More... | |
template<typename Type > | |
Type | jmax (const Type a, const Type b, const Type c) |
Returns the larger of three values. More... | |
template<typename Type > | |
Type | jmax (const Type a, const Type b, const Type c, const Type d) |
Returns the larger of four values. More... | |
template<typename Type > | |
Type | jmin (const Type a, const Type b) |
Returns the smaller of two values. More... | |
template<typename Type > | |
Type | jmin (const Type a, const Type b, const Type c) |
Returns the smaller of three values. More... | |
template<typename Type > | |
Type | jmin (const Type a, const Type b, const Type c, const Type d) |
Returns the smaller of four values. More... | |
template<typename Type > | |
Type | jmap (Type value0To1, Type targetRangeMin, Type targetRangeMax) |
Remaps a normalised value (between 0 and 1) to a target range. More... | |
template<typename Type > | |
Type | jmap (Type sourceValue, Type sourceRangeMin, Type sourceRangeMax, Type targetRangeMin, Type targetRangeMax) |
Remaps a value from a source range to a target range. More... | |
template<typename Type > | |
Type | findMinimum (const Type *data, int numValues) |
Scans an array of values, returning the minimum value that it contains. More... | |
template<typename Type > | |
Type | findMaximum (const Type *values, int numValues) |
Scans an array of values, returning the maximum value that it contains. More... | |
template<typename Type > | |
void | findMinAndMax (const Type *values, int numValues, Type &lowest, Type &highest) |
Scans an array of values, returning the minimum and maximum values that it contains. More... | |
template<typename Type > | |
Type | jlimit (const Type lowerLimit, const Type upperLimit, const Type valueToConstrain) noexcept |
Constrains a value to keep it within a given range. More... | |
template<typename Type > | |
bool | isPositiveAndBelow (Type valueToTest, Type upperLimit) noexcept |
Returns true if a value is at least zero, and also below a specified upper limit. More... | |
template<> | |
bool | isPositiveAndBelow (const int valueToTest, const int upperLimit) noexcept |
template<typename Type > | |
bool | isPositiveAndNotGreaterThan (Type valueToTest, Type upperLimit) noexcept |
Returns true if a value is at least zero, and also less than or equal to a specified upper limit. More... | |
template<> | |
bool | isPositiveAndNotGreaterThan (const int valueToTest, const int upperLimit) noexcept |
template<typename Type > | |
void | swapVariables (Type &variable1, Type &variable2) |
Handy function to swap two values. More... | |
template<typename Type1 > | |
void | ignoreUnused (const Type1 &) noexcept |
Handy function for avoiding unused variables warning. More... | |
template<typename Type1 , typename Type2 > | |
void | ignoreUnused (const Type1 &, const Type2 &) noexcept |
template<typename Type1 , typename Type2 , typename Type3 > | |
void | ignoreUnused (const Type1 &, const Type2 &, const Type3 &) noexcept |
template<typename Type1 , typename Type2 , typename Type3 , typename Type4 > | |
void | ignoreUnused (const Type1 &, const Type2 &, const Type3 &, const Type4 &) noexcept |
template<typename Type , int N> | |
int | numElementsInArray (Type(&array)[N]) |
Handy function for getting the number of elements in a simple const C array. More... | |
template<typename Type > | |
Type | juce_hypot (Type a, Type b) noexcept |
Using juce_hypot is easier than dealing with the different types of hypot function that are provided by the various platforms and compilers. More... | |
int64 | abs64 (const int64 n) noexcept |
64-bit abs function. More... | |
float | degreesToRadians (float degrees) noexcept |
Converts an angle in degrees to radians. More... | |
double | degreesToRadians (double degrees) noexcept |
Converts an angle in degrees to radians. More... | |
float | radiansToDegrees (float radians) noexcept |
Converts an angle in radians to degrees. More... | |
double | radiansToDegrees (double radians) noexcept |
Converts an angle in radians to degrees. More... | |
template<typename NumericType > | |
bool | juce_isfinite (NumericType) noexcept |
The isfinite() method seems to vary between platforms, so this is a platform-independent function for it. More... | |
template<> | |
bool | juce_isfinite (float value) noexcept |
template<> | |
bool | juce_isfinite (double value) noexcept |
template<typename FloatType > | |
int | roundToInt (const FloatType value) noexcept |
Fast floating-point-to-integer conversion. More... | |
int | roundToInt (int value) noexcept |
int | roundToIntAccurate (const double value) noexcept |
Fast floating-point-to-integer conversion. More... | |
int | roundDoubleToInt (const double value) noexcept |
Fast floating-point-to-integer conversion. More... | |
int | roundFloatToInt (const float value) noexcept |
Fast floating-point-to-integer conversion. More... | |
template<typename IntegerType > | |
bool | isPowerOfTwo (IntegerType value) |
Returns true if the specified integer is a power-of-two. More... | |
int | nextPowerOfTwo (int n) noexcept |
Returns the smallest power-of-two which is equal to or greater than the given integer. More... | |
int | countNumberOfBits (uint32 n) noexcept |
Returns the number of bits in a 32-bit integer. More... | |
int | countNumberOfBits (uint64 n) noexcept |
Returns the number of bits in a 64-bit integer. More... | |
template<typename IntegerType > | |
IntegerType | negativeAwareModulo (IntegerType dividend, const IntegerType divisor) noexcept |
Performs a modulo operation, but can cope with the dividend being negative. More... | |
template<typename NumericType > | |
NumericType | square (NumericType n) noexcept |
Returns the square of its argument. More... | |
Variables | |
const double | double_Pi = 3.1415926535897932384626433832795 |
A predefined value for Pi, at double-precision. More... | |
const float | float_Pi = 3.14159265358979323846f |
A predefined value for Pi, at single-precision. More... | |
#define JUCE_UNDENORMALISE | ( | x | ) | { (x) += 0.1f; (x) -= 0.1f; } |
This macro can be applied to a float variable to check whether it contains a denormalised value, and to normalise it if necessary.
On CPUs that aren't vulnerable to denormalisation problems, this will have no effect.
Referenced by Reverb::processMono().
#define PARAMETER_TYPE | ( | a | ) | typename TypeHelpers::ParameterType<a>::type |
A helpful macro to simplify the use of the ParameterType template.
typedef signed char int8 |
A platform-independent 8-bit signed integer type.
typedef unsigned char uint8 |
A platform-independent 8-bit unsigned integer type.
typedef signed short int16 |
A platform-independent 16-bit signed integer type.
typedef unsigned short uint16 |
A platform-independent 16-bit unsigned integer type.
typedef signed int int32 |
A platform-independent 32-bit signed integer type.
typedef unsigned int uint32 |
A platform-independent 32-bit unsigned integer type.
typedef long long int64 |
A platform-independent 64-bit integer type.
typedef unsigned long long uint64 |
A platform-independent 64-bit unsigned integer type.
typedef int pointer_sized_int |
A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it.
typedef unsigned int pointer_sized_uint |
An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it.
Type jmax | ( | const Type | a, |
const Type | b | ||
) |
Returns the larger of two values.
Referenced by Rectangle< int >::enlargeIfAdjacent(), Rectangle< int >::expand(), Rectangle< int >::expanded(), Rectangle< int >::findAreaContainingPoints(), PluginBusUtilities::findMaxNumberOfChannelsForBus(), Decibels::gainToDecibels(), RectangleList< int >::getBounds(), Rectangle< int >::getIntersection(), Range< int64 >::getIntersectionWith(), AudioBuffer< float >::getMagnitude(), Rectangle< int >::getUnion(), Range< int64 >::getUnionWith(), Rectangle< int >::intersectRectangle(), Rectangle< int >::intersectRectangles(), jmax(), AudioUnitHelpers::CoreAudioBufferList::prepare(), ResizableBorderComponent::Zone::resizeRectangleBy(), Rectangle< int >::setLeft(), Range< int64 >::setLength(), Draggable3DOrientation::setRadius(), Rectangle< int >::setTop(), Rectangle< int >::transformedBy(), Rectangle< int >::withBottom(), Rectangle< int >::withLeft(), Rectangle< int >::withRight(), Range< int64 >::withStart(), and Rectangle< int >::withTop().
Type jmax | ( | const Type | a, |
const Type | b, | ||
const Type | c | ||
) |
Returns the larger of three values.
Type jmax | ( | const Type | a, |
const Type | b, | ||
const Type | c, | ||
const Type | d | ||
) |
Returns the larger of four values.
References jmax().
Type jmin | ( | const Type | a, |
const Type | b | ||
) |
Returns the smaller of two values.
Referenced by Rectangle< int >::constrainedWithin(), SelectedItemSet< SelectableItemType >::deselectAll(), Rectangle< int >::enlargeIfAdjacent(), Rectangle< int >::findAreaContainingPoints(), PluginBusUtilities::findMaxNumberOfChannelsForBus(), RectangleList< int >::getBounds(), Rectangle< int >::getIntersection(), Range< int64 >::getIntersectionWith(), Draggable3DOrientation::getQuaternion(), Rectangle< int >::getUnion(), Range< int64 >::getUnionWith(), Rectangle< int >::intersectRectangle(), Rectangle< int >::intersectRectangles(), jmin(), Rectangle< int >::removeFromBottom(), Rectangle< int >::removeFromLeft(), Rectangle< int >::removeFromRight(), Rectangle< int >::removeFromTop(), SparseSet< int >::removeRange(), ResizableBorderComponent::Zone::resizeRectangleBy(), SelectedItemSet< SelectableItemType >::selectOnly(), Rectangle< int >::setBottom(), Rectangle< int >::setRight(), AudioBuffer< float >::setSize(), toString(), Rectangle< int >::transformedBy(), PixelARGB::unpremultiply(), Rectangle< int >::withBottom(), Range< int64 >::withEnd(), Rectangle< int >::withRight(), Line< ValueType >::withShortenedEnd(), and Line< ValueType >::withShortenedStart().
Type jmin | ( | const Type | a, |
const Type | b, | ||
const Type | c | ||
) |
Returns the smaller of three values.
Type jmin | ( | const Type | a, |
const Type | b, | ||
const Type | c, | ||
const Type | d | ||
) |
Returns the smaller of four values.
References jmin().
Type jmap | ( | Type | value0To1, |
Type | targetRangeMin, | ||
Type | targetRangeMax | ||
) |
Remaps a normalised value (between 0 and 1) to a target range.
This effectively returns (targetRangeMin + value0To1 * (targetRangeMax - targetRangeMin)).
Type jmap | ( | Type | sourceValue, |
Type | sourceRangeMin, | ||
Type | sourceRangeMax, | ||
Type | targetRangeMin, | ||
Type | targetRangeMax | ||
) |
Remaps a value from a source range to a target range.
References jassert.
Type findMinimum | ( | const Type * | data, |
int | numValues | ||
) |
Scans an array of values, returning the minimum value that it contains.
Type findMaximum | ( | const Type * | values, |
int | numValues | ||
) |
Scans an array of values, returning the maximum value that it contains.
void findMinAndMax | ( | const Type * | values, |
int | numValues, | ||
Type & | lowest, | ||
Type & | highest | ||
) |
Scans an array of values, returning the minimum and maximum values that it contains.
Referenced by AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::findMinAndMax().
|
noexcept |
Constrains a value to keep it within a given range.
This will check that the specified value lies between the lower and upper bounds specified, and if not, will return the nearest value that would be in-range. Effectively, it's like calling jmax (lowerLimit, jmin (upperLimit, value)).
Note that it expects that lowerLimit <= upperLimit. If this isn't true, the results will be unpredictable.
lowerLimit | the minimum value to return |
upperLimit | the maximum value to return |
valueToConstrain | the value to try to return |
References jassert.
Referenced by Range< int64 >::clipValue(), Rectangle< int >::constrainedWithin(), Range< int64 >::constrainRange(), Line< ValueType >::findNearestProportionalPositionTo(), Rectangle< int >::getConstrainedPoint(), Draggable3DOrientation::getQuaternion(), ReferenceCountedArray< AudioProcessorGraph::Node >::removeRange(), OwnedArray< MidiBuffer >::removeRange(), Array< Button::Listener * >::removeRange(), and MidiEventList::toEventList().
|
noexcept |
Returns true if a value is at least zero, and also below a specified upper limit.
This is basically a quicker way to write:
References jassert.
Referenced by AudioBuffer< float >::addFrom(), AudioBuffer< float >::addFromWithRamp(), AudioBuffer< float >::addSample(), AudioBuffer< float >::applyGain(), AudioBuffer< float >::applyGainRamp(), PluginBusUtilities::busCanBeDisabled(), PluginBusUtilities::busIgnoresLayout(), AudioBuffer< float >::clear(), AudioBuffer< float >::copyFrom(), AudioBuffer< float >::copyFromWithRamp(), AudioBuffer< float >::findMinMax(), MidiEventList::getEvent(), AudioBuffer< float >::getMagnitude(), PluginBusUtilities::getNumChannels(), ReferenceCountedArray< AudioProcessorGraph::Node >::getObjectPointer(), ReferenceCountedArray< AudioProcessorGraph::Node >::getObjectPointerUnchecked(), SparseSet< int >::getRange(), AudioBuffer< float >::getReadPointer(), Array< Button::Listener * >::getReference(), AudioBuffer< float >::getRMSLevel(), AudioBuffer< float >::getSample(), OwnedArray< MidiBuffer >::getUnchecked(), Array< Button::Listener * >::getUnchecked(), AudioBuffer< float >::getWritePointer(), Array< Button::Listener * >::insert(), OwnedArray< MidiBuffer >::insertArray(), Array< Button::Listener * >::insertArray(), Array< Button::Listener * >::insertMultiple(), PluginBusUtilities::isBusEnabledByDefault(), EdgeTable::iterate(), ReferenceCountedArray< AudioProcessorGraph::Node >::move(), OwnedArray< MidiBuffer >::move(), Array< Button::Listener * >::move(), OwnedArray< MidiBuffer >::operator[](), Array< Button::Listener * >::operator[](), ReferenceCountedArray< AudioProcessorGraph::Node >::remove(), OwnedArray< MidiBuffer >::remove(), Array< Button::Listener * >::remove(), ReferenceCountedArray< AudioProcessorGraph::Node >::removeAndReturn(), OwnedArray< MidiBuffer >::removeAndReturn(), AudioBuffer< float >::reverse(), Array< Button::Listener * >::set(), AudioBuffer< float >::setSample(), Array< Button::Listener * >::setUnchecked(), ReferenceCountedArray< AudioProcessorGraph::Node >::swap(), OwnedArray< MidiBuffer >::swap(), and Array< Button::Listener * >::swap().
|
noexcept |
References jassert.
|
noexcept |
Returns true if a value is at least zero, and also less than or equal to a specified upper limit.
This is basically a quicker way to write:
References jassert.
|
noexcept |
References jassert.
void swapVariables | ( | Type & | variable1, |
Type & | variable2 | ||
) |
Handy function to swap two values.
|
noexcept |
Handy function for avoiding unused variables warning.
Referenced by OwnedArray< MidiBuffer >::addSorted(), UndoableAction::createCoalescedAction(), ContainerDeletePolicy< ObjectType >::destroy(), MidiInputCallback::handlePartialSysexMessage(), ReferenceCountedArray< AudioProcessorGraph::Node >::indexOfSorted(), OwnedArray< MidiBuffer >::indexOfSorted(), Array< Button::Listener * >::indexOfSorted(), numElementsInArray(), PositionableAudioSource::setLooping(), ReferenceCountedArray< AudioProcessorGraph::Node >::sort(), OwnedArray< MidiBuffer >::sort(), and Array< Button::Listener * >::sort().
|
noexcept |
|
noexcept |
|
noexcept |
int numElementsInArray | ( | Type(&) | array[N] | ) |
Handy function for getting the number of elements in a simple const C array.
E.g.
References ignoreUnused().
Referenced by AudioBuffer< float >::reverse().
|
noexcept |
Using juce_hypot is easier than dealing with the different types of hypot function that are provided by the various platforms and compilers.
Referenced by Point< int >::getDistanceFrom(), Point< int >::getDistanceFromOrigin(), and Line< ValueType >::getPointAlongLine().
|
noexcept |
Converts an angle in degrees to radians.
|
noexcept |
Converts an angle in degrees to radians.
|
noexcept |
Converts an angle in radians to degrees.
References float_Pi.
|
noexcept |
Converts an angle in radians to degrees.
References double_Pi.
|
noexcept |
The isfinite() method seems to vary between platforms, so this is a platform-independent function for it.
Referenced by StatisticsAccumulator< FloatType >::addValue(), Point< int >::isFinite(), and Rectangle< int >::isFinite().
|
noexcept |
|
noexcept |
|
noexcept |
Fast floating-point-to-integer conversion.
This is faster than using the normal c++ cast to convert a float to an int, and it will round the value to the nearest integer, rather than rounding it down like the normal cast does.
Note that this routine gets its speed at the expense of some accuracy, and when rounding values whose floating point component is exactly 0.5, odd numbers and even numbers will be rounded up or down differently.
Referenced by AudioParameterInt::get(), AudioParameterChoice::getIndex(), roundDoubleToInt(), roundFloatToInt(), Point< int >::roundToInt(), roundToIntAccurate(), MidiEventList::toEventList(), and Rectangle< int >::toNearestInt().
|
noexcept |
|
noexcept |
Fast floating-point-to-integer conversion.
This is a slightly slower and slightly more accurate version of roundDoubleToInt(). It works fine for values above zero, but negative numbers are rounded the wrong way.
References roundToInt().
|
noexcept |
Fast floating-point-to-integer conversion.
This is faster than using the normal c++ cast to convert a double to an int, and it will round the value to the nearest integer, rather than rounding it down like the normal cast does.
Note that this routine gets its speed at the expense of some accuracy, and when rounding values whose floating point component is exactly 0.5, odd numbers and even numbers will be rounded up or down differently. For a more accurate conversion, see roundDoubleToIntAccurate().
References roundToInt().
|
noexcept |
Fast floating-point-to-integer conversion.
This is faster than using the normal c++ cast to convert a float to an int, and it will round the value to the nearest integer, rather than rounding it down like the normal cast does.
Note that this routine gets its speed at the expense of some accuracy, and when rounding values whose floating point component is exactly 0.5, odd numbers and even numbers will be rounded up or down differently.
References roundToInt().
bool isPowerOfTwo | ( | IntegerType | value | ) |
Returns true if the specified integer is a power-of-two.
|
noexcept |
Returns the smallest power-of-two which is equal to or greater than the given integer.
|
noexcept |
Returns the number of bits in a 32-bit integer.
Referenced by countNumberOfBits().
|
noexcept |
Returns the number of bits in a 64-bit integer.
References countNumberOfBits().
|
noexcept |
Performs a modulo operation, but can cope with the dividend being negative.
The divisor must be greater than zero.
References jassert.
|
noexcept |
Returns the square of its argument.
const double double_Pi = 3.1415926535897932384626433832795 |
const float float_Pi = 3.14159265358979323846f |