Browse Source

Fix for an AU crash when running in 10.4. Added a PlatformUtilities method to get the version of OSX that's running. Added a workaround for a 10.4 OS bug when drawing gradients. Added some macros to allow CD burning and reading to be enabled independantly.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
15a5c53bc0
13 changed files with 111 additions and 64 deletions
  1. +23
    -11
      extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm
  2. +8
    -1
      juce_Config.h
  3. +31
    -27
      juce_amalgamated.cpp
  4. +19
    -1
      juce_amalgamated.h
  5. +3
    -0
      src/audio/audio_file_formats/juce_AudioCDBurner.h
  6. +1
    -1
      src/audio/audio_file_formats/juce_AudioCDReader.cpp
  7. +3
    -0
      src/audio/audio_file_formats/juce_AudioCDReader.h
  8. +5
    -0
      src/core/juce_PlatformUtilities.h
  9. +1
    -1
      src/gui/graphics/fonts/juce_Typeface.cpp
  10. +0
    -2
      src/native/juce_win32_NativeCode.cpp
  11. +2
    -0
      src/native/mac/juce_mac_CoreGraphicsContext.mm
  12. +9
    -0
      src/native/mac/juce_mac_MiscUtilities.mm
  13. +6
    -20
      src/native/windows/juce_win32_AudioCDReader.cpp

+ 23
- 11
extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm View File

@@ -200,9 +200,15 @@ public:
} }
else if (inID == kAudioUnitProperty_CocoaUI) 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) 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;
}
} }
} }


+ 8
- 1
juce_Config.h View File

@@ -136,13 +136,20 @@
#endif #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. it to build without the MS SDK under windows.
*/ */
#if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC) #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
#define JUCE_USE_CDBURNER 1 #define JUCE_USE_CDBURNER 1
#endif #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 /** Enabling this provides support for cameras, using the CameraDevice class
*/ */


+ 31
- 27
juce_amalgamated.cpp View File

@@ -280,13 +280,20 @@
#define JUCE_USE_OGGVORBIS 1 #define JUCE_USE_OGGVORBIS 1
#endif #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. it to build without the MS SDK under windows.
*/ */
#if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC) #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
#define JUCE_USE_CDBURNER 1 #define JUCE_USE_CDBURNER 1
#endif #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 /** Enabling this provides support for cameras, using the CameraDevice class
*/ */
#if JUCE_QUICKTIME && ! defined (JUCE_USE_CAMERA) #if JUCE_QUICKTIME && ! defined (JUCE_USE_CAMERA)
@@ -18947,7 +18954,7 @@ END_JUCE_NAMESPACE


BEGIN_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.. // 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. // 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) for (int i = 0; i < numCharacters; ++i)
{ {
const juce_wchar c = characterStartIndex + i;
const juce_wchar c = (juce_wchar) (characterStartIndex + i);


Array <int> glyphIndexes; Array <int> glyphIndexes;
Array <float> offsets; Array <float> offsets;
@@ -234805,10 +234812,6 @@ END_JUCE_NAMESPACE


BEGIN_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE


#if JUCE_USE_CDBURNER

#endif

#define JUCE_INCLUDED_FILE 1 #define JUCE_INCLUDED_FILE 1


// Now include the actual code files.. // Now include the actual code files..
@@ -242983,7 +242986,9 @@ void OpenGLPixelFormat::getAvailablePixelFormats (Component* component,
/********* Start of inlined file: juce_win32_AudioCDReader.cpp *********/ /********* Start of inlined file: juce_win32_AudioCDReader.cpp *********/
// (This file gets included by juce_win32_NativeCode.cpp, rather than being // (This file gets included by juce_win32_NativeCode.cpp, rather than being
// compiled on its own). // compiled on its own).
#if JUCE_INCLUDED_FILE && JUCE_USE_CDBURNER
#if JUCE_INCLUDED_FILE

#if JUCE_USE_CDREADER


//*************************************************************************** //***************************************************************************
// %%% TARGET STATUS VALUES %%% // %%% TARGET STATUS VALUES %%%
@@ -244986,6 +244991,10 @@ void AudioCDReader::ejectDisk()
((CDDeviceWrapper*) handle)->cdH->openDrawer (true); ((CDDeviceWrapper*) handle)->cdH->openDrawer (true);
} }


#endif

#if JUCE_USE_CDBURNER

static IDiscRecorder* enumCDBurners (StringArray* list, int indexToOpen, IDiscMaster** master) static IDiscRecorder* enumCDBurners (StringArray* list, int indexToOpen, IDiscMaster** master)
{ {
CoInitialize (0); CoInitialize (0);
@@ -245030,25 +245039,6 @@ static IDiscRecorder* enumCDBurners (StringArray* list, int indexToOpen, IDiscMa
drEnum->Release(); 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) if (master == 0)
dm->Close(); dm->Close();
} }
@@ -245305,6 +245295,7 @@ bool AudioCDBurner::addAudioTrack (AudioSource* source, int numSamples)
return ok && hr == S_OK; return ok && hr == S_OK;
} }


#endif
#endif #endif
/********* End of inlined file: juce_win32_AudioCDReader.cpp *********/ /********* 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 #if ! JUCE_ONLY_BUILD_CORE_LIBRARY


bool AlertWindow::showNativeDialogBox (const String& title, bool AlertWindow::showNativeDialogBox (const String& title,
@@ -263249,6 +263249,8 @@ private:
void drawGradient() const throw() void drawGradient() const throw()
{ {
CGContextSetAlpha (context, 1.0f); 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); CGShadingRef shading = createGradient (state->gradient);
CGContextDrawShading (context, shading); CGContextDrawShading (context, shading);
CGShadingRelease (shading); CGShadingRelease (shading);
@@ -267675,6 +267677,8 @@ private:
void drawGradient() const throw() void drawGradient() const throw()
{ {
CGContextSetAlpha (context, 1.0f); 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); CGShadingRef shading = createGradient (state->gradient);
CGContextDrawShading (context, shading); CGContextDrawShading (context, shading);
CGShadingRelease (shading); CGShadingRelease (shading);


+ 19
- 1
juce_amalgamated.h View File

@@ -314,13 +314,20 @@
#define JUCE_USE_OGGVORBIS 1 #define JUCE_USE_OGGVORBIS 1
#endif #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. it to build without the MS SDK under windows.
*/ */
#if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC) #if (! defined (JUCE_USE_CDBURNER)) && ! (JUCE_WINDOWS && ! JUCE_MSVC)
#define JUCE_USE_CDBURNER 1 #define JUCE_USE_CDBURNER 1
#endif #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 /** Enabling this provides support for cameras, using the CameraDevice class
*/ */
#if JUCE_QUICKTIME && ! defined (JUCE_USE_CAMERA) #if JUCE_QUICKTIME && ! defined (JUCE_USE_CAMERA)
@@ -7225,6 +7232,11 @@ public:


/** MAC ONLY - Adds an item to the dock */ /** MAC ONLY - Adds an item to the dock */
static void addItemToDock (const File& file); 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 #endif


#if JUCE_WINDOWS || DOXYGEN #if JUCE_WINDOWS || DOXYGEN
@@ -37208,6 +37220,8 @@ public:
#ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__ #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
#define __JUCE_AUDIOCDBURNER_JUCEHEADER__ #define __JUCE_AUDIOCDBURNER_JUCEHEADER__


#if JUCE_USE_CDBURNER

/** /**
*/ */
class AudioCDBurner class AudioCDBurner
@@ -37278,6 +37292,7 @@ private:
void* internal; void* internal;
}; };


#endif
#endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__ #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__
/********* End of inlined file: juce_AudioCDBurner.h *********/ /********* End of inlined file: juce_AudioCDBurner.h *********/


@@ -37288,6 +37303,8 @@ private:
#ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__ #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
#define __JUCE_AUDIOCDREADER_JUCEHEADER__ #define __JUCE_AUDIOCDREADER_JUCEHEADER__


#if JUCE_USE_CDREADER

#if JUCE_MAC #if JUCE_MAC


#endif #endif
@@ -37434,6 +37451,7 @@ private:
const AudioCDReader& operator= (const AudioCDReader&); const AudioCDReader& operator= (const AudioCDReader&);
}; };


#endif
#endif // __JUCE_AUDIOCDREADER_JUCEHEADER__ #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__
/********* End of inlined file: juce_AudioCDReader.h *********/ /********* End of inlined file: juce_AudioCDReader.h *********/




+ 3
- 0
src/audio/audio_file_formats/juce_AudioCDBurner.h View File

@@ -26,6 +26,8 @@
#ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__ #ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__
#define __JUCE_AUDIOCDBURNER_JUCEHEADER__ #define __JUCE_AUDIOCDBURNER_JUCEHEADER__
#if JUCE_USE_CDBURNER
#include "juce_AudioFormatReader.h" #include "juce_AudioFormatReader.h"
#include "../audio_sources/juce_AudioSource.h" #include "../audio_sources/juce_AudioSource.h"
@@ -104,4 +106,5 @@ private:
}; };
#endif
#endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__ #endif // __JUCE_AUDIOCDBURNER_JUCEHEADER__

+ 1
- 1
src/audio/audio_file_formats/juce_AudioCDReader.cpp View File

@@ -27,7 +27,7 @@
BEGIN_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.. // Mac version doesn't need any native code because it's all done with files..


+ 3
- 0
src/audio/audio_file_formats/juce_AudioCDReader.h View File

@@ -26,6 +26,8 @@
#ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__ #ifndef __JUCE_AUDIOCDREADER_JUCEHEADER__
#define __JUCE_AUDIOCDREADER_JUCEHEADER__ #define __JUCE_AUDIOCDREADER_JUCEHEADER__
#if JUCE_USE_CDREADER
#include "juce_AudioFormatReader.h" #include "juce_AudioFormatReader.h"
#include "../../text/juce_StringArray.h" #include "../../text/juce_StringArray.h"
#if JUCE_MAC #if JUCE_MAC
@@ -177,4 +179,5 @@ private:
const AudioCDReader& operator= (const AudioCDReader&); const AudioCDReader& operator= (const AudioCDReader&);
}; };
#endif
#endif // __JUCE_AUDIOCDREADER_JUCEHEADER__ #endif // __JUCE_AUDIOCDREADER_JUCEHEADER__

+ 5
- 0
src/core/juce_PlatformUtilities.h View File

@@ -73,6 +73,11 @@ public:
/** MAC ONLY - Adds an item to the dock */ /** MAC ONLY - Adds an item to the dock */
static void addItemToDock (const File& file); 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 #endif


+ 1
- 1
src/gui/graphics/fonts/juce_Typeface.cpp View File

@@ -240,7 +240,7 @@ void CustomTypeface::addGlyphsFromOtherTypeface (Typeface& typefaceToCopy, juce_
{ {
for (int i = 0; i < numCharacters; ++i) for (int i = 0; i < numCharacters; ++i)
{ {
const juce_wchar c = characterStartIndex + i;
const juce_wchar c = (juce_wchar) (characterStartIndex + i);
Array <int> glyphIndexes; Array <int> glyphIndexes;
Array <float> offsets; Array <float> offsets;


+ 0
- 2
src/native/juce_win32_NativeCode.cpp View File

@@ -71,9 +71,7 @@ BEGIN_JUCE_NAMESPACE
#include "../gui/components/special/juce_SystemTrayIconComponent.h" #include "../gui/components/special/juce_SystemTrayIconComponent.h"
#include "../gui/components/filebrowser/juce_FileChooser.h" #include "../gui/components/filebrowser/juce_FileChooser.h"
#include "../gui/components/lookandfeel/juce_LookAndFeel.h" #include "../gui/components/lookandfeel/juce_LookAndFeel.h"
#if JUCE_USE_CDBURNER
#include "../audio/audio_file_formats/juce_AudioCDBurner.h" #include "../audio/audio_file_formats/juce_AudioCDBurner.h"
#endif
#include "../audio/audio_file_formats/juce_AudioCDReader.h" #include "../audio/audio_file_formats/juce_AudioCDReader.h"
#include "../audio/audio_sources/juce_AudioSource.h" #include "../audio/audio_sources/juce_AudioSource.h"
#include "../audio/dsp/juce_AudioDataConverters.h" #include "../audio/dsp/juce_AudioDataConverters.h"


+ 2
- 0
src/native/mac/juce_mac_CoreGraphicsContext.mm View File

@@ -516,6 +516,8 @@ private:
void drawGradient() const throw() void drawGradient() const throw()
{ {
CGContextSetAlpha (context, 1.0f); 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); CGShadingRef shading = createGradient (state->gradient);
CGContextDrawShading (context, shading); CGContextDrawShading (context, shading);
CGShadingRelease (shading); CGShadingRelease (shading);


+ 9
- 0
src/native/mac/juce_mac_MiscUtilities.mm View File

@@ -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 #if ! JUCE_ONLY_BUILD_CORE_LIBRARY


+ 6
- 20
src/native/windows/juce_win32_AudioCDReader.cpp View File

@@ -25,8 +25,9 @@
// (This file gets included by juce_win32_NativeCode.cpp, rather than being // (This file gets included by juce_win32_NativeCode.cpp, rather than being
// compiled on its own). // compiled on its own).
#if JUCE_INCLUDED_FILE && JUCE_USE_CDBURNER
#if JUCE_INCLUDED_FILE
#if JUCE_USE_CDREADER
//*************************************************************************** //***************************************************************************
// %%% TARGET STATUS VALUES %%% // %%% TARGET STATUS VALUES %%%
@@ -2069,6 +2070,9 @@ void AudioCDReader::ejectDisk()
((CDDeviceWrapper*) handle)->cdH->openDrawer (true); ((CDDeviceWrapper*) handle)->cdH->openDrawer (true);
} }
#endif
#if JUCE_USE_CDBURNER
//============================================================================== //==============================================================================
static IDiscRecorder* enumCDBurners (StringArray* list, int indexToOpen, IDiscMaster** master) static IDiscRecorder* enumCDBurners (StringArray* list, int indexToOpen, IDiscMaster** master)
@@ -2115,25 +2119,6 @@ static IDiscRecorder* enumCDBurners (StringArray* list, int indexToOpen, IDiscMa
drEnum->Release(); 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) if (master == 0)
dm->Close(); dm->Close();
} }
@@ -2391,3 +2376,4 @@ bool AudioCDBurner::addAudioTrack (AudioSource* source, int numSamples)
} }
#endif #endif
#endif

Loading…
Cancel
Save