Arduino STK  4.6.2
ArdStkMidiAction.h
1 #pragma once
2 #include "ArdConfig.h"
3 
4 #include "MidiAction.h"
5 #include "Voicer.h"
6 
7 namespace stk {
8 
9 
10 /***************************************************/
16 /***************************************************/
17 
18 class StkMidiAction : public midi::MidiAction {
19  public:
20  StkMidiAction() = default;
21 
22  StkMidiAction(Instrmnt *instrument, int group=0) {
23  addInstrument(instrument, group);
24  };
25 
26  Voicer &voicer() {
27  return voicer_obj;
28  }
29 
30  virtual void addInstrument( Instrmnt *instrument, int group=0 ){
31  voicer_obj.addInstrument(instrument, group);
32  }
33 
34  virtual void removeInstrument( Instrmnt *instrument ){
35  voicer_obj.removeInstrument(instrument);
36  }
37 
38  virtual void onNoteOn(uint8_t channel, uint8_t note, uint8_t velocity=87) {
39  voicer_obj.noteOn(note, velocity, channel);
40  }
41 
42  virtual void onNoteOff(uint8_t channel, uint8_t note, uint8_t velocity=87) {
43  voicer_obj.noteOff(note, velocity, channel);
44  }
45 
46  virtual void onControlChange(uint8_t channel, uint8_t controller, uint8_t value) {
47  voicer_obj.controlChange(controller,(StkFloat) value, channel);
48  }
49 
50  virtual void onPitchBend(uint8_t channel, uint8_t value) {
51  voicer_obj.pitchBend(value, channel);
52  }
53 
54  StkFloat tick( unsigned int channel = 0 ){
55  return voicer_obj.tick(channel);
56  }
57 
58  StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ){
59  return voicer_obj.tick(frames, channel);
60  }
61  protected:
62  Voicer voicer_obj;
63 };
64 
65 }
66 
The STK namespace.
Definition: ADSR.h:8