Lines Matching +full:at +full:- +full:the +full:- +full:time
6 .\" purpose with or without fee is hereby granted, provided that the above
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 .Cd "midi* at autri?"
25 .Cd "midi* at eap?"
26 .Cd "midi* at envy?"
27 .Cd "midi* at mpu?"
28 .Cd "midi* at sb?"
29 .Cd "midi* at umidi?"
30 .Cd "midi* at ym?"
39 Data received on the input port is not interpreted and is passed
40 to the user program as-is.
41 Similarly, data issued by the user program is sent as-is to the
46 device at a given time, although file descriptors may be shared
47 between processes once the first open completes.
48 If it is opened read-only (write-only), only the input (output)
50 .Ss Writing to the device
51 A process can send raw MIDI data to the output port by using the
54 Data is queued and the system call returns immediately; the data
55 is sent as fast as possible to the output MIDI port.
56 However, if the in-kernel buffer is full or the requested amount
60 The current size of the in-kernel buffer is 1024 bytes, which
64 .Ss Reading from the device
65 Data received from the input MIDI port is stored into the
66 in-kernel buffer.
71 If there is less data than the amount requested for reading, then
73 If no data is available, then the
78 The MIDI protocol has been designed for real-time performance and
80 An application must be able to read the incoming data fast enough
82 The kernel can buffer up to 1024 bytes; once the buffer is full
84 .Ss Polling the device
85 A process can use the
87 system call to poll for the following events:
88 .Bl -tag -width POLLOUT
90 The in-kernel input buffer isn't empty, i.e. at least one byte is
96 The in-kernel output buffer is empty, thus a subsequent call to
102 Using the
104 system call is the recommended way to handle multiple
106 devices in a real-time MIDI application.
107 .Ss Non-blocking I/O
108 If the
110 device is opened with the O_NONBLOCK flag (see
121 Similarly, the
125 Note that even if non-blocking I/O is not selected,
129 system calls are non-blocking when the kernel buffers permit it.
131 .Bl -tag -width /dev/rmidim -compact
137 The following command could record the memory dump of a
140 .Dl $ cat -u /dev/rmidi2 >dumpfile
142 A MIDI keyboard could be connected to a synthesizer by the
145 .Dl $ cat -u /dev/rmidi1 >/dev/rmidi2
147 The input port could be connected to the output port by the
150 .Dl $ cat -u <>/dev/rmidi1 >&0
154 sends the result to a third (output) device.
155 .Bd -literal -offset indent
168 if (poll(ifd, 2, -1) == -1)
171 if ((iused = read(ifd[0].fd, ibuf, BUFSIZE)) == -1)
178 if ((iused = read(ifd[1].fd, ibuf, BUFSIZE)) == -1)
184 if (write(ofd, obuf, oused) == -1)
189 In the above example, unless kernel buffers are full, processing
190 is done in real-time without any noticeable latency; as expected,
203 .Bl -tag -width Er
205 The device is opened read-only (write-only) but
215 Non-blocking I/O was selected and the output buffer is full (on
216 writing) or the input buffer is empty (on reading).
233 .An -nosplit
241 MIDI hardware was designed for real time performance and software
244 is the time it takes for sound to propagate 1.75 meters).
250 tries to write data faster than the hardware is able to process it
252 full and the application may be blocked.
254 The other common reason for MIDI data being delayed is the system
258 if they are running a lot of expensive system calls) then the
259 scheduling of a real-time MIDI application may be delayed.
260 Even on low-end machines this delay hardly reaches a few
261 milliseconds provided that the system load is reasonable.
263 A real-time MIDI application can avoid being swapped by locking
269 For a given device, even if the physical MIDI input and output
270 ports are independent, there is no way for one process to use the
271 input MIDI port and for another process to use the output MIDI
272 port at the same time.