Skip to content

Commit

Permalink
Try to fix NVDAControlEx crashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
m1maker committed Feb 21, 2025
1 parent 62bf743 commit aacdc87
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions SRC/NVDA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool NVDA::GetActive() {
bool NVDA::Speak(const char* text, bool interrupt) {
if (!GetActive())return false;
if (interrupt) {
nvda_active() == 0 ? nvdaController_cancelSpeech() : nvda_cancel_speech();
nvda_active() == -1 ? nvdaController_cancelSpeech() : nvda_cancel_speech();
}
if (nvda_active() == 0)
return !enable_spelling ? nvda_speak(text, this->symbolLevel) == 0 : nvda_speak_spelling(text, "", this->use_character_descriptions) == 0;
Expand All @@ -70,7 +70,7 @@ bool NVDA::Speak(const char* text, bool interrupt) {
bool NVDA::SpeakSsml(const char* ssml, bool interrupt) {
if (!GetActive())return false;
if (interrupt)
nvda_active() == 0 ? nvdaController_cancelSpeech() : nvda_cancel_speech();
nvda_active() == -1 ? nvdaController_cancelSpeech() : nvda_cancel_speech();
if (nvda_active() == 0)
return nvda_speak_ssml(ssml, this->symbolLevel) == 0;
std::string text_str(ssml);
Expand Down Expand Up @@ -127,7 +127,7 @@ bool NVDA::Braille(const char* text) {
}
bool NVDA::StopSpeech() {
if (!GetActive())return false;
return nvda_active() == 0 ? nvdaController_cancelSpeech() == 0 : nvda_cancel_speech() == 0;
return nvda_active() == -1 ? nvdaController_cancelSpeech() == 0 : nvda_cancel_speech() == 0;
}
bool NVDA::PauseSpeech() {
if (!GetActive())return false;
Expand All @@ -148,5 +148,5 @@ bool NVDA::PauseSpeech() {
return true;
}
bool NVDA::ResumeSpeech() {
return nvda_active() == 0 ? PauseSpeech() : nvda_pause_speech(false);
return nvda_active() == -1 ? PauseSpeech() : nvda_pause_speech(false);
}

0 comments on commit aacdc87

Please sign in to comment.