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