1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2005 by Miika Pekkarinen
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
23 #define PCMBUF_TARGET_CHUNK 32768 /* This is the target fill size of chunks
25 #define PCMBUF_MINAVG_CHUNK 24576 /* This is the minimum average size of
26 chunks on the pcm buffer (or we run out
27 of buffer descriptors, which is
30 #define PCMBUF_TARGET_CHUNK 16384
31 #define PCMBUF_MINAVG_CHUNK 12288
34 #define PCMBUF_MIN_CHUNK 4096 /* We try to never feed a chunk smaller than
36 #define PCMBUF_MIX_CHUNK 8192 /* This is the maximum size of one packet
37 for mixing (crossfade or voice) */
39 /* Returns true if the buffer needs to change size */
40 bool pcmbuf_is_same_size(size_t bufsize
);
41 void pcmbuf_init(size_t bufsize
);
42 /* Size in bytes used by the pcmbuffer */
43 size_t pcmbuf_get_bufsize(void);
44 size_t get_pcmbuf_descsize(void);
46 void pcmbuf_pause(bool pause
);
47 void pcmbuf_play_stop(void);
48 bool pcmbuf_is_crossfade_active(void);
50 /* These functions are for playing chained buffers of PCM data */
51 #if defined(HAVE_ADJUSTABLE_CPU_FREQ) && !defined(SIMULATOR)
52 void pcmbuf_boost(bool state
);
53 void pcmbuf_set_boost_mode(bool state
);
55 #define pcmbuf_boost(state) do { } while(0)
56 #define pcmbuf_set_boost_mode(state) do { } while(0)
58 bool pcmbuf_is_lowdata(void);
59 void pcmbuf_play_start(void);
60 bool pcmbuf_crossfade_init(bool manual_skip
);
61 void pcmbuf_set_event_handler(void (*callback
)(void));
62 void pcmbuf_set_position_callback(void (*callback
)(size_t size
));
63 size_t pcmbuf_free(void);
64 unsigned int pcmbuf_get_latency(void);
65 void pcmbuf_set_low_latency(bool state
);
66 void pcmbuf_write_complete(size_t length
);
67 void* pcmbuf_request_buffer(size_t length
, size_t *realsize
);
68 void* pcmbuf_request_voice_buffer(size_t length
, size_t *realsize
, bool mix
);
69 bool pcmbuf_is_crossfade_enabled(void);
70 void pcmbuf_crossfade_enable(bool on_off
);
72 int pcmbuf_usage(void);
73 int pcmbuf_mix_free(void);
74 void pcmbuf_beep(unsigned int frequency
, size_t duration
, int amplitude
);
75 void pcmbuf_mix_voice(size_t length
);
77 int pcmbuf_used_descs(void);
78 int pcmbuf_descs(void);