2005-07-13 12:48:22 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 by Miika Pekkarinen
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2005-07-13 12:48:22 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef PCMBUF_H
|
|
|
|
#define PCMBUF_H
|
|
|
|
|
2006-02-07 20:38:55 +00:00
|
|
|
#define PCMBUF_TARGET_CHUNK 32768 /* This is the target fill size of chunks
|
|
|
|
on the pcm buffer */
|
2006-05-08 11:03:19 +00:00
|
|
|
#define PCMBUF_MINAVG_CHUNK 24576 /* This is the minimum average size of
|
|
|
|
chunks on the pcm buffer (or we run out
|
|
|
|
of buffer descriptors, which is
|
|
|
|
non-fatal) */
|
2006-02-07 20:38:55 +00:00
|
|
|
#define PCMBUF_MIN_CHUNK 4096 /* We try to never feed a chunk smaller than
|
|
|
|
this to the DMA */
|
2006-04-22 14:40:13 +00:00
|
|
|
#define PCMBUF_MIX_CHUNK 8192 /* This is the maximum size of one packet
|
2006-02-07 20:38:55 +00:00
|
|
|
for mixing (crossfade or voice) */
|
2005-07-13 12:48:22 +00:00
|
|
|
|
2006-02-07 20:38:55 +00:00
|
|
|
/* Returns true if the buffer needs to change size */
|
2007-03-19 22:04:17 +00:00
|
|
|
bool pcmbuf_is_same_size(void);
|
|
|
|
size_t pcmbuf_init(unsigned char *bufend);
|
2006-02-07 20:38:55 +00:00
|
|
|
/* Size in bytes used by the pcmbuffer */
|
|
|
|
size_t pcmbuf_get_bufsize(void);
|
2007-03-19 22:04:17 +00:00
|
|
|
#ifdef ROCKBOX_HAS_LOGF
|
|
|
|
/* just used for logging for now */
|
|
|
|
unsigned char * pcmbuf_get_meminfo(size_t *length);
|
|
|
|
#endif
|
2005-07-13 12:48:22 +00:00
|
|
|
|
2006-02-07 20:38:55 +00:00
|
|
|
void pcmbuf_pause(bool pause);
|
2005-07-13 12:48:22 +00:00
|
|
|
void pcmbuf_play_stop(void);
|
|
|
|
bool pcmbuf_is_crossfade_active(void);
|
|
|
|
|
|
|
|
/* These functions are for playing chained buffers of PCM data */
|
2007-05-10 13:16:08 +00:00
|
|
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
2005-08-28 14:16:03 +00:00
|
|
|
void pcmbuf_boost(bool state);
|
2005-07-13 12:48:22 +00:00
|
|
|
void pcmbuf_set_boost_mode(bool state);
|
2005-08-28 19:55:30 +00:00
|
|
|
#else
|
2006-02-07 20:38:55 +00:00
|
|
|
#define pcmbuf_boost(state) do { } while(0)
|
2005-08-28 19:55:30 +00:00
|
|
|
#define pcmbuf_set_boost_mode(state) do { } while(0)
|
|
|
|
#endif
|
2005-07-13 12:48:22 +00:00
|
|
|
bool pcmbuf_is_lowdata(void);
|
2005-08-20 11:13:19 +00:00
|
|
|
void pcmbuf_play_start(void);
|
2006-01-27 16:25:44 +00:00
|
|
|
bool pcmbuf_crossfade_init(bool manual_skip);
|
2006-02-07 20:38:55 +00:00
|
|
|
void pcmbuf_set_event_handler(void (*callback)(void));
|
2008-03-28 12:51:33 +00:00
|
|
|
void pcmbuf_set_position_callback(void (*callback)(size_t size));
|
2006-04-23 22:54:34 +00:00
|
|
|
size_t pcmbuf_free(void);
|
2005-07-13 12:48:22 +00:00
|
|
|
unsigned int pcmbuf_get_latency(void);
|
2006-02-07 19:17:51 +00:00
|
|
|
void pcmbuf_set_low_latency(bool state);
|
2007-11-18 17:12:19 +00:00
|
|
|
void * pcmbuf_request_buffer(int *count);
|
2007-02-07 00:51:50 +00:00
|
|
|
void pcmbuf_write_complete(int count);
|
2007-11-18 17:12:19 +00:00
|
|
|
void * pcmbuf_request_voice_buffer(int *count);
|
|
|
|
void pcmbuf_write_voice_complete(int count);
|
2005-07-13 12:48:22 +00:00
|
|
|
bool pcmbuf_is_crossfade_enabled(void);
|
|
|
|
void pcmbuf_crossfade_enable(bool on_off);
|
2007-03-19 22:04:17 +00:00
|
|
|
void pcmbuf_crossfade_enable_finished(void);
|
2005-08-20 11:13:19 +00:00
|
|
|
int pcmbuf_usage(void);
|
2006-04-22 14:40:13 +00:00
|
|
|
int pcmbuf_mix_free(void);
|
2006-02-22 01:56:44 +00:00
|
|
|
void pcmbuf_beep(unsigned int frequency, size_t duration, int amplitude);
|
2006-02-07 20:38:55 +00:00
|
|
|
|
|
|
|
int pcmbuf_used_descs(void);
|
|
|
|
int pcmbuf_descs(void);
|
2009-06-17 08:47:51 +00:00
|
|
|
void pcmbuf_play_remainder(void);
|
2009-08-18 03:24:45 +00:00
|
|
|
void pcmbuf_flush_limiter_buffer(void);
|
2005-08-20 11:13:19 +00:00
|
|
|
|
2005-07-13 12:48:22 +00:00
|
|
|
#endif
|