Restore support for Mac OS X 10.5 and earlier (#947)

Expands on #803 and closes #946.

Tested on macOS 11.4 as well as 10.4.
This commit is contained in:
Evan Miller 2021-07-28 04:20:48 -04:00 committed by GitHub
parent 62b60ae161
commit c68a10ca13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -152,3 +152,4 @@ Marcus Weseloh
Jean-jacques Ceresa
Vladimir Davidovich
Tamás Korodi
Evan Miller

View file

@ -187,14 +187,22 @@ new_fluid_core_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func
dev->data = data;
// Open the default output unit
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
ComponentDescription desc;
#else
AudioComponentDescription desc;
#endif
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_HALOutput; //kAudioUnitSubType_DefaultOutput;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
Component comp = FindNextComponent(NULL, &desc);
#else
AudioComponent comp = AudioComponentFindNext(NULL, &desc);
#endif
if(comp == NULL)
{
@ -202,7 +210,11 @@ new_fluid_core_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func
goto error_recovery;
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
status = OpenAComponent(comp, &dev->outputUnit);
#else
status = AudioComponentInstanceNew(comp, &dev->outputUnit);
#endif
if(status != noErr)
{
@ -372,7 +384,11 @@ delete_fluid_core_audio_driver(fluid_audio_driver_t *p)
fluid_core_audio_driver_t *dev = (fluid_core_audio_driver_t *) p;
fluid_return_if_fail(dev != NULL);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
CloseComponent(dev->outputUnit);
#else
AudioComponentInstanceDispose(dev->outputUnit);
#endif
if(dev->buffers[0])
{