SetOutput.hpp
1 #pragma once
2 #include <Midi/Commands/CommandFactory.hpp>
3 
4 #include <score/model/path/Path.hpp>
5 
6 namespace Midi
7 {
8 class ProcessModel;
9 
10 class SetChannel final : public score::Command
11 {
12  SCORE_COMMAND_DECL(Midi::CommandFactoryName(), SetChannel, "Set Midi channel")
13 public:
14  // Channel should be in [ 0; 15 ]
15  SetChannel(const ProcessModel& model, int chan);
16 
17  void undo(const score::DocumentContext& ctx) const override;
18  void redo(const score::DocumentContext& ctx) const override;
19 
20 protected:
21  void serializeImpl(DataStreamInput& s) const override;
22  void deserializeImpl(DataStreamOutput& s) override;
23 
24 private:
25  Path<ProcessModel> m_model;
26  int m_old{}, m_new{};
27 };
28 
29 class SetRange final : public score::Command
30 {
31  SCORE_COMMAND_DECL(Midi::CommandFactoryName(), SetRange, "Set Midi range")
32 public:
33  // Channel should be in [ 0; 15 ]
34  SetRange(const ProcessModel& model, int min, int max);
35 
36  void undo(const score::DocumentContext& ctx) const override;
37  void redo(const score::DocumentContext& ctx) const override;
38 
39 protected:
40  void serializeImpl(DataStreamInput& s) const override;
41  void deserializeImpl(DataStreamOutput& s) override;
42 
43 private:
44  Path<ProcessModel> m_model;
45  int m_oldmin{}, m_newmin{};
46  int m_oldmax{}, m_newmax{};
47 };
48 }
Definition: MidiProcess.hpp:15
Definition: SetOutput.hpp:11
Definition: SetOutput.hpp:30
The Command class.
Definition: Command.hpp:34
Definition: DataStreamHelpers.hpp:99
Definition: DataStreamHelpers.hpp:103
Definition: DocumentContext.hpp:18