Allolib  1.0
C++ Components For Interactive Multimedia
al::SequencerMIDI Class Reference

The SequencerMIDI class connects PolySynth objects to MIDI messages. More...

#include <C:/Users/Andres/source/repos/casm_viewer/external/tinc/external/allolib/include/al/scene/al_SequencerMIDI.hpp>

Inheritance diagram for al::SequencerMIDI:
al::MIDIMessageHandler

Public Member Functions

 SequencerMIDI (int deviceIndex)
 
 SequencerMIDI (int deviceIndex, PolySynth &synth)
 
void open (int deviceIndex, PolySynth &synth)
 
void open (int deviceIndex)
 
void close ()
 
bool isOpen ()
 
void setSynthSequencer (PolySynth &synth)
 
void connectNoteOnToFunction (std::function< void(int, int, int)> function)
 
void connectNoteOffToFunction (std::function< void(int, int, int)> function)
 
virtual void onMIDIMessage (const MIDIMessage &m) override
 Called when a MIDI message is received.
 
void bindTo (RtMidiIn &RtMidiIn, unsigned port=0)
 Bind handler to a MIDI input.
 
void clearBindings ()
 

Protected Attributes

std::vector< BindingmBindings
 

Detailed Description

The SequencerMIDI class connects PolySynth objects to MIDI messages.

PolySynth synth;
SequencerMIDI seq;
seq.open(0, synth);
seq.connectNoteOnToFunction(
[&](int note, int vel, int chan) {
if (chan != 1) {
return;
}
auto voicePtr = mSynth->getVoice<Voice1>();
if (voicePtr) {
// Set voice params from MIDI data
voice->note = note;
voice->vel = vel;
// then trigger note
mScene.triggerOn(voice, 0);
}
});
TSynthVoice * getVoice(bool forceAlloc=false)
Get a reference to a voice.

Definition at line 79 of file al_SequencerMIDI.hpp.


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