2
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
|
2
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
5506
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
2
|
24 |
*/
|
|
25 |
|
|
26 |
#include <alsa/asoundlib.h>
|
|
27 |
#include "Utilities.h"
|
|
28 |
#include "PlatformMidi.h"
|
|
29 |
|
|
30 |
|
|
31 |
#ifndef PLATFORM_API_LINUXOS_ALSA_MIDIUTILS_H_INCLUDED
|
|
32 |
#define PLATFORM_API_LINUXOS_ALSA_MIDIUTILS_H_INCLUDED
|
|
33 |
|
|
34 |
#define EVENT_PARSER_BUFSIZE (2048)
|
|
35 |
|
|
36 |
// if this is defined, use plughw: devices
|
|
37 |
//#define ALSA_MIDI_USE_PLUGHW
|
|
38 |
#undef ALSA_MIDI_USE_PLUGHW
|
|
39 |
|
|
40 |
typedef struct tag_ALSA_MIDIDeviceDescription {
|
|
41 |
int index; // in
|
|
42 |
int strLen; // in
|
|
43 |
INT32 deviceID; // out
|
|
44 |
char* name; // out
|
|
45 |
char* description; // out
|
|
46 |
} ALSA_MIDIDeviceDescription;
|
|
47 |
|
|
48 |
|
|
49 |
const char* getErrorStr(INT32 err);
|
|
50 |
|
|
51 |
/* Returns the number of devices. */
|
|
52 |
/* direction is either SND_RAWMIDI_STREAM_OUTPUT or
|
|
53 |
SND_RAWMIDI_STREAM_INPUT. */
|
|
54 |
int getMidiDeviceCount(snd_rawmidi_stream_t direction);
|
|
55 |
|
|
56 |
/* Returns MIDI_SUCCESS or MIDI_INVALID_DEVICEID */
|
|
57 |
/* direction is either SND_RAWMIDI_STREAM_OUTPUT or
|
|
58 |
SND_RAWMIDI_STREAM_INPUT. */
|
|
59 |
int getMidiDeviceName(snd_rawmidi_stream_t direction, int index,
|
|
60 |
char *name, UINT32 nameLength);
|
|
61 |
|
|
62 |
/* Returns MIDI_SUCCESS or MIDI_INVALID_DEVICEID */
|
|
63 |
int getMidiDeviceVendor(int index, char *name, UINT32 nameLength);
|
|
64 |
|
|
65 |
/* Returns MIDI_SUCCESS or MIDI_INVALID_DEVICEID */
|
|
66 |
/* direction is either SND_RAWMIDI_STREAM_OUTPUT or
|
|
67 |
SND_RAWMIDI_STREAM_INPUT. */
|
|
68 |
int getMidiDeviceDescription(snd_rawmidi_stream_t direction, int index,
|
|
69 |
char *name, UINT32 nameLength);
|
|
70 |
|
|
71 |
/* Returns MIDI_SUCCESS or MIDI_INVALID_DEVICEID */
|
|
72 |
int getMidiDeviceVersion(int index, char *name, UINT32 nameLength);
|
|
73 |
|
|
74 |
// returns 0 on success, otherwise MIDI_OUT_OF_MEMORY or ALSA error code
|
|
75 |
/* direction is either SND_RAWMIDI_STREAM_OUTPUT or
|
|
76 |
SND_RAWMIDI_STREAM_INPUT. */
|
|
77 |
INT32 openMidiDevice(snd_rawmidi_stream_t direction, INT32 deviceIndex,
|
|
78 |
MidiDeviceHandle** handle);
|
|
79 |
|
|
80 |
// returns 0 on success, otherwise a (negative) ALSA error code
|
|
81 |
INT32 closeMidiDevice(MidiDeviceHandle* handle);
|
|
82 |
|
|
83 |
INT64 getMidiTimestamp(MidiDeviceHandle* handle);
|
|
84 |
|
|
85 |
#endif // PLATFORM_API_LINUXOS_ALSA_MIDIUTILS_H_INCLUDED
|