Home | History | Annotate | Download | only in alsa
      1 /**
      2  * \file include/pcm_plugin.h
      3  * \brief Common PCM plugin code
      4  * \author Abramo Bagnara <abramo (at) alsa-project.org>
      5  * \author Jaroslav Kysela <perex (at) perex.cz>
      6  * \date 2000-2001
      7  *
      8  * Application interface library for the ALSA driver.
      9  * See the \ref pcm_plugins page for more details.
     10  *
     11  * \warning Using of contents of this header file might be dangerous
     12  *	    in the sense of compatibility reasons. The contents might be
     13  *	    freely changed in future.
     14  */
     15 /*
     16  *   This library is free software; you can redistribute it and/or modify
     17  *   it under the terms of the GNU Lesser General Public License as
     18  *   published by the Free Software Foundation; either version 2.1 of
     19  *   the License, or (at your option) any later version.
     20  *
     21  *   This program is distributed in the hope that it will be useful,
     22  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     23  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     24  *   GNU Lesser General Public License for more details.
     25  *
     26  *   You should have received a copy of the GNU Lesser General Public
     27  *   License along with this library; if not, write to the Free Software
     28  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
     29  *
     30  */
     31 
     32 #ifndef __ALSA_PCM_PLUGIN_H
     33 
     34 /**
     35  * \defgroup PCM_Plugins PCM Plugins
     36  * \ingroup PCM
     37  * See the \ref pcm_plugins page for more details.
     38  * \{
     39  */
     40 
     41 #define SND_PCM_PLUGIN_RATE_MIN 4000	/**< minimal rate for the rate plugin */
     42 #define SND_PCM_PLUGIN_RATE_MAX 192000	/**< maximal rate for the rate plugin */
     43 
     44 /* ROUTE_FLOAT should be set to 0 for machines without FP unit - like iPAQ */
     45 #ifdef HAVE_SOFT_FLOAT
     46 #define SND_PCM_PLUGIN_ROUTE_FLOAT 0	   /**< use integers for route plugin */
     47 #else
     48 #define SND_PCM_PLUGIN_ROUTE_FLOAT 1	   /**< use floats for route plugin */
     49 #endif
     50 
     51 #define SND_PCM_PLUGIN_ROUTE_RESOLUTION 16 /**< integer resolution for route plugin */
     52 
     53 #if SND_PCM_PLUGIN_ROUTE_FLOAT
     54 /** route ttable entry type */
     55 typedef float snd_pcm_route_ttable_entry_t;
     56 #define SND_PCM_PLUGIN_ROUTE_HALF 0.5	/**< half value */
     57 #define SND_PCM_PLUGIN_ROUTE_FULL 1.0	/**< full value */
     58 #else
     59 /** route ttable entry type */
     60 typedef int snd_pcm_route_ttable_entry_t;
     61 #define SND_PCM_PLUGIN_ROUTE_HALF (SND_PCM_PLUGIN_ROUTE_RESOLUTION / 2)	/**< half value */
     62 #define SND_PCM_PLUGIN_ROUTE_FULL SND_PCM_PLUGIN_ROUTE_RESOLUTION	/**< full value */
     63 #endif
     64 
     65 /*
     66  *  Hardware plugin
     67  */
     68 int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
     69 		    int card, int device, int subdevice,
     70 		    snd_pcm_stream_t stream, int mode,
     71 		    int mmap_emulation, int sync_ptr_ioctl);
     72 int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
     73 		     snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
     74 		     snd_pcm_stream_t stream, int mode);
     75 
     76 /*
     77  *  Copy plugin
     78  */
     79 int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
     80 		      snd_pcm_t *slave, int close_slave);
     81 int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
     82 		       snd_config_t *root, snd_config_t *conf,
     83                        snd_pcm_stream_t stream, int mode);
     84 
     85 /*
     86  *  Linear conversion plugin
     87  */
     88 int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
     89 			snd_pcm_format_t sformat, snd_pcm_t *slave,
     90 			int close_slave);
     91 int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
     92 			 snd_config_t *root, snd_config_t *conf,
     93 			 snd_pcm_stream_t stream, int mode);
     94 
     95 /*
     96  *  Linear<->Float conversion plugin
     97  */
     98 int snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
     99 			snd_pcm_format_t sformat, snd_pcm_t *slave,
    100 			int close_slave);
    101 int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
    102 			 snd_config_t *root, snd_config_t *conf,
    103 			 snd_pcm_stream_t stream, int mode);
    104 
    105 /*
    106  *  Linear<->mu-Law conversion plugin
    107  */
    108 int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
    109 		       snd_pcm_format_t sformat, snd_pcm_t *slave,
    110 		       int close_slave);
    111 int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
    112 			snd_config_t *root, snd_config_t *conf,
    113                         snd_pcm_stream_t stream, int mode);
    114 
    115 /*
    116  *  Linear<->a-Law conversion plugin
    117  */
    118 int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
    119 		      snd_pcm_format_t sformat, snd_pcm_t *slave,
    120 		      int close_slave);
    121 int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
    122 		       snd_config_t *root, snd_config_t *conf,
    123 		       snd_pcm_stream_t stream, int mode);
    124 
    125 /*
    126  *  Linear<->Ima-ADPCM conversion plugin
    127  */
    128 int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
    129 		       snd_pcm_format_t sformat, snd_pcm_t *slave,
    130 		       int close_slave);
    131 int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
    132 			snd_config_t *root, snd_config_t *conf,
    133 			snd_pcm_stream_t stream, int mode);
    134 
    135 /*
    136  *  Route plugin for linear formats
    137  */
    138 int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *ttable,
    139 			      unsigned int tt_csize, unsigned int tt_ssize,
    140 			      unsigned int *tt_cused, unsigned int *tt_sused,
    141 			      int schannels);
    142 int snd_pcm_route_determine_ttable(snd_config_t *tt,
    143 				   unsigned int *tt_csize,
    144 				   unsigned int *tt_ssize);
    145 int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
    146 		       snd_pcm_format_t sformat, int schannels,
    147 		       snd_pcm_route_ttable_entry_t *ttable,
    148 		       unsigned int tt_ssize,
    149 		       unsigned int tt_cused, unsigned int tt_sused,
    150 		       snd_pcm_t *slave, int close_slave);
    151 int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
    152 			snd_config_t *root, snd_config_t *conf,
    153 			snd_pcm_stream_t stream, int mode);
    154 
    155 /*
    156  *  Rate plugin for linear formats
    157  */
    158 int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
    159 		      snd_pcm_format_t sformat, unsigned int srate,
    160 		      const snd_config_t *converter,
    161 		      snd_pcm_t *slave, int close_slave);
    162 int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
    163 		       snd_config_t *root, snd_config_t *conf,
    164 		       snd_pcm_stream_t stream, int mode);
    165 
    166 /*
    167  *  Hooks plugin
    168  */
    169 int snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
    170 		       snd_pcm_t *slave, int close_slave);
    171 int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
    172 			snd_config_t *root, snd_config_t *conf,
    173 			snd_pcm_stream_t stream, int mode);
    174 
    175 /*
    176  *  LADSPA plugin
    177  */
    178 int snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
    179 			const char *ladspa_path,
    180 			unsigned int channels,
    181 			snd_config_t *ladspa_pplugins,
    182 			snd_config_t *ladspa_cplugins,
    183 			snd_pcm_t *slave, int close_slave);
    184 int _snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
    185 			 snd_config_t *root, snd_config_t *conf,
    186 			 snd_pcm_stream_t stream, int mode);
    187 
    188 /*
    189  *  Jack plugin
    190  */
    191 int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
    192 					snd_config_t *playback_conf,
    193 					snd_config_t *capture_conf,
    194 		      snd_pcm_stream_t stream, int mode);
    195 int _snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
    196                        snd_config_t *root, snd_config_t *conf,
    197                        snd_pcm_stream_t stream, int mode);
    198 
    199 
    200 /** \} */
    201 
    202 #endif /* __ALSA_PCM_PLUGIN_H */
    203