43 uint8_t firstNonVolumeParam;
44 uint8_t firstHybridParam;
45 uint8_t firstExpParam;
52 Patcher(
const Config& config, std::span<int32_t> source_values, std::span<int32_t> param_final_values,
54 : config(config), source_values_(source_values), param_final_values_(param_final_values), locks_(locks) {};
58 hasLocks() ? performInitialPatchingImpl<true>(sound, param_manager)
59 : performInitialPatchingImpl<false>(sound, param_manager);
61 void performPatching(uint32_t sources_changed, Sound& sound, ParamManagerForTimeline& param_manager) {
62 hasLocks() ? performPatchingImpl<true>(sources_changed, sound, param_manager)
63 : performPatchingImpl<false>(sources_changed, sound, param_manager);
65 void recalculateFinalValueForParamWithNoCables(int32_t param, Sound& sound,
66 ParamManagerForTimeline& param_manager) {
67 hasLocks() ? recalculateFinalValueForParamWithNoCablesImpl<true>(param, sound, param_manager)
68 : recalculateFinalValueForParamWithNoCablesImpl<false>(param, sound, param_manager);
72 [[nodiscard]]
bool hasLocks()
const {
return locks_ !=
nullptr && !locks_->empty(); }
73 template <
bool kLocks>
74 void performInitialPatchingImpl(Sound& sound, ParamManager& param_manager);
75 template <
bool kLocks>
76 void performPatchingImpl(uint32_t sources_changed, Sound& sound, ParamManagerForTimeline& param_manager);
77 template <
bool kLocks>
78 void recalculateFinalValueForParamWithNoCablesImpl(int32_t param, Sound& sound,
79 ParamManagerForTimeline& param_manager);
80 template <
bool kLocks>
81 int32_t presetValue(uint32_t param, Sound& sound, ParamManager& param_manager)
const;
83 int32_t combineCablesLinearForRangeParam(Destination
const* destination, ParamManager& param_manager);
84 template <
bool kLocks>
85 int32_t combineCablesLinear(Destination
const* destination, uint32_t param, Sound& sound,
86 ParamManager& param_manager);
87 template <
bool kLocks>
88 int32_t combineCablesExp(Destination
const* destination, uint32_t param, Sound& sound, ParamManager& param_manager);
89 static int32_t cableToLinearParamWithoutRangeAdjustment(int32_t running_total, int32_t source_value,
90 int32_t cable_strength);
91 static int32_t cableToLinearParam(int32_t running_total,
const PatchCable& cable, int32_t source_value,
92 int32_t cable_strength);
93 static int32_t cableToExpParamWithoutRangeAdjustment(int32_t running_total, int32_t source_value,
94 int32_t cable_strength);
95 static int32_t cableToExpParam(int32_t running_total,
const PatchCable& cable, int32_t source_value,
96 int32_t cable_strength);
99 std::span<int32_t> source_values_;
100 std::span<int32_t> param_final_values_;
101 const deluge::note_locks::LockSet* locks_;