diff --git a/src/Funes.cpp b/src/Funes.cpp index 5325398a..d85206a4 100644 --- a/src/Funes.cpp +++ b/src/Funes.cpp @@ -166,18 +166,18 @@ struct Funes : SanguineModule { Funes() { config(PARAMS_COUNT, INPUTS_COUNT, OUTPUTS_COUNT, LIGHTS_COUNT); - configSwitch(PARAM_MODEL, 0.0f, 23.0f, 8.0f, "Model", funesModelLabels); - - configParam(PARAM_FREQUENCY, -4.0, 4.0, 0.0, "Frequency", " semitones", 0.f, 12.f); - configParam(PARAM_FREQUENCY_ROOT, -4.0, 4.0, 0.0, "Frequency Root", " semitones", 0.f, 12.f); - configParam(PARAM_HARMONICS, 0.0, 1.0, 0.5, "Harmonics", "%", 0.f, 100.f); - configParam(PARAM_TIMBRE, 0.0, 1.0, 0.5, "Timbre", "%", 0.f, 100.f); - configParam(PARAM_LPG_COLOR, 0.0, 1.0, 0.5, "Lowpass gate response", "%", 0.f, 100.f); - configParam(PARAM_MORPH, 0.0, 1.0, 0.5, "Morph", "%", 0.f, 100.f); - configParam(PARAM_LPG_DECAY, 0.0, 1.0, 0.5, "Lowpass gate decay", "%", 0.f, 100.f); - configParam(PARAM_TIMBRE_CV, -1.0, 1.0, 0.0, "Timbre CV"); - configParam(PARAM_FREQUENCY_CV, -1.0, 1.0, 0.0, "Frequency CV"); - configParam(PARAM_MORPH_CV, -1.0, 1.0, 0.0, "Morph CV"); + configSwitch(PARAM_MODEL, 0.f, 23.f, 8.f, "Model", funesModelLabels); + + configParam(PARAM_FREQUENCY, -4.f, 4.f, 0.f, "Frequency", " semitones", 0.f, 12.f); + configParam(PARAM_FREQUENCY_ROOT, -4.f, 4.f, 0.f, "Frequency Root", " semitones", 0.f, 12.f); + configParam(PARAM_HARMONICS, 0.f, 1.f, 0.5f, "Harmonics", "%", 0.f, 100.f); + configParam(PARAM_TIMBRE, 0.f, 1.f, 0.5f, "Timbre", "%", 0.f, 100.f); + configParam(PARAM_LPG_COLOR, 0.f, 1.f, 0.5f, "Lowpass gate response", "%", 0.f, 100.f); + configParam(PARAM_MORPH, 0.f, 1.f, 0.5f, "Morph", "%", 0.f, 100.f); + configParam(PARAM_LPG_DECAY, 0.f, 1.f, 0.5f, "Lowpass gate decay", "%", 0.f, 100.f); + configParam(PARAM_TIMBRE_CV, -1.f, 1.f, 0.f, "Timbre CV"); + configParam(PARAM_FREQUENCY_CV, -1.f, 1.f, 0.f, "Frequency CV"); + configParam(PARAM_MORPH_CV, -1.f, 1.f, 0.f, "Morph CV"); configSwitch(PARAM_FREQ_MODE, 0.f, 10.f, 10.f, "Frequency mode", funesFrequencyModes); configInput(INPUT_ENGINE, "Model"); diff --git a/src/aestus.cpp b/src/aestus.cpp index 4f09b1e3..8a3ebf36 100644 --- a/src/aestus.cpp +++ b/src/aestus.cpp @@ -118,11 +118,11 @@ struct Aestus : SanguineModule { config(PARAMS_COUNT, INPUTS_COUNT, OUTPUTS_COUNT, LIGHTS_COUNT); configButton(PARAM_MODE, aestusModelModeHeaders[0]); configButton(PARAM_RANGE, "Frequency range"); - configParam(PARAM_FREQUENCY, -48.0, 48.0, 0.0, "Main frequency"); - configParam(PARAM_FM, -12.0, 12.0, 0.0, "FM input attenuverter"); - configParam(PARAM_SHAPE, -1.0, 1.0, 0.0, "Shape"); - configParam(PARAM_SLOPE, -1.0, 1.0, 0.0, "Slope"); - configParam(PARAM_SMOOTHNESS, -1.0, 1.0, 0.0, "Smoothness"); + configParam(PARAM_FREQUENCY, -48.f, 48.f, 0.f, "Main frequency"); + configParam(PARAM_FM, -12.f, 12.f, 0.f, "FM input attenuverter"); + configParam(PARAM_SHAPE, -1.f, 1.f, 0.f, "Shape"); + configParam(PARAM_SLOPE, -1.f, 1.f, 0.f, "Slope"); + configParam(PARAM_SMOOTHNESS, -1.f, 1.f, 0.f, "Smoothness"); configSwitch(PARAM_MODEL, 0.f, 1.f, 0.f, "Module model", aestusMenuLabels); @@ -201,7 +201,7 @@ struct Aestus : SanguineModule { } // Level - uint16_t level = clamp(inputs[INPUT_LEVEL].getNormalVoltage(8.0) / 8.0f, 0.0f, 1.0f) + uint16_t level = clamp(inputs[INPUT_LEVEL].getNormalVoltage(8.f) / 8.f, 0.f, 1.f) * 65535; if (level < 32) { level = 0; diff --git a/src/anuli.cpp b/src/anuli.cpp index 215b23da..d9c9ac50 100644 --- a/src/anuli.cpp +++ b/src/anuli.cpp @@ -124,16 +124,16 @@ struct Anuli : SanguineModule { configParam(PARAM_POLYPHONY, 1.f, 4.f, 1.f, "Polyphony"); paramQuantities[PARAM_POLYPHONY]->snapEnabled = true; - configParam(PARAM_FREQUENCY, 0.0, 60.0, 30.0, "Frequency"); - configParam(PARAM_STRUCTURE, 0.0, 1.0, 0.5, "Structure"); - configParam(PARAM_BRIGHTNESS, 0.0, 1.0, 0.5, "Brightness"); - configParam(PARAM_DAMPING, 0.0, 1.0, 0.5, "Damping"); - configParam(PARAM_POSITION, 0.0, 1.0, 0.5, "Position"); - configParam(PARAM_BRIGHTNESS_MOD, -1.0, 1.0, 0.0, "Brightness CV"); - configParam(PARAM_FREQUENCY_MOD, -1.0, 1.0, 0.0, "Frequency CV"); - configParam(PARAM_DAMPING_MOD, -1.0, 1.0, 0.0, "Damping CV"); - configParam(PARAM_STRUCTURE_MOD, -1.0, 1.0, 0.0, "Structure CV"); - configParam(PARAM_POSITION_MOD, -1.0, 1.0, 0.0, "Position CV"); + configParam(PARAM_FREQUENCY, 0.f, 60.f, 30.f, "Frequency"); + configParam(PARAM_STRUCTURE, 0.f, 1.f, 0.5f, "Structure"); + configParam(PARAM_BRIGHTNESS, 0.f, 1.f, 0.5f, "Brightness"); + configParam(PARAM_DAMPING, 0.f, 1.f, 0.5f, "Damping"); + configParam(PARAM_POSITION, 0.f, 1.f, 0.5f, "Position"); + configParam(PARAM_BRIGHTNESS_MOD, -1.f, 1.f, 0.f, "Brightness CV"); + configParam(PARAM_FREQUENCY_MOD, -1.f, 1.f, 0.f, "Frequency CV"); + configParam(PARAM_DAMPING_MOD, -1.f, 1.f, 0.f, "Damping CV"); + configParam(PARAM_STRUCTURE_MOD, -1.f, 1.f, 0.f, "Structure CV"); + configParam(PARAM_POSITION_MOD, -1.f, 1.f, 0.f, "Position CV"); configInput(INPUT_BRIGHTNESS_CV, "Brightness"); configInput(INPUT_FREQUENCY_CV, "Frequency"); @@ -156,7 +156,7 @@ struct Anuli : SanguineModule { memset(&strummer[i], 0, sizeof(rings::Strummer)); memset(&part[i], 0, sizeof(rings::Part)); memset(&stringSynth[i], 0, sizeof(rings::StringSynthPart)); - strummer[i].Init(0.01, 44100.0 / 24); + strummer[i].Init(0.01f, 44100.f / 24); part[i].Init(reverbBuffer[i]); stringSynth[i].Init(reverbBuffer[i]); @@ -219,12 +219,12 @@ struct Anuli : SanguineModule { // Get input if (!inputBuffer[channel].full()) { dsp::Frame<1> frame; - frame.samples[0] = inputs[INPUT_IN].getVoltage(channel) / 5.0; + frame.samples[0] = inputs[INPUT_IN].getVoltage(channel) / 5.f; inputBuffer[channel].push(frame); } if (!bStrum[channel]) { - bStrum[channel] = inputs[INPUT_STRUM].getVoltage(channel) >= 1.0; + bStrum[channel] = inputs[INPUT_STRUM].getVoltage(channel) >= 1.f; } // Render frames diff --git a/src/apices.cpp b/src/apices.cpp index f655773c..5c215399 100644 --- a/src/apices.cpp +++ b/src/apices.cpp @@ -324,8 +324,8 @@ struct Apices : SanguineModule { // Peaks manual says output spec is 0..8V for envelopes and 10Vpp for audio/CV. // TODO Check the output values against an actual device. - outputs[OUT_1_OUTPUT].setVoltage(rescale(static_cast(frame.samples[0]), 0.0f, 65535.f, -8.0f, 8.0f)); - outputs[OUT_2_OUTPUT].setVoltage(rescale(static_cast(frame.samples[1]), 0.0f, 65535.f, -8.0f, 8.0f)); + outputs[OUT_1_OUTPUT].setVoltage(rescale(static_cast(frame.samples[0]), 0.f, 65535.f, -8.f, 8.f)); + outputs[OUT_2_OUTPUT].setVoltage(rescale(static_cast(frame.samples[1]), 0.f, 65535.f, -8.f, 8.f)); } } @@ -502,7 +502,7 @@ struct Apices : SanguineModule { int currentLight; switch (editMode) { case EDIT_MODE_FIRST: - lights[LIGHT_CHANNEL1].setBrightnessSmooth((flash == 1) ? 1.0f : 0.0f, sampleTime); + lights[LIGHT_CHANNEL1].setBrightnessSmooth((flash == 1) ? 1.f : 0.f, sampleTime); lights[LIGHT_CHANNEL2].setBrightnessSmooth(0.f, sampleTime); lights[LIGHT_CHANNEL_SELECT + 0].setBrightnessSmooth(1.f, sampleTime); lights[LIGHT_CHANNEL_SELECT + 1].setBrightnessSmooth(0.f, sampleTime); @@ -515,7 +515,7 @@ struct Apices : SanguineModule { break; case EDIT_MODE_SECOND: lights[LIGHT_CHANNEL1].setBrightnessSmooth(0.f, sampleTime); - lights[LIGHT_CHANNEL2].setBrightnessSmooth((flash == 1 || flash == 3) ? 1.0f : 0.0f, sampleTime); + lights[LIGHT_CHANNEL2].setBrightnessSmooth((flash == 1 || flash == 3) ? 1.f : 0.f, sampleTime); lights[LIGHT_CHANNEL_SELECT + 0].setBrightnessSmooth(1.f, sampleTime); lights[LIGHT_CHANNEL_SELECT + 1].setBrightnessSmooth(1.f, sampleTime); for (int i = 0; i < 4; i++) { @@ -561,23 +561,23 @@ struct Apices : SanguineModule { break; } - lights[LIGHT_SPLIT_MODE].setBrightnessSmooth((editMode == EDIT_MODE_SPLIT) ? 1.0f : 0.0f, sampleTime); - lights[LIGHT_EXPERT_MODE].setBrightnessSmooth((editMode & 2) ? 1.0F : 0.F, sampleTime); + lights[LIGHT_SPLIT_MODE].setBrightnessSmooth((editMode == EDIT_MODE_SPLIT) ? 1.f : 0.f, sampleTime); + lights[LIGHT_EXPERT_MODE].setBrightnessSmooth((editMode & 2) ? 1.F : 0.F, sampleTime); ProcessorFunction currentProcessorFunction = getProcessorFunction(); for (int i = 0; i < 4; i++) { currentLight = LIGHT_FUNCTION_1 + i; switch (lightStates[currentProcessorFunction][i]) { case LIGHT_ON: { - lights[currentLight].setBrightnessSmooth(1.0f, sampleTime); + lights[currentLight].setBrightnessSmooth(1.f, sampleTime); break; } case LIGHT_OFF: { - lights[currentLight].setBrightnessSmooth(0.0f, sampleTime); + lights[currentLight].setBrightnessSmooth(0.f, sampleTime); break; } case LIGHT_BLINK: { - lights[currentLight].setBrightnessSmooth(getSystemTimeMs() & 256 ? 0.0f : 1.f, sampleTime); + lights[currentLight].setBrightnessSmooth(getSystemTimeMs() & 256 ? 0.f : 1.f, sampleTime); break; } default: { @@ -616,7 +616,7 @@ struct Apices : SanguineModule { if (editMode == EDIT_MODE_SPLIT || editMode == EDIT_MODE_TWIN) { uint8_t pattern = processors[0].number_station().digit() ^ processors[1].number_station().digit(); for (size_t i = 0; i < 4; ++i) { - lights[LIGHT_FUNCTION_1 + i].setBrightness((pattern & 1) ? 1.0f : 0.0f); + lights[LIGHT_FUNCTION_1 + i].setBrightness((pattern & 1) ? 1.f : 0.f); pattern = pattern >> 1; } } @@ -624,14 +624,14 @@ struct Apices : SanguineModule { else if (editMode == EDIT_MODE_FIRST && channel1IsStation) { int digit = processors[0].number_station().digit(); for (size_t i = 0; i < 4; i++) { - lights[LIGHT_FUNCTION_1 + i].setBrightness((i & digit) ? 1.0f : 0.0f); + lights[LIGHT_FUNCTION_1 + i].setBrightness((i & digit) ? 1.f : 0.f); } } // Ibid else if (editMode == EDIT_MODE_SECOND && channel2IsStation) { uint8_t digit = processors[1].number_station().digit(); for (size_t i = 0; i < 4; i++) { - lights[LIGHT_FUNCTION_1 + i].setBrightness((i & digit) ? 1.0f : 0.0f); + lights[LIGHT_FUNCTION_1 + i].setBrightness((i & digit) ? 1.f : 0.f); } } if (channel1IsStation) { @@ -642,8 +642,8 @@ struct Apices : SanguineModule { } } - lights[LIGHT_TRIGGER_1].setBrightnessSmooth(rescale(static_cast(buttonBrightness[0]), 0.0f, 255.0f, 0.0f, 1.0f), sampleTime); - lights[LIGHT_TRIGGER_2].setBrightnessSmooth(rescale(static_cast(buttonBrightness[1]), 0.0f, 255.0f, 0.0f, 1.0f), sampleTime); + lights[LIGHT_TRIGGER_1].setBrightnessSmooth(rescale(static_cast(buttonBrightness[0]), 0.f, 255.f, 0.f, 1.f), sampleTime); + lights[LIGHT_TRIGGER_2].setBrightnessSmooth(rescale(static_cast(buttonBrightness[1]), 0.f, 255.f, 0.f, 1.f), sampleTime); } void onReset() override { diff --git a/src/contextus.cpp b/src/contextus.cpp index 4e92aa69..fbb227cc 100644 --- a/src/contextus.cpp +++ b/src/contextus.cpp @@ -307,21 +307,21 @@ struct Contextus : SanguineModule { configSwitch(PARAM_MODEL, 0.f, renaissance::MACRO_OSC_SHAPE_LAST_ACCESSIBLE_FROM_META, 0.f, "Model", contextusMenuLabels); - configParam(PARAM_MODULATION, -1.0, 1.0, 0.0, "Modulation"); - configParam(PARAM_COARSE, -5.0, 3.0, -1.0, "Coarse frequency", " semitones", 0.f, 12.f, 12.f); - configParam(PARAM_FINE, -1.0, 1.0, 0.0, "Fine frequency", " semitones"); - configParam(PARAM_ATTACK, 0.0, 15.0, 0.0, "Attack"); + configParam(PARAM_MODULATION, -1.f, 1.f, 0.f, "Modulation"); + configParam(PARAM_COARSE, -5.f, 3.f, -1.f, "Coarse frequency", " semitones", 0.f, 12.f, 12.f); + configParam(PARAM_FINE, -1.f, 1.f, 0.f, "Fine frequency", " semitones"); + configParam(PARAM_ATTACK, 0.f, 15.f, 0.f, "Attack"); paramQuantities[PARAM_ATTACK]->snapEnabled = true; - configParam(PARAM_AD_TIMBRE, 0.0, 15.f, 0.0, "Timbre AD"); + configParam(PARAM_AD_TIMBRE, 0.f, 15.f, 0.f, "Timbre AD"); paramQuantities[PARAM_AD_TIMBRE]->snapEnabled = true; - configParam(PARAM_TIMBRE, 0.0, 1.0, 0.5, "Timbre", "%", 0.f, 100.f); - configParam(PARAM_ROOT, 0.0, 11.0, 0.0, "Quantizer root note", "", 0.f, 1.0, 1.f); + configParam(PARAM_TIMBRE, 0.f, 1.f, 0.5f, "Timbre", "%", 0.f, 100.f); + configParam(PARAM_ROOT, 0.f, 11.f, 0.f, "Quantizer root note", "", 0.f, 1.f, 1.f); paramQuantities[PARAM_ROOT]->snapEnabled = true; - configParam(PARAM_SCALE, 0.0, 48.0, 0.0, "Quantizer scale"); + configParam(PARAM_SCALE, 0.f, 48.f, 0.f, "Quantizer scale"); paramQuantities[PARAM_SCALE]->snapEnabled = true; - configParam(PARAM_DECAY, 0.0, 15.f, 7.0, "Decay"); + configParam(PARAM_DECAY, 0.f, 15.f, 7.f, "Decay"); paramQuantities[PARAM_DECAY]->snapEnabled = true; configParam(PARAM_AD_COLOR, 0.f, 15.f, 0.f, "Color AD"); @@ -329,12 +329,12 @@ struct Contextus : SanguineModule { configParam(PARAM_AD_MODULATION, 0.f, 15.f, 0.f, "FM AD"); paramQuantities[PARAM_AD_MODULATION]->snapEnabled = true; - configParam(PARAM_COLOR, 0.0, 1.0, 0.5, "Color", "%", 0.f, 100.f); - configParam(PARAM_PITCH_OCTAVE, 0.0, 4.0, 2.f, "Octave", "", 0.f, 1.f, -2.f); + configParam(PARAM_COLOR, 0.f, 1.f, 0.5f, "Color", "%", 0.f, 100.f); + configParam(PARAM_PITCH_OCTAVE, 0.f, 4.f, 2.f, "Octave", "", 0.f, 1.f, -2.f); paramQuantities[PARAM_PITCH_OCTAVE]->snapEnabled = true; configParam(PARAM_PITCH_RANGE, 0.f, 4.f, 0.f, "Pitch range"); paramQuantities[PARAM_PITCH_RANGE]->snapEnabled = true; - configParam(PARAM_FM, -1.0, 1.0, 0.0, "FM"); + configParam(PARAM_FM, -1.f, 1.f, 0.f, "FM"); configParam(PARAM_TRIGGER_DELAY, 0.f, 6.f, 0.f, "Trigger delay"); paramQuantities[PARAM_TRIGGER_DELAY]->snapEnabled = true; @@ -414,7 +414,7 @@ struct Contextus : SanguineModule { settings[channel].invert_encoder = false; // Trigger - bool bTriggerInput = inputs[INPUT_TRIGGER].getVoltage(channel) >= 1.0; + bool bTriggerInput = inputs[INPUT_TRIGGER].getVoltage(channel) >= 1.f; if (!bLastTrig[channel] && bTriggerInput) { bFlagTriggerDetected[channel] = bTriggerInput; } @@ -456,7 +456,7 @@ struct Contextus : SanguineModule { // Set model int model = params[PARAM_MODEL].getValue(); if (inputs[INPUT_META].isConnected()) { - model += roundf(inputs[INPUT_META].getVoltage(channel) / 10.0 * renaissance::MACRO_OSC_SHAPE_LAST_ACCESSIBLE_FROM_META); + model += roundf(inputs[INPUT_META].getVoltage(channel) / 10.f * renaissance::MACRO_OSC_SHAPE_LAST_ACCESSIBLE_FROM_META); } settings[channel].shape = clamp(model, 0, renaissance::MACRO_OSC_SHAPE_LAST_ACCESSIBLE_FROM_META); @@ -465,25 +465,25 @@ struct Contextus : SanguineModule { osc[channel].set_shape(renaissance::MacroOscillatorShape(settings[channel].shape)); // Set timbre/modulation - float timbre = params[PARAM_TIMBRE].getValue() + params[PARAM_MODULATION].getValue() * inputs[INPUT_TIMBRE].getVoltage(channel) / 5.0; - float modulation = params[PARAM_COLOR].getValue() + inputs[INPUT_COLOR].getVoltage(channel) / 5.0; + float timbre = params[PARAM_TIMBRE].getValue() + params[PARAM_MODULATION].getValue() * inputs[INPUT_TIMBRE].getVoltage(channel) / 5.f; + float modulation = params[PARAM_COLOR].getValue() + inputs[INPUT_COLOR].getVoltage(channel) / 5.f; - timbre += adValue / 65535. * settings[channel].ad_timbre / 16.; - modulation += adValue / 65535. * settings[channel].ad_color / 16.; + timbre += adValue / 65535.f * settings[channel].ad_timbre / 16.f; + modulation += adValue / 65535.f * settings[channel].ad_color / 16.f; - int16_t param1 = math::rescale(clamp(timbre, 0.0, 1.0), 0.0, 1.0, 0, INT16_MAX); - int16_t param2 = math::rescale(clamp(modulation, 0.0, 1.0), 0.0, 1.0, 0, INT16_MAX); + int16_t param1 = math::rescale(clamp(timbre, 0.f, 1.f), 0.f, 1.f, 0, INT16_MAX); + int16_t param2 = math::rescale(clamp(modulation, 0.f, 1.f), 0.f, 1.f, 0, INT16_MAX); osc[channel].set_parameters(param1, param2); // Set pitch - float pitchV = inputs[INPUT_PITCH].getVoltage(channel) + params[PARAM_COARSE].getValue() + params[PARAM_FINE].getValue() / 12.0; + float pitchV = inputs[INPUT_PITCH].getVoltage(channel) + params[PARAM_COARSE].getValue() + params[PARAM_FINE].getValue() / 12.f; pitchV += fm; if (bLowCpu) { - pitchV += log2f(96000.0 / args.sampleRate); + pitchV += log2f(96000.f / args.sampleRate); } - int32_t pitch = (pitchV * 12.0 + 60) * 128; + int32_t pitch = (pitchV * 12.f + 60) * 128; // pitch_range if (settings[channel].pitch_range == renaissance::PITCH_RANGE_EXTERNAL || settings[channel].pitch_range == renaissance::PITCH_RANGE_LFO) { @@ -556,7 +556,7 @@ struct Contextus : SanguineModule { // Sample rate convert dsp::Frame<1> in[24]; for (int i = 0; i < 24; i++) { - in[i].samples[0] = renderBuffer[i] / 32768.0; + in[i].samples[0] = renderBuffer[i] / 32768.f; } sampleRateConverter[channel].setRates(96000, args.sampleRate); @@ -568,7 +568,7 @@ struct Contextus : SanguineModule { else { for (int i = 0; i < 24; i++) { dsp::Frame<1> f; - f.samples[0] = renderBuffer[i] / 32768.0; + f.samples[0] = renderBuffer[i] / 32768.f; drbOutputBuffer[channel].push(f); } } @@ -577,7 +577,7 @@ struct Contextus : SanguineModule { // Output if (!drbOutputBuffer[channel].empty()) { dsp::Frame<1> f = drbOutputBuffer[channel].shift(); - outputs[OUTPUT_OUT].setVoltage(5.0 * f.samples[0], channel); + outputs[OUTPUT_OUT].setVoltage(5.f * f.samples[0], channel); } } // Channels diff --git a/src/distortiones.cpp b/src/distortiones.cpp index f5aeece2..8e00ffc6 100644 --- a/src/distortiones.cpp +++ b/src/distortiones.cpp @@ -65,14 +65,14 @@ struct Distortiones : SanguineModule { configButton(PARAM_MODE_SWITCH, "Mode select"); - configParam(PARAM_ALGORITHM, 0.0, 8.0, 0.0, "Algorithm"); + configParam(PARAM_ALGORITHM, 0.f, 8.f, 0.f, "Algorithm"); configParam(PARAM_CARRIER, 0.f, 3.f, 0.f, "Internal oscillator mode"); - configParam(PARAM_TIMBRE, 0.0, 1.0, 0.5, "Timbre", "%", 0, 100); + configParam(PARAM_TIMBRE, 0.f, 1.f, 0.5f, "Timbre", "%", 0, 100); - configParam(PARAM_LEVEL1, 0.0, 1.0, 1.0, "External oscillator amplitude / internal oscillator frequency", "%", 0, 100); - configParam(PARAM_LEVEL2, 0.0, 1.0, 1.0, "Modulator amplitude", "%", 0, 100); + configParam(PARAM_LEVEL1, 0.f, 1.f, 1.f, "External oscillator amplitude / internal oscillator frequency", "%", 0, 100); + configParam(PARAM_LEVEL2, 0.f, 1.f, 1.f, "Modulator amplitude", "%", 0, 100); configInput(INPUT_LEVEL1, "Level 1"); configInput(INPUT_LEVEL2, "Level 2"); @@ -90,7 +90,7 @@ struct Distortiones : SanguineModule { for (int i = 0; i < PORT_MAX_CHANNELS; i++) { memset(&distortionesModulator[i], 0, sizeof(distortiones::DistortionesModulator)); - distortionesModulator[i].Init(96000.0f); + distortionesModulator[i].Init(96000.f); distortionesParameters[i] = distortionesModulator[i].mutable_parameters(); } @@ -138,7 +138,7 @@ struct Distortiones : SanguineModule { } else { lastAlgorithmValue = params[PARAM_ALGORITHM].getValue(); - algorithmValue = lastAlgorithmValue / 8.0; + algorithmValue = lastAlgorithmValue / 8.f; } for (int channel = 0; channel < channelCount; channel++) { @@ -182,26 +182,26 @@ struct Distortiones : SanguineModule { if (!bModeSwitchEnabled) { distortionesParameters[channel]->raw_algorithm_pot = algorithmValue; - distortionesParameters[channel]->raw_algorithm_cv = clamp(f4Voltages[2], -1.0f, 1.0f); + distortionesParameters[channel]->raw_algorithm_cv = clamp(f4Voltages[2], -1.f, 1.f); - distortionesParameters[channel]->modulation_algorithm = clamp(algorithmValue + f4Voltages[2], 0.0f, 1.0f); + distortionesParameters[channel]->modulation_algorithm = clamp(algorithmValue + f4Voltages[2], 0.f, 1.f); distortionesParameters[channel]->raw_algorithm = distortionesParameters[channel]->modulation_algorithm; } - distortionesParameters[channel]->modulation_parameter = clamp(params[PARAM_TIMBRE].getValue() + f4Voltages[3], 0.0f, 1.0f); + distortionesParameters[channel]->modulation_parameter = clamp(params[PARAM_TIMBRE].getValue() + f4Voltages[3], 0.f, 1.f); - distortionesParameters[channel]->note = 60.0 * params[PARAM_LEVEL1].getValue() + 12.0 - * inputs[INPUT_LEVEL1].getNormalVoltage(2.0, channel) + 12.0; - distortionesParameters[channel]->note += log2f(96000.0f * args.sampleTime) * 12.0f; + distortionesParameters[channel]->note = 60.f * params[PARAM_LEVEL1].getValue() + 12.f + * inputs[INPUT_LEVEL1].getNormalVoltage(2.f, channel) + 12.f; + distortionesParameters[channel]->note += log2f(96000.f * args.sampleTime) * 12.f; distortionesModulator[channel].Process(inputFrames[channel], outputFrames[channel], 60); } - inputFrames[channel][frame[channel]].l = clamp(int(inputs[INPUT_CARRIER].getVoltage(channel) / 16.0 * 32768), -32768, 32767); - inputFrames[channel][frame[channel]].r = clamp(int(inputs[INPUT_MODULATOR].getVoltage(channel) / 16.0 * 32768), -32768, 32767); + inputFrames[channel][frame[channel]].l = clamp(int(inputs[INPUT_CARRIER].getVoltage(channel) / 16.f * 32768), -32768, 32767); + inputFrames[channel][frame[channel]].r = clamp(int(inputs[INPUT_MODULATOR].getVoltage(channel) / 16.f * 32768), -32768, 32767); - outputs[OUTPUT_MODULATOR].setVoltage(float(outputFrames[channel][frame[channel]].l) / 32768 * 5.0, channel); - outputs[OUTPUT_AUX].setVoltage(float(outputFrames[channel][frame[channel]].r) / 32768 * 5.0, channel); + outputs[OUTPUT_MODULATOR].setVoltage(float(outputFrames[channel][frame[channel]].l) / 32768 * 5.f, channel); + outputs[OUTPUT_AUX].setVoltage(float(outputFrames[channel][frame[channel]].r) / 32768 * 5.f, channel); } outputs[OUTPUT_MODULATOR].setChannels(channelCount); @@ -209,9 +209,9 @@ struct Distortiones : SanguineModule { if (isLightsTurn) { lights[LIGHT_CARRIER + 0].value = (distortionesParameters[0]->carrier_shape == 1 - || distortionesParameters[0]->carrier_shape == 2) ? 1.0 : 0.0; + || distortionesParameters[0]->carrier_shape == 2) ? 1.f : 0.f; lights[LIGHT_CARRIER + 1].value = (distortionesParameters[0]->carrier_shape == 2 - || distortionesParameters[0]->carrier_shape == 3) ? 1.0 : 0.0; + || distortionesParameters[0]->carrier_shape == 3) ? 1.f : 0.f; lights[LIGHT_MODE_SWITCH].setBrightness(bModeSwitchEnabled ? 1.f : 0.f); @@ -229,7 +229,7 @@ struct Distortiones : SanguineModule { palette = paletteWarpsDefault; } - zone = 8.0f * distortionesParameters[0]->modulation_algorithm; + zone = 8.f * distortionesParameters[0]->modulation_algorithm; MAKE_INTEGRAL_FRACTIONAL(zone); int zone_fractional_i = static_cast(zone_fractional * 256); for (int i = 0; i < 3; i++) { diff --git a/src/etesia.cpp b/src/etesia.cpp index 02817649..7ee9f95f 100644 --- a/src/etesia.cpp +++ b/src/etesia.cpp @@ -126,7 +126,7 @@ struct Etesia : SanguineModule { etesia::PlaybackMode lastPlaybackMode = etesia::PLAYBACK_MODE_GRANULAR; etesia::PlaybackMode lastLEDPlaybackMode = etesia::PLAYBACK_MODE_GRANULAR; - float freezeLight = 0.0; + float freezeLight = 0.f; float lastBlend; float lastSpread; @@ -164,22 +164,22 @@ struct Etesia : SanguineModule { configParam(PARAM_MODE, 0.f, 5.f, 0.f, "Mode", "", 0.f, 1.f, 1.f); paramQuantities[PARAM_MODE]->snapEnabled = true; - configParam(PARAM_POSITION, 0.0, 1.0, 0.5, "Grain position", "%", 0.f, 100.f); + configParam(PARAM_POSITION, 0.f, 1.f, 0.5f, "Grain position", "%", 0.f, 100.f); configInput(INPUT_POSITION, "Grain position CV"); - configParam(PARAM_DENSITY, 0.0, 1.0, 0.5, "Grain density", "%", 0.f, 100.f); + configParam(PARAM_DENSITY, 0.f, 1.f, 0.5f, "Grain density", "%", 0.f, 100.f); configInput(INPUT_DENSITY, "Grain density CV"); - configParam(PARAM_SIZE, 0.0, 1.0, 0.5, "Grain size", "%", 0.f, 100.f); + configParam(PARAM_SIZE, 0.f, 1.f, 0.5f, "Grain size", "%", 0.f, 100.f); configInput(INPUT_SIZE, "Grain size CV"); - configParam(PARAM_TEXTURE, 0.0, 1.0, 0.5, "Grain texture", "%", 0.f, 100.f); + configParam(PARAM_TEXTURE, 0.f, 1.f, 0.5f, "Grain texture", "%", 0.f, 100.f); configInput(INPUT_TEXTURE, "Grain texture CV"); - configParam(PARAM_PITCH, -2.0, 2.0, 0.0, "Grain pitch"); + configParam(PARAM_PITCH, -2.f, 2.f, 0.f, "Grain pitch"); configInput(INPUT_PITCH, "Pitch (1V/oct)"); - configParam(PARAM_BLEND, 0.0, 1.0, 0.5, "Dry/wet", "%", 0.f, 100.f); + configParam(PARAM_BLEND, 0.f, 1.f, 0.5f, "Dry/wet", "%", 0.f, 100.f); configInput(INPUT_BLEND, "Dry/wet CV"); configInput(INPUT_TRIGGER, "Trigger"); @@ -209,8 +209,8 @@ struct Etesia : SanguineModule { lastBlend = 0.5f; lastSpread = 0.5f; - lastFeedback = 0.5; - lastReverb = 0.5; + lastFeedback = 0.5f; + lastReverb = 0.5f; lastHiFi = 1; lastStereo = 1; @@ -239,14 +239,14 @@ struct Etesia : SanguineModule { // Get input if (!inputBuffer.full()) { - inputFrame.samples[0] = inputs[INPUT_LEFT].getVoltageSum() * params[PARAM_IN_GAIN].getValue() / 5.0; + inputFrame.samples[0] = inputs[INPUT_LEFT].getVoltageSum() * params[PARAM_IN_GAIN].getValue() / 5.f; inputFrame.samples[1] = inputs[INPUT_RIGHT].isConnected() ? inputs[INPUT_RIGHT].getVoltageSum() - * params[PARAM_IN_GAIN].getValue() / 5.0 : inputFrame.samples[0]; + * params[PARAM_IN_GAIN].getValue() / 5.f : inputFrame.samples[0]; inputBuffer.push(inputFrame); } // Trigger - bTriggered = inputs[INPUT_TRIGGER].getVoltage() >= 1.0; + bTriggered = inputs[INPUT_TRIGGER].getVoltage() >= 1.f; etesia::Parameters* etesiaParameters = etesiaProcessor->mutable_parameters(); @@ -291,17 +291,17 @@ struct Etesia : SanguineModule { etesiaParameters->trigger = bTriggered; etesiaParameters->gate = bTriggered; - etesiaParameters->freeze = (inputs[INPUT_FREEZE].getVoltage() >= 1.0 || frozen); - etesiaParameters->position = clamp(params[PARAM_POSITION].getValue() + inputs[INPUT_POSITION].getVoltage() / 5.0, 0.0f, 1.0f); - etesiaParameters->size = clamp(params[PARAM_SIZE].getValue() + inputs[INPUT_SIZE].getVoltage() / 5.0, 0.0f, 1.0f); - etesiaParameters->pitch = clamp((params[PARAM_PITCH].getValue() + inputs[INPUT_PITCH].getVoltage()) * 12.0, -48.0f, 48.0f); - etesiaParameters->density = clamp(params[PARAM_DENSITY].getValue() + inputs[INPUT_DENSITY].getVoltage() / 5.0, 0.0f, 1.0f); - etesiaParameters->texture = clamp(params[PARAM_TEXTURE].getValue() + inputs[INPUT_TEXTURE].getVoltage() / 5.0, 0.0f, 1.0f); - float blend = clamp(params[PARAM_BLEND].getValue() + inputs[INPUT_BLEND].getVoltage() / 5.0, 0.0f, 1.0f); + etesiaParameters->freeze = (inputs[INPUT_FREEZE].getVoltage() >= 1.f || frozen); + etesiaParameters->position = clamp(params[PARAM_POSITION].getValue() + inputs[INPUT_POSITION].getVoltage() / 5.f, 0.f, 1.f); + etesiaParameters->size = clamp(params[PARAM_SIZE].getValue() + inputs[INPUT_SIZE].getVoltage() / 5.f, 0.f, 1.f); + etesiaParameters->pitch = clamp((params[PARAM_PITCH].getValue() + inputs[INPUT_PITCH].getVoltage()) * 12.f, -48.f, 48.f); + etesiaParameters->density = clamp(params[PARAM_DENSITY].getValue() + inputs[INPUT_DENSITY].getVoltage() / 5.f, 0.f, 1.f); + etesiaParameters->texture = clamp(params[PARAM_TEXTURE].getValue() + inputs[INPUT_TEXTURE].getVoltage() / 5.f, 0.f, 1.f); + float blend = clamp(params[PARAM_BLEND].getValue() + inputs[INPUT_BLEND].getVoltage() / 5.f, 0.f, 1.f); etesiaParameters->dry_wet = blend; - etesiaParameters->stereo_spread = clamp(params[PARAM_SPREAD].getValue() + inputs[INPUT_SPREAD].getVoltage() / 5.0, 0.0f, 1.0f); - etesiaParameters->feedback = clamp(params[PARAM_FEEDBACK].getValue() + inputs[INPUT_FEEDBACK].getVoltage() / 5.0, 0.0f, 1.0f); - etesiaParameters->reverb = clamp(params[PARAM_REVERB].getValue() + inputs[INPUT_REVERB].getVoltage() / 5.0, 0.0f, 1.0f); + etesiaParameters->stereo_spread = clamp(params[PARAM_SPREAD].getValue() + inputs[INPUT_SPREAD].getVoltage() / 5.f, 0.f, 1.f); + etesiaParameters->feedback = clamp(params[PARAM_FEEDBACK].getValue() + inputs[INPUT_FEEDBACK].getVoltage() / 5.f, 0.f, 1.f); + etesiaParameters->reverb = clamp(params[PARAM_REVERB].getValue() + inputs[INPUT_REVERB].getVoltage() / 5.f, 0.f, 1.f); etesiaParameters->granular.reverse = params[PARAM_REVERSE].getValue(); etesia::ShortFrame output[32]; @@ -325,14 +325,14 @@ struct Etesia : SanguineModule { } } - lights[LIGHT_FREEZE].setBrightnessSmooth(etesiaParameters->freeze ? 1.0 : 0.0, args.sampleTime); + lights[LIGHT_FREEZE].setBrightnessSmooth(etesiaParameters->freeze ? 1.f : 0.f, args.sampleTime); // Convert output buffer { dsp::Frame<2> outputFrames[32]; for (int i = 0; i < 32; i++) { - outputFrames[i].samples[0] = output[i].l / 32768.0; - outputFrames[i].samples[1] = output[i].r / 32768.0; + outputFrames[i].samples[0] = output[i].l / 32768.f; + outputFrames[i].samples[1] = output[i].r / 32768.f; } outputSrc.setRates(32000, args.sampleRate); @@ -349,10 +349,10 @@ struct Etesia : SanguineModule { if (!outputBuffer.empty()) { outputFrame = outputBuffer.shift(); if (outputs[OUTPUT_LEFT].isConnected()) { - outputs[OUTPUT_LEFT].setVoltage(5.0 * outputFrame.samples[0]); + outputs[OUTPUT_LEFT].setVoltage(5.f * outputFrame.samples[0]); } if (outputs[OUTPUT_RIGHT].isConnected()) { - outputs[OUTPUT_RIGHT].setVoltage(5.0 * outputFrame.samples[1]); + outputs[OUTPUT_RIGHT].setVoltage(5.f * outputFrame.samples[1]); } } @@ -373,9 +373,9 @@ struct Etesia : SanguineModule { vuMeter.process(args.sampleTime, fmaxf(fabsf(lightFrame.samples[0]), fabsf(lightFrame.samples[1]))); - lights[LIGHT_FREEZE].setBrightness(etesiaParameters->freeze ? 0.75 : 0.0); + lights[LIGHT_FREEZE].setBrightness(etesiaParameters->freeze ? 0.75f : 0.f); - lights[LIGHT_REVERSE].setBrightness(etesiaParameters->granular.reverse ? 0.75 : 0.0); + lights[LIGHT_REVERSE].setBrightness(etesiaParameters->granular.reverse ? 0.75f : 0.f); if (params[PARAM_BLEND].getValue() != lastBlend || params[PARAM_SPREAD].getValue() != lastSpread || params[PARAM_FEEDBACK].getValue() != lastFeedback || params[PARAM_REVERB].getValue() != lastReverb) { diff --git a/src/explorator.cpp b/src/explorator.cpp index 917478a3..0ebf5b59 100644 --- a/src/explorator.cpp +++ b/src/explorator.cpp @@ -242,7 +242,7 @@ struct Explorator : SanguineModule { } lights[LIGHT_1_TO_3 + 0].setBrightnessSmooth(math::rescale(-voltage1to3Sum, 0.f, 10.f, 0.f, 1.f), sampleTime); lights[LIGHT_1_TO_3 + 1].setBrightnessSmooth(math::rescale(voltage1to3Sum, 0.f, 10.f, 0.f, 1.f), sampleTime); - lights[LIGHT_1_TO_3 + 2].setBrightnessSmooth(0.0f, sampleTime); + lights[LIGHT_1_TO_3 + 2].setBrightnessSmooth(0.f, sampleTime); } else { voltage1to3Sum = clamp(inputs[INPUT_1_TO_3].getVoltageSum() / channels1to3, -10.f, 10.f); @@ -262,7 +262,7 @@ struct Explorator : SanguineModule { } lights[LIGHT_SIGN + 0].setBrightnessSmooth(math::rescale(-voltageSignSum, 0.f, 10.f, 0.f, 1.f), sampleTime); lights[LIGHT_SIGN + 1].setBrightnessSmooth(math::rescale(voltageSignSum, 0.f, 10.f, 0.f, 1.f), sampleTime); - lights[LIGHT_SIGN + 2].setBrightnessSmooth(0.0f, sampleTime); + lights[LIGHT_SIGN + 2].setBrightnessSmooth(0.f, sampleTime); } else { voltageSignSum = clamp(inputs[INPUT_SIGN].getVoltageSum() / channelsSign, -10.f, 10.f); @@ -282,7 +282,7 @@ struct Explorator : SanguineModule { } lights[LIGHT_2_TO_2 + 0].setBrightnessSmooth(math::rescale(-voltage2to2Sum, 0.f, 10.f, 0.f, 1.f), sampleTime); lights[LIGHT_2_TO_2 + 1].setBrightnessSmooth(math::rescale(voltage2to2Sum, 0.f, 10.f, 0.f, 1.f), sampleTime); - lights[LIGHT_2_TO_2 + 2].setBrightnessSmooth(0.0f, sampleTime); + lights[LIGHT_2_TO_2 + 2].setBrightnessSmooth(0.f, sampleTime); } else { voltage2to2Sum = (clamp((inputs[INPUT_2_TO_2_A].getVoltageSum() + inputs[INPUT_2_TO_2_B].getVoltageSum()) / channels2to2, -10.f, 10.f)); @@ -302,7 +302,7 @@ struct Explorator : SanguineModule { } lights[LIGHT_LOGIC + 0].setBrightnessSmooth(math::rescale(-voltageLogicSum, 0.f, 10.f, 0.f, 1.f), sampleTime); lights[LIGHT_LOGIC + 1].setBrightnessSmooth(math::rescale(voltageLogicSum, 0.f, 10.f, 0.f, 1.f), sampleTime); - lights[LIGHT_LOGIC + 2].setBrightnessSmooth(0.0f, sampleTime); + lights[LIGHT_LOGIC + 2].setBrightnessSmooth(0.f, sampleTime); } else { voltageLogicSum = clamp((inputs[INPUT_LOGIC_A].getVoltageSum() + inputs[INPUT_LOGIC_B].getVoltageSum()) / channelsLogic, -10.f, 10.f); @@ -322,13 +322,13 @@ struct Explorator : SanguineModule { voltage3to1Out = clamp(inputs[INPUT_3_TO_1_A].getVoltage() + inputs[INPUT_3_TO_1_B].getVoltage() + inputs[INPUT_3_TO_1_C].getVoltage(), -10.f, 10.f); } else { - voltage3to1Out = clamp((inputs[INPUT_3_TO_1_A].getVoltage() + inputs[INPUT_3_TO_1_B].getVoltage() + inputs[INPUT_3_TO_1_C].getVoltage()) / 3, -10.f, 10.f); + voltage3to1Out = clamp((inputs[INPUT_3_TO_1_A].getVoltage() + inputs[INPUT_3_TO_1_B].getVoltage() + inputs[INPUT_3_TO_1_C].getVoltage()) / 3.f, -10.f, 10.f); } } lights[LIGHT_3_TO_1 + 0].setBrightnessSmooth(math::rescale(-voltage3to1Out, 0.f, 10.f, 0.f, 1.f), sampleTime); lights[LIGHT_3_TO_1 + 1].setBrightnessSmooth(math::rescale(voltage3to1Out, 0.f, 10.f, 0.f, 1.f), sampleTime); - lights[LIGHT_3_TO_1 + 2].setBrightnessSmooth(0.0f, sampleTime); + lights[LIGHT_3_TO_1 + 2].setBrightnessSmooth(0.f, sampleTime); } else { if (!attenuate3to1) { @@ -359,7 +359,7 @@ struct Explorator : SanguineModule { lights[LIGHT_SH + 0].setBrightnessSmooth(math::rescale(-sampleAndHoldVoltageSum, 0.f, 10.f, 0.f, 1.f), sampleTime); lights[LIGHT_SH + 1].setBrightnessSmooth(math::rescale(sampleAndHoldVoltageSum, 0.f, 10.f, 0.f, 1.f), sampleTime); - lights[LIGHT_SH + 2].setBrightnessSmooth(0.0f, sampleAndHoldVoltageSum); + lights[LIGHT_SH + 2].setBrightnessSmooth(0.f, sampleAndHoldVoltageSum); } else { for (int i = 0; i < lastSampleAndHoldChannels; i++) { diff --git a/src/fluctus.cpp b/src/fluctus.cpp index c4bce522..19e7528a 100644 --- a/src/fluctus.cpp +++ b/src/fluctus.cpp @@ -121,7 +121,7 @@ struct Fluctus : SanguineModule { fluctus::PlaybackMode lastPlaybackMode = fluctus::PLAYBACK_MODE_GRANULAR; fluctus::PlaybackMode lastLEDPlaybackMode = fluctus::PLAYBACK_MODE_GRANULAR; - float freezeLight = 0.0; + float freezeLight = 0.f; float lastBlend; float lastSpread; @@ -157,22 +157,22 @@ struct Fluctus : SanguineModule { configParam(PARAM_MODE, 0.f, 4.f, 0.f, "Mode", "", 0.f, 1.f, 1.f); paramQuantities[PARAM_MODE]->snapEnabled = true; - configParam(PARAM_POSITION, 0.0, 1.0, 0.5, "Grain position", "%", 0.f, 100.f); + configParam(PARAM_POSITION, 0.f, 1.f, 0.5f, "Grain position", "%", 0.f, 100.f); configInput(INPUT_POSITION, "Grain position CV"); - configParam(PARAM_DENSITY, 0.0, 1.0, 0.5, "Grain density", "%", 0.f, 100.f); + configParam(PARAM_DENSITY, 0.f, 1.f, 0.5f, "Grain density", "%", 0.f, 100.f); configInput(INPUT_DENSITY, "Grain density CV"); - configParam(PARAM_SIZE, 0.0, 1.0, 0.5, "Grain size", "%", 0.f, 100.f); + configParam(PARAM_SIZE, 0.f, 1.f, 0.5f, "Grain size", "%", 0.f, 100.f); configInput(INPUT_SIZE, "Grain size CV"); - configParam(PARAM_TEXTURE, 0.0, 1.0, 0.5, "Grain texture", "%", 0.f, 100.f); + configParam(PARAM_TEXTURE, 0.f, 1.f, 0.5f, "Grain texture", "%", 0.f, 100.f); configInput(INPUT_TEXTURE, "Grain texture CV"); - configParam(PARAM_PITCH, -2.0, 2.0, 0.0, "Grain pitch"); + configParam(PARAM_PITCH, -2.f, 2.f, 0.f, "Grain pitch"); configInput(INPUT_PITCH, "Pitch (1V/oct)"); - configParam(PARAM_BLEND, 0.0, 1.0, 0.5, "Dry/wet", "%", 0.f, 100.f); + configParam(PARAM_BLEND, 0.f, 1.f, 0.5f, "Dry/wet", "%", 0.f, 100.f); configInput(INPUT_BLEND, "Dry/wet CV"); configInput(INPUT_TRIGGER, "Trigger"); @@ -202,8 +202,8 @@ struct Fluctus : SanguineModule { lastBlend = 0.5f; lastSpread = 0.5f; - lastFeedback = 0.5; - lastReverb = 0.5; + lastFeedback = 0.5f; + lastReverb = 0.5f; lastHiFi = 1; lastStereo = 1; @@ -232,14 +232,14 @@ struct Fluctus : SanguineModule { // Get input if (!inputBuffer.full()) { - inputFrame.samples[0] = inputs[INPUT_LEFT].getVoltageSum() * params[PARAM_IN_GAIN].getValue() / 5.0; + inputFrame.samples[0] = inputs[INPUT_LEFT].getVoltageSum() * params[PARAM_IN_GAIN].getValue() / 5.f; inputFrame.samples[1] = inputs[INPUT_RIGHT].isConnected() ? inputs[INPUT_RIGHT].getVoltageSum() - * params[PARAM_IN_GAIN].getValue() / 5.0 : inputFrame.samples[0]; + * params[PARAM_IN_GAIN].getValue() / 5.f : inputFrame.samples[0]; inputBuffer.push(inputFrame); } // Trigger - bTriggered = inputs[INPUT_TRIGGER].getVoltage() >= 1.0; + bTriggered = inputs[INPUT_TRIGGER].getVoltage() >= 1.f; fluctus::Parameters* fluctusParameters = fluctusProcessor->mutable_parameters(); @@ -284,13 +284,13 @@ struct Fluctus : SanguineModule { fluctusParameters->trigger = bTriggered; fluctusParameters->gate = bTriggered; - fluctusParameters->freeze = (inputs[INPUT_FREEZE].getVoltage() >= 1.0 || frozen); - fluctusParameters->position = clamp(params[PARAM_POSITION].getValue() + inputs[INPUT_POSITION].getVoltage() / 5.0, 0.0f, 1.f); - fluctusParameters->size = clamp(params[PARAM_SIZE].getValue() + inputs[INPUT_SIZE].getVoltage() / 5.0, 0.0f, 1.0f); - fluctusParameters->pitch = clamp((params[PARAM_PITCH].getValue() + inputs[INPUT_PITCH].getVoltage()) * 12.0, -48.0f, 48.f); - fluctusParameters->density = clamp(params[PARAM_DENSITY].getValue() + inputs[INPUT_DENSITY].getVoltage() / 5.0, 0.0f, 1.f); - fluctusParameters->texture = clamp(params[PARAM_TEXTURE].getValue() + inputs[INPUT_TEXTURE].getVoltage() / 5.0, 0.0f, 1.f); - float blend = clamp(params[PARAM_BLEND].getValue() + inputs[INPUT_BLEND].getVoltage() / 5.0, 0.0f, 1.0f); + fluctusParameters->freeze = (inputs[INPUT_FREEZE].getVoltage() >= 1.f || frozen); + fluctusParameters->position = clamp(params[PARAM_POSITION].getValue() + inputs[INPUT_POSITION].getVoltage() / 5.f, 0.f, 1.f); + fluctusParameters->size = clamp(params[PARAM_SIZE].getValue() + inputs[INPUT_SIZE].getVoltage() / 5.f, 0.f, 1.f); + fluctusParameters->pitch = clamp((params[PARAM_PITCH].getValue() + inputs[INPUT_PITCH].getVoltage()) * 12.f, -48.f, 48.f); + fluctusParameters->density = clamp(params[PARAM_DENSITY].getValue() + inputs[INPUT_DENSITY].getVoltage() / 5.f, 0.f, 1.f); + fluctusParameters->texture = clamp(params[PARAM_TEXTURE].getValue() + inputs[INPUT_TEXTURE].getVoltage() / 5.f, 0.f, 1.f); + float blend = clamp(params[PARAM_BLEND].getValue() + inputs[INPUT_BLEND].getVoltage() / 5.f, 0.f, 1.f); fluctusParameters->dry_wet = blend; fluctusParameters->stereo_spread = clamp(params[PARAM_SPREAD].getValue() + inputs[INPUT_SPREAD].getVoltage() / 5.f, 0.f, 1.f); fluctusParameters->feedback = clamp(params[PARAM_FEEDBACK].getValue() + inputs[INPUT_FEEDBACK].getVoltage() / 5.f, 0.f, 1.f); @@ -299,7 +299,7 @@ struct Fluctus : SanguineModule { fluctusParameters->kammerl.clock_divider = fluctusParameters->stereo_spread; fluctusParameters->kammerl.pitch_mode = fluctusParameters->feedback; fluctusParameters->kammerl.distortion = fluctusParameters->reverb; - fluctusParameters->kammerl.pitch = clamp((math::rescale(params[PARAM_PITCH].getValue(), -2.f, 2.f, 0.f, 1.f) + inputs[INPUT_PITCH].getVoltage() / 5.0f), 0.f, 1.f); + fluctusParameters->kammerl.pitch = clamp((math::rescale(params[PARAM_PITCH].getValue(), -2.f, 2.f, 0.f, 1.f) + inputs[INPUT_PITCH].getVoltage() / 5.f), 0.f, 1.f); fluctus::ShortFrame output[32]; fluctusProcessor->Process(input, output, 32); @@ -322,14 +322,14 @@ struct Fluctus : SanguineModule { } } - lights[LIGHT_FREEZE].setBrightnessSmooth(fluctusParameters->freeze ? 1.0 : 0.0, args.sampleTime); + lights[LIGHT_FREEZE].setBrightnessSmooth(fluctusParameters->freeze ? 1.f : 0.f, args.sampleTime); // Convert output buffer { dsp::Frame<2> outputFrames[32]; for (int i = 0; i < 32; i++) { - outputFrames[i].samples[0] = output[i].l / 32768.0; - outputFrames[i].samples[1] = output[i].r / 32768.0; + outputFrames[i].samples[0] = output[i].l / 32768.f; + outputFrames[i].samples[1] = output[i].r / 32768.f; } outputSrc.setRates(32000, args.sampleRate); @@ -346,10 +346,10 @@ struct Fluctus : SanguineModule { if (!outputBuffer.empty()) { outputFrame = outputBuffer.shift(); if (outputs[OUTPUT_LEFT].isConnected()) { - outputs[OUTPUT_LEFT].setVoltage(5.0 * outputFrame.samples[0]); + outputs[OUTPUT_LEFT].setVoltage(5.f * outputFrame.samples[0]); } if (outputs[OUTPUT_RIGHT].isConnected()) { - outputs[OUTPUT_RIGHT].setVoltage(5.0 * outputFrame.samples[1]); + outputs[OUTPUT_RIGHT].setVoltage(5.f * outputFrame.samples[1]); } } @@ -370,7 +370,7 @@ struct Fluctus : SanguineModule { vuMeter.process(args.sampleTime, fmaxf(fabsf(lightFrame.samples[0]), fabsf(lightFrame.samples[1]))); - lights[LIGHT_FREEZE].setBrightness(fluctusParameters->freeze ? 0.75 : 0.0); + lights[LIGHT_FREEZE].setBrightness(fluctusParameters->freeze ? 0.75f : 0.f); if (params[PARAM_BLEND].getValue() != lastBlend || params[PARAM_SPREAD].getValue() != lastSpread || params[PARAM_FEEDBACK].getValue() != lastFeedback || params[PARAM_REVERB].getValue() != lastReverb) { diff --git a/src/incurvationes.cpp b/src/incurvationes.cpp index 50a148cd..a37a0a0f 100644 --- a/src/incurvationes.cpp +++ b/src/incurvationes.cpp @@ -57,14 +57,14 @@ struct Incurvationes : SanguineModule { configButton(PARAM_EASTER_EGG, "Frequency shifter (Easter egg)"); - configParam(PARAM_ALGORITHM, 0.0, 8.0, 0.0, "Algorithm"); + configParam(PARAM_ALGORITHM, 0.f, 8.f, 0.f, "Algorithm"); configParam(PARAM_CARRIER, 0.f, 3.f, 0.f, "Internal oscillator mode"); - configParam(PARAM_TIMBRE, 0.0, 1.0, 0.5, "Timbre", "%", 0, 100); + configParam(PARAM_TIMBRE, 0.f, 1.f, 0.5f, "Timbre", "%", 0.f, 100.f); - configParam(PARAM_LEVEL1, 0.0, 1.0, 1.0, "External oscillator amplitude / internal oscillator frequency", "%", 0, 100); - configParam(PARAM_LEVEL2, 0.0, 1.0, 1.0, "Modulator amplitude", "%", 0, 100); + configParam(PARAM_LEVEL1, 0.f, 1.f, 1.f, "External oscillator amplitude / internal oscillator frequency", "%", 0.f, 100.f); + configParam(PARAM_LEVEL2, 0.f, 1.f, 1.f, "Modulator amplitude", "%", 0.f, 100.f); configInput(INPUT_LEVEL1, "Level 1"); configInput(INPUT_LEVEL2, "Level 2"); @@ -80,7 +80,7 @@ struct Incurvationes : SanguineModule { for (int i = 0; i < PORT_MAX_CHANNELS; i++) { memset(&warpsModulator[i], 0, sizeof(warps::Modulator)); - warpsModulator[i].Init(96000.0f); + warpsModulator[i].Init(96000.f); warpsParameters[i] = warpsModulator[i].mutable_parameters(); } @@ -136,11 +136,11 @@ struct Incurvationes : SanguineModule { warpsModulator[channel].Process(inputFrames[channel], outputFrames[channel], 60); } - inputFrames[channel][frame[channel]].l = clamp(int(inputs[INPUT_CARRIER].getVoltage(channel) / 16.0 * 32768), -32768, 32767); - inputFrames[channel][frame[channel]].r = clamp(int(inputs[INPUT_MODULATOR].getVoltage(channel) / 16.0 * 32768), -32768, 32767); + inputFrames[channel][frame[channel]].l = clamp(int(inputs[INPUT_CARRIER].getVoltage(channel) / 16.f * 32768), -32768, 32767); + inputFrames[channel][frame[channel]].r = clamp(int(inputs[INPUT_MODULATOR].getVoltage(channel) / 16.f * 32768), -32768, 32767); - outputs[OUTPUT_MODULATOR].setVoltage(float(outputFrames[channel][frame[channel]].l) / 32768 * 5.0, channel); - outputs[OUTPUT_AUX].setVoltage(float(outputFrames[channel][frame[channel]].r) / 32768 * 5.0, channel); + outputs[OUTPUT_MODULATOR].setVoltage(float(outputFrames[channel][frame[channel]].l) / 32768 * 5.f, channel); + outputs[OUTPUT_AUX].setVoltage(float(outputFrames[channel][frame[channel]].r) / 32768 * 5.f, channel); } outputs[OUTPUT_MODULATOR].setChannels(channelCount); @@ -148,9 +148,9 @@ struct Incurvationes : SanguineModule { if (isLightsTurn) { lights[LIGHT_CARRIER + 0].value = (warpsParameters[0]->carrier_shape == 1 - || warpsParameters[0]->carrier_shape == 2) ? 1.0 : 0.0; + || warpsParameters[0]->carrier_shape == 2) ? 1.f : 0.f; lights[LIGHT_CARRIER + 1].value = (warpsParameters[0]->carrier_shape == 2 - || warpsParameters[0]->carrier_shape == 3) ? 1.0 : 0.0; + || warpsParameters[0]->carrier_shape == 3) ? 1.f : 0.f; lights[LIGHT_EASTER_EGG].setBrightness(bEasterEggEnabled ? 1.f : 0.f); @@ -169,7 +169,7 @@ struct Incurvationes : SanguineModule { int a = palette[zone_integral][i]; int b = palette[zone_integral + 1][i]; - colorValues[channel][i] = static_cast(a + ((b - a) * zone_fractional_i >> 8)) / 255.0f; + colorValues[channel][i] = static_cast(a + ((b - a) * zone_fractional_i >> 8)) / 255.f; lights[currentLight + i].setBrightness(colorValues[channel][i]); } diff --git a/src/marmora.cpp b/src/marmora.cpp index 1eadfd82..b006aa52 100644 --- a/src/marmora.cpp +++ b/src/marmora.cpp @@ -361,18 +361,18 @@ struct Marmora : SanguineModule { configButton(PARAM_DEJA_VU_T, "T deja vu"); configButton(PARAM_DEJA_VU_X, "X deja vu"); - configParam(PARAM_DEJA_VU, 0.0, 1.0, 0.5, "Deja vu probability", "%", 0.f, 100.f); - configParam(PARAM_T_RATE, -1.0, 1.0, 0.0, "Clock rate"); - configParam(PARAM_X_SPREAD, 0.0, 1.0, 0.5, "Probability distribution", "%", 0.f, 100.f); + configParam(PARAM_DEJA_VU, 0.f, 1.f, 0.5f, "Deja vu probability", "%", 0.f, 100.f); + configParam(PARAM_T_RATE, -1.f, 1.f, 0.f, "Clock rate"); + configParam(PARAM_X_SPREAD, 0.f, 1.f, 0.5f, "Probability distribution", "%", 0.f, 100.f); configSwitch(PARAM_T_MODE, 0.f, 6.f, 0.f, "T mode", marmoraTModeLabels); configSwitch(PARAM_X_MODE, 0.f, 2.f, 0.f, "X mode", marmoraXModeLabels); - configParam(PARAM_DEJA_VU_LENGTH, 0.0, 1.0, 1.0, "Loop length", "", 0.f, 100.f); - configParam(PARAM_T_BIAS, 0.0, 1.0, 0.5, "Gate bias", "%", 0.f, 100.f); - configParam(PARAM_X_BIAS, 0.0, 1.0, 0.5, "Distribution bias", "%", 0.f, 100.f); + configParam(PARAM_DEJA_VU_LENGTH, 0.f, 1.f, 1.f, "Loop length", "", 0.f, 100.f); + configParam(PARAM_T_BIAS, 0.f, 1.f, 0.5f, "Gate bias", "%", 0.f, 100.f); + configParam(PARAM_X_BIAS, 0.f, 1.f, 0.5f, "Distribution bias", "%", 0.f, 100.f); configSwitch(PARAM_T_RANGE, 0.f, 2.f, 0.f, "Clock range mode", marmoraTRangeLabels); configSwitch(PARAM_X_RANGE, 0.f, 2.f, 0.f, "Output voltage range", marmoraXRangeLabels); configButton(PARAM_EXTERNAL, "External processing mode"); - configParam(PARAM_T_JITTER, 0.0, 1.0, 0.0, "Randomness amount", "%", 0.f, 100.f); + configParam(PARAM_T_JITTER, 0.f, 1.f, 0.f, "Randomness amount", "%", 0.f, 100.f); configParam(PARAM_X_STEPS, 0.f, 1.f, 0.5f, "Smoothness", "%", 0.f, 100.f); configSwitch(PARAM_SCALE, 0.f, 5.f, 0.f, "Scale", marmoraScaleLabels); configSwitch(PARAM_INTERNAL_X_CLOCK_SOURCE, 0.f, 3.f, 0.f, "Internal X clock source", marmoraInternalClockLabels); @@ -399,13 +399,13 @@ struct Marmora : SanguineModule { configOutput(OUTPUT_X2, "X₂"); configOutput(OUTPUT_X3, "X₃"); - configParam(PARAM_Y_RATE, 0.0, 1.0, 4.5 / LENGTHOF(y_divider_ratios), "Clock divide"); - configParam(PARAM_Y_SPREAD, 0.0, 1.0, 0.5, "Probability distribution", "%", 0.f, 100.f); - configParam(PARAM_Y_BIAS, 0.0, 1.0, 0.5, "Voltage offset", "%", 0.f, 100.f); - configParam(PARAM_Y_STEPS, 0.0, 1.0, 0.0, "Smoothness", "%", 0.f, 100.f); + configParam(PARAM_Y_RATE, 0.f, 1.f, 4.5f / LENGTHOF(y_divider_ratios), "Clock divide"); + configParam(PARAM_Y_SPREAD, 0.f, 1.f, 0.5f, "Probability distribution", "%", 0.f, 100.f); + configParam(PARAM_Y_BIAS, 0.f, 1.f, 0.5f, "Voltage offset", "%", 0.f, 100.f); + configParam(PARAM_Y_STEPS, 0.f, 1.f, 0.f, "Smoothness", "%", 0.f, 100.f); - configParam(PARAM_GATE_BIAS, 0.0, 1.0, 0.5, "Gate length", "%", 0.f, 100.f); - configParam(PARAM_GATE_JITTER, 0.0, 1.0, 0.0, "Gate length randomness", "%", 0.f, 100.f); + configParam(PARAM_GATE_BIAS, 0.f, 1.f, 0.5f, "Gate length", "%", 0.f, 100.f); + configParam(PARAM_GATE_JITTER, 0.f, 1.f, 0.f, "Gate length randomness", "%", 0.f, 100.f); lightsDivider.setDivision(kLightDivider); @@ -695,11 +695,11 @@ struct Marmora : SanguineModule { y.control_mode = marbles::CONTROL_MODE_IDENTICAL; y.voltage_range = marbles::VOLTAGE_RANGE_FULL; y.register_mode = false; - y.register_value = 0.0f; + y.register_value = 0.f; y.spread = params[PARAM_Y_SPREAD].getValue(); y.bias = params[PARAM_Y_BIAS].getValue(); y.steps = params[PARAM_Y_STEPS].getValue(); - y.deja_vu = 0.0f; + y.deja_vu = 0.f; y.length = 1; unsigned int index = params[PARAM_Y_RATE].getValue() * LENGTHOF(y_divider_ratios); @@ -716,7 +716,7 @@ struct Marmora : SanguineModule { */ float noteCV = (inputs[INPUT_X_SPREAD].getVoltage() / 5.f); float u = noteFilter.Process(0.5f * (noteCV + 1.f)); - float voltage = (u - 0.5f) * 10.0f; + float voltage = (u - 0.5f) * 10.f; if (inputs[INPUT_X_CLOCK].getVoltage() >= 0.5f) { if (!bLastGate) { scaleRecorder.NewNote(voltage); diff --git a/src/mortuus.cpp b/src/mortuus.cpp index b59d97eb..e966ed27 100644 --- a/src/mortuus.cpp +++ b/src/mortuus.cpp @@ -413,8 +413,8 @@ struct Mortuus : SanguineModule { // Peaks manual says output spec is 0..8V for envelopes and 10Vpp for audio/CV. // TODO Check the output values against an actual device. - outputs[OUT_1_OUTPUT].setVoltage(rescale(static_cast(frame.samples[0]), 0.0f, 65535.f, -8.0f, 8.0f)); - outputs[OUT_2_OUTPUT].setVoltage(rescale(static_cast(frame.samples[1]), 0.0f, 65535.f, -8.0f, 8.0f)); + outputs[OUT_1_OUTPUT].setVoltage(rescale(static_cast(frame.samples[0]), 0.f, 65535.f, -8.f, 8.f)); + outputs[OUT_2_OUTPUT].setVoltage(rescale(static_cast(frame.samples[1]), 0.f, 65535.f, -8.f, 8.f)); } } @@ -591,7 +591,7 @@ struct Mortuus : SanguineModule { int currentLight; switch (editMode) { case EDIT_MODE_FIRST: - lights[LIGHT_CHANNEL1].setBrightnessSmooth((flash == 1) ? 1.0f : 0.0f, sampleTime); + lights[LIGHT_CHANNEL1].setBrightnessSmooth((flash == 1) ? 1.f : 0.f, sampleTime); lights[LIGHT_CHANNEL2].setBrightnessSmooth(0.f, sampleTime); lights[LIGHT_CHANNEL_SELECT + 0].setBrightnessSmooth(1.f, sampleTime); lights[LIGHT_CHANNEL_SELECT + 1].setBrightnessSmooth(0.f, sampleTime); @@ -604,7 +604,7 @@ struct Mortuus : SanguineModule { break; case EDIT_MODE_SECOND: lights[LIGHT_CHANNEL1].setBrightnessSmooth(0.f, sampleTime); - lights[LIGHT_CHANNEL2].setBrightnessSmooth((flash == 1 || flash == 3) ? 1.0f : 0.0f, sampleTime); + lights[LIGHT_CHANNEL2].setBrightnessSmooth((flash == 1 || flash == 3) ? 1.f : 0.f, sampleTime); lights[LIGHT_CHANNEL_SELECT + 0].setBrightnessSmooth(1.f, sampleTime); lights[LIGHT_CHANNEL_SELECT + 1].setBrightnessSmooth(1.f, sampleTime); for (int i = 0; i < 4; i++) { @@ -650,23 +650,23 @@ struct Mortuus : SanguineModule { break; } - lights[LIGHT_SPLIT_MODE].setBrightnessSmooth((editMode == EDIT_MODE_SPLIT) ? 1.0f : 0.0f, sampleTime); - lights[LIGHT_EXPERT_MODE].setBrightnessSmooth((editMode & 2) ? 1.0F : 0.F, sampleTime); + lights[LIGHT_SPLIT_MODE].setBrightnessSmooth((editMode == EDIT_MODE_SPLIT) ? 1.f : 0.f, sampleTime); + lights[LIGHT_EXPERT_MODE].setBrightnessSmooth((editMode & 2) ? 1.f : 0.f, sampleTime); ProcessorFunction currentProcessorFunction = getProcessorFunction(); for (int i = 0; i < 4; i++) { currentLight = LIGHT_FUNCTION_1 + i; switch (lightStates[currentProcessorFunction][i]) { case LIGHT_ON: { - lights[currentLight].setBrightnessSmooth(1.0f, sampleTime); + lights[currentLight].setBrightnessSmooth(1.f, sampleTime); break; } case LIGHT_OFF: { - lights[currentLight].setBrightnessSmooth(0.0f, sampleTime); + lights[currentLight].setBrightnessSmooth(0.f, sampleTime); break; } case LIGHT_BLINK: { - lights[currentLight].setBrightnessSmooth(getSystemTimeMs() & 256 ? 0.0f : 1.f, sampleTime); + lights[currentLight].setBrightnessSmooth(getSystemTimeMs() & 256 ? 0.f : 1.f, sampleTime); break; } default: { @@ -721,7 +721,7 @@ struct Mortuus : SanguineModule { if (editMode == EDIT_MODE_SPLIT || editMode == EDIT_MODE_TWIN) { uint8_t pattern = processors[0].number_station().digit() ^ processors[1].number_station().digit(); for (size_t i = 0; i < 4; ++i) { - lights[LIGHT_FUNCTION_1 + i].setBrightness((pattern & 1) ? 1.0f : 0.0f); + lights[LIGHT_FUNCTION_1 + i].setBrightness((pattern & 1) ? 1.f : 0.f); pattern = pattern >> 1; } } @@ -729,14 +729,14 @@ struct Mortuus : SanguineModule { else if (editMode == EDIT_MODE_FIRST && channel1IsStation) { int digit = processors[0].number_station().digit(); for (size_t i = 0; i < 4; i++) { - lights[LIGHT_FUNCTION_1 + i].setBrightness((i & digit) ? 1.0f : 0.0f); + lights[LIGHT_FUNCTION_1 + i].setBrightness((i & digit) ? 1.f : 0.f); } } // Ibid else if (editMode == EDIT_MODE_SECOND && channel2IsStation) { uint8_t digit = processors[1].number_station().digit(); for (size_t i = 0; i < 4; i++) { - lights[LIGHT_FUNCTION_1 + i].setBrightness((i & digit) ? 1.0f : 0.0f); + lights[LIGHT_FUNCTION_1 + i].setBrightness((i & digit) ? 1.f : 0.f); } } if (channel1IsStation) { @@ -747,8 +747,8 @@ struct Mortuus : SanguineModule { } } - lights[LIGHT_TRIGGER_1].setBrightnessSmooth(rescale(static_cast(buttonBrightness[0]), 0.0f, 255.0f, 0.0f, 1.0f), sampleTime); - lights[LIGHT_TRIGGER_2].setBrightnessSmooth(rescale(static_cast(buttonBrightness[1]), 0.0f, 255.0f, 0.0f, 1.0f), sampleTime); + lights[LIGHT_TRIGGER_1].setBrightnessSmooth(rescale(static_cast(buttonBrightness[0]), 0.f, 255.f, 0.f, 1.f), sampleTime); + lights[LIGHT_TRIGGER_2].setBrightnessSmooth(rescale(static_cast(buttonBrightness[1]), 0.f, 255.f, 0.f, 1.f), sampleTime); } void onReset() override { diff --git a/src/mutuus.cpp b/src/mutuus.cpp index a8d085e9..5891b860 100644 --- a/src/mutuus.cpp +++ b/src/mutuus.cpp @@ -71,14 +71,14 @@ struct Mutuus : SanguineModule { configButton(PARAM_MODE_SWITCH, "Mode select"); - configParam(PARAM_ALGORITHM, 0.0, 8.0, 0.0, "Algorithm"); + configParam(PARAM_ALGORITHM, 0.f, 8.f, 0.f, "Algorithm"); configParam(PARAM_CARRIER, 0.f, 3.f, 0.f, "Internal oscillator mode"); - configParam(PARAM_TIMBRE, 0.0, 1.0, 0.5, "Timbre", "%", 0, 100); + configParam(PARAM_TIMBRE, 0.f, 1.f, 0.5f, "Timbre", "%", 0.f, 100.f); - configParam(PARAM_LEVEL1, 0.0, 1.0, 1.0, "External oscillator amplitude / internal oscillator frequency", "%", 0, 100); - configParam(PARAM_LEVEL2, 0.0, 1.0, 1.0, "Modulator amplitude", "%", 0, 100); + configParam(PARAM_LEVEL1, 0.f, 1.f, 1.f, "External oscillator amplitude / internal oscillator frequency", "%", 0.f, 100.f); + configParam(PARAM_LEVEL2, 0.f, 1.f, 1.f, "Modulator amplitude", "%", 0.f, 100.f); configInput(INPUT_LEVEL1, "Level 1"); configInput(INPUT_LEVEL2, "Level 2"); @@ -96,7 +96,7 @@ struct Mutuus : SanguineModule { for (int i = 0; i < PORT_MAX_CHANNELS; i++) { memset(&mutuusModulator[i], 0, sizeof(mutuus::MutuusModulator)); - mutuusModulator[i].Init(96000.0f, reverbBuffer[i]); + mutuusModulator[i].Init(96000.f, reverbBuffer[i]); mutuusParameters[i] = mutuusModulator[i].mutable_parameters(); } @@ -144,7 +144,7 @@ struct Mutuus : SanguineModule { } else { lastAlgorithmValue = params[PARAM_ALGORITHM].getValue(); - algorithmValue = lastAlgorithmValue / 8.0; + algorithmValue = lastAlgorithmValue / 8.f; } for (int channel = 0; channel < channelCount; channel++) { @@ -188,35 +188,35 @@ struct Mutuus : SanguineModule { mutuusParameters[channel]->raw_level[0] = mutuusParameters[channel]->channel_drive[0]; mutuusParameters[channel]->raw_level[1] = mutuusParameters[channel]->channel_drive[1]; - mutuusParameters[channel]->raw_level_pot[0] = clamp(params[PARAM_LEVEL1].getValue(), 0.0f, 1.0f); - mutuusParameters[channel]->raw_level_pot[1] = clamp(params[PARAM_LEVEL2].getValue(), 0.0f, 1.0f); + mutuusParameters[channel]->raw_level_pot[0] = clamp(params[PARAM_LEVEL1].getValue(), 0.f, 1.f); + mutuusParameters[channel]->raw_level_pot[1] = clamp(params[PARAM_LEVEL2].getValue(), 0.f, 1.f); if (!bModeSwitchEnabled) { mutuusParameters[channel]->raw_algorithm_pot = algorithmValue; - mutuusParameters[channel]->raw_algorithm_cv = clamp(f4Voltages[2], -1.0f, 1.0f); + mutuusParameters[channel]->raw_algorithm_cv = clamp(f4Voltages[2], -1.f, 1.f); - mutuusParameters[channel]->modulation_algorithm = clamp(algorithmValue + f4Voltages[2], 0.0f, 1.0f); + mutuusParameters[channel]->modulation_algorithm = clamp(algorithmValue + f4Voltages[2], 0.f, 1.f); mutuusParameters[channel]->raw_algorithm = mutuusParameters[channel]->modulation_algorithm; } - mutuusParameters[channel]->modulation_parameter = clamp(params[PARAM_TIMBRE].getValue() + f4Voltages[3], 0.0f, 1.0f); + mutuusParameters[channel]->modulation_parameter = clamp(params[PARAM_TIMBRE].getValue() + f4Voltages[3], 0.f, 1.f); mutuusParameters[channel]->raw_modulation = mutuusParameters[channel]->modulation_parameter; mutuusParameters[channel]->raw_modulation_pot = clamp(params[PARAM_TIMBRE].getValue(), 0.f, 1.f); mutuusParameters[channel]->raw_modulation_cv = clamp(f4Voltages[3], -1.f, 1.f); - mutuusParameters[channel]->note = 60.0 * params[PARAM_LEVEL1].getValue() + 12.0 - * inputs[INPUT_LEVEL1].getNormalVoltage(2.0, channel) + 12.0; - mutuusParameters[channel]->note += log2f(96000.0f * args.sampleTime) * 12.0f; + mutuusParameters[channel]->note = 60.f * params[PARAM_LEVEL1].getValue() + 12.f + * inputs[INPUT_LEVEL1].getNormalVoltage(2.f, channel) + 12.f; + mutuusParameters[channel]->note += log2f(96000.f * args.sampleTime) * 12.f; mutuusModulator[channel].Process(inputFrames[channel], outputFrames[channel], 60); } - inputFrames[channel][frame[channel]].l = clamp(int(inputs[INPUT_CARRIER].getVoltage(channel) / 16.0 * 32768), -32768, 32767); - inputFrames[channel][frame[channel]].r = clamp(int(inputs[INPUT_MODULATOR].getVoltage(channel) / 16.0 * 32768), -32768, 32767); + inputFrames[channel][frame[channel]].l = clamp(int(inputs[INPUT_CARRIER].getVoltage(channel) / 16.f * 32768), -32768, 32767); + inputFrames[channel][frame[channel]].r = clamp(int(inputs[INPUT_MODULATOR].getVoltage(channel) / 16.f * 32768), -32768, 32767); - outputs[OUTPUT_MODULATOR].setVoltage(float(outputFrames[channel][frame[channel]].l) / 32768 * 5.0, channel); - outputs[OUTPUT_AUX].setVoltage(float(outputFrames[channel][frame[channel]].r) / 32768 * 5.0, channel); + outputs[OUTPUT_MODULATOR].setVoltage(float(outputFrames[channel][frame[channel]].l) / 32768 * 5.f, channel); + outputs[OUTPUT_AUX].setVoltage(float(outputFrames[channel][frame[channel]].r) / 32768 * 5.f, channel); } outputs[OUTPUT_MODULATOR].setChannels(channelCount); @@ -224,9 +224,9 @@ struct Mutuus : SanguineModule { if (isLightsTurn) { lights[LIGHT_CARRIER + 0].value = (mutuusParameters[0]->carrier_shape == 1 - || mutuusParameters[0]->carrier_shape == 2) ? 1.0 : 0.0; + || mutuusParameters[0]->carrier_shape == 2) ? 1.f : 0.f; lights[LIGHT_CARRIER + 1].value = (mutuusParameters[0]->carrier_shape == 2 - || mutuusParameters[0]->carrier_shape == 3) ? 1.0 : 0.0; + || mutuusParameters[0]->carrier_shape == 3) ? 1.f : 0.f; lights[LIGHT_MODE_SWITCH].setBrightness(bModeSwitchEnabled ? 1.f : 0.f); @@ -245,7 +245,7 @@ struct Mutuus : SanguineModule { palette = paletteWarpsDefault; } - zone = 8.0f * mutuusParameters[0]->modulation_algorithm; + zone = 8.f * mutuusParameters[0]->modulation_algorithm; MAKE_INTEGRAL_FRACTIONAL(zone); int zone_fractional_i = static_cast(zone_fractional * 256); for (int i = 0; i < 3; i++) { diff --git a/src/nebulae.cpp b/src/nebulae.cpp index 17b3b476..754ac0ad 100644 --- a/src/nebulae.cpp +++ b/src/nebulae.cpp @@ -124,7 +124,7 @@ struct Nebulae : SanguineModule { clouds::PlaybackMode lastPlaybackMode = clouds::PLAYBACK_MODE_GRANULAR; clouds::PlaybackMode lastLEDPlaybackMode = clouds::PLAYBACK_MODE_GRANULAR; - float freezeLight = 0.0; + float freezeLight = 0.f; float lastBlend; float lastSpread; @@ -160,22 +160,22 @@ struct Nebulae : SanguineModule { configParam(PARAM_MODE, 0.f, 3.f, 0.f, "Mode", "", 0.f, 1.f, 1.f); paramQuantities[PARAM_MODE]->snapEnabled = true; - configParam(PARAM_POSITION, 0.0, 1.0, 0.5, "Grain position", "%", 0.f, 100.f); + configParam(PARAM_POSITION, 0.f, 1.f, 0.5f, "Grain position", "%", 0.f, 100.f); configInput(INPUT_POSITION, "Grain position CV"); - configParam(PARAM_DENSITY, 0.0, 1.0, 0.5, "Grain density", "%", 0.f, 100.f); + configParam(PARAM_DENSITY, 0.f, 1.f, 0.5f, "Grain density", "%", 0.f, 100.f); configInput(INPUT_DENSITY, "Grain density CV"); - configParam(PARAM_SIZE, 0.0, 1.0, 0.5, "Grain size", "%", 0.f, 100.f); + configParam(PARAM_SIZE, 0.f, 1.f, 0.5f, "Grain size", "%", 0.f, 100.f); configInput(INPUT_SIZE, "Grain size CV"); - configParam(PARAM_TEXTURE, 0.0, 1.0, 0.5, "Grain texture", "%", 0.f, 100.f); + configParam(PARAM_TEXTURE, 0.f, 1.f, 0.5f, "Grain texture", "%", 0.f, 100.f); configInput(INPUT_TEXTURE, "Grain texture CV"); - configParam(PARAM_PITCH, -2.0, 2.0, 0.0, "Grain pitch"); + configParam(PARAM_PITCH, -2.f, 2.f, 0.f, "Grain pitch"); configInput(INPUT_PITCH, "Pitch (1V/oct)"); - configParam(PARAM_BLEND, 0.0, 1.0, 0.5, "Dry/wet", "%", 0.f, 100.f); + configParam(PARAM_BLEND, 0.f, 1.f, 0.5f, "Dry/wet", "%", 0.f, 100.f); configInput(INPUT_BLEND, "Dry/wet CV"); configInput(INPUT_TRIGGER, "Trigger"); @@ -235,14 +235,14 @@ struct Nebulae : SanguineModule { // Get input if (!inputBuffer.full()) { - inputFrame.samples[0] = inputs[INPUT_LEFT].getVoltageSum() * params[PARAM_IN_GAIN].getValue() / 5.0; + inputFrame.samples[0] = inputs[INPUT_LEFT].getVoltageSum() * params[PARAM_IN_GAIN].getValue() / 5.f; inputFrame.samples[1] = inputs[INPUT_RIGHT].isConnected() ? inputs[INPUT_RIGHT].getVoltageSum() * - params[PARAM_IN_GAIN].getValue() / 5.0 : inputFrame.samples[0]; + params[PARAM_IN_GAIN].getValue() / 5.f : inputFrame.samples[0]; inputBuffer.push(inputFrame); } // Trigger - bTriggered = inputs[INPUT_TRIGGER].getVoltage() >= 1.0; + bTriggered = inputs[INPUT_TRIGGER].getVoltage() >= 1.f; clouds::Parameters* cloudsParameters = cloudsProcessor->mutable_parameters(); @@ -287,17 +287,17 @@ struct Nebulae : SanguineModule { cloudsParameters->trigger = bTriggered; cloudsParameters->gate = bTriggered; - cloudsParameters->freeze = (inputs[INPUT_FREEZE].getVoltage() >= 1.0 || frozen); - cloudsParameters->position = clamp(params[PARAM_POSITION].getValue() + inputs[INPUT_POSITION].getVoltage() / 5.0, 0.0f, 1.0f); - cloudsParameters->size = clamp(params[PARAM_SIZE].getValue() + inputs[INPUT_SIZE].getVoltage() / 5.0, 0.0f, 1.0f); - cloudsParameters->pitch = clamp((params[PARAM_PITCH].getValue() + inputs[INPUT_PITCH].getVoltage()) * 12.0, -48.0f, 48.0f); - cloudsParameters->density = clamp(params[PARAM_DENSITY].getValue() + inputs[INPUT_DENSITY].getVoltage() / 5.0, 0.0f, 1.0f); - cloudsParameters->texture = clamp(params[PARAM_TEXTURE].getValue() + inputs[INPUT_TEXTURE].getVoltage() / 5.0, 0.0f, 1.0f); - float blend = clamp(params[PARAM_BLEND].getValue() + inputs[INPUT_BLEND].getVoltage() / 5.0, 0.0f, 1.0f); + cloudsParameters->freeze = (inputs[INPUT_FREEZE].getVoltage() >= 1.f || frozen); + cloudsParameters->position = clamp(params[PARAM_POSITION].getValue() + inputs[INPUT_POSITION].getVoltage() / 5.f, 0.f, 1.f); + cloudsParameters->size = clamp(params[PARAM_SIZE].getValue() + inputs[INPUT_SIZE].getVoltage() / 5.f, 0.f, 1.f); + cloudsParameters->pitch = clamp((params[PARAM_PITCH].getValue() + inputs[INPUT_PITCH].getVoltage()) * 12.f, -48.f, 48.f); + cloudsParameters->density = clamp(params[PARAM_DENSITY].getValue() + inputs[INPUT_DENSITY].getVoltage() / 5.f, 0.f, 1.f); + cloudsParameters->texture = clamp(params[PARAM_TEXTURE].getValue() + inputs[INPUT_TEXTURE].getVoltage() / 5.f, 0.f, 1.f); + float blend = clamp(params[PARAM_BLEND].getValue() + inputs[INPUT_BLEND].getVoltage() / 5.f, 0.f, 1.f); cloudsParameters->dry_wet = blend; - cloudsParameters->stereo_spread = clamp(params[PARAM_SPREAD].getValue() + inputs[INPUT_SPREAD].getVoltage() / 5.0, 0.0f, 1.0f); - cloudsParameters->feedback = clamp(params[PARAM_FEEDBACK].getValue() + inputs[INPUT_FEEDBACK].getVoltage() / 5.0, 0.0f, 1.0f); - cloudsParameters->reverb = clamp(params[PARAM_REVERB].getValue() + inputs[INPUT_REVERB].getVoltage() / 5.0, 0.0f, 1.0f); + cloudsParameters->stereo_spread = clamp(params[PARAM_SPREAD].getValue() + inputs[INPUT_SPREAD].getVoltage() / 5.f, 0.f, 1.f); + cloudsParameters->feedback = clamp(params[PARAM_FEEDBACK].getValue() + inputs[INPUT_FEEDBACK].getVoltage() / 5.f, 0.f, 1.f); + cloudsParameters->reverb = clamp(params[PARAM_REVERB].getValue() + inputs[INPUT_REVERB].getVoltage() / 5.f, 0.f, 1.f); clouds::ShortFrame output[32]; cloudsProcessor->Process(input, output, 32); @@ -320,14 +320,14 @@ struct Nebulae : SanguineModule { } } - lights[LIGHT_FREEZE].setBrightnessSmooth(cloudsParameters->freeze ? 1.0 : 0.0, args.sampleTime); + lights[LIGHT_FREEZE].setBrightnessSmooth(cloudsParameters->freeze ? 1.f : 0.f, args.sampleTime); // Convert output buffer { dsp::Frame<2> outputFrames[32]; for (int i = 0; i < 32; i++) { - outputFrames[i].samples[0] = output[i].l / 32768.0; - outputFrames[i].samples[1] = output[i].r / 32768.0; + outputFrames[i].samples[0] = output[i].l / 32768.f; + outputFrames[i].samples[1] = output[i].r / 32768.f; } outputSrc.setRates(32000, args.sampleRate); @@ -344,10 +344,10 @@ struct Nebulae : SanguineModule { if (!outputBuffer.empty()) { outputFrame = outputBuffer.shift(); if (outputs[OUTPUT_LEFT].isConnected()) { - outputs[OUTPUT_LEFT].setVoltage(5.0 * outputFrame.samples[0]); + outputs[OUTPUT_LEFT].setVoltage(5.f * outputFrame.samples[0]); } if (outputs[OUTPUT_RIGHT].isConnected()) { - outputs[OUTPUT_RIGHT].setVoltage(5.0 * outputFrame.samples[1]); + outputs[OUTPUT_RIGHT].setVoltage(5.f * outputFrame.samples[1]); } } @@ -368,7 +368,7 @@ struct Nebulae : SanguineModule { vuMeter.process(args.sampleTime, fmaxf(fabsf(lightFrame.samples[0]), fabsf(lightFrame.samples[1]))); - lights[LIGHT_FREEZE].setBrightness(cloudsParameters->freeze ? 0.75f : 0.0f); + lights[LIGHT_FREEZE].setBrightness(cloudsParameters->freeze ? 0.75f : 0.f); if (params[PARAM_BLEND].getValue() != lastBlend || params[PARAM_SPREAD].getValue() != lastSpread || params[PARAM_FEEDBACK].getValue() != lastFeedback || params[PARAM_REVERB].getValue() != lastReverb) { diff --git a/src/nodi.cpp b/src/nodi.cpp index f72e4075..5bc37c02 100644 --- a/src/nodi.cpp +++ b/src/nodi.cpp @@ -280,21 +280,21 @@ struct Nodi : SanguineModule { config(PARAMS_COUNT, INPUTS_COUNT, OUTPUTS_COUNT, LIGHTS_COUNT); configSwitch(PARAM_MODEL, 0.f, braids::MACRO_OSC_SHAPE_LAST_ACCESSIBLE_FROM_META, 0.f, "Model", nodiMenuLabels); - configParam(PARAM_MODULATION, -1.0, 1.0, 0.0, "Modulation"); - configParam(PARAM_COARSE, -5.0, 3.0, -1.0, "Coarse frequency", " semitones", 0.f, 12.f, 12.f); - configParam(PARAM_FINE, -1.0, 1.0, 0.0, "Fine frequency", " semitones"); - configParam(PARAM_ATTACK, 0.0, 15.0, 0.0, "Attack"); + configParam(PARAM_MODULATION, -1.f, 1.f, 0.f, "Modulation"); + configParam(PARAM_COARSE, -5.f, 3.f, -1.f, "Coarse frequency", " semitones", 0.f, 12.f, 12.f); + configParam(PARAM_FINE, -1.f, 1.f, 0.f, "Fine frequency", " semitones"); + configParam(PARAM_ATTACK, 0.f, 15.f, 0.f, "Attack"); paramQuantities[PARAM_ATTACK]->snapEnabled = true; - configParam(PARAM_AD_TIMBRE, 0.0, 15.f, 0.0, "Timbre AD"); + configParam(PARAM_AD_TIMBRE, 0.f, 15.f, 0.f, "Timbre AD"); paramQuantities[PARAM_AD_TIMBRE]->snapEnabled = true; - configParam(PARAM_TIMBRE, 0.0, 1.0, 0.5, "Timbre", "%", 0.f, 100.f); - configParam(PARAM_ROOT, 0.0, 11.0, 0.0, "Quantizer root note", "", 0.f, 1.0, 1.f); + configParam(PARAM_TIMBRE, 0.f, 1.f, 0.5f, "Timbre", "%", 0.f, 100.f); + configParam(PARAM_ROOT, 0.f, 11.f, 0.f, "Quantizer root note", "", 0.f, 1.f, 1.f); paramQuantities[PARAM_ROOT]->snapEnabled = true; - configParam(PARAM_SCALE, 0.0, 48.0, 0.0, "Quantizer scale"); + configParam(PARAM_SCALE, 0.f, 48.f, 0.f, "Quantizer scale"); paramQuantities[PARAM_SCALE]->snapEnabled = true; - configParam(PARAM_DECAY, 0.0, 15.f, 7.0, "Decay"); + configParam(PARAM_DECAY, 0.f, 15.f, 7.f, "Decay"); paramQuantities[PARAM_DECAY]->snapEnabled = true; configParam(PARAM_AD_COLOR, 0.f, 15.f, 0.f, "Color AD"); @@ -302,12 +302,12 @@ struct Nodi : SanguineModule { configParam(PARAM_AD_MODULATION, 0.f, 15.f, 0.f, "FM AD"); paramQuantities[PARAM_AD_MODULATION]->snapEnabled = true; - configParam(PARAM_COLOR, 0.0, 1.0, 0.5, "Color", "%", 0.f, 100.f); - configParam(PARAM_PITCH_OCTAVE, 0.0, 4.0, 2.f, "Octave", "", 0.f, 1.f, -2.f); + configParam(PARAM_COLOR, 0.f, 1.f, 0.5f, "Color", "%", 0.f, 100.f); + configParam(PARAM_PITCH_OCTAVE, 0.f, 4.f, 2.f, "Octave", "", 0.f, 1.f, -2.f); paramQuantities[PARAM_PITCH_OCTAVE]->snapEnabled = true; configParam(PARAM_PITCH_RANGE, 0.f, 4.f, 0.f, "Pitch range"); paramQuantities[PARAM_PITCH_RANGE]->snapEnabled = true; - configParam(PARAM_FM, -1.0, 1.0, 0.0, "FM"); + configParam(PARAM_FM, -1.f, 1.f, 0.f, "FM"); configParam(PARAM_TRIGGER_DELAY, 0.f, 6.f, 0.f, "Trigger delay"); paramQuantities[PARAM_TRIGGER_DELAY]->snapEnabled = true; @@ -388,7 +388,7 @@ struct Nodi : SanguineModule { settings[channel].ad_color = params[PARAM_AD_COLOR].getValue(); // Trigger - bool bTriggerInput = inputs[INPUT_TRIGGER].getVoltage(channel) >= 1.0; + bool bTriggerInput = inputs[INPUT_TRIGGER].getVoltage(channel) >= 1.f; if (!bLastTrig[channel] && bTriggerInput) { bFlagTriggerDetected[channel] = bTriggerInput; } @@ -431,7 +431,7 @@ struct Nodi : SanguineModule { if (!bPaques) { int model = params[PARAM_MODEL].getValue(); if (inputs[INPUT_META].isConnected()) { - model += roundf(inputs[INPUT_META].getVoltage(channel) / 10.0 * braids::MACRO_OSC_SHAPE_LAST_ACCESSIBLE_FROM_META); + model += roundf(inputs[INPUT_META].getVoltage(channel) / 10.f * braids::MACRO_OSC_SHAPE_LAST_ACCESSIBLE_FROM_META); } settings[channel].shape = clamp(model, 0, braids::MACRO_OSC_SHAPE_LAST_ACCESSIBLE_FROM_META); @@ -444,25 +444,25 @@ struct Nodi : SanguineModule { } // Set timbre/modulation - float timbre = params[PARAM_TIMBRE].getValue() + params[PARAM_MODULATION].getValue() * inputs[INPUT_TIMBRE].getVoltage(channel) / 5.0; - float modulation = params[PARAM_COLOR].getValue() + inputs[INPUT_COLOR].getVoltage(channel) / 5.0; + float timbre = params[PARAM_TIMBRE].getValue() + params[PARAM_MODULATION].getValue() * inputs[INPUT_TIMBRE].getVoltage(channel) / 5.f; + float modulation = params[PARAM_COLOR].getValue() + inputs[INPUT_COLOR].getVoltage(channel) / 5.f; - timbre += adValue / 65535. * settings[channel].ad_timbre / 16.; - modulation += adValue / 65535. * settings[channel].ad_color / 16.; + timbre += adValue / 65535.f * settings[channel].ad_timbre / 16.f; + modulation += adValue / 65535.f * settings[channel].ad_color / 16.f; - int16_t param1 = math::rescale(clamp(timbre, 0.0, 1.0), 0.0, 1.0, 0, INT16_MAX); - int16_t param2 = math::rescale(clamp(modulation, 0.0, 1.0), 0.0, 1.0, 0, INT16_MAX); + int16_t param1 = math::rescale(clamp(timbre, 0.f, 1.f), 0.f, 1.f, 0, INT16_MAX); + int16_t param2 = math::rescale(clamp(modulation, 0.f, 1.f), 0.f, 1.f, 0, INT16_MAX); osc[channel].set_parameters(param1, param2); // Set pitch - float pitchV = inputs[INPUT_PITCH].getVoltage(channel) + params[PARAM_COARSE].getValue() + params[PARAM_FINE].getValue() / 12.0; + float pitchV = inputs[INPUT_PITCH].getVoltage(channel) + params[PARAM_COARSE].getValue() + params[PARAM_FINE].getValue() / 12.f; pitchV += fm; if (bLowCpu) { - pitchV += log2f(96000.0 / args.sampleRate); + pitchV += log2f(96000.f / args.sampleRate); } - int32_t pitch = (pitchV * 12.0 + 60) * 128; + int32_t pitch = (pitchV * 12.f + 60) * 128; // pitch_range if (settings[channel].pitch_range == braids::PITCH_RANGE_EXTERNAL || settings[channel].pitch_range == braids::PITCH_RANGE_LFO) { @@ -535,7 +535,7 @@ struct Nodi : SanguineModule { // Sample rate convert dsp::Frame<1> in[24]; for (int i = 0; i < 24; i++) { - in[i].samples[0] = renderBuffer[i] / 32768.0; + in[i].samples[0] = renderBuffer[i] / 32768.f; } sampleRateConverter[channel].setRates(96000, args.sampleRate); @@ -547,7 +547,7 @@ struct Nodi : SanguineModule { else { for (int i = 0; i < 24; i++) { dsp::Frame<1> f; - f.samples[0] = renderBuffer[i] / 32768.0; + f.samples[0] = renderBuffer[i] / 32768.f; drbOutputBuffer[channel].push(f); } } @@ -556,7 +556,7 @@ struct Nodi : SanguineModule { // Output if (!drbOutputBuffer[channel].empty()) { dsp::Frame<1> f = drbOutputBuffer[channel].shift(); - outputs[OUTPUT_OUT].setVoltage(5.0 * f.samples[0], channel); + outputs[OUTPUT_OUT].setVoltage(5.f * f.samples[0], channel); } } // Channels @@ -787,7 +787,7 @@ struct NodiWidget : SanguineModuleWidget { addChild(nodiFrambuffer); const float lightXBase = 5.256f; - const float lightXDelta = 4.0f; + const float lightXDelta = 4.f; const int offset = 8; float currentX = lightXBase; diff --git a/src/nodicommon.cpp b/src/nodicommon.cpp index c3504587..faa256e7 100644 --- a/src/nodicommon.cpp +++ b/src/nodicommon.cpp @@ -12,7 +12,7 @@ void NodiDisplay::drawLayer(const DrawArgs& args, int layer) { // Text nvgFontSize(args.vg, fontSize); nvgFontFaceId(args.vg, font->handle); - nvgTextLetterSpacing(args.vg, 2.5); + nvgTextLetterSpacing(args.vg, 2.5f); Vec textPos = Vec(9, 52); nvgFillColor(args.vg, nvgTransRGBA(textColor, 16)); diff --git a/src/sanguinecomponents.cpp b/src/sanguinecomponents.cpp index 444fb1ca..c7143048 100644 --- a/src/sanguinecomponents.cpp +++ b/src/sanguinecomponents.cpp @@ -180,10 +180,10 @@ SanguineBaseSegmentDisplay::SanguineBaseSegmentDisplay(uint32_t newCharacterCoun void SanguineBaseSegmentDisplay::draw(const DrawArgs& args) { // Background nvgBeginPath(args.vg); - nvgRoundedRect(args.vg, 0.0, 0.0, box.size.x, box.size.y, 5.0); + nvgRoundedRect(args.vg, 0.f, 0.f, box.size.x, box.size.y, 5.f); nvgFillColor(args.vg, backgroundColor); nvgFill(args.vg); - nvgStrokeWidth(args.vg, 1.0); + nvgStrokeWidth(args.vg, 1.f); nvgStrokeColor(args.vg, borderColor); nvgStroke(args.vg); @@ -257,7 +257,7 @@ void SanguineBaseSegmentDisplay::drawLayer(const DrawArgs& args, int layer) { SanguineAlphaDisplay::SanguineAlphaDisplay(uint32_t newCharacterCount, Module* theModule, const float X, const float Y, bool createCentered) : SanguineBaseSegmentDisplay(newCharacterCount, theModule) { fontName = "res/components/Segment14.ttf"; - box.size = mm2px(Vec(newCharacterCount * 12.6, 21.2)); + box.size = mm2px(Vec(newCharacterCount * 12.6f, 21.2f)); fontSize = 40; if (createCentered) { @@ -276,8 +276,8 @@ SanguineAlphaDisplay::SanguineAlphaDisplay(uint32_t newCharacterCount, Module* t SanguineLedNumberDisplay::SanguineLedNumberDisplay(uint32_t newCharacterCount, Module* theModule, const float X, const float Y, bool createCentered) : SanguineBaseSegmentDisplay(newCharacterCount, theModule) { fontName = "res/components/Segment7Standard.otf"; - box.size = mm2px(Vec(newCharacterCount * 7.75, 15)); - fontSize = 33.95; + box.size = mm2px(Vec(newCharacterCount * 7.75f, 15.f)); + fontSize = 33.95f; if (createCentered) { box.pos = centerWidgetInMillimeters(this, X, Y); @@ -298,8 +298,8 @@ SanguineMatrixDisplay::SanguineMatrixDisplay(uint32_t newCharacterCount, Module* SanguineBaseSegmentDisplay(newCharacterCount, theModule) { fontName = "res/components/sanguinematrix.ttf"; - box.size = mm2px(Vec(newCharacterCount * 5.70275, 10.16)); - fontSize = 16.45; + box.size = mm2px(Vec(newCharacterCount * 5.70275f, 10.16f)); + fontSize = 16.45f; if (createCentered) { box.pos = centerWidgetInMillimeters(this, X, Y); @@ -317,8 +317,8 @@ SanguineMatrixDisplay::SanguineMatrixDisplay(uint32_t newCharacterCount, Module* SanguineTinyNumericDisplay::SanguineTinyNumericDisplay(uint32_t newCharacterCount, Module* theModule, const float X, const float Y, bool createCentered) : SanguineLedNumberDisplay(newCharacterCount, theModule, X, Y, createCentered) { displayType = DISPLAY_NUMERIC; - box.size = mm2px(Vec(newCharacterCount * 6.45, 8.f)); - fontSize = 21.4; + box.size = mm2px(Vec(newCharacterCount * 6.45f, 8.f)); + fontSize = 21.4f; if (createCentered) { box.pos = centerWidgetInMillimeters(this, X, Y); @@ -335,7 +335,7 @@ SanguineTinyNumericDisplay::SanguineTinyNumericDisplay(uint32_t newCharacterCoun Sanguine96x32OLEDDisplay::Sanguine96x32OLEDDisplay(Module* theModule, const float X, const float Y, bool createCentered) { fontName = "res/components/sanguinematrix.ttf"; - box.size = mm2px(Vec(16.298, 5.418)); + box.size = mm2px(Vec(16.298f, 5.418f)); module = theModule; @@ -353,10 +353,10 @@ void Sanguine96x32OLEDDisplay::draw(const DrawArgs& args) { NVGcolor backgroundColor = nvgRGB(10, 10, 10); NVGcolor borderColor = nvgRGB(100, 100, 100); nvgBeginPath(args.vg); - nvgRect(args.vg, 0.0, 0.0, box.size.x, box.size.y); + nvgRect(args.vg, 0.f, 0.f, box.size.x, box.size.y); nvgFillColor(args.vg, backgroundColor); nvgFill(args.vg); - nvgStrokeWidth(args.vg, 1.0); + nvgStrokeWidth(args.vg, 1.f); nvgStrokeColor(args.vg, borderColor); nvgStroke(args.vg); @@ -373,7 +373,7 @@ void Sanguine96x32OLEDDisplay::drawLayer(const DrawArgs& args, int layer) { nvgFillColor(args.vg, textColor); - Vec textPos = Vec(3, 7.5); + Vec textPos = Vec(3.f, 7.5f); if (module && !module->isBypassed()) { if (oledText && !(oledText->empty())) { @@ -386,7 +386,7 @@ void Sanguine96x32OLEDDisplay::drawLayer(const DrawArgs& args, int layer) { displayText += textCopy[i]; textCopy.erase(0, 8); nvgText(args.vg, textPos.x, textPos.y, displayText.c_str(), NULL); - textPos = Vec(3, 14.5); + textPos = Vec(3.f, 14.5f); displayText = ""; for (uint32_t i = 0; (i < 8 || i < textCopy.length()); i++) displayText += textCopy[i]; @@ -412,7 +412,7 @@ void Sanguine96x32OLEDDisplay::drawLayer(const DrawArgs& args, int layer) { SanguineLightUpSwitch::SanguineLightUpSwitch() { momentary = true; - shadow->opacity = 0.0; + shadow->opacity = 0.f; sw->wrap(); box.size = sw->box.size; } @@ -431,7 +431,7 @@ void SanguineLightUpSwitch::drawLayer(const DrawArgs& args, int layer) { nvgGlobalCompositeBlendFunc(args.vg, NVG_ONE_MINUS_DST_COLOR, NVG_ONE); rack::window::svgDraw(args.vg, svg->handle); if (frameNum < halos.size()) { - drawCircularHalo(args, box.size, halos[frameNum], 175, 8.f); + drawCircularHalo(args, box.size, halos[frameNum], 175.f, 8.f); } } } @@ -440,7 +440,7 @@ void SanguineLightUpSwitch::drawLayer(const DrawArgs& args, int layer) { SanguineLightUpRGBSwitch::SanguineLightUpRGBSwitch() { momentary = true; - shadow->opacity = 0.0; + shadow->opacity = 0.f; sw->wrap(); box.size = sw->box.size; transformWidget = new TransformWidget; @@ -482,7 +482,7 @@ void SanguineLightUpRGBSwitch::drawLayer(const DrawArgs& args, int layer) { Programmer responsibility: make sure there are enough halos here for every switch state or Rack will go to synth heaven. */ - drawCircularHalo(args, box.size, halos[frameNum], 175, 8.f); + drawCircularHalo(args, box.size, halos[frameNum], 175.f, 8.f); } // For module browser else if (!module && sw->svg) { @@ -505,7 +505,7 @@ void SanguineLightUpRGBSwitch::setBackground(const std::string fileName) { fb->box.size = sw->box.size; // Move shadow downward by 10% shadow->box.size = sw->box.size; - shadow->box.pos = math::Vec(0, sw->box.size.y * 0.10); + shadow->box.pos = math::Vec(0.f, sw->box.size.y * 0.10f); } void SanguineLightUpRGBSwitch::setGlyph(const std::string fileName, const float offsetX, const float offsetY) { @@ -559,7 +559,7 @@ NVGpaint SanguineMultiColoredShapedLight::getPaint(NVGcontext* vg, NSVGpaint* p, if (p->type == NSVG_PAINT_LINEAR_GRADIENT) paint = nvgLinearGradient(vg, s.x, s.y, e.x, e.y, innerColor, outerColor); else - paint = nvgRadialGradient(vg, s.x, s.y, 0.0, 160, innerColor, outerColor); + paint = nvgRadialGradient(vg, s.x, s.y, 0.f, 160.f, innerColor, outerColor); return paint; }; @@ -581,7 +581,7 @@ void SanguineMultiColoredShapedLight::drawLayer(const DrawArgs& args, int layer) nvgSave(args.vg); // Opacity - if (shape->opacity < 1.0) + if (shape->opacity < 1.f) nvgAlpha(args.vg, shape->opacity); // Build path @@ -606,7 +606,7 @@ void SanguineMultiColoredShapedLight::drawLayer(const DrawArgs& args, int layer) // Using the even-odd fill rule, if we draw a line from a point on the path to a point outside the boundary (e.g. top left) and count the number of times it crosses another path, the parity of this count determines whether the path is a hole (odd) or solid (even). int crossings = 0; math::Vec p0 = math::Vec(path->pts[0], path->pts[1]); - math::Vec p1 = math::Vec(path->bounds[0] - 1.0, path->bounds[1] - 1.0); + math::Vec p1 = math::Vec(path->bounds[0] - 1.f, path->bounds[1] - 1.f); // Iterate all other paths for (NSVGpath* path2 = shape->paths; path2; path2 = path2->next) { if (path2 == path) @@ -623,7 +623,7 @@ void SanguineMultiColoredShapedLight::drawLayer(const DrawArgs& args, int layer) math::Vec p3 = (i < path2->npts) ? math::Vec(p[4], p[5]) : math::Vec(path2->pts[0], path2->pts[1]); float crossing = getLineCrossing(p0, p1, p2, p3); float crossing2 = getLineCrossing(p2, p3, p0, p1); - if (0.0 <= crossing && crossing < 1.0 && 0.0 <= crossing2) { + if (0.f <= crossing && crossing < 1.f && 0.f <= crossing2) { crossings++; } } @@ -995,7 +995,7 @@ void drawRectHalo(const Widget::DrawArgs& args, const Vec boxSize, const NVGcolo NVGcolor icol = color::mult(nvgTransRGBA(haloColor, haloOpacity), halo); NVGcolor ocol = nvgRGBA(0, 0, 0, 0); - NVGpaint paint = nvgBoxGradient(args.vg, 4.5f + positionX, 4.5f, boxSize.x - 4.5, boxSize.y - 4.5, 5, 8, icol, ocol); + NVGpaint paint = nvgBoxGradient(args.vg, 4.5f + positionX, 4.5f, boxSize.x - 4.5f, boxSize.y - 4.5f, 5.f, 8.f, icol, ocol); nvgFillPaint(args.vg, paint); nvgFill(args.vg); diff --git a/src/sanguinecomponents.hpp b/src/sanguinecomponents.hpp index 0096c734..e6f2c740 100644 --- a/src/sanguinecomponents.hpp +++ b/src/sanguinecomponents.hpp @@ -261,14 +261,14 @@ template struct CKD6Light : TBase { CKD6Light() { this->bgColor = color::BLACK_TRANSPARENT; - this->box.size = Vec(28 - 6, 28 - 6); + this->box.size = Vec(28.f - 6.f, 28.f - 6.f); } }; template struct Rogan6PSLight : Base { Rogan6PSLight() { - this->box.size = mm2px(Vec(23.04, 23.04)); + this->box.size = mm2px(Vec(23.04f, 23.04f)); this->borderColor = nvgRGBA(0, 0, 0, 0); } }; diff --git a/src/sanguinedsp.hpp b/src/sanguinedsp.hpp index 3bcf17f9..dd5df0ee 100644 --- a/src/sanguinedsp.hpp +++ b/src/sanguinedsp.hpp @@ -11,7 +11,7 @@ struct SaturatorFloat_4 { static inline simd::float_4 saturation(simd::float_4 x) { const simd::float_4 y1 = 0.98765f; // (2*x - 1)/x**2 where x is 0.9. const simd::float_4 offset = 0.075f / limit; // Magic. - simd::float_4 x1 = (x + 1.0f) * 0.5f; + simd::float_4 x1 = (x + 1.f) * 0.5f; return limit * (offset + x1 - simd::sqrt(x1 * x1 - y1 * x) * (1.f / y1)); } @@ -29,7 +29,7 @@ struct SaturatorFloat { static inline float saturation(float x) { const float y1 = 0.98765f; // (2*x - 1)/x**2 where x is 0.9. const float offset = 0.075f / limit; // Magic. - float x1 = (x + 1.0f) * 0.5f; + float x1 = (x + 1.f) * 0.5f; return limit * (offset + x1 - sqrtf(x1 * x1 - y1 * x) * (1.f / y1)); } diff --git a/src/velamina.cpp b/src/velamina.cpp index 265248c0..cf71bdd3 100644 --- a/src/velamina.cpp +++ b/src/velamina.cpp @@ -59,7 +59,7 @@ struct Velamina : SanguineModule { config(PARAMS_COUNT, INPUTS_COUNT, OUTPUTS_COUNT, LIGHTS_COUNT); for (int i = 0; i < 4; i++) { - configParam(PARAM_GAIN_1 + i, 0.f, 1.f, 0.f, string::f("Channel %d gain", i + 1), "%", 0, 100); + configParam(PARAM_GAIN_1 + i, 0.f, 1.f, 0.f, string::f("Channel %d gain", i + 1), "%", 0.f, 100.f); configParam(PARAM_RESPONSE_1 + i, 0.f, 1.f, 0.f, string::f("Channel %d response (Exponential <-> Linear)", i + 1)); configParam(PARAM_OFFSET_1 + i, 0.f, 5.f, 0.f, string::f("Channel %d CV offset", i + 1), "V"); configInput(INPUT_IN_1 + i, string::f("Channel %d", i + 1));