Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Lab3_1 RTOS-VS1053b-mp3_semaphore RTOS-VS1053b-mp3_v01
Diff: VS1053.h
- Revision:
- 6:eed008905159
- Parent:
- 5:ead95c0f7800
- Child:
- 7:b6853a2c88c2
--- a/VS1053.h Sat Dec 25 00:29:04 2010 +0000
+++ b/VS1053.h Sat Jan 08 15:45:58 2011 +0000
@@ -67,14 +67,14 @@
#define DEFAULT_TREBLE_AMPLITUDE 0 // -8 - 7 dB
#define DEFAULT_TREBLE_FREQUENCY 15000 //1000 - 15000 Hz
-#define BUFFER_SIZE (16 * 1024 + 1)
+#define BUFFER_SIZE (20 * 1024 + 1)
// SCI register address assignment
#define SCI_MODE 0x00
#define SCI_STATUS 0x01
#define SCI_BASS 0x02
#define SCI_CLOCKF 0x03
-#define SCI_DECODE_TOME 0x04
+#define SCI_DECODE_TIME 0x04
#define SCI_AUDATA 0x05
#define SCI_WRAM 0x06
#define SCI_WRAMADDR 0x07
@@ -136,6 +136,69 @@
#define INTERRUPT_HANDLER_ENABLE _DREQ_INTERUPT_IN.rise(this, &VS1053::dataRequestHandler); timer.attach_us(this, &VS1053::dataRequestHandler, 1000)
#define INTERRUPT_HANDLER_DISABLE _DREQ_INTERUPT_IN.rise(NULL); timer.detach()
+
+
+typedef enum AudioType
+{
+ WAV,
+ AAC,
+ WMA,
+ MIDI,
+ OGG_VORBIS,
+ MP3,
+ UNKNOWN
+} AudioType;
+
+typedef enum MP3_ID
+{
+ MPG2_5a = 0,
+ MPG2_5b = 1,
+ MPG2_0 = 2,
+ MPG1_0 = 3
+} MP3_ID;
+
+typedef enum MP3_MODE
+{
+ STEREO = 0,
+ JOINT_STEREO = 1,
+ DUAL_CHANNEL = 2,
+ MONO = 3
+} MP3_MODE;
+
+/** Struct for informations about audio streams.
+ *
+ */
+typedef struct AudioInfo
+{
+ AudioType type : 4;
+ unsigned short kBitRate;
+ unsigned short decodeTime;
+ union {
+ struct {
+ MP3_ID id : 2;
+ char layer : 2;
+ char protrectBit : 1;
+ char padBit : 1;
+ MP3_MODE mode : 2;
+ char extension : 2;
+ char copyright : 1;
+ char original : 1;
+ char emphasis : 2;
+ char kSampleRate : 6;
+ } mp3;
+ struct {
+
+ } wma;
+ struct {
+
+ } aac;
+ struct {
+
+ } other;
+ } ext;
+
+} AudioInfo;
+
/** Class for VS1053 - Ogg Vorbis / MP3 / AAC / WMA / FLAC / MIDI Audio Codec Chip.
*
* This code based on:
@@ -362,6 +425,14 @@
*
*/
void stop(void);
+
+ /** Get information about played audio stream.
+ *
+ * @param aInfo
+ * Return value for the informations.
+ *
+ */
+ void getAudioInfo(AudioInfo* aInfo);
protected:
unsigned short int wram_read(unsigned short int);
@@ -424,6 +495,8 @@
Ticker timer;
+ static const char _sampleRateTable[4][4]; // _sampleRateTable[id][srate]
+
};
#endif