sequencer: implement commands to change scenes

This commit is contained in:
Torrie Fischer 2023-12-11 07:57:49 +01:00
parent 4e56134dd9
commit 58df15702d
2 changed files with 30 additions and 0 deletions

View File

@ -94,5 +94,34 @@ Sequencer::handleEvent(const InputEvent& evt)
}
}
void
doScenes(Args& args, Print& out)
{
out.println("Available scenes: ");
for (auto scene : Static<Sequencer>::instance()->scenes()) {
out.println(scene.name);
}
}
static String s;
void
doScene(Args& args, Print& out)
{
s = args[1];
MainLoop::instance()->dispatch(InputEvent{InputEvent::SetPattern, s.c_str()});
}
const std::vector<Command> _commands = {
{"scene", doScene},
{"scenes", doScenes}
};
const std::vector<Command>&
Sequencer::commands() const
{
return _commands;
}
STATIC_ALLOC(Sequencer);
STATIC_TASK(Sequencer);

View File

@ -23,6 +23,7 @@ public:
const char* currentSceneName();
const std::vector<Scene> scenes() const;
const std::vector<Command>& commands() const override;
private:
int m_idx;