Linus Nielsen Feltzing | 1c497e6 | 2005-06-05 23:05:10 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2005 Miika Pekkarinen |
| 11 | * |
| 12 | * All files in this archive are subject to the GNU General Public License. |
| 13 | * See the file COPYING in the source tree root for full license agreement. |
| 14 | * |
| 15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 16 | * KIND, either express or implied. |
| 17 | * |
| 18 | ****************************************************************************/ |
| 19 | |
Dave Chapman | 3ad485b | 2005-06-14 22:27:57 +0000 | [diff] [blame] | 20 | #ifndef _PLAYBACK_H |
| 21 | #define _PLAYBACK_H |
| 22 | |
| 23 | #include <stdlib.h> |
| 24 | #include <ctype.h> |
| 25 | #include <stdbool.h> |
| 26 | |
| 27 | #include "id3.h" |
| 28 | #include "mp3data.h" |
Linus Nielsen Feltzing | 1c497e6 | 2005-06-05 23:05:10 +0000 | [diff] [blame] | 29 | |
Miika Pekkarinen | d8cb703 | 2005-06-26 19:41:29 +0000 | [diff] [blame] | 30 | enum { |
| 31 | CODEC_SET_FILEBUF_WATERMARK = 1, |
| 32 | CODEC_SET_FILEBUF_CHUNKSIZE, |
| 33 | CODEC_SET_FILEBUF_LIMIT, |
| 34 | CODEC_DSP_ENABLE, |
| 35 | DSP_SET_FREQUENCY, |
Linus Nielsen Feltzing | 315304a | 2005-08-10 22:56:24 +0000 | [diff] [blame] | 36 | DSP_SWITCH_FREQUENCY, |
Miika Pekkarinen | d8cb703 | 2005-06-26 19:41:29 +0000 | [diff] [blame] | 37 | DSP_SET_CLIP_MIN, |
| 38 | DSP_SET_CLIP_MAX, |
| 39 | DSP_SET_SAMPLE_DEPTH, |
| 40 | DSP_SET_STEREO_MODE, |
| 41 | DSP_RESET, |
Magnus Holmgren | 4a53787 | 2005-07-24 15:32:28 +0000 | [diff] [blame] | 42 | DSP_DITHER, |
| 43 | DSP_SET_TRACK_GAIN, |
| 44 | DSP_SET_ALBUM_GAIN, |
| 45 | DSP_SET_TRACK_PEAK, |
| 46 | DSP_SET_ALBUM_PEAK |
Miika Pekkarinen | d8cb703 | 2005-06-26 19:41:29 +0000 | [diff] [blame] | 47 | }; |
Miika Pekkarinen | 68b9acd | 2005-06-10 15:02:10 +0000 | [diff] [blame] | 48 | |
| 49 | /* Not yet implemented. */ |
| 50 | #define CODEC_SET_AUDIOBUF_WATERMARK 4 |
| 51 | |
Miika Pekkarinen | 5c2c991 | 2005-07-05 19:55:40 +0000 | [diff] [blame] | 52 | #define MAX_TRACK 32 |
Dave Chapman | 3ad485b | 2005-06-14 22:27:57 +0000 | [diff] [blame] | 53 | struct track_info { |
| 54 | struct mp3entry id3; /* TAG metadata */ |
Dave Chapman | 3ad485b | 2005-06-14 22:27:57 +0000 | [diff] [blame] | 55 | char *codecbuf; /* Pointer to codec buffer */ |
Miika Pekkarinen | 85f4973 | 2005-06-27 19:29:49 +0000 | [diff] [blame] | 56 | long codecsize; /* Codec length in bytes */ |
Dave Chapman | 3ad485b | 2005-06-14 22:27:57 +0000 | [diff] [blame] | 57 | |
| 58 | off_t filerem; /* Remaining bytes of file NOT in buffer */ |
| 59 | off_t filesize; /* File total length */ |
| 60 | off_t filepos; /* Read position of file for next buffer fill */ |
| 61 | off_t start_pos; /* Position to first bytes of file in buffer */ |
| 62 | volatile int available; /* Available bytes to read from buffer */ |
| 63 | bool taginfo_ready; /* Is metadata read */ |
| 64 | int playlist_offset; /* File location in playlist */ |
Miika Pekkarinen | d54811f | 2005-07-02 16:52:30 +0000 | [diff] [blame] | 65 | bool event_sent; /* Has event callback functions been called? */ |
Dave Chapman | 3ad485b | 2005-06-14 22:27:57 +0000 | [diff] [blame] | 66 | }; |
| 67 | |
Miika Pekkarinen | 7d6d122 | 2005-06-29 21:36:30 +0000 | [diff] [blame] | 68 | /* Functions */ |
Jens Arnold | a88d076 | 2005-08-18 06:05:15 +0000 | [diff] [blame] | 69 | void audio_set_track_changed_event(void (*handler)(struct mp3entry *id3)); |
Miika Pekkarinen | d54811f | 2005-07-02 16:52:30 +0000 | [diff] [blame] | 70 | void audio_set_track_buffer_event(void (*handler)(struct mp3entry *id3, |
| 71 | bool last_track)); |
Michiel Van Der Kolk | 765cd6d | 2005-07-03 21:08:16 +0000 | [diff] [blame] | 72 | void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3, |
Miika Pekkarinen | 9bde038 | 2005-07-03 18:36:24 +0000 | [diff] [blame] | 73 | bool last_track)); |
Miika Pekkarinen | bbd42ad | 2005-07-01 18:22:04 +0000 | [diff] [blame] | 74 | void audio_invalidate_tracks(void); |
Miika Pekkarinen | 159c52d | 2005-08-20 11:13:19 +0000 | [diff] [blame^] | 75 | void voice_init(void); |
Miika Pekkarinen | 7d6d122 | 2005-06-29 21:36:30 +0000 | [diff] [blame] | 76 | |
Linus Nielsen Feltzing | 1c497e6 | 2005-06-05 23:05:10 +0000 | [diff] [blame] | 77 | #endif |
| 78 | |
| 79 | |