diff options
Diffstat (limited to 'media/libmedia/ToneGenerator.cpp')
-rw-r--r-- | media/libmedia/ToneGenerator.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp index 6da5348..af75e0f 100644 --- a/media/libmedia/ToneGenerator.cpp +++ b/media/libmedia/ToneGenerator.cpp @@ -698,7 +698,11 @@ const ToneGenerator::ToneDescriptor ToneGenerator::sToneDescriptors[] = { { .segments = { { .duration = 0, .waveFreq = { 0 }, 0, 0 }}, .repeatCnt = 0, .repeatSegment = 0 }, // TONE_CDMA_SIGNAL_OFF - + { .segments = { { .duration = 15000, .waveFreq = { 0 }, 0, 0 }, + { .duration = 500, .waveFreq = { 450, 0 }, 0, 0 }, + { .duration = 0 , .waveFreq = { 0 }, 0, 0}}, + .repeatCnt = ToneGenerator::TONEGEN_INF, + .repeatSegment = 0 }, // TONE_HOLD_RECALL { .segments = { { .duration = ToneGenerator::TONEGEN_INF, .waveFreq = { 350, 440, 0 }, 0, 0 }, { .duration = 0 , .waveFreq = { 0 }, 0, 0}}, .repeatCnt = ToneGenerator::TONEGEN_INF, @@ -804,6 +808,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 +1056,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 @@ -1580,7 +1590,8 @@ void ToneGenerator::WaveGenerator::getSamples(short *outBuffer, } long dec = lAmplitude/count; // loop generation - while (count--) { + while (count) { + count--; Sample = ((lA1 * lS1) >> S_Q14) - lS2; // shift delay lS2 = lS1; @@ -1591,7 +1602,8 @@ void ToneGenerator::WaveGenerator::getSamples(short *outBuffer, } } else { // loop generation - while (count--) { + while (count) { + count--; Sample = ((lA1 * lS1) >> S_Q14) - lS2; // shift delay lS2 = lS1; |