MidiProcess.hpp
1 #pragma once
2 #include <Process/Process.hpp>
3 
4 #include <Midi/MidiNote.hpp>
5 #include <Midi/MidiProcessMetadata.hpp>
6 
7 #include <score/tools/Clamp.hpp>
8 
9 #include <verdigris>
10 
11 namespace Midi
12 {
13 
14 class SCORE_PLUGIN_MIDI_EXPORT ProcessModel final : public Process::ProcessModel
15 {
16  SCORE_SERIALIZE_FRIENDS
17  W_OBJECT(ProcessModel)
18 
19 public:
20  PROCESS_METADATA_IMPL(Midi::ProcessModel)
21  explicit ProcessModel(
22  const TimeVal& duration, const Id<Process::ProcessModel>& id, QObject* parent);
23 
24  template <typename Impl>
25  explicit ProcessModel(Impl& vis, QObject* parent)
26  : Process::ProcessModel{vis, parent}
27  {
28  vis.writeTo(*this);
29  init();
30  }
31 
32  void init();
33 
34  ~ProcessModel() override;
35 
37 
38  void setChannel(int n);
39  int channel() const;
40 
41  std::pair<int, int> range() const { return m_range; }
42 
43  void setRange(int min, int max);
44 
45  std::unique_ptr<Process::MidiOutlet> outlet;
46 
47  using Process::ProcessModel::setDuration;
48 
49 public:
50  void notesNeedUpdate() W_SIGNAL(notesNeedUpdate);
51  void notesChanged() W_SIGNAL(notesChanged);
52  void channelChanged(int arg_1) W_SIGNAL(channelChanged, arg_1);
53 
54  void rangeChanged(int arg_1, int arg_2) W_SIGNAL(rangeChanged, arg_1, arg_2);
55 
56 private:
57  TimeVal contentDuration() const noexcept override;
58  void setDurationAndScale(const TimeVal& newDuration) noexcept override;
59  void setDurationAndGrow(const TimeVal& newDuration) noexcept override;
60  void setDurationAndShrink(const TimeVal& newDuration) noexcept override;
61 
62  int m_channel{1};
63  std::pair<int, int> m_range{0, 127};
64 };
65 }
Definition: MidiProcess.hpp:15
The Process class.
Definition: score-lib-process/Process/Process.hpp:61
The id_base_t class.
Definition: Identifier.hpp:57
The EntityMap class.
Definition: EntityMap.hpp:36
Definition: TimeValue.hpp:21
Definition: LFO_v2.hpp:68