diff --git a/build/macosx/Juce.xcodeproj/project.pbxproj b/build/macosx/Juce.xcodeproj/project.pbxproj index 5a637c23e5..0d69db8fda 100644 --- a/build/macosx/Juce.xcodeproj/project.pbxproj +++ b/build/macosx/Juce.xcodeproj/project.pbxproj @@ -4262,7 +4262,12 @@ "DEBUG=1", ); GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_VARIABLE = YES; PRODUCT_NAME = jucedebug; RUN_CLANG_STATIC_ANALYZER = YES; @@ -4284,6 +4289,7 @@ ); GCC_SYMBOLS_PRIVATE_EXTERN = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; PRODUCT_NAME = juce; RUN_CLANG_STATIC_ANALYZER = YES; diff --git a/extras/juce demo/src/juce_AppConfig.h b/extras/juce demo/src/juce_AppConfig.h index aac15695b4..44b184defa 100644 --- a/extras/juce demo/src/juce_AppConfig.h +++ b/extras/juce demo/src/juce_AppConfig.h @@ -70,6 +70,8 @@ #if JUCE_LINUX || JUCE_IPHONE #define JUCE_USE_CAMERA 0 +#elif JUCE_MAC + #define JUCE_USE_CAMERA 1 #endif //#define JUCE_CHECK_MEMORY_LEAKS 1 diff --git a/src/audio/audio_file_formats/juce_OggVorbisAudioFormat.cpp b/src/audio/audio_file_formats/juce_OggVorbisAudioFormat.cpp index d6ded62867..a60c527d58 100644 --- a/src/audio/audio_file_formats/juce_OggVorbisAudioFormat.cpp +++ b/src/audio/audio_file_formats/juce_OggVorbisAudioFormat.cpp @@ -179,7 +179,7 @@ public: float** dataIn = 0; const int samps = ov_read_float (&ovFile, &dataIn, numToRead, &bitStream); - if (samps == 0) + if (samps <= 0) break; jassert (samps <= numToRead); diff --git a/src/audio/processors/juce_AudioProcessorGraph.cpp b/src/audio/processors/juce_AudioProcessorGraph.cpp index a2bc9f9ba5..dc8f2b25cd 100644 --- a/src/audio/processors/juce_AudioProcessorGraph.cpp +++ b/src/audio/processors/juce_AudioProcessorGraph.cpp @@ -1109,6 +1109,9 @@ void AudioProcessorGraph::processBlock (AudioSampleBuffer& buffer, MidiBuffer& m for (i = 0; i < buffer.getNumChannels(); ++i) buffer.copyFrom (i, 0, currentAudioOutputBuffer, i, 0, numSamples); + + midiMessages.clear(); + midiMessages.addEvents (currentMidiOutputBuffer, 0, buffer.getNumSamples(), 0); } const String AudioProcessorGraph::getInputChannelName (const int channelIndex) const diff --git a/src/core/juce_Singleton.h b/src/core/juce_Singleton.h index 42a722f46e..0be1b7c9b1 100644 --- a/src/core/juce_Singleton.h +++ b/src/core/juce_Singleton.h @@ -33,21 +33,18 @@ /** Macro to declare member variables and methods for a singleton class. - To use this, add the line juce_DeclareSingleton (MyClass, allowOnlyOneInstance) + To use this, add the line juce_DeclareSingleton (MyClass, doNotRecreateAfterDeletion) to the class's definition. - If allowOnlyOneInstance == true, it won't allow the object to be created - more than once in the process's lifetime. - Then put a macro juce_ImplementSingleton (MyClass) along with the class's implementation code. - Clients can then call the static MyClass::getInstance() to get a pointer to the - singleton, or MyClass::getInstanceWithoutCreating() which may return 0 if no instance - is currently extant + It's also a very good idea to also add the call clearSingletonInstance() in your class's + destructor, in case it is deleted by other means than deleteInstance() - it's a very good idea to also add the call clearSingletonInstance() to the - destructor of the class, in case it is deleted by other means than deleteInstance() + Clients can then call the static method MyClass::getInstance() to get a pointer + to the singleton, or MyClass::getInstanceWithoutCreating() which will return 0 if + no instance currently exists. e.g. @code @@ -80,13 +77,18 @@ @endcode + If doNotRecreateAfterDeletion = true, it won't allow the object to be created more + than once during the process's lifetime - i.e. after you've created and deleted the + object, getInstance() will refuse to create another one. This can be useful to stop + objects being accidentally re-created during your app's shutdown code. + If you know that your object will only be created and deleted by a single thread, you can use the slightly more efficient juce_DeclareSingleton_SingleThreaded() macro instead of this one. @see juce_ImplementSingleton, juce_DeclareSingleton_SingleThreaded */ -#define juce_DeclareSingleton(classname, allowOnlyOneInstance) \ +#define juce_DeclareSingleton(classname, doNotRecreateAfterDeletion) \ \ static classname* _singletonInstance; \ static JUCE_NAMESPACE::CriticalSection _singletonLock; \ @@ -102,7 +104,7 @@ static bool alreadyInside = false; \ static bool createdOnceAlready = false; \ \ - const bool problem = alreadyInside || ((allowOnlyOneInstance) && createdOnceAlready); \ + const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \ jassert (! problem); \ if (! problem) \ { \ @@ -163,13 +165,18 @@ only ever be created or deleted by a single thread, then this is a more efficient version to use. + If doNotRecreateAfterDeletion = true, it won't allow the object to be created more + than once during the process's lifetime - i.e. after you've created and deleted the + object, getInstance() will refuse to create another one. This can be useful to stop + objects being accidentally re-created during your app's shutdown code. + See the documentation for juce_DeclareSingleton for more information about how to use it, the only difference being that you have to use juce_ImplementSingleton_SingleThreaded instead of juce_ImplementSingleton. @see juce_ImplementSingleton_SingleThreaded, juce_DeclareSingleton, juce_DeclareSingleton_SingleThreaded_Minimal */ -#define juce_DeclareSingleton_SingleThreaded(classname, allowOnlyOneInstance) \ +#define juce_DeclareSingleton_SingleThreaded(classname, doNotRecreateAfterDeletion) \ \ static classname* _singletonInstance; \ \ @@ -180,7 +187,7 @@ static bool alreadyInside = false; \ static bool createdOnceAlready = false; \ \ - const bool problem = alreadyInside || ((allowOnlyOneInstance) && createdOnceAlready); \ + const bool problem = alreadyInside || ((doNotRecreateAfterDeletion) && createdOnceAlready); \ jassert (! problem); \ if (! problem) \ { \ diff --git a/src/gui/graphics/geometry/juce_AffineTransform.h b/src/gui/graphics/geometry/juce_AffineTransform.h index ef5c018fe5..9df9d7c68e 100644 --- a/src/gui/graphics/geometry/juce_AffineTransform.h +++ b/src/gui/graphics/geometry/juce_AffineTransform.h @@ -160,6 +160,16 @@ public: points. */ bool isOnlyTranslation() const throw(); + /** If this transform is only a translation, this returns the X offset. + @see isOnlyTranslation + */ + float getTranslationX() const throw() { return mat02; } + + /** If this transform is only a translation, this returns the X offset. + @see isOnlyTranslation + */ + float getTranslationY() const throw() { return mat12; } + //============================================================================== juce_UseDebuggingNewOperator diff --git a/src/text/juce_String.cpp b/src/text/juce_String.cpp index 8ec15dcf4f..f04e0434cd 100644 --- a/src/text/juce_String.cpp +++ b/src/text/juce_String.cpp @@ -882,6 +882,21 @@ String& String::operator<< (const short number) throw() return *this; } +String& String::operator<< (const unsigned short number) throw() +{ + return operator<< ((unsigned int) number); +} + +String& String::operator<< (const long number) throw() +{ + return operator<< ((int) number); +} + +String& String::operator<< (const unsigned long number) throw() +{ + return operator<< ((unsigned int) number); +} + String& String::operator<< (const double number) throw() { operator+= (String (number)); diff --git a/src/text/juce_String.h b/src/text/juce_String.h index 65d077c8db..3aee0daa0d 100644 --- a/src/text/juce_String.h +++ b/src/text/juce_String.h @@ -156,10 +156,16 @@ public: /** Appends a decimal number at the end of this string. */ String& operator<< (const short number) throw(); /** Appends a decimal number at the end of this string. */ + String& operator<< (const unsigned short number) throw(); + /** Appends a decimal number at the end of this string. */ String& operator<< (const int number) throw(); /** Appends a decimal number at the end of this string. */ String& operator<< (const unsigned int number) throw(); /** Appends a decimal number at the end of this string. */ + String& operator<< (const long number) throw(); + /** Appends a decimal number at the end of this string. */ + String& operator<< (const unsigned long number) throw(); + /** Appends a decimal number at the end of this string. */ String& operator<< (const float number) throw(); /** Appends a decimal number at the end of this string. */ String& operator<< (const double number) throw();