Entropy Piano Tuner  1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MidiAdapter Class Referenceabstract

Adapter class for reading an externally connected MIDI keyboard. More...

#include <midiadapter.h>

+ Inheritance diagram for MidiAdapter:

Classes

struct  Data
 Structure of the data associated with a MIDI event. More...
 

Public Types

enum  MidiEvent { MIDI_UNDEFINED = 0, MIDI_KEY_PRESS, MIDI_KEY_RELEASE, MIDI_CONTROL_CHANGE }
 Enumeration of the possible MIDI events. More...
 

Public Member Functions

 MidiAdapter ()
 Constructor without function. More...
 
 ~MidiAdapter ()
 Destructor without function. More...
 
virtual void init ()=0
 Initialisation of the implementation. More...
 
virtual void exit ()=0
 Shut down the implementation. More...
 
virtual int GetNumberOfPorts ()=0
 Get the number of available input devices. More...
 
virtual std::string GetPortName (int i)=0
 Get the name of device number i (starting with zero) More...
 
virtual std::string GetPortNames ()
 Get a list of all available input devices. More...
 
virtual bool OpenPort (int i, std::string AppName="")=0
 Open Midi input device number i. More...
 
virtual bool OpenPort (std::string AppName="")=0
 Open Midi device with the highest port number. More...
 
virtual int getCurrentPort () const =0
 Get the current port number. More...
 
void send (Data &data)
 Send new MIDI data to the messaging system. More...
 

Static Public Member Functions

static MidiEvent byteToEvent (int byte)
 Convert MIDI code to MidiEvent. More...
 

Detailed Description

Adapter class for reading an externally connected MIDI keyboard.

This abstract class defines the interface between the EPT and an external MIDI keyboard. It has to be inherited in a specific platform-dependent implementation.

See also
class RtMidiImplementation and NoMidiImplementation

A midi command consists of three bytes, as explained e.g. in https://www.nyu.edu/classes/bello/FMT_files/9_MIDI_code.pdf . In addition, the callback function provides a parameter called 'deltatime', which is basically the time in seconds elapsed since the last event.

Definition at line 43 of file midiadapter.h.

Member Enumeration Documentation

Enumeration of the possible MIDI events.

Midi events processed by the EPT, representing the MIDI operation code in a simplified manner.

Enumerator
MIDI_UNDEFINED 

Midi event undefined.

MIDI_KEY_PRESS 

Midi event when a key is pressed.

MIDI_KEY_RELEASE 

Midi event when a key is released.

MIDI_CONTROL_CHANGE 

Midi event for changing voice.

Definition at line 68 of file midiadapter.h.

Constructor & Destructor Documentation

MidiAdapter::MidiAdapter ( )
inline

Constructor without function.

Definition at line 47 of file midiadapter.h.

MidiAdapter::~MidiAdapter ( )
inline

Destructor without function.

Definition at line 48 of file midiadapter.h.

Member Function Documentation

MidiAdapter::MidiEvent MidiAdapter::byteToEvent ( int  byte)
static

Convert MIDI code to MidiEvent.

Returns
MidiEvent code, MIDI_UNDEFINED if not recognized

Definition at line 63 of file midiadapter.cpp.

virtual void MidiAdapter::exit ( )
pure virtual

Shut down the implementation.

Implemented in RtMidiImplementation, and NoMidiImplementation.

virtual int MidiAdapter::getCurrentPort ( ) const
pure virtual

Get the current port number.

Implemented in RtMidiImplementation, and NoMidiImplementation.

virtual int MidiAdapter::GetNumberOfPorts ( )
pure virtual

Get the number of available input devices.

Implemented in RtMidiImplementation, and NoMidiImplementation.

virtual std::string MidiAdapter::GetPortName ( int  i)
pure virtual

Get the name of device number i (starting with zero)

Implemented in RtMidiImplementation, and NoMidiImplementation.

std::string MidiAdapter::GetPortNames ( )
virtual

Get a list of all available input devices.

Returns
List all available Midi devices in a single string

Reimplemented in RtMidiImplementation.

Definition at line 41 of file midiadapter.cpp.

+ Here is the call graph for this function:

virtual void MidiAdapter::init ( )
pure virtual

Initialisation of the implementation.

Implemented in RtMidiImplementation, and NoMidiImplementation.

virtual bool MidiAdapter::OpenPort ( int  i,
std::string  AppName = "" 
)
pure virtual

Open Midi input device number i.

Implemented in RtMidiImplementation, and NoMidiImplementation.

virtual bool MidiAdapter::OpenPort ( std::string  AppName = "")
pure virtual

Open Midi device with the highest port number.

Implemented in RtMidiImplementation, and NoMidiImplementation.

void MidiAdapter::send ( Data data)

Send new MIDI data to the messaging system.

This function sends a new data set received from the MIDI implementation as a message to the message handler.

Definition at line 84 of file midiadapter.cpp.


The documentation for this class was generated from the following files: