1
/* sqUnixMIDINone.c -- Unix with no MIDI support
3
* Copyright (C) 1996-2007 by Ian Piumarta and other authors/contributors
4
* listed elsewhere in this file.
7
* This file is part of Unix Squeak.
9
* Permission is hereby granted, free of charge, to any person obtaining a copy
10
* of this software and associated documentation files (the "Software"), to deal
11
* in the Software without restriction, including without limitation the rights
12
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
* copies of the Software, and to permit persons to whom the Software is
14
* furnished to do so, subject to the following conditions:
16
* The above copyright notice and this permission notice shall be included in
17
* all copies or substantial portions of the Software.
19
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
/* Author: Ian.Piumarta@INRIA.FR
30
* Last edited: 2007-03-11 13:30:32 by piumarta on emilia.local
33
/* Put the given port into MIDI mode, which uses a clock supplied
34
by an external MIDI interface adaptor to determine the data rate.
35
Possible external clock rates: 31.25 KHz, 0.5 MHz, 1 MHz, or 2 MHz. */
36
int serialPortMidiClockRate(int portNum, int interfaceClockRate)
42
/* Close the given MIDI port. Do nothing if the port is not open.
43
Fail if there is no port of the given number.*/
44
int sqMIDIClosePort(int portNum)
50
/* Return the current value of the clock used to schedule MIDI events.
51
The MIDI clock is assumed to wrap at or before half the maximum
52
positive SmallInteger value. This allows events to be scheduled
53
into the future without overflowing into LargePositiveIntegers.
54
This implementation does not support event scheduling, so it
55
just returns the value of the Squeak millisecond clock. */
56
int sqMIDIGetClock(void)
62
/* Return the number of available MIDI interfaces, including both
63
hardware ports and software entities that act like ports. Ports
64
are numbered from 0 to N-1, where N is the number returned by this
66
int sqMIDIGetPortCount(void)
72
/* Return an integer indicating the directionality of the given
73
port where: 1 = input, 2 = output, 3 = bidirectional. Fail if
74
there is no port of the given number. */
75
int sqMIDIGetPortDirectionality(int portNum)
81
/* Copy the name of the given MIDI port into the string at the given
82
address. Copy at most length characters, and return the number of
83
characters copied. Fail if there is no port of the given number.*/
84
int sqMIDIGetPortName(int portNum, int namePtr, int length)
90
/* Open the given port, if possible. If non-zero, readSemaphoreIndex
91
specifies the index in the external objects array of a semaphore
92
to be signalled when incoming MIDI data is available. Note that
93
not all implementations support read semaphores (this one does
94
not); see sqMIDICanUseSemaphore. The interfaceClockRate parameter
95
specifies the clock speed for an external MIDI interface
96
adaptor on platforms that use such adaptors (e.g., Macintosh).
97
Fail if there is no port of the given number.*/
98
int sqMIDIOpenPort(int portNum, int readSemaIndex, int interfaceClockRate)
104
/* Read or write the given MIDI driver parameter. If modify is 0,
105
then newValue is ignored and the current value of the specified
106
parameter is returned. If modify is non-zero, then the specified
107
parameter is set to newValue. Note that many MIDI driver parameters
108
are read-only; attempting to set one of these parameters fails.
109
For boolean parameters, true = 1, false = 0. */
110
int sqMIDIParameter(int whichParameter, int modify, int newValue)
116
/* bufferPtr is the address of the first byte of a Smalltalk
117
ByteArray of the given length. Copy up to (length - 4) bytes
118
of incoming MIDI data into that buffer, preceded by a 4-byte
119
timestamp in the units of the MIDI clock, most significant byte
120
first. Implementations that do not support timestamping of
121
incoming data as it arrives (see sqMIDIHasInputClock) simply
122
set the timestamp to the value of the MIDI clock when this
123
function is called. Return the total number of bytes read,
124
including the timestamp bytes. Return zero if no data is
125
available. Fail if the buffer is shorter than five bytes,
126
since there must be enough room for the timestamp plus at
127
least one data byte. */
128
int sqMIDIPortReadInto(int portNum, int count, int bufferPtr)
134
/* bufferPtr is the address of the first byte of a Smalltalk
135
ByteArray of the given length. Send its contents to the given
136
port when the MIDI clock reaches the given time. If time equals
137
zero, then send the data immediately. Implementations that do
138
not support a timestamped output queue, such as this one, always
139
send the data immediately; see sqMIDIHasBuffer. */
140
int sqMIDIPortWriteFromAt(int portNum, int count, int bufferPtr, int time)
153
int sqMIDIParameterGet(int which)
159
int sqMIDIParameterSet(int which, int value)
165
int midiShutdown(void)