From 516ba5a225b2c533e24e3c29c8e2eee48e677d44 Mon Sep 17 00:00:00 2001 From: Branden Archer Date: Sun, 27 Dec 2015 20:34:02 -0500 Subject: [PATCH] Allow volume control to adjust playback volume The AudioTrack for playing audio from the child device was sending audio to the voice call stream. It is more appropriate to use the music stream. In addition, suggest that the activity control the music stream's volume with the hardware controls. --- src/protect/babymonitor/ListenActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/protect/babymonitor/ListenActivity.java b/src/protect/babymonitor/ListenActivity.java index f2e5b9e..0e1b66e 100644 --- a/src/protect/babymonitor/ListenActivity.java +++ b/src/protect/babymonitor/ListenActivity.java @@ -50,7 +50,7 @@ public class ListenActivity extends Activity int audioEncoding = AudioFormat.ENCODING_PCM_16BIT; int bufferSize = AudioTrack.getMinBufferSize(frequency, channelConfiguration, audioEncoding); - final AudioTrack audioTrack = new AudioTrack(AudioManager.STREAM_VOICE_CALL, + final AudioTrack audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, frequency, channelConfiguration, audioEncoding, @@ -63,6 +63,8 @@ public class ListenActivity extends Activity Thread playThread = new Thread(audioPlayer); playThread.start(); + setVolumeControlStream(AudioManager.STREAM_MUSIC); + InputStream is = socket.getInputStream(); int read = 0;