OSDN Git Service

ブロックの終わりでも時刻をリセットするように変更
[yamml/yamml-git.git] / include / ir2midi / context.hpp
index e970053..bc19119 100644 (file)
@@ -1,6 +1,7 @@
 
 #pragma once
 
+#include <string>
 #include <vector>
 
 #include <midi/event.hpp>
@@ -21,7 +22,17 @@ public:
 class TrackCompilerContext final
 {
 public:
-    void EnterBlock();
+    TrackCompilerContext() = default;
+
+    explicit TrackCompilerContext(int lastEventTime)
+    {
+        SetLastEventTime(lastEventTime);
+    }
+
+    void ResetTime();
+    int GetLastEventTime();
+    void SetLastEventTime(int t);
+    void UpdateTime(int relativeTime);
     void PushEvent(int relativeTime, const MIDI::MIDIEvent::EventType& ev);
     void SortEvents();
     const std::vector<AbsoluteMIDIEvent>& GetEvents() const;
@@ -32,6 +43,17 @@ private:
     int m_LastEventTime = 0;
 };
 
+class IIR2MIDICompiler
+{
+public:
+    virtual ~IIR2MIDICompiler() = default;
+
+    virtual std::string GetSourceName() const = 0;
+    virtual TrackCompilerContext& GetTrackContext(int trackNumber) = 0;
+    virtual bool CompileTrackBlock(const std::string& trackBlockName) = 0;
+    virtual bool HasTrackBlock(const std::string& trackBlockName) const = 0;
+};
+
 } // namespace IR2MIDI
 
 } // namespace YAMML