diff options
author | Glenn Kasten <gkasten@google.com> | 2012-01-27 15:25:25 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2012-01-27 16:01:44 -0800 |
commit | 23f7ad39ef52c0ac0a94934a71b6802c0a806b7f (patch) | |
tree | 0bfdcf0cd063baff963652e1cf1c9a365b406483 | |
parent | c1f63ddba76717db4f42ec04a06a0be12f22b2dc (diff) | |
download | frameworks_base-23f7ad39ef52c0ac0a94934a71b6802c0a806b7f.zip frameworks_base-23f7ad39ef52c0ac0a94934a71b6802c0a806b7f.tar.gz frameworks_base-23f7ad39ef52c0ac0a94934a71b6802c0a806b7f.tar.bz2 |
Use ToneGenerator::tone_type consistently
Also remove defaults in startToneCommand(), they're not needed and the
default for tone type was nonsense.
Change-Id: I70fa8cee4f3dbb8c66ceb3719c8d3d2f447f05b9
-rw-r--r-- | core/jni/android_media_ToneGenerator.cpp | 2 | ||||
-rw-r--r-- | include/media/ToneGenerator.h | 4 | ||||
-rw-r--r-- | media/libmedia/ToneGenerator.cpp | 10 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 3 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.h | 5 |
5 files changed, 13 insertions, 11 deletions
diff --git a/core/jni/android_media_ToneGenerator.cpp b/core/jni/android_media_ToneGenerator.cpp index 53a0501..26e82aa 100644 --- a/core/jni/android_media_ToneGenerator.cpp +++ b/core/jni/android_media_ToneGenerator.cpp @@ -48,7 +48,7 @@ static jboolean android_media_ToneGenerator_startTone(JNIEnv *env, jobject thiz, return false; } - return lpToneGen->startTone(toneType, durationMs); + return lpToneGen->startTone((ToneGenerator::tone_type) toneType, durationMs); } static void android_media_ToneGenerator_stopTone(JNIEnv *env, jobject thiz) { diff --git a/include/media/ToneGenerator.h b/include/media/ToneGenerator.h index 7d890bd..df0c97e 100644 --- a/include/media/ToneGenerator.h +++ b/include/media/ToneGenerator.h @@ -154,7 +154,7 @@ public: ToneGenerator(audio_stream_type_t streamType, float volume, bool threadCanCallJava = false); ~ToneGenerator(); - bool startTone(int toneType, int durationMs = -1); + bool startTone(tone_type toneType, int durationMs = -1); void stopTone(); bool isInited() { return (mState == TONE_IDLE)?false:true;} @@ -274,7 +274,7 @@ private: bool prepareWave(); unsigned int numWaves(unsigned int segmentIdx); void clearWaveGens(); - int getToneForRegion(int toneType); + tone_type getToneForRegion(tone_type toneType); // WaveGenerator generates a single sine wave class WaveGenerator { diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp index 5ceb912..549a412 100644 --- a/media/libmedia/ToneGenerator.cpp +++ b/media/libmedia/ToneGenerator.cpp @@ -751,7 +751,7 @@ const ToneGenerator::ToneDescriptor ToneGenerator::sToneDescriptors[] = { // Used by ToneGenerator::getToneForRegion() to convert user specified supervisory tone type // to actual tone for current region. -const unsigned char ToneGenerator::sToneMappingTable[NUM_REGIONS-1][NUM_SUP_TONES] = { +const unsigned char /*tone_type*/ ToneGenerator::sToneMappingTable[NUM_REGIONS-1][NUM_SUP_TONES] = { { // ANSI TONE_ANSI_DIAL, // TONE_SUP_DIAL TONE_ANSI_BUSY, // TONE_SUP_BUSY @@ -878,7 +878,7 @@ ToneGenerator::~ToneGenerator() { // none // //////////////////////////////////////////////////////////////////////////////// -bool ToneGenerator::startTone(int toneType, int durationMs) { +bool ToneGenerator::startTone(tone_type toneType, int durationMs) { bool lResult = false; status_t lStatus; @@ -1434,13 +1434,13 @@ void ToneGenerator::clearWaveGens() { // none // //////////////////////////////////////////////////////////////////////////////// -int ToneGenerator::getToneForRegion(int toneType) { - int regionTone; +ToneGenerator::tone_type ToneGenerator::getToneForRegion(tone_type toneType) { + tone_type regionTone; if (mRegion == CEPT || toneType < FIRST_SUP_TONE || toneType > LAST_SUP_TONE) { regionTone = toneType; } else { - regionTone = sToneMappingTable[mRegion][toneType - FIRST_SUP_TONE]; + regionTone = (tone_type) sToneMappingTable[mRegion][toneType - FIRST_SUP_TONE]; } ALOGV("getToneForRegion, tone %d, region %d, regionTone %d", toneType, mRegion, regionTone); diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index 28b1c89..30bbabd 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -786,7 +786,8 @@ status_t AudioPolicyService::AudioCommandThread::dump(int fd) return NO_ERROR; } -void AudioPolicyService::AudioCommandThread::startToneCommand(int type, audio_stream_type_t stream) +void AudioPolicyService::AudioCommandThread::startToneCommand(ToneGenerator::tone_type type, + audio_stream_type_t stream) { AudioCommand *command = new AudioCommand(); command->mCommand = START_TONE; diff --git a/services/audioflinger/AudioPolicyService.h b/services/audioflinger/AudioPolicyService.h index 9811670..65ff6ef 100644 --- a/services/audioflinger/AudioPolicyService.h +++ b/services/audioflinger/AudioPolicyService.h @@ -171,7 +171,8 @@ private: virtual bool threadLoop(); void exit(); - void startToneCommand(int type = 0, audio_stream_type_t stream = AUDIO_STREAM_VOICE_CALL); + void startToneCommand(ToneGenerator::tone_type type, + audio_stream_type_t stream); void stopToneCommand(); status_t volumeCommand(audio_stream_type_t stream, float volume, int output, int delayMs = 0); status_t parametersCommand(int ioHandle, const char *keyValuePairs, int delayMs = 0); @@ -198,7 +199,7 @@ private: class ToneData { public: - int mType; // tone type (START_TONE only) + ToneGenerator::tone_type mType; // tone type (START_TONE only) audio_stream_type_t mStream; // stream type (START_TONE only) }; |