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

/media/uploads/bw/img_1293.jpg

/* 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.
*/
Revision:
0:bbf6cf0eab95
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buffer.h	Thu Mar 27 21:27:04 2014 +0000
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Implements FIFO buffer for glitch-free audio playback.
+ * Bryan Wade
+ * 27 MAR 2014
+ ******************************************************************************/
+#ifndef BUFFER_H
+#define BUFFER_H
+
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct buffer_t buffer_t; // Opaque type declaration.
+
+// Get a ptr to a new buffer.
+buffer_t *Buffer_Create(void *ram, size_t size);
+
+// Read one sample from buffer.
+bool Buffer_Read(buffer_t *buffer, int16_t *pDataOut);
+
+// Write one sample to buffer.
+void Buffer_Write(buffer_t *buffer, int16_t DataIn);
+
+// Write a block of data to buffer.
+void Buffer_WriteBlock(buffer_t *buffer, const int16_t *pDataIn, uint32_t length);
+
+// Get the current number of samples buffered.
+int32_t Buffer_GetLevel(buffer_t *buffer);
+
+#endif