MidiDrop.hpp
1 #pragma once
2 #include <Process/Drop/ProcessDropHandler.hpp>
3 #include <Process/TimeValue.hpp>
4 
5 #include <Midi/MidiNote.hpp>
6 namespace Midi
7 {
8 
10 {
11  SCORE_CONCRETE("8F162598-9E4E-4865-A861-81DF01D2CDF0")
12 
13 public:
14  QSet<QString> mimeTypes() const noexcept override;
15  QSet<QString> fileExtensions() const noexcept override;
16  void dropData(
17  std::vector<ProcessDrop>& drops, const DroppedFile& data,
18  const score::DocumentContext& ctx) const noexcept override;
19 };
20 
21 struct MidiTrack
22 {
23  QString name;
24 
25  std::vector<Midi::NoteData> notes;
26  int min{127}, max{0};
27 
28  struct MidiSong
29  {
30  std::vector<MidiTrack> tracks;
31  double duration{};
32  float tempo{};
33  float tickPerBeat{};
34 
35  double durationInMs{};
36  };
37  static std::vector<MidiTrack::MidiSong>
38  parse(const QMimeData& dat, const score::DocumentContext& ctx);
39  static MidiSong parse(const QByteArray& dat, const score::DocumentContext& ctx);
40 };
41 }
Definition: MidiDrop.hpp:10
Definition: ProcessDropHandler.hpp:25
Definition: MidiDrop.hpp:29
Definition: MidiDrop.hpp:22
Definition: ProcessDropHandler.hpp:36
Definition: DocumentContext.hpp:18