Compare commits

...

1 Commits

Author SHA1 Message Date
Dave Horton 83a2d1d730 modify cache folder name and various fixes from testing tts streaming (#50) 2024-04-18 11:28:17 -04:00
6 changed files with 70 additions and 65 deletions
+6 -1
View File
@@ -59,7 +59,7 @@ extern "C" {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
fullDirPath = std::string(baseDir) + "jambonz-tts-cache-files"; fullDirPath = std::string(baseDir) + "tts-cache-files";
// Create the directory with read, write, and execute permissions for everyone // Create the directory with read, write, and execute permissions for everyone
mode_t oldMask = umask(0); mode_t oldMask = umask(0);
@@ -179,6 +179,7 @@ extern "C" {
speechConfig->SetEndpointId(a->endpointId); speechConfig->SetEndpointId(a->endpointId);
} }
try {
auto speechSynthesizer = SpeechSynthesizer::FromConfig(speechConfig); auto speechSynthesizer = SpeechSynthesizer::FromConfig(speechConfig);
speechSynthesizer->SynthesisStarted += [a](const SpeechSynthesisEventArgs& e) { speechSynthesizer->SynthesisStarted += [a](const SpeechSynthesisEventArgs& e) {
@@ -245,6 +246,10 @@ extern "C" {
std::thread(start_synthesis, speechSynthesizer, text, a).detach(); std::thread(start_synthesis, speechSynthesizer, text, a).detach();
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "azure_speech_feed_tts sent synthesize request\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "azure_speech_feed_tts sent synthesize request\n");
} catch (const std::exception& e) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mod_azure_tts: Exception: %s\n", e.what());
return SWITCH_STATUS_FALSE;
}
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
+2 -2
View File
@@ -385,7 +385,7 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, ConnInfo_t *conn) {
auto d = conn->deepgram; auto d = conn->deepgram;
CircularBuffer_t *cBuffer = (CircularBuffer_t *) d->circularBuffer; CircularBuffer_t *cBuffer = (CircularBuffer_t *) d->circularBuffer;
if (conn->flushed) { if (conn->flushed || cBuffer == nullptr) {
/* this will abort the transfer */ /* this will abort the transfer */
return 0; return 0;
} }
@@ -641,7 +641,7 @@ extern "C" {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
fullDirPath = std::string(baseDir) + "jambonz-tts-cache-files"; fullDirPath = std::string(baseDir) + "tts-cache-files";
// Create the directory with read, write, and execute permissions for everyone // Create the directory with read, write, and execute permissions for everyone
mode_t oldMask = umask(0); mode_t oldMask = umask(0);
+2 -2
View File
@@ -445,7 +445,7 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, ConnInfo_t *conn) {
CircularBuffer_t *cBuffer = (CircularBuffer_t *) el->circularBuffer; CircularBuffer_t *cBuffer = (CircularBuffer_t *) el->circularBuffer;
std::vector<uint16_t> pcm_data; std::vector<uint16_t> pcm_data;
if (conn->flushed) { if (conn->flushed || cBuffer == nullptr) {
/* this will abort the transfer */ /* this will abort the transfer */
return 0; return 0;
} }
@@ -688,7 +688,7 @@ extern "C" {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
fullDirPath = std::string(baseDir) + "jambonz-tts-cache-files"; fullDirPath = std::string(baseDir) + "tts-cache-files";
// Create the directory with read, write, and execute permissions for everyone // Create the directory with read, write, and execute permissions for everyone
mode_t oldMask = umask(0); mode_t oldMask = umask(0);
+2 -2
View File
@@ -436,7 +436,7 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, ConnInfo_t *conn) {
CircularBuffer_t *cBuffer = (CircularBuffer_t *) p->circularBuffer; CircularBuffer_t *cBuffer = (CircularBuffer_t *) p->circularBuffer;
std::vector<uint16_t> pcm_data; std::vector<uint16_t> pcm_data;
if (conn->flushed) { if (conn->flushed || cBuffer == nullptr) {
/* this will abort the transfer */ /* this will abort the transfer */
return 0; return 0;
} }
@@ -648,7 +648,7 @@ extern "C" {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
fullDirPath = std::string(baseDir) + "jambonz-tts-cache-files"; fullDirPath = std::string(baseDir) + "tts-cache-files";
// Create the directory with read, write, and execute permissions for everyone // Create the directory with read, write, and execute permissions for everyone
mode_t oldMask = umask(0); mode_t oldMask = umask(0);
+2 -2
View File
@@ -386,7 +386,7 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, ConnInfo_t *conn) {
auto d = conn->rimelabs; auto d = conn->rimelabs;
CircularBuffer_t *cBuffer = (CircularBuffer_t *) d->circularBuffer; CircularBuffer_t *cBuffer = (CircularBuffer_t *) d->circularBuffer;
if (conn->flushed) { if (conn->flushed || cBuffer == nullptr) {
/* this will abort the transfer */ /* this will abort the transfer */
return 0; return 0;
} }
@@ -626,7 +626,7 @@ extern "C" {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
fullDirPath = std::string(baseDir) + "jambonz-tts-cache-files"; fullDirPath = std::string(baseDir) + "tts-cache-files";
// Create the directory with read, write, and execute permissions for everyone // Create the directory with read, write, and execute permissions for everyone
mode_t oldMask = umask(0); mode_t oldMask = umask(0);
+2 -2
View File
@@ -436,7 +436,7 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, ConnInfo_t *conn) {
CircularBuffer_t *cBuffer = (CircularBuffer_t *) w->circularBuffer; CircularBuffer_t *cBuffer = (CircularBuffer_t *) w->circularBuffer;
std::vector<uint16_t> pcm_data; std::vector<uint16_t> pcm_data;
if (conn->flushed) { if (conn->flushed || cBuffer == nullptr) {
/* this will abort the transfer */ /* this will abort the transfer */
return 0; return 0;
} }
@@ -671,7 +671,7 @@ extern "C" {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
fullDirPath = std::string(baseDir) + "jambonz-tts-cache-files"; fullDirPath = std::string(baseDir) + "tts-cache-files";
// Create the directory with read, write, and execute permissions for everyone // Create the directory with read, write, and execute permissions for everyone
mode_t oldMask = umask(0); mode_t oldMask = umask(0);