00001 /*************************************************************************** 00002 * Copyright (C) 2006 by André Lindhjem <belgarat@sdf.lonestar.org>, * 00003 * Kjetil Holien <kjetil.holien@gmail.com>, * 00004 * Terje Risa <terje.risa@gmail.com> & * 00005 * Øyvind Nerbråten <oyvind@nerbraten.com> * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 *************************************************************************** 00022 * 00023 * \file mp3.h 00024 * \author André Lindhjem, Kjetil Holien, Terje Risa & Øyvind Nerbråten 00025 * \date 15.02.2006 00026 * 00027 * Functinality for controlling mp3 placyback using mad and libao. With the audio_play 00028 * function we can specify a mp3 file and start and stop offsets. The audio_play function loades 00029 * the mp3 file into a memory map and decodes the part we specified for playing. 00030 */ 00031 00032 #ifndef MP3_H_ 00033 #define MP3_H_ 00034 00035 #include <sys/stat.h> 00036 #include <string.h> 00037 #include <mad.h> 00038 #include <ao/ao.h> 00039 #include <stdbool.h> 00040 00041 #include "daisylibao.h" 00042 #include "audio.h" 00043 #include "libdaisy.h" 00044 00045 00046 #define DITHER_MAGIC 0xC69AA8EC 00047 00048 00049 00050 /* ************************************************** * 00051 * Global data structures * 00052 * ************************************************** */ 00053 00054 struct audio_dither { 00055 mad_fixed_t error[3]; 00056 mad_fixed_t random; 00057 unsigned int magic; 00058 }; 00059 00060 00061 00062 /* ************************************************** * 00063 * Global function declarations * 00064 * ************************************************** */ 00065 00071 void mp3_init(struct_audio_data_t *data); 00072 00080 bool mp3_play (struct_audio_data_t *data); 00081 00087 void mp3_close(struct_audio_data_t *data); 00088 00089 #endif /* MP3_H_ */