Commited too much really this time.
[kugel-rb.git] / apps / pcmbuf.h
blobb4e551f74da959964854897a3d0124da28c22cb5
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 #define PCMBUF_TARGET_CHUNK 32768 /* This is the target fill size of chunks
25 on the pcm buffer */
26 #define PCMBUF_MINAVG_CHUNK 24576 /* This is the minimum average size of
27 chunks on the pcm buffer (or we run out
28 of buffer descriptors, which is
29 non-fatal) */
30 #define PCMBUF_MIN_CHUNK 4096 /* We try to never feed a chunk smaller than
31 this to the DMA */
32 #define PCMBUF_MIX_CHUNK 8192 /* This is the maximum size of one packet
33 for mixing (crossfade or voice) */
35 /* Returns true if the buffer needs to change size */
36 bool pcmbuf_is_same_size(void);
37 size_t pcmbuf_init(unsigned char *bufend);
38 /* Size in bytes used by the pcmbuffer */
39 size_t pcmbuf_get_bufsize(void);
40 #ifdef ROCKBOX_HAS_LOGF
41 /* just used for logging for now */
42 unsigned char * pcmbuf_get_meminfo(size_t *length);
43 #endif
45 void pcmbuf_pause(bool pause);
46 void pcmbuf_play_stop(void);
47 bool pcmbuf_is_crossfade_active(void);
49 /* These functions are for playing chained buffers of PCM data */
50 #if defined(HAVE_ADJUSTABLE_CPU_FREQ)
51 void pcmbuf_boost(bool state);
52 void pcmbuf_set_boost_mode(bool state);
53 #else
54 #define pcmbuf_boost(state) do { } while(0)
55 #define pcmbuf_set_boost_mode(state) do { } while(0)
56 #endif
57 bool pcmbuf_is_lowdata(void);
58 void pcmbuf_play_start(void);
59 bool pcmbuf_crossfade_init(bool manual_skip);
60 void pcmbuf_set_event_handler(void (*callback)(void));
61 void pcmbuf_set_position_callback(void (*callback)(size_t size));
62 size_t pcmbuf_free(void);
63 unsigned int pcmbuf_get_latency(void);
64 void pcmbuf_set_low_latency(bool state);
65 void * pcmbuf_request_buffer(int *count);
66 void pcmbuf_write_complete(int count);
67 void * pcmbuf_request_voice_buffer(int *count);
68 void pcmbuf_write_voice_complete(int count);
69 bool pcmbuf_is_crossfade_enabled(void);
70 void pcmbuf_crossfade_enable(bool on_off);
71 void pcmbuf_crossfade_enable_finished(void);
72 int pcmbuf_usage(void);
73 int pcmbuf_mix_free(void);
74 void pcmbuf_beep(unsigned int frequency, size_t duration, int amplitude);
76 int pcmbuf_used_descs(void);
77 int pcmbuf_descs(void);
79 #endif