~mixxxdevelopers/mixxx/mixxx-buildserver

« back to all changes in this revision

Viewing changes to mixxx/lib/libsamplerate/common.h

  • Committer: Albert Santoni
  • Date: 2011-03-20 00:27:15 UTC
  • mfrom: (2607.1.162 mixxx-1.9)
  • Revision ID: alberts@mixxx.org-20110320002715-sa2d88zbuc5kkyya
MergedĀ fromĀ 1.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
** Copyright (C) 2002,2003 Erik de Castro Lopo <erikd@mega-nerd.com>
3
 
**
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.
8
 
**
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.
13
 
**
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.
17
 
*/
18
 
 
19
 
#ifndef COMMON_H_INCLUDED
20
 
#define COMMON_H_INCLUDED
21
 
 
22
 
#ifdef HAVE_STDINT_H
23
 
#include <stdint.h>
24
 
#elif (SIZEOF_INT == 4)
25
 
typedef  int  int32_t ;
26
 
#elif (SIZEOF_LONG == 4)
27
 
typedef  long  int32_t ;
28
 
#endif
29
 
 
30
 
#define SRC_MAX_RATIO                   12
31
 
#define SRC_MIN_RATIO_DIFF              (1e-20)
32
 
 
33
 
#define MAX(a,b)        (((a) > (b)) ? (a) : (b))
34
 
#define MIN(a,b)        (((a) < (b)) ? (a) : (b))
35
 
 
36
 
#define MAKE_MAGIC(a,b,c,d,e,f) ((a)+((b)<<4)+((c)<<8)+((d)<<12)+((e)<<16)+((f)<<20))
37
 
 
38
 
#include "samplerate.h"
39
 
 
40
 
enum
41
 
{       SRC_FALSE       = 0,
42
 
        SRC_TRUE        = 1
43
 
} ;
44
 
 
45
 
enum
46
 
{       SRC_ERR_NO_ERROR = 0,
47
 
 
48
 
        SRC_ERR_MALLOC_FAILED,
49
 
        SRC_ERR_BAD_STATE,
50
 
        SRC_ERR_BAD_DATA,
51
 
        SRC_ERR_BAD_DATA_PTR,
52
 
        SRC_ERR_NO_PRIVATE,
53
 
        SRC_ERR_BAD_SRC_RATIO,
54
 
        SRC_ERR_BAD_PROC_PTR,
55
 
        SRC_ERR_SHIFT_BITS,
56
 
        SRC_ERR_FILTER_LEN,
57
 
        SRC_ERR_BAD_CONVERTER,
58
 
        SRC_ERR_BAD_CHANNEL_COUNT,
59
 
        SRC_ERR_SINC_BAD_BUFFER_LEN,
60
 
        SRC_ERR_SIZE_INCOMPATIBILITY,
61
 
        SRC_ERR_BAD_PRIV_PTR,
62
 
        SRC_ERR_BAD_SINC_STATE,
63
 
        SRC_ERR_DATA_OVERLAP,
64
 
 
65
 
        /* This must be the last error number. */
66
 
        SRC_ERR_MAX_ERROR
67
 
} ;
68
 
 
69
 
typedef struct SRC_PRIVATE_tag
70
 
{       double  last_ratio, last_position ;
71
 
 
72
 
        void    *private_data ;
73
 
 
74
 
        int             (*process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ;
75
 
        void    (*reset) (struct SRC_PRIVATE_tag *psrc) ;
76
 
 
77
 
        int             error ;
78
 
        int             channels ;
79
 
} SRC_PRIVATE ;
80
 
 
81
 
/* In src_sinc.c */
82
 
int sinc_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
83
 
 
84
 
const char* sinc_get_name (int src_enum) ;
85
 
const char* sinc_get_description (int src_enum) ;
86
 
 
87
 
int sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) ;
88
 
 
89
 
/* In src_linear.c */
90
 
int linear_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
91
 
 
92
 
const char* linear_get_name (int src_enum) ;
93
 
const char* linear_get_description (int src_enum) ;
94
 
 
95
 
int linear_set_converter (SRC_PRIVATE *psrc, int src_enum) ;
96
 
 
97
 
/* In src_zoh.c */
98
 
int zoh_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
99
 
 
100
 
const char* zoh_get_name (int src_enum) ;
101
 
const char* zoh_get_description (int src_enum) ;
102
 
 
103
 
int zoh_set_converter (SRC_PRIVATE *psrc, int src_enum) ;
104
 
 
105
 
#endif  /* COMMON_H_INCLUDED */