if (!PhoneNumberUtils.is12Key(c)) {
Log.e(LOG_TAG,
"playDtmfTone called with invalid character '" + c + "'");
} else {
// Play the tone for the far side
PhoneApp.getInstance().phone.sendDtmf(c);
// Don't play these locally for now.
if (false) {
// Play the tone locally
int index = c - '0";
if (c >= '0" && c <= '9") {
index = c - '0";
} else if (c == '*") {
index = 10;
} else if (c == '#") {
index = 11;
}
try {
if (DBG) {
Log.d(LOG_TAG, "[SoundEffect] playDtmfTone for " + c + ", tone index=" + index);
}
if (sDtmfTone == null) {
sDtmfTone = new MediaPlayer();
}
sDtmfTone.reset();
sDtmfTone.setDataSource(sDtmfToneFilePath[index]);
sDtmfTone.setAudioStreamType(
android.media.AudioManager.STREAM_RING);
sDtmfTone.prepare();
sDtmfTone.seekTo(0);
sDtmfTone.start();
} catch (Exception ex) {
if (DBG) Log.e(LOG_TAG,
"[SoundEffect] playDtmfTone caught " + ex);
}
}
}