The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

81 lines
3.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_FLOATVECTOROPERATIONS_JUCEHEADER__
  19. #define __JUCE_FLOATVECTOROPERATIONS_JUCEHEADER__
  20. //==============================================================================
  21. /**
  22. A collection of simple vector operations on arrays of floats, accelerated with
  23. SIMD instructions where possible.
  24. */
  25. class JUCE_API FloatVectorOperations
  26. {
  27. public:
  28. //==============================================================================
  29. /** Clears a vector of floats. */
  30. static void JUCE_CALLTYPE clear (float* dest, int numValues) noexcept;
  31. /** Copies a repeated value into a vector of floats. */
  32. static void JUCE_CALLTYPE fill (float* dest, float valueToFill, int numValues) noexcept;
  33. /** Copies a vector of floats. */
  34. static void JUCE_CALLTYPE copy (float* dest, const float* src, int numValues) noexcept;
  35. /** Copies a vector of floats, multiplying each value by a given multiplier */
  36. static void JUCE_CALLTYPE copyWithMultiply (float* dest, const float* src, float multiplier, int numValues) noexcept;
  37. /** Adds the source values to the destination values. */
  38. static void JUCE_CALLTYPE add (float* dest, const float* src, int numValues) noexcept;
  39. /** Adds a fixed value to the destination values. */
  40. static void JUCE_CALLTYPE add (float* dest, float amount, int numValues) noexcept;
  41. /** Multiplies each source value by the given multiplier, then adds it to the destination value. */
  42. static void JUCE_CALLTYPE addWithMultiply (float* dest, const float* src, float multiplier, int numValues) noexcept;
  43. /** Multiplies the destination values by the source values. */
  44. static void JUCE_CALLTYPE multiply (float* dest, const float* src, int numValues) noexcept;
  45. /** Multiplies each of the destination values by a fixed multiplier. */
  46. static void JUCE_CALLTYPE multiply (float* dest, float multiplier, int numValues) noexcept;
  47. /** Converts a stream of integers to floats, multiplying each one by the given multiplier. */
  48. static void JUCE_CALLTYPE convertFixedToFloat (float* dest, const int* src, float multiplier, int numValues) noexcept;
  49. /** Finds the miniumum and maximum values in the given array. */
  50. static void JUCE_CALLTYPE findMinAndMax (const float* src, int numValues, float& minResult, float& maxResult) noexcept;
  51. /** Finds the miniumum value in the given array. */
  52. static float JUCE_CALLTYPE findMinimum (const float* src, int numValues) noexcept;
  53. /** Finds the maximum value in the given array. */
  54. static float JUCE_CALLTYPE findMaximum (const float* src, int numValues) noexcept;
  55. };
  56. #endif // __JUCE_FLOATVECTOROPERATIONS_JUCEHEADER__