1 #ifndef __AMUSE_SEQUENCER_HPP__ 2 #define __AMUSE_SEQUENCER_HPP__ 5 #include "AudioGroupProject.hpp" 6 #include "SongState.hpp" 7 #include "optional.hpp" 8 #include <unordered_map> 9 #include <unordered_set> 19 enum class SequencerState
32 Submix* m_submix =
nullptr;
33 std::list<std::shared_ptr<Sequencer>>::iterator m_engineIt;
35 const unsigned char* m_arrData =
nullptr;
37 double m_ticksPerSec = 1000.0;
38 SequencerState m_state = SequencerState::Interactive;
39 bool m_dieOnEnd =
false;
50 Submix* m_submix =
nullptr;
52 ChannelState(
Sequencer& parent, uint8_t chanId);
55 std::unordered_map<uint8_t, std::shared_ptr<Voice>> m_chanVoxs;
56 std::unordered_set<std::shared_ptr<Voice>> m_keyoffVoxs;
57 int8_t m_ctrlVals[128];
58 float m_curPitchWheel = 0.f;
59 int8_t m_curProgram = 0;
63 void _bringOutYourDead();
64 size_t getVoiceCount()
const;
65 std::shared_ptr<Voice> keyOn(uint8_t note, uint8_t velocity);
66 void keyOff(uint8_t note, uint8_t velocity);
67 void setCtrlValue(uint8_t ctrl, int8_t val);
68 bool programChange(int8_t prog);
71 void setPitchWheel(
float pitchWheel);
72 void setVolume(
float vol);
73 void setPan(
float pan);
75 void killKeygroup(uint8_t kg,
bool now);
76 std::shared_ptr<Voice> findVoice(
int vid);
77 void sendMacroMessage(ObjectId macroId, int32_t val);
79 std::array<std::experimental::optional<ChannelState>, 16> m_chanStates;
81 void _bringOutYourDead();
89 void advance(
double dt);
95 SequencerState
state()
const {
return m_state;}
98 size_t getVoiceCount()
const;
101 std::shared_ptr<Voice> keyOn(uint8_t chan, uint8_t note, uint8_t velocity);
104 void keyOff(uint8_t chan, uint8_t note, uint8_t velocity);
107 void setCtrlValue(uint8_t chan, uint8_t ctrl, int8_t val);
110 void setPitchWheel(uint8_t chan,
float pitchWheel);
113 void allOff(
bool now=
false);
116 void killKeygroup(uint8_t kg,
bool now);
119 std::shared_ptr<Voice> findVoice(
int vid);
122 void sendMacroMessage(ObjectId macroId, int32_t val);
125 void setTempo(
double ticksPerSec);
128 void playSong(
const unsigned char* arrData,
bool dieOnEnd=
true);
131 void setVolume(
float vol);
134 int8_t getChanProgram(int8_t chanId)
const;
137 bool setChanProgram(int8_t chanId, int8_t prog);
140 void nextChanProgram(int8_t chanId);
143 void prevChanProgram(int8_t chanId);
146 void kill() {m_state = SequencerState::Dead;}
151 #endif // __AMUSE_SEQUENCER_HPP__
SequencerState state() const