linuxsampler 1.0.0

LinuxSampler::VirtualMidiDevice Class Reference

Light-weight MIDI interface (for MIDI in & out) intended to be used by pure software MIDI "devices", that is e.g. More...

#include <VirtualMidiDevice.h>

Inheritance diagram for LinuxSampler::VirtualMidiDevice:
LinuxSampler::InstrumentEditor

List of all members.

Classes

struct  event_t

Public Types

enum  event_type_t { EVENT_TYPE_NOTEON = 1, EVENT_TYPE_NOTEOFF = 2 }

Public Member Functions

bool SendNoteOnToSampler (uint8_t Key, uint8_t Velocity)
 Sends a MIDI note on event to the sampler.
bool SendNoteOffToSampler (uint8_t Key, uint8_t Velocity)
 Sends a MIDI note off event to the sampler.
bool NotesChanged ()
 Can be called by the virtual MIDI device to check whether a new note on or note off MIDI event arrived to the sampler during the last call to this method.
bool NoteChanged (uint8_t Key)
 Can be called by the virtual MIDI device to check whether a new note on or note off MIDI event arrived to the sampler for Key during the last call to this method.
bool NoteIsActive (uint8_t Key)
 Can be called by the virtual MIDI device to check which key / note is currently active by the sampler, e.g.
uint8_t NoteOnVelocity (uint8_t Key)
 Returns the velocity of the last note on event.
uint8_t NoteOffVelocity (uint8_t Key)
 Returns the velocity of the last note off event.
void SendNoteOnToDevice (uint8_t Key, uint8_t Velocity)
 Informs the virtual MIDI device that a note on event occured (e.g.
void SendNoteOffToDevice (uint8_t Key, uint8_t Velocity)
 Informs the virtual MIDI device that a note off event occured (e.g.
bool GetMidiEventFromDevice (event_t &Event)
 Gets the next pending MIDI event from the virtual MIDI device by using a lockfree FIFO.
 VirtualMidiDevice ()
 Constructor.
virtual ~VirtualMidiDevice ()
 Destructor.

Detailed Description

Light-weight MIDI interface (for MIDI in & out) intended to be used by pure software MIDI "devices", that is e.g.

a graphical virtual MIDI keyboard in an instrument editor or in a sampler frontend. This class should not be used for regular MIDI input device drivers for the sampler. This primitive interface by design doesn't care about jitter, fast event delivery or masses and masses of events in a short time!

Definition at line 20 of file VirtualMidiDevice.h.


Member Enumeration Documentation

Enumerator:
EVENT_TYPE_NOTEON 
EVENT_TYPE_NOTEOFF 

Definition at line 22 of file VirtualMidiDevice.h.


Constructor & Destructor Documentation

LinuxSampler::VirtualMidiDevice::VirtualMidiDevice ( )

Constructor.

virtual LinuxSampler::VirtualMidiDevice::~VirtualMidiDevice ( ) [virtual]

Destructor.


Member Function Documentation

bool LinuxSampler::VirtualMidiDevice::GetMidiEventFromDevice ( event_t Event)

Gets the next pending MIDI event from the virtual MIDI device by using a lockfree FIFO.

Note: this method is usually only called by the sampler.

Parameters:
Event- destination for writing the next event to
Returns:
true on success, false if no event pending
bool LinuxSampler::VirtualMidiDevice::NoteChanged ( uint8_t  Key)

Can be called by the virtual MIDI device to check whether a new note on or note off MIDI event arrived to the sampler for Key during the last call to this method.

So this is a asynchronously, "polling" based communication mechanism, which works in conjunction with the NoteIsActive() method call.

bool LinuxSampler::VirtualMidiDevice::NoteIsActive ( uint8_t  Key)

Can be called by the virtual MIDI device to check which key / note is currently active by the sampler, e.g.

to highlight the respective keys on a graphical virtual keyboard.

See also:
NotesChanged(), NoteChanged()
uint8_t LinuxSampler::VirtualMidiDevice::NoteOffVelocity ( uint8_t  Key)

Returns the velocity of the last note off event.

No FIFO is used!

uint8_t LinuxSampler::VirtualMidiDevice::NoteOnVelocity ( uint8_t  Key)

Returns the velocity of the last note on event.

No FIFO is used!

bool LinuxSampler::VirtualMidiDevice::NotesChanged ( )

Can be called by the virtual MIDI device to check whether a new note on or note off MIDI event arrived to the sampler during the last call to this method.

So this is a asynchronously, "polling" based communication mechanism, which works in conjunction with the NoteIsActive() method call.

void LinuxSampler::VirtualMidiDevice::SendNoteOffToDevice ( uint8_t  Key,
uint8_t  Velocity 
)

Informs the virtual MIDI device that a note off event occured (e.g.

caused by a MIDI keyboard connected to the sampler). Communication acts asynchronously, that is this method call doesn't lock in any way and returns immediately. It is thus realtime safe.

Note: this method is usually only called by the sampler.

See also:
ActiveNotesChanged(), NoteIsActive()
bool LinuxSampler::VirtualMidiDevice::SendNoteOffToSampler ( uint8_t  Key,
uint8_t  Velocity 
)

Sends a MIDI note off event to the sampler.

Returns:
true on success, false if internal FIFO full (or provided values invalid)
void LinuxSampler::VirtualMidiDevice::SendNoteOnToDevice ( uint8_t  Key,
uint8_t  Velocity 
)

Informs the virtual MIDI device that a note on event occured (e.g.

caused by a MIDI keyboard connected to the sampler). Communication acts asynchronously, that is this method call doesn't lock in any way and returns immediately. It is thus realtime safe.

Note: this method is usually only called by the sampler.

See also:
ActiveNotesChanged(), NoteIsActive()
bool LinuxSampler::VirtualMidiDevice::SendNoteOnToSampler ( uint8_t  Key,
uint8_t  Velocity 
)

Sends a MIDI note on event to the sampler.

Returns:
true on success, false if internal FIFO full (or provided values invalid)

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