wxMidi - A MIDI interface based on PortMidi
wxMidi.h File Reference

The only header file for wxMidi. More...

#include "wx/wxprec.h"
#include "wx/wx.h"
#include "portmidi.h"
#include "porttime.h"
#include <time.h>

Go to the source code of this file.

Classes

class  wxMidiMessage
 Abstract class representing a MIDI message. More...
 
class  wxMidiShortMessage
 wxMidiShortMessage represents a MIDI short message. More...
 
class  wxMidiSysExMessage
 Represents a system-exclusive MIDI message. More...
 
class  wxMidiDevice
 Abstract class representing a MIDI device. More...
 
class  wxMidiOutDevice
 Represents a MIDI stream on which MIDI data traffic can be sent. More...
 
class  wxMidiInDevice
 Represents a MIDI stream on which MIDI data traffic can be read. More...
 
class  wxMidiDatabaseGM
 A database for Midi GM (General MIDI Standard) instruments. More...
 
class  wxMidiSystem
 Class wxMidiSystem is the entry point to the wxMidi library. More...
 
class  wxMidiThread
 Helper class for internal use. More...
 

Macros

#define __WXMIDI_H__
 
#define wxMIDI_VERSION   _T("2.0")
 Constants related to wxMidi version.
 
#define wxMIDI_MAJOR   2
 
#define wxMIDI_MINOR   0
 
#define wxMidiDeviceID   PmDeviceID
 Rename some data types inherited from portmidi.
 
#define wxMidiTimestamp   PmTimestamp
 
#define wxMidiPmMessage   PmMessage
 
#define wxMidiPmEvent   PmEvent
 
#define wxMIDI_CHANNEL(channel)   (1<<(channel))
 
#define PopulateWithPercussionInstr   PopulateWithPercusionInstr
 Fix spelling error without changing the API, for backwards compatibility.
 

Enumerations

enum  wxMidiError {
  wxMIDI_NO_ERROR = 0, wxMIDI_ERROR_HostError = -10000, wxMIDI_ERROR_InvalidDeviceId, wxMIDI_ERROR_InsufficientMemory,
  wxMIDI_ERROR_BufferTooSmall, wxMIDI_ERROR_BufferOverflow, wxMIDI_ERROR_BadPtr, wxMIDI_ERROR_BadData,
  wxMIDI_ERROR_InternalError, wxMIDI_ERROR_BufferMaxSize, wxMIDI_ERROR_AlreadyListening = -10100, wxMIDI_ERROR_CreateThread,
  wxMIDI_ERROR_StartThread, wxMIDI_ERROR_BadSysExMsg_Start, wxMIDI_ERROR_NoDataAvailable, wxMIDI_ERROR_TimeOut
}
 Error codes from portmidi and additional errors from wxMidi. More...
 
enum  wxMidiFilter {
  wxMIDI_NO_FILTER = 0x00, wxMIDI_FILT_ACTIVE = PM_FILT_ACTIVE, wxMIDI_FILT_SYSEX = PM_FILT_SYSEX, wxMIDI_FILT_CLOCK = PM_FILT_CLOCK,
  wxMIDI_FILT_PLAY = PM_FILT_PLAY, wxMIDI_FILT_TICK = PM_FILT_TICK, wxMIDI_FILT_FD = PM_FILT_FD, wxMIDI_FILT_UNDEFINED = PM_FILT_UNDEFINED,
  wxMIDI_FILT_RESET = PM_FILT_RESET, wxMIDI_FILT_REALTIME = PM_FILT_REALTIME, wxMIDI_FILT_NOTE = PM_FILT_NOTE, wxMIDI_FILT_CHANNEL_AFTERTOUCH = PM_FILT_CHANNEL_AFTERTOUCH,
  wxMIDI_FILT_POLY_AFTERTOUCH = PM_FILT_POLY_AFTERTOUCH, wxMIDI_FILT_AFTERTOUCH = PM_FILT_AFTERTOUCH, wxMIDI_FILT_PROGRAM = PM_FILT_PROGRAM, wxMIDI_FILT_CONTROL = PM_FILT_CONTROL,
  wxMIDI_FILT_PITCHBEND = PM_FILT_PITCHBEND, wxMIDI_FILT_MTC = PM_FILT_MTC, wxMIDI_FILT_SONG_POSITION = PM_FILT_SONG_POSITION, wxMIDI_FILT_SONG_SELECT = PM_FILT_SONG_SELECT,
  wxMIDI_FILT_TUNE = PM_FILT_TUNE, wxMIDI_FILT_SYSTEMCOMMON = PM_FILT_SYSTEMCOMMON
}
 Filter codes, renamed from portmidi. More...
 
enum  wxMidiMsgType { wxMIDI_UNDEFINED_MSG = 0, wxMIDI_SHORT_MSG, wxMIDI_SYSEX_MSG }
 Identifies the MIDI message type. More...
 

Detailed Description

The only header file for wxMidi.

Macro Definition Documentation

◆ wxMIDI_CHANNEL

#define wxMIDI_CHANNEL (   channel)    (1<<(channel))

Macro to be used in method wxMidiInDevice::SetChannelMask(). This method requires a mask value that is a 16-bit bitfield with bits set to signal the appropriate channels. Macro wxMIDI_CHANNEL can assist in preparing this mask. For example, to set for receiving input only from channel 12, prepare the mask with

Multiple channels should be OR'd together, like

Enumeration Type Documentation

◆ wxMidiError

Error codes from portmidi and additional errors from wxMidi.

Enumerator
wxMIDI_ERROR_HostError 

No error.

The requested operation succedeed.

wxMIDI_ERROR_InvalidDeviceId 

Portmidi reported a host error.

You have to call wxMidiSystem::GetHostErrorText to get more details about the error.

wxMIDI_ERROR_InsufficientMemory 

Invalid device ID.

The ID is out of range (less than zero or greater or equal than the value returned by wxMidiSystem::CountDevices. Or it is an input device and it is being used to construct a wxMidiOutDevice, or viceversa. Or the device is already opened

wxMIDI_ERROR_BufferTooSmall 

Insufficient memory.

wxMIDI_ERROR_BufferOverflow 

PortMidi reports a 'Buffer too small' error.

You should close the device and reopen it specifying a greater buffersize value.

wxMIDI_ERROR_BadPtr 

PortMidi reported a 'Buffer overflow'.

You should close the device and reopen it specifying a greater buffersize value.

wxMIDI_ERROR_BadData 

PortMidi reports a `Bad pointer error'.

This should not happen as wxMidi deals with PmDevices inside objects wxMidiDevice, and so, user has no need to deal with pointers to PmDevices.

wxMIDI_ERROR_InternalError 

PortMidi reported an 'Invalid MIDI message Data' such as illegal MIDI data or a missing EOX.

wxMIDI_ERROR_BufferMaxSize 

Portmidi reported an 'Internal Error'.

Sorry, no more information.

wxMIDI_ERROR_AlreadyListening 

Portmidi informs that 'buffer is already as large as it can be'.

wxMIDI_ERROR_CreateThread 

Informative error.

A second call to method wxMidiInDevice::StartListening without previously calling method wxMidiInDevice::StopListening. The lisening thread is left active.

wxMIDI_ERROR_StartThread 

An error ocurred during a call to wxMidiInDevice::StartListening.

The error ocurred while trying to create the wxThread object.

wxMIDI_ERROR_BadSysExMsg_Start 

An error ocurred during a call to wxMidiInDevice::StartListening.

The error ocurred after successful creation of the wxThread object, while starting the thread execution.

wxMIDI_ERROR_NoDataAvailable 

The wxByte string received as parameter to create a wxMidiSysExMessage object does not start with 0xF0 (start-of-sysex status byte).

wxMIDI_ERROR_TimeOut 

You called method wxMidiInDevice::Read but there is no message waiting to be delivered.

You have to call Read method only after an wxEVT_MIDI_INPUT event takes place or after the method wxMidiInDevice::Poll reports that there is a message waiting.

◆ wxMidiFilter

Filter codes, renamed from portmidi.

Enumerator
wxMIDI_NO_FILTER 

No filter. All MIDI messages will be delivered to user application.

wxMIDI_FILT_ACTIVE 

Filter active sensing messages (0xFE).

wxMIDI_FILT_SYSEX 

Filter system exclusive messages (0xF0).

wxMIDI_FILT_CLOCK 

Filter real-time clock messages (0xF8 only, does not filter clock start, etc.).

wxMIDI_FILT_PLAY 

Filter play messages (start 0xFA, stop 0xFC, continue 0xFB).

wxMIDI_FILT_TICK 

Filter undefined 0xF9 messages (some equipment uses this as a 10ms 'tick').

wxMIDI_FILT_FD 

Filter undefined 0xFD messages.

wxMIDI_FILT_UNDEFINED 

Filter undefined real-time messages = (wxMIDI_FILT_F9 | wxMIDI_FILT_FD).

wxMIDI_FILT_RESET 

Filter reset messages (0xFF).

wxMIDI_FILT_REALTIME 

Filter all real-time messages.

Equivalent to (wxMIDI_FILT_ACTIVE | wxMIDI_FILT_SYSEX | wxMIDI_FILT_CLOCK | wxMIDI_FILT_PLAY | wxMIDI_FILT_UNDEFINED | wxMIDI_FILT_RESET).

wxMIDI_FILT_NOTE 

Filter note-on and note-off messages (0x90-0x9F and 0x80-0x8F).

wxMIDI_FILT_CHANNEL_AFTERTOUCH 

Filter channel aftertouch (most MIDI controllers use this) (0xD0-0xDF).

wxMIDI_FILT_POLY_AFTERTOUCH 

Filter per-note aftertouch messages (Ensoniq holds a patent on generating these messages on keyboards until June 2006) (0xA0-0xAF).

wxMIDI_FILT_AFTERTOUCH 

Filter both channel and poly aftertouch.

Equivalent to (wxMIDI_FILT_CHANNEL_AFTERTOUCH | wxMIDI_FILT_POLY_AFTERTOUCH)

wxMIDI_FILT_PROGRAM 

Filter Program change messages (0xC0-0xCF).

wxMIDI_FILT_CONTROL 

Filter Control Change messages (0xB0-0xBF).

wxMIDI_FILT_PITCHBEND 

Filetr Pitch Bender messages (0xE0-0xEF).

wxMIDI_FILT_MTC 

Filter MIDI Time Code messages (0xF1).

wxMIDI_FILT_SONG_POSITION 

Filter Song Position messages (0xF2).

wxMIDI_FILT_SONG_SELECT 

Filter Song Select messages (0xF3).

wxMIDI_FILT_TUNE 

Filter Tuning request messages (0xF6).

wxMIDI_FILT_SYSTEMCOMMON 

Filter all System Common messages (MTC, song position, song select, tune request).

Equivalent to (wxMIDI_FILT_MTC | wxMIDI_FILT_SONG_POSITION | wxMIDI_FILT_SONG_SELECT | wxMIDI_FILT_TUNE).

◆ wxMidiMsgType

Identifies the MIDI message type.

Enumerator
wxMIDI_UNDEFINED_MSG 

Undefined (invalid wxMidiMessage object)

wxMIDI_SHORT_MSG 

Short message (wxMidiShortMessage)

wxMIDI_SYSEX_MSG 

SysEx message (wxMidiSysExMessage)