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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers buffer.h Source File

buffer.h

00001 /*******************************************************************************
00002  * Implements FIFO buffer for glitch-free audio playback.
00003  * Bryan Wade
00004  * 27 MAR 2014
00005  ******************************************************************************/
00006 #ifndef BUFFER_H
00007 #define BUFFER_H
00008 
00009 #include <stdint.h>
00010 #include <stdlib.h>
00011 
00012 typedef struct buffer_t buffer_t; // Opaque type declaration.
00013 
00014 // Get a ptr to a new buffer.
00015 buffer_t *Buffer_Create(void *ram, size_t size);
00016 
00017 // Read one sample from buffer.
00018 bool Buffer_Read(buffer_t *buffer, int16_t *pDataOut);
00019 
00020 // Write one sample to buffer.
00021 void Buffer_Write(buffer_t *buffer, int16_t DataIn);
00022 
00023 // Write a block of data to buffer.
00024 void Buffer_WriteBlock(buffer_t *buffer, const int16_t *pDataIn, uint32_t length);
00025 
00026 // Get the current number of samples buffered.
00027 int32_t Buffer_GetLevel(buffer_t *buffer);
00028 
00029 #endif