diff --git a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h index 451dc608fa..9ea81f51df 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h +++ b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h @@ -23,53 +23,6 @@ namespace juce { -#ifndef DOXYGEN -/** The contents of this namespace are used to implement AudioBuffer and should - not be used elsewhere. Their interfaces (and existence) are liable to change! -*/ -namespace detail -{ - /** On iOS/arm7 the alignment of `double` is greater than the alignment of - `std::max_align_t`, so we can't trust max_align_t. Instead, we query - lots of primitive types and use the maximum alignment of all of them. - - We're putting this stuff outside AudioBuffer itself to avoid creating - unnecessary copies for each distinct template instantiation of - AudioBuffer. - - MSVC 2015 doesn't like when we write getMaxAlignment as a loop which - accumulates the max alignment (declarations not allowed in constexpr - function body) so instead we use this recursive version which - instantiates a zillion templates. - */ - - template struct Type {}; - - constexpr size_t getMaxAlignment() noexcept { return 0; } - - template - constexpr size_t getMaxAlignment (Type, Type... tail) noexcept - { - return jmax (alignof (Head), getMaxAlignment (tail...)); - } - - constexpr size_t maxAlignment = getMaxAlignment (Type{}, - Type{}, - Type{}, - Type{}, - Type{}, - Type{}, - Type{}, - Type{}, - Type{}, - Type{}, - Type{}, - Type{}, - Type{}, - Type{}); -} // namespace detail -#endif - //============================================================================== /** A multi-channel buffer containing floating point audio samples. @@ -1215,17 +1168,10 @@ public: private: //============================================================================== - int numChannels = 0, size = 0; - size_t allocatedBytes = 0; - Type** channels; - HeapBlock allocatedData; - Type* preallocatedChannelSpace[32]; - bool isClear = false; - void allocateData() { #if (! JUCE_GCC || (__GNUC__ * 100 + __GNUC_MINOR__) >= 409) - static_assert (alignof (Type) <= detail::maxAlignment, + static_assert (alignof (Type) <= maxAlignment, "AudioBuffer cannot hold types with alignment requirements larger than that guaranteed by malloc"); #endif jassert (size >= 0); @@ -1278,6 +1224,43 @@ private: isClear = false; } + /* On iOS/arm7 the alignment of `double` is greater than the alignment of + `std::max_align_t`, so we can't trust max_align_t. Instead, we query + lots of primitive types and use the maximum alignment of all of them. + */ + static constexpr size_t getMaxAlignment() noexcept + { + constexpr size_t alignments[] { alignof (std::max_align_t), + alignof (void*), + alignof (float), + alignof (double), + alignof (long double), + alignof (short int), + alignof (int), + alignof (long int), + alignof (long long int), + alignof (bool), + alignof (char), + alignof (char16_t), + alignof (char32_t), + alignof (wchar_t) }; + + size_t max = 0; + + for (const auto elem : alignments) + max = jmax (max, elem); + + return max; + } + + int numChannels = 0, size = 0; + size_t allocatedBytes = 0; + Type** channels; + HeapBlock allocatedData; + Type* preallocatedChannelSpace[32]; + bool isClear = false; + static constexpr size_t maxAlignment = getMaxAlignment(); + JUCE_LEAK_DETECTOR (AudioBuffer) }; diff --git a/modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp b/modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp index cdbcd122f1..b0593bb349 100644 --- a/modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp +++ b/modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp @@ -91,9 +91,9 @@ void BufferingAudioSource::releaseResources() buffer.setSize (numberOfChannels, 0); - // MSVC2015 seems to need this if statement to not generate a warning during linking. + // MSVC2017 seems to need this if statement to not generate a warning during linking. // As source is set in the constructor, there is no way that source could - // ever equal this, but it seems to make MSVC2015 happy. + // ever equal this, but it seems to make MSVC2017 happy. if (source != this) source->releaseResources(); } diff --git a/modules/juce_dsp/juce_dsp.h b/modules/juce_dsp/juce_dsp.h index 0253225119..fa3694c773 100644 --- a/modules/juce_dsp/juce_dsp.h +++ b/modules/juce_dsp/juce_dsp.h @@ -93,7 +93,7 @@ #ifndef JUCE_VECTOR_CALLTYPE // __vectorcall does not work on 64-bit due to internal compiler error in - // release mode in both VS2015 and VS2017. Re-enable when Microsoft fixes this + // release mode VS2017. Re-enable when Microsoft fixes this #if _MSC_VER && JUCE_USE_SIMD && ! (defined(_M_X64) || defined(__amd64__)) #define JUCE_VECTOR_CALLTYPE __vectorcall #else diff --git a/modules/juce_gui_extra/misc/juce_ColourSelector.cpp b/modules/juce_gui_extra/misc/juce_ColourSelector.cpp index 07b1a5d54a..91d014335b 100644 --- a/modules/juce_gui_extra/misc/juce_ColourSelector.cpp +++ b/modules/juce_gui_extra/misc/juce_ColourSelector.cpp @@ -411,12 +411,8 @@ ColourSelector::ColourSelector (int sectionsToShow, int edge, int gapAroundColou sliders[3]->setVisible ((flags & showAlphaChannel) != 0); - // VS2015 needs some scoping braces around this if statement to - // avoid a compiler bug. for (auto& slider : sliders) - { slider->onValueChange = [this] { changeColour(); }; - } } if ((flags & showColourspace) != 0)