sysextemp.h 3.67 KB
/*************************************************************************
 *
 *  header file for common synthesizer constants
 *
 *			    Written by Gints Klimanis 
 *			Silicon Graphics Computer Systems
 *				 1995
 *************************************************************************/
#ifndef __INCLUDE_SYNTHCOMMON_H__
#define __INCLUDE_SYNTHCOMMON_H__ 1

#ifdef __cplusplus
extern "C" {
#endif

#include <dmedia/midi.h>    
/*#define SGISoftwareSynthDeviceName  "SoftwareSynth"*/
#define SGISoftwareSynthDeviceName  "SoftwareSynth"

#define _MIDI_PANEL_ID	    8
#define _SOUND_PLAYER_ID    7

#define _SYNTH_MEKTON_ID    10
#define _SYNTH_NINTENDO_ID  9
#define _SYNTH_KEYS_ID	    6
#define _SYNTH_PANEL_ID	    5
#define _SYNTH_SYNTH_ID	    4
#define _SYNTH_EDITOR_ID    3

#define _ORIGIN_UNSPECIFIED_ID	    0
#define _DESTINATION_UNSPECIFIED_ID 0
#define _ORIGIN_ANY_ID		    1
#define _DESTINATION_ALL_ID	    1

/* SYSEX AP function ID codes */
#define _AP_SET_ADDRESS		0
#define _AP_SET_BOOLEAN		2
#define _AP_SET_DOUBLE		4
#define _AP_SET_NUMBER		_AP_SET_DOUBLE
#define _AP_SET_STRING		6
#define _AP_SET_BULK_DATA	8

#define _AP_SET_MIDI_SYSEX	16 
#define _AP_SET_MIDI_MESSAGE	18 
#define _AP_SET_PARAMETER	20

#define _AP_GET_ADDRESS		1
#define _AP_GET_BOOLEAN		3
#define _AP_GET_DOUBLE		5
#define _AP_GET_NUMBER		_AP_GET_DOUBLE
#define _AP_GET_STRING		7
#define _AP_GET_BULK_DATA	15
#define _AP_GET_PARAMETER	21

#define _AP_TELL		9
#define _AP_ASK			11
#define _AP_ERROR		13	/* should be 13 or 666 */

/* 
System Exclusive (SYSEX) message format 

$F0:	start sysex
$00:	manufacturer ID (SGI)
$00:	device ID
$00:	model ID
$00:	command ID
$xx:	MIDI channel   (currently only 1 byte)
$xx:	origin ID      (currently only 1 byte)
$xx:	destination ID (currently only 1 byte)

body	(bytes with up to seven bits filled)
	parameter value
	parameter name
$F7:	end sysex
*/

#define _AP_SYSEX_MAX_BUFFER_SIZE   1000

#define _AP_SYSEX_MANUFACTURER_INDEX	1
#define _AP_SYSEX_DEVICE_INDEX		2
#define _AP_SYSEX_MODEL_INDEX		3
#define _AP_SYSEX_COMMAND_INDEX		4
#define _AP_SYSEX_CHANNEL_INDEX	    _AP_SYSEX_COMMAND_INDEX     + 1
#define _AP_SYSEX_ORIGIN_INDEX	    _AP_SYSEX_CHANNEL_INDEX     + 1
#define _AP_SYSEX_DESTINATION_INDEX _AP_SYSEX_ORIGIN_INDEX      + 1
#define _AP_SYSEX_DATA_INDEX	    _AP_SYSEX_DESTINATION_INDEX + 1

#define _AP_SYSEX_MANUFACTURER_SGI	0x55
#define _AP_SYSEX_DEVICE_SYNTH		0x32
#define _AP_SYSEX_MODEL_GINTS		0x66

#define NOT_NEEDED		    -1

#define _AP_MESSAGE_NONE		0
#define _AP_MESSAGE_EDIT_BUFFER_CREATED	1
#define _AP_PRESET_CHANGED		2


#define _AP_BAD_PARAMETER		3
#define _AP_BAD_PARAMETER_VALUE		4
#define _AP_BAD_MESSAGE_CODE		5
#define _AP_BAD_PRESET_LOAD		6
#define _AP_BAD_COMMAND			7


char suIsSGISynthSystemExclusive(MDevent *event);
int suGetOriginID(MDevent *event); 
int suGetCommandID(MDevent *event); 
char *suGetParameter(MDevent *event);
char *suGetData(MDevent *event);
double suNibblesToDouble(char *in);
void suSetBooleanMIDI(MDport port, int channel, int *IDs, char *parameter, char value);
void suSetNumberMIDI(MDport port, int channel, int *IDs, char *parameter, double value);
void suSetStringMIDI(MDport port, int channel, int *IDs, char *parameter, char *value);


#ifdef __cplusplus
}
char suIsSGISynthSystemExclusive(MDevent *event);
int suGetOriginID(MDevent *event); 
int suGetCommandID(MDevent *event); 
char *suGetParameter(MDevent *event);
char *suGetData(MDevent *event);
double suNibblesToDouble(char *in);
void suSetBooleanMIDI(MDport port, int channel, int *IDs, char *parameter, char value);
void suSetNumberMIDI(MDport port, int channel, int *IDs, char *parameter, double value);
void suSetStringMIDI(MDport port, int channel, int *IDs, char *parameter, char *value);

#endif

#endif