12-polyphonic "chiptune" MIDI synthesizer for LPC1768 (Standalone version)
Dependencies: ClockControl PowerControl mbed
Wavetable.h@3:cf57d7031c12, 2014-11-18 (annotated)
- Committer:
- kayekss
- Date:
- Tue Nov 18 17:05:49 2014 +0000
- Revision:
- 3:cf57d7031c12
- Parent:
- 0:727737138ac5
Add sampling rate configuration to GeminiCore's constructor argument
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kayekss | 0:727737138ac5 | 1 | #ifndef WAVETABLE_H_ |
kayekss | 0:727737138ac5 | 2 | #define WAVETABLE_H_ |
kayekss | 0:727737138ac5 | 3 | |
kayekss | 0:727737138ac5 | 4 | #define WAVETABLE_LENGTH 256 |
kayekss | 0:727737138ac5 | 5 | |
kayekss | 0:727737138ac5 | 6 | class Wavetable { |
kayekss | 0:727737138ac5 | 7 | public: |
kayekss | 0:727737138ac5 | 8 | typedef enum { |
kayekss | 0:727737138ac5 | 9 | Sine = 0, |
kayekss | 0:727737138ac5 | 10 | Square = 1, |
kayekss | 0:727737138ac5 | 11 | Pulse1_3 = 2, |
kayekss | 0:727737138ac5 | 12 | Pulse1_7 = 3, |
kayekss | 0:727737138ac5 | 13 | Sawtooth = 4, |
kayekss | 0:727737138ac5 | 14 | Triangle = 5, |
kayekss | 0:727737138ac5 | 15 | CoarseTriangle = 6, |
kayekss | 0:727737138ac5 | 16 | SpikedSine = 7, |
kayekss | 0:727737138ac5 | 17 | Noise = 8, |
kayekss | 0:727737138ac5 | 18 | LowPeriodNoise = 9 |
kayekss | 0:727737138ac5 | 19 | } wavetype_t; |
kayekss | 0:727737138ac5 | 20 | typedef struct { |
kayekss | 0:727737138ac5 | 21 | wavetype_t wavetype; |
kayekss | 0:727737138ac5 | 22 | uint8_t decaySpeed; |
kayekss | 0:727737138ac5 | 23 | uint8_t sustainLevel; |
kayekss | 0:727737138ac5 | 24 | } wave_t; |
kayekss | 3:cf57d7031c12 | 25 | |
kayekss | 0:727737138ac5 | 26 | static const uint8_t* const waveTableList[]; |
kayekss | 0:727737138ac5 | 27 | static wave_t const waveDefList[128]; |
kayekss | 0:727737138ac5 | 28 | static uint8_t const sineTable[WAVETABLE_LENGTH]; |
kayekss | 0:727737138ac5 | 29 | static uint8_t const squareTable[WAVETABLE_LENGTH]; |
kayekss | 0:727737138ac5 | 30 | static uint8_t const pulse1_3Table[WAVETABLE_LENGTH]; |
kayekss | 0:727737138ac5 | 31 | static uint8_t const pulse1_7Table[WAVETABLE_LENGTH]; |
kayekss | 0:727737138ac5 | 32 | static uint8_t const sawtoothTable[WAVETABLE_LENGTH]; |
kayekss | 0:727737138ac5 | 33 | static uint8_t const triangleTable[WAVETABLE_LENGTH]; |
kayekss | 0:727737138ac5 | 34 | static uint8_t const coarseTriangleTable[WAVETABLE_LENGTH]; |
kayekss | 0:727737138ac5 | 35 | static uint8_t const spikedSineTable[WAVETABLE_LENGTH]; |
kayekss | 0:727737138ac5 | 36 | }; |
kayekss | 0:727737138ac5 | 37 | |
kayekss | 0:727737138ac5 | 38 | #endif |