small refactoring of voice engine status variables

This commit is contained in:
sonora 2019-11-03 08:46:32 +01:00
parent 3269cc13a6
commit 19a8d63ecc
3 changed files with 12 additions and 12 deletions

View file

@ -137,11 +137,11 @@ public class TestVoiceActivity extends OsmandActionBarActivity {
v += "\n \u25CF OsmAnd voice: " + osmandVoice; v += "\n \u25CF OsmAnd voice: " + osmandVoice;
v += "\n \u25CF OsmAnd voice language: " + osmandVoiceLang; v += "\n \u25CF OsmAnd voice language: " + osmandVoiceLang;
v += "\n \u25CF TTS voice language availability: " + (TTSCommandPlayerImpl.getTtsVoiceStatus().equals("") ? "-" : TTSCommandPlayerImpl.getTtsVoiceStatus()); v += "\n \u25CF TTS voice language availability: " + TTSCommandPlayerImpl.getTtsVoiceStatus();
v += "\n \u25CF TTS voice actually used: " + (TTSCommandPlayerImpl.getTtsVoiceUsed().equals("") ? "-" : TTSCommandPlayerImpl.getTtsVoiceUsed()); v += "\n \u25CF TTS voice actually used: " + TTSCommandPlayerImpl.getTtsVoiceUsed();
if (((OsmandApplication) getApplication()).getSettings().AUDIO_STREAM_GUIDANCE.get() == 0) { if (((OsmandApplication) getApplication()).getSettings().AUDIO_STREAM_GUIDANCE.get() == 0) {
v += "\n \u25CF BT SCO: " + (AbstractPrologCommandPlayer.btScoInit.equals("") ? "-" : AbstractPrologCommandPlayer.btScoInit); v += "\n \u25CF BT SCO: " + AbstractPrologCommandPlayer.btScoInit;
} else { } else {
v += "\n \u25CF BT SCO: The current app profile is not set to use 'Phone call audio'."; v += "\n \u25CF BT SCO: The current app profile is not set to use 'Phone call audio'.";
} }

View file

@ -326,7 +326,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat
//public static final int BT_SCO_DELAY = 1500; //public static final int BT_SCO_DELAY = 1500;
// This only needed for init debugging in TestVoiceActivity: // This only needed for init debugging in TestVoiceActivity:
public static String btScoInit = ""; public static String btScoInit = "-";
private synchronized boolean toggleBtSco(boolean on) { private synchronized boolean toggleBtSco(boolean on) {
// Hardy, 2016-07-03: Establish a low quality BT SCO (Synchronous Connection-Oriented) link to interrupt e.g. a car stereo FM radio // Hardy, 2016-07-03: Establish a low quality BT SCO (Synchronous Connection-Oriented) link to interrupt e.g. a car stereo FM radio

View file

@ -68,8 +68,8 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
// TODO: We could actually remove v102 support, I am done updating all existing 35 TTS voices to v103. Hardy, July 2016 // TODO: We could actually remove v102 support, I am done updating all existing 35 TTS voices to v103. Hardy, July 2016
private static final Log log = PlatformUtil.getLog(TTSCommandPlayerImpl.class); private static final Log log = PlatformUtil.getLog(TTSCommandPlayerImpl.class);
private static TextToSpeech mTts; private static TextToSpeech mTts;
private static String ttsVoiceStatus = ""; private static String ttsVoiceStatus = "-";
private static String ttsVoiceUsed = ""; private static String ttsVoiceUsed = "-";
private Context mTtsContext; private Context mTtsContext;
private HashMap<String, String> params = new HashMap<String, String>(); private HashMap<String, String> params = new HashMap<String, String>();
private VoiceRouter vrt; private VoiceRouter vrt;
@ -175,8 +175,8 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
} }
if (mTts == null) { if (mTts == null) {
mTtsContext = ctx; mTtsContext = ctx;
ttsVoiceStatus = ""; ttsVoiceStatus = "-";
ttsVoiceUsed = ""; ttsVoiceUsed = "-";
ttsRequests = 0; ttsRequests = 0;
final float speechRate = cSpeechRate; final float speechRate = cSpeechRate;
@ -220,7 +220,7 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
case TextToSpeech.LANG_AVAILABLE: case TextToSpeech.LANG_AVAILABLE:
ttsVoiceStatus = newLocale.getDisplayName() + ": LANG_AVAILABLE"; ttsVoiceStatus = newLocale.getDisplayName() + ": LANG_AVAILABLE";
case TextToSpeech.LANG_COUNTRY_AVAILABLE: case TextToSpeech.LANG_COUNTRY_AVAILABLE:
ttsVoiceStatus = "".equals(ttsVoiceStatus) ? newLocale.getDisplayName() + ": LANG_COUNTRY_AVAILABLE" : ttsVoiceStatus; ttsVoiceStatus = "-".equals(ttsVoiceStatus) ? newLocale.getDisplayName() + ": LANG_COUNTRY_AVAILABLE" : ttsVoiceStatus;
case TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE: case TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE:
try { try {
mTts.setLanguage(newLocale); mTts.setLanguage(newLocale);
@ -235,7 +235,7 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
if(speechRate != 1) { if(speechRate != 1) {
mTts.setSpeechRate(speechRate); mTts.setSpeechRate(speechRate);
} }
ttsVoiceStatus = "".equals(ttsVoiceStatus) ? newLocale.getDisplayName() + ": LANG_COUNTRY_VAR_AVAILABLE" : ttsVoiceStatus; ttsVoiceStatus = "-".equals(ttsVoiceStatus) ? newLocale.getDisplayName() + ": LANG_COUNTRY_VAR_AVAILABLE" : ttsVoiceStatus;
ttsVoiceUsed = getVoiceUsed(); ttsVoiceUsed = getVoiceUsed();
break; break;
case TextToSpeech.LANG_NOT_SUPPORTED: case TextToSpeech.LANG_NOT_SUPPORTED:
@ -320,8 +320,8 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
} }
abandonAudioFocus(); abandonAudioFocus();
mTtsContext = null; mTtsContext = null;
ttsVoiceStatus = ""; ttsVoiceStatus = "-";
ttsVoiceUsed = ""; ttsVoiceUsed = "-";
} }
@Override @Override