blob: a5b64ba0e355af4b394a38b30fb289c36e33e0c4 [file] [log] [blame]
Linus Nielsen Feltzing1c497e62005-06-05 23:05:10 +00001/***************************************************************************
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 Chapman3ad485b2005-06-14 22:27:57 +000020#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 Feltzing1c497e62005-06-05 23:05:10 +000029
Miika Pekkarinend8cb7032005-06-26 19:41:29 +000030enum {
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 Feltzing315304a2005-08-10 22:56:24 +000036 DSP_SWITCH_FREQUENCY,
Miika Pekkarinend8cb7032005-06-26 19:41:29 +000037 DSP_SET_CLIP_MIN,
38 DSP_SET_CLIP_MAX,
39 DSP_SET_SAMPLE_DEPTH,
40 DSP_SET_STEREO_MODE,
41 DSP_RESET,
Magnus Holmgren4a537872005-07-24 15:32:28 +000042 DSP_DITHER,
43 DSP_SET_TRACK_GAIN,
44 DSP_SET_ALBUM_GAIN,
45 DSP_SET_TRACK_PEAK,
46 DSP_SET_ALBUM_PEAK
Miika Pekkarinend8cb7032005-06-26 19:41:29 +000047};
Miika Pekkarinen68b9acd2005-06-10 15:02:10 +000048
49/* Not yet implemented. */
50#define CODEC_SET_AUDIOBUF_WATERMARK 4
51
Miika Pekkarinen5c2c9912005-07-05 19:55:40 +000052#define MAX_TRACK 32
Dave Chapman3ad485b2005-06-14 22:27:57 +000053struct track_info {
54 struct mp3entry id3; /* TAG metadata */
Dave Chapman3ad485b2005-06-14 22:27:57 +000055 char *codecbuf; /* Pointer to codec buffer */
Miika Pekkarinen85f49732005-06-27 19:29:49 +000056 long codecsize; /* Codec length in bytes */
Dave Chapman3ad485b2005-06-14 22:27:57 +000057
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 Pekkarinend54811f2005-07-02 16:52:30 +000065 bool event_sent; /* Has event callback functions been called? */
Dave Chapman3ad485b2005-06-14 22:27:57 +000066};
67
Miika Pekkarinen7d6d1222005-06-29 21:36:30 +000068/* Functions */
Jens Arnolda88d0762005-08-18 06:05:15 +000069void audio_set_track_changed_event(void (*handler)(struct mp3entry *id3));
Miika Pekkarinend54811f2005-07-02 16:52:30 +000070void audio_set_track_buffer_event(void (*handler)(struct mp3entry *id3,
71 bool last_track));
Michiel Van Der Kolk765cd6d2005-07-03 21:08:16 +000072void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3,
Miika Pekkarinen9bde0382005-07-03 18:36:24 +000073 bool last_track));
Miika Pekkarinenbbd42ad2005-07-01 18:22:04 +000074void audio_invalidate_tracks(void);
Miika Pekkarinen159c52d2005-08-20 11:13:19 +000075void voice_init(void);
Miika Pekkarinen7d6d1222005-06-29 21:36:30 +000076
Linus Nielsen Feltzing1c497e62005-06-05 23:05:10 +000077#endif
78
79