blob: b7bf8c2b16414d4a490e7e17def2ebeb9883fbe3 [file] [log] [blame]
Miika Pekkarinen20b38972005-07-13 12:48:22 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Miika Pekkarinen
11 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
Miika Pekkarinen20b38972005-07-13 12:48:22 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef PCMBUF_H
22#define PCMBUF_H
23
Jeffrey Goode37adbee2009-11-06 04:13:36 +000024/* Commit PCM data */
25void *pcmbuf_request_buffer(int *count);
26void pcmbuf_write_complete(int count);
27
28/* Init */
Michael Sevakise1dd10d2007-03-19 22:04:17 +000029size_t pcmbuf_init(unsigned char *bufend);
Jeffrey Goode37adbee2009-11-06 04:13:36 +000030
31/* Playback */
Miika Pekkarinen159c52d2005-08-20 11:13:19 +000032void pcmbuf_play_start(void);
Jeffrey Goode04b01e12009-11-05 21:59:36 +000033void pcmbuf_play_stop(void);
34void pcmbuf_pause(bool pause);
Michael Sevakis65109732011-02-23 14:31:13 +000035void pcmbuf_monitor_track_change(bool monitor);
Michael Sevakisc537d592011-04-27 03:08:23 +000036bool pcmbuf_start_track_change(bool manual_skip);
Brandon Low413da2a2006-02-07 20:38:55 +000037
Jeffrey Goode37adbee2009-11-06 04:13:36 +000038/* Crossfade */
Jeffrey Goode9e095342009-11-10 03:46:08 +000039#ifdef HAVE_CROSSFADE
Jeffrey Goode04b01e12009-11-05 21:59:36 +000040bool pcmbuf_is_crossfade_active(void);
41void pcmbuf_request_crossfade_enable(bool on_off);
42bool pcmbuf_is_same_size(void);
Michael Sevakisc537d592011-04-27 03:08:23 +000043#else
44/* Dummy functions with sensible returns */
45static inline bool pcmbuf_is_crossfade_active(void)
46 { return false; }
47static inline void pcmbuf_request_crossfade_enable(bool on_off)
48 { return; (void)on_off; }
49static inline bool pcmbuf_is_same_size(void)
50 { return true; }
Jeffrey Goode9e095342009-11-10 03:46:08 +000051#endif
Jeffrey Goode04b01e12009-11-05 21:59:36 +000052
Jeffrey Goode37adbee2009-11-06 04:13:36 +000053/* Voice */
Jeffrey Goode04b01e12009-11-05 21:59:36 +000054void *pcmbuf_request_voice_buffer(int *count);
55void pcmbuf_write_voice_complete(int count);
56
Jeffrey Goode37adbee2009-11-06 04:13:36 +000057/* Debug menu, other metrics */
Jeffrey Goode04b01e12009-11-05 21:59:36 +000058size_t pcmbuf_free(void);
59size_t pcmbuf_get_bufsize(void);
Brandon Low413da2a2006-02-07 20:38:55 +000060int pcmbuf_descs(void);
Jeffrey Goode04b01e12009-11-05 21:59:36 +000061int pcmbuf_used_descs(void);
62#ifdef ROCKBOX_HAS_LOGF
63unsigned char *pcmbuf_get_meminfo(size_t *length);
64#endif
65
Jeffrey Goodeb6f15f22009-11-08 04:27:27 +000066/* Misc */
Jeffrey Goode04b01e12009-11-05 21:59:36 +000067bool pcmbuf_is_lowdata(void);
68void pcmbuf_set_low_latency(bool state);
69unsigned long pcmbuf_get_latency(void);
Jeffrey Goode37adbee2009-11-06 04:13:36 +000070void pcmbuf_beep(unsigned int frequency, size_t duration, int amplitude);
Miika Pekkarinen159c52d2005-08-20 11:13:19 +000071
Miika Pekkarinen20b38972005-07-13 12:48:22 +000072#endif