Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/linuxbsd_headers/alsa/pcm_rate.h
9903 views
1
/**
2
* \file include/pcm_rate.h
3
* \brief External Rate-Converter-Plugin SDK
4
* \author Takashi Iwai <[email protected]>
5
* \date 2006
6
*
7
* External Rate-Converter-Plugin SDK
8
*/
9
10
/*
11
* ALSA external PCM rate-converter plugin SDK (draft version)
12
*
13
* Copyright (c) 2006 Takashi Iwai <[email protected]>
14
*
15
* This library is free software; you can redistribute it and/or modify
16
* it under the terms of the GNU Lesser General Public License as
17
* published by the Free Software Foundation; either version 2.1 of
18
* the License, or (at your option) any later version.
19
*
20
* This program is distributed in the hope that it will be useful,
21
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
* GNU Lesser General Public License for more details.
24
*
25
* You should have received a copy of the GNU Lesser General Public
26
* License along with this library; if not, write to the Free Software
27
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
*
29
*/
30
31
#ifndef __ALSA_PCM_RATE_H
32
#define __ALSA_PCM_RATE_H
33
34
#ifdef __cplusplus
35
extern "C" {
36
#endif
37
38
/**
39
* Protocol version
40
*/
41
#define SND_PCM_RATE_PLUGIN_VERSION 0x010002
42
43
/** hw_params information for a single side */
44
typedef struct snd_pcm_rate_side_info {
45
snd_pcm_format_t format;
46
unsigned int rate;
47
snd_pcm_uframes_t buffer_size;
48
snd_pcm_uframes_t period_size;
49
} snd_pcm_rate_side_info_t;
50
51
/** hw_params information */
52
typedef struct snd_pcm_rate_info {
53
struct snd_pcm_rate_side_info in;
54
struct snd_pcm_rate_side_info out;
55
unsigned int channels;
56
} snd_pcm_rate_info_t;
57
58
/** Callback table of rate-converter */
59
typedef struct snd_pcm_rate_ops {
60
/**
61
* close the converter; optional
62
*/
63
void (*close)(void *obj);
64
/**
65
* initialize the converter, called at hw_params
66
*/
67
int (*init)(void *obj, snd_pcm_rate_info_t *info);
68
/**
69
* free the converter; optional
70
*/
71
void (*free)(void *obj);
72
/**
73
* reset the converter, called at prepare; optional
74
*/
75
void (*reset)(void *obj);
76
/**
77
* adjust the pitch, called at sw_params; optional
78
*/
79
int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);
80
/**
81
* convert the data
82
*/
83
void (*convert)(void *obj,
84
const snd_pcm_channel_area_t *dst_areas,
85
snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
86
const snd_pcm_channel_area_t *src_areas,
87
snd_pcm_uframes_t src_offset, unsigned int src_frames);
88
/**
89
* convert an s16 interleaved-data array; exclusive with convert
90
*/
91
void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,
92
const int16_t *src, unsigned int src_frames);
93
/**
94
* compute the frame size for input
95
*/
96
snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);
97
/**
98
* compute the frame size for output
99
*/
100
snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);
101
/**
102
* the protocol version the plugin supports;
103
* new field since version 0x010002
104
*/
105
unsigned int version;
106
/**
107
* return the supported min / max sample rates;
108
* new ops since version 0x010002
109
*/
110
int (*get_supported_rates)(void *obj, unsigned int *rate_min,
111
unsigned int *rate_max);
112
/**
113
* show some status messages for verbose mode;
114
* new ops since version 0x010002
115
*/
116
void (*dump)(void *obj, snd_output_t *out);
117
} snd_pcm_rate_ops_t;
118
119
/** open function type */
120
typedef int (*snd_pcm_rate_open_func_t)(unsigned int version, void **objp,
121
snd_pcm_rate_ops_t *opsp);
122
123
/**
124
* Define the object entry for external PCM rate-converter plugins
125
*/
126
#define SND_PCM_RATE_PLUGIN_ENTRY(name) _snd_pcm_rate_##name##_open
127
128
129
#ifndef DOC_HIDDEN
130
/* old rate_ops for protocol version 0x010001 */
131
typedef struct snd_pcm_rate_old_ops {
132
void (*close)(void *obj);
133
int (*init)(void *obj, snd_pcm_rate_info_t *info);
134
void (*free)(void *obj);
135
void (*reset)(void *obj);
136
int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);
137
void (*convert)(void *obj,
138
const snd_pcm_channel_area_t *dst_areas,
139
snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
140
const snd_pcm_channel_area_t *src_areas,
141
snd_pcm_uframes_t src_offset, unsigned int src_frames);
142
void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,
143
const int16_t *src, unsigned int src_frames);
144
snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);
145
snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);
146
} snd_pcm_rate_old_ops_t;
147
#endif
148
149
#ifdef __cplusplus
150
}
151
#endif
152
153
#endif /* __ALSA_PCM_RATE_H */
154
155