mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-02-18 18:11:05 +00:00
Silence compiler warnings on macOS
This commit is contained in:
parent
59fdc3795b
commit
ac0aab2fa0
2 changed files with 35 additions and 22 deletions
|
@ -27,10 +27,10 @@
|
|||
#include "fluid_adriver.h"
|
||||
#include "fluid_settings.h"
|
||||
|
||||
/*
|
||||
/*
|
||||
* !!! Make sure that no include above includes <netinet/tcp.h> !!!
|
||||
* It #defines some macros that collide with enum definitions of OpenTransportProviders.h, which is included from OSServices.h, included from CoreServices.h
|
||||
*
|
||||
*
|
||||
* https://trac.macports.org/ticket/36962
|
||||
*/
|
||||
|
||||
|
@ -81,7 +81,7 @@ get_num_outputs(AudioDeviceID deviceID)
|
|||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioDevicePropertyStreamConfiguration;
|
||||
pa.mScope = kAudioDevicePropertyScopeOutput;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
pa.mElement = kAudioObjectPropertyElementMain;
|
||||
|
||||
if(OK(AudioObjectGetPropertyDataSize(deviceID, &pa, 0, 0, &size)) && size > 0)
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ fluid_core_audio_driver_settings(fluid_settings_t *settings)
|
|||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioHardwarePropertyDevices;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
pa.mElement = kAudioObjectPropertyElementMain;
|
||||
|
||||
fluid_settings_register_str(settings, "audio.coreaudio.device", "default", 0);
|
||||
fluid_settings_add_option(settings, "audio.coreaudio.device", "default");
|
||||
|
@ -172,6 +172,17 @@ new_fluid_core_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func
|
|||
OSStatus status;
|
||||
UInt32 size;
|
||||
int i;
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
||||
ComponentDescription desc;
|
||||
#else
|
||||
AudioComponentDescription desc;
|
||||
#endif
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
||||
Component comp;
|
||||
#else
|
||||
AudioComponent comp;
|
||||
#endif
|
||||
AURenderCallbackStruct render;
|
||||
|
||||
dev = FLUID_NEW(fluid_core_audio_driver_t);
|
||||
|
||||
|
@ -187,11 +198,6 @@ 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;
|
||||
|
@ -199,9 +205,9 @@ new_fluid_core_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func
|
|||
desc.componentFlagsMask = 0;
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
||||
Component comp = FindNextComponent(NULL, &desc);
|
||||
comp = FindNextComponent(NULL, &desc);
|
||||
#else
|
||||
AudioComponent comp = AudioComponentFindNext(NULL, &desc);
|
||||
comp = AudioComponentFindNext(NULL, &desc);
|
||||
#endif
|
||||
|
||||
if(comp == NULL)
|
||||
|
@ -223,7 +229,6 @@ new_fluid_core_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func
|
|||
}
|
||||
|
||||
// Set up a callback function to generate output
|
||||
AURenderCallbackStruct render;
|
||||
render.inputProc = fluid_core_audio_callback;
|
||||
render.inputProcRefCon = (void *) dev;
|
||||
status = AudioUnitSetProperty(dev->outputUnit,
|
||||
|
@ -250,7 +255,7 @@ new_fluid_core_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func
|
|||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioHardwarePropertyDevices;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
pa.mElement = kAudioObjectPropertyElementMain;
|
||||
|
||||
if(OK(AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &pa, 0, 0, &size)))
|
||||
{
|
||||
|
@ -342,7 +347,7 @@ new_fluid_core_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t func
|
|||
|
||||
dev->buffers[0] = FLUID_ARRAY(float, dev->buffer_size);
|
||||
dev->buffers[1] = FLUID_ARRAY(float, dev->buffer_size);
|
||||
|
||||
|
||||
if(dev->buffers[0] == NULL || dev->buffers[1] == NULL)
|
||||
{
|
||||
FLUID_LOG(FLUID_ERR, "Out of memory.");
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
/* End work around */
|
||||
|
||||
#include <unistd.h>
|
||||
#include <os/log.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include <CoreMIDI/MIDIServices.h>
|
||||
|
||||
|
@ -62,6 +63,10 @@ typedef struct
|
|||
int autoconn_inputs;
|
||||
} fluid_coremidi_driver_t;
|
||||
|
||||
static MIDIClientRef invalid_client = (MIDIClientRef)-1;
|
||||
static MIDIEndpointRef invalid_endpoint = (MIDIEndpointRef)-1;
|
||||
static MIDIPortRef invalid_port = (MIDIPortRef)-1;
|
||||
|
||||
void fluid_coremidi_callback(const MIDIPacketList *list, void *p, void *src);
|
||||
|
||||
void fluid_coremidi_driver_settings(fluid_settings_t *settings)
|
||||
|
@ -108,6 +113,8 @@ new_fluid_coremidi_driver(fluid_settings_t *settings, handle_midi_event_func_t h
|
|||
char *id;
|
||||
CFStringRef str_portname;
|
||||
CFStringRef str_clientname;
|
||||
OSStatus result;
|
||||
CFStringRef str_input_portname;
|
||||
|
||||
/* not much use doing anything */
|
||||
if(handler == NULL)
|
||||
|
@ -124,9 +131,10 @@ new_fluid_coremidi_driver(fluid_settings_t *settings, handle_midi_event_func_t h
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dev->client = 0;
|
||||
dev->endpoint = 0;
|
||||
dev->parser = 0;
|
||||
dev->client = invalid_client;
|
||||
dev->endpoint = invalid_endpoint;
|
||||
dev->input_port = invalid_port;
|
||||
dev->parser = NULL;
|
||||
dev->driver.handler = handler;
|
||||
dev->driver.data = data;
|
||||
|
||||
|
@ -173,7 +181,7 @@ new_fluid_coremidi_driver(fluid_settings_t *settings, handle_midi_event_func_t h
|
|||
FLUID_FREE(portname); /* -- free port name */
|
||||
}
|
||||
|
||||
OSStatus result = MIDIClientCreate(str_clientname, NULL, NULL, &client);
|
||||
result = MIDIClientCreate(str_clientname, NULL, NULL, &client);
|
||||
CFRelease(str_clientname);
|
||||
|
||||
if(result != noErr)
|
||||
|
@ -194,7 +202,7 @@ new_fluid_coremidi_driver(fluid_settings_t *settings, handle_midi_event_func_t h
|
|||
goto error_recovery;
|
||||
}
|
||||
|
||||
CFStringRef str_input_portname = CFSTR("input");
|
||||
str_input_portname = CFSTR("input");
|
||||
result = MIDIInputPortCreate(client, str_input_portname,
|
||||
fluid_coremidi_callback,
|
||||
(void *)dev, &dev->input_port);
|
||||
|
@ -231,17 +239,17 @@ delete_fluid_coremidi_driver(fluid_midi_driver_t *p)
|
|||
fluid_coremidi_driver_t *dev = (fluid_coremidi_driver_t *) p;
|
||||
fluid_return_if_fail(dev != NULL);
|
||||
|
||||
if(dev->input_port != NULL)
|
||||
if(dev->input_port != invalid_port)
|
||||
{
|
||||
MIDIPortDispose(dev->input_port);
|
||||
}
|
||||
|
||||
if(dev->client != NULL)
|
||||
if(dev->client != invalid_client)
|
||||
{
|
||||
MIDIClientDispose(dev->client);
|
||||
}
|
||||
|
||||
if(dev->endpoint != NULL)
|
||||
if(dev->endpoint != invalid_endpoint)
|
||||
{
|
||||
MIDIEndpointDispose(dev->endpoint);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue