BaseMachine UI Controllerに分離
Dependencies: AverageAnalogIn PinDetect RotaryEncoder Sequence SequencerDisplay mbed-rtos mbed st7567LCD BaseMachineComon
Fork of BaseMachine_Sequencer by
Diff: main.cpp
- Revision:
- 40:2f9616bdcf65
- Parent:
- 38:cafa2fff5565
- Child:
- 41:48864f5f5424
--- a/main.cpp Sat Oct 01 22:18:08 2016 +0000 +++ b/main.cpp Sat Oct 01 22:37:05 2016 +0000 @@ -32,6 +32,8 @@ const int baseNoteNumber = 36; const int bpmMax = 240; const int bpmMin = 60; +const int octaveMax = 2; +const int octaveMin = -2; const int waveShapeMax = 1; const int UImodeMax = 2; @@ -218,7 +220,7 @@ #endif uint8_t _waveShape = oscillatorParam.waveShape; _waveShape++; - if (_waveShape == waveShapeMax) { + if (_waveShape > waveShapeMax) { _waveShape = 0; } oscillatorParam.waveShape = _waveShape; @@ -243,18 +245,22 @@ #if (UART_TRACE) printf("PinOctaveUp Pushed\r\n"); #endif - sequencerDisplay.setOctave(sequencerDisplay.getOctave() + 1); + if (sequencerDisplay.getOctave() < octaveMax ) { + sequencerDisplay.setOctave(sequencerDisplay.getOctave() + 1); + isDirty = true; + } pinFlag &= ~bOctaveUp; - isDirty = true; } if (pinFlag & bOctaveDown) { #if (UART_TRACE) printf("PinOctaveDown Pushed\r\n"); #endif - sequencerDisplay.setOctave(sequencerDisplay.getOctave() - 1); + if (sequencerDisplay.getOctave () > octaveMin) { + sequencerDisplay.setOctave(sequencerDisplay.getOctave() - 1); + isDirty = true; + } pinFlag &= ~bOctaveDown; - isDirty = true; } if (pinFlag & bNoteOnOff) {