SwamiMidiEvent

SwamiMidiEvent

Synopsis

                    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);

Description

Details

SwamiMidiEvent

typedef struct {
  SwamiMidiEventType type;
  int channel;	     /* most events send on a specific MIDI channel */

  union
  {
    SwamiMidiEventNote note;
    SwamiMidiEventControl control;
  } data;
} SwamiMidiEvent;

SwamiMidiEventNote

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;

SwamiMidiEventControl

typedef struct {
  guint param;			/* control number */
  int value;			/* control value */
} SwamiMidiEventControl;

SWAMI_TYPE_MIDI_EVENT

#define SWAMI_TYPE_MIDI_EVENT   (swami_midi_event_get_type ())

enum SwamiMidiEventType

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;

SWAMI_MIDI_CC_BANK_MSB

#define SWAMI_MIDI_CC_BANK_MSB		0

SWAMI_MIDI_CC_MODULATION

#define SWAMI_MIDI_CC_MODULATION 1

SWAMI_MIDI_CC_VOLUME

#define SWAMI_MIDI_CC_VOLUME		7

SWAMI_MIDI_CC_PAN

#define SWAMI_MIDI_CC_PAN		10

SWAMI_MIDI_CC_EXPRESSION

#define SWAMI_MIDI_CC_EXPRESSION 11

SWAMI_MIDI_CC_BANK_LSB

#define SWAMI_MIDI_CC_BANK_LSB		32

SWAMI_MIDI_CC_SUSTAIN

#define SWAMI_MIDI_CC_SUSTAIN		64

SWAMI_MIDI_CC_REVERB

#define SWAMI_MIDI_CC_REVERB		91

SWAMI_MIDI_CC_CHORUS

#define SWAMI_MIDI_CC_CHORUS		93

SWAMI_MIDI_RPN_BEND_RANGE

#define SWAMI_MIDI_RPN_BEND_RANGE 0

SWAMI_MIDI_RPN_MASTER_TUNE

#define SWAMI_MIDI_RPN_MASTER_TUNE 1

swami_midi_event_get_type ()

GType               swami_midi_event_get_type           (void);

swami_midi_event_new ()

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.

swami_midi_event_free ()

void                swami_midi_event_free               (SwamiMidiEvent *event);

Free a MIDI event previously allocated by swami_midi_event_new().

event :

MIDI event structure to free

swami_midi_event_copy ()

SwamiMidiEvent *    swami_midi_event_copy               (SwamiMidiEvent *event);

Duplicate a MIDI event structure.

event :

MIDI event structure to duplicate

Returns :

New duplicate MIDI event. Free it with swami_midi_event_free() when finished.

swami_midi_event_set ()

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.

event :

MIDI event structure

type :

Type of event to assign

channel :

MIDI channel to send to

param1 :

First parameter of event type

param2 :

Second parameter of event type (only for some types)

swami_midi_event_note_on ()

void                swami_midi_event_note_on            (SwamiMidiEvent *event,
                                                         int channel,
                                                         int note,
                                                         int velocity);

Make a MIDI event structure a note on event.

event :

MIDI event structure

channel :

MIDI channel to send note on event to

note :

MIDI note number

velocity :

MIDI note velocity

swami_midi_event_note_off ()

void                swami_midi_event_note_off           (SwamiMidiEvent *event,
                                                         int channel,
                                                         int note,
                                                         int velocity);

Make a MIDI event structure a note off event.

event :

MIDI event structure

channel :

MIDI channel to send note off event to

note :

MIDI note number

velocity :

MIDI note velocity

swami_midi_event_bank_select ()

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.

event :

MIDI event structure

channel :

MIDI channel to send bank select to

bank :

Bank number to change to

swami_midi_event_program_change ()

void                swami_midi_event_program_change     (SwamiMidiEvent *event,
                                                         int channel,
                                                         int program);

Set a MIDI event structure to a program change event.

event :

MIDI event structure

channel :

MIDI channel to send program change to

program :

Program number to change to

swami_midi_event_bend_range ()

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.

event :

MIDI event structure

channel :

MIDI channel to send event to

cents :

Bend range in cents (100th of a semitone)

swami_midi_event_pitch_bend ()

void                swami_midi_event_pitch_bend         (SwamiMidiEvent *event,
                                                         int channel,
                                                         int value);

Make a MIDI event structure a pitch bend event.

event :

MIDI event structure

channel :

MIDI channel to send event to

value :

MIDI pitch bend value (-8192 - 8191, 0 = center)

swami_midi_event_control ()

void                swami_midi_event_control            (SwamiMidiEvent *event,
                                                         int channel,
                                                         int ctrlnum,
                                                         int value);

Make a MIDI event structure a 7 bit controller event.

event :

MIDI event structure

channel :

MIDI channel to send event on

ctrlnum :

Control number

value :

7 bit value to set control to

swami_midi_event_control14 ()

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).

event :

MIDI event structure

channel :

MIDI channel to send event on

ctrlnum :

Control number

value :

14 bit value to set control to

swami_midi_event_rpn ()

void                swami_midi_event_rpn                (SwamiMidiEvent *event,
                                                         int channel,
                                                         int paramnum,
                                                         int value);

Make a MIDI event structure a RPN (registered parameter number) event.

event :

MIDI event structure

channel :

MIDI channel to send event to

paramnum :

RPN parameter number

value :

14 bit value to set parameter to

swami_midi_event_nrpn ()

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.

event :

MIDI event structure

channel :

MIDI channel to send event to

paramnum :

NRPN parameter number

value :

14 bit value to set parameter to