Mac OSX fixes: frameworks build, midi.coremidi.id option.

This commit is contained in:
Pedro Lopez-Cabanillas 2010-10-31 16:15:32 +00:00
parent 068a7534ef
commit 155e43760e
4 changed files with 226 additions and 209 deletions

View file

@ -1,4 +1,4 @@
# FluidSynth - A Software Synthesize # FluidSynth - A Software Synthesizer
# #
# Copyright (C) 2003-2010 Peter Hanappe and others. # Copyright (C) 2003-2010 Peter Hanappe and others.
# #

View file

@ -1,4 +1,4 @@
# FluidSynth - A Software Synthesize # FluidSynth - A Software Synthesizer
# #
# Copyright (C) 2003-2010 Peter Hanappe and others. # Copyright (C) 2003-2010 Peter Hanappe and others.
# #
@ -107,6 +107,13 @@ if ( MIDISHARE_SUPPORT )
include_directories ( ${MidiShare_INCLUDE_DIRS} ) include_directories ( ${MidiShare_INCLUDE_DIRS} )
endif ( MIDISHARE_SUPPORT ) endif ( MIDISHARE_SUPPORT )
set ( config_SOURCES ${CMAKE_BINARY_DIR}/config.h )
if ( MSVC )
set ( config_SOURCES
${config_SOURCES}
${CMAKE_BINARY_DIR}/config_win32.h )
endif ( MSVC )
set ( libfluidsynth_SOURCES set ( libfluidsynth_SOURCES
utils/fluid_conv.c utils/fluid_conv.c
utils/fluid_conv.h utils/fluid_conv.h
@ -224,6 +231,7 @@ link_directories (
# note: by default this target creates a shared object (or dll). To build a # note: by default this target creates a shared object (or dll). To build a
# static library instead, set the option BUILD_SHARED_LIBS to FALSE. # static library instead, set the option BUILD_SHARED_LIBS to FALSE.
add_library ( libfluidsynth add_library ( libfluidsynth
${config_SOURCES}
${fluid_alsa_SOURCES} ${fluid_alsa_SOURCES}
${fluid_coreaudio_SOURCES} ${fluid_coreaudio_SOURCES}
${fluid_coremidi_SOURCES} ${fluid_coremidi_SOURCES}
@ -252,7 +260,7 @@ if ( MACOSX_FRAMEWORK )
FRAMEWORK TRUE FRAMEWORK TRUE
PUBLIC_HEADER "${public_main_HEADER}" PUBLIC_HEADER "${public_main_HEADER}"
FRAMEWORK_VERSION "${LIB_VERSION_CURRENT}" FRAMEWORK_VERSION "${LIB_VERSION_CURRENT}"
INSTALL_NAME_DIR ${FRAMEWORK_INSTALL_DIR} INSTALL_NAME_DIR ""
VERSION ${LIB_VERSION_INFO} VERSION ${LIB_VERSION_INFO}
SOVERSION ${LIB_VERSION_CURRENT} SOVERSION ${LIB_VERSION_CURRENT}
) )
@ -308,10 +316,16 @@ target_link_libraries ( fluidsynth
${FLUID_LIBS} ${FLUID_LIBS}
) )
install ( TARGETS fluidsynth libfluidsynth if ( MACOSX_FRAMEWORK )
install ( TARGETS fluidsynth libfluidsynth
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
FRAMEWORK DESTINATION ${FRAMEWORK_INSTALL_DIR}
)
else ( MACOSX_FRAMEWORK )
install ( TARGETS fluidsynth libfluidsynth
RUNTIME DESTINATION ${BIN_INSTALL_DIR} RUNTIME DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}${LIB_SUFFIX} LIBRARY DESTINATION ${LIB_INSTALL_DIR}${LIB_SUFFIX}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}${LIB_SUFFIX} ARCHIVE DESTINATION ${LIB_INSTALL_DIR}${LIB_SUFFIX}
FRAMEWORK DESTINATION ${FRAMEWORK_INSTALL_DIR}
BUNDLE DESTINATION ${BUNDLE_INSTALL_DIR}
) )
endif ( MACOSX_FRAMEWORK )

View file

@ -109,8 +109,8 @@ fluid_core_audio_driver_settings(fluid_settings_t* settings)
pa.mScope = kAudioObjectPropertyScopeWildcard; pa.mScope = kAudioObjectPropertyScopeWildcard;
pa.mElement = kAudioObjectPropertyElementMaster; pa.mElement = kAudioObjectPropertyElementMaster;
fluid_settings_register_str(settings, "audio.coreaudio.device", "default", 0, NULL, NULL); fluid_settings_register_str (settings, "audio.coreaudio.device", "default", 0, NULL, NULL);
fluid_settings_add_option(settings, "audio.coreaudio.device", "default"); fluid_settings_add_option (settings, "audio.coreaudio.device", "default");
if (OK (AudioObjectGetPropertyDataSize (kAudioObjectSystemObject, &pa, 0, 0, &size))) { if (OK (AudioObjectGetPropertyDataSize (kAudioObjectSystemObject, &pa, 0, 0, &size))) {
int num = size / (int) sizeof (AudioDeviceID); int num = size / (int) sizeof (AudioDeviceID);
AudioDeviceID devs [num]; AudioDeviceID devs [num];
@ -121,7 +121,7 @@ fluid_core_audio_driver_settings(fluid_settings_t* settings)
pa.mSelector = kAudioDevicePropertyDeviceName; pa.mSelector = kAudioDevicePropertyDeviceName;
if (OK (AudioObjectGetPropertyData (devs[i], &pa, 0, 0, &size, name))) { if (OK (AudioObjectGetPropertyData (devs[i], &pa, 0, 0, &size, name))) {
if ( get_num_outputs (devs[i]) > 0) { if ( get_num_outputs (devs[i]) > 0) {
fluid_settings_add_option(settings, "audio.coreaudio.device", name); fluid_settings_add_option (settings, "audio.coreaudio.device", name);
} }
} }
} }

View file

@ -78,6 +78,7 @@ new_fluid_coremidi_driver(fluid_settings_t* settings, handle_midi_event_func_t h
fluid_coremidi_driver_t* dev; fluid_coremidi_driver_t* dev;
MIDIClientRef client; MIDIClientRef client;
MIDIEndpointRef endpoint; MIDIEndpointRef endpoint;
char clientid[32];
char * portname; char * portname;
char * id; char * id;
CFStringRef str_portname; CFStringRef str_portname;
@ -108,23 +109,25 @@ new_fluid_coremidi_driver(fluid_settings_t* settings, handle_midi_event_func_t h
} }
fluid_settings_dupstr(settings, "midi.coremidi.id", &id); /* ++ alloc id string */ fluid_settings_dupstr(settings, "midi.coremidi.id", &id); /* ++ alloc id string */
if (!id || FLUID_STRCMP(id, "pid") == 0) bzero (clientid, sizeof(clientid));
str_clientname = CFStringCreateWithFormat(NULL, NULL, if (id != NULL) {
CFSTR("FluidSynth %qi"), if (FLUID_STRCMP (id, "pid") == 0) {
(long long) getpid()); snprintf (clientid, sizeof(clientid), " (%d)", getpid());
else } else {
str_clientname = CFStringCreateWithFormat(NULL, NULL, snprintf (clientid, sizeof(clientid), " (%s)", id);
CFSTR("FluidSynth %s"), id); }
FLUID_FREE (id); /* -- free id string */
if (id) FLUID_FREE (id); /* -- free id string */ }
str_clientname = CFStringCreateWithFormat (NULL, NULL,
CFSTR("FluidSynth%s"), clientid);
fluid_settings_dupstr(settings, "midi.portname", &portname); /* ++ alloc port name */ fluid_settings_dupstr(settings, "midi.portname", &portname); /* ++ alloc port name */
if (!portname || strlen(portname) == 0) if (!portname || strlen(portname) == 0)
str_portname = CFStringCreateWithFormat(NULL, NULL, str_portname = CFStringCreateWithFormat (NULL, NULL,
CFSTR("FluidSynth virtual port %qi"), CFSTR("FluidSynth virtual port%s"),
(long long) getpid()); clientid);
else else
str_portname = CFStringCreateWithCString(NULL, portname, str_portname = CFStringCreateWithCString (NULL, portname,
kCFStringEncodingASCII); kCFStringEncodingASCII);
if (portname) FLUID_FREE (portname); /* -- free port name */ if (portname) FLUID_FREE (portname); /* -- free port name */