The Midi Kit: BMidiText

The Midi Kit Table of Contents | The Midi Kit Index

# BMidiText

Derived from: public BMidi

Declared in: be/midi/MidiText.h

Library: libmidi.so

###### Summary

A BMidiText object prints, on standard output, a text description of each MIDI message it receives. You use BMidiText objects to debug and monitor your application; it has no other purpose.

To use a BMidiText object, you construct it and connect it to some other BMidi object as shown below:

       BMidiText midiText;

       otherMidiObj.Connect(midiText);
       otherMidiObj.Start();

BMidiText's output (the text it displays) is timed: When it receives a MIDI message that's timestamped for the future, the object waits until that time has come before it displays its message. While it's waiting, the object won't process any other in-coming messages. Because of this, you shouldn't connect the same BMidiText object to more than one BMidi object. To monitor two or more MIDI-producing objects, you should connect a separate BMidiText object to each.

The text that's displayed by a BMidiText follows this general format:

timestamp: MESSAGE TYPE; message data

(Message-specific formats are given in the section "Output Text" on page40.) Of particular note is the timestamp field. Its value is the number of milliseconds that have elapsed since the object received its first message. The time value is computed through the use of an internal timer; to reset this timer—a useful thing to do between performances, for example—you call the `ResetTimer()` function.

The BMidiText class doesn't generate or spray MIDI messages, so the performance and connection functions that it inherits from BMidi have no effect.

## Constructor and Destructor

### BMidiText() , ~BMidiText()

`BMidiText(`void`) `
`virtual ~BMidiText() `

The constructor creates a new BMidiText object. The object's timer is set to zero and doesn't start ticking until the first message is received. To force the timer to start, call `ResetTimer(true)`.

The destructor destroys the object.

## Member Functions

### ResetTimer()

void `ResetTimer``(`bool start = false`) `

Sets the object's internal timer to zero. If start is `false` the timer doesn't start ticking until the next MIDI message is received. If start is `true`, the timer begins immediately.

The timer value is used to compute the timestamp that's displayed at the beginning of each message description.

## Output Text

The text strings that a BMidiText object displays are shown below, listed by MIDI event

### Channel Pressure

timestamp: CHANNEL PRESSURE; channel = channel, pressure = pressure

### Control Change

timestamp: CONTROL CHANGE; channel = channel, control = ctrl_num,
value = ctrl_value

### Key Pressure

timestamp: KEY PRESSURE; channel = channel, note = note, pressure = pressure

### Note Off

timestamp: NOTE OFF; channel = channel, note = note, velocity = velocity

### Note On

timestamp: NOTE ON; channel = channel, note = note, velocity = velocity

### Pitch Bend

timestamp: PITCH BEND; channel = channel, lsb = lsb, msb = msb

### Program Change

timestamp: PROGRAM CHANGE; channel = channel, program = program_num

### System Common

timestamp: SYSTEM COMMON; status = status, data1 = data1, data2= data2

### System Exclusive

timestamp: SYSTEM EXCLUSIVE;

Followed by the data itself (in hex, byte-by-byte), starting on the next line.

### SystemRealTime()

timestamp: SYSTEM REAL TIME; status = status

The Midi Kit Table of Contents | The Midi Kit Index

The Be Book,
...in lovely HTML...
for BeOS Release 5.

Copyright © 2000 Be, Inc. All rights reserved..