update wavesaudio backend, now supports Windows (ASIO) as well as OS X (CoreAudio)
[ardour.git] / libs / backends / wavesaudio / portmidi / src / pm_mac / pmmac.c
1 /* pmmac.c -- PortMidi os-dependent code */
2
3 /* This file only needs to implement:
4 pm_init(), which calls various routines to register the 
5 available midi devices,
6 Pm_GetDefaultInputDeviceID(), and
7 Pm_GetDefaultOutputDeviceID().
8 It is seperate from pmmacosxcm because we might want to register
9 non-CoreMIDI devices.
10 */
11
12 #include "stdlib.h"
13 #include "portmidi.h"
14 #include "pmutil.h"
15 #include "pminternal.h"
16 #include "pmmacosxcm.h"
17
18 PmDeviceID pm_default_input_device_id = -1;
19 PmDeviceID pm_default_output_device_id = -1;
20
21 void pm_init()
22 {
23     PmError err = pm_macosxcm_init();
24     // this is set when we return to Pm_Initialize, but we need it
25     // now in order to (successfully) call Pm_CountDevices()
26     pm_initialized = TRUE;
27     if (!err) {
28         pm_default_input_device_id = find_default_device(
29                 "/PortMidi/PM_RECOMMENDED_INPUT_DEVICE", TRUE, 
30                 pm_default_input_device_id);
31         pm_default_output_device_id = find_default_device(
32                 "/PortMidi/PM_RECOMMENDED_OUTPUT_DEVICE", FALSE, 
33                 pm_default_output_device_id);
34     }
35 }
36
37
38 void pm_term(void)
39 {
40     pm_macosxcm_term();
41 }
42
43
44 PmDeviceID Pm_GetDefaultInputDeviceID()
45 {
46     Pm_Initialize();
47     return pm_default_input_device_id;
48 }
49
50 PmDeviceID Pm_GetDefaultOutputDeviceID() {
51     Pm_Initialize();
52     return pm_default_output_device_id;
53 }
54
55 void *pm_alloc(size_t s) { return malloc(s); }
56
57 void pm_free(void *ptr) { free(ptr); }
58
59