blob: 57edf2b5ec227829bb07fdb187927ffbe4bab789 [file] [log] [blame]
Michael Sevakis5857c442013-05-31 02:41:02 -04001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005-2007 Miika Pekkarinen
11 * Copyright (C) 2007-2008 Nicolas Pennequin
12 * Copyright (C) 2011-2013 Michael Sevakis
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23#ifndef AUDIO_THREAD_H
24#define AUDIO_THREAD_H
25
26/* Define one constant that includes recording related functionality */
27#if defined(HAVE_RECORDING) && !defined(SIMULATOR)
28#define AUDIO_HAVE_RECORDING
29#endif
30
31enum
32{
33 Q_NULL = 0, /* reserved */
34
35 /* -> audio */
36 Q_AUDIO_PLAY,
37 Q_AUDIO_STOP,
38 Q_AUDIO_PAUSE,
39 Q_AUDIO_SKIP,
40 Q_AUDIO_PRE_FF_REWIND,
41 Q_AUDIO_FF_REWIND,
42 Q_AUDIO_FLUSH,
43 Q_AUDIO_DIR_SKIP,
44
45 /* pcmbuf -> audio */
46 Q_AUDIO_TRACK_CHANGED,
47
48 /* audio -> audio */
49 Q_AUDIO_FILL_BUFFER, /* continue buffering next track */
50
51 /* buffering -> audio */
52 Q_AUDIO_BUFFERING, /* some buffer event */
53 Q_AUDIO_FINISH_LOAD_TRACK, /* metadata is buffered */
54 Q_AUDIO_HANDLE_FINISHED, /* some other type is buffered */
55
56 /* codec -> audio (*) */
57 Q_AUDIO_CODEC_SEEK_COMPLETE,
58 Q_AUDIO_CODEC_COMPLETE,
59
60 /* audio -> codec */
61 Q_CODEC_LOAD,
62 Q_CODEC_RUN,
63 Q_CODEC_PAUSE,
64 Q_CODEC_SEEK,
65 Q_CODEC_STOP,
66 Q_CODEC_UNLOAD,
67
68 /* -> codec */
69 Q_CODEC_DO_CALLBACK,
70
71 /* -> recording */
72#ifdef HAVE_RECORDING
73 Q_AUDIO_INIT_RECORDING,
74 Q_AUDIO_CLOSE_RECORDING,
75 Q_AUDIO_RECORDING_OPTIONS,
76 Q_AUDIO_RECORD,
Michael Sevakis48881312013-06-22 16:41:16 -040077 Q_AUDIO_RECORD_STOP,
78 Q_AUDIO_RECORD_PAUSE,
79 Q_AUDIO_RECORD_RESUME,
80 Q_AUDIO_RECORD_FLUSH,
Michael Sevakis5857c442013-05-31 02:41:02 -040081#endif
82
83 /*- settings -*/
84
85#ifdef HAVE_DISK_STORAGE
86 /* -> audio */
87 Q_AUDIO_UPDATE_WATERMARK, /* buffering watermark needs updating */
88#endif
89 /* -> audio */
90 Q_AUDIO_REMAKE_AUDIO_BUFFER, /* buffer needs to be reinitialized */
91};
92
93/* (*) If you change these, you must check audio_clear_track_notifications
94 in playback.c for correctness */
95
96void audio_init(void);
97void playback_init(void);
98unsigned int playback_status(void);
99
100void audio_playback_handler(struct queue_event *ev);
101#ifdef AUDIO_HAVE_RECORDING
102void audio_recording_handler(struct queue_event *ev);
103#endif
104
Michael Sevakis48881312013-06-22 16:41:16 -0400105/** --- audio_queue helpers --- **/
106void audio_queue_post(long id, intptr_t data);
107intptr_t audio_queue_send(long id, intptr_t data);
108
Michael Sevakis5857c442013-05-31 02:41:02 -0400109#endif /* AUDIO_THREAD_H */