This now matches original Gravity behavior. Also, now when applying CV mod positive voltages increase clock mod instead of reducing it.
Also fix pulse out, which wasn't previously updated when CLOCK_MOD was moved to program mem.
Reviewed-on: https://git.pinkduck.xyz/awonak/libGravity/pulls/16
Each channel can define a euclidean rhythm by setting a number of steps (up to 16) and a number of hits to evenly distribute within those steps. CV Mod is available, however the cv mod acts as an override instead of a sum mix like the other parameters.
Refactor `applyCvMod()` so it is only called if cv mod is active for that channel. Now the setter methods will update the final output value if cv mod is not active.
Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/9
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
Convert all string references from const char* to String/F() to store values in flash instead of ram.
Memory usage from `main`:
```
Sketch uses 27878 bytes (90%) of program storage space. Maximum is 30720 bytes.
Global variables use 1755 bytes (85%) of dynamic memory, leaving 293 bytes for local variables. Maximum is 2048 bytes.
```
Memory usage after these changes:
```
Sketch uses 28054 bytes (91%) of program storage space. Maximum is 30720 bytes.
Global variables use 1445 bytes (70%) of dynamic memory, leaving 603 bytes for local variables. Maximum is 2048 bytes.
```
This provides a dynamic memory savings of 310 bytes!
Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/8
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
Select swing amount from a percentage range of the beat starting a 50% (unchanged) to a max swing amount of 95% (about 1/32nd note before end of period). Swing percentage shows an indicator marker when the percentage lines up with a quantized note on the grid.
This is probably going to be the last feature because it is pushing up against the limits of available dynamic memory.
Out of scope changes:
- selecting parameters / values no longer wraps
- reduce dynamic memory used in processClockTick
- various readability formatting
Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/7
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
- add reset state menu option to return all settings back to default values.
- add reverse encoder menu option and save state
- make saving to EEPROM safer by wrapping put calls with noInterrupts()
- improve save state behavior by using a mutex flag and update check with debounce in main loop
- refactor gravity.h global const definitions to be static and more readable.
- improve usage of EncoderDir in ISR with pointer to instance and static isr() method.
- reduce u8g2 memory usage by using single page buffer
Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/6
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>
Each channel can enable CV 1 or CV 2 as an input source for modulation, which can be applied to any of the user-editable parameters. When editing the parameter, cv mod is not applied in the UI so the user can easily see the base value for editing. When not editing, the UI will display the current cv modded value in the UI for the modded parameter.
I had originally intended to provide configuration for attenuating and offsetting the cv input per channel, but that introduced a significant amount of memory needed to store several new ints per channel. I may return to add this feature later, but given it's something that can easily be done with other modules between the modulation source and Gravity cv input, I am deprioritizing this feature.
Reviewed-on: https://git.pinkduck.xyz/adam/libGravity/pulls/4
Co-authored-by: Adam Wonak <adam.wonak@gmail.com>
Co-committed-by: Adam Wonak <adam.wonak@gmail.com>