diff options
author | Haynes Mathew George <hgeorge@codeaurora.org> | 2014-11-13 20:17:26 -0800 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:24:19 -0600 |
commit | 502b3cb43aba4eae5928647515fec58a3ed0c70c (patch) | |
tree | ccf9063a85730fcff174223582dce440c8d94946 /media/libmedia/ToneGenerator.cpp | |
parent | 34205d1f5f98b01ece198f16ad55ff80ece31558 (diff) | |
download | frameworks_av-502b3cb43aba4eae5928647515fec58a3ed0c70c.zip frameworks_av-502b3cb43aba4eae5928647515fec58a3ed0c70c.tar.gz frameworks_av-502b3cb43aba4eae5928647515fec58a3ed0c70c.tar.bz2 |
ToneGenerator: Limit tones to 48k
DTMF tones are played at the hardware module sampling rate.
Until now, this rate was limited to 48k. Tones sound not too
pleasant at higher rates (like 96k and 192k). Ergo, limit the rate
to 48k.
Change-Id: I7fbc3185d988628ce3ee478076a322857221dece
Diffstat (limited to 'media/libmedia/ToneGenerator.cpp')
-rw-r--r-- | media/libmedia/ToneGenerator.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp index 6da5348..53b229e 100644 --- a/media/libmedia/ToneGenerator.cpp +++ b/media/libmedia/ToneGenerator.cpp @@ -804,6 +804,12 @@ ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool ALOGE("Unable to marshal AudioFlinger"); return; } + + if (mSamplingRate > 48000) { + ALOGW("mSamplingRate %d . limit to 48k", mSamplingRate); + mSamplingRate = 48000; + } + mThreadCanCallJava = threadCanCallJava; mStreamType = streamType; mVolume = volume; @@ -1046,7 +1052,7 @@ bool ToneGenerator::initAudioTrack() { ALOGV("Create Track: %p", mpAudioTrack.get()); mpAudioTrack->set(mStreamType, - 0, // sampleRate + mSamplingRate, AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_OUT_MONO, 0, // frameCount |