summaryrefslogtreecommitdiff
path: root/lib/libsalsa/rawmidi.c
blob: 4246357b69fd8ab71c507d4c2762a71dd6018f67 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
/*
 *  Copyright (c) 2004 by Hannu Savolainen < hannu@opensound.com>
 *
 *   This library is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License version 2.1 as
 *   published by the Free Software Foundation.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public
 *   License along with this library; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 */
#include <stdio.h>
#include "local.h"

/**
 * \brief Opens a new connection to the RawMidi interface.
 * \param inputp Returned input handle (NULL if not wanted)
 * \param outputp Returned output handle (NULL if not wanted)
 * \param name ASCII identifier of the RawMidi handle
 * \param mode Open mode
 * \return 0 on success otherwise a negative error code
 *
 * Opens a new connection to the RawMidi interface specified with
 * an ASCII identifier and mode.
 */
int
snd_rawmidi_open (snd_rawmidi_t ** inputp, snd_rawmidi_t ** outputp,
		  const char *name, int mode)
{
  dbg_printf ("snd_rawmidi_open(%s)\n", name);

  ALIB_INIT ();

  if (!alib_appcheck ())
    return -ENODEV;

  return 0;
}

/**
 * \brief close RawMidi handle
 * \param rawmidi RawMidi handle
 * \return 0 on success otherwise a negative error code
 *
 * Closes the specified RawMidi handle and frees all associated
 * resources.
 */
int
snd_rawmidi_close (snd_rawmidi_t * rawmidi)
{
  dbg_printf ("snd_rawmidi_close()\n");

  return 0;
}

/**
 * \brief read MIDI bytes from MIDI stream
 * \param rawmidi RawMidi handle
 * \param buffer buffer to store the input MIDI bytes
 * \param size input buffer size in bytes
 */
ssize_t
snd_rawmidi_read (snd_rawmidi_t * rawmidi, void *buffer, size_t size)
{
  dbg_printf ("snd_rawmidi_read(%d)\n", size);
}

/**
 * \brief write MIDI bytes to MIDI stream
 * \param rawmidi RawMidi handle
 * \param buffer buffer containing MIDI bytes
 * \param size output buffer size in bytes
 */
ssize_t
snd_rawmidi_write (snd_rawmidi_t * rawmidi, const void *buffer, size_t size)
{
  dbg_printf ("snd_rawmidi_write(%d)\n", size);

  return size;
}


/**
 * \brief set nonblock mode
 * \param rawmidi RawMidi handle
 * \param nonblock 0 = block, 1 = nonblock mode
 * \return 0 on success otherwise a negative error code
 *
 * The nonblock mode cannot be used when the stream is in
 * #SND_RAWMIDI_APPEND state.
 */
int
snd_rawmidi_nonblock (snd_rawmidi_t * rawmidi, int nonblock)
{
  dbg_printf ("snd_rawmidi_nonblock(%d)\n", nonblock);

  return 0;
}

/**
 * \brief get count of poll descriptors for RawMidi handle
 * \param rawmidi RawMidi handle
 * \return count of poll descriptors
 */
int
snd_rawmidi_poll_descriptors_count (snd_rawmidi_t * rawmidi)
{
  dbg_printf ("snd_rawmidi_poll_descriptors_count()\n");

  return 0;
}

/**
 * \brief get poll descriptors
 * \param rawmidi RawMidi handle
 * \param pfds array of poll descriptors
 * \param space space in the poll descriptor array
 * \return count of filled descriptors
 */
int
snd_rawmidi_poll_descriptors (snd_rawmidi_t * rawmidi, struct pollfd *pfds,
			      unsigned int space)
{
  dbg_printf ("snd_rawmidi_poll_descriptors()\n");

  return 0;
}

/**
 * \brief get returned events from poll descriptors
 * \param pcm rawmidi RawMidi handle
 * \param pfds array of poll descriptors
 * \param nfds count of poll descriptors
 * \param revents returned events
 * \return zero if success, otherwise a negative error code
 */
int
snd_rawmidi_poll_descriptors_revents (snd_rawmidi_t * rawmidi, struct pollfd
				      *pfds, unsigned int nfds,
				      unsigned short *revents)
{
  dbg_printf ("snd_rawmidi_poll_descriptors_revents()\n");

  return 0;
}

/**
 * \brief get size of the snd_rawmidi_info_t structure in bytes
 * \return size of the snd_rawmidi_info_t structure in bytes
 */
size_t
snd_rawmidi_info_sizeof ()
{
  return sizeof (snd_rawmidi_info_t);
}

/**
 * \brief get rawmidi hardware driver name
 * \param info pointer to a snd_rawmidi_info_t structure
 * \return rawmidi hardware driver name
 */
const char *
snd_rawmidi_info_get_name (const snd_rawmidi_info_t * info)
{
  dbg_printf ("snd_rawmidi_info_get_name()\n");

  return "OSS rawmidi";
}

/**
 * \brief get rawmidi count of subdevices
 * \param info pointer to a snd_rawmidi_info_t structure
 * \return rawmidi count of subdevices
 */
unsigned int
snd_rawmidi_info_get_subdevices_count (const snd_rawmidi_info_t * info)
{
  dbg_printf ("snd_rawmidi_info_get_subdevices_count()\n");

  return 1;
}

/**
 * \brief set rawmidi device number
 * \param info pointer to a snd_rawmidi_info_t structure
 * \param val device number
 */
void
snd_rawmidi_info_set_device (snd_rawmidi_info_t * info, unsigned int val)
{
  dbg_printf ("snd_rawmidi_info_set_device(%d)\n", val);

}


/**
 * \brief set rawmidi subdevice number
 * \param info pointer to a snd_rawmidi_info_t structure
 * \param val subdevice number
 */
void
snd_rawmidi_info_set_subdevice (snd_rawmidi_info_t * info, unsigned int val)
{
  dbg_printf ("snd_rawmidi_info_set_subdevice(%d)\n", val);
}

/**
 * \brief set rawmidi stream identifier
 * \param info pointer to a snd_rawmidi_info_t structure
 * \param val rawmidi stream identifier
 */
void
snd_rawmidi_info_set_stream (snd_rawmidi_info_t * info,
			     snd_rawmidi_stream_t val)
{
  dbg_printf ("snd_rawmidi_info_set_stream(%d)\n", val);
}

/**
 * \brief get rawmidi subdevice name
 * \param info pointer to a snd_rawmidi_info_t structure
 * \return rawmidi subdevice name
 */
const char *
snd_rawmidi_info_get_subdevice_name (const snd_rawmidi_info_t * info)
{
  dbg_printf ("snd_rawmidi_info_get_subdevice_name()\n");

  return "OSS rawmidi subdevice";
}