diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2008-02-08 13:00:32 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2008-02-08 13:00:32 +0000 |
commit | 4d84d14ac1aa13958eaa2971b03f7f929a519105 (patch) | |
tree | 6579d3f2cea5410a10c4baac8d0f372fb0dff372 /desiredata/portmidi_osx/pmdarwin.c | |
parent | b334d38aefbd8e0e159d7af6c20d63c5d2b64859 (diff) |
reorganized
svn path=/trunk/; revision=9400
Diffstat (limited to 'desiredata/portmidi_osx/pmdarwin.c')
-rw-r--r-- | desiredata/portmidi_osx/pmdarwin.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/desiredata/portmidi_osx/pmdarwin.c b/desiredata/portmidi_osx/pmdarwin.c new file mode 100644 index 00000000..42e53fcc --- /dev/null +++ b/desiredata/portmidi_osx/pmdarwin.c @@ -0,0 +1,78 @@ +/* + * PortMidi OS-dependent interface for Darwin (MacOS X) + * Jon Parise <jparise@cmu.edu> + * + * $Id: pmdarwin.c,v 1.9.2.2 2005-07-12 15:53:50 timblech Exp $ + * + * CHANGE LOG: + * 03Jul03 - X. J. Scott (xjs): + * - Pm_GetDefaultInputDeviceID() and Pm_GetDefaultOutputDeviceID() + * now return id of first input and output devices in system, + * rather than returning 0 as before. + * This fix enables valid default port values to be returned. + * 0 is returned if no such device is found. + */ + +/* + * This file only needs to implement pm_init(), which calls various + * routines to register the available midi devices. This file must + * be separate from the main portmidi.c file because it is system + * dependent, and it is separate from, say, pmwinmm.c, because it + * might need to register devices for winmm, directx, and others. + */ + +#include <stdlib.h> +#include "portmidi.h" +#include "pmmacosx.h" + +PmError pm_init(void) // xjs added void +{ + return pm_macosx_init(); +} + +PmError pm_term(void) // xjs added void +{ + return pm_macosx_term(); +} + +/* Pm_GetDefaultInputDeviceID() - return input with lowest id # (xjs) + */ +PmDeviceID Pm_GetDefaultInputDeviceID() +{ + int i; + int device_count; + const PmDeviceInfo *deviceInfo; + + device_count = Pm_CountDevices(); + for (i = 0; i < device_count; i++) { + deviceInfo = Pm_GetDeviceInfo(i); + if (deviceInfo->input) + return i; + } + + return 0; +}; + +/* Pm_GetDefaultOutputDeviceID() - return output with lowest id # (xjs) +*/ +PmDeviceID Pm_GetDefaultOutputDeviceID() +{ + int i; + int device_count; + const PmDeviceInfo *deviceInfo; + + device_count = Pm_CountDevices(); + for (i = 0; i < device_count; i++) { + deviceInfo = Pm_GetDeviceInfo(i); + if (deviceInfo->output) + return i; + } + + return 0; +}; + + +void *pm_alloc(size_t s) { return malloc(s); } + +void pm_free(void *ptr) { free(ptr); } + |