diff --git a/docs/community_features.md b/docs/community_features.md index 874a6a9fd2..fc3f941de1 100644 --- a/docs/community_features.md +++ b/docs/community_features.md @@ -47,6 +47,10 @@ Here is a list of general improvements that have been made, ordered from newest - The value range displayed is 0-50 for non-MIDI parameters and 0-127 for MIDI parameters. - Note: In the Menu, if you wish to scroll through the parameter value range faster at an accelerated rate of +/- 5, hold Shift while turning the Select Encoder. +#### 3.9 - Adjust Metronome Volume +- ([#683]) The Metronome's volume now respects the song's volume and will increase and decrease in volume together with the Gold Volume Encoder. + - In addition, a Default menu was created titled "Metronome" which enables you to set a value between 22 and 27 to further adjust the volume of the Metronome. 22 being the lowest metronome volume that can be heard when the Song's volume is at its maximum and 27 being the loudest metronome volume. + ## 4. New Features Added Here is a list of features that have been added to the firmware as a list, grouped by category: @@ -212,6 +216,10 @@ Synchronization modes accessible through the "LFO SYNC" shortcut. - ([#360]) Fixed interpolation bugs, added fine tuning for long presses, and added pad selection mode - ([#636]) Updated Parameter Values displayed in Automation View to match Parameter Value Ranges displayed in the Menu's. E.g. instead of 0 - 128, it now displays 0 - 50 (except for Pan which now displays -25 to +25 and MIDI instrument clips which now display 0 - 127). - ([#658]) Added Stutter Rate Parameter to Automation View. There is no grid shortcut for this parameter so you will not see a pad on the Automation Overview that indicates whether Stutter has been automated. This parameter can be selected and automated using the Select Encoder to scroll the available list of Automatable Parameters. + - ([#681]) Added new automation community feature menu to re-instate audition pad shortcuts in the Automation Instrument Clip View. + - Currently in the Instrument Clip View if you hold down an audition pad and press a shortcut pad on the grid, it will open the menu corresponding to that shortcut pad. + - By default in the Automation Instrument Clip View that same behaviour of holding an audition pad and pressing a shortcut pad is disabled in favour of you being able to hold down an audition pad and adjust the automation lane values so that you can audible hear the changes to the sound while adjusting automation settings. + - Through the community features menu, you can disable this change and re-instate the audition pad shortcuts by setting the community feature to "Off." #### 4.3.6 - Set Probability By Row @@ -322,6 +330,12 @@ In the main menu of the deluge (accessed by pressing "SHIFT" + the "SELECT" knob * Shift Note (SHIF) * When On, shifting notes horizontally in the regular Instrument Clip View will shift the Notes and MPE, but not the Automation. * When On, to shift Non-MPE Automation horizontally you will need to enter the Automation Instrument Clip View. + * Disable Audition Pad Shortcuts (SCUT) + * When On, audition pad shortcuts are disabled. Holding an audition pad and pressing a shortcut pad will not activate the shortcut and will not change the selected parameter. + * When On, to change the selected parameter you will need to either: + 1) use the select encoder; + 2) use the shift + shortcut pad combo; or + 3) go back to the automation overview; * Allow Insecure Develop Sysex Messages (SYX) * When On, the ability to load firmware over USB is enabled. * Sync Scaling Action (SCAL) @@ -408,4 +422,6 @@ This list includes all preprocessor switches that can alter firmware behaviour a [#636]: https://github.com/SynthstromAudible/DelugeFirmware/pull/636 [#653]: https://github.com/SynthstromAudible/DelugeFirmware/pull/653 [#658]: https://github.com/SynthstromAudible/DelugeFirmware/pull/658 +[#681]: https://github.com/SynthstromAudible/DelugeFirmware/pull/681 +[#683]: https://github.com/SynthstromAudible/DelugeFirmware/pull/683 [Automation View Documentation]: https://github.com/SynthstromAudible/DelugeFirmware/blob/release/1.0/docs/features/automation_view.md diff --git a/docs/features/automation_view.md b/docs/features/automation_view.md index df23fdc174..91df1d8970 100644 --- a/docs/features/automation_view.md +++ b/docs/features/automation_view.md @@ -321,6 +321,16 @@ In the Automation Instrument Clip View, functionality is provided to shift autom > **Note:** MPE recorded will still be shifted as the scope of this PR does not cover editing MPE. +### Disable Audition Pad Shortcuts + +Currently in the Instrument Clip View if you hold down an audition pad and press a shortcut pad on the grid, it will open the menu corresponding to that shortcut pad. + +By default in the Automation Instrument Clip View that same behaviour of holding an audition pad and pressing a shortcut pad is disabled in favour of you being able to hold down an audition pad and adjust the automation lane values so that you can audible hear the changes to the sound while adjusting automation settings. + +Through the community features menu, you can disable this change and re-instate the audition pad shortcuts by setting the community feature to "Off." + +> **Note:** in automation view, shortcuts do not open the menu. They change the selected parameter for automation lane editing. + # Fun things to try with the new Automation Instrument Clip View ## Two Hand Automation Drumming diff --git a/src/definitions_cxx.hpp b/src/definitions_cxx.hpp index 59940c4ac6..f67771eb9a 100644 --- a/src/definitions_cxx.hpp +++ b/src/definitions_cxx.hpp @@ -370,6 +370,11 @@ constexpr int32_t kMinMenuPanValue = -1 * kMaxMenuPanValue; //patch cable menu range e.g. -5000 to 5000 constexpr int32_t kMaxMenuPatchCableValue = kMaxMenuValue * 100; constexpr int32_t kMinMenuPatchCableValue = -1 * kMaxMenuPatchCableValue; + +//metronome volume menu range : 22 to 27 +constexpr int32_t kMaxMenuMetronomeVolumeValue = 27; +constexpr int32_t kMinMenuMetronomeVolumeValue = 22; + // //Automation View constants diff --git a/src/deluge/gui/l10n/english.cpp b/src/deluge/gui/l10n/english.cpp index 9d2ebb311f..a1742439be 100644 --- a/src/deluge/gui/l10n/english.cpp +++ b/src/deluge/gui/l10n/english.cpp @@ -504,6 +504,7 @@ PLACE_SDRAM_DATA Language english{ {STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_CLEAR_CLIP, "Clear Clip"}, {STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_NUDGE_NOTE, "Nudge Note"}, {STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_SHIFT_CLIP, "Shift Note"}, + {STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_DISABLE_AUDITION_PAD_SHORTCUTS, "Disable Audition Pad Shortcuts"}, {STRING_FOR_COMMUNITY_FEATURE_DEV_SYSEX, "Allow Insecure Develop Sysex Messages"}, {STRING_FOR_COMMUNITY_FEATURE_SYNC_SCALING_ACTION, "Sync Scaling Action"}, {STRING_FOR_COMMUNITY_FEATURE_HIGHLIGHT_INCOMING_NOTES, "Highlight Incoming Notes"}, @@ -691,6 +692,8 @@ PLACE_SDRAM_DATA Language english{ {STRING_FOR_SIDECH_RELEASE_MENU_TITLE, "Sidech release"}, {STRING_FOR_SIDECHAIN_COMP_MENU_TITLE, "Sidechain comp"}, {STRING_FOR_NUM_MEMBER_CH_MENU_TITLE, "Num member ch."}, + {STRING_FOR_METRONOME, "METRONOME"}, + {STRING_FOR_DEFAULT_METRO_MENU_TITLE, "Default metro."}, {STRING_FOR_CV_INSTRUMENT, "CV instrument"}, diff --git a/src/deluge/gui/l10n/seven_segment.cpp b/src/deluge/gui/l10n/seven_segment.cpp index dd93ebfb41..c16e43e8a5 100644 --- a/src/deluge/gui/l10n/seven_segment.cpp +++ b/src/deluge/gui/l10n/seven_segment.cpp @@ -343,6 +343,7 @@ PLACE_SDRAM_DATA Language seven_segment{ {STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_CLEAR_CLIP, "CLEA"}, {STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_NUDGE_NOTE, "NUDG"}, {STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_SHIFT_CLIP, "SHIF"}, + {STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_DISABLE_AUDITION_PAD_SHORTCUTS, "SCUT"}, {STRING_FOR_COMMUNITY_FEATURE_DEV_SYSEX, "SYSX"}, {STRING_FOR_COMMUNITY_FEATURE_SYNC_SCALING_ACTION, "SCAL"}, {STRING_FOR_COMMUNITY_FEATURE_HIGHLIGHT_INCOMING_NOTES, "HIGH"}, diff --git a/src/deluge/gui/l10n/strings.h b/src/deluge/gui/l10n/strings.h index 21c1e33fad..16dd9e8f43 100644 --- a/src/deluge/gui/l10n/strings.h +++ b/src/deluge/gui/l10n/strings.h @@ -407,6 +407,7 @@ enum class String : size_t { STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_CLEAR_CLIP, STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_NUDGE_NOTE, STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_SHIFT_CLIP, + STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_DISABLE_AUDITION_PAD_SHORTCUTS, STRING_FOR_COMMUNITY_FEATURE_DEV_SYSEX, STRING_FOR_COMMUNITY_FEATURE_SYNC_SCALING_ACTION, STRING_FOR_COMMUNITY_FEATURE_HIGHLIGHT_INCOMING_NOTES, @@ -570,6 +571,7 @@ enum class String : size_t { STRING_FOR_AUDIO_CLIP, STRING_FOR_SETTINGS, STRING_FOR_STUTTER_RATE, + STRING_FOR_METRONOME, // MENU TITLES STRING_FOR_ENV_ATTACK_MENU_TITLE, @@ -614,6 +616,7 @@ enum class String : size_t { STRING_FOR_MASTER_TRAN_MENU_TITLE, STRING_FOR_MIDI_INST_MENU_TITLE, STRING_FOR_NUM_MEMBER_CH_MENU_TITLE, + STRING_FOR_DEFAULT_METRO_MENU_TITLE, STRING_FOR_CV_INSTRUMENT, diff --git a/src/deluge/gui/menu_item/defaults/metronome_volume.h b/src/deluge/gui/menu_item/defaults/metronome_volume.h new file mode 100644 index 0000000000..6b3f4c08ba --- /dev/null +++ b/src/deluge/gui/menu_item/defaults/metronome_volume.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2014-2023 Synthstrom Audible Limited + * + * This file is part of The Synthstrom Audible Deluge Firmware. + * + * The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program. + * If not, see . +*/ +#pragma once +#include "gui/menu_item/integer.h" +#include "storage/flash_storage.h" + +namespace deluge::gui::menu_item::defaults { +class MetronomeVolume final : public Integer { +public: + using Integer::Integer; + [[nodiscard]] int32_t getMinValue() const override { return kMinMenuMetronomeVolumeValue; } + [[nodiscard]] int32_t getMaxValue() const override { return kMaxMenuMetronomeVolumeValue; } + void readCurrentValue() override { this->setValue(FlashStorage::defaultMetronomeVolume); } + void writeCurrentValue() override { FlashStorage::defaultMetronomeVolume = this->getValue(); } +}; +} // namespace deluge::gui::menu_item::defaults diff --git a/src/deluge/gui/menu_item/runtime_feature/settings.cpp b/src/deluge/gui/menu_item/runtime_feature/settings.cpp index f253ab0eba..15a4bc2c65 100644 --- a/src/deluge/gui/menu_item/runtime_feature/settings.cpp +++ b/src/deluge/gui/menu_item/runtime_feature/settings.cpp @@ -44,6 +44,7 @@ Setting menuAutomationInterpolate(RuntimeFeatureSettingType::AutomationInterpola Setting menuAutomationClearClip(RuntimeFeatureSettingType::AutomationClearClip); Setting menuAutomationNudgeNote(RuntimeFeatureSettingType::AutomationNudgeNote); Setting menuAutomationShiftClip(RuntimeFeatureSettingType::AutomationShiftClip); +Setting menuAutomationDisableAuditionPadShortcuts(RuntimeFeatureSettingType::AutomationDisableAuditionPadShortcuts); Setting menuSyncScalingAction(RuntimeFeatureSettingType::SyncScalingAction); DevSysexSetting menuDevSysexAllowed(RuntimeFeatureSettingType::DevSysexAllowed); Setting menuHighlightIncomingNotes(RuntimeFeatureSettingType::HighlightIncomingNotes); @@ -58,6 +59,7 @@ Submenu subMenuAutomation{ &menuAutomationClearClip, &menuAutomationNudgeNote, &menuAutomationShiftClip, + &menuAutomationDisableAuditionPadShortcuts, }, }; diff --git a/src/deluge/gui/ui/menus.cpp b/src/deluge/gui/ui/menus.cpp index 83c4dd3ed3..648695b7a3 100644 --- a/src/deluge/gui/ui/menus.cpp +++ b/src/deluge/gui/ui/menus.cpp @@ -32,6 +32,7 @@ #include "gui/menu_item/defaults/grid_unarm_empty_pads.h" #include "gui/menu_item/defaults/keyboard_layout.h" #include "gui/menu_item/defaults/magnitude.h" +#include "gui/menu_item/defaults/metronome_volume.h" #include "gui/menu_item/defaults/scale.h" #include "gui/menu_item/defaults/session_layout.h" #include "gui/menu_item/defaults/velocity.h" @@ -853,6 +854,7 @@ defaults::Scale defaultScaleMenu{STRING_FOR_SCALE, STRING_FOR_DEFAULT_SCALE}; defaults::Velocity defaultVelocityMenu{STRING_FOR_VELOCITY, STRING_FOR_DEFAULT_VELOC_MENU_TITLE}; defaults::Magnitude defaultMagnitudeMenu{STRING_FOR_RESOLUTION, STRING_FOR_DEFAULT_RESOL_MENU_TITLE}; defaults::BendRange defaultBendRangeMenu{STRING_FOR_BEND_RANGE, STRING_FOR_DEFAULT_BEND_R}; +defaults::MetronomeVolume defaultMetronomeVolumeMenu{STRING_FOR_METRONOME, STRING_FOR_DEFAULT_METRO_MENU_TITLE}; Submenu defaultsSubmenu{ STRING_FOR_DEFAULTS, @@ -865,6 +867,7 @@ Submenu defaultsSubmenu{ &defaultVelocityMenu, &defaultMagnitudeMenu, &defaultBendRangeMenu, + &defaultMetronomeVolumeMenu, }, }; diff --git a/src/deluge/gui/views/automation_instrument_clip_view.cpp b/src/deluge/gui/views/automation_instrument_clip_view.cpp index 87c4ccad97..4da41b7932 100644 --- a/src/deluge/gui/views/automation_instrument_clip_view.cpp +++ b/src/deluge/gui/views/automation_instrument_clip_view.cpp @@ -1465,8 +1465,10 @@ ActionResult AutomationInstrumentClipView::padAction(int32_t x, int32_t y, int32 //if the user wants to change the parameter they are editing using Shift + Pad shortcut if (velocity) { - if (Buttons::isShiftButtonPressed()) { - + if (Buttons::isShiftButtonPressed() + || (isUIModeActive(UI_MODE_AUDITIONING) + && (runtimeFeatureSettings.get(RuntimeFeatureSettingType::AutomationDisableAuditionPadShortcuts) + == RuntimeFeatureStateToggle::Off))) { initPadSelection(); handleSinglePadPress(modelStack, clip, x, y, true); @@ -2434,10 +2436,8 @@ bool AutomationInstrumentClipView::modEncoderActionForSelectedPad(int32_t whichM //ignore modEncoderTurn for Midi CC if current or new knobPos exceeds 127 //if current knobPos exceeds 127, e.g. it's 128, then it needs to drop to 126 before a value change gets recorded //if newKnobPos exceeds 127, then it means current knobPos was 127 and it was increased to 128. In which case, ignore value change - if (clip->output->type == InstrumentType::MIDI_OUT) { - if ((knobPos == 64) || (newKnobPos == 64)) { - return true; - } + if ((clip->output->type == InstrumentType::MIDI_OUT) && (newKnobPos == 64)) { + return true; } //use default interpolation settings @@ -2481,10 +2481,8 @@ void AutomationInstrumentClipView::modEncoderActionForUnselectedPad(int32_t whic //ignore modEncoderTurn for Midi CC if current or new knobPos exceeds 127 //if current knobPos exceeds 127, e.g. it's 128, then it needs to drop to 126 before a value change gets recorded //if newKnobPos exceeds 127, then it means current knobPos was 127 and it was increased to 128. In which case, ignore value change - if (clip->output->type == InstrumentType::MIDI_OUT) { - if ((knobPos == 64) || (newKnobPos == 64)) { - return; - } + if ((clip->output->type == InstrumentType::MIDI_OUT) && (newKnobPos == 64)) { + return; } int32_t newValue = diff --git a/src/deluge/gui/views/view.cpp b/src/deluge/gui/views/view.cpp index 955438be4f..83bdc8ab19 100644 --- a/src/deluge/gui/views/view.cpp +++ b/src/deluge/gui/views/view.cpp @@ -874,10 +874,8 @@ void View::modEncoderAction(int32_t whichModEncoder, int32_t offset) { //if current knobPos exceeds 127, e.g. it's 128, then it needs to drop to 126 before a value change gets recorded //if newKnobPos exceeds 127, then it means current knobPos was 127 and it was increased to 128. In which case, ignore value change if ((getRootUI() == &instrumentClipView) || (getRootUI() == &automationInstrumentClipView)) { - if (clip->output->type == InstrumentType::MIDI_OUT) { - if ((knobPos == 64) || (newKnobPos == 64)) { - return; - } + if ((clip->output->type == InstrumentType::MIDI_OUT) && (newKnobPos == 64)) { + return; } } @@ -894,7 +892,7 @@ void View::modEncoderAction(int32_t whichModEncoder, int32_t offset) { char buffer[5]; int32_t valueForDisplay; if (clip->output->type == InstrumentType::MIDI_OUT) { - valueForDisplay = newKnobPos = kKnobPosOffset; + valueForDisplay = newKnobPos + kKnobPosOffset; } else if ((modelStackWithParam->paramId == Param::Local::PAN) || (modelStackWithParam->paramId == Param::Unpatched::GlobalEffectable::PAN)) { diff --git a/src/deluge/model/settings/runtime_feature_settings.cpp b/src/deluge/model/settings/runtime_feature_settings.cpp index 0f8d1d24e0..cb54d983ca 100644 --- a/src/deluge/model/settings/runtime_feature_settings.cpp +++ b/src/deluge/model/settings/runtime_feature_settings.cpp @@ -127,6 +127,10 @@ void RuntimeFeatureSettings::init() { SetupOnOffSetting(settings[RuntimeFeatureSettingType::AutomationShiftClip], deluge::l10n::getView(STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_SHIFT_CLIP), "automationShiftClip", RuntimeFeatureStateToggle::On); + // Disable Audition Pad Shortcuts in Automation View + SetupOnOffSetting(settings[RuntimeFeatureSettingType::AutomationDisableAuditionPadShortcuts], + deluge::l10n::getView(STRING_FOR_COMMUNITY_FEATURE_AUTOMATION_DISABLE_AUDITION_PAD_SHORTCUTS), + "automationDisableAuditionPadShortcuts", RuntimeFeatureStateToggle::On); // devSysexAllowed SetupOnOffSetting(settings[RuntimeFeatureSettingType::DevSysexAllowed], deluge::l10n::getView(STRING_FOR_COMMUNITY_FEATURE_DEV_SYSEX), "devSysexAllowed", diff --git a/src/deluge/model/settings/runtime_feature_settings.h b/src/deluge/model/settings/runtime_feature_settings.h index 4f5fd2cdb3..8d00980584 100644 --- a/src/deluge/model/settings/runtime_feature_settings.h +++ b/src/deluge/model/settings/runtime_feature_settings.h @@ -50,6 +50,7 @@ enum RuntimeFeatureSettingType : uint32_t { AutomationNudgeNote, AutomationShiftClip, AutomationInterpolate, + AutomationDisableAuditionPadShortcuts, DevSysexAllowed, SyncScalingAction, HighlightIncomingNotes, diff --git a/src/deluge/processing/engines/audio_engine.cpp b/src/deluge/processing/engines/audio_engine.cpp index ae96f408f0..19b96743c6 100644 --- a/src/deluge/processing/engines/audio_engine.cpp +++ b/src/deluge/processing/engines/audio_engine.cpp @@ -597,7 +597,8 @@ void routine() { //the max error is 0.3ms. At 100bpm 24ppq it is 25ms per pulse //this works out to a 1% error in the absolute worse case of alternating //no extension and max extension, approximately 10x better than average usb midi accuracy. - numSamples = std::max(numSamples, MINSAMPLES); + int32_t minSamples = std::min(unadjustedNumSamplesBeforeLappingPlayHead, MINSAMPLES); + numSamples = std::max(numSamples, minSamples); numSamplesLastTime = numSamples; memset(&renderingBuffer, 0, numSamples * sizeof(StereoSample)); @@ -1414,11 +1415,15 @@ void slowRoutine() { - SSI_TX_BUFFER_NUM_SAMPLES) & (SSI_RX_BUFFER_NUM_SAMPLES - 1); - if (latencyWithinAppropriateWindow >= SSI_TX_BUFFER_NUM_SAMPLES) { + while (latencyWithinAppropriateWindow >= SSI_TX_BUFFER_NUM_SAMPLES) { i2sRXBufferPos += (SSI_TX_BUFFER_NUM_SAMPLES << (2 + NUM_MONO_INPUT_CHANNELS_MAGNITUDE)); if (i2sRXBufferPos >= (uint32_t)getRxBufferEnd()) { i2sRXBufferPos -= (SSI_RX_BUFFER_NUM_SAMPLES << (2 + NUM_MONO_INPUT_CHANNELS_MAGNITUDE)); } + latencyWithinAppropriateWindow = + (((rxBufferWriteAddr - (uint32_t)i2sRXBufferPos) >> (2 + NUM_MONO_INPUT_CHANNELS_MAGNITUDE)) + - SSI_TX_BUFFER_NUM_SAMPLES) + & (SSI_RX_BUFFER_NUM_SAMPLES - 1); } // Discard any LiveInputBuffers which aren't in use diff --git a/src/deluge/processing/metronome/metronome.cpp b/src/deluge/processing/metronome/metronome.cpp index 1962149907..3b11045ef0 100644 --- a/src/deluge/processing/metronome/metronome.cpp +++ b/src/deluge/processing/metronome/metronome.cpp @@ -17,6 +17,10 @@ #include "processing/metronome/metronome.h" #include "dsp/stereo_sample.h" +#include "model/song/song.h" +#include "modulation/params/param_set.h" +#include "processing/engines/audio_engine.h" +#include "storage/flash_storage.h" Metronome::Metronome() { sounding = false; @@ -33,17 +37,29 @@ void Metronome::render(StereoSample* buffer, uint16_t numSamples) { if (!sounding) { return; } + int32_t volumePostFX; + if (currentSong) { + volumePostFX = getFinalParameterValueVolume( + 1 << FlashStorage::defaultMetronomeVolume, + cableToLinearParamShortcut(currentSong->paramManager.getUnpatchedParamSet()->getValue( + Param::Unpatched::GlobalEffectable::VOLUME))) + >> 1; + } + else { + volumePostFX = ONE_Q31; + } + q31_t high = multiply_32x32_rshift32(1 << FlashStorage::defaultMetronomeVolume, volumePostFX); StereoSample* thisSample = buffer; StereoSample* bufferEnd = buffer + numSamples; do { int32_t value; if (phase < 2147483648u) { - value = 8388608; + value = high; } else { - value = -8388608; + value = -high; } phase += phaseIncrement; diff --git a/src/deluge/storage/flash_storage.cpp b/src/deluge/storage/flash_storage.cpp index c228247d72..85de2e2e0d 100644 --- a/src/deluge/storage/flash_storage.cpp +++ b/src/deluge/storage/flash_storage.cpp @@ -118,6 +118,7 @@ namespace FlashStorage { 119: gridUnarmEmptyPads 120: gridAllowGreenSelection 121: defaultGridActiveMode +122: defaultMetronomeVolume */ uint8_t defaultScale; @@ -142,6 +143,8 @@ bool gridUnarmEmptyPads; bool gridAllowGreenSelection; GridDefaultActiveMode defaultGridActiveMode; +uint8_t defaultMetronomeVolume; + void resetSettings() { cvEngine.setCVVoltsPerOctave(0, 100); @@ -212,6 +215,8 @@ void resetSettings() { gridUnarmEmptyPads = false; gridAllowGreenSelection = true; defaultGridActiveMode = GridDefaultActiveModeSelection; + + defaultMetronomeVolume = kMaxMenuMetronomeVolumeValue; } void readSettings() { @@ -407,6 +412,12 @@ void readSettings() { gridUnarmEmptyPads = buffer[119]; gridAllowGreenSelection = buffer[120]; defaultGridActiveMode = static_cast(buffer[121]); + + defaultMetronomeVolume = buffer[122]; + if (defaultMetronomeVolume > kMaxMenuMetronomeVolumeValue + || defaultMetronomeVolume < kMinMenuMetronomeVolumeValue) { + defaultMetronomeVolume = kMaxMenuMetronomeVolumeValue; + } } void writeSettings() { @@ -516,6 +527,8 @@ void writeSettings() { buffer[120] = gridAllowGreenSelection; buffer[121] = util::to_underlying(defaultGridActiveMode); + buffer[122] = defaultMetronomeVolume; + R_SFLASH_EraseSector(0x80000 - 0x1000, SPIBSC_CH, SPIBSC_CMNCR_BSZ_SINGLE, 1, SPIBSC_OUTPUT_ADDR_24); R_SFLASH_ByteProgram(0x80000 - 0x1000, buffer, 256, SPIBSC_CH, SPIBSC_CMNCR_BSZ_SINGLE, SPIBSC_1BIT, SPIBSC_OUTPUT_ADDR_24); diff --git a/src/deluge/storage/flash_storage.h b/src/deluge/storage/flash_storage.h index e4459ec59d..e7247d3da6 100644 --- a/src/deluge/storage/flash_storage.h +++ b/src/deluge/storage/flash_storage.h @@ -44,6 +44,8 @@ extern bool gridUnarmEmptyPads; extern bool gridAllowGreenSelection; extern GridDefaultActiveMode defaultGridActiveMode; +extern uint8_t defaultMetronomeVolume; + void readSettings(); void writeSettings(); void resetSettings();