1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 2 /* 3 Rosegarden 4 A sequencer and musical notation editor. 5 Copyright 2020 the Rosegarden development team. 6 7 This program is free software; you can redistribute it and/or 8 modify it under the terms of the GNU General Public License as 9 published by the Free Software Foundation; either version 2 of the 10 License, or (at your option) any later version. See the file 11 COPYING included with this distribution for more information. 12 */ 13 14 #pragma once 15 16 #include "base/Instrument.h" // For InstrumentId 17 #include "base/MidiProgram.h" // For MidiByte 18 #include "base/RealTime.h" 19 20 #include <set> 21 22 namespace Rosegarden 23 { 24 25 26 /// Pending Note Off event for the NoteOffQueue 27 struct NoteOffEvent 28 { NoteOffEventNoteOffEvent29 NoteOffEvent() : 30 realTime(), 31 pitch(0), 32 channel(0), 33 instrumentId(0) 34 { } 35 NoteOffEventNoteOffEvent36 NoteOffEvent(const RealTime &realTime, 37 MidiByte pitch, 38 MidiByte channel, 39 InstrumentId instrumentId) : 40 realTime(realTime), 41 pitch(pitch), 42 channel(channel), 43 instrumentId(instrumentId) 44 { } 45 46 RealTime realTime; 47 MidiByte pitch; 48 MidiByte channel; 49 InstrumentId instrumentId; 50 }; 51 52 struct NoteOffEventCmp 53 { operatorNoteOffEventCmp54 bool operator()(const NoteOffEvent *lhs, const NoteOffEvent *rhs) const 55 { 56 return (lhs->realTime < rhs->realTime); 57 } 58 }; 59 60 typedef std::multiset<NoteOffEvent *, NoteOffEventCmp> NoteOffQueue; 61 62 63 } 64