enable audio logging if env AZURE_AUDIO_LOGGING is set

This commit is contained in:
Dave Horton committed 2024-06-06 14:07:07 -04:00
1 parent 2a94213668
commit e0ea13d83b
1 file changed
+7
+7
View File
@@ -15,6 +15,8 @@ typedef boost::circular_buffer<uint16_t> CircularBuffer_t;
using namespace Microsoft::CognitiveServices::Speech; using namespace Microsoft::CognitiveServices::Speech;
static const char* audioLogging = std::getenv("AZURE_AUDIO_LOGGING");
static std::string fullDirPath; static std::string fullDirPath;
static void start_synthesis(std::shared_ptr<SpeechSynthesizer> speechSynthesizer, const char* text, azure_t* a) { static void start_synthesis(std::shared_ptr<SpeechSynthesizer> speechSynthesizer, const char* text, azure_t* a) {
@@ -168,6 +170,11 @@ extern "C" {
speechConfig->SetEndpointId(a->endpointId); speechConfig->SetEndpointId(a->endpointId);
} }
if (audioLogging) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "azure_speech_feed_tts enabling audio logging\n");
speechConfig->EnableAudioLogging();
}
try { try {
auto speechSynthesizer = SpeechSynthesizer::FromConfig(speechConfig); auto speechSynthesizer = SpeechSynthesizer::FromConfig(speechConfig);