diff --git a/media/libaudioclient/ToneGenerator.cpp b/media/libaudioclient/ToneGenerator.cpp index ea856af2ea..435cfa265f 100644 --- a/media/libaudioclient/ToneGenerator.cpp +++ b/media/libaudioclient/ToneGenerator.cpp @@ -787,6 +787,18 @@ const ToneGenerator::ToneDescriptor ToneGenerator::sToneDescriptors[] = { { .duration = 0 , .waveFreq = { 0 }, 0, 0}}, .repeatCnt = ToneGenerator::TONEGEN_INF, .repeatSegment = 0 }, // TONE_AUSTRALIA_CONGESTION + { .segments = { { .duration = 750, .waveFreq = { 425, 0 }, 0, 0 }, + { .duration = 750, .waveFreq = { 0 }, 0, 0 }, + { .duration = 0 , .waveFreq = { 0 }, 0, 0}}, + .repeatCnt = ToneGenerator::TONEGEN_INF, + .repeatSegment = 0 }, // TONE_SG_BUSY + { .segments = { { .duration = 400, .waveFreq = { 401, 425, 449, 0 }, 0, 0 }, + { .duration = 200, .waveFreq = { 0 }, 0, 0 }, + { .duration = 400, .waveFreq = { 401, 425, 449, 0 }, 0, 0 }, + { .duration = 2000, .waveFreq = { 0 }, 0, 0 }, + { .duration = 0 , .waveFreq = { 0 }, 0, 0}}, + .repeatCnt = ToneGenerator::TONEGEN_INF, + .repeatSegment = 0 }, // TONE_SG_RINGTONE }; // Used by ToneGenerator::getToneForRegion() to convert user specified supervisory tone type @@ -831,6 +843,16 @@ const unsigned char /*tone_type*/ ToneGenerator::sToneMappingTable[NUM_REGIONS-1 TONE_SUP_ERROR, // TONE_SUP_ERROR TONE_AUSTRALIA_CALL_WAITING,// TONE_SUP_CALL_WAITING TONE_AUSTRALIA_RINGTONE // TONE_SUP_RINGTONE + }, + { // SINGAPORE + TONE_SUP_DIAL, // TONE_SUP_DIAL + TONE_SG_BUSY, // TONE_SUP_BUSY + TONE_SUP_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_SG_RINGTONE // TONE_SUP_RINGTONE } }; @@ -889,6 +911,8 @@ ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool mRegion = GB; } else if (strstr(value, "au") != NULL) { mRegion = AUSTRALIA; + } else if (strstr(value, "sg") != NULL) { + mRegion = SINGAPORE; } else { mRegion = CEPT; } diff --git a/media/libaudioclient/include/media/ToneGenerator.h b/media/libaudioclient/include/media/ToneGenerator.h index 3112edb337..d362c6862c 100644 --- a/media/libaudioclient/include/media/ToneGenerator.h +++ b/media/libaudioclient/include/media/ToneGenerator.h @@ -177,7 +177,7 @@ private: // Region specific tones. - // These supervisory tones are different depending on the region (USA/CANADA, JAPAN, rest of the world). + // These supervisory tones are different depending on the region (USA/CANADA, JAPAN, Singapore, rest of the world). // When a tone in the range [FIRST_SUP_TONE, LAST_SUP_TONE] is requested, the region is determined // from system property gsm.operator.iso-country and the proper tone descriptor is selected with the // help of sToneMappingTable[] @@ -203,6 +203,9 @@ private: TONE_AUSTRALIA_BUSY, // Busy tone: 425 Hz repeated in a 0.375s on, 0.375s off pattern. TONE_AUSTRALIA_CALL_WAITING,// Call waiting tone: 425Hz tone repeated in a 0.2s on, 0.2s off, 0.2s on, 4.4s off pattern. TONE_AUSTRALIA_CONGESTION, // Congestion tone: 425Hz tone repeated in a 0.375s on, 0.375s off pattern + // SINGAPORE Supervisory tones + TONE_SG_BUSY, // Busy tone: 425 Hz, 750ms ON, 750ms OFF... + TONE_SG_RINGTONE, // Ring Tone: 425 Hz tone modulated with 24 Hz, 400ms ON, 200ms OFF, 400ms ON, 2s OFF... NUM_ALTERNATE_TONES }; @@ -211,6 +214,7 @@ private: JAPAN, GB, AUSTRALIA, + SINGAPORE, CEPT, NUM_REGIONS };