Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SequencerDisplay.h@1:1f6d3e65d946, 2016-08-12 (annotated)
- Committer:
- ryood
- Date:
- Fri Aug 12 23:36:42 2016 +0000
- Revision:
- 1:1f6d3e65d946
- Parent:
- 0:9a0f67fe026b
- Child:
- 3:5b11261a545a
Pitch????Grid???????
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ryood | 0:9a0f67fe026b | 1 | /* |
| ryood | 0:9a0f67fe026b | 2 | * SequencerDisplay.h |
| ryood | 0:9a0f67fe026b | 3 | * |
| ryood | 0:9a0f67fe026b | 4 | * 2016.08.13 |
| ryood | 0:9a0f67fe026b | 5 | * |
| ryood | 0:9a0f67fe026b | 6 | */ |
| ryood | 0:9a0f67fe026b | 7 | #ifndef _SEQUENCE_DISPLAY_H_ |
| ryood | 0:9a0f67fe026b | 8 | #define _SEQUENCE_DISPLAY_H_ |
| ryood | 0:9a0f67fe026b | 9 | |
| ryood | 0:9a0f67fe026b | 10 | #include "mbed.h" |
| ryood | 0:9a0f67fe026b | 11 | #include "Sequence.h" |
| ryood | 0:9a0f67fe026b | 12 | |
| ryood | 0:9a0f67fe026b | 13 | class SequencerDisplay { |
| ryood | 0:9a0f67fe026b | 14 | public: |
| ryood | 0:9a0f67fe026b | 15 | typedef enum { stop, run } DISPLAY_MODE; |
| ryood | 0:9a0f67fe026b | 16 | |
| ryood | 0:9a0f67fe026b | 17 | SequencerDisplay(Sequence* _sequences, int _sequenceNum) : |
| ryood | 0:9a0f67fe026b | 18 | sequences(_sequences), |
| ryood | 0:9a0f67fe026b | 19 | sequenceNum(_sequenceNum), |
| ryood | 1:1f6d3e65d946 | 20 | octave(0), |
| ryood | 1:1f6d3e65d946 | 21 | bpm(120) {}; |
| ryood | 0:9a0f67fe026b | 22 | |
| ryood | 0:9a0f67fe026b | 23 | void update(DISPLAY_MODE mode, int step) { |
| ryood | 0:9a0f67fe026b | 24 | switch (mode) { |
| ryood | 0:9a0f67fe026b | 25 | case run: |
| ryood | 0:9a0f67fe026b | 26 | displayWhileRun(step); |
| ryood | 0:9a0f67fe026b | 27 | break; |
| ryood | 0:9a0f67fe026b | 28 | case stop: |
| ryood | 0:9a0f67fe026b | 29 | displayWhileStop(step); |
| ryood | 0:9a0f67fe026b | 30 | break; |
| ryood | 0:9a0f67fe026b | 31 | default: |
| ryood | 0:9a0f67fe026b | 32 | error("SequenceDisplay::update: invalid mode"); |
| ryood | 0:9a0f67fe026b | 33 | }; |
| ryood | 0:9a0f67fe026b | 34 | }; |
| ryood | 0:9a0f67fe026b | 35 | |
| ryood | 0:9a0f67fe026b | 36 | void setOctave(int _octave) { octave = _octave; }; |
| ryood | 0:9a0f67fe026b | 37 | int getOctave() { return octave; }; |
| ryood | 0:9a0f67fe026b | 38 | |
| ryood | 1:1f6d3e65d946 | 39 | void setBpm(int _bpm) { bpm = _bpm; }; |
| ryood | 1:1f6d3e65d946 | 40 | int getBpm() { return bpm; }; |
| ryood | 1:1f6d3e65d946 | 41 | |
| ryood | 0:9a0f67fe026b | 42 | protected: |
| ryood | 0:9a0f67fe026b | 43 | virtual void displayWhileRun(int step) { |
| ryood | 0:9a0f67fe026b | 44 | #if (UART_TRACE) |
| ryood | 0:9a0f67fe026b | 45 | printf("displayWhileRun step:%d\r\n", step); |
| ryood | 0:9a0f67fe026b | 46 | #endif |
| ryood | 0:9a0f67fe026b | 47 | }; |
| ryood | 0:9a0f67fe026b | 48 | |
| ryood | 0:9a0f67fe026b | 49 | virtual void displayWhileStop(int step) { |
| ryood | 0:9a0f67fe026b | 50 | #if (UART_TRACE) |
| ryood | 0:9a0f67fe026b | 51 | printf("displayWhileStop step:%d\r\n", step); |
| ryood | 0:9a0f67fe026b | 52 | #endif |
| ryood | 0:9a0f67fe026b | 53 | }; |
| ryood | 0:9a0f67fe026b | 54 | |
| ryood | 0:9a0f67fe026b | 55 | Sequence* sequences; |
| ryood | 0:9a0f67fe026b | 56 | int sequenceNum; |
| ryood | 1:1f6d3e65d946 | 57 | int bpm; |
| ryood | 0:9a0f67fe026b | 58 | int octave; |
| ryood | 0:9a0f67fe026b | 59 | }; |
| ryood | 0:9a0f67fe026b | 60 | |
| ryood | 0:9a0f67fe026b | 61 | #endif //_SEQUENCE_DISPLAY_H_ |