diff options
| author | Konstantin <const@const.me> | 2023-02-03 13:44:56 +0100 |
|---|---|---|
| committer | Konstantin <const@const.me> | 2023-02-03 13:44:56 +0100 |
| commit | c869213e639f523752f5b41706486b320f994d1b (patch) | |
| tree | 41a1818322199cd694aee3908e35ff36bd074c3d /Examples | |
| parent | 3cff5d22de44b21333390b442dafcc0ccde9e196 (diff) | |
Minor, C++ example
Diffstat (limited to 'Examples')
| -rw-r--r-- | Examples/main/main.cpp | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/Examples/main/main.cpp b/Examples/main/main.cpp index c3a659e..d76bfc8 100644 --- a/Examples/main/main.cpp +++ b/Examples/main/main.cpp @@ -20,12 +20,6 @@ static HRESULT loadWhisperModel( const wchar_t* path, iModel** pp ) namespace { - struct sPrintUserData - { - const whisper_params* params; - // const std::vector<std::vector<float>>* pcmf32s; - }; - // Terminal color map. 10 colors grouped in ranges [0.0, 0.1, ..., 0.9] // Lowest is red, middle is yellow, highest is green. static const std::array<const char*, 10> k_colors = @@ -64,7 +58,7 @@ namespace sTranscribeLength length; CHECK( results->getSize( length ) ); - const whisper_params& params = *( (sPrintUserData*)user_data )->params; + const whisper_params& params = *( (const whisper_params*)user_data ); // print the last n_new segments const uint32_t s0 = length.countSegments - n_new; @@ -241,15 +235,6 @@ int wmain( int argc, wchar_t* argv[] ) fprintf( stderr, "%s: WARNING: model is not multilingual, ignoring language and translation options\n", __func__ ); } } - - /* - fwprintf( stderr, L"%S: processing '%s' (%zu samples, %.1f sec), %d threads, %d processors, lang = %S, task = %S, timestamps = %d ...\n", - __func__, fname.c_str(), audio.pcmf32.size(), audio.seconds(), - params.n_threads, params.n_processors, - params.language.c_str(), - params.translate ? "translate" : "transcribe", - params.no_timestamps ? 0 : 1 ); - */ } // run the inference @@ -272,14 +257,12 @@ int wmain( int argc, wchar_t* argv[] ) wparams.max_len = params.output_wts && params.max_len == 0 ? 60 : params.max_len; wparams.setFlag( eFullParamsFlags::SpeedupAudio, params.speed_up ); - // sPrintUserData user_data = { ¶ms, &audio.pcmf32s }; - sPrintUserData user_data = { ¶ms }; - // this callback is called on each new segment + // This callback is called on each new segment if( !wparams.flag( eFullParamsFlags::PrintRealtime ) ) { wparams.new_segment_callback = &newSegmentCallback; - wparams.new_segment_callback_user_data = &user_data; + wparams.new_segment_callback_user_data = ¶ms; } // example for abort mechanism |
