2000-09-24 09:57:26 +00:00
|
|
|
/*
|
|
|
|
|
* PCM - Common plugin code
|
|
|
|
|
* Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Library General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
snd_pcm_t *slave;
|
|
|
|
|
int close_slave;
|
|
|
|
|
snd_pcm_xfer_areas_func_t read;
|
|
|
|
|
snd_pcm_xfer_areas_func_t write;
|
2000-11-20 20:10:46 +00:00
|
|
|
ssize_t (*client_frames)(snd_pcm_t *pcm, ssize_t frames);
|
2000-09-24 09:57:26 +00:00
|
|
|
int (*init)(snd_pcm_t *pcm);
|
2000-11-20 20:10:46 +00:00
|
|
|
int shmid;
|
2000-10-14 10:31:34 +00:00
|
|
|
size_t appl_ptr, hw_ptr;
|
2000-09-24 09:57:26 +00:00
|
|
|
} snd_pcm_plugin_t;
|
|
|
|
|
|
|
|
|
|
int snd_pcm_plugin_close(snd_pcm_t *pcm);
|
|
|
|
|
int snd_pcm_plugin_nonblock(snd_pcm_t *pcm, int nonblock);
|
2000-10-11 12:37:27 +00:00
|
|
|
int snd_pcm_plugin_async(snd_pcm_t *pcm, int sig, pid_t pid);
|
2000-09-24 09:57:26 +00:00
|
|
|
int snd_pcm_plugin_info(snd_pcm_t *pcm, snd_pcm_info_t * info);
|
2000-11-20 20:10:46 +00:00
|
|
|
int snd_pcm_plugin_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
|
|
|
|
|
int snd_pcm_plugin_dig_info(snd_pcm_t *pcm, snd_pcm_dig_info_t *info);
|
|
|
|
|
int snd_pcm_plugin_dig_params(snd_pcm_t *pcm, snd_pcm_dig_params_t *params);
|
2000-09-24 09:57:26 +00:00
|
|
|
int snd_pcm_plugin_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info);
|
|
|
|
|
int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status);
|
|
|
|
|
int snd_pcm_plugin_state(snd_pcm_t *pcm);
|
|
|
|
|
int snd_pcm_plugin_delay(snd_pcm_t *pcm, ssize_t *delayp);
|
|
|
|
|
int snd_pcm_plugin_prepare(snd_pcm_t *pcm);
|
|
|
|
|
int snd_pcm_plugin_start(snd_pcm_t *pcm);
|
2000-10-02 06:59:59 +00:00
|
|
|
int snd_pcm_plugin_drop(snd_pcm_t *pcm);
|
2000-09-29 20:49:18 +00:00
|
|
|
int snd_pcm_plugin_drain(snd_pcm_t *pcm);
|
2000-09-24 09:57:26 +00:00
|
|
|
int snd_pcm_plugin_pause(snd_pcm_t *pcm, int enable);
|
2000-09-26 09:46:05 +00:00
|
|
|
ssize_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, size_t frames);
|
2000-09-24 09:57:26 +00:00
|
|
|
ssize_t snd_pcm_plugin_writei(snd_pcm_t *pcm, const void *buffer, size_t size);
|
|
|
|
|
ssize_t snd_pcm_plugin_writen(snd_pcm_t *pcm, void **bufs, size_t size);
|
|
|
|
|
ssize_t snd_pcm_plugin_readi(snd_pcm_t *pcm, void *buffer, size_t size);
|
|
|
|
|
ssize_t snd_pcm_plugin_readn(snd_pcm_t *pcm, void **bufs, size_t size);
|
|
|
|
|
ssize_t snd_pcm_plugin_mmap_forward(snd_pcm_t *pcm, size_t size);
|
|
|
|
|
ssize_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm);
|
|
|
|
|
int snd_pcm_plugin_mmap_status(snd_pcm_t *pcm);
|
|
|
|
|
int snd_pcm_plugin_mmap_control(snd_pcm_t *pcm);
|
2000-10-14 10:31:34 +00:00
|
|
|
int snd_pcm_plugin_mmap(snd_pcm_t *pcm);
|
2000-09-24 09:57:26 +00:00
|
|
|
int snd_pcm_plugin_munmap_status(snd_pcm_t *pcm);
|
|
|
|
|
int snd_pcm_plugin_munmap_control(snd_pcm_t *pcm);
|
2000-10-14 10:31:34 +00:00
|
|
|
int snd_pcm_plugin_munmap(snd_pcm_t *pcm);
|
2000-09-24 09:57:26 +00:00
|
|
|
int snd_pcm_plugin_poll_descriptor(snd_pcm_t *pcm);
|
2000-10-22 09:50:20 +00:00
|
|
|
int get_index(int src_format, int dst_format);
|
|
|
|
|
int put_index(int src_format, int dst_format);
|
2000-09-24 09:57:26 +00:00
|
|
|
int conv_index(int src_format, int dst_format);
|
|
|
|
|
|
2000-11-29 08:32:36 +00:00
|
|
|
#define SND_PCM_FMTBIT_LINEAR (SND_PCM_FMTBIT_S8 |SND_PCM_FMTBIT_U8 | \
|
2000-11-20 20:10:46 +00:00
|
|
|
SND_PCM_FMTBIT_S16_LE|SND_PCM_FMTBIT_S16_BE | \
|
|
|
|
|
SND_PCM_FMTBIT_U16_LE|SND_PCM_FMTBIT_U16_BE | \
|
|
|
|
|
SND_PCM_FMTBIT_S24_LE|SND_PCM_FMTBIT_S24_BE | \
|
|
|
|
|
SND_PCM_FMTBIT_U24_LE|SND_PCM_FMTBIT_U24_BE | \
|
|
|
|
|
SND_PCM_FMTBIT_S32_LE|SND_PCM_FMTBIT_S32_BE | \
|
|
|
|
|
SND_PCM_FMTBIT_U32_LE|SND_PCM_FMTBIT_U32_BE)
|
2000-09-24 09:57:26 +00:00
|
|
|
|
2000-10-14 10:31:34 +00:00
|
|
|
extern snd_pcm_fast_ops_t snd_pcm_plugin_fast_ops;
|
2000-09-24 09:57:26 +00:00
|
|
|
|
2000-11-29 08:32:36 +00:00
|
|
|
#define RATE_MIN 4000
|
|
|
|
|
#define RATE_MAX 192000
|
|
|
|
|
|
2000-09-24 09:57:26 +00:00
|
|
|
#define ROUTE_PLUGIN_FLOAT 1
|
|
|
|
|
#define ROUTE_PLUGIN_RESOLUTION 16
|
|
|
|
|
|
|
|
|
|
#if ROUTE_PLUGIN_FLOAT
|
|
|
|
|
typedef float ttable_entry_t;
|
|
|
|
|
#define HALF 0.5
|
|
|
|
|
#define FULL 1.0
|
|
|
|
|
#else
|
|
|
|
|
typedef int ttable_entry_t;
|
|
|
|
|
#define HALF (ROUTE_PLUGIN_RESOLUTION / 2)
|
|
|
|
|
#define FULL ROUTE_PLUGIN_RESOLUTION
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-12-11 11:16:07 +00:00
|
|
|
int snd_pcm_copy_open(snd_pcm_t **pcmp, char *name, snd_pcm_t *slave, int close_slave);
|
2000-10-14 10:31:34 +00:00
|
|
|
int snd_pcm_linear_open(snd_pcm_t **pcmp, char *name, int sformat, snd_pcm_t *slave, int close_slave);
|
|
|
|
|
int snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name, int sformat, snd_pcm_t *slave, int close_slave);
|
|
|
|
|
int snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name, int sformat, snd_pcm_t *slave, int close_slave);
|
|
|
|
|
int snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name, int sformat, snd_pcm_t *slave, int close_slave);
|
2000-09-24 09:57:26 +00:00
|
|
|
int snd_pcm_route_load_ttable(snd_config_t *tt, ttable_entry_t *ttable,
|
|
|
|
|
unsigned int tt_csize, unsigned int tt_ssize,
|
|
|
|
|
unsigned int *tt_cused, unsigned int *tt_sused,
|
|
|
|
|
int schannels);
|
2000-10-14 10:31:34 +00:00
|
|
|
int snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
|
2000-09-24 09:57:26 +00:00
|
|
|
int sformat, unsigned int schannels,
|
|
|
|
|
ttable_entry_t *ttable,
|
|
|
|
|
unsigned int tt_ssize,
|
|
|
|
|
unsigned int tt_cused, unsigned int tt_sused,
|
|
|
|
|
snd_pcm_t *slave, int close_slave);
|
2000-10-14 10:31:34 +00:00
|
|
|
int snd_pcm_rate_open(snd_pcm_t **pcmp, char *name, int sformat, int srate, snd_pcm_t *slave, int close_slave);
|
2000-09-24 09:57:26 +00:00
|
|
|
|