Get the event list from the midi state

This commit is contained in:
Paul Ferrand 2020-03-29 15:52:21 +02:00
parent 9f8b275712
commit 9263488882
3 changed files with 15 additions and 4 deletions

View file

@ -139,3 +139,11 @@ void sfz::MidiState::resetAllControllers(int delay) noexcept
pitchBend = 0;
}
const sfz::EventVector& sfz::MidiState::getEvents(int ccIdx) const noexcept
{
if (ccIdx < 0 || ccIdx > config::numCCs)
return nullEvent;
return cc[ccIdx];
}

View file

@ -141,10 +141,9 @@ public:
return validRange.clamp(value);
}
const EventVector& getEvents(int ccIdx) const noexcept;
private:
template<class T>
using MidiNoteArray = std::array<T, 128>;
using EventVector = std::vector<MidiEvent>;
int activeNotes { 0 };
/**
@ -168,6 +167,8 @@ private:
*
*/
std::array<EventVector, config::numCCs> cc;
const EventVector nullEvent {{0, 0.0f}};
/**
* Pitch bend status
*/

View file

@ -19,7 +19,8 @@ namespace sfz
{
using CCNamePair = std::pair<uint16_t, std::string>;
template<class T>
using MidiNoteArray = std::array<T, 128>;
template<class ValueType>
struct CCValuePair {
int cc;
@ -66,6 +67,7 @@ struct MidiEvent {
int delay;
float value;
};
using EventVector = std::vector<MidiEvent>;
struct MidiEventDelayComparator {
bool operator()(const MidiEvent& event, const int& delay)