Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
4.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef JUCE_FLOATVECTOROPERATIONS_H_INCLUDED
  18. #define JUCE_FLOATVECTOROPERATIONS_H_INCLUDED
  19. //==============================================================================
  20. /**
  21. A collection of simple vector operations on arrays of floats, accelerated with
  22. SIMD instructions where possible.
  23. */
  24. class JUCE_API FloatVectorOperations
  25. {
  26. public:
  27. //==============================================================================
  28. /** Clears a vector of floats. */
  29. static void JUCE_CALLTYPE clear (float* dest, int numValues) noexcept;
  30. /** Copies a repeated value into a vector of floats. */
  31. static void JUCE_CALLTYPE fill (float* dest, float valueToFill, int numValues) noexcept;
  32. /** Copies a vector of floats. */
  33. static void JUCE_CALLTYPE copy (float* dest, const float* src, int numValues) noexcept;
  34. /** Copies a vector of floats, multiplying each value by a given multiplier */
  35. static void JUCE_CALLTYPE copyWithMultiply (float* dest, const float* src, float multiplier, int numValues) noexcept;
  36. /** Adds the source values to the destination values. */
  37. static void JUCE_CALLTYPE add (float* dest, const float* src, int numValues) noexcept;
  38. /** Adds a fixed value to the destination values. */
  39. static void JUCE_CALLTYPE add (float* dest, float amount, int numValues) noexcept;
  40. /** Multiplies each source value by the given multiplier, then adds it to the destination value. */
  41. static void JUCE_CALLTYPE addWithMultiply (float* dest, const float* src, float multiplier, int numValues) noexcept;
  42. /** Multiplies the destination values by the source values. */
  43. static void JUCE_CALLTYPE multiply (float* dest, const float* src, int numValues) noexcept;
  44. /** Multiplies each of the destination values by a fixed multiplier. */
  45. static void JUCE_CALLTYPE multiply (float* dest, float multiplier, int numValues) noexcept;
  46. /** Copies a source vector to a destination, negating each value. */
  47. static void JUCE_CALLTYPE negate (float* dest, const float* src, int numValues) noexcept;
  48. /** Converts a stream of integers to floats, multiplying each one by the given multiplier. */
  49. static void JUCE_CALLTYPE convertFixedToFloat (float* dest, const int* src, float multiplier, int numValues) noexcept;
  50. /** Finds the miniumum and maximum values in the given array. */
  51. static void JUCE_CALLTYPE findMinAndMax (const float* src, int numValues, float& minResult, float& maxResult) noexcept;
  52. /** Finds the miniumum value in the given array. */
  53. static float JUCE_CALLTYPE findMinimum (const float* src, int numValues) noexcept;
  54. /** Finds the maximum value in the given array. */
  55. static float JUCE_CALLTYPE findMaximum (const float* src, int numValues) noexcept;
  56. /** On Intel CPUs, this method enables or disables the SSE flush-to-zero mode.
  57. Effectively, this is a wrapper around a call to _MM_SET_FLUSH_ZERO_MODE
  58. */
  59. static void JUCE_CALLTYPE enableFlushToZeroMode (bool shouldEnable) noexcept;
  60. };
  61. #endif // JUCE_FLOATVECTOROPERATIONS_H_INCLUDED