Streams USB audio with sound effects applied. Sound effect selected by joystick and intensity altered by tilting the mbed. Output to the mbed-application-board phono jack.
Dependencies: C12832_lcd MMA7660 USBDevice mbed
/* Uses the mbed LPC1768 and mbed-application-board to create a USB audio device * that streams audio from a host computer to headphones or powered speakers. * A couple different sound effects can be applied to the stream in real-time, * and tilting the mbed alters intensity of the effect. * * ECHO * The joystick selects ) | * one of three effect ) STRAIGHT - o - STRAIGHT * modes. ) | * REVERB * * * * \\ || * Tilting the mbed ) ====== \\ || * determines intensity ) \\ || * of the effect. ) * 0% 50% 100% * * The LCD display shows the current effect mode, intesity and buffer level. */
effects.h@0:bbf6cf0eab95, 2014-03-27 (annotated)
- Committer:
- bw
- Date:
- Thu Mar 27 21:27:04 2014 +0000
- Revision:
- 0:bbf6cf0eab95
Initial.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bw | 0:bbf6cf0eab95 | 1 | /******************************************************************************* |
bw | 0:bbf6cf0eab95 | 2 | * Module processes 16-bit audio samples to produces delay-based sound effects. |
bw | 0:bbf6cf0eab95 | 3 | * Bryan Wade |
bw | 0:bbf6cf0eab95 | 4 | * 27 MAR 2014 |
bw | 0:bbf6cf0eab95 | 5 | ******************************************************************************/ |
bw | 0:bbf6cf0eab95 | 6 | #ifndef EFFECTS_H |
bw | 0:bbf6cf0eab95 | 7 | #define EFFECTS_H |
bw | 0:bbf6cf0eab95 | 8 | |
bw | 0:bbf6cf0eab95 | 9 | #include <stdint.h> |
bw | 0:bbf6cf0eab95 | 10 | |
bw | 0:bbf6cf0eab95 | 11 | // Practical gain limit for decent sound. |
bw | 0:bbf6cf0eab95 | 12 | #define MAX_EFFECT_GAIN (58982) |
bw | 0:bbf6cf0eab95 | 13 | |
bw | 0:bbf6cf0eab95 | 14 | // Available sound effect modes |
bw | 0:bbf6cf0eab95 | 15 | typedef enum effect_mode_t { |
bw | 0:bbf6cf0eab95 | 16 | EFFECT_STRAIGHT, |
bw | 0:bbf6cf0eab95 | 17 | EFFECT_ECHO, |
bw | 0:bbf6cf0eab95 | 18 | EFFECT_REVERB |
bw | 0:bbf6cf0eab95 | 19 | } effect_mode_t; |
bw | 0:bbf6cf0eab95 | 20 | |
bw | 0:bbf6cf0eab95 | 21 | |
bw | 0:bbf6cf0eab95 | 22 | // Initialize module. |
bw | 0:bbf6cf0eab95 | 23 | void Effects_Initialize(void); |
bw | 0:bbf6cf0eab95 | 24 | |
bw | 0:bbf6cf0eab95 | 25 | // Process one audio sample. |
bw | 0:bbf6cf0eab95 | 26 | int16_t Effects_ProcessSample(int16_t dataIn); |
bw | 0:bbf6cf0eab95 | 27 | |
bw | 0:bbf6cf0eab95 | 28 | void Effects_SetMode(effect_mode_t mode); |
bw | 0:bbf6cf0eab95 | 29 | |
bw | 0:bbf6cf0eab95 | 30 | void Effects_SetGain(uint16_t gain); |
bw | 0:bbf6cf0eab95 | 31 | |
bw | 0:bbf6cf0eab95 | 32 | #endif |