From 82a44c108aab5c764b4010995eab861851f1ab02 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sat, 13 Oct 2012 20:28:51 +0200 Subject: Set output route when mode changed Signed-off-by: Paul Kocialkowski --- audio_hw.c | 12 ++++++++++-- audio_hw.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/audio_hw.c b/audio_hw.c index 144706d..abe6b76 100644 --- a/audio_hw.c +++ b/audio_hw.c @@ -125,9 +125,17 @@ static int audio_hw_set_mode(struct audio_hw_device *dev, int mode) device = (struct tinyalsa_audio_device *) dev; - device->mode = mode; + if(mode != device->mode) { + device->mode = mode; - // TODO: If mode changed, change routing + if(device->stream_out != NULL) { + audio_out_set_route(device->stream_out, + device->stream_out->device_current); + // TODO: audio_input_set_route + } + } + + device->mode = mode; return 0; } diff --git a/audio_hw.h b/audio_hw.h index 84750b5..dc5d395 100644 --- a/audio_hw.h +++ b/audio_hw.h @@ -79,6 +79,9 @@ int audio_hw_open_output_stream(struct audio_hw_device *dev, void audio_hw_close_output_stream(struct audio_hw_device *dev, struct audio_stream_out *stream); +int audio_out_set_route(struct tinyalsa_audio_stream_out *stream_out, + audio_devices_t device); + int audio_hw_open_input_stream(struct audio_hw_device *dev, uint32_t devices, int *format, uint32_t *channels, uint32_t *sample_rate, audio_in_acoustics_t acoustics, struct audio_stream_in **stream_in); -- cgit v1.1