Display Class for BaseMachine
SequencerDisplay.h@14:92fd44537679, 2017-02-13 (annotated)
- Committer:
- ryood
- Date:
- Mon Feb 13 20:14:33 2017 +0000
- Revision:
- 14:92fd44537679
- Parent:
- 12:e6b2b72db313
Initialize SequencePattern as 0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ryood | 4:e51a5f0891a0 | 1 | |
ryood | 0:9a0f67fe026b | 2 | /* |
ryood | 0:9a0f67fe026b | 3 | * SequencerDisplay.h |
ryood | 0:9a0f67fe026b | 4 | * |
ryood | 0:9a0f67fe026b | 5 | * 2016.08.13 |
ryood | 0:9a0f67fe026b | 6 | * |
ryood | 0:9a0f67fe026b | 7 | */ |
ryood | 0:9a0f67fe026b | 8 | #ifndef _SEQUENCE_DISPLAY_H_ |
ryood | 0:9a0f67fe026b | 9 | #define _SEQUENCE_DISPLAY_H_ |
ryood | 0:9a0f67fe026b | 10 | |
ryood | 0:9a0f67fe026b | 11 | #include "mbed.h" |
ryood | 0:9a0f67fe026b | 12 | #include "Sequence.h" |
ryood | 0:9a0f67fe026b | 13 | |
ryood | 0:9a0f67fe026b | 14 | class SequencerDisplay { |
ryood | 0:9a0f67fe026b | 15 | public: |
ryood | 3:5b11261a545a | 16 | enum DisplayMode { stop, run }; |
ryood | 0:9a0f67fe026b | 17 | |
ryood | 0:9a0f67fe026b | 18 | SequencerDisplay(Sequence* _sequences, int _sequenceNum) : |
ryood | 0:9a0f67fe026b | 19 | sequences(_sequences), |
ryood | 0:9a0f67fe026b | 20 | sequenceNum(_sequenceNum), |
ryood | 1:1f6d3e65d946 | 21 | octave(0), |
ryood | 4:e51a5f0891a0 | 22 | bpm(120), |
ryood | 4:e51a5f0891a0 | 23 | waveShape(0), |
ryood | 14:92fd44537679 | 24 | sequencePattern(0), |
ryood | 4:e51a5f0891a0 | 25 | modNumber(0) {}; |
ryood | 0:9a0f67fe026b | 26 | |
ryood | 9:a8adc9b9b3d8 | 27 | void update(enum DisplayMode mode, int editingStep, int runningStep) { |
ryood | 0:9a0f67fe026b | 28 | switch (mode) { |
ryood | 0:9a0f67fe026b | 29 | case run: |
ryood | 9:a8adc9b9b3d8 | 30 | displayWhileRun(editingStep, runningStep); |
ryood | 0:9a0f67fe026b | 31 | break; |
ryood | 0:9a0f67fe026b | 32 | case stop: |
ryood | 9:a8adc9b9b3d8 | 33 | displayWhileStop(editingStep, runningStep); |
ryood | 0:9a0f67fe026b | 34 | break; |
ryood | 0:9a0f67fe026b | 35 | default: |
ryood | 0:9a0f67fe026b | 36 | error("SequenceDisplay::update: invalid mode"); |
ryood | 0:9a0f67fe026b | 37 | }; |
ryood | 0:9a0f67fe026b | 38 | }; |
ryood | 0:9a0f67fe026b | 39 | |
ryood | 12:e6b2b72db313 | 40 | void setSequences(Sequence* _sequences) { sequences = _sequences; } |
ryood | 12:e6b2b72db313 | 41 | Sequence* getSequences() { return sequences; } |
ryood | 12:e6b2b72db313 | 42 | |
ryood | 0:9a0f67fe026b | 43 | void setOctave(int _octave) { octave = _octave; }; |
ryood | 0:9a0f67fe026b | 44 | int getOctave() { return octave; }; |
ryood | 0:9a0f67fe026b | 45 | |
ryood | 1:1f6d3e65d946 | 46 | void setBpm(int _bpm) { bpm = _bpm; }; |
ryood | 1:1f6d3e65d946 | 47 | int getBpm() { return bpm; }; |
ryood | 1:1f6d3e65d946 | 48 | |
ryood | 4:e51a5f0891a0 | 49 | void setWaveShape(int _waveShape) { waveShape = _waveShape; } |
ryood | 4:e51a5f0891a0 | 50 | int getWaveShape() { return waveShape; } |
ryood | 4:e51a5f0891a0 | 51 | |
ryood | 4:e51a5f0891a0 | 52 | void setModNumber(int _modNumber) { modNumber = _modNumber; } |
ryood | 4:e51a5f0891a0 | 53 | int getModNumber() { return modNumber; } |
ryood | 4:e51a5f0891a0 | 54 | |
ryood | 10:699beb99effe | 55 | void setSequencePattern(int _sequencePattern) { sequencePattern = _sequencePattern; } |
ryood | 10:699beb99effe | 56 | int getSequencePattern() { return sequencePattern; } |
ryood | 10:699beb99effe | 57 | |
ryood | 0:9a0f67fe026b | 58 | protected: |
ryood | 9:a8adc9b9b3d8 | 59 | virtual void displayWhileRun(int editingStep, int runningStep) { |
ryood | 0:9a0f67fe026b | 60 | #if (UART_TRACE) |
ryood | 9:a8adc9b9b3d8 | 61 | printf("displayWhileRun step:%d %d\r\n", editingStep, runningStep); |
ryood | 0:9a0f67fe026b | 62 | #endif |
ryood | 0:9a0f67fe026b | 63 | }; |
ryood | 0:9a0f67fe026b | 64 | |
ryood | 9:a8adc9b9b3d8 | 65 | virtual void displayWhileStop(int editingStep, int runningStep) { |
ryood | 0:9a0f67fe026b | 66 | #if (UART_TRACE) |
ryood | 9:a8adc9b9b3d8 | 67 | printf("displayWhileStop step:%d %d\r\n", editingStep, runningStep); |
ryood | 0:9a0f67fe026b | 68 | #endif |
ryood | 0:9a0f67fe026b | 69 | }; |
ryood | 0:9a0f67fe026b | 70 | |
ryood | 0:9a0f67fe026b | 71 | Sequence* sequences; |
ryood | 0:9a0f67fe026b | 72 | int sequenceNum; |
ryood | 3:5b11261a545a | 73 | int octave; |
ryood | 1:1f6d3e65d946 | 74 | int bpm; |
ryood | 4:e51a5f0891a0 | 75 | int waveShape; |
ryood | 10:699beb99effe | 76 | int sequencePattern; |
ryood | 4:e51a5f0891a0 | 77 | int modNumber; |
ryood | 0:9a0f67fe026b | 78 | }; |
ryood | 0:9a0f67fe026b | 79 | |
ryood | 0:9a0f67fe026b | 80 | #endif //_SEQUENCE_DISPLAY_H_ |