diff --git a/extras/JuceDemo/Builds/Android/local.properties b/extras/JuceDemo/Builds/Android/local.properties
index d04423f3c7..9056a243f3 100644
--- a/extras/JuceDemo/Builds/Android/local.properties
+++ b/extras/JuceDemo/Builds/Android/local.properties
@@ -2,5 +2,5 @@
# It is automatically generated by the Jucer - DO NOT EDIT IT or your changes will be lost!.
sdk.dir=${user.home}/SDKs/android-sdk-mac_x86
-ndk.dir=${user.home}/SDKs/android-ndk-r5
+ndk.dir=${user.home}/SDKs/android-ndk-r5b
diff --git a/extras/JuceDemo/Juce Demo.jucer b/extras/JuceDemo/Juce Demo.jucer
index c1874be94d..c05c6eae9d 100644
--- a/extras/JuceDemo/Juce Demo.jucer
+++ b/extras/JuceDemo/Juce Demo.jucer
@@ -22,7 +22,7 @@
diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp
index 358c122a33..5fa413e912 100644
--- a/juce_amalgamated.cpp
+++ b/juce_amalgamated.cpp
@@ -921,6 +921,7 @@ protected:
#include
#include
#include
+#include
#include
#include
#include
@@ -1716,7 +1717,7 @@ const String SystemStats::getJUCEVersion()
#undef JUCE_STRINGIFYVERSION2
}
-#if JUCE_DEBUG
+#if JUCE_DEBUG && ! JUCE_ANDROID
struct JuceVersionPrinter
{
JuceVersionPrinter()
@@ -24328,8 +24329,8 @@ void AudioFormatReaderSource::getNextAudioBlock (const AudioSourceChannelInfo& i
if (looping)
{
- const int newStart = start % (int) reader->lengthInSamples;
- const int newEnd = (start + info.numSamples) % (int) reader->lengthInSamples;
+ const int newStart = (int) (start % (int) reader->lengthInSamples);
+ const int newEnd = (int) ((start + info.numSamples) % (int) reader->lengthInSamples);
if (newEnd > newStart)
{
@@ -24990,8 +24991,8 @@ void BufferingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& info
{
for (int chan = jmin (numberOfChannels, info.buffer->getNumChannels()); --chan >= 0;)
{
- const int startBufferIndex = (validStart + nextPlayPos) % buffer.getNumSamples();
- const int endBufferIndex = (validEnd + nextPlayPos) % buffer.getNumSamples();
+ const int startBufferIndex = (int) ((validStart + nextPlayPos) % buffer.getNumSamples());
+ const int endBufferIndex = (int) ((validEnd + nextPlayPos) % buffer.getNumSamples());
if (startBufferIndex < endBufferIndex)
{
@@ -25094,8 +25095,8 @@ bool BufferingAudioSource::readNextBufferChunk()
if (sectionToReadStart != sectionToReadEnd)
{
- const int bufferIndexStart = sectionToReadStart % buffer.getNumSamples();
- const int bufferIndexEnd = sectionToReadEnd % buffer.getNumSamples();
+ const int bufferIndexStart = (int) (sectionToReadStart % buffer.getNumSamples());
+ const int bufferIndexEnd = (int) (sectionToReadEnd % buffer.getNumSamples());
if (bufferIndexStart < bufferIndexEnd)
{
@@ -29521,7 +29522,7 @@ int MidiMessage::getNoteNumber() const noexcept
void MidiMessage::setNoteNumber (const int newNoteNumber) noexcept
{
if (isNoteOnOrOff())
- data[1] = newNoteNumber & 127;
+ data[1] = (char) (newNoteNumber & 127);
}
uint8 MidiMessage::getVelocity() const noexcept
@@ -33644,6 +33645,28 @@ static VstIntPtr VSTCALLBACK audioMaster (AEffect* effect, VstInt32 opcode, VstI
static int shellUIDToCreate = 0;
static int insideVSTCallback = 0;
+class IdleCallRecursionPreventer
+{
+public:
+ IdleCallRecursionPreventer()
+ : isMessageThread (MessageManager::getInstance()->isThisTheMessageThread())
+ {
+ if (isMessageThread)
+ ++insideVSTCallback;
+ }
+
+ ~IdleCallRecursionPreventer()
+ {
+ if (isMessageThread)
+ --insideVSTCallback;
+ }
+
+private:
+ const bool isMessageThread;
+
+ JUCE_DECLARE_NON_COPYABLE (IdleCallRecursionPreventer);
+};
+
class VSTPluginWindow;
// Change this to disable logging of various VST activities
@@ -33799,7 +33822,8 @@ public:
}
_fpreset(); // (doesn't do any harm)
- ++insideVSTCallback;
+
+ const IdleCallRecursionPreventer icrp;
shellUIDToCreate = 0;
log ("Attempting to load VST: " + file.getFullPathName());
@@ -33809,7 +33833,6 @@ public:
if (! m->open())
m = nullptr;
- --insideVSTCallback;
_fpreset(); // (doesn't do any harm)
return m.release();
@@ -33818,24 +33841,21 @@ public:
ModuleHandle (const File& file_)
: file (file_),
moduleMain (0),
-#if JUCE_WINDOWS || JUCE_LINUX
+ #if JUCE_WINDOWS || JUCE_LINUX
hModule (0)
-#elif JUCE_MAC
- fragId (0),
- resHandle (0),
- bundleRef (0),
- resFileId (0)
-#endif
+ #elif JUCE_MAC
+ fragId (0), resHandle (0), bundleRef (0), resFileId (0)
+ #endif
{
getActiveModules().add (this);
-#if JUCE_WINDOWS || JUCE_LINUX
+ #if JUCE_WINDOWS || JUCE_LINUX
fullParentDirectoryPathName = file_.getParentDirectory().getFullPathName();
-#elif JUCE_MAC
+ #elif JUCE_MAC
FSRef ref;
PlatformUtilities::makeFSRefFromPath (&ref, file_.getParentDirectory().getFullPathName());
FSGetCatalogInfo (&ref, kFSCatInfoNone, 0, 0, &parentDirFSSpec, 0);
-#endif
+ #endif
}
~ModuleHandle()
@@ -33850,7 +33870,7 @@ public:
bool open()
{
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
static bool timePeriodSet = false;
if (! timePeriodSet)
@@ -33858,7 +33878,7 @@ public:
timePeriodSet = true;
timeBeginPeriod (2);
}
-#endif
+ #endif
pluginName = file.getFileNameWithoutExtension();
@@ -34009,7 +34029,7 @@ public:
void close()
{
-#if JUCE_PPC
+ #if JUCE_PPC
if (fragId != 0)
{
if (moduleMain != 0)
@@ -34022,7 +34042,7 @@ public:
CloseResFile (resFileId);
}
else
-#endif
+ #endif
if (bundleRef != 0)
{
CFBundleCloseBundleResourceMap (bundleRef, resFileId);
@@ -34037,7 +34057,7 @@ public:
void closeEffect (AEffect* eff)
{
-#if JUCE_PPC
+ #if JUCE_PPC
if (fragId != 0)
{
Array thingsToDelete;
@@ -34053,13 +34073,13 @@ public:
disposeMachOFromCFM (thingsToDelete[i]);
}
else
-#endif
+ #endif
{
eff->dispatcher (eff, effClose, 0, 0, 0, 0);
}
}
-#if JUCE_PPC
+ #if JUCE_PPC
static void* newMachOFromCFM (void* cfmfp)
{
if (cfmfp == 0)
@@ -34094,7 +34114,7 @@ public:
eff->processReplacing = (AEffectProcessProc) newMachOFromCFM ((void*) eff->processReplacing);
}
}
-#endif
+ #endif
#endif
@@ -34238,7 +34258,8 @@ private:
};
VSTPluginInstance::VSTPluginInstance (const ReferenceCountedObjectPtr & module_)
- : effect (0),
+ : effect (nullptr),
+ name (module_->pluginName),
wantsMidiMessages (false),
initialised (false),
isPowerOn (false),
@@ -34247,40 +34268,36 @@ VSTPluginInstance::VSTPluginInstance (const ReferenceCountedObjectPtr pluginName;
log ("Creating VST instance: " + name);
-#if JUCE_MAC
+ #if JUCE_MAC
if (module->resFileId != 0)
UseResFile (module->resFileId);
-#if JUCE_PPC
+ #if JUCE_PPC
if (module->fragId != 0)
{
static void* audioMasterCoerced = nullptr;
- if (audioMasterCoerced == 0)
+ if (audioMasterCoerced == nullptr)
audioMasterCoerced = NewCFMFromMachO ((void*) &audioMaster);
effect = module->moduleMain ((audioMasterCallback) audioMasterCoerced);
}
else
-#endif
-#endif
+ #endif
+ #endif
{
effect = module->moduleMain (&audioMaster);
}
- --insideVSTCallback;
-
if (effect != nullptr && effect->magic == kEffectMagic)
{
-#if JUCE_PPC
+ #if JUCE_PPC
module->coerceAEffectFunctionCalls (effect);
-#endif
+ #endif
jassert (effect->resvd2 == 0);
jassert (effect->object != 0);
@@ -34293,25 +34310,21 @@ VSTPluginInstance::VSTPluginInstance (const ReferenceCountedObjectPtr magic == kEffectMagic)
{
try
{
-#if JUCE_MAC
+ #if JUCE_MAC
if (module->resFileId != 0)
UseResFile (module->resFileId);
-#endif
+ #endif
// Must delete any editors before deleting the plugin instance!
jassert (getActiveEditor() == 0);
@@ -34547,9 +34560,9 @@ public:
VSTPluginWindow (VSTPluginInstance& plugin_)
: AudioProcessorEditor (&plugin_),
-#if ! JUCE_MAC
+ #if ! JUCE_MAC
ComponentMovementWatcher (this),
-#endif
+ #endif
plugin (plugin_),
isOpen (false),
recursiveResize (false),
@@ -34600,17 +34613,17 @@ public:
recursiveResize = true;
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
if (pluginHWND != 0)
MoveWindow (pluginHWND, pos.getX(), pos.getY(), getWidth(), getHeight(), TRUE);
-#elif JUCE_LINUX
+ #elif JUCE_LINUX
if (pluginWindow != 0)
{
XResizeWindow (display, pluginWindow, getWidth(), getHeight());
XMoveWindow (display, pluginWindow, pos.getX(), pos.getY());
XMapRaised (display, pluginWindow);
}
-#endif
+ #endif
recursiveResize = false;
}
@@ -34660,7 +34673,7 @@ public:
const Point pos (getScreenPosition() - peer->getScreenPosition());
peer->addMaskedRegion (pos.getX(), pos.getY(), getWidth(), getHeight());
-#if JUCE_LINUX
+ #if JUCE_LINUX
if (pluginWindow != 0)
{
const Rectangle clip (g.getClipBounds());
@@ -34676,7 +34689,7 @@ public:
sendEventToChild (&ev);
}
-#endif
+ #endif
}
}
else
@@ -34688,14 +34701,14 @@ public:
void timerCallback()
{
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
if (--sizeCheckCount <= 0)
{
sizeCheckCount = 10;
checkPluginWindowSize();
}
-#endif
+ #endif
try
{
@@ -34714,7 +34727,7 @@ public:
void mouseDown (const MouseEvent& e)
{
-#if JUCE_LINUX
+ #if JUCE_LINUX
if (pluginWindow == 0)
return;
@@ -34735,11 +34748,11 @@ public:
sendEventToChild (&ev);
-#elif JUCE_WINDOWS
+ #elif JUCE_WINDOWS
(void) e;
toFront (true);
-#endif
+ #endif
}
void broughtToFront()
@@ -34747,9 +34760,9 @@ public:
activeVSTWindows.removeValue (this);
activeVSTWindows.add (this);
-#if JUCE_MAC
+ #if JUCE_MAC
dispatch (effEditTop, 0, 0, 0, 0);
-#endif
+ #endif
}
private:
@@ -34757,14 +34770,14 @@ private:
bool isOpen, recursiveResize;
bool pluginWantsKeys, pluginRefusesToResize, alreadyInside;
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
HWND pluginHWND;
void* originalWndProc;
int sizeCheckCount;
-#elif JUCE_LINUX
+ #elif JUCE_LINUX
Window pluginWindow;
EventProcPtr pluginProc;
-#endif
+ #endif
#if JUCE_MAC
void openPluginWindow (WindowRef parentWindow)
@@ -34829,7 +34842,7 @@ private:
// Install keyboard hooks
pluginWantsKeys = (dispatch (effKeysRequired, 0, 0, 0, 0) == 0);
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
originalWndProc = 0;
pluginHWND = GetWindow ((HWND) getWindowHandle(), GW_CHILD);
@@ -34884,7 +34897,7 @@ private:
}
}
-#elif JUCE_LINUX
+ #elif JUCE_LINUX
pluginWindow = getChildWindow ((Window) getWindowHandle());
if (pluginWindow != 0)
@@ -34907,7 +34920,7 @@ private:
if (pluginWindow != 0)
XMapRaised (display, pluginWindow);
-#endif
+ #endif
// double-check it's not too tiny
w = jmax (w, 32);
@@ -34915,9 +34928,9 @@ private:
setSize (w, h);
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
checkPluginWindowSize();
-#endif
+ #endif
startTimer (18 + JUCE_NAMESPACE::Random::getSystemRandom().nextInt (5));
repaint();
@@ -34934,7 +34947,7 @@ private:
dispatch (effEditClose, 0, 0, 0, 0);
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
#pragma warning (push)
#pragma warning (disable: 4244)
@@ -34949,11 +34962,11 @@ private:
DestroyWindow (pluginHWND);
pluginHWND = 0;
-#elif JUCE_LINUX
+ #elif JUCE_LINUX
stopTimer();
pluginWindow = 0;
pluginProc = 0;
-#endif
+ #endif
}
}
#endif
@@ -35526,35 +35539,30 @@ void VSTPluginInstance::timerCallback()
int VSTPluginInstance::dispatch (const int opcode, const int index, const int value, void* const ptr, float opt) const
{
- const ScopedLock sl (lock);
-
- ++insideVSTCallback;
int result = 0;
- try
+ if (effect != nullptr)
{
- if (effect != 0)
+ const ScopedLock sl (lock);
+ const IdleCallRecursionPreventer icrp;
+
+ try
{
- #if JUCE_MAC
+ #if JUCE_MAC
if (module->resFileId != 0)
UseResFile (module->resFileId);
- #endif
+ #endif
result = effect->dispatcher (effect, opcode, index, value, ptr, opt);
- #if JUCE_MAC
+ #if JUCE_MAC
module->resFileId = CurResFile();
- #endif
-
- --insideVSTCallback;
- return result;
+ #endif
}
- }
- catch (...)
- {
+ catch (...)
+ {}
}
- --insideVSTCallback;
return result;
}
@@ -35650,19 +35658,19 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs
case audioMasterIdle:
if (insideVSTCallback == 0 && MessageManager::getInstance()->isThisTheMessageThread())
{
- ++insideVSTCallback;
-#if JUCE_MAC
+ const IdleCallRecursionPreventer icrp;
+
+ #if JUCE_MAC
if (getActiveEditor() != nullptr)
dispatch (effEditIdle, 0, 0, 0, 0);
-#endif
+ #endif
+
juce_callAnyTimersSynchronously();
handleUpdateNowIfNeeded();
for (int i = ComponentPeer::getNumPeers(); --i >= 0;)
ComponentPeer::getPeer (i)->performAnyPendingRepaintsNow();
-
- --insideVSTCallback;
}
break;
@@ -36117,10 +36125,10 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray & resul
try
{
-#if JUCE_MAC
+ #if JUCE_MAC
if (instance->module->resFileId != 0)
UseResFile (instance->module->resFileId);
-#endif
+ #endif
instance->fillInPluginDescription (desc);
@@ -36131,9 +36139,7 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray & resul
// Normal plugin...
results.add (new PluginDescription (desc));
- ++insideVSTCallback;
instance->dispatch (effOpen, 0, 0, 0, 0);
- --insideVSTCallback;
}
else
{
@@ -36218,11 +36224,11 @@ bool VSTPluginFormat::fileMightContainThisPluginType (const String& fileOrIdenti
{
const File f (fileOrIdentifier);
-#if JUCE_MAC
+ #if JUCE_MAC
if (f.isDirectory() && f.hasFileExtension (".vst"))
return true;
-#if JUCE_PPC
+ #if JUCE_PPC
FSRef fileRef;
if (PlatformUtilities::makeFSRefFromPath (&fileRef, f.getFullPathName()))
{
@@ -36237,14 +36243,14 @@ bool VSTPluginFormat::fileMightContainThisPluginType (const String& fileOrIdenti
return true;
}
}
-#endif
+ #endif
return false;
-#elif JUCE_WINDOWS
+ #elif JUCE_WINDOWS
return f.existsAsFile() && f.hasFileExtension (".dll");
-#elif JUCE_LINUX
+ #elif JUCE_LINUX
return f.existsAsFile() && f.hasFileExtension (".so");
-#endif
+ #endif
}
const String VSTPluginFormat::getNameOfPluginFromIdentifier (const String& fileOrIdentifier)
@@ -36291,15 +36297,15 @@ void VSTPluginFormat::recursiveFileSearch (StringArray& results, const File& dir
const FileSearchPath VSTPluginFormat::getDefaultLocationsToSearch()
{
-#if JUCE_MAC
+ #if JUCE_MAC
return FileSearchPath ("~/Library/Audio/Plug-Ins/VST;/Library/Audio/Plug-Ins/VST");
-#elif JUCE_WINDOWS
+ #elif JUCE_WINDOWS
const String programFiles (File::getSpecialLocation (File::globalApplicationsDirectory).getFullPathName());
return FileSearchPath (programFiles + "\\Steinberg\\VstPlugins");
-#elif JUCE_LINUX
+ #elif JUCE_LINUX
return FileSearchPath ("/usr/lib/vst");
-#endif
+ #endif
}
END_JUCE_NAMESPACE
@@ -39667,7 +39673,7 @@ BEGIN_JUCE_NAMESPACE
MessageManager* MessageManager::instance = nullptr;
-static const int quitMessageId = 0xfffff321;
+enum { quitMessageId = 0xfffff321 };
MessageManager::MessageManager() noexcept
: quitMessagePosted (false),
@@ -39733,7 +39739,7 @@ void MessageManager::deliverMessage (Message* const message)
{
callbackMessage->messageCallback();
}
- else if (message->intParameter1 == quitMessageId)
+ else if (message->intParameter1 == (int) quitMessageId)
{
quitMessageReceived = true;
}
@@ -39756,7 +39762,7 @@ void MessageManager::runDispatchLoop()
void MessageManager::stopDispatchLoop()
{
- postMessageToQueue (new Message (quitMessageId, 0, 0, nullptr));
+ postMessageToQueue (new Message ((int) quitMessageId, 0, 0, nullptr));
quitMessagePosted = true;
}
@@ -62219,7 +62225,7 @@ CaretComponent::~CaretComponent()
void CaretComponent::paint (Graphics& g)
{
- g.fillAll (findColour (caretColourId));
+ g.fillAll (findColour (caretColourId, true));
}
void CaretComponent::timerCallback()
@@ -62366,6 +62372,7 @@ public:
: image (component.createComponentSnapshot (component.getLocalBounds()))
{
setBounds (component.getBounds());
+ setTransform (component.getTransform());
setAlpha (component.getAlpha());
setInterceptsMouseClicks (false, false);
@@ -269249,7 +269256,17 @@ SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
const String SystemStats::getOperatingSystemName()
{
- return "Mac OS X";
+ #if JUCE_IOS
+ String s ("iOS ");
+ #else
+ String s ("Mac OSX ");
+ #endif
+
+ struct utsname uts;
+ if (uname (&uts) >= 0)
+ s << uts.release;
+
+ return s;
}
#if ! JUCE_IOS
@@ -286772,6 +286789,8 @@ JUCE_JNI_CALLBACK (JuceAppActivity, launchApp, void, (JNIEnv* env, jobject activ
{
android.initialise (env, activity, appFile, appDataDir);
+ DBG (SystemStats::getJUCEVersion());
+
JUCEApplication::createInstance = &juce_CreateApplication;
initialiseJuce_GUI();
@@ -286793,8 +286812,11 @@ void PlatformUtilities::beep()
void Logger::outputDebugString (const String& text)
{
- getEnv()->CallStaticVoidMethod (android.activityClass, android.printToConsole,
- javaString (text).get());
+ JNIEnv* const env = getEnv();
+
+ if (env != nullptr)
+ env->CallStaticVoidMethod (android.activityClass, android.printToConsole,
+ javaString (text).get());
}
void SystemClipboard::copyTextToClipboard (const String& text)
diff --git a/juce_amalgamated.h b/juce_amalgamated.h
index 709e2d8177..c899f728a2 100644
--- a/juce_amalgamated.h
+++ b/juce_amalgamated.h
@@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 53
-#define JUCE_BUILDNUMBER 87
+#define JUCE_BUILDNUMBER 88
/** Current Juce version number.
@@ -9394,6 +9394,8 @@ template
class ReferenceCountedObjectPtr
{
public:
+ /** The class being referenced by this pointer. */
+ typedef ReferenceCountedObjectClass ReferencedType;
/** Creates a pointer to a null object. */
inline ReferenceCountedObjectPtr() noexcept
diff --git a/src/audio/audio_sources/juce_AudioFormatReaderSource.cpp b/src/audio/audio_sources/juce_AudioFormatReaderSource.cpp
index f868d9db23..a0692da240 100644
--- a/src/audio/audio_sources/juce_AudioFormatReaderSource.cpp
+++ b/src/audio/audio_sources/juce_AudioFormatReaderSource.cpp
@@ -87,8 +87,8 @@ void AudioFormatReaderSource::getNextAudioBlock (const AudioSourceChannelInfo& i
if (looping)
{
- const int newStart = start % (int) reader->lengthInSamples;
- const int newEnd = (start + info.numSamples) % (int) reader->lengthInSamples;
+ const int newStart = (int) (start % (int) reader->lengthInSamples);
+ const int newEnd = (int) ((start + info.numSamples) % (int) reader->lengthInSamples);
if (newEnd > newStart)
{
diff --git a/src/audio/audio_sources/juce_BufferingAudioSource.cpp b/src/audio/audio_sources/juce_BufferingAudioSource.cpp
index 844963c6eb..76c1af69ff 100644
--- a/src/audio/audio_sources/juce_BufferingAudioSource.cpp
+++ b/src/audio/audio_sources/juce_BufferingAudioSource.cpp
@@ -209,8 +209,8 @@ void BufferingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& info
{
for (int chan = jmin (numberOfChannels, info.buffer->getNumChannels()); --chan >= 0;)
{
- const int startBufferIndex = (validStart + nextPlayPos) % buffer.getNumSamples();
- const int endBufferIndex = (validEnd + nextPlayPos) % buffer.getNumSamples();
+ const int startBufferIndex = (int) ((validStart + nextPlayPos) % buffer.getNumSamples());
+ const int endBufferIndex = (int) ((validEnd + nextPlayPos) % buffer.getNumSamples());
if (startBufferIndex < endBufferIndex)
{
@@ -313,8 +313,8 @@ bool BufferingAudioSource::readNextBufferChunk()
if (sectionToReadStart != sectionToReadEnd)
{
- const int bufferIndexStart = sectionToReadStart % buffer.getNumSamples();
- const int bufferIndexEnd = sectionToReadEnd % buffer.getNumSamples();
+ const int bufferIndexStart = (int) (sectionToReadStart % buffer.getNumSamples());
+ const int bufferIndexEnd = (int) (sectionToReadEnd % buffer.getNumSamples());
if (bufferIndexStart < bufferIndexEnd)
{
diff --git a/src/audio/midi/juce_MidiMessage.cpp b/src/audio/midi/juce_MidiMessage.cpp
index adb3e70e4a..48a33f8f4b 100644
--- a/src/audio/midi/juce_MidiMessage.cpp
+++ b/src/audio/midi/juce_MidiMessage.cpp
@@ -348,7 +348,7 @@ int MidiMessage::getNoteNumber() const noexcept
void MidiMessage::setNoteNumber (const int newNoteNumber) noexcept
{
if (isNoteOnOrOff())
- data[1] = newNoteNumber & 127;
+ data[1] = (char) (newNoteNumber & 127);
}
uint8 MidiMessage::getVelocity() const noexcept
diff --git a/src/audio/plugin_client/VST/juce_VST_Wrapper.cpp b/src/audio/plugin_client/VST/juce_VST_Wrapper.cpp
index 8b7035f8da..7807ff7b62 100644
--- a/src/audio/plugin_client/VST/juce_VST_Wrapper.cpp
+++ b/src/audio/plugin_client/VST/juce_VST_Wrapper.cpp
@@ -87,6 +87,7 @@
typedef long VstInt32;
typedef long VstIntPtr;
+
enum Vst2StringConstants
{
kVstMaxNameLen = 64,
diff --git a/src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp b/src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp
index 43b5d05021..77f27a31e0 100644
--- a/src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp
+++ b/src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp
@@ -222,6 +222,28 @@ static VstIntPtr VSTCALLBACK audioMaster (AEffect* effect, VstInt32 opcode, VstI
static int shellUIDToCreate = 0;
static int insideVSTCallback = 0;
+class IdleCallRecursionPreventer
+{
+public:
+ IdleCallRecursionPreventer()
+ : isMessageThread (MessageManager::getInstance()->isThisTheMessageThread())
+ {
+ if (isMessageThread)
+ ++insideVSTCallback;
+ }
+
+ ~IdleCallRecursionPreventer()
+ {
+ if (isMessageThread)
+ --insideVSTCallback;
+ }
+
+private:
+ const bool isMessageThread;
+
+ JUCE_DECLARE_NON_COPYABLE (IdleCallRecursionPreventer);
+};
+
class VSTPluginWindow;
//==============================================================================
@@ -382,7 +404,8 @@ public:
}
_fpreset(); // (doesn't do any harm)
- ++insideVSTCallback;
+
+ const IdleCallRecursionPreventer icrp;
shellUIDToCreate = 0;
log ("Attempting to load VST: " + file.getFullPathName());
@@ -392,7 +415,6 @@ public:
if (! m->open())
m = nullptr;
- --insideVSTCallback;
_fpreset(); // (doesn't do any harm)
return m.release();
@@ -402,24 +424,21 @@ public:
ModuleHandle (const File& file_)
: file (file_),
moduleMain (0),
-#if JUCE_WINDOWS || JUCE_LINUX
+ #if JUCE_WINDOWS || JUCE_LINUX
hModule (0)
-#elif JUCE_MAC
- fragId (0),
- resHandle (0),
- bundleRef (0),
- resFileId (0)
-#endif
+ #elif JUCE_MAC
+ fragId (0), resHandle (0), bundleRef (0), resFileId (0)
+ #endif
{
getActiveModules().add (this);
-#if JUCE_WINDOWS || JUCE_LINUX
+ #if JUCE_WINDOWS || JUCE_LINUX
fullParentDirectoryPathName = file_.getParentDirectory().getFullPathName();
-#elif JUCE_MAC
+ #elif JUCE_MAC
FSRef ref;
PlatformUtilities::makeFSRefFromPath (&ref, file_.getParentDirectory().getFullPathName());
FSGetCatalogInfo (&ref, kFSCatInfoNone, 0, 0, &parentDirFSSpec, 0);
-#endif
+ #endif
}
~ModuleHandle()
@@ -435,7 +454,7 @@ public:
bool open()
{
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
static bool timePeriodSet = false;
if (! timePeriodSet)
@@ -443,7 +462,7 @@ public:
timePeriodSet = true;
timeBeginPeriod (2);
}
-#endif
+ #endif
pluginName = file.getFileNameWithoutExtension();
@@ -594,7 +613,7 @@ public:
void close()
{
-#if JUCE_PPC
+ #if JUCE_PPC
if (fragId != 0)
{
if (moduleMain != 0)
@@ -607,7 +626,7 @@ public:
CloseResFile (resFileId);
}
else
-#endif
+ #endif
if (bundleRef != 0)
{
CFBundleCloseBundleResourceMap (bundleRef, resFileId);
@@ -622,7 +641,7 @@ public:
void closeEffect (AEffect* eff)
{
-#if JUCE_PPC
+ #if JUCE_PPC
if (fragId != 0)
{
Array thingsToDelete;
@@ -638,13 +657,13 @@ public:
disposeMachOFromCFM (thingsToDelete[i]);
}
else
-#endif
+ #endif
{
eff->dispatcher (eff, effClose, 0, 0, 0, 0);
}
}
-#if JUCE_PPC
+ #if JUCE_PPC
static void* newMachOFromCFM (void* cfmfp)
{
if (cfmfp == 0)
@@ -679,7 +698,7 @@ public:
eff->processReplacing = (AEffectProcessProc) newMachOFromCFM ((void*) eff->processReplacing);
}
}
-#endif
+ #endif
#endif
@@ -832,7 +851,8 @@ private:
//==============================================================================
VSTPluginInstance::VSTPluginInstance (const ReferenceCountedObjectPtr & module_)
- : effect (0),
+ : effect (nullptr),
+ name (module_->pluginName),
wantsMidiMessages (false),
initialised (false),
isPowerOn (false),
@@ -841,40 +861,36 @@ VSTPluginInstance::VSTPluginInstance (const ReferenceCountedObjectPtr pluginName;
log ("Creating VST instance: " + name);
-#if JUCE_MAC
+ #if JUCE_MAC
if (module->resFileId != 0)
UseResFile (module->resFileId);
-#if JUCE_PPC
+ #if JUCE_PPC
if (module->fragId != 0)
{
static void* audioMasterCoerced = nullptr;
- if (audioMasterCoerced == 0)
+ if (audioMasterCoerced == nullptr)
audioMasterCoerced = NewCFMFromMachO ((void*) &audioMaster);
effect = module->moduleMain ((audioMasterCallback) audioMasterCoerced);
}
else
-#endif
-#endif
+ #endif
+ #endif
{
effect = module->moduleMain (&audioMaster);
}
- --insideVSTCallback;
-
if (effect != nullptr && effect->magic == kEffectMagic)
{
-#if JUCE_PPC
+ #if JUCE_PPC
module->coerceAEffectFunctionCalls (effect);
-#endif
+ #endif
jassert (effect->resvd2 == 0);
jassert (effect->object != 0);
@@ -887,25 +903,21 @@ VSTPluginInstance::VSTPluginInstance (const ReferenceCountedObjectPtr magic == kEffectMagic)
{
try
{
-#if JUCE_MAC
+ #if JUCE_MAC
if (module->resFileId != 0)
UseResFile (module->resFileId);
-#endif
+ #endif
// Must delete any editors before deleting the plugin instance!
jassert (getActiveEditor() == 0);
@@ -1147,9 +1159,9 @@ public:
//==============================================================================
VSTPluginWindow (VSTPluginInstance& plugin_)
: AudioProcessorEditor (&plugin_),
-#if ! JUCE_MAC
+ #if ! JUCE_MAC
ComponentMovementWatcher (this),
-#endif
+ #endif
plugin (plugin_),
isOpen (false),
recursiveResize (false),
@@ -1201,17 +1213,17 @@ public:
recursiveResize = true;
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
if (pluginHWND != 0)
MoveWindow (pluginHWND, pos.getX(), pos.getY(), getWidth(), getHeight(), TRUE);
-#elif JUCE_LINUX
+ #elif JUCE_LINUX
if (pluginWindow != 0)
{
XResizeWindow (display, pluginWindow, getWidth(), getHeight());
XMoveWindow (display, pluginWindow, pos.getX(), pos.getY());
XMapRaised (display, pluginWindow);
}
-#endif
+ #endif
recursiveResize = false;
}
@@ -1263,7 +1275,7 @@ public:
const Point pos (getScreenPosition() - peer->getScreenPosition());
peer->addMaskedRegion (pos.getX(), pos.getY(), getWidth(), getHeight());
-#if JUCE_LINUX
+ #if JUCE_LINUX
if (pluginWindow != 0)
{
const Rectangle clip (g.getClipBounds());
@@ -1279,7 +1291,7 @@ public:
sendEventToChild (&ev);
}
-#endif
+ #endif
}
}
else
@@ -1292,14 +1304,14 @@ public:
//==============================================================================
void timerCallback()
{
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
if (--sizeCheckCount <= 0)
{
sizeCheckCount = 10;
checkPluginWindowSize();
}
-#endif
+ #endif
try
{
@@ -1319,7 +1331,7 @@ public:
//==============================================================================
void mouseDown (const MouseEvent& e)
{
-#if JUCE_LINUX
+ #if JUCE_LINUX
if (pluginWindow == 0)
return;
@@ -1340,11 +1352,11 @@ public:
sendEventToChild (&ev);
-#elif JUCE_WINDOWS
+ #elif JUCE_WINDOWS
(void) e;
toFront (true);
-#endif
+ #endif
}
void broughtToFront()
@@ -1352,9 +1364,9 @@ public:
activeVSTWindows.removeValue (this);
activeVSTWindows.add (this);
-#if JUCE_MAC
+ #if JUCE_MAC
dispatch (effEditTop, 0, 0, 0, 0);
-#endif
+ #endif
}
//==============================================================================
@@ -1363,14 +1375,14 @@ private:
bool isOpen, recursiveResize;
bool pluginWantsKeys, pluginRefusesToResize, alreadyInside;
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
HWND pluginHWND;
void* originalWndProc;
int sizeCheckCount;
-#elif JUCE_LINUX
+ #elif JUCE_LINUX
Window pluginWindow;
EventProcPtr pluginProc;
-#endif
+ #endif
//==============================================================================
#if JUCE_MAC
@@ -1436,7 +1448,7 @@ private:
// Install keyboard hooks
pluginWantsKeys = (dispatch (effKeysRequired, 0, 0, 0, 0) == 0);
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
originalWndProc = 0;
pluginHWND = GetWindow ((HWND) getWindowHandle(), GW_CHILD);
@@ -1491,7 +1503,7 @@ private:
}
}
-#elif JUCE_LINUX
+ #elif JUCE_LINUX
pluginWindow = getChildWindow ((Window) getWindowHandle());
if (pluginWindow != 0)
@@ -1514,7 +1526,7 @@ private:
if (pluginWindow != 0)
XMapRaised (display, pluginWindow);
-#endif
+ #endif
// double-check it's not too tiny
w = jmax (w, 32);
@@ -1522,9 +1534,9 @@ private:
setSize (w, h);
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
checkPluginWindowSize();
-#endif
+ #endif
startTimer (18 + JUCE_NAMESPACE::Random::getSystemRandom().nextInt (5));
repaint();
@@ -1542,7 +1554,7 @@ private:
dispatch (effEditClose, 0, 0, 0, 0);
-#if JUCE_WINDOWS
+ #if JUCE_WINDOWS
#pragma warning (push)
#pragma warning (disable: 4244)
@@ -1557,11 +1569,11 @@ private:
DestroyWindow (pluginHWND);
pluginHWND = 0;
-#elif JUCE_LINUX
+ #elif JUCE_LINUX
stopTimer();
pluginWindow = 0;
pluginProc = 0;
-#endif
+ #endif
}
}
#endif
@@ -2142,35 +2154,30 @@ void VSTPluginInstance::timerCallback()
int VSTPluginInstance::dispatch (const int opcode, const int index, const int value, void* const ptr, float opt) const
{
- const ScopedLock sl (lock);
-
- ++insideVSTCallback;
int result = 0;
- try
+ if (effect != nullptr)
{
- if (effect != 0)
+ const ScopedLock sl (lock);
+ const IdleCallRecursionPreventer icrp;
+
+ try
{
- #if JUCE_MAC
+ #if JUCE_MAC
if (module->resFileId != 0)
UseResFile (module->resFileId);
- #endif
+ #endif
result = effect->dispatcher (effect, opcode, index, value, ptr, opt);
- #if JUCE_MAC
+ #if JUCE_MAC
module->resFileId = CurResFile();
- #endif
-
- --insideVSTCallback;
- return result;
+ #endif
}
- }
- catch (...)
- {
+ catch (...)
+ {}
}
- --insideVSTCallback;
return result;
}
@@ -2267,19 +2274,19 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs
case audioMasterIdle:
if (insideVSTCallback == 0 && MessageManager::getInstance()->isThisTheMessageThread())
{
- ++insideVSTCallback;
-#if JUCE_MAC
+ const IdleCallRecursionPreventer icrp;
+
+ #if JUCE_MAC
if (getActiveEditor() != nullptr)
dispatch (effEditIdle, 0, 0, 0, 0);
-#endif
+ #endif
+
juce_callAnyTimersSynchronously();
handleUpdateNowIfNeeded();
for (int i = ComponentPeer::getNumPeers(); --i >= 0;)
ComponentPeer::getPeer (i)->performAnyPendingRepaintsNow();
-
- --insideVSTCallback;
}
break;
@@ -2742,10 +2749,10 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray & resul
try
{
-#if JUCE_MAC
+ #if JUCE_MAC
if (instance->module->resFileId != 0)
UseResFile (instance->module->resFileId);
-#endif
+ #endif
instance->fillInPluginDescription (desc);
@@ -2756,9 +2763,7 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray & resul
// Normal plugin...
results.add (new PluginDescription (desc));
- ++insideVSTCallback;
instance->dispatch (effOpen, 0, 0, 0, 0);
- --insideVSTCallback;
}
else
{
@@ -2843,11 +2848,11 @@ bool VSTPluginFormat::fileMightContainThisPluginType (const String& fileOrIdenti
{
const File f (fileOrIdentifier);
-#if JUCE_MAC
+ #if JUCE_MAC
if (f.isDirectory() && f.hasFileExtension (".vst"))
return true;
-#if JUCE_PPC
+ #if JUCE_PPC
FSRef fileRef;
if (PlatformUtilities::makeFSRefFromPath (&fileRef, f.getFullPathName()))
{
@@ -2862,14 +2867,14 @@ bool VSTPluginFormat::fileMightContainThisPluginType (const String& fileOrIdenti
return true;
}
}
-#endif
+ #endif
return false;
-#elif JUCE_WINDOWS
+ #elif JUCE_WINDOWS
return f.existsAsFile() && f.hasFileExtension (".dll");
-#elif JUCE_LINUX
+ #elif JUCE_LINUX
return f.existsAsFile() && f.hasFileExtension (".so");
-#endif
+ #endif
}
const String VSTPluginFormat::getNameOfPluginFromIdentifier (const String& fileOrIdentifier)
@@ -2916,15 +2921,15 @@ void VSTPluginFormat::recursiveFileSearch (StringArray& results, const File& dir
const FileSearchPath VSTPluginFormat::getDefaultLocationsToSearch()
{
-#if JUCE_MAC
+ #if JUCE_MAC
return FileSearchPath ("~/Library/Audio/Plug-Ins/VST;/Library/Audio/Plug-Ins/VST");
-#elif JUCE_WINDOWS
+ #elif JUCE_WINDOWS
const String programFiles (File::getSpecialLocation (File::globalApplicationsDirectory).getFullPathName());
return FileSearchPath (programFiles + "\\Steinberg\\VstPlugins");
-#elif JUCE_LINUX
+ #elif JUCE_LINUX
return FileSearchPath ("/usr/lib/vst");
-#endif
+ #endif
}
diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h
index 00d8c83329..c377677522 100644
--- a/src/core/juce_StandardHeader.h
+++ b/src/core/juce_StandardHeader.h
@@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 53
-#define JUCE_BUILDNUMBER 87
+#define JUCE_BUILDNUMBER 88
/** Current Juce version number.
diff --git a/src/core/juce_SystemStats.cpp b/src/core/juce_SystemStats.cpp
index 0cd361ec5b..4ab88edad4 100644
--- a/src/core/juce_SystemStats.cpp
+++ b/src/core/juce_SystemStats.cpp
@@ -66,7 +66,7 @@ const String SystemStats::getJUCEVersion()
#undef JUCE_STRINGIFYVERSION2
}
-#if JUCE_DEBUG
+#if JUCE_DEBUG && ! JUCE_ANDROID
struct JuceVersionPrinter
{
JuceVersionPrinter()
diff --git a/src/events/juce_MessageManager.cpp b/src/events/juce_MessageManager.cpp
index 55be9fe115..4dcae75b2e 100644
--- a/src/events/juce_MessageManager.cpp
+++ b/src/events/juce_MessageManager.cpp
@@ -37,7 +37,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
MessageManager* MessageManager::instance = nullptr;
-static const int quitMessageId = 0xfffff321;
+enum { quitMessageId = 0xfffff321 };
MessageManager::MessageManager() noexcept
: quitMessagePosted (false),
@@ -105,7 +105,7 @@ void MessageManager::deliverMessage (Message* const message)
{
callbackMessage->messageCallback();
}
- else if (message->intParameter1 == quitMessageId)
+ else if (message->intParameter1 == (int) quitMessageId)
{
quitMessageReceived = true;
}
@@ -129,7 +129,7 @@ void MessageManager::runDispatchLoop()
void MessageManager::stopDispatchLoop()
{
- postMessageToQueue (new Message (quitMessageId, 0, 0, nullptr));
+ postMessageToQueue (new Message ((int) quitMessageId, 0, 0, nullptr));
quitMessagePosted = true;
}
diff --git a/src/gui/components/keyboard/juce_CaretComponent.cpp b/src/gui/components/keyboard/juce_CaretComponent.cpp
index 56aac0fc14..c73eb4e35b 100644
--- a/src/gui/components/keyboard/juce_CaretComponent.cpp
+++ b/src/gui/components/keyboard/juce_CaretComponent.cpp
@@ -44,7 +44,7 @@ CaretComponent::~CaretComponent()
void CaretComponent::paint (Graphics& g)
{
- g.fillAll (findColour (caretColourId));
+ g.fillAll (findColour (caretColourId, true));
}
void CaretComponent::timerCallback()
diff --git a/src/gui/components/layout/juce_ComponentAnimator.cpp b/src/gui/components/layout/juce_ComponentAnimator.cpp
index 74ce63b2be..1cb261222c 100644
--- a/src/gui/components/layout/juce_ComponentAnimator.cpp
+++ b/src/gui/components/layout/juce_ComponentAnimator.cpp
@@ -152,6 +152,7 @@ public:
: image (component.createComponentSnapshot (component.getLocalBounds()))
{
setBounds (component.getBounds());
+ setTransform (component.getTransform());
setAlpha (component.getAlpha());
setInterceptsMouseClicks (false, false);
diff --git a/src/memory/juce_ReferenceCountedObject.h b/src/memory/juce_ReferenceCountedObject.h
index 1372f4e196..1a3a6f09bf 100644
--- a/src/memory/juce_ReferenceCountedObject.h
+++ b/src/memory/juce_ReferenceCountedObject.h
@@ -130,6 +130,9 @@ template
class ReferenceCountedObjectPtr
{
public:
+ /** The class being referenced by this pointer. */
+ typedef ReferenceCountedObjectClass ReferencedType;
+
//==============================================================================
/** Creates a pointer to a null object. */
inline ReferenceCountedObjectPtr() noexcept
diff --git a/src/native/android/juce_android_Misc.cpp b/src/native/android/juce_android_Misc.cpp
index 6fab5de122..498ff4eaa9 100644
--- a/src/native/android/juce_android_Misc.cpp
+++ b/src/native/android/juce_android_Misc.cpp
@@ -37,6 +37,8 @@ JUCE_JNI_CALLBACK (JuceAppActivity, launchApp, void, (JNIEnv* env, jobject activ
{
android.initialise (env, activity, appFile, appDataDir);
+ DBG (SystemStats::getJUCEVersion());
+
JUCEApplication::createInstance = &juce_CreateApplication;
initialiseJuce_GUI();
@@ -60,8 +62,11 @@ void PlatformUtilities::beep()
//==============================================================================
void Logger::outputDebugString (const String& text)
{
- getEnv()->CallStaticVoidMethod (android.activityClass, android.printToConsole,
- javaString (text).get());
+ JNIEnv* const env = getEnv();
+
+ if (env != nullptr)
+ env->CallStaticVoidMethod (android.activityClass, android.printToConsole,
+ javaString (text).get());
}
//==============================================================================
diff --git a/src/native/mac/juce_mac_NativeIncludes.h b/src/native/mac/juce_mac_NativeIncludes.h
index 1ea02350ec..3f5e3e31ff 100644
--- a/src/native/mac/juce_mac_NativeIncludes.h
+++ b/src/native/mac/juce_mac_NativeIncludes.h
@@ -69,6 +69,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/src/native/mac/juce_mac_SystemStats.mm b/src/native/mac/juce_mac_SystemStats.mm
index b4e6f7aa1d..2e95dc4969 100644
--- a/src/native/mac/juce_mac_SystemStats.mm
+++ b/src/native/mac/juce_mac_SystemStats.mm
@@ -99,7 +99,17 @@ SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
const String SystemStats::getOperatingSystemName()
{
- return "Mac OS X";
+ #if JUCE_IOS
+ String s ("iOS ");
+ #else
+ String s ("Mac OSX ");
+ #endif
+
+ struct utsname uts;
+ if (uname (&uts) >= 0)
+ s << uts.release;
+
+ return s;
}
#if ! JUCE_IOS