blob: 33422bbee5c930ccf955dfe3bcf4f583bbb4eb93 [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
Michael Sevakis7ad2cad2011-08-28 07:45:35 +000024#include <sys/types.h>
25
Jeffrey Goode37adbee2009-11-06 04:13:36 +000026/* Commit PCM data */
27void *pcmbuf_request_buffer(int *count);
Michael Sevakis7ad2cad2011-08-28 07:45:35 +000028void pcmbuf_write_complete(int count, unsigned long elapsed, off_t offset);
Jeffrey Goode37adbee2009-11-06 04:13:36 +000029
30/* Init */
Michael Sevakisfdd36342012-04-27 16:51:54 -040031size_t pcmbuf_init(void *bufend);
Jeffrey Goode37adbee2009-11-06 04:13:36 +000032
33/* Playback */
Miika Pekkarinen159c52d2005-08-20 11:13:19 +000034void pcmbuf_play_start(void);
Jeffrey Goode04b01e12009-11-05 21:59:36 +000035void pcmbuf_play_stop(void);
36void pcmbuf_pause(bool pause);
Michael Sevakis5833cc12012-02-20 00:47:21 -050037
38/* Track change */
Michael Sevakis7ad2cad2011-08-28 07:45:35 +000039
40/* Track change origin type */
41enum pcm_track_change_type
42{
43 TRACK_CHANGE_NONE = 0, /* No track change pending */
44 TRACK_CHANGE_MANUAL, /* Manual change (from user) */
45 TRACK_CHANGE_AUTO, /* Automatic change (from codec) */
Michael Sevakis5e4532c2017-04-06 19:32:35 -040046 TRACK_CHANGE_AUTO_PILEUP, /* Auto change during pending change */
Michael Sevakis7ad2cad2011-08-28 07:45:35 +000047 TRACK_CHANGE_END_OF_DATA, /* Expect no more data (from codec) */
48};
Michael Sevakis5833cc12012-02-20 00:47:21 -050049void pcmbuf_monitor_track_change(bool monitor);
Michael Sevakis7ad2cad2011-08-28 07:45:35 +000050void pcmbuf_start_track_change(enum pcm_track_change_type type);
Brandon Low413da2a2006-02-07 20:38:55 +000051
Jeffrey Goode37adbee2009-11-06 04:13:36 +000052/* Crossfade */
Jeffrey Goode9e095342009-11-10 03:46:08 +000053#ifdef HAVE_CROSSFADE
Michael Sevakis7ad2cad2011-08-28 07:45:35 +000054void pcmbuf_request_crossfade_enable(int setting);
Jeffrey Goode04b01e12009-11-05 21:59:36 +000055bool pcmbuf_is_same_size(void);
Michael Sevakisc537d592011-04-27 03:08:23 +000056#else
57/* Dummy functions with sensible returns */
Michael Sevakis7ad2cad2011-08-28 07:45:35 +000058static FORCE_INLINE void pcmbuf_request_crossfade_enable(bool on_off)
Michael Sevakisc537d592011-04-27 03:08:23 +000059 { return; (void)on_off; }
Michael Sevakis7ad2cad2011-08-28 07:45:35 +000060static FORCE_INLINE bool pcmbuf_is_same_size(void)
Michael Sevakisc537d592011-04-27 03:08:23 +000061 { return true; }
Jeffrey Goode9e095342009-11-10 03:46:08 +000062#endif
Jeffrey Goode04b01e12009-11-05 21:59:36 +000063
Jeffrey Goode37adbee2009-11-06 04:13:36 +000064/* Debug menu, other metrics */
Jeffrey Goode04b01e12009-11-05 21:59:36 +000065size_t pcmbuf_free(void);
66size_t pcmbuf_get_bufsize(void);
Jeffrey Goode04b01e12009-11-05 21:59:36 +000067int pcmbuf_used_descs(void);
Michael Sevakis5833cc12012-02-20 00:47:21 -050068int pcmbuf_descs(void);
Jeffrey Goode04b01e12009-11-05 21:59:36 +000069
Michael Sevakis5833cc12012-02-20 00:47:21 -050070/* Fading and channel volume control */
Michael Sevakisa2b67032011-06-29 06:37:04 +000071void pcmbuf_fade(bool fade, bool in);
Michael Sevakis5078d462011-08-23 01:37:59 +000072bool pcmbuf_fading(void);
Michael Sevakisa2b67032011-06-29 06:37:04 +000073void pcmbuf_soft_mode(bool shhh);
Michael Sevakis5833cc12012-02-20 00:47:21 -050074
75/* Time and position */
76unsigned int pcmbuf_get_position_key(void);
77void pcmbuf_sync_position_update(void);
78
79/* Misc */
Jeffrey Goode04b01e12009-11-05 21:59:36 +000080bool pcmbuf_is_lowdata(void);
81void pcmbuf_set_low_latency(bool state);
Michael Sevakisd37bf242013-05-23 13:58:51 -040082void pcmbuf_update_frequency(void);
83unsigned int pcmbuf_get_frequency(void);
Miika Pekkarinen159c52d2005-08-20 11:13:19 +000084
Michael Sevakis5833cc12012-02-20 00:47:21 -050085#endif /* PCMBUF_H */