enable audio logging if env AZURE_AUDIO_LOGGING is set

This commit is contained in:
Dave Horton
2024-06-06 14:07:07 -04:00
parent 2a94213668
commit e0ea13d83b

View File

@@ -15,6 +15,8 @@ typedef boost::circular_buffer<uint16_t> CircularBuffer_t;
using namespace Microsoft::CognitiveServices::Speech;
static const char* audioLogging = std::getenv("AZURE_AUDIO_LOGGING");
static std::string fullDirPath;
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);
}
if (audioLogging) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "azure_speech_feed_tts enabling audio logging\n");
speechConfig->EnableAudioLogging();
}
try {
auto speechSynthesizer = SpeechSynthesizer::FromConfig(speechConfig);