Loading...
Searching...
No Matches
ScaleNotes.hpp
1#pragma once
2#include <Midi/Commands/CommandFactory.hpp>
3#include <Midi/MidiNote.hpp>
4
5#include <score/command/AggregateCommand.hpp>
6#include <score/model/path/Path.hpp>
7
8namespace Midi
9{
10class ProcessModel;
11
12class ScaleNotes final : public score::Command
13{
14 SCORE_COMMAND_DECL(Midi::CommandFactoryName(), ScaleNotes, "Scale notes")
15public:
17 const ProcessModel& model, const std::vector<Id<Note>>& to_move, double delta);
18
19 void undo(const score::DocumentContext& ctx) const override;
20 void redo(const score::DocumentContext& ctx) const override;
21
22protected:
23 void serializeImpl(DataStreamInput& s) const override;
24 void deserializeImpl(DataStreamOutput& s) override;
25
26private:
27 Path<ProcessModel> m_model;
28 std::vector<Id<Note>> m_toScale;
29 double m_delta{};
30};
31
32// sclaes the whole process
33class RescaleMidi final : public score::Command
34{
35 SCORE_COMMAND_DECL(Midi::CommandFactoryName(), RescaleMidi, "Rescale midi")
36public:
37 RescaleMidi(const ProcessModel& model, double delta);
38
39 void undo(const score::DocumentContext& ctx) const override;
40 void redo(const score::DocumentContext& ctx) const override;
41
42protected:
43 void serializeImpl(DataStreamInput& s) const override;
44 void deserializeImpl(DataStreamOutput& s) override;
45
46private:
47 Path<ProcessModel> m_model;
48 std::vector<std::pair<Id<Note>, NoteData>> m_old;
49 double m_delta{};
50};
52{
53 SCORE_COMMAND_DECL(Midi::CommandFactoryName(), RescaleAllMidi, "Rescale all midi")
54public:
55};
56}
Definition MidiProcess.hpp:15
Definition ScaleNotes.hpp:52
Definition ScaleNotes.hpp:34
Definition ScaleNotes.hpp:13
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
The id_base_t class.
Definition Identifier.hpp:57
Allows for grouping of multiple commands in a single one.
Definition AggregateCommand.hpp:15
The Command class.
Definition Command.hpp:34
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition MidiNote.hpp:11
Definition DocumentContext.hpp:18