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