Skip to content

Commit

Permalink
Drop SSML support for now, as it is broken and incomplete anyway.
Browse files Browse the repository at this point in the history
  • Loading branch information
a11cf0 committed Oct 16, 2024
1 parent da0ae00 commit 4afa320
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 55 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ endif()
project ("SRAL")
add_library(${PROJECT_NAME}_obj OBJECT)
target_sources(${PROJECT_NAME}_obj PRIVATE
"SRC/SRAL.cpp" "SRC/Engine.h" "SRC/Util.h" "SRC/Util.cpp")
"SRC/SRAL.cpp" "SRC/Engine.h")
target_sources(${PROJECT_NAME}_obj PUBLIC
FILE_SET HEADERS
BASE_DIRS "${INCLUDES}"
Expand Down
15 changes: 1 addition & 14 deletions SRC/NVDA.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "Encoding.h"
#include "NVDA.h"
#include "Util.h"
#include<Windows.h>

bool NVDA::Initialize() {
Expand All @@ -10,7 +9,6 @@ bool NVDA::Initialize() {
nvdaController_brailleMessage = (NVDAController_brailleMessage)GetProcAddress(lib, "nvdaController_brailleMessage");
nvdaController_cancelSpeech = (NVDAController_cancelSpeech)GetProcAddress(lib, "nvdaController_cancelSpeech");
nvdaController_testIfRunning = (NVDAController_testIfRunning)GetProcAddress(lib, "nvdaController_testIfRunning");
nvdaController_speakSsml = (NVDAController_speakSsml)GetProcAddress(lib, "nvdaController_speakSsml");
return true;
}
bool NVDA::Uninitialize() {
Expand All @@ -20,7 +18,6 @@ bool NVDA::Uninitialize() {
nvdaController_brailleMessage = nullptr;
nvdaController_cancelSpeech = nullptr;
nvdaController_testIfRunning = nullptr;
nvdaController_speakSsml = nullptr;
return true;
}
bool NVDA::GetActive() {
Expand All @@ -33,19 +30,9 @@ bool NVDA::Speak(const char* text, bool interrupt) {
if (interrupt)
nvdaController_cancelSpeech();
std::string text_str(text);
if (!IsSsml(text_str))AddSsml(text_str);

std::wstring out;
UnicodeConvert(text_str, out);
error_status_t result = nvdaController_speakSsml(out.c_str(), -1, 0, true);
if (result == 0)return true;
else if (result == 1717) {
RemoveSsml(text_str);
UnicodeConvert(text_str, out);
result = nvdaController_speakText(out.c_str());
return result == 0;
}
return false;
return nvdaController_speakText(out.c_str()) == 0;
}
bool NVDA::Braille(const char* text) {
if (!GetActive())return false;
Expand Down
2 changes: 1 addition & 1 deletion SRC/NVDA.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class NVDA : public Engine {
bool Initialize()override;
bool Uninitialize()override;
int GetFeatures()override {
return SUPPORTS_SPEECH | SUPPORTS_BRAILLE | SUPPORTS_PAUSE_SPEECH | SUPPORTS_SSML;
return SUPPORTS_SPEECH | SUPPORTS_BRAILLE | SUPPORTS_PAUSE_SPEECH;
}
void SetVolume(uint64_t)override { return; }
uint64_t GetVolume()override { return 0; }
Expand Down
2 changes: 0 additions & 2 deletions SRC/SAPI.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#ifdef _WIN32
#include "SAPI.h"
#include "Util.h"
#include <cstdio>
#include<string>
#include<thread>
Expand Down Expand Up @@ -132,7 +131,6 @@ bool SAPI::Speak(const char* text, bool interrupt) {
this->Initialize();
}
std::string text_str(text);
if (!IsSsml(text_str))AddSsml(text_str);
unsigned long bytes;
char* audio_ptr = blastspeak_speak_to_memory(instance, &bytes, text_str.c_str());
if (audio_ptr == nullptr)
Expand Down
5 changes: 1 addition & 4 deletions SRC/SRAL.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#define SRAL_EXPORT
#include "../Include/SRAL.h"
#include "Engine.h"
#include "Util.h"
#if defined(_WIN32)
#define UNICODE
#include "NVDA.h"
Expand Down Expand Up @@ -367,9 +366,7 @@ extern "C" SRAL_API bool SRAL_Output(const char* text, bool interrupt) {
if (g_currentEngine == nullptr)return false;
speech_engine_update();
const bool speech = SRAL_Speak(text, interrupt);
std::string braille_str(text);
if (IsSsml(braille_str))RemoveSsml(braille_str);
const bool braille = SRAL_Braille(braille_str.c_str());
const bool braille = SRAL_Braille(text);
return speech || braille;
}
extern "C" SRAL_API bool SRAL_StopSpeech(void) {
Expand Down
26 changes: 0 additions & 26 deletions SRC/Util.cpp

This file was deleted.

7 changes: 0 additions & 7 deletions SRC/Util.h

This file was deleted.

0 comments on commit 4afa320

Please sign in to comment.