clone45 / voxglitch

Modules for VCV Rack
GNU General Public License v3.0
99 stars 16 forks source link

Fix ambiguity of clamp use #124

Closed falkTX closed 2 years ago

falkTX commented 2 years ago

The clamp function from Rack has an int and float version. Which one was being called here was unclear because length is int but the other values are double. This can generate a compiler warning in some conditions.

In file included from voxglitch/src/DigitalSequencerXP.cpp:26:0:
voxglitch/src/DigitalSequencerXP/DigitalSequencerXP.hpp: In member function 'void DigitalSequencerXP::set_sequencer_lengths()':
voxglitch/src/DigitalSequencerXP/DigitalSequencerXP.hpp:585:41: error: call of overloaded 'clamp(int&, float, float)' is ambiguous
         length = clamp(length, 1.0, 32.0);
                                         ^

We can simply make all arguments an integer, which fixes the ambiguity.