Skip to content

Commit

Permalink
refactor: avoid temporary qlist allocation on midi sysex receive
Browse files Browse the repository at this point in the history
  • Loading branch information
Swiftb0y authored and m0dB committed Mar 1, 2024
1 parent 4203158 commit 3718cc0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/controllers/midi/midicontroller.cpp
@@ -1,6 +1,7 @@
#include "controllers/midi/midicontroller.h"

#include <QJSValue>
#include <algorithm>

#include "control/controlobject.h"
#include "controllers/defs_controllers.h"
Expand Down Expand Up @@ -518,10 +519,11 @@ void MidiController::receive(const QByteArray& data, mixxx::Duration timestamp)
}
}

const auto inputMappings = m_pMapping->getInputMappings().values(mappingKey.key);
for (const auto& inputMapping : inputMappings) {
const auto [inputMappingsBegin, inputMappingsEnd] =
m_pMapping->getInputMappings().equal_range(mappingKey.key);
std::for_each(inputMappingsBegin, inputMappingsEnd, [&](const auto& inputMapping) {
processInputMapping(inputMapping, data, timestamp);
}
});
}

void MidiController::processInputMapping(const MidiInputMapping& mapping,
Expand Down

0 comments on commit 3718cc0

Please sign in to comment.