summaryrefslogtreecommitdiffstats
path: root/audio_out.c
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2012-10-13 17:16:33 +0200
committerPaul Kocialkowski <contact@paulk.fr>2012-10-13 17:16:33 +0200
commit6a2edf8f42c9fe4533d583938362f5c183fcd887 (patch)
tree7bb575190a84dc8c127639303cb235ad17dea66a /audio_out.c
parentd1f7c8de5559d02b1649d9081bd3a30a291bf99c (diff)
downloadhardware_tinyalsa-audio-6a2edf8f42c9fe4533d583938362f5c183fcd887.tar.gz
hardware_tinyalsa-audio-6a2edf8f42c9fe4533d583938362f5c183fcd887.tar.bz2
hardware_tinyalsa-audio-6a2edf8f42c9fe4533d583938362f5c183fcd887.zip
Bindings for Yamaha-MC1N2-Audio library
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
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;