2#include <Midi/Commands/CommandFactory.hpp>
4#include <score/command/Command.hpp>
5#include <score/command/PropertyCommand.hpp>
6#include <score/model/path/PathSerialization.hpp>
8#include <Patternist/PatternModel.hpp>
11inline auto& CommandFactoryName()
13 return Midi::CommandFactoryName();
19 SCORE_COMMAND_DECL(Midi::CommandFactoryName(),
UpdatePattern,
"Update a pattern")
23 , m_old{model.patterns()}
24 , m_new{model.patterns()}
26 update(model, p, pat);
31 m_model.find(ctx).setPatterns(m_old);
36 m_model.find(ctx).setPatterns(m_new);
41 if(ossia::valid_index(p, m_new))
48 s << m_model << m_old << m_new;
53 s >> m_model >> m_old >> m_new;
58 std::vector<Pattern> m_old;
59 std::vector<Pattern> m_new;
64 SCORE_COMMAND_DECL(Midi::CommandFactoryName(),
UpdatePatterns,
"Update patterns")
68 , m_old{model.patterns()}
69 , m_new{std::move(pat)}
75 m_model.find(ctx).setPatterns(m_old);
80 m_model.find(ctx).setPatterns(m_new);
86 s << m_model << m_old << m_new;
89 void deserializeImpl(
DataStreamOutput& s)
override { s >> m_model >> m_old >> m_new; }
93 std::vector<Pattern> m_old;
94 std::vector<Pattern> m_new;
101 SCORE_COMMAND_DECL(Midi::CommandFactoryName(),
ReplacePatterns,
"Change the patterns")
105 , m_old{model.patterns()}
106 , m_new{std::move(pat)}
107 , m_oldCurrent{model.currentPattern()}
108 , m_newCurrent{current}
114 auto& m = m_model.find(ctx);
115 m.setPatterns(m_old);
116 m.setCurrentPattern(m_oldCurrent);
121 auto& m = m_model.find(ctx);
122 m.setPatterns(m_new);
123 m.setCurrentPattern(m_newCurrent);
129 s << m_model << m_old << m_new << m_oldCurrent << m_newCurrent;
134 s >> m_model >> m_old >> m_new >> m_oldCurrent >> m_newCurrent;
139 std::vector<Pattern> m_old;
140 std::vector<Pattern> m_new;
146 Patternist, SetPatternChannel, ProcessModel::p_channel,
"Change channel")
147SCORE_COMMAND_DECL_T(Patternist::SetPatternChannel)
149 Patternist, SetCurrentPattern, ProcessModel::p_currentPattern, "Change pattern")
150SCORE_COMMAND_DECL_T(Patternist::SetCurrentPattern)
152 Patternist, SetLaneLabels, ProcessModel::p_laneLabels, "Change lane labels")
153SCORE_COMMAND_DECL_T(Patternist::SetLaneLabels)
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
Definition PatternModel.hpp:247
Definition PatternProperties.hpp:100
Definition PatternProperties.hpp:18
Definition PatternProperties.hpp:63
The Command class.
Definition Command.hpp:34
Definition DataStreamHelpers.hpp:103
Definition PatternModel.hpp:139
Definition DocumentContext.hpp:18