From 599ca05559f93c608f00f2ad13846bf27ba82648 Mon Sep 17 00:00:00 2001 From: Tomoharu Kasahara Date: Mon, 23 Oct 2017 09:54:36 +0900 Subject: [PATCH] Support Ireland specific supervisory tone Ringtone and call waiting tone for Ireland are not following ITU-T specification. This patch implements them as per ITU-T specification. Bug: 68294204 Test: Build and test ringback tone for Ireland Change-Id: I2cf3f425aec47b9dbc6ecf2ffb3aef44ca4f783c --- media/libaudioclient/ToneGenerator.cpp | 26 +++++++++++++++++++ .../include/media/ToneGenerator.h | 4 +++ 2 files changed, 30 insertions(+) diff --git a/media/libaudioclient/ToneGenerator.cpp b/media/libaudioclient/ToneGenerator.cpp index fa1d253499..cfb5be6904 100644 --- a/media/libaudioclient/ToneGenerator.cpp +++ b/media/libaudioclient/ToneGenerator.cpp @@ -811,6 +811,20 @@ const ToneGenerator::ToneDescriptor ToneGenerator::sToneDescriptors[] = { { .duration = 0 , .waveFreq = { 0 }, 0, 0}}, .repeatCnt = ToneGenerator::TONEGEN_INF, .repeatSegment = 0 }, // TONE_HK_RINGTONE + { .segments = { { .duration = 400, .waveFreq = { 400, 450, 0 }, 0, 0 }, + { .duration = 200, .waveFreq = { 0 }, 0, 0 }, + { .duration = 400, .waveFreq = { 400, 450, 0 }, 0, 0 }, + { .duration = 2000, .waveFreq = { 0 }, 0, 0}, + { .duration = 0, .waveFreq = { 0 }, 0, 0}}, + .repeatCnt = ToneGenerator::TONEGEN_INF, + .repeatSegment = 0 }, // TONE_IE_RINGTONE + { .segments = { { .duration = 180, .waveFreq = { 425, 0 }, 0, 0 }, + { .duration = 200, .waveFreq = { 0 }, 0, 0 }, + { .duration = 200, .waveFreq = { 425, 0 }, 0, 0 }, + { .duration = 4500, .waveFreq = { 0 }, 0, 0 }, + { .duration = 0 , .waveFreq = { 0 }, 0, 0}}, + .repeatCnt = ToneGenerator::TONEGEN_INF, + .repeatSegment = 0 }, // TONE_IE_CALL_WAITING }; // Used by ToneGenerator::getToneForRegion() to convert user specified supervisory tone type @@ -875,6 +889,16 @@ const unsigned char /*tone_type*/ ToneGenerator::sToneMappingTable[NUM_REGIONS-1 TONE_SUP_ERROR, // TONE_SUP_ERROR TONE_SUP_CALL_WAITING, // TONE_SUP_CALL_WAITING TONE_HK_RINGTONE // TONE_SUP_RINGTONE + }, + { // IRELAND + TONE_SUP_DIAL, // TONE_SUP_DIAL + TONE_SUP_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_IE_CALL_WAITING, // TONE_SUP_CALL_WAITING + TONE_IE_RINGTONE // TONE_SUP_RINGTONE } }; @@ -944,6 +968,8 @@ ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool mRegion = SINGAPORE; } else if (strstr(value, "hk") != NULL) { mRegion = HONGKONG; + } else if (strstr(value, "ie") != NULL) { + mRegion = IRELAND; } else { mRegion = CEPT; } diff --git a/media/libaudioclient/include/media/ToneGenerator.h b/media/libaudioclient/include/media/ToneGenerator.h index 97bc825fa6..247703fe95 100644 --- a/media/libaudioclient/include/media/ToneGenerator.h +++ b/media/libaudioclient/include/media/ToneGenerator.h @@ -209,6 +209,9 @@ private: // HONG KONG Supervisory tones TONE_HK_BUSY, // Busy tone: 480 Hz + 620 Hz, 500ms ON, 500ms OFF... TONE_HK_RINGTONE, // Ring Tone: 440 Hz + 480 Hz repeated with pattern 0,4s on, 0,2s off, 0,4s on and 3s off. + // IRELAND Supervisory tones + TONE_IE_RINGTONE, // Ring Tone: A 400Hz + 450Hz tone repeated in a 0.4s on, 0.2s off, 0.4s on, 2.0s off pattern. + TONE_IE_CALL_WAITING, // Call waiting tone: 425Hz tone repeated in a 0.18s on, 0.2s off, 0.2s on, 4.5s off pattern. NUM_ALTERNATE_TONES }; @@ -219,6 +222,7 @@ private: AUSTRALIA, SINGAPORE, HONGKONG, + IRELAND, CEPT, NUM_REGIONS };