Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 3rdparty/voice_text/launch/voice_text.launch
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<machine if="$(arg use_machine)" name="localhost" address="localhost" />

<arg name="sound_play_respawn" default="true" />
<arg name="license_path" default="/usr/vt/sayaka/M16/data-common/verify/verification.txt" />
<arg name="db_path" default="/usr/vt/sayaka/M16" />
<arg name="license_path" default="" />
<arg name="db_path" default="" />
<arg name="enable_custom_engine_info" default="false" />
<arg name="device" default="" />

Expand Down
Empty file modified 3rdparty/voice_text/scripts/text2wave.py
100644 → 100755
Empty file.
40 changes: 30 additions & 10 deletions 3rdparty/voice_text/src/vt_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ VTHandler::VTHandler(const std::string license_path, const std::string db_path,
const std::string iso_code,
const std::string vendor,
const int sampling_rate){
glob_t sdk_old_gbuf_{}, sdk_new_gbuf_{}, api_gbuf_{};
glob_t sdk_old_gbuf_{}, sdk_new_gbuf_{}, api_gbuf_{}, db_path_gbuf_{}, license_path_gbuf_{};
std::string lib_file_;
char *dl_err_, *db_path_char_, *license_path_char_;
bool sym_status_;
Expand Down Expand Up @@ -79,18 +79,38 @@ VTHandler::VTHandler(const std::string license_path, const std::string db_path,

// Initialize VT Handler
// db_path is for backward compatibility
db_path_char_ = (char*)calloc(std::strlen(db_path.c_str())+1, sizeof(char));
std::strcpy(db_path_char_, db_path.c_str());
std::string resolved_db_path = db_path;
if (resolved_db_path.empty()) {
if (glob("/usr/vt/*/*", GLOB_ONLYDIR, nullptr, &db_path_gbuf_) == 0 &&
db_path_gbuf_.gl_pathc > 0) {
resolved_db_path = db_path_gbuf_.gl_pathv[0];
}
globfree(&db_path_gbuf_);
if (resolved_db_path.empty()) {
ROS_FATAL("[VT] Could not resolve db_path under /usr/vt/*/*");
return;
}
}
db_path_char_ = static_cast<char*>(calloc(resolved_db_path.size() + 1, sizeof(char)));
std::strcpy(db_path_char_, resolved_db_path.c_str());
ROS_INFO("Loading db at: %s", db_path_char_);

// Load license file
license_path_char_ = NULL;
if(!license_path.empty()){
license_path_char_ = (char*)calloc(std::strlen(license_path.c_str())+1, sizeof(char));
std::strcpy(license_path_char_, license_path.c_str());
}else{
ROS_FATAL("Please set license file");
return;
std::string resolved_license_path = license_path;
if (resolved_license_path.empty()) {
if (glob("/usr/vt/*/*/data-common/verify/verification.txt", 0, nullptr, &license_path_gbuf_) == 0 &&
license_path_gbuf_.gl_pathc > 0) {
resolved_license_path = license_path_gbuf_.gl_pathv[0]; // copy later
}
globfree(&license_path_gbuf_);
if (resolved_license_path.empty()) {
ROS_FATAL("[VT] Could not find license file under /usr/vt/*/*/data-common/verify/");
return;
}
}
license_path_char_ = static_cast<char*>(calloc(resolved_license_path.size() + 1, sizeof(char)));
std::strcpy(license_path_char_, resolved_license_path.c_str());
ROS_INFO("Resolved license file: %s", license_path_char_);

// Load license file
if(this->vt_type == VT_SDK){
Expand Down
Loading