Miika Pekkarinen | 20b3897 | 2005-07-13 12:48:22 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2005 by Miika Pekkarinen |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame] | 12 | * 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 Pekkarinen | 20b3897 | 2005-07-13 12:48:22 +0000 | [diff] [blame] | 16 | * |
| 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 Sevakis | 7ad2cad | 2011-08-28 07:45:35 +0000 | [diff] [blame] | 24 | #include <sys/types.h> |
| 25 | |
Jeffrey Goode | 37adbee | 2009-11-06 04:13:36 +0000 | [diff] [blame] | 26 | /* Commit PCM data */ |
| 27 | void *pcmbuf_request_buffer(int *count); |
Michael Sevakis | 7ad2cad | 2011-08-28 07:45:35 +0000 | [diff] [blame] | 28 | void pcmbuf_write_complete(int count, unsigned long elapsed, off_t offset); |
Jeffrey Goode | 37adbee | 2009-11-06 04:13:36 +0000 | [diff] [blame] | 29 | |
| 30 | /* Init */ |
Michael Sevakis | fdd3634 | 2012-04-27 16:51:54 -0400 | [diff] [blame] | 31 | size_t pcmbuf_init(void *bufend); |
Jeffrey Goode | 37adbee | 2009-11-06 04:13:36 +0000 | [diff] [blame] | 32 | |
| 33 | /* Playback */ |
Miika Pekkarinen | 159c52d | 2005-08-20 11:13:19 +0000 | [diff] [blame] | 34 | void pcmbuf_play_start(void); |
Jeffrey Goode | 04b01e1 | 2009-11-05 21:59:36 +0000 | [diff] [blame] | 35 | void pcmbuf_play_stop(void); |
| 36 | void pcmbuf_pause(bool pause); |
Michael Sevakis | 5833cc1 | 2012-02-20 00:47:21 -0500 | [diff] [blame] | 37 | |
| 38 | /* Track change */ |
Michael Sevakis | 7ad2cad | 2011-08-28 07:45:35 +0000 | [diff] [blame] | 39 | |
| 40 | /* Track change origin type */ |
| 41 | enum 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) */ |
| 46 | TRACK_CHANGE_END_OF_DATA, /* Expect no more data (from codec) */ |
| 47 | }; |
Michael Sevakis | 5833cc1 | 2012-02-20 00:47:21 -0500 | [diff] [blame] | 48 | void pcmbuf_monitor_track_change(bool monitor); |
Michael Sevakis | 7ad2cad | 2011-08-28 07:45:35 +0000 | [diff] [blame] | 49 | void pcmbuf_start_track_change(enum pcm_track_change_type type); |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 50 | |
Jeffrey Goode | 37adbee | 2009-11-06 04:13:36 +0000 | [diff] [blame] | 51 | /* Crossfade */ |
Jeffrey Goode | 9e09534 | 2009-11-10 03:46:08 +0000 | [diff] [blame] | 52 | #ifdef HAVE_CROSSFADE |
Michael Sevakis | 7ad2cad | 2011-08-28 07:45:35 +0000 | [diff] [blame] | 53 | void pcmbuf_request_crossfade_enable(int setting); |
Jeffrey Goode | 04b01e1 | 2009-11-05 21:59:36 +0000 | [diff] [blame] | 54 | bool pcmbuf_is_same_size(void); |
Michael Sevakis | c537d59 | 2011-04-27 03:08:23 +0000 | [diff] [blame] | 55 | #else |
| 56 | /* Dummy functions with sensible returns */ |
Michael Sevakis | 7ad2cad | 2011-08-28 07:45:35 +0000 | [diff] [blame] | 57 | static FORCE_INLINE void pcmbuf_request_crossfade_enable(bool on_off) |
Michael Sevakis | c537d59 | 2011-04-27 03:08:23 +0000 | [diff] [blame] | 58 | { return; (void)on_off; } |
Michael Sevakis | 7ad2cad | 2011-08-28 07:45:35 +0000 | [diff] [blame] | 59 | static FORCE_INLINE bool pcmbuf_is_same_size(void) |
Michael Sevakis | c537d59 | 2011-04-27 03:08:23 +0000 | [diff] [blame] | 60 | { return true; } |
Jeffrey Goode | 9e09534 | 2009-11-10 03:46:08 +0000 | [diff] [blame] | 61 | #endif |
Jeffrey Goode | 04b01e1 | 2009-11-05 21:59:36 +0000 | [diff] [blame] | 62 | |
Jeffrey Goode | 37adbee | 2009-11-06 04:13:36 +0000 | [diff] [blame] | 63 | /* Debug menu, other metrics */ |
Jeffrey Goode | 04b01e1 | 2009-11-05 21:59:36 +0000 | [diff] [blame] | 64 | size_t pcmbuf_free(void); |
| 65 | size_t pcmbuf_get_bufsize(void); |
Jeffrey Goode | 04b01e1 | 2009-11-05 21:59:36 +0000 | [diff] [blame] | 66 | int pcmbuf_used_descs(void); |
Michael Sevakis | 5833cc1 | 2012-02-20 00:47:21 -0500 | [diff] [blame] | 67 | int pcmbuf_descs(void); |
Jeffrey Goode | 04b01e1 | 2009-11-05 21:59:36 +0000 | [diff] [blame] | 68 | |
Michael Sevakis | 5833cc1 | 2012-02-20 00:47:21 -0500 | [diff] [blame] | 69 | /* Fading and channel volume control */ |
Michael Sevakis | a2b6703 | 2011-06-29 06:37:04 +0000 | [diff] [blame] | 70 | void pcmbuf_fade(bool fade, bool in); |
Michael Sevakis | 5078d46 | 2011-08-23 01:37:59 +0000 | [diff] [blame] | 71 | bool pcmbuf_fading(void); |
Michael Sevakis | a2b6703 | 2011-06-29 06:37:04 +0000 | [diff] [blame] | 72 | void pcmbuf_soft_mode(bool shhh); |
Michael Sevakis | 5833cc1 | 2012-02-20 00:47:21 -0500 | [diff] [blame] | 73 | |
| 74 | /* Time and position */ |
| 75 | unsigned int pcmbuf_get_position_key(void); |
| 76 | void pcmbuf_sync_position_update(void); |
| 77 | |
| 78 | /* Misc */ |
Jeffrey Goode | 04b01e1 | 2009-11-05 21:59:36 +0000 | [diff] [blame] | 79 | bool pcmbuf_is_lowdata(void); |
| 80 | void pcmbuf_set_low_latency(bool state); |
Michael Sevakis | d37bf24 | 2013-05-23 13:58:51 -0400 | [diff] [blame] | 81 | void pcmbuf_update_frequency(void); |
| 82 | unsigned int pcmbuf_get_frequency(void); |
Miika Pekkarinen | 159c52d | 2005-08-20 11:13:19 +0000 | [diff] [blame] | 83 | |
Michael Sevakis | 5833cc1 | 2012-02-20 00:47:21 -0500 | [diff] [blame] | 84 | #endif /* PCMBUF_H */ |