2005-06-26 19:41:29 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 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-06-26 19:41:29 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _DSP_H
|
|
|
|
#define _DSP_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#define NATIVE_FREQUENCY 44100
|
2009-09-25 15:46:38 +00:00
|
|
|
|
2007-02-19 02:49:26 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
STEREO_INTERLEAVED = 0,
|
|
|
|
STEREO_NONINTERLEAVED,
|
|
|
|
STEREO_MONO,
|
|
|
|
STEREO_NUM_MODES,
|
|
|
|
};
|
2005-06-26 19:41:29 +00:00
|
|
|
|
2007-11-18 17:12:19 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
CODEC_IDX_AUDIO = 0,
|
|
|
|
CODEC_IDX_VOICE,
|
|
|
|
};
|
|
|
|
|
2007-02-24 17:06:36 +00:00
|
|
|
enum
|
|
|
|
{
|
2009-01-10 21:10:56 +00:00
|
|
|
DSP_MYDSP = 1,
|
2005-09-21 13:09:10 +00:00
|
|
|
DSP_SET_FREQUENCY,
|
|
|
|
DSP_SWITCH_FREQUENCY,
|
|
|
|
DSP_SET_SAMPLE_DEPTH,
|
|
|
|
DSP_SET_STEREO_MODE,
|
|
|
|
DSP_RESET,
|
2006-11-26 12:02:47 +00:00
|
|
|
DSP_FLUSH,
|
2005-09-21 13:09:10 +00:00
|
|
|
DSP_SET_TRACK_GAIN,
|
|
|
|
DSP_SET_ALBUM_GAIN,
|
|
|
|
DSP_SET_TRACK_PEAK,
|
2005-11-14 21:56:56 +00:00
|
|
|
DSP_SET_ALBUM_PEAK,
|
|
|
|
DSP_CROSSFEED
|
2005-09-21 13:09:10 +00:00
|
|
|
};
|
|
|
|
|
2012-02-08 19:55:37 +00:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* NOTE: Any assembly routines that use these structures must be updated
|
|
|
|
* if current data members are moved or changed.
|
|
|
|
*/
|
|
|
|
struct resample_data
|
|
|
|
{
|
|
|
|
uint32_t delta; /* 00h */
|
|
|
|
uint32_t phase; /* 04h */
|
|
|
|
int32_t last_sample[2]; /* 08h */
|
|
|
|
/* 10h */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* This is for passing needed data to external dsp routines. If another
|
|
|
|
* dsp parameter needs to be passed, add to the end of the structure
|
|
|
|
* and remove from dsp_config.
|
|
|
|
* If another function type becomes assembly/external and requires dsp
|
|
|
|
* config info, add a pointer paramter of type "struct dsp_data *".
|
|
|
|
* If removing something from other than the end, reserve the spot or
|
|
|
|
* else update every implementation for every target.
|
|
|
|
* Be sure to add the offset of the new member for easy viewing as well. :)
|
|
|
|
* It is the first member of dsp_config and all members can be accessesed
|
|
|
|
* through the main aggregate but this is intended to make a safe haven
|
|
|
|
* for these items whereas the c part can be rearranged at will. dsp_data
|
|
|
|
* could even moved within dsp_config without disurbing the order.
|
|
|
|
*/
|
|
|
|
struct dsp_data
|
|
|
|
{
|
|
|
|
int output_scale; /* 00h */
|
|
|
|
int num_channels; /* 04h */
|
|
|
|
struct resample_data resample_data; /* 08h */
|
|
|
|
int32_t clip_min; /* 18h */
|
|
|
|
int32_t clip_max; /* 1ch */
|
|
|
|
int32_t gain; /* 20h - Note that this is in S8.23 format. */
|
|
|
|
int frac_bits; /* 24h */
|
|
|
|
/* 28h */
|
|
|
|
};
|
|
|
|
|
2007-11-18 17:12:19 +00:00
|
|
|
struct dsp_config;
|
|
|
|
|
|
|
|
int dsp_process(struct dsp_config *dsp, char *dest,
|
|
|
|
const char *src[], int count);
|
|
|
|
int dsp_input_count(struct dsp_config *dsp, int count);
|
|
|
|
int dsp_output_count(struct dsp_config *dsp, int count);
|
|
|
|
intptr_t dsp_configure(struct dsp_config *dsp, int setting,
|
|
|
|
intptr_t value);
|
2009-10-22 00:59:42 +00:00
|
|
|
int get_replaygain_mode(bool have_track_gain, bool have_album_gain);
|
2007-02-24 17:06:36 +00:00
|
|
|
void dsp_set_replaygain(void);
|
2005-11-14 21:56:56 +00:00
|
|
|
void dsp_set_crossfeed(bool enable);
|
2006-04-11 13:49:05 +00:00
|
|
|
void dsp_set_crossfeed_direct_gain(int gain);
|
2007-11-18 17:12:19 +00:00
|
|
|
void dsp_set_crossfeed_cross_params(long lf_gain, long hf_gain,
|
|
|
|
long cutoff);
|
2006-03-28 21:19:30 +00:00
|
|
|
void dsp_set_eq(bool enable);
|
|
|
|
void dsp_set_eq_precut(int precut);
|
|
|
|
void dsp_set_eq_coefs(int band);
|
2006-10-27 20:41:33 +00:00
|
|
|
void dsp_dither_enable(bool enable);
|
2009-06-12 07:20:50 +00:00
|
|
|
void dsp_timestretch_enable(bool enable);
|
2009-06-16 07:10:05 +00:00
|
|
|
bool dsp_timestretch_available(void);
|
2009-07-11 16:46:19 +00:00
|
|
|
void sound_set_pitch(int32_t r);
|
|
|
|
int32_t sound_get_pitch(void);
|
|
|
|
void dsp_set_timestretch(int32_t percent);
|
|
|
|
int32_t dsp_get_timestretch(void);
|
2009-06-16 07:10:05 +00:00
|
|
|
int dsp_callback(int msg, intptr_t param);
|
2011-10-05 04:44:56 +00:00
|
|
|
void dsp_set_compressor(void);
|
2006-03-21 23:20:17 +00:00
|
|
|
|
2005-06-26 19:41:29 +00:00
|
|
|
#endif
|