FM: create Audio Track using Builder
Change-Id: Ide8deed32b844d384375c64a8f347fc26d474eb2
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 28da6fd..7fd41b1 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -389,10 +389,16 @@
mAudioRecord = new AudioRecord(MediaRecorder.AudioSource.RADIO_TUNER,
AUDIO_SAMPLE_RATE, AUDIO_CHANNEL_CONFIG,
AUDIO_ENCODING_FORMAT, FM_RECORD_BUF_SIZE);
- mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC,
- AUDIO_SAMPLE_RATE, AUDIO_CHANNEL_CONFIG,
- AUDIO_ENCODING_FORMAT, FM_RECORD_BUF_SIZE,
- AudioTrack.MODE_STREAM);
+
+ mAudioTrack = new AudioTrack.Builder()
+ .setAudioFormat(new AudioFormat.Builder()
+ .setEncoding(AUDIO_ENCODING_FORMAT)
+ .setSampleRate(AUDIO_SAMPLE_RATE)
+ .setChannelIndexMask(AUDIO_CHANNEL_CONFIG)
+ .build())
+ .setBufferSizeInBytes(FM_RECORD_BUF_SIZE)
+ .build();
+
if (mMuted)
mAudioTrack.setVolume(0.0f);
}