MoveNotes.hpp
1 #pragma once
2 #include <Midi/Commands/CommandFactory.hpp>
3 #include <Midi/MidiNote.hpp>
4 
5 #include <score/model/path/Path.hpp>
6 #include <score/tools/Unused.hpp>
7 
8 #include <QVector>
9 
10 namespace Midi
11 {
12 class ProcessModel;
13 
14 class MoveNotes final : public score::Command
15 {
16  SCORE_COMMAND_DECL(Midi::CommandFactoryName(), MoveNotes, "Move notes")
17 public:
18  MoveNotes(
19  const ProcessModel& model, const std::vector<Id<Note>>& to_move, int note_delta,
20  double t_delta);
21 
22  void undo(const score::DocumentContext& ctx) const override;
23  void redo(const score::DocumentContext& ctx) const override;
24 
25  void update(unused_t, unused_t, int note_delta, double t_delta);
26 
27 protected:
28  void serializeImpl(DataStreamInput& s) const override;
29  void deserializeImpl(DataStreamOutput& s) override;
30 
31 private:
32  Path<ProcessModel> m_model;
33  std::vector<std::pair<Id<Note>, NoteData>> m_before, m_after;
34 };
35 
36 class ChangeNotesVelocity final : public score::Command
37 {
38  SCORE_COMMAND_DECL(Midi::CommandFactoryName(), ChangeNotesVelocity, "Change velocity")
39 public:
41  const ProcessModel& model, const std::vector<Id<Note>>& to_update,
42  double vel_delta);
43 
44  void undo(const score::DocumentContext& ctx) const override;
45  void redo(const score::DocumentContext& ctx) const override;
46 
47  void update(unused_t, unused_t, double vel_delta);
48 
49 protected:
50  void serializeImpl(DataStreamInput& s) const override;
51  void deserializeImpl(DataStreamOutput& s) override;
52 
53 private:
54  Path<ProcessModel> m_model;
55  std::vector<std::pair<Id<Note>, NoteData>> m_before, m_after;
56 };
57 }
Definition: MoveNotes.hpp:37
Definition: MoveNotes.hpp:15
Definition: MidiProcess.hpp:15
The id_base_t class.
Definition: Identifier.hpp:57
The Command class.
Definition: Command.hpp:34
Definition: DataStreamHelpers.hpp:99
Definition: DataStreamHelpers.hpp:103
Definition: MidiNote.hpp:11
Definition: DocumentContext.hpp:18
Definition: Unused.hpp:3