12-polyphonic "chiptune" MIDI synthesizer for LPC1768 (Standalone version)

Dependencies:   ClockControl PowerControl mbed

Committer:
kayekss
Date:
Tue Dec 23 21:50:53 2014 +0000
Revision:
6:cda45a5e723e
Parent:
3:cf57d7031c12
Supports "Panic on offline" feature when using MIDI-port input

Who changed what in which revision?

UserRevisionLine numberNew 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