2
** Copyright (C) 2002,2003 Erik de Castro Lopo <erikd@mega-nerd.com>
4
** This program is free software; you can redistribute it and/or modify
5
** it under the terms of the GNU General Public License as published by
6
** the Free Software Foundation; either version 2 of the License, or
7
** (at your option) any later version.
9
** This program is distributed in the hope that it will be useful,
10
** but WITHOUT ANY WARRANTY; without even the implied warranty of
11
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
** GNU General Public License for more details.
14
** You should have received a copy of the GNU General Public License
15
** along with this program; if not, write to the Free Software
16
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
19
#ifndef COMMON_H_INCLUDED
20
#define COMMON_H_INCLUDED
24
#elif (SIZEOF_INT == 4)
26
#elif (SIZEOF_LONG == 4)
27
typedef long int32_t ;
30
#define SRC_MAX_RATIO 12
31
#define SRC_MIN_RATIO_DIFF (1e-20)
33
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
34
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
36
#define MAKE_MAGIC(a,b,c,d,e,f) ((a)+((b)<<4)+((c)<<8)+((d)<<12)+((e)<<16)+((f)<<20))
38
#include "samplerate.h"
46
{ SRC_ERR_NO_ERROR = 0,
48
SRC_ERR_MALLOC_FAILED,
53
SRC_ERR_BAD_SRC_RATIO,
57
SRC_ERR_BAD_CONVERTER,
58
SRC_ERR_BAD_CHANNEL_COUNT,
59
SRC_ERR_SINC_BAD_BUFFER_LEN,
60
SRC_ERR_SIZE_INCOMPATIBILITY,
62
SRC_ERR_BAD_SINC_STATE,
65
/* This must be the last error number. */
69
typedef struct SRC_PRIVATE_tag
70
{ double last_ratio, last_position ;
74
int (*process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ;
75
void (*reset) (struct SRC_PRIVATE_tag *psrc) ;
82
int sinc_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
84
const char* sinc_get_name (int src_enum) ;
85
const char* sinc_get_description (int src_enum) ;
87
int sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) ;
90
int linear_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
92
const char* linear_get_name (int src_enum) ;
93
const char* linear_get_description (int src_enum) ;
95
int linear_set_converter (SRC_PRIVATE *psrc, int src_enum) ;
98
int zoh_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
100
const char* zoh_get_name (int src_enum) ;
101
const char* zoh_get_description (int src_enum) ;
103
int zoh_set_converter (SRC_PRIVATE *psrc, int src_enum) ;
105
#endif /* COMMON_H_INCLUDED */