Cleaned all hw_info. Removed snd_pcm_hw_{info,params}_rules* and changed strategy to allow the same functionality. Cleaned names tables. Added informative failure

This commit is contained in:
Abramo Bagnara 2000-11-29 08:32:36 +00:00
parent ae549cf739
commit b9916fd7fe
15 changed files with 1098 additions and 2107 deletions

View file

@ -28,7 +28,6 @@ typedef struct {
int (*init)(snd_pcm_t *pcm);
int shmid;
size_t appl_ptr, hw_ptr;
unsigned int saccess_mask;
} snd_pcm_plugin_t;
int snd_pcm_plugin_close(snd_pcm_t *pcm);
@ -65,7 +64,7 @@ int get_index(int src_format, int dst_format);
int put_index(int src_format, int dst_format);
int conv_index(int src_format, int dst_format);
#define SND_PCM_FMTBIT_LINEAR (SND_PCM_FMTBIT_S8 |SND_PCM_FMTBIT_U8 | \
#define SND_PCM_FMTBIT_LINEAR (SND_PCM_FMTBIT_S8 |SND_PCM_FMTBIT_U8 | \
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 | \
@ -75,21 +74,34 @@ int conv_index(int src_format, int dst_format);
extern snd_pcm_fast_ops_t snd_pcm_plugin_fast_ops;
static inline ssize_t muldiv(ssize_t a, ssize_t b, ssize_t d, ssize_t corr)
{
double v = ((double) a * b + corr) / d;
if (v > LONG_MAX)
return LONG_MAX;
if (v < LONG_MIN)
return LONG_MIN;
return v;
}
static inline ssize_t muldiv_down(ssize_t a, ssize_t b, ssize_t d)
{
return (int64_t) (a * b) / d;
return muldiv(a, b, d, 0);
}
static inline ssize_t muldiv_up(ssize_t a, ssize_t b, ssize_t d)
{
return (int64_t) (a * b + (d - 1)) / d;
return muldiv(a, b, d, d - 1);
}
static inline ssize_t muldiv_near(ssize_t a, ssize_t b, ssize_t d)
{
return (int64_t) (a * b + (d / 2)) / d;
return muldiv(a, b, d, d / 2);
}
#define RATE_MIN 4000
#define RATE_MAX 192000
#define ROUTE_PLUGIN_FLOAT 1
#define ROUTE_PLUGIN_RESOLUTION 16