robot36/pcm.c

44 wiersze
717 B
C
Czysty Zwykły widok Historia

#include <stdint.h>
#include <string.h>
2011-09-08 11:58:01 +00:00
#include <stdlib.h>
#include "pcm.h"
#include "alsa.h"
#include "wav.h"
void close_pcm(pcm_t *pcm)
{
pcm->close(pcm);
free(pcm);
}
void info_pcm(pcm_t *pcm)
{
pcm->info(pcm);
}
int rate_pcm(pcm_t *pcm)
{
return pcm->rate(pcm);
}
int channels_pcm(pcm_t *pcm)
{
return pcm->channels(pcm);
}
int read_pcm(pcm_t *pcm, short *buff, int frames)
{
return pcm->read(pcm, buff, frames);
}
int open_pcm(pcm_t **p, char *name)
{
if (strstr(name, "plughw:") == name || strstr(name, "hw:") == name || strstr(name, "default") == name)
return open_alsa(p, name);
if (strstr(name, ".wav") == (name + (strlen(name) - strlen(".wav"))))
return open_wav(p, name);
return 0;
}