npisanti/ofxPDSP

Use map instead of vector for MidiControls

Closed this issue · 3 comments

@npisanti I've rewritten the

MidiControls
and
MidiCCBuffers
classes to use maps instead of vectors to store MessageBuffer and SequencerValueOutput in order to avoid the awkward range-based allocation of buffers. Good idea?

The change renders

getMaxCCNum
and
setMaxCCNum
irrelevant and deprecated. Let me know if you'd like me to make a pull request.

what map did you used? std::map or std::unordered_map ?

what map did you used? std::map or std::unordered_map ?

I used std::map, but I can change it to std::unordered_map!

In pdsp i mostly used std::vector everywere instead of other data structure as in many cases the contiguous memory is of std::vector make it faster than other data structures, expecially for low sizes. I always reserved some space in the vectors to avoid allocation during audio processing.

Reviewing my code it was just premature optimization in the case of the midi CC buffers (as the big part of the processing is made elsewhere)

For this case, as possible midi CC are < 127 i think that std::map is the better choice, can you prepare me the PR so i can review the code changes?