diff options
| author | Konstantin <const@const.me> | 2023-02-14 20:54:54 +0100 |
|---|---|---|
| committer | Konstantin <const@const.me> | 2023-02-14 20:54:54 +0100 |
| commit | e736f91c0361099a85619a2b83340c98e2be04e6 (patch) | |
| tree | a11588d17a7cb72ad7c8e34dca49f3bb8ae1207d /Examples/main/main.cpp | |
| parent | 2ec5b19e8384538bcd9e440ad99aba9e172f8924 (diff) | |
When token timestamps are requested, disabled streaming in C++ CLI example
Diffstat (limited to 'Examples/main/main.cpp')
| -rw-r--r-- | Examples/main/main.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/Examples/main/main.cpp b/Examples/main/main.cpp index 7706b8f..28dcada 100644 --- a/Examples/main/main.cpp +++ b/Examples/main/main.cpp @@ -277,16 +277,22 @@ int wmain( int argc, wchar_t* argv[] ) wparams.encoder_begin_callback_user_data = &is_aborted; } -#if STREAM_AUDIO - ComLight::CComPtr<iAudioReader> reader; - CHECK( mf->openAudioFile( fname.c_str(), params.diarize, &reader ) ); - sProgressSink progressSink{ nullptr, nullptr }; - hr = context->runStreamed( wparams, progressSink, reader ); -#else - ComLight::CComPtr<iAudioBuffer> buffer; - CHECK( mf->loadAudioFile( fname.c_str(), params.diarize, &buffer ) ); - hr = context->runFull( wparams, buffer ); -#endif + if( STREAM_AUDIO && !wparams.flag( eFullParamsFlags::TokenTimestamps ) ) + { + ComLight::CComPtr<iAudioReader> reader; + CHECK( mf->openAudioFile( fname.c_str(), params.diarize, &reader ) ); + sProgressSink progressSink{ nullptr, nullptr }; + hr = context->runStreamed( wparams, progressSink, reader ); + } + else + { + // Token-level timestamps feature is not currently implemented when streaming the audio + // When these timestamps are requested, fall back to buffered mode. + ComLight::CComPtr<iAudioBuffer> buffer; + CHECK( mf->loadAudioFile( fname.c_str(), params.diarize, &buffer ) ); + hr = context->runFull( wparams, buffer ); + } + if( FAILED( hr ) ) { printError( "Unable to process audio", hr ); |
