libswami Reference Manual | ||||
---|---|---|---|---|
Top | Description |
SwamiMidiEvent; SwamiMidiEventNote; SwamiMidiEventControl; #define SWAMI_TYPE_MIDI_EVENT enum SwamiMidiEventType; #define SWAMI_MIDI_CC_BANK_MSB #define SWAMI_MIDI_CC_MODULATION #define SWAMI_MIDI_CC_VOLUME #define SWAMI_MIDI_CC_PAN #define SWAMI_MIDI_CC_EXPRESSION #define SWAMI_MIDI_CC_BANK_LSB #define SWAMI_MIDI_CC_SUSTAIN #define SWAMI_MIDI_CC_REVERB #define SWAMI_MIDI_CC_CHORUS #define SWAMI_MIDI_RPN_BEND_RANGE #define SWAMI_MIDI_RPN_MASTER_TUNE GType swami_midi_event_get_type (void
); SwamiMidiEvent * swami_midi_event_new (void
); void swami_midi_event_free (SwamiMidiEvent *event
); SwamiMidiEvent * swami_midi_event_copy (SwamiMidiEvent *event
); void swami_midi_event_set (SwamiMidiEvent *event
,SwamiMidiEventType type
,int channel
,int param1
,int param2
); void swami_midi_event_note_on (SwamiMidiEvent *event
,int channel
,int note
,int velocity
); void swami_midi_event_note_off (SwamiMidiEvent *event
,int channel
,int note
,int velocity
); void swami_midi_event_bank_select (SwamiMidiEvent *event
,int channel
,int bank
); void swami_midi_event_program_change (SwamiMidiEvent *event
,int channel
,int program
); void swami_midi_event_bend_range (SwamiMidiEvent *event
,int channel
,int cents
); void swami_midi_event_pitch_bend (SwamiMidiEvent *event
,int channel
,int value
); void swami_midi_event_control (SwamiMidiEvent *event
,int channel
,int ctrlnum
,int value
); void swami_midi_event_control14 (SwamiMidiEvent *event
,int channel
,int ctrlnum
,int value
); void swami_midi_event_rpn (SwamiMidiEvent *event
,int channel
,int paramnum
,int value
); void swami_midi_event_nrpn (SwamiMidiEvent *event
,int channel
,int paramnum
,int value
);
typedef struct { SwamiMidiEventType type; int channel; /* most events send on a specific MIDI channel */ union { SwamiMidiEventNote note; SwamiMidiEventControl control; } data; } SwamiMidiEvent;
typedef struct { guint8 note; guint8 velocity; /* _NOTE_ON, _NOTE_OFF, _KEY_PRESSURE, or _NOTE events */ guint8 off_velocity; /* _NOTE event only */ guint8 unused; guint duration; /* for SWAMI_MIDI_NOTE event only */ } SwamiMidiEventNote;
typedef struct { guint param; /* control number */ int value; /* control value */ } SwamiMidiEventControl;
typedef enum { SWAMI_MIDI_NONE, /* NULL event */ SWAMI_MIDI_NOTE, /* a note interval (Note) */ SWAMI_MIDI_NOTE_ON, /* note on event (Note) */ SWAMI_MIDI_NOTE_OFF, /* note off event (Note) */ SWAMI_MIDI_KEY_PRESSURE, /* key pressure (Note) */ SWAMI_MIDI_PITCH_BEND, /* pitch bend event -8192 - 8191 (Control) */ SWAMI_MIDI_PROGRAM_CHANGE, /* program change (Control) */ SWAMI_MIDI_CONTROL, /* 7 bit controller (Control) */ SWAMI_MIDI_CONTROL14, /* 14 bit controller (Control) */ SWAMI_MIDI_CHAN_PRESSURE, /* channel pressure (Control) */ SWAMI_MIDI_RPN, /* registered param (Control) */ SWAMI_MIDI_NRPN, /* non registered param (Control) */ /* these are used as a convenience for swami_midi_event_set() but they should not appear in the event type field, they are handled by other events above */ SWAMI_MIDI_BEND_RANGE, SWAMI_MIDI_BANK_SELECT } SwamiMidiEventType;
SwamiMidiEvent * swami_midi_event_new (void
);
Create a new MIDI event structure.
Returns : |
New MIDI event structure. Free it with swami_midi_event_free()
when finished.
|
void swami_midi_event_free (SwamiMidiEvent *event
);
Free a MIDI event previously allocated by swami_midi_event_new()
.
|
MIDI event structure to free |
SwamiMidiEvent * swami_midi_event_copy (SwamiMidiEvent *event
);
Duplicate a MIDI event structure.
|
MIDI event structure to duplicate |
Returns : |
New duplicate MIDI event. Free it with swami_midi_event_free()
when finished.
|
void swami_midi_event_set (SwamiMidiEvent *event
,SwamiMidiEventType type
,int channel
,int param1
,int param2
);
A single entry point for all event types if one does not care to use the event type specific functions.
|
MIDI event structure |
|
Type of event to assign |
|
MIDI channel to send to |
|
First parameter of event type
|
|
Second parameter of event type (only for some types)
|
void swami_midi_event_note_on (SwamiMidiEvent *event
,int channel
,int note
,int velocity
);
Make a MIDI event structure a note on event.
|
MIDI event structure |
|
MIDI channel to send note on event to |
|
MIDI note number |
|
MIDI note velocity |
void swami_midi_event_note_off (SwamiMidiEvent *event
,int channel
,int note
,int velocity
);
Make a MIDI event structure a note off event.
|
MIDI event structure |
|
MIDI channel to send note off event to |
|
MIDI note number |
|
MIDI note velocity |
void swami_midi_event_bank_select (SwamiMidiEvent *event
,int channel
,int bank
);
Make a MIDI event structure a bank select event. A convenience function since a bank select is just a controller event, and is sent as such.
|
MIDI event structure |
|
MIDI channel to send bank select to |
|
Bank number to change to |
void swami_midi_event_program_change (SwamiMidiEvent *event
,int channel
,int program
);
Set a MIDI event structure to a program change event.
|
MIDI event structure |
|
MIDI channel to send program change to |
|
Program number to change to |
void swami_midi_event_bend_range (SwamiMidiEvent *event
,int channel
,int cents
);
Make a MIDI event structure a bend range event. A convenience since one
could also use the swami_midi_event_rpn()
function.
|
MIDI event structure |
|
MIDI channel to send event to |
|
Bend range in cents (100th of a semitone) |
void swami_midi_event_pitch_bend (SwamiMidiEvent *event
,int channel
,int value
);
Make a MIDI event structure a pitch bend event.
|
MIDI event structure |
|
MIDI channel to send event to |
|
MIDI pitch bend value (-8192 - 8191, 0 = center) |
void swami_midi_event_control (SwamiMidiEvent *event
,int channel
,int ctrlnum
,int value
);
Make a MIDI event structure a 7 bit controller event.
|
MIDI event structure |
|
MIDI channel to send event on |
|
Control number |
|
7 bit value to set control to |
void swami_midi_event_control14 (SwamiMidiEvent *event
,int channel
,int ctrlnum
,int value
);
Make a MIDI event structure a 14 bit controller event. The ctrlnum should be one of the first 32 MIDI controllers that have MSB and LSB controllers for sending 14 bit values. Either the MSB or LSB controller number may be used (example: either 0 or 32 can be used for setting 14 bit bank number). Internally the MSB controller numbers are used (0-31).
|
MIDI event structure |
|
MIDI channel to send event on |
|
Control number |
|
14 bit value to set control to |
void swami_midi_event_rpn (SwamiMidiEvent *event
,int channel
,int paramnum
,int value
);
Make a MIDI event structure a RPN (registered parameter number) event.
|
MIDI event structure |
|
MIDI channel to send event to |
|
RPN parameter number |
|
14 bit value to set parameter to |
void swami_midi_event_nrpn (SwamiMidiEvent *event
,int channel
,int paramnum
,int value
);
Make a MIDI event structure a NRPN (non-registered parameter number) event.
|
MIDI event structure |
|
MIDI channel to send event to |
|
NRPN parameter number |
|
14 bit value to set parameter to |