Loading...
Searching...
No Matches
SetOutput.hpp
1#pragma once
2#include <Midi/Commands/CommandFactory.hpp>
3
4#include <score/model/path/Path.hpp>
5
6namespace Midi
7{
8class ProcessModel;
9
10class SetChannel final : public score::Command
11{
12 SCORE_COMMAND_DECL(Midi::CommandFactoryName(), SetChannel, "Set Midi channel")
13public:
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
20protected:
21 void serializeImpl(DataStreamInput& s) const override;
22 void deserializeImpl(DataStreamOutput& s) override;
23
24private:
25 Path<ProcessModel> m_model;
26 int m_old{}, m_new{};
27};
28
29class SetRange final : public score::Command
30{
31 SCORE_COMMAND_DECL(Midi::CommandFactoryName(), SetRange, "Set Midi range")
32public:
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
39protected:
40 void serializeImpl(DataStreamInput& s) const override;
41 void deserializeImpl(DataStreamOutput& s) override;
42
43private:
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 Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
The Command class.
Definition Command.hpp:34
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition DocumentContext.hpp:18