|
Packit |
4a16fb |
/*
|
|
Packit |
4a16fb |
* PCM - Common plugin code
|
|
Packit |
4a16fb |
* Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* This library is free software; you can redistribute it and/or modify
|
|
Packit |
4a16fb |
* it under the terms of the GNU Lesser General Public License as
|
|
Packit |
4a16fb |
* published by the Free Software Foundation; either version 2.1 of
|
|
Packit |
4a16fb |
* the License, or (at your option) any later version.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* This program is distributed in the hope that it will be useful,
|
|
Packit |
4a16fb |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
4a16fb |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
4a16fb |
* GNU Lesser General Public License for more details.
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
4a16fb |
* License along with this library; if not, write to the Free Software
|
|
Packit |
4a16fb |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit |
4a16fb |
*
|
|
Packit |
4a16fb |
*/
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
#include "pcm_generic.h"
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
typedef snd_pcm_uframes_t (*snd_pcm_slave_xfer_areas_func_t)
|
|
Packit |
4a16fb |
(snd_pcm_t *pcm,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t offset,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t size,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *slave_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t slave_offset,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t *slave_sizep);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
typedef snd_pcm_sframes_t (*snd_pcm_slave_xfer_areas_undo_func_t)
|
|
Packit |
4a16fb |
(snd_pcm_t *pcm,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *res_areas, /* result areas */
|
|
Packit |
4a16fb |
snd_pcm_uframes_t res_offset, /* offset of result areas */
|
|
Packit |
4a16fb |
snd_pcm_uframes_t res_size, /* size of result areas */
|
|
Packit |
4a16fb |
snd_pcm_uframes_t slave_undo_size);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
typedef struct {
|
|
Packit |
4a16fb |
snd_pcm_generic_t gen;
|
|
Packit |
4a16fb |
snd_pcm_slave_xfer_areas_func_t read;
|
|
Packit |
4a16fb |
snd_pcm_slave_xfer_areas_func_t write;
|
|
Packit |
4a16fb |
snd_pcm_slave_xfer_areas_undo_func_t undo_read;
|
|
Packit |
4a16fb |
snd_pcm_slave_xfer_areas_undo_func_t undo_write;
|
|
Packit |
4a16fb |
int (*init)(snd_pcm_t *pcm);
|
|
Packit |
4a16fb |
snd_pcm_uframes_t appl_ptr, hw_ptr;
|
|
Packit |
4a16fb |
} snd_pcm_plugin_t;
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/* make local functions really local */
|
|
Packit |
4a16fb |
#define snd_pcm_plugin_init \
|
|
Packit |
4a16fb |
snd1_pcm_plugin_init
|
|
Packit |
4a16fb |
#define snd_pcm_plugin_may_wait_for_avail_min \
|
|
Packit |
4a16fb |
snd1_pcm_plugin_may_wait_for_avail_min
|
|
Packit |
4a16fb |
#define snd_pcm_plugin_fast_ops \
|
|
Packit |
4a16fb |
snd1_pcm_plugin_fast_ops
|
|
Packit |
4a16fb |
#define snd_pcm_plugin_undo_read_generic \
|
|
Packit |
4a16fb |
snd1_pcm_plugin_undo_read_generic
|
|
Packit |
4a16fb |
#define snd_pcm_plugin_undo_write_generic \
|
|
Packit |
4a16fb |
snd1_pcm_plugin_undo_write_generic
|
|
Packit |
4a16fb |
#define snd_pcm_plugin_rewind \
|
|
Packit |
4a16fb |
snd1_pcm_plugin_rewind
|
|
Packit |
4a16fb |
#define snd_pcm_plugin_forward \
|
|
Packit |
4a16fb |
snd1_pcm_plugin_forward
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
void snd_pcm_plugin_init(snd_pcm_plugin_t *plugin);
|
|
Packit |
4a16fb |
snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
|
|
Packit |
4a16fb |
snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
|
|
Packit |
4a16fb |
int snd_pcm_plugin_may_wait_for_avail_min(snd_pcm_t *pcm, snd_pcm_uframes_t avail);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
extern const snd_pcm_fast_ops_t snd_pcm_plugin_fast_ops;
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
snd_pcm_sframes_t snd_pcm_plugin_undo_read_generic
|
|
Packit |
4a16fb |
(snd_pcm_t *pcm,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *res_areas, /* result areas */
|
|
Packit |
4a16fb |
snd_pcm_uframes_t res_offset, /* offset of result areas */
|
|
Packit |
4a16fb |
snd_pcm_uframes_t res_size, /* size of result areas */
|
|
Packit |
4a16fb |
snd_pcm_uframes_t slave_undo_size);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
snd_pcm_sframes_t snd_pcm_plugin_undo_write_generic
|
|
Packit |
4a16fb |
(snd_pcm_t *pcm,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *res_areas, /* result areas */
|
|
Packit |
4a16fb |
snd_pcm_uframes_t res_offset, /* offset of result areas */
|
|
Packit |
4a16fb |
snd_pcm_uframes_t res_size, /* size of result areas */
|
|
Packit |
4a16fb |
snd_pcm_uframes_t slave_undo_size);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
/* make local functions really local */
|
|
Packit |
4a16fb |
#define snd_pcm_linear_get_index snd1_pcm_linear_get_index
|
|
Packit |
4a16fb |
#define snd_pcm_linear_put_index snd1_pcm_linear_put_index
|
|
Packit |
4a16fb |
#define snd_pcm_linear_convert_index snd1_pcm_linear_convert_index
|
|
Packit |
4a16fb |
#define snd_pcm_linear_convert snd1_pcm_linear_convert
|
|
Packit |
4a16fb |
#define snd_pcm_linear_getput snd1_pcm_linear_getput
|
|
Packit |
4a16fb |
#define snd_pcm_alaw_decode snd1_pcm_alaw_decode
|
|
Packit |
4a16fb |
#define snd_pcm_alaw_encode snd1_pcm_alaw_encode
|
|
Packit |
4a16fb |
#define snd_pcm_mulaw_decode snd1_pcm_mulaw_decode
|
|
Packit |
4a16fb |
#define snd_pcm_mulaw_encode snd1_pcm_mulaw_encode
|
|
Packit |
4a16fb |
#define snd_pcm_adpcm_decode snd1_pcm_adpcm_decode
|
|
Packit |
4a16fb |
#define snd_pcm_adpcm_encode snd1_pcm_adpcm_encode
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
|
Packit |
4a16fb |
int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
|
Packit |
4a16fb |
int snd_pcm_linear_convert_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
|
|
Packit |
4a16fb |
unsigned int channels, snd_pcm_uframes_t frames,
|
|
Packit |
4a16fb |
unsigned int convidx);
|
|
Packit |
4a16fb |
void snd_pcm_linear_getput(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
|
|
Packit |
4a16fb |
unsigned int channels, snd_pcm_uframes_t frames,
|
|
Packit |
4a16fb |
unsigned int get_idx, unsigned int put_idx);
|
|
Packit |
4a16fb |
void snd_pcm_alaw_decode(const snd_pcm_channel_area_t *dst_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t dst_offset,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *src_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t src_offset,
|
|
Packit |
4a16fb |
unsigned int channels, snd_pcm_uframes_t frames,
|
|
Packit |
4a16fb |
unsigned int putidx);
|
|
Packit |
4a16fb |
void snd_pcm_alaw_encode(const snd_pcm_channel_area_t *dst_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t dst_offset,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *src_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t src_offset,
|
|
Packit |
4a16fb |
unsigned int channels, snd_pcm_uframes_t frames,
|
|
Packit |
4a16fb |
unsigned int getidx);
|
|
Packit |
4a16fb |
void snd_pcm_mulaw_decode(const snd_pcm_channel_area_t *dst_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t dst_offset,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *src_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t src_offset,
|
|
Packit |
4a16fb |
unsigned int channels, snd_pcm_uframes_t frames,
|
|
Packit |
4a16fb |
unsigned int putidx);
|
|
Packit |
4a16fb |
void snd_pcm_mulaw_encode(const snd_pcm_channel_area_t *dst_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t dst_offset,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *src_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t src_offset,
|
|
Packit |
4a16fb |
unsigned int channels, snd_pcm_uframes_t frames,
|
|
Packit |
4a16fb |
unsigned int getidx);
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
typedef struct _snd_pcm_adpcm_state {
|
|
Packit |
4a16fb |
int pred_val; /* Calculated predicted value */
|
|
Packit |
4a16fb |
int step_idx; /* Previous StepSize lookup index */
|
|
Packit |
4a16fb |
} snd_pcm_adpcm_state_t;
|
|
Packit |
4a16fb |
|
|
Packit |
4a16fb |
void snd_pcm_adpcm_decode(const snd_pcm_channel_area_t *dst_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t dst_offset,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *src_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t src_offset,
|
|
Packit |
4a16fb |
unsigned int channels, snd_pcm_uframes_t frames,
|
|
Packit |
4a16fb |
unsigned int putidx,
|
|
Packit |
4a16fb |
snd_pcm_adpcm_state_t *states);
|
|
Packit |
4a16fb |
void snd_pcm_adpcm_encode(const snd_pcm_channel_area_t *dst_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t dst_offset,
|
|
Packit |
4a16fb |
const snd_pcm_channel_area_t *src_areas,
|
|
Packit |
4a16fb |
snd_pcm_uframes_t src_offset,
|
|
Packit |
4a16fb |
unsigned int channels, snd_pcm_uframes_t frames,
|
|
Packit |
4a16fb |
unsigned int getidx,
|
|
Packit |
4a16fb |
snd_pcm_adpcm_state_t *states);
|