linuxsampler 1.0.0

VirtualMidiDevice.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2008 Christian Schoenebeck
00003  */
00004 
00005 #ifndef LS_VIRTUALMIDIDEVICE_H
00006 #define LS_VIRTUALMIDIDEVICE_H
00007 
00008 #include "../../common/global.h"
00009 
00010 namespace LinuxSampler {
00011 
00020 class VirtualMidiDevice {
00021 public:
00022     enum event_type_t {
00023         EVENT_TYPE_NOTEON  = 1,
00024         EVENT_TYPE_NOTEOFF = 2
00025     };
00026 
00027     struct event_t {
00028         event_type_t Type;
00029         uint8_t      Key;
00030         uint8_t      Velocity;
00031     };
00032 
00034     // Device methods
00035     //     (called by the VirtualMidiDevice implementation)
00036 
00043     bool SendNoteOnToSampler(uint8_t Key, uint8_t Velocity);
00044 
00051     bool SendNoteOffToSampler(uint8_t Key, uint8_t Velocity);
00052 
00060     bool NotesChanged();
00061 
00069     bool NoteChanged(uint8_t Key);
00070 
00078     bool NoteIsActive(uint8_t Key);
00079 
00083     uint8_t NoteOnVelocity(uint8_t Key);
00084 
00088     uint8_t NoteOffVelocity(uint8_t Key);
00089 
00091     // Sampler methods
00092     //     (usually only called by the Sampler)
00093 
00104     void SendNoteOnToDevice(uint8_t Key, uint8_t Velocity);
00105 
00116     void SendNoteOffToDevice(uint8_t Key, uint8_t Velocity);
00117 
00127     bool GetMidiEventFromDevice(event_t& Event);
00128 
00132     VirtualMidiDevice();
00133 
00137     virtual ~VirtualMidiDevice();
00138 
00139 private:
00140     struct private_data_t;
00141     private_data_t* const p;
00142 };
00143 
00144 } // namespace LinuxSampler
00145 
00146 #endif // LS_VIRTUALMIDIDEVICE_H