BASS.NET API for the Un4seen BASS Audio Library

MidiShortMessageGetPairedData Method

BASS.NET API for the Un4seen BASS Audio Library
Returns a combined paired value from a MSB and a LSB data byte.

Namespace:  radio42.Multimedia.Midi
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

public static short GetPairedData(
	byte dataMSB,
	byte dataLSB
)

Parameters

dataMSB
Type: SystemByte
The MSB (most significant) data byte value.
dataLSB
Type: SystemByte
The LSB (least significant) data byte value.

Return Value

Type: Int16
The combined data value ranging from 0 to 16383 (128*128 values).
Remarks

The dataLSB byte will contain the lower 7-bit value (single steps) and the dataMSB byte the upper 7-bit value (128th steps) both ranging from 0 to 128.

Some Midi data messages might actually use two sub-sequent short messages to construct a paired message representing a single value range (e.g. the ControlChange with a BankSelect). This to support paired values with a higher resolution (16384 instead of 128 values). The same might apply the the controller value itself. In such case two short messages will be send, where one contains the LSB value (single steps) in it's Data2 or Data1 byte and the other message contains the MSB value (128th steps) in it's Data2 or Data1 byte. Typically the messages with a StatusType of ControlChange and with a Controller value between 0 and 31 (MSB) are paired with a message of a Controller value between 32 and 63 (LSB). But also a Controller value of 98 (LSB) will be paired with a Controller value of 99 (MSB) as well as a Controller value of 100 (LSB) will be paired with a Controller value of 101 (MSB). Other pairs might be hardware specific.

So it might be useful to keep in your MIDIINPROC handler always the current and the last message.

The resulting combined data value will be constructed like this: dataMSB=0xxxxxxx, dataLSB=0yyyyyyy = paired=00xxxxxxxyyyyyyy.

You might also use the GetPairedData1(MidiShortMessage, MidiShortMessage) resp. the GetPairedData2(MidiShortMessage, MidiShortMessage) method to retrieve a combined value from two short messages resp. two data value.

See Also

Reference