diff --git a/extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm b/extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm index 3d257ed3bf..950d1ac1c7 100644 --- a/extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm +++ b/extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm @@ -200,9 +200,15 @@ public: } else if (inID == kAudioUnitProperty_CocoaUI) { - outDataSize = sizeof (AudioUnitCocoaViewInfo); - outWritable = true; - return noErr; +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 + // (On 10.4, there's a random obj-c dispatching crash when trying to load a cocoa UI) + if (PlatformUtilities::getOSXMinorVersionNumber() > 4) +#endif + { + outDataSize = sizeof (AudioUnitCocoaViewInfo); + outWritable = true; + return noErr; + } } } @@ -234,18 +240,24 @@ public: } else if (inID == kAudioUnitProperty_CocoaUI) { - const ScopedAutoReleasePool pool; +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 + // (On 10.4, there's a random obj-c dispatching crash when trying to load a cocoa UI) + if (PlatformUtilities::getOSXMinorVersionNumber() > 4) +#endif + { + const ScopedAutoReleasePool pool; - AudioUnitCocoaViewInfo* info = (AudioUnitCocoaViewInfo*) outData; + AudioUnitCocoaViewInfo* info = (AudioUnitCocoaViewInfo*) outData; - const File bundleFile (File::getSpecialLocation (File::currentApplicationFile)); - NSString* bundlePath = [NSString stringWithUTF8String: (const char*) bundleFile.getFullPathName().toUTF8()]; - NSBundle* b = [NSBundle bundleWithPath: bundlePath]; + const File bundleFile (File::getSpecialLocation (File::currentApplicationFile)); + NSString* bundlePath = [NSString stringWithUTF8String: (const char*) bundleFile.getFullPathName().toUTF8()]; + NSBundle* b = [NSBundle bundleWithPath: bundlePath]; - info->mCocoaAUViewClass[0] = (CFStringRef) [[[JuceUICreationClass class] className] retain]; - info->mCocoaAUViewBundleLocation = (CFURLRef) [[NSURL fileURLWithPath: [b bundlePath]] retain]; + info->mCocoaAUViewClass[0] = (CFStringRef) [[[JuceUICreationClass class] className] retain]; + info->mCocoaAUViewBundleLocation = (CFURLRef) [[NSURL fileURLWithPath: [b bundlePath]] retain]; - return noErr; + return noErr; + } } } diff --git a/juce_Config.h b/juce_Config.h index 3ee56b56b1..5a82791550 100644 --- a/juce_Config.h +++ b/juce_Config.h @@ -136,13 +136,20 @@ #endif //============================================================================= -/** This flag lets you enable support for CD-burning. You might want to disable +/** This flag lets you enable the AudioCDBurner class. You might want to disable it to build without the MS SDK under windows. */ #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC) #define JUCE_USE_CDBURNER 1 #endif +/** This flag lets you enable support for the AudioCDReader class. You might want to disable + it to build without the MS SDK under windows. +*/ +#ifndef JUCE_USE_CDREADER + #define JUCE_USE_CDREADER 1 +#endif + //============================================================================= /** Enabling this provides support for cameras, using the CameraDevice class */ diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 36fa656da1..b3b02c1b77 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -280,13 +280,20 @@ #define JUCE_USE_OGGVORBIS 1 #endif -/** This flag lets you enable support for CD-burning. You might want to disable +/** This flag lets you enable the AudioCDBurner class. You might want to disable it to build without the MS SDK under windows. */ #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC) #define JUCE_USE_CDBURNER 1 #endif +/** This flag lets you enable support for the AudioCDReader class. You might want to disable + it to build without the MS SDK under windows. +*/ +#ifndef JUCE_USE_CDREADER + #define JUCE_USE_CDREADER 1 +#endif + /** Enabling this provides support for cameras, using the CameraDevice class */ #if JUCE_QUICKTIME && ! defined (JUCE_USE_CAMERA) @@ -18947,7 +18954,7 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE -#if JUCE_MAC +#if JUCE_MAC && JUCE_USE_CDREADER // Mac version doesn't need any native code because it's all done with files.. // Windows + Linux versions are in the platform-dependent code sections. @@ -87856,7 +87863,7 @@ void CustomTypeface::addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_ { for (int i = 0; i < numCharacters; ++i) { - const juce_wchar c = characterStartIndex + i; + const juce_wchar c = (juce_wchar) (characterStartIndex + i); Array glyphIndexes; Array offsets; @@ -234805,10 +234812,6 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE -#if JUCE_USE_CDBURNER - -#endif - #define JUCE_INCLUDED_FILE 1 // Now include the actual code files.. @@ -242983,7 +242986,9 @@ void OpenGLPixelFormat::getAvailablePixelFormats (Component* component, /********* Start of inlined file: juce_win32_AudioCDReader.cpp *********/ // (This file gets included by juce_win32_NativeCode.cpp, rather than being // compiled on its own). -#if JUCE_INCLUDED_FILE && JUCE_USE_CDBURNER +#if JUCE_INCLUDED_FILE + +#if JUCE_USE_CDREADER //*************************************************************************** // %%% TARGET STATUS VALUES %%% @@ -244986,6 +244991,10 @@ void AudioCDReader::ejectDisk() ((CDDeviceWrapper*) handle)->cdH->openDrawer (true); } +#endif + +#if JUCE_USE_CDBURNER + static IDiscRecorder* enumCDBurners (StringArray* list, int indexToOpen, IDiscMaster** master) { CoInitialize (0); @@ -245030,25 +245039,6 @@ static IDiscRecorder* enumCDBurners (StringArray* list, int indexToOpen, IDiscMa drEnum->Release(); } - /*if (redbookFormat != 0) - { - IEnumDiscMasterFormats* mfEnum; - - if (SUCCEEDED (dm->EnumDiscMasterFormats (&mfEnum))) - { - IID formatIID; - DWORD dummy; - - while (mfEnum->Next (1, &formatIID, &dummy) == S_OK) - { - } - - mfEnum->Release(); - } - - redbookFormat - }*/ - if (master == 0) dm->Close(); } @@ -245305,6 +245295,7 @@ bool AudioCDBurner::addAudioTrack (AudioSource* source, int numSamples) return ok && hr == S_OK; } +#endif #endif /********* End of inlined file: juce_win32_AudioCDReader.cpp *********/ @@ -262004,6 +261995,15 @@ void PlatformUtilities::addItemToDock (const File& file) } } +int PlatformUtilities::getOSXMinorVersionNumber() throw() +{ + SInt32 versionMinor = 0; + OSErr err = Gestalt (gestaltSystemVersionMinor, &versionMinor); + (void) err; + jassert (err == noErr); + return (int) versionMinor; +} + #if ! JUCE_ONLY_BUILD_CORE_LIBRARY bool AlertWindow::showNativeDialogBox (const String& title, @@ -263249,6 +263249,8 @@ private: void drawGradient() const throw() { CGContextSetAlpha (context, 1.0f); + CGContextSetInterpolationQuality (context, kCGInterpolationDefault); // (This is required for 10.4, where there's a crash if + // you draw a gradient with high quality interp enabled). CGShadingRef shading = createGradient (state->gradient); CGContextDrawShading (context, shading); CGShadingRelease (shading); @@ -267675,6 +267677,8 @@ private: void drawGradient() const throw() { CGContextSetAlpha (context, 1.0f); + CGContextSetInterpolationQuality (context, kCGInterpolationDefault); // (This is required for 10.4, where there's a crash if + // you draw a gradient with high quality interp enabled). CGShadingRef shading = createGradient (state->gradient); CGContextDrawShading (context, shading); CGShadingRelease (shading); diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 430b594685..7647f51f1c 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -314,13 +314,20 @@ #define JUCE_USE_OGGVORBIS 1 #endif -/** This flag lets you enable support for CD-burning. You might want to disable +/** This flag lets you enable the AudioCDBurner class. You might want to disable it to build without the MS SDK under windows. */ #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC) #define JUCE_USE_CDBURNER 1 #endif +/** This flag lets you enable support for the AudioCDReader class. You might want to disable + it to build without the MS SDK under windows. +*/ +#ifndef JUCE_USE_CDREADER + #define JUCE_USE_CDREADER 1 +#endif + /** Enabling this provides support for cameras, using the CameraDevice class */ #if JUCE_QUICKTIME && ! defined (JUCE_USE_CAMERA) @@ -7225,6 +7232,11 @@ public: /** MAC ONLY - Adds an item to the dock */ static void addItemToDock (const File& file); + + /** MAC ONLY - Returns the current OS version number. + E.g. if it's running on 10.4, this will be 4, 10.5 will return 5, etc. + */ + static int getOSXMinorVersionNumber() throw(); #endif #if JUCE_WINDOWS || DOXYGEN @@ -37208,6 +37220,8 @@ public: #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__ #define __JUCE_AUDIOCDBURNER_JUCEHEADER__ +#if JUCE_USE_CDBURNER + /** */ class AudioCDBurner @@ -37278,6 +37292,7 @@ private: void* internal; }; +#endif #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__ /********* End of inlined file: juce_AudioCDBurner.h *********/ @@ -37288,6 +37303,8 @@ private: #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__ #define __JUCE_AUDIOCDREADER_JUCEHEADER__ +#if JUCE_USE_CDREADER + #if JUCE_MAC #endif @@ -37434,6 +37451,7 @@ private: const AudioCDReader& operator= (const AudioCDReader&); }; +#endif #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__ /********* End of inlined file: juce_AudioCDReader.h *********/ diff --git a/src/audio/audio_file_formats/juce_AudioCDBurner.h b/src/audio/audio_file_formats/juce_AudioCDBurner.h index 90ab41ef84..d652d5aaed 100644 --- a/src/audio/audio_file_formats/juce_AudioCDBurner.h +++ b/src/audio/audio_file_formats/juce_AudioCDBurner.h @@ -26,6 +26,8 @@ #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__ #define __JUCE_AUDIOCDBURNER_JUCEHEADER__ +#if JUCE_USE_CDBURNER + #include "juce_AudioFormatReader.h" #include "../audio_sources/juce_AudioSource.h" @@ -104,4 +106,5 @@ private: }; +#endif #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__ diff --git a/src/audio/audio_file_formats/juce_AudioCDReader.cpp b/src/audio/audio_file_formats/juce_AudioCDReader.cpp index 707caaa551..d79a8b5451 100644 --- a/src/audio/audio_file_formats/juce_AudioCDReader.cpp +++ b/src/audio/audio_file_formats/juce_AudioCDReader.cpp @@ -27,7 +27,7 @@ BEGIN_JUCE_NAMESPACE -#if JUCE_MAC +#if JUCE_MAC && JUCE_USE_CDREADER //============================================================================== // Mac version doesn't need any native code because it's all done with files.. diff --git a/src/audio/audio_file_formats/juce_AudioCDReader.h b/src/audio/audio_file_formats/juce_AudioCDReader.h index 581e2da461..c4739b6af2 100644 --- a/src/audio/audio_file_formats/juce_AudioCDReader.h +++ b/src/audio/audio_file_formats/juce_AudioCDReader.h @@ -26,6 +26,8 @@ #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__ #define __JUCE_AUDIOCDREADER_JUCEHEADER__ +#if JUCE_USE_CDREADER + #include "juce_AudioFormatReader.h" #include "../../text/juce_StringArray.h" #if JUCE_MAC @@ -177,4 +179,5 @@ private: const AudioCDReader& operator= (const AudioCDReader&); }; +#endif #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__ diff --git a/src/core/juce_PlatformUtilities.h b/src/core/juce_PlatformUtilities.h index 06caddd577..58a957ba71 100644 --- a/src/core/juce_PlatformUtilities.h +++ b/src/core/juce_PlatformUtilities.h @@ -73,6 +73,11 @@ public: /** MAC ONLY - Adds an item to the dock */ static void addItemToDock (const File& file); + + /** MAC ONLY - Returns the current OS version number. + E.g. if it's running on 10.4, this will be 4, 10.5 will return 5, etc. + */ + static int getOSXMinorVersionNumber() throw(); #endif diff --git a/src/gui/graphics/fonts/juce_Typeface.cpp b/src/gui/graphics/fonts/juce_Typeface.cpp index 7716c4b375..486f9af685 100644 --- a/src/gui/graphics/fonts/juce_Typeface.cpp +++ b/src/gui/graphics/fonts/juce_Typeface.cpp @@ -240,7 +240,7 @@ void CustomTypeface::addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_ { for (int i = 0; i < numCharacters; ++i) { - const juce_wchar c = characterStartIndex + i; + const juce_wchar c = (juce_wchar) (characterStartIndex + i); Array glyphIndexes; Array offsets; diff --git a/src/native/juce_win32_NativeCode.cpp b/src/native/juce_win32_NativeCode.cpp index e017c1b6f3..6c8df850a7 100644 --- a/src/native/juce_win32_NativeCode.cpp +++ b/src/native/juce_win32_NativeCode.cpp @@ -71,9 +71,7 @@ BEGIN_JUCE_NAMESPACE #include "../gui/components/special/juce_SystemTrayIconComponent.h" #include "../gui/components/filebrowser/juce_FileChooser.h" #include "../gui/components/lookandfeel/juce_LookAndFeel.h" -#if JUCE_USE_CDBURNER #include "../audio/audio_file_formats/juce_AudioCDBurner.h" -#endif #include "../audio/audio_file_formats/juce_AudioCDReader.h" #include "../audio/audio_sources/juce_AudioSource.h" #include "../audio/dsp/juce_AudioDataConverters.h" diff --git a/src/native/mac/juce_mac_CoreGraphicsContext.mm b/src/native/mac/juce_mac_CoreGraphicsContext.mm index 8cc0b540e7..d2f0df428f 100644 --- a/src/native/mac/juce_mac_CoreGraphicsContext.mm +++ b/src/native/mac/juce_mac_CoreGraphicsContext.mm @@ -516,6 +516,8 @@ private: void drawGradient() const throw() { CGContextSetAlpha (context, 1.0f); + CGContextSetInterpolationQuality (context, kCGInterpolationDefault); // (This is required for 10.4, where there's a crash if + // you draw a gradient with high quality interp enabled). CGShadingRef shading = createGradient (state->gradient); CGContextDrawShading (context, shading); CGShadingRelease (shading); diff --git a/src/native/mac/juce_mac_MiscUtilities.mm b/src/native/mac/juce_mac_MiscUtilities.mm index fda70de5b0..d1797512f3 100644 --- a/src/native/mac/juce_mac_MiscUtilities.mm +++ b/src/native/mac/juce_mac_MiscUtilities.mm @@ -59,6 +59,15 @@ void PlatformUtilities::addItemToDock (const File& file) } } +int PlatformUtilities::getOSXMinorVersionNumber() throw() +{ + SInt32 versionMinor = 0; + OSErr err = Gestalt (gestaltSystemVersionMinor, &versionMinor); + (void) err; + jassert (err == noErr); + return (int) versionMinor; +} + //============================================================================== #if ! JUCE_ONLY_BUILD_CORE_LIBRARY diff --git a/src/native/windows/juce_win32_AudioCDReader.cpp b/src/native/windows/juce_win32_AudioCDReader.cpp index 247a31d142..949927d26c 100644 --- a/src/native/windows/juce_win32_AudioCDReader.cpp +++ b/src/native/windows/juce_win32_AudioCDReader.cpp @@ -25,8 +25,9 @@ // (This file gets included by juce_win32_NativeCode.cpp, rather than being // compiled on its own). -#if JUCE_INCLUDED_FILE && JUCE_USE_CDBURNER +#if JUCE_INCLUDED_FILE +#if JUCE_USE_CDREADER //*************************************************************************** // %%% TARGET STATUS VALUES %%% @@ -2069,6 +2070,9 @@ void AudioCDReader::ejectDisk() ((CDDeviceWrapper*) handle)->cdH->openDrawer (true); } +#endif + +#if JUCE_USE_CDBURNER //============================================================================== static IDiscRecorder* enumCDBurners (StringArray* list, int indexToOpen, IDiscMaster** master) @@ -2115,25 +2119,6 @@ static IDiscRecorder* enumCDBurners (StringArray* list, int indexToOpen, IDiscMa drEnum->Release(); } - /*if (redbookFormat != 0) - { - IEnumDiscMasterFormats* mfEnum; - - if (SUCCEEDED (dm->EnumDiscMasterFormats (&mfEnum))) - { - IID formatIID; - DWORD dummy; - - while (mfEnum->Next (1, &formatIID, &dummy) == S_OK) - { - } - - mfEnum->Release(); - } - - redbookFormat - }*/ - if (master == 0) dm->Close(); } @@ -2391,3 +2376,4 @@ bool AudioCDBurner::addAudioTrack (AudioSource* source, int numSamples) } #endif +#endif