diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 9ed7452e9d..0e9a7136ad 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -1049,7 +1049,7 @@ protected: #define JUCE_AMALGAMATED_TEMPLATE 1 -#if JUCE_BUILD_NATIVE +#if (JUCE_BUILD_NATIVE || JUCE_BUILD_AMALGAMATION) && ! defined (__JUCE_AMALGAMATED_TEMPLATE_JUCEHEADER__) #include "juce_amalgamated.h" // FORCE_AMALGAMATOR_INCLUDE #endif @@ -28650,18 +28650,21 @@ void AudioSampleBuffer::setSize (const int newNumChannels, HeapBlock newData; newData.allocate (newTotalBytes, clearExtraSpace); - const int numChansToCopy = jmin (numChannels, newNumChannels); const size_t numBytesToCopy = sizeof (float) * jmin (newNumSamples, size); float** const newChannels = reinterpret_cast (newData.getData()); float* newChan = reinterpret_cast (newData + channelListSize); - for (int i = 0; i < numChansToCopy; ++i) + + for (int j = 0; j < newNumChannels; ++j) { - memcpy (newChan, channels[i], numBytesToCopy); - newChannels[i] = newChan; + newChannels[j] = newChan; newChan += newNumSamples; } + const int numChansToCopy = jmin (numChannels, newNumChannels); + for (int i = 0; i < numChansToCopy; ++i) + memcpy (newChannels[i], channels[i], numBytesToCopy); + allocatedData.swapWith (newData); allocatedBytes = (int) newTotalBytes; channels = newChannels; @@ -36215,8 +36218,12 @@ private: void removeView (HIViewRef) { - owner->dispatch (effEditClose, 0, 0, 0, 0); - owner->dispatch (effEditSleep, 0, 0, 0, 0); + if (owner->isOpen) + { + owner->isOpen = false; + owner->dispatch (effEditClose, 0, 0, 0, 0); + owner->dispatch (effEditSleep, 0, 0, 0, 0); + } } bool getEmbeddedViewSize (int& w, int& h) @@ -282841,7 +282848,7 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis { [NSApp setPresentationOptions: NSApplicationPresentationDefault]; } - #else + #elif JUCE_SUPPORT_CARBON if (enableOrDisable) { SetSystemUIMode (kUIModeAllSuppressed, allowMenusAndBars ? kUIOptionAutoShowMenuBar : 0); @@ -282851,6 +282858,8 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis { SetSystemUIMode (kUIModeNormal, 0); } + #else + jassertfalse; #endif } diff --git a/src/audio/dsp/juce_AudioSampleBuffer.cpp b/src/audio/dsp/juce_AudioSampleBuffer.cpp index 0b1d5431b2..983eee02e0 100644 --- a/src/audio/dsp/juce_AudioSampleBuffer.cpp +++ b/src/audio/dsp/juce_AudioSampleBuffer.cpp @@ -171,18 +171,21 @@ void AudioSampleBuffer::setSize (const int newNumChannels, HeapBlock newData; newData.allocate (newTotalBytes, clearExtraSpace); - const int numChansToCopy = jmin (numChannels, newNumChannels); const size_t numBytesToCopy = sizeof (float) * jmin (newNumSamples, size); float** const newChannels = reinterpret_cast (newData.getData()); float* newChan = reinterpret_cast (newData + channelListSize); - for (int i = 0; i < numChansToCopy; ++i) + + for (int j = 0; j < newNumChannels; ++j) { - memcpy (newChan, channels[i], numBytesToCopy); - newChannels[i] = newChan; + newChannels[j] = newChan; newChan += newNumSamples; } + const int numChansToCopy = jmin (numChannels, newNumChannels); + for (int i = 0; i < numChansToCopy; ++i) + memcpy (newChannels[i], channels[i], numBytesToCopy); + allocatedData.swapWith (newData); allocatedBytes = (int) newTotalBytes; channels = newChannels; diff --git a/src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp b/src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp index 057bc59b87..7b9da19be6 100644 --- a/src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp +++ b/src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp @@ -1822,8 +1822,12 @@ private: void removeView (HIViewRef) { - owner->dispatch (effEditClose, 0, 0, 0, 0); - owner->dispatch (effEditSleep, 0, 0, 0, 0); + if (owner->isOpen) + { + owner->isOpen = false; + owner->dispatch (effEditClose, 0, 0, 0, 0); + owner->dispatch (effEditSleep, 0, 0, 0, 0); + } } bool getEmbeddedViewSize (int& w, int& h) diff --git a/src/native/mac/juce_mac_NSViewComponentPeer.mm b/src/native/mac/juce_mac_NSViewComponentPeer.mm index a14dc709f5..714b06e594 100644 --- a/src/native/mac/juce_mac_NSViewComponentPeer.mm +++ b/src/native/mac/juce_mac_NSViewComponentPeer.mm @@ -1753,7 +1753,7 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis { [NSApp setPresentationOptions: NSApplicationPresentationDefault]; } - #else + #elif JUCE_SUPPORT_CARBON if (enableOrDisable) { SetSystemUIMode (kUIModeAllSuppressed, allowMenusAndBars ? kUIOptionAutoShowMenuBar : 0); @@ -1763,6 +1763,8 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis { SetSystemUIMode (kUIModeNormal, 0); } + #else + jassertfalse; #endif }