simpleaudio: backend_device support
This commit is contained in:
parent
c2bb5c6205
commit
5ee6a23c42
|
@ -98,6 +98,7 @@ sa_alsa_close( simpleaudio *sa )
|
|||
static int
|
||||
sa_alsa_open_stream(
|
||||
simpleaudio *sa,
|
||||
const char *backend_device,
|
||||
sa_direction_t sa_stream_direction,
|
||||
sa_format_t sa_format,
|
||||
unsigned int rate, unsigned int channels,
|
||||
|
@ -106,8 +107,11 @@ sa_alsa_open_stream(
|
|||
snd_pcm_t *pcm;
|
||||
int error;
|
||||
|
||||
if ( ! backend_device )
|
||||
backend_device = "default";
|
||||
|
||||
error = snd_pcm_open(&pcm,
|
||||
"plughw:0,0",
|
||||
backend_device,
|
||||
sa_stream_direction == SA_STREAM_RECORD ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK,
|
||||
0 /*mode*/);
|
||||
if (error) {
|
||||
|
|
|
@ -83,6 +83,7 @@ sa_benchmark_close( simpleaudio *sa )
|
|||
static int
|
||||
sa_benchmark_open_stream(
|
||||
simpleaudio *sa,
|
||||
const char *backend_device,
|
||||
sa_direction_t sa_stream_direction,
|
||||
sa_format_t sa_format,
|
||||
unsigned int rate, unsigned int channels,
|
||||
|
|
|
@ -82,6 +82,7 @@ sa_pulse_close( simpleaudio *sa )
|
|||
static int
|
||||
sa_pulse_open_stream(
|
||||
simpleaudio *sa,
|
||||
const char *backend_device,
|
||||
sa_direction_t sa_stream_direction,
|
||||
sa_format_t sa_format,
|
||||
unsigned int rate, unsigned int channels,
|
||||
|
|
|
@ -160,12 +160,13 @@ sndfile_format_from_path( const char *path )
|
|||
static int
|
||||
sa_sndfile_open_stream(
|
||||
simpleaudio *sa,
|
||||
const char *backend_device,
|
||||
sa_direction_t sa_stream_direction,
|
||||
sa_format_t sa_format,
|
||||
unsigned int rate, unsigned int channels,
|
||||
char *app_name, char *stream_name )
|
||||
{
|
||||
const char *path = stream_name;
|
||||
const char *path = backend_device;
|
||||
|
||||
int sf_format;
|
||||
switch ( sa->format ) {
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
simpleaudio *
|
||||
simpleaudio_open_stream(
|
||||
sa_backend_t sa_backend,
|
||||
const char *backend_device,
|
||||
sa_direction_t sa_stream_direction,
|
||||
sa_format_t sa_format,
|
||||
unsigned int rate, unsigned int channels,
|
||||
|
@ -106,7 +107,7 @@ simpleaudio_open_stream(
|
|||
}
|
||||
|
||||
int ok = sa->backend->simpleaudio_open_stream(sa,
|
||||
sa_stream_direction, sa_format,
|
||||
backend_device, sa_stream_direction, sa_format,
|
||||
rate, channels, app_name, stream_name);
|
||||
|
||||
if ( ok ) {
|
||||
|
|
|
@ -55,6 +55,7 @@ typedef enum {
|
|||
simpleaudio *
|
||||
simpleaudio_open_stream(
|
||||
sa_backend_t sa_backend,
|
||||
const char *backend_device,
|
||||
sa_direction_t sa_stream_direction,
|
||||
sa_format_t sa_format,
|
||||
unsigned int rate, unsigned int channels,
|
||||
|
|
|
@ -43,6 +43,7 @@ struct simpleaudio_backend {
|
|||
int /* boolean 'ok' value */
|
||||
(*simpleaudio_open_stream)(
|
||||
simpleaudio * sa,
|
||||
const char *backend_device,
|
||||
sa_direction_t sa_stream_direction,
|
||||
sa_format_t sa_format,
|
||||
unsigned int rate, unsigned int channels,
|
||||
|
|
Loading…
Reference in New Issue