Change numCC to uint16_t and increase the max number of ccs

This commit is contained in:
Paul Fd 2020-03-16 23:47:54 +01:00 committed by Paul Ferrand
parent bce6258827
commit f8801e78e4
4 changed files with 8 additions and 8 deletions

View file

@ -52,7 +52,7 @@ namespace config {
constexpr float A440 { 440.0 }; constexpr float A440 { 440.0 };
constexpr size_t powerHistoryLength { 16 }; constexpr size_t powerHistoryLength { 16 };
constexpr float voiceStealingThreshold { 0.00001f }; constexpr float voiceStealingThreshold { 0.00001f };
constexpr uint8_t numCCs { 143 }; constexpr uint16_t numCCs { 512 };
constexpr int chunkSize { 1024 }; constexpr int chunkSize { 1024 };
constexpr float defaultAmpEGRelease { 0.02f }; constexpr float defaultAmpEGRelease { 0.02f };
constexpr int filtersInPool { maxVoices * 2 }; constexpr int filtersInPool { maxVoices * 2 };

View file

@ -69,7 +69,7 @@ namespace Default
// Region logic: MIDI conditions // Region logic: MIDI conditions
constexpr Range<uint8_t> channelRange { 1, 16 }; constexpr Range<uint8_t> channelRange { 1, 16 };
constexpr Range<uint8_t> midiChannelRange { 0, 15 }; constexpr Range<uint8_t> midiChannelRange { 0, 15 };
constexpr Range<uint8_t> ccNumberRange { 0, config::numCCs }; constexpr Range<uint16_t> ccNumberRange { 0, config::numCCs };
constexpr Range<uint8_t> ccValueRange { 0, 127 }; constexpr Range<uint8_t> ccValueRange { 0, 127 };
constexpr uint8_t cc { 0 }; constexpr uint8_t cc { 0 };
constexpr Range<int> bendRange { -8192, 8192 }; constexpr Range<int> bendRange { -8192, 8192 };

View file

@ -104,7 +104,7 @@ void sfz::MidiState::reset(int delay) noexcept
void sfz::MidiState::resetAllControllers(int delay) noexcept void sfz::MidiState::resetAllControllers(int delay) noexcept
{ {
for (int idx = 0; idx < config::numCCs; idx++) for (unsigned idx = 0; idx < config::numCCs; idx++)
cc[idx] = 0; cc[idx] = 0;
pitchBend = 0; pitchBend = 0;

View file

@ -379,14 +379,14 @@ bool sfz::Synth::loadSfzFile(const fs::path& file)
noteActivationLists[note].push_back(region); noteActivationLists[note].push_back(region);
} }
for (auto cc = 0; cc < config::numCCs; cc++) { for (unsigned cc = 0; cc < config::numCCs; cc++) {
if (region->ccTriggers.contains(cc) || region->ccConditions.contains(cc)) if (region->ccTriggers.contains(cc) || region->ccConditions.contains(cc))
ccActivationLists[cc].push_back(region); ccActivationLists[cc].push_back(region);
} }
// Defaults // Defaults
for (int ccIndex = 0; ccIndex < config::numCCs; ccIndex++) { for (unsigned cc = 0; cc < config::numCCs; cc++) {
region->registerCC(ccIndex, resources.midiState.getCCValue(ccIndex)); region->registerCC(cc, resources.midiState.getCCValue(cc));
} }
if (defaultSwitch) { if (defaultSwitch) {
@ -953,12 +953,12 @@ void sfz::Synth::resetAllControllers(int delay) noexcept
resources.midiState.resetAllControllers(delay); resources.midiState.resetAllControllers(delay);
for (auto& voice: voices) { for (auto& voice: voices) {
voice->registerPitchWheel(delay, 0); voice->registerPitchWheel(delay, 0);
for (int cc = 0; cc < config::numCCs; ++cc) for (unsigned cc = 0; cc < config::numCCs; ++cc)
voice->registerCC(delay, cc, 0); voice->registerCC(delay, cc, 0);
} }
for (auto& region: regions) { for (auto& region: regions) {
for (int cc = 0; cc < config::numCCs; ++cc) for (unsigned cc = 0; cc < config::numCCs; ++cc)
region->registerCC(cc, 0); region->registerCC(cc, 0);
} }
} }