summaryrefslogtreecommitdiffstats
path: root/audio_out.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio_out.c')
-rw-r--r--audio_out.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/audio_out.c b/audio_out.c
index 69394c8..47f4dfa 100644
--- a/audio_out.c
+++ b/audio_out.c
@@ -28,6 +28,10 @@
#include <cutils/str_parms.h>
#include <cutils/log.h>
+#ifdef YAMAHA_MC1N2_AUDIO
+#include <yamaha-mc1n2-audio.h>
+#endif
+
#define EFFECT_UUID_NULL EFFECT_UUID_NULL_OUT
#define EFFECT_UUID_NULL_STR EFFECT_UUID_NULL_STR_OUT
#include "audio_hw.h"
@@ -188,6 +192,7 @@ static int audio_out_set_format(struct audio_stream *stream, int format)
static int audio_out_standby(struct audio_stream *stream)
{
struct tinyalsa_audio_stream_out *stream_out;
+ int rc;
LOGD("%s(%p)", __func__, stream);
@@ -199,6 +204,15 @@ static int audio_out_standby(struct audio_stream *stream)
if(stream_out->pcm != NULL)
audio_out_pcm_close(stream_out);
+#ifdef YAMAHA_MC1N2_AUDIO
+ if(!stream_out->standby) {
+ rc = yamaha_mc1n2_audio_routine_route_stop(stream_out->device->mc1n2_pdata);
+ if(rc < 0) {
+ LOGE("Failed to set Yamaha-MC1N2-Audio route");
+ }
+ }
+#endif
+
stream_out->standby = 1;
return 0;
@@ -302,6 +316,13 @@ static ssize_t audio_out_write(struct audio_stream_out *stream,
stream_out = (struct tinyalsa_audio_stream_out *) stream;
if(stream_out->standby) {
+#ifdef YAMAHA_MC1N2_AUDIO
+ rc = yamaha_mc1n2_audio_routine_route_start(stream_out->device->mc1n2_pdata);
+ if(rc < 0) {
+ LOGE("Failed to set Yamaha-MC1N2-Audio route");
+ }
+#endif
+
rc = audio_out_pcm_open(stream_out);
if(rc < 0) {
LOGE("Unable to open pcm device");
@@ -429,6 +450,13 @@ int audio_hw_open_output_stream(struct audio_hw_device *dev,
goto error_stream;
}
+#ifdef YAMAHA_MC1N2_AUDIO
+ rc = yamaha_mc1n2_audio_routine_postopen(tinyalsa_audio_device->mc1n2_pdata);
+ if(rc < 0) {
+ LOGE("Failed to init Yamaha-MC1N2-Audio route");
+ }
+#endif
+
audio_out_pcm_close(tinyalsa_audio_stream_out);
tinyalsa_audio_stream_out->standby = 1;