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