ftp.nice.ch/peanuts/GeneralData/Documents/NeXT/MIDIDriver.tar.gz#/MIDIDriver/CFunctions/ReceivingTransmitting.rtf

This is ReceivingTransmitting.rtf in view mode; [Download] [Up]

paperh22175 margl-907 margr0 margt0 margb0 {fonttblf0fswiss Helvetica;f1froman Times;f2fmodern Courier;f3ftech Symbol;f4froman Palantino;}fi0 ri0 ql sb0 f1 fs24 Release 2.0  Copyright f3 'e3f1 1991 by NeXT Computer, Inc.  All Rights Reserved.

b fs36 f1 ql ri1007 li1108 fi-503 Receiving and Transmitting MIDI Data
fs16 
fs36 pard s28 li1108 fi0 ri1007 ql fs16 

fs36 midi_get_data()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Get received MIDI data.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_server.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b midi_get_data(b0 midi_rx_t i receive_porti0 , port_ t i reply_portb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i receive_porti0 :  The MIDI receive port.
fs16 
fs28 i reply_porti0 :  Port to send MIDI data to.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionb  midi_get_data()b0  causes any received data to be sent to the specified port.  The i receive_porti0  parameter is the port previously obtained using the b midi_get_recv()b0  call on the device port.  When data has been received it will be forwarded to the application as either raw, cooked, or packed data, according to the input protocol specified (see b midi_set_proto()b0 ).  The exception is that if a System Exclusive message is received while in cooked mode, the data will be sent as packed data.  The appropriate one of the messages b midi_ret_raw_datab0 , b midi_ret_cooked_datab0 , or b midi_ret_packed_datab0  will be sent on the port specified by the i reply_porti0  parameter (see b midi_reply_handler()b0 ).
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  Data enqueued for output.
fs16 
fs28 MIDI_BAD_PORT:  i Receive_porti0  was invalid.
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 midi_get_sys_ignores(), midi_set_sys_ignores()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Set or get the bitmap specifying MIDI system commands to be ignored.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_server.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b midi_get_sys_ignores(b0 midi_rx_t i receive_porti0 , u_int *i sys_ignoresb i0 )
b0 kern_return_t b midi_set_sys_ignores(b0 midi_rx_t i receive_porti0 , u_int i sys_ignoresb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i receive_porti0 :  The MIDI receive port.
fs16 
fs28 i sys_ignoresi0 :  Bitmap (or a pointer to it) describing which MIDI system commands to ignore.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionb  midi_set_sys_ignores()b0  specifies which MIDI system commands will be ignored by the device driver.  If any one of these commands is subsequently received, it is discarded along with all data associated with it.  The i sys_ignoresi0  parameter is a bitmap specifying which MIDI system commands are to be ignored.  See b <midi/midi_types.h>b0  for defines for the bits associated with each MIDI system command; a number of constants of the form MIDI_IGNORE_i systemMsgi0  are provided.
fs16 
fs28 The functionb  midi_get_sys_ignores()b0  returns the i sys_ignoresi0  bitmap by reference.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  Data enqueued for output.
fs16 
fs28 MIDI_BAD_PORT:  i Receive_porti0  was invalid.
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 midi_output_queue_notify()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Ask to be notified when queue gets small enough.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_server.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b midi_output_queue_notify(b0 midi_dev_t i device_porti0 , port_t i owner_porti0 , port_t i reply_porti0 , u_int i queue_sizeb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i device_porti0 :  The MIDI device port.
fs16 
fs28 i owner_porti0 :  The port registered as the owner port.
fs16 
fs28 i reply_porti0 :  The port to send a b midi_queue_notify()b0  message on.
fs16 
fs28 i queue_sizei0 :  The maximum number of messages that can be enqueued before a reply is sent.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionb  midi_output_queue_notify()b0  registers i reply_porti0  as the port on which to send a b midi_queue_notify()b0  message (see b midi_reply_handler()b0 ) when the size of the output becomes less than or equal to i queue_sizei0  messages in length.  This function can be used to control the flow of MIDI output.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  A b midi_queue_notify()b0  message will be returned.
fs16 
fs28 MIDI_BAD_PORT:  i device_porti0  was invalid.
fs16 
fs28 MIDI_NOT_OWNER:  i owner_porti0  is not the registered owner port.
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 midi_output_queue_size()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Find out the current and maximum sizes of the MIDI output queue.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_server.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b midi_output_queue_size(b0 midi_dev_t i device_porti0 , u_int *i queue_sizei0 , u_int *i queue_maxb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i device_porti0 :  The MIDI device port.
fs16 
fs28 i queue_sizei0 :  Pointer to the current number of MIDI messages enqueued for output.
fs16 
fs28 i queue_maxi0 :  Pointer to the maximum number of MIDI messages that may be enqueued for output without causing the driver to block.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionb  midi_output_queue_size()b0  returns a pointer to the number of messages enqueued for output, and a pointer to the maximum number of messages that may be enqueued for output before the device stops receiving any further messages on its transmit port.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  Output queue current and maximum size was returned.
fs16 
fs28 MIDI_BAD_PORT:  i device_porti0  was invalid.
fs16 
fs28 MIDI_NOT_OWNER:  i owner_porti0  is not the registered owner port.
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 midi_send_cooked_data(), midi_send_packed_data(), midi_send_raw_data()
fs16 
fs36 pard s20 li4636 fi-2520 ri1007 ql tx4636 b0 fs28 fs16 
fs28 SUMMARY	Enqueue MIDI data for output.
fs16 
fs28 pard s29 li2116 fi0 ri1007 ql fs16 fs28 SYNOPSIS
pard s5 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 b #import <midi/midi_server.h>
fs16 
fs28 pard s11 li3124 fi-503 ri1007 ql b0 kern_return_t b midi_send_cooked_data(b0 midi_rx_t i xmit_porti0 , midi_cooked_t i midi_cooked_datai0 , u_int i counti0 , boolean_t i dont_blockb i0 )
b0 kern_return_t b midi_send_packed_data(b0 midi_rx_t i xmit_porti0 , u_int i quantai0 , midi_packed_t i midi_packed_datai0 , u_int i counti0 , boolean_t i dont_blockb i0 )
b0 kern_return_t b midi_send_raw_data(b0 midi_rx_t i xmit_porti0 , midi_raw_t i midi_raw_datai0 , u_int i counti0 , boolean_t i dont_blockb i0 )
s9 li2116 fi503 fi0 b0 fs16 

fs28 ARGUMENTS
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 i xmit_porti0 :  The MIDI transmit port.
fs16 
fs28 i midi_cooked_datai0 :i   i0 An array of cooked MIDI eventsi .
fs16 
fs28 i0 i midi_packed_datai0 :i   i0 An array of packed MIDI eventsi .
fs16 
fs28 i0 i midi_raw_datai0 :i   i0 An array of raw MIDI events.
fs16 
fs28 i counti0 :  The number of MIDI events in the array.
fs16 
fs28 i dont_blocki0 :  Whether to cause a warning to be returned if the queue is full.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 DESCRIPTION
pard s2 li2620 fi0 ri1007 ql tx3124 tx3628 tx4132 The functionsb  midi_send_cooked_data()b0 ,b  midi_send_packed_data()b0 , andb  midi_send_raw_data()b0  cause an array of bytes to be enqueued for output.  The bytes consist of MIDI messages in the cooked, packed, or raw format, respectively.  The i xmit_porti0  parameter is the port previously obtained using the b midi_get_xmit()b0  call on the device port.  The parameteri  midi_packed_data, midi_raw_datai0 , ori  midi_cooked_datai0  is an array of elements of the respective type (see b <midi/midi_types.h>b0 ).  In the packed format, each element consists of a single byte of data; in the raw format, each element contains a i quantai0  timestamp and a single byte of data; and in the cooked format, each element contains a i quantai0  timestamp, a byte count, and three bytes of data.  The timestamp in the raw and cooked formats represents either a relative delay from the previous MIDI output event, or an absolute time as represented by the timer service associated with the output MIDI device (see b midi_get_out_timer_port()b0  and b midi_set_proto()b0 ).  
fs16 
fs28 If i dont_blocki0  is YES, the function will return the error value MIDI_WILL_BLOCK if this request to send data would cause the number of messages enqueued for output to equal or exceed the maximum allowed queue size.  If i dont_blocki0  is NO, the next attempt to enqueue output data may block until the queue has shrunk below the maximum size.  Along with b midi_output_queue_notify()b0 , the i dont_blocki0  parameter can be used to flow-control output to the device.
fs16 
fs28 pard s9 li2116 fi0 ri1007 ql fs16 
fs28 RETURN
pard s17 li3124 fi-503 ri1007 ql tx3124 tx3628 tx4132 KERN_SUCCESS:  Data enqueued for output.
fs16 
fs28 MIDI_BAD_PORT:  i xmit_porti0  was invalid.
fs16 
fs28 MIDI_WILL_BLOCK:  The next call enqueuing output data may be delayed (queue full).
fs16 
fs28 pard s28 li1108 fi0 ri1007 ql b fs36 fs16 



fs36 midi_send_packed_data() f3 b0 'aef1 b  See midi_send_cooked_data()
fs16 
fs36 s6 fs16 fs36 midi_send_raw_data() f3 b0 'aef1 b  See midi_send_cooked_data()
fs16 
fs36 fs16 fs36 midi_set_sys_ignores() f3 b0 'aef1  b See midi_get_sys_ignores()
fs16 
fs36 s24 fi-503 fs16 



fs36 }

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.