comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/alsa/pcm_rate.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 69:33d812a61356
1 /**
2 * \file include/pcm_rate.h
3 * \brief External Rate-Converter-Plugin SDK
4 * \author Takashi Iwai <tiwai@suse.de>
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 <tiwai@suse.de>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 typedef int (*snd_pcm_rate_open_conf_func_t)(unsigned int version, void **objp,
124 snd_pcm_rate_ops_t *opsp, const snd_config_t *conf);
125
126 /**
127 * Define the object entry for external PCM rate-converter plugins
128 */
129 #define SND_PCM_RATE_PLUGIN_ENTRY(name) _snd_pcm_rate_##name##_open
130 #define SND_PCM_RATE_PLUGIN_CONF_ENTRY(name) _snd_pcm_rate_##name##_open_conf
131
132 #ifndef DOC_HIDDEN
133 /* old rate_ops for protocol version 0x010001 */
134 typedef struct snd_pcm_rate_old_ops {
135 void (*close)(void *obj);
136 int (*init)(void *obj, snd_pcm_rate_info_t *info);
137 void (*free)(void *obj);
138 void (*reset)(void *obj);
139 int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);
140 void (*convert)(void *obj,
141 const snd_pcm_channel_area_t *dst_areas,
142 snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
143 const snd_pcm_channel_area_t *src_areas,
144 snd_pcm_uframes_t src_offset, unsigned int src_frames);
145 void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,
146 const int16_t *src, unsigned int src_frames);
147 snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);
148 snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);
149 } snd_pcm_rate_old_ops_t;
150 #endif
151
152 #ifdef __cplusplus
153 }
154 #endif
155
156 #endif /* __ALSA_PCM_RATE_H */