blob: 7c1fb7125acdd52825c1d54be73b485caf24f76d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/*
* PortMidi OS-dependent interface for Darwin (MacOS X)
* Jon Parise <jparise@cmu.edu>
*
* $Id: pmdarwin.c,v 1.1.1.2 2004-02-02 11:28:02 ggeiger 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); }
|