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"
config.h@2:f28cf0afd021, 2010-11-27 (annotated)
- 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?
User | Revision | Line number | New 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 | */ |
Gruenfrosch | 0:7627c79db971 | 20 | /************************************************************************/ |
Gruenfrosch | 0:7627c79db971 | 21 | /* This library has been changed by Andreas Gruen to work on an LPC1768 |
Gruenfrosch | 0:7627c79db971 | 22 | * Because the available RAM is too small for decoding, it uses |
Gruenfrosch | 0:7627c79db971 | 23 | * some of the AHB-RAM dedicated to the Ethernet peripheral to |
Gruenfrosch | 0:7627c79db971 | 24 | * store parts of the mad_decoder structure. |
Gruenfrosch | 0:7627c79db971 | 25 | * Therefore the Ethernet module cannot be used ! |
Gruenfrosch | 0:7627c79db971 | 26 | * The address is defined by AHBMEM below, ~12kByte are used |
Gruenfrosch | 0:7627c79db971 | 27 | * All other changes are made only to satisfy the mbed online compiler, |
Gruenfrosch | 0:7627c79db971 | 28 | * which treats all files as C++ code and does not allow additional |
Gruenfrosch | 0:7627c79db971 | 29 | * defines on the command line. |
Gruenfrosch | 0:7627c79db971 | 30 | * The changes are: |
Gruenfrosch | 0:7627c79db971 | 31 | * forced inclusion of "config.h" in all files |
Gruenfrosch | 0:7627c79db971 | 32 | * forced inclusion of "mbed.h" in all files via "config.h" |
Gruenfrosch | 0:7627c79db971 | 33 | * typecasts from void * |
Gruenfrosch | 0:7627c79db971 | 34 | * renaming of all .c-Files to .cpp |
Gruenfrosch | 0:7627c79db971 | 35 | * renaming of all .dat-Files to .h |
Gruenfrosch | 0:7627c79db971 | 36 | * |
Gruenfrosch | 0:7627c79db971 | 37 | * The exact changes can bee seen by a diff-tool comparing with |
Gruenfrosch | 0:7627c79db971 | 38 | * the libmad-0.15.1b source. |
Gruenfrosch | 0:7627c79db971 | 39 | * This modified version does no longer compile for other systems. |
Gruenfrosch | 0:7627c79db971 | 40 | * There are still one compiler warning that can be ignored. |
Gruenfrosch | 0:7627c79db971 | 41 | */ |
Gruenfrosch | 0:7627c79db971 | 42 | |
Gruenfrosch | 0:7627c79db971 | 43 | # ifndef LIBMAD_CONFIG_H |
Gruenfrosch | 0:7627c79db971 | 44 | # define LIBMAD_CONFIG_H |
Gruenfrosch | 2:f28cf0afd021 | 45 | |
Gruenfrosch | 2:f28cf0afd021 | 46 | #if defined(TARGET_LPC1768) |
Gruenfrosch | 0:7627c79db971 | 47 | #include "mbed.h" |
Gruenfrosch | 2:f28cf0afd021 | 48 | void *mad_malloc(unsigned int sz); |
Gruenfrosch | 2:f28cf0afd021 | 49 | void reset_ahb_mem(void); |
Gruenfrosch | 2:f28cf0afd021 | 50 | #endif |
Gruenfrosch | 0:7627c79db971 | 51 | |
Gruenfrosch | 0:7627c79db971 | 52 | /* config.h. Generated by configure. */ |
Gruenfrosch | 0:7627c79db971 | 53 | /* config.h.in. Generated from configure.ac by autoheader. */ |
Gruenfrosch | 0:7627c79db971 | 54 | |
Gruenfrosch | 0:7627c79db971 | 55 | |
Gruenfrosch | 0:7627c79db971 | 56 | /* used by USB |
Gruenfrosch | 0:7627c79db971 | 57 | #define AHBMEM ((void *)0x2007C000) */ |
Gruenfrosch | 0:7627c79db971 | 58 | |
Gruenfrosch | 0:7627c79db971 | 59 | /* used by ethernet */ |
Gruenfrosch | 0:7627c79db971 | 60 | #define AHBMEM ((void *)0x20080000) |
Gruenfrosch | 2:f28cf0afd021 | 61 | #define AHBMEMSIZE 16300 |
Gruenfrosch | 0:7627c79db971 | 62 | |
Gruenfrosch | 0:7627c79db971 | 63 | #define FPM_DEFAULT |
Gruenfrosch | 0:7627c79db971 | 64 | /* Define to enable diagnostic debugging support. */ |
Gruenfrosch | 0:7627c79db971 | 65 | /* #undef DEBUG */ |
Gruenfrosch | 0:7627c79db971 | 66 | |
Gruenfrosch | 0:7627c79db971 | 67 | /* Define to enable experimental code. */ |
Gruenfrosch | 0:7627c79db971 | 68 | /* #undef EXPERIMENTAL */ |
Gruenfrosch | 0:7627c79db971 | 69 | |
Gruenfrosch | 0:7627c79db971 | 70 | /* Define to 1 if you have the <assert.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 71 | /*#define HAVE_ASSERT_H 1*/ |
Gruenfrosch | 0:7627c79db971 | 72 | |
Gruenfrosch | 0:7627c79db971 | 73 | /* Define to 1 if you have the <dlfcn.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 74 | /* #undef HAVE_DLFCN_H */ |
Gruenfrosch | 0:7627c79db971 | 75 | |
Gruenfrosch | 0:7627c79db971 | 76 | /* Define to 1 if you have the <errno.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 77 | /* #define HAVE_ERRNO_H 1*/ |
Gruenfrosch | 0:7627c79db971 | 78 | |
Gruenfrosch | 0:7627c79db971 | 79 | /* Define to 1 if you have the `fcntl' function. */ |
Gruenfrosch | 0:7627c79db971 | 80 | /* #undef HAVE_FCNTL */ |
Gruenfrosch | 0:7627c79db971 | 81 | |
Gruenfrosch | 0:7627c79db971 | 82 | /* Define to 1 if you have the <fcntl.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 83 | /* #define HAVE_FCNTL_H 1*/ |
Gruenfrosch | 0:7627c79db971 | 84 | |
Gruenfrosch | 0:7627c79db971 | 85 | /* Define to 1 if you have the `fork' function. */ |
Gruenfrosch | 0:7627c79db971 | 86 | /* #undef HAVE_FORK */ |
Gruenfrosch | 0:7627c79db971 | 87 | |
Gruenfrosch | 0:7627c79db971 | 88 | /* Define to 1 if you have the <inttypes.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 89 | /* #define HAVE_INTTYPES_H 1*/ |
Gruenfrosch | 0:7627c79db971 | 90 | |
Gruenfrosch | 0:7627c79db971 | 91 | /* Define to 1 if you have the <limits.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 92 | /* #define HAVE_LIMITS_H 1*/ |
Gruenfrosch | 0:7627c79db971 | 93 | |
Gruenfrosch | 0:7627c79db971 | 94 | /* Define if your MIPS CPU supports a 2-operand MADD16 instruction. */ |
Gruenfrosch | 0:7627c79db971 | 95 | /* #undef HAVE_MADD16_ASM */ |
Gruenfrosch | 0:7627c79db971 | 96 | |
Gruenfrosch | 0:7627c79db971 | 97 | /* Define if your MIPS CPU supports a 2-operand MADD instruction. */ |
Gruenfrosch | 0:7627c79db971 | 98 | /* #undef HAVE_MADD_ASM */ |
Gruenfrosch | 0:7627c79db971 | 99 | |
Gruenfrosch | 0:7627c79db971 | 100 | /* Define to 1 if you have the <memory.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 101 | /* #define HAVE_MEMORY_H 1 */ |
Gruenfrosch | 0:7627c79db971 | 102 | |
Gruenfrosch | 0:7627c79db971 | 103 | /* Define to 1 if you have the `pipe' function. */ |
Gruenfrosch | 0:7627c79db971 | 104 | /* #undef HAVE_PIPE */ |
Gruenfrosch | 0:7627c79db971 | 105 | |
Gruenfrosch | 0:7627c79db971 | 106 | /* Define to 1 if you have the <stdint.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 107 | /* #define HAVE_STDINT_H 1*/ |
Gruenfrosch | 0:7627c79db971 | 108 | |
Gruenfrosch | 0:7627c79db971 | 109 | /* Define to 1 if you have the <stdlib.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 110 | #define HAVE_STDLIB_H 1 |
Gruenfrosch | 0:7627c79db971 | 111 | |
Gruenfrosch | 0:7627c79db971 | 112 | /* Define to 1 if you have the <strings.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 113 | #define HAVE_STRINGS_H 1 |
Gruenfrosch | 0:7627c79db971 | 114 | |
Gruenfrosch | 0:7627c79db971 | 115 | /* Define to 1 if you have the <string.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 116 | /* #define HAVE_STRING_H 1 */ |
Gruenfrosch | 0:7627c79db971 | 117 | |
Gruenfrosch | 0:7627c79db971 | 118 | /* Define to 1 if you have the <sys/stat.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 119 | /* #define HAVE_SYS_STAT_H 1*/ |
Gruenfrosch | 0:7627c79db971 | 120 | |
Gruenfrosch | 0:7627c79db971 | 121 | /* Define to 1 if you have the <sys/types.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 122 | /* #define HAVE_SYS_TYPES_H 1*/ |
Gruenfrosch | 0:7627c79db971 | 123 | |
Gruenfrosch | 0:7627c79db971 | 124 | /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ |
Gruenfrosch | 0:7627c79db971 | 125 | /* #undef HAVE_SYS_WAIT_H */ |
Gruenfrosch | 0:7627c79db971 | 126 | |
Gruenfrosch | 0:7627c79db971 | 127 | /* Define to 1 if you have the <unistd.h> header file. */ |
Gruenfrosch | 0:7627c79db971 | 128 | /* #undef HAVE_UNISTD_H */ |
Gruenfrosch | 0:7627c79db971 | 129 | |
Gruenfrosch | 0:7627c79db971 | 130 | /* Define to 1 if you have the `waitpid' function. */ |
Gruenfrosch | 0:7627c79db971 | 131 | /* #undef HAVE_WAITPID */ |
Gruenfrosch | 0:7627c79db971 | 132 | |
Gruenfrosch | 0:7627c79db971 | 133 | /* Define to disable debugging assertions. */ |
Gruenfrosch | 0:7627c79db971 | 134 | /* #undef NDEBUG */ |
Gruenfrosch | 0:7627c79db971 | 135 | |
Gruenfrosch | 0:7627c79db971 | 136 | /* Define to optimize for accuracy over speed. */ |
Gruenfrosch | 0:7627c79db971 | 137 | /* #undef OPT_ACCURACY */ |
Gruenfrosch | 0:7627c79db971 | 138 | |
Gruenfrosch | 0:7627c79db971 | 139 | /* Define to optimize for speed over accuracy. */ |
Gruenfrosch | 2:f28cf0afd021 | 140 | /* #define OPT_SPEED */ |
Gruenfrosch | 0:7627c79db971 | 141 | |
Gruenfrosch | 0:7627c79db971 | 142 | /* Define to enable a fast subband synthesis approximation optimization. */ |
Gruenfrosch | 2:f28cf0afd021 | 143 | /* #define OPT_SSO */ |
Gruenfrosch | 0:7627c79db971 | 144 | |
Gruenfrosch | 0:7627c79db971 | 145 | /* Define to influence a strict interpretation of the ISO/IEC standards, even |
Gruenfrosch | 0:7627c79db971 | 146 | if this is in opposition with best accepted practices. */ |
Gruenfrosch | 0:7627c79db971 | 147 | /* #undef OPT_STRICT */ |
Gruenfrosch | 0:7627c79db971 | 148 | |
Gruenfrosch | 0:7627c79db971 | 149 | /* Name of package */ |
Gruenfrosch | 0:7627c79db971 | 150 | #define PACKAGE "libmad" |
Gruenfrosch | 0:7627c79db971 | 151 | |
Gruenfrosch | 0:7627c79db971 | 152 | /* Define to the address where bug reports for this package should be sent. */ |
Gruenfrosch | 0:7627c79db971 | 153 | #define PACKAGE_BUGREPORT "support@underbit.com" |
Gruenfrosch | 0:7627c79db971 | 154 | |
Gruenfrosch | 0:7627c79db971 | 155 | /* Define to the full name of this package. */ |
Gruenfrosch | 0:7627c79db971 | 156 | #define PACKAGE_NAME "MPEG Audio Decoder" |
Gruenfrosch | 0:7627c79db971 | 157 | |
Gruenfrosch | 0:7627c79db971 | 158 | /* Define to the full name and version of this package. */ |
Gruenfrosch | 0:7627c79db971 | 159 | #define PACKAGE_STRING "MPEG Audio Decoder 0.15.1b" |
Gruenfrosch | 0:7627c79db971 | 160 | |
Gruenfrosch | 0:7627c79db971 | 161 | /* Define to the one symbol short name of this package. */ |
Gruenfrosch | 0:7627c79db971 | 162 | #define PACKAGE_TARNAME "libmad" |
Gruenfrosch | 0:7627c79db971 | 163 | |
Gruenfrosch | 0:7627c79db971 | 164 | /* Define to the version of this package. */ |
Gruenfrosch | 0:7627c79db971 | 165 | #define PACKAGE_VERSION "0.15.1b" |
Gruenfrosch | 0:7627c79db971 | 166 | |
Gruenfrosch | 0:7627c79db971 | 167 | /* The size of a `int', as computed by sizeof. */ |
Gruenfrosch | 0:7627c79db971 | 168 | #define SIZEOF_INT 4 |
Gruenfrosch | 0:7627c79db971 | 169 | |
Gruenfrosch | 0:7627c79db971 | 170 | /* The size of a `long', as computed by sizeof. */ |
Gruenfrosch | 0:7627c79db971 | 171 | #define SIZEOF_LONG 4 |
Gruenfrosch | 0:7627c79db971 | 172 | |
Gruenfrosch | 0:7627c79db971 | 173 | /* The size of a `long long', as computed by sizeof. */ |
Gruenfrosch | 0:7627c79db971 | 174 | #define SIZEOF_LONG_LONG 8 |
Gruenfrosch | 0:7627c79db971 | 175 | |
Gruenfrosch | 0:7627c79db971 | 176 | /* Define to 1 if you have the ANSI C header files. */ |
Gruenfrosch | 0:7627c79db971 | 177 | #define STDC_HEADERS 1 |
Gruenfrosch | 0:7627c79db971 | 178 | |
Gruenfrosch | 0:7627c79db971 | 179 | /* Version number of package */ |
Gruenfrosch | 0:7627c79db971 | 180 | #define VERSION "0.15.1b" |
Gruenfrosch | 0:7627c79db971 | 181 | |
Gruenfrosch | 0:7627c79db971 | 182 | /* Define to empty if `const' does not conform to ANSI C. */ |
Gruenfrosch | 0:7627c79db971 | 183 | /* #undef const */ |
Gruenfrosch | 0:7627c79db971 | 184 | |
Gruenfrosch | 0:7627c79db971 | 185 | /* Define as `__inline' if that's what the C compiler calls it, or to nothing |
Gruenfrosch | 0:7627c79db971 | 186 | if it is not supported. */ |
Gruenfrosch | 0:7627c79db971 | 187 | #define inline |
Gruenfrosch | 0:7627c79db971 | 188 | |
Gruenfrosch | 0:7627c79db971 | 189 | /* Define to `int' if <sys/types.h> does not define. */ |
Gruenfrosch | 0:7627c79db971 | 190 | /* #undef pid_t */ |
Gruenfrosch | 2:f28cf0afd021 | 191 | |
Gruenfrosch | 2:f28cf0afd021 | 192 | |
Gruenfrosch | 2:f28cf0afd021 | 193 | /* Define mad_malloc to malloc if no special mem handling required */ |
Gruenfrosch | 2:f28cf0afd021 | 194 | |
Gruenfrosch | 0:7627c79db971 | 195 | #endif |