class Rest final
{
+public:
+ int Duration;
};
class PolyphonicAftertouch final
void EnterBlock();
void SaveTime();
void RestoreTime();
+ void UpdateTime(int relativeTime);
void PushEvent(int relativeTime, const MIDI::MIDIEvent::EventType& ev);
void SortEvents();
const std::vector<AbsoluteMIDIEvent>& GetEvents() const;
std::vector<IR::Block::EventType> Phrase2IRCompiler::operator()(const AST::Rest& ast, int duration)
{
static_cast<void>(ast);
- static_cast<void>(duration);
-
- return {IR::Event{m_RelativeTime, IR::Rest{}}};
+ return {IR::Event{m_RelativeTime, IR::Rest{duration}}};
}
std::vector<IR::Block::EventType> Phrase2IRCompiler::operator()(const AST::NoteNumber& ast, int duration)
m_LastEventTime = m_PrevLastEventTime;
}
-void TrackCompilerContext::PushEvent(int relativeTime, const MIDI::MIDIEvent::EventType& ev)
+void TrackCompilerContext::UpdateTime(int relativeTime)
{
m_LastEventTime = m_BaseTimeForCurrentBlock + relativeTime;
+}
+
+void TrackCompilerContext::PushEvent(int relativeTime, const MIDI::MIDIEvent::EventType& ev)
+{
+ UpdateTime(relativeTime);
m_Events.push_back(AbsoluteMIDIEvent{m_LastEventTime, ev});
}
m_Context.PushEvent(m_RelativeTime + ev.Duration, MIDI::NoteOff{m_Channel, ev.Number, ev.OffVelocity});
}
- void operator()(const IR::Rest&)
+ void operator()(const IR::Rest& ev)
{
+ m_Context.UpdateTime(m_RelativeTime + ev.Duration);
}
void operator()(const IR::PolyphonicAftertouch& ev)