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 /*
Gruenfrosch 0:7627c79db971 2 * libmad - MPEG audio decoder library
Gruenfrosch 0:7627c79db971 3 * Copyright (C) 2000-2004 Underbit Technologies, Inc.
Gruenfrosch 0:7627c79db971 4 *
Gruenfrosch 0:7627c79db971 5 * This program is free software; you can redistribute it and/or modify
Gruenfrosch 0:7627c79db971 6 * it under the terms of the GNU General Public License as published by
Gruenfrosch 0:7627c79db971 7 * the Free Software Foundation; either version 2 of the License, or
Gruenfrosch 0:7627c79db971 8 * (at your option) any later version.
Gruenfrosch 0:7627c79db971 9 *
Gruenfrosch 0:7627c79db971 10 * This program is distributed in the hope that it will be useful,
Gruenfrosch 0:7627c79db971 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Gruenfrosch 0:7627c79db971 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Gruenfrosch 0:7627c79db971 13 * GNU General Public License for more details.
Gruenfrosch 0:7627c79db971 14 *
Gruenfrosch 0:7627c79db971 15 * You should have received a copy of the GNU General Public License
Gruenfrosch 0:7627c79db971 16 * along with this program; if not, write to the Free Software
Gruenfrosch 0:7627c79db971 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Gruenfrosch 0:7627c79db971 18 *
Gruenfrosch 0:7627c79db971 19 * $Id: timer.h,v 1.1 2010/11/23 20:12:57 andy Exp $
Gruenfrosch 0:7627c79db971 20 */
Gruenfrosch 0:7627c79db971 21
Gruenfrosch 0:7627c79db971 22 # ifndef LIBMAD_TIMER_H
Gruenfrosch 0:7627c79db971 23 # define LIBMAD_TIMER_H
Gruenfrosch 0:7627c79db971 24
Gruenfrosch 0:7627c79db971 25 typedef struct {
Gruenfrosch 0:7627c79db971 26 signed long seconds; /* whole seconds */
Gruenfrosch 0:7627c79db971 27 unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
Gruenfrosch 0:7627c79db971 28 } mad_timer_t;
Gruenfrosch 0:7627c79db971 29
Gruenfrosch 0:7627c79db971 30 extern mad_timer_t const mad_timer_zero;
Gruenfrosch 0:7627c79db971 31
Gruenfrosch 0:7627c79db971 32 # define MAD_TIMER_RESOLUTION 352800000UL
Gruenfrosch 0:7627c79db971 33
Gruenfrosch 0:7627c79db971 34 enum mad_units {
Gruenfrosch 0:7627c79db971 35 MAD_UNITS_HOURS = -2,
Gruenfrosch 0:7627c79db971 36 MAD_UNITS_MINUTES = -1,
Gruenfrosch 0:7627c79db971 37 MAD_UNITS_SECONDS = 0,
Gruenfrosch 0:7627c79db971 38
Gruenfrosch 0:7627c79db971 39 /* metric units */
Gruenfrosch 0:7627c79db971 40
Gruenfrosch 0:7627c79db971 41 MAD_UNITS_DECISECONDS = 10,
Gruenfrosch 0:7627c79db971 42 MAD_UNITS_CENTISECONDS = 100,
Gruenfrosch 0:7627c79db971 43 MAD_UNITS_MILLISECONDS = 1000,
Gruenfrosch 0:7627c79db971 44
Gruenfrosch 0:7627c79db971 45 /* audio sample units */
Gruenfrosch 0:7627c79db971 46
Gruenfrosch 0:7627c79db971 47 MAD_UNITS_8000_HZ = 8000,
Gruenfrosch 0:7627c79db971 48 MAD_UNITS_11025_HZ = 11025,
Gruenfrosch 0:7627c79db971 49 MAD_UNITS_12000_HZ = 12000,
Gruenfrosch 0:7627c79db971 50
Gruenfrosch 0:7627c79db971 51 MAD_UNITS_16000_HZ = 16000,
Gruenfrosch 0:7627c79db971 52 MAD_UNITS_22050_HZ = 22050,
Gruenfrosch 0:7627c79db971 53 MAD_UNITS_24000_HZ = 24000,
Gruenfrosch 0:7627c79db971 54
Gruenfrosch 0:7627c79db971 55 MAD_UNITS_32000_HZ = 32000,
Gruenfrosch 0:7627c79db971 56 MAD_UNITS_44100_HZ = 44100,
Gruenfrosch 0:7627c79db971 57 MAD_UNITS_48000_HZ = 48000,
Gruenfrosch 0:7627c79db971 58
Gruenfrosch 0:7627c79db971 59 /* video frame/field units */
Gruenfrosch 0:7627c79db971 60
Gruenfrosch 0:7627c79db971 61 MAD_UNITS_24_FPS = 24,
Gruenfrosch 0:7627c79db971 62 MAD_UNITS_25_FPS = 25,
Gruenfrosch 0:7627c79db971 63 MAD_UNITS_30_FPS = 30,
Gruenfrosch 0:7627c79db971 64 MAD_UNITS_48_FPS = 48,
Gruenfrosch 0:7627c79db971 65 MAD_UNITS_50_FPS = 50,
Gruenfrosch 0:7627c79db971 66 MAD_UNITS_60_FPS = 60,
Gruenfrosch 0:7627c79db971 67
Gruenfrosch 0:7627c79db971 68 /* CD audio frames */
Gruenfrosch 0:7627c79db971 69
Gruenfrosch 0:7627c79db971 70 MAD_UNITS_75_FPS = 75,
Gruenfrosch 0:7627c79db971 71
Gruenfrosch 0:7627c79db971 72 /* video drop-frame units */
Gruenfrosch 0:7627c79db971 73
Gruenfrosch 0:7627c79db971 74 MAD_UNITS_23_976_FPS = -24,
Gruenfrosch 0:7627c79db971 75 MAD_UNITS_24_975_FPS = -25,
Gruenfrosch 0:7627c79db971 76 MAD_UNITS_29_97_FPS = -30,
Gruenfrosch 0:7627c79db971 77 MAD_UNITS_47_952_FPS = -48,
Gruenfrosch 0:7627c79db971 78 MAD_UNITS_49_95_FPS = -50,
Gruenfrosch 0:7627c79db971 79 MAD_UNITS_59_94_FPS = -60
Gruenfrosch 0:7627c79db971 80 };
Gruenfrosch 0:7627c79db971 81
Gruenfrosch 0:7627c79db971 82 # define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
Gruenfrosch 0:7627c79db971 83
Gruenfrosch 0:7627c79db971 84 int mad_timer_compare(mad_timer_t, mad_timer_t);
Gruenfrosch 0:7627c79db971 85
Gruenfrosch 0:7627c79db971 86 # define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero)
Gruenfrosch 0:7627c79db971 87
Gruenfrosch 0:7627c79db971 88 void mad_timer_negate(mad_timer_t *);
Gruenfrosch 0:7627c79db971 89 mad_timer_t mad_timer_abs(mad_timer_t);
Gruenfrosch 0:7627c79db971 90
Gruenfrosch 0:7627c79db971 91 void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
Gruenfrosch 0:7627c79db971 92 void mad_timer_add(mad_timer_t *, mad_timer_t);
Gruenfrosch 0:7627c79db971 93 void mad_timer_multiply(mad_timer_t *, signed long);
Gruenfrosch 0:7627c79db971 94
Gruenfrosch 0:7627c79db971 95 signed long mad_timer_count(mad_timer_t, enum mad_units);
Gruenfrosch 0:7627c79db971 96 unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
Gruenfrosch 0:7627c79db971 97 void mad_timer_string(mad_timer_t, char *, char const *,
Gruenfrosch 0:7627c79db971 98 enum mad_units, enum mad_units, unsigned long);
Gruenfrosch 0:7627c79db971 99
Gruenfrosch 0:7627c79db971 100 # endif