2018-10-07 03:40:25 +00:00
|
|
|
#pragma once
|
2018-07-28 04:34:29 +00:00
|
|
|
|
2018-07-30 06:20:03 +00:00
|
|
|
#include "amuse/Voice.hpp"
|
2018-07-28 04:34:29 +00:00
|
|
|
#include "amuse/BooBackend.hpp"
|
2018-07-29 03:37:06 +00:00
|
|
|
#include "amuse/Common.hpp"
|
2018-07-28 04:34:29 +00:00
|
|
|
#include <unordered_set>
|
|
|
|
|
2018-12-08 05:20:09 +00:00
|
|
|
class MIDIReader : public amuse::BooBackendMIDIReader {
|
|
|
|
std::unordered_map<uint8_t, amuse::ObjToken<amuse::Voice>> m_chanVoxs;
|
|
|
|
std::unordered_set<amuse::ObjToken<amuse::Voice>> m_keyoffVoxs;
|
|
|
|
amuse::ObjToken<amuse::Voice> m_lastVoice;
|
|
|
|
|
2018-07-28 04:34:29 +00:00
|
|
|
public:
|
2018-12-08 05:20:09 +00:00
|
|
|
MIDIReader(amuse::Engine& engine, bool useLock);
|
|
|
|
|
|
|
|
void noteOff(uint8_t chan, uint8_t key, uint8_t velocity);
|
|
|
|
void noteOn(uint8_t chan, uint8_t key, uint8_t velocity);
|
|
|
|
void notePressure(uint8_t chan, uint8_t key, uint8_t pressure);
|
|
|
|
void controlChange(uint8_t chan, uint8_t control, uint8_t value);
|
|
|
|
void programChange(uint8_t chan, uint8_t program);
|
|
|
|
void channelPressure(uint8_t chan, uint8_t pressure);
|
|
|
|
void pitchBend(uint8_t chan, int16_t pitch);
|
|
|
|
|
|
|
|
void allSoundOff(uint8_t chan);
|
|
|
|
void resetAllControllers(uint8_t chan);
|
|
|
|
void localControl(uint8_t chan, bool on);
|
|
|
|
void allNotesOff(uint8_t chan);
|
|
|
|
void omniMode(uint8_t chan, bool on);
|
|
|
|
void polyMode(uint8_t chan, bool on);
|
|
|
|
|
|
|
|
void sysex(const void* data, size_t len);
|
|
|
|
void timeCodeQuarterFrame(uint8_t message, uint8_t value);
|
|
|
|
void songPositionPointer(uint16_t pointer);
|
|
|
|
void songSelect(uint8_t song);
|
|
|
|
void tuneRequest();
|
|
|
|
|
|
|
|
void startSeq();
|
|
|
|
void continueSeq();
|
|
|
|
void stopSeq();
|
|
|
|
|
|
|
|
void reset();
|
2018-07-28 04:34:29 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:20:09 +00:00
|
|
|
class VoiceAllocator : public amuse::BooBackendVoiceAllocator {
|
2018-07-28 04:34:29 +00:00
|
|
|
public:
|
2018-12-08 05:20:09 +00:00
|
|
|
VoiceAllocator(boo::IAudioVoiceEngine& booEngine);
|
|
|
|
std::unique_ptr<amuse::IMIDIReader> allocateMIDIReader(amuse::Engine& engine);
|
2018-07-28 04:34:29 +00:00
|
|
|
};
|