MP3 Player without external hardware MP3 Player without external hardware. A software based MP3 player based on a modified version of libmad. Mono output (at the moment) via AnalogOut. Files are read from an USB drive. This is a demo program, it plays only one file at the moment. Documentation is in "main.cpp" and "config.h"

Dependencies:   mbed

Committer:
Gruenfrosch
Date:
Sat Nov 27 17:27:33 2010 +0000
Revision:
2:f28cf0afd021
Parent:
0:7627c79db971
Version 3:
* moved another memory block into AHB RAM, giving more room for
* stereo buffer.
* moved content of decode() to main()
* decoding is now safe to be called multiple times (bug in older versions)
* Output routine now fills stereo buffer, DAC output sums channels,
* just for demonstration that stereo output could go here

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Gruenfrosch 0:7627c79db971 1 /* mbed Microcontroller Library - Stream
Gruenfrosch 0:7627c79db971 2 * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
Gruenfrosch 0:7627c79db971 3 * sford
Gruenfrosch 0:7627c79db971 4 */
Gruenfrosch 0:7627c79db971 5
Gruenfrosch 0:7627c79db971 6 #ifndef MBED_STREAM_H
Gruenfrosch 0:7627c79db971 7 #define MBED_STREAM_H
Gruenfrosch 0:7627c79db971 8
Gruenfrosch 0:7627c79db971 9 #include "FileLike.h"
Gruenfrosch 0:7627c79db971 10 #include "platform.h"
Gruenfrosch 0:7627c79db971 11 #include <cstdio>
Gruenfrosch 0:7627c79db971 12
Gruenfrosch 0:7627c79db971 13 namespace mbed {
Gruenfrosch 0:7627c79db971 14
Gruenfrosch 0:7627c79db971 15 class Stream : public FileLike {
Gruenfrosch 0:7627c79db971 16
Gruenfrosch 0:7627c79db971 17 public:
Gruenfrosch 0:7627c79db971 18
Gruenfrosch 0:7627c79db971 19 Stream(const char *name = NULL);
Gruenfrosch 0:7627c79db971 20 virtual ~Stream();
Gruenfrosch 0:7627c79db971 21
Gruenfrosch 0:7627c79db971 22 int putc(int c) {
Gruenfrosch 0:7627c79db971 23 fflush(_file);
Gruenfrosch 0:7627c79db971 24 return std::fputc(c, _file);
Gruenfrosch 0:7627c79db971 25 }
Gruenfrosch 0:7627c79db971 26 int puts(const char *s) {
Gruenfrosch 0:7627c79db971 27 fflush(_file);
Gruenfrosch 0:7627c79db971 28 return std::fputs(s, _file);
Gruenfrosch 0:7627c79db971 29 }
Gruenfrosch 0:7627c79db971 30 int getc() {
Gruenfrosch 0:7627c79db971 31 fflush(_file);
Gruenfrosch 0:7627c79db971 32 return std::fgetc(_file);
Gruenfrosch 0:7627c79db971 33 }
Gruenfrosch 0:7627c79db971 34 char *gets(char *s, int size) {
Gruenfrosch 0:7627c79db971 35 fflush(_file);
Gruenfrosch 0:7627c79db971 36 return std::fgets(s,size,_file);;
Gruenfrosch 0:7627c79db971 37 }
Gruenfrosch 0:7627c79db971 38 int printf(const char* format, ...);
Gruenfrosch 0:7627c79db971 39 int scanf(const char* format, ...);
Gruenfrosch 0:7627c79db971 40
Gruenfrosch 0:7627c79db971 41 operator std::FILE*() { return _file; }
Gruenfrosch 0:7627c79db971 42
Gruenfrosch 0:7627c79db971 43 #ifdef MBED_RPC
Gruenfrosch 0:7627c79db971 44 virtual const struct rpc_method *get_rpc_methods();
Gruenfrosch 0:7627c79db971 45 #endif
Gruenfrosch 0:7627c79db971 46
Gruenfrosch 0:7627c79db971 47 protected:
Gruenfrosch 0:7627c79db971 48
Gruenfrosch 0:7627c79db971 49 virtual int close();
Gruenfrosch 0:7627c79db971 50 virtual ssize_t write(const void* buffer, size_t length);
Gruenfrosch 0:7627c79db971 51 virtual ssize_t read(void* buffer, size_t length);
Gruenfrosch 0:7627c79db971 52 virtual off_t lseek(off_t offset, int whence);
Gruenfrosch 0:7627c79db971 53 virtual int isatty();
Gruenfrosch 0:7627c79db971 54 virtual int fsync();
Gruenfrosch 0:7627c79db971 55 virtual off_t flen();
Gruenfrosch 0:7627c79db971 56
Gruenfrosch 0:7627c79db971 57 virtual int _putc(int c) = 0;
Gruenfrosch 0:7627c79db971 58 virtual int _getc() = 0;
Gruenfrosch 0:7627c79db971 59
Gruenfrosch 0:7627c79db971 60 std::FILE *_file;
Gruenfrosch 0:7627c79db971 61
Gruenfrosch 0:7627c79db971 62 };
Gruenfrosch 0:7627c79db971 63
Gruenfrosch 0:7627c79db971 64 } // namespace mbed
Gruenfrosch 0:7627c79db971 65
Gruenfrosch 0:7627c79db971 66 #endif
Gruenfrosch 0:7627c79db971 67