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

Commit fcd22e43 authored by Eric Laurent's avatar Eric Laurent
Browse files

ToneGenerator: add tones for Malaysia

Add definitions for region specific supervisory tones for Malaysia:
    - Congestion Tone : 425 Hz, [500ms on, 250ms off] ...
    - Ringing / RBT : 425 Hz, [400ms on, 200ms off, 400ms on, 2000ms off] ...

Bug: 324498671
Test: atest ToneGeneratorTest
Change-Id: I54e9d73969ad0ce59f2ece54dbb07aa0562c715c
parent 3585aa2e
Loading
Loading
Loading
Loading
+24 −0
Original line number Original line Diff line number Diff line
@@ -872,6 +872,18 @@ const ToneGenerator::ToneDescriptor ToneGenerator::sToneDescriptors[] = {
                        { .duration = 0 , .waveFreq = { 0 }, 0, 0}},
                        { .duration = 0 , .waveFreq = { 0 }, 0, 0}},
          .repeatCnt = 3,
          .repeatCnt = 3,
          .repeatSegment = 0 },                              // TONE_NZ_CALL_WAITING
          .repeatSegment = 0 },                              // TONE_NZ_CALL_WAITING
        { .segments = { { .duration = 500, .waveFreq = { 425, 0 }, 0, 0 },
                        { .duration = 250, .waveFreq = { 0 }, 0, 0 },
                        { .duration = 0 , .waveFreq = { 0 }, 0, 0}},
          .repeatCnt = ToneGenerator::TONEGEN_INF,
          .repeatSegment = 0 },                             // TONE_MY_CONGESTION
        { .segments = { { .duration = 400, .waveFreq = { 425, 0 }, 0, 0 },
                        { .duration = 200, .waveFreq = { 0 }, 0, 0 },
                        { .duration = 400, .waveFreq = { 425, 0 }, 0, 0 },
                        { .duration = 2000, .waveFreq = { 0 }, 0, 0},
                        { .duration = 0, .waveFreq = { 0 }, 0, 0}},
          .repeatCnt = ToneGenerator::TONEGEN_INF,
          .repeatSegment = 0 }                              // TONE_MY_RINGTONE
};
};


// Used by ToneGenerator::getToneForRegion() to convert user specified supervisory tone type
// Used by ToneGenerator::getToneForRegion() to convert user specified supervisory tone type
@@ -976,6 +988,16 @@ const unsigned char /*tone_type*/ ToneGenerator::sToneMappingTable[NUM_REGIONS-1
            TONE_SUP_ERROR,               // TONE_SUP_ERROR
            TONE_SUP_ERROR,               // TONE_SUP_ERROR
            TONE_NZ_CALL_WAITING,         // TONE_SUP_CALL_WAITING
            TONE_NZ_CALL_WAITING,         // TONE_SUP_CALL_WAITING
            TONE_GB_RINGTONE              // TONE_SUP_RINGTONE
            TONE_GB_RINGTONE              // TONE_SUP_RINGTONE
        },
        {   // MALAYSIA
            TONE_SUP_DIAL,                // TONE_SUP_DIAL
            TONE_SUP_BUSY,                // TONE_SUP_BUSY
            TONE_MY_CONGESTION,           // TONE_SUP_CONGESTION
            TONE_SUP_RADIO_ACK,           // TONE_SUP_RADIO_ACK
            TONE_SUP_RADIO_NOTAVAIL,      // TONE_SUP_RADIO_NOTAVAIL
            TONE_SUP_ERROR,               // TONE_SUP_ERROR
            TONE_SUP_CALL_WAITING,        // TONE_SUP_CALL_WAITING
            TONE_MY_RINGTONE              // TONE_SUP_RINGTONE
        }
        }
};
};


@@ -1055,6 +1077,8 @@ ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool
        mRegion = TAIWAN;
        mRegion = TAIWAN;
    } else if (strstr(value, "nz") != NULL) {
    } else if (strstr(value, "nz") != NULL) {
        mRegion = NZ;
        mRegion = NZ;
    } else if (strstr(value, "my") != NULL) {
        mRegion = MY;
    } else {
    } else {
        mRegion = CEPT;
        mRegion = CEPT;
    }
    }
+6 −2
Original line number Original line Diff line number Diff line
@@ -230,6 +230,9 @@ private:
        // NEW ZEALAND supervisory tones
        // NEW ZEALAND supervisory tones
        TONE_NZ_CALL_WAITING,       // Call waiting tone: 400 Hz,  0.2s ON, 3s OFF,
        TONE_NZ_CALL_WAITING,       // Call waiting tone: 400 Hz,  0.2s ON, 3s OFF,
                                    //        0.2s ON, 3s OFF, 0.2s ON, 3s OFF, 0.2s ON
                                    //        0.2s ON, 3s OFF, 0.2s ON, 3s OFF, 0.2s ON
        // MALAYSIA supervisory tones
        TONE_MY_CONGESTION,         // Congestion tone: 425 Hz, 500ms ON, 250ms OFF...
        TONE_MY_RINGTONE,           // Ring tone: 425 Hz, 400ms ON 200ms OFF 400ms ON 2s OFF..
        NUM_ALTERNATE_TONES
        NUM_ALTERNATE_TONES
    };
    };


@@ -244,6 +247,7 @@ private:
        INDIA,
        INDIA,
        TAIWAN,
        TAIWAN,
        NZ,
        NZ,
        MY,
        CEPT,
        CEPT,
        NUM_REGIONS
        NUM_REGIONS
    };
    };