i.MX31: Implement asynchronous version of I2C driver.
[maemo-rb.git] / apps / pcmbuf.h
blob3261b20b351bf6b13c28e1b9f19b6eea0e737817
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Miika Pekkarinen
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef PCMBUF_H
22 #define PCMBUF_H
24 #include <sys/types.h>
26 /* Commit PCM data */
27 void *pcmbuf_request_buffer(int *count);
28 void pcmbuf_write_complete(int count, unsigned long elapsed, off_t offset);
30 /* Init */
31 size_t pcmbuf_init(unsigned char *bufend);
33 /* Playback */
34 void pcmbuf_play_start(void);
35 void pcmbuf_play_stop(void);
36 void pcmbuf_pause(bool pause);
37 void pcmbuf_monitor_track_change(bool monitor);
38 void pcmbuf_sync_position_update(void);
40 /* Track change origin type */
41 enum pcm_track_change_type
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) */
48 void pcmbuf_start_track_change(enum pcm_track_change_type type);
50 /* Crossfade */
51 #ifdef HAVE_CROSSFADE
52 bool pcmbuf_is_crossfade_active(void);
53 void pcmbuf_request_crossfade_enable(int setting);
54 bool pcmbuf_is_same_size(void);
55 #else
56 /* Dummy functions with sensible returns */
57 static FORCE_INLINE bool pcmbuf_is_crossfade_active(void)
58 { return false; }
59 static FORCE_INLINE void pcmbuf_request_crossfade_enable(bool on_off)
60 { return; (void)on_off; }
61 static FORCE_INLINE bool pcmbuf_is_same_size(void)
62 { return true; }
63 #endif
65 /* Voice */
66 void *pcmbuf_request_voice_buffer(int *count);
67 void pcmbuf_write_voice_complete(int count);
69 /* Debug menu, other metrics */
70 size_t pcmbuf_free(void);
71 size_t pcmbuf_get_bufsize(void);
72 int pcmbuf_descs(void);
73 int pcmbuf_used_descs(void);
74 unsigned int pcmbuf_get_position_key(void);
76 /* Misc */
77 void pcmbuf_fade(bool fade, bool in);
78 bool pcmbuf_fading(void);
79 void pcmbuf_soft_mode(bool shhh);
80 bool pcmbuf_is_lowdata(void);
81 void pcmbuf_set_low_latency(bool state);
83 #endif