Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23f7ad39 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

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
parent c1f63ddb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+2 −2
Original line number Diff line number Diff line
@@ -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 {
+5 −5
Original line number Diff line number Diff line
@@ -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);
+2 −1
Original line number Diff line number Diff line
@@ -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;
+3 −2
Original line number Diff line number Diff line
@@ -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)
        };