Copyright © 2005-2019 MultiMedia Soft

MIDI.StreamEventsListItemAdd method

Previous pageReturn to chapter overviewNext page

Remarks

 

Adds a specific single MIDI event to the list of MIDI events that will be applied to the loaded MIDI stream in one single shot through a call to the MIDI.StreamEventsListApply method.

 

The call to this method generates a unique identifier for the specific MIDI event added to the list, allowing to perform removal or modifications of the MIDI event at a later time using the provided methods MIDI StreamEventsListItemRemove, MIDI.StreamEventsListItemGet. and MIDI.StreamEventsListItemModify.

 

The total number of MIDI events added to the list can be obtained through the MIDI.StreamEventsListItemCountGet method and, for each MIDI event, you can obtain the specific unique identifier through the MIDI.StreamEventsListItemUniqueIdGet method.

 

For further details about the use of MIDI protocol see the MIDIMan class section and the How to deal with MIDI protocol tutorial.

 

 

Syntax

 

[Visual Basic]

Public Function StreamEventsListItemAdd (

nPlayerIndex as Int16,

nMidiEvent as enumMidiStreamEvents,

nMidiParam1 as Int16,

nMidiParam2 as Int16,

nMidiChannel as Int16

) as Int32


 

[C#]

public Int32 StreamEventsListItemAdd (

Int16 nPlayerIndex,

enumMidiStreamEvents nMidiEvent,

Int16 nMidiParam1,

Int16 nMidiParam2,

Int16 nMidiChannel

);


 

[C++]

public: Int32 StreamEventsListItemAdd (

Int16 nPlayerIndex,

enumMidiStreamEvents nMidiEvent,

Int16 nMidiParam1,

Int16 nMidiParam2,

Int16 nMidiChannel

);


 

 

 

Parameter

Description

 

 

nPlayerIndex

Number representing the zero-based index of the involved player

nMidiEvent

MIDI event to add to the list.

Supported values, with related parameters, are the following:

Mnemonic constant

Value

Meaning

MIDI_EVENT_NOTE

1

Presses or releases a key note.

nMidiParam1: the key number from 0 to 127; 60 means middle C

nMidiParam2: velocity; 0 means key released while values from 1 to 127 mean pressure

MIDI_EVENT_PROGRAM

2

Modifies a preset or instrument.

nMidiParam1: the preset program number from 0 to 127

nMidiParam2: not used

MIDI_EVENT_CHANPRES

3

Modifies the channel pressure.

nMidiParam1: the pressure level from 0 to 127

nMidiParam2: not used

MIDI_EVENT_PITCH

4

Modifies the pitch wheel position.

nMidiParam1: the pitch wheel position; can range from 0 to 16383

nMidiParam2: not used

MIDI_EVENT_PITCHRANGE

5

Modifies the pitch wheel range (MIDI RPN 0).

nMidiParam1: the pitch wheel range

nMidiParam2: not used

MIDI_EVENT_DRUMS

6

Switches between melody channels and the rhythm (drums) channel.

nMidiParam1: if set to 0 melody channels are used, if set to 1 the rhythm channel is used.

nMidiParam2: not used

MIDI_EVENT_FINETUNE

7

Sets the fine tuning (MIDI RPN 1).

nMidiParam1: fine tuning in cents, can range from 0 to 16383. 0 means a fine tuning of -100, 8192 means normal while 16383 means a fine tuning of +100.

nMidiParam2: not used

MIDI_EVENT_COARSETUNE

8

Sets the coarse tuning (MIDI RPN 2).

nMidiParam1: coarse tuning in semitones, can range from 0 to 127. 0 means a tuning of -64, 64 means normal while 127 means a fine tuning of +63.

nMidiParam2: not used

MIDI_EVENT_MASTERVOL

9

Sets the master volume.

nMidiParam1: can range from 0 to 16383 where 0 means silence and 16383 means max volume.

nMidiParam2: not used

MIDI_EVENT_BANK

10

Selects the bank to use (MIDI controller 0).

nMidiParam1: the bank number from 0 to 127

nMidiParam2: not used

MIDI_EVENT_MODULATION

11

Sets the modulation (MIDI controller 1).

nMidiParam1: the modulation level from 0 to 127

nMidiParam2: not used

MIDI_EVENT_VOLUME

12

Sets the volume (MIDI controller 7).

nMidiParam1: the volume level from 0 to 127

nMidiParam2: not used

MIDI_EVENT_PAN

13

Sets the pan position (MIDI controller 10).

nMidiParam1: the pan position from 0 to 128. 0 means left, 64 means  middle, 127 means right while 128 sets a random position.

nMidiParam2: not used

MIDI_EVENT_EXPRESSION

14

Sets the expression level (MIDI controller 11).

nMidiParam1: the expression level from 0 to 127

nMidiParam2: not used

MIDI_EVENT_SUSTAIN

15

Sets the sustain pedal or switch (MIDI controller 64).

nMidiParam1: from 0 to 63 the sustain is off while from 64 to 127 the sustain is on.

nMidiParam2: not used

MIDI_EVENT_SOUNDOFF

16

Stops all sounds (MIDI controller 120).

nMidiParam1: not used

nMidiParam2: not used

MIDI_EVENT_RESET

17

Reset controllers to their default values (MIDI controller 121).

nMidiParam1: not used

nMidiParam2: not used

MIDI_EVENT_NOTESOFF

18

Releases all key notes (MIDI controller 123).

nMidiParam1: not used

nMidiParam2: not used

MIDI_EVENT_PORTAMENTO

19

Sets the portamento switch (MIDI controller 65).

nMidiParam1: from 0 to 63 the portamento is off while from 64 to 127 the portamento is on.

nMidiParam2: not used

MIDI_EVENT_PORTATIME

20

Sets the portamento time (MIDI controller 5).

nMidiParam1: the portamento time from 0 to 127

nMidiParam2: not used

MIDI_EVENT_PORTANOTE

21

Sets the portamento start key (MIDI controller 84).

nMidiParam1: the key number from 1 to 127; 60 means middle C

nMidiParam2: not used

MIDI_EVENT_MODE

22

Switches between poly and mono modes (MIDI controllers 126 and 127)

nMidiParam1: 0 means poly while 1 means mono

nMidiParam2: not used

MIDI_EVENT_REVERB

23

Sets the reverb level (MIDI controller 91).

nMidiParam1: the reverb level from 0 to 127

nMidiParam2: not used

MIDI_EVENT_CHORUS

24

Sets the chorus level (MIDI controller 93).

nMidiParam1: the chorus level from 0 to 127

nMidiParam2: not used

MIDI_EVENT_CUTOFF

25

Sets the cutoff of the low-pass filter (MIDI controller 74, NRPN 120h).

nMidiParam1: cutoff level, can range from 0 to 127. 0 means a level of -64, 64 means normal while 127 means a level of +63.

nMidiParam2: not used

MIDI_EVENT_RESONANCE

26

Sets the resonance of the low-pass filter (MIDI controller 71, NRPN 121h).

nMidiParam1: resonance level, can range from 0 to 127. 0 means a level of -64, 64 means normal while 127 means a level of +63.

nMidiParam2: not used

MIDI_EVENT_RELEASE

27

Sets the release time (MIDI controller 72, NRPN 166h).

nMidiParam1: release time, can range from 0 to 127. 0 means a time of -64, 64 means normal while 127 means a time of +63.

nMidiParam2: not used

MIDI_EVENT_ATTACK

28

Sets the attack time (MIDI controller 73, NRPN 163h).

nMidiParam1: attack time, can range from 0 to 127. 0 means a time of -64, 64 means normal while 127 means a time of +63.

nMidiParam2: not used

MIDI_EVENT_REVERB_TIME

32

Sets the reverb time.

nMidiParam1: reverb time in milliseconds.

nMidiParam2: not used

MIDI_EVENT_REVERB_DELAY

33

Sets the reverb delay.

nMidiParam1: reverb delay in 10ths of millisecond.

nMidiParam2: not used

MIDI_EVENT_REVERB_LOCUTOFF

34

Sets the cutoff of the reverb low-pass filter.

nMidiParam1: cutoff in Hertz; 0 means no cutoff.

nMidiParam2: not used

MIDI_EVENT_REVERB_HIGCUTOFF

35

Sets the cutoff of the reverb high-pass filter.

nMidiParam1: cutoff in Hertz; 0 means no cutoff.

nMidiParam2: not used

MIDI_EVENT_REVERB_LEVEL

36

Sets the reverb level.

nMidiParam1: reverb level; 0 means no reverb, 100 applies a 0 dB level, 200 applies a +6 dB level.

nMidiParam2: not used

MIDI_EVENT_CHORUS_DELAY

37

Sets the chorus delay.

nMidiParam1: chorus delay in 10ths of millisecond.

nMidiParam2: not used

MIDI_EVENT_CHORUS_DEPTH

38

Sets the chorus depth.

nMidiParam1: chorus depth in 10ths of millisecond.

nMidiParam2: not used

MIDI_EVENT_CHORUS_RATE

39

Sets the chorus rate.

nMidiParam1: chorus in 100ths of Hertz.

nMidiParam2: not used

MIDI_EVENT_CHORUS_FEEDBACK

40

Sets the level of the chorus feedback..

nMidiParam1: the chorus feedback level, can range from 0 to 200. 0 means -100%, 100 means that feedback is off while 200 means +100%.

nMidiParam2: not used

MIDI_EVENT_CHORUS_LEVEL

41

Sets the chorus level.

nMidiParam1: chorus level; 0 means no chorus, 100 applies a 0 dB level, 200 applies a +6 dB level.

nMidiParam2: not used

MIDI_EVENT_CHORUS_REVERB

42

Sets the chorus reverb level.

nMidiParam1: chorus reverb level; 0 means no chorus reverb, 100 applies a 0 dB level, 200 applies a +6 dB level.

nMidiParam2: not used

MIDI_EVENT_DRUM_FINETUNE

50

Sets the fine tuning of a drum key (MIDI NRPN 19knh).

nMidiParam1: the key number from 0 to 127; 60 means middle C

nMidiParam2: fine tune in cents, can range from 0 to 127. 0 means -100, 64 means normal while 127 means +100.

MIDI_EVENT_DRUM_COARSETUNE

51

Sets the coarse tuning of a drum key (MIDI NRPN 18knh).

nMidiParam1: the key number from 0 to 127; 60 means middle C

nMidiParam2: coarse tuning in semitones, can range from 0 to 127. 0 means a tuning of -64, 64 means normal while 127 means a fine tuning of +63.

MIDI_EVENT_DRUM_PAN

52

Sets the pan position of a drum key (MIDI NRPN 1Cknh).

nMidiParam1: the key number from 0 to 127; 60 means middle C

nMidiParam2: the pan position from 0 to 127. 0 means left, 64 means  middle while 127 means right. .

MIDI_EVENT_DRUM_REVERB

53

Sets the reverb level of a drum key (MIDI NRPN 1Dknh).

nMidiParam1: the key number from 0 to 127; 60 means middle C

nMidiParam2: the reverb level from 0 to 128.

MIDI_EVENT_DRUM_CHORUS

54

Sets the chorus level of a drum key (MIDI NRPN 1Eknh)

nMidiParam1: the key number from 0 to 127; 60 means middle C

nMidiParam2: the chorus level from 0 to 128.

MIDI_EVENT_DRUM_CUTOFF

55

Sets the cutoff of the low-pass filter of a drum key (MIDI NRPN 14knh).

nMidiParam1: the key number from 0 to 127; 60 means middle C

nMidiParam2: cutoff level from 0 to 127

MIDI_EVENT_DRUM_RESONANCE

56

Sets the resonance of the low-pass filter of a drum key (MIDI NRPN 15knh).

nMidiParam1: the key number from 0 to 127; 60 means middle C

nMidiParam2: resonance level from 0 to 127

MIDI_EVENT_DRUM_LEVEL

57

Sets the level of a drum key (MIDI NRPN 1Aknh).

nMidiParam1: the key number from 0 to 127; 60 means middle C

nMidiParam2: level from 0 to 127; 127 means full level.

MIDI_EVENT_SOFT

60

Sets the soft pedal or switch (MIDI controller 67).

nMidiParam1: from 0 to 63 the soft pedal is off while from 64 to 127 the soft pedal is on.

nMidiParam2: not used

MIDI_EVENT_SYSTEM

61

Sets the system mode, resetting everything to the system's defaults.

nMidiParam1: type of system mode, can assume the following values:

0 = System default

1 = General MIDI 1

2 = General MIDI 2

3 = Yamaha XG

4 = Roland GS

nMidiParam2: not used

MIDI_EVENT_TEMPO

62

Sets the tempo (MIDI meta event 81).

nMidiParam1: tempo in microseconds per quarter note.

nMidiParam2: not used

MIDI_EVENT_SCALETUNING

63

Sets the tuning of a note in every octave.

nMidiParam1: tuning change in cents, can range from 0 to 16383. 0 means a tuning of -100, 8192 means normal while 16383 means a tuning of +100.

nMidiParam2: note; can range from 0 to 11 where 0 is note C

MIDI_EVENT_CONTROL

64

Unhandled controller. This has no effect on the MIDI stream, but can be useful for custom processing purposes with the MidiStreamEventNotification event.

MIDI_EVENT_CHANPRES_VIBRATO

65

Sets the maximum effect of channel pressure on vibrato depth.

nMidiParam1: vibrato depth effect in cents (0=none, 128=100, 256=200, etc).

nMidiParam2: not used

MIDI_EVENT_CHANPRES_PITCH

66

Sets the maximum effect of channel pressure on pitch.

nMidiParam1: pitch effect in semitones (0=-24, 24=none, 48=+24). .

nMidiParam2: not used

MIDI_EVENT_CHANPRES_FILTER

67

Sets the maximum effect of channel pressure on filter cutoff.

nMidiParam1: filter cutoff effect in cents (0=-9600, 9600=none, 19200=+9600).

nMidiParam2: not used

MIDI_EVENT_CHANPRES_VOLUME

68

Sets the maximum effect of channel pressure on volume.

nMidiParam1: volume effect percentage (0=-100, 100=none, 200=+100).

nMidiParam2: not used

MIDI_EVENT_MODRANGE

69

Sets the modulation/vibrato depth range (MIDI RPN 5).

nMidiParam1: vibrato depth in cents (128=100, 256=200, etc).

nMidiParam2: not used

MIDI_EVENT_BANK_LSB

70

Selects the bank LSB to use (MIDI controller 32).

nMidiParam1: bank number LSB (0-127).

nMidiParam2: not used

MIDI_EVENT_MIX_VOLUME_LEVEL

Hex 10000

Sets the volume level at mixing time, meaning that the level will not be affected by eventual MIDI_EVENT_VOLUME events inside a MIDI file.

nMidiParam1: volume level; 0 means silence, 100 applies a 0 dB level, 200 applies a +6 dB level.

nMidiParam2: not used

MIDI_EVENT_TRANSPOSE

Hex 10001

Transposes all notes.

nMidiParam1: amount of transposition in semitones, can range from 0 to 200. 0 means -100, 100 means normal while 200 means +100.

nMidiParam2: not used

MIDI_EVENT_SYSTEMEX

Hex 10002

Sets the system mode, resetting everything to the system's defaults including MIDI channels allocated through the MIDI.ChannelsSet method.

nMidiParam1: type of system mode, can assume the following values:

0 = System default

1 = General MIDI 1

2 = General MIDI 2

3 = Yamaha XG

4 = Roland GS

nMidiParam2: not used

nMidiParam1

Number representing the first parameter related to the event (see the MIDI events table above for details)

nMidiParam2

Number representing the second parameter related to the event (see the MIDI events table above for details)

nMidiChannel

The MIDI channel on which the event is applied. The current number of channels can be retrieved through a call to the MIDI.ChannelsGet method.

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred, check the LastError property value in order to get the error code

Value > 0

The method call was successful and the returned value is the unique identifier of the event.