diff --git a/bindings/go/whisper.go b/bindings/go/whisper.go index 78ca07d..d47f7f7 100644 --- a/bindings/go/whisper.go +++ b/bindings/go/whisper.go @@ -20,7 +20,7 @@ extern bool callEncoderBegin(void* user_data); // Text segment callback // Called on every newly generated text segment // Use the whisper_full_...() functions to obtain the text segments -static void whisper_new_segment_cb(struct whisper_context* ctx, int n_new, void* user_data) { +static void whisper_new_segment_cb(struct whisper_context* ctx, struct whisper_state* state, int n_new, void* user_data) { if(user_data != NULL && ctx != NULL) { callNewSegment(user_data, n_new); } @@ -29,7 +29,7 @@ static void whisper_new_segment_cb(struct whisper_context* ctx, int n_new, void* // Encoder begin callback // If not NULL, called before the encoder starts // If it returns false, the computation is aborted -static bool whisper_encoder_begin_cb(struct whisper_context* ctx, void* user_data) { +static bool whisper_encoder_begin_cb(struct whisper_context* ctx, struct whisper_state* state, void* user_data) { if(user_data != NULL && ctx != NULL) { return callEncoderBegin(user_data); } diff --git a/bindings/ruby/ext/ruby_whisper.cpp b/bindings/ruby/ext/ruby_whisper.cpp index e7416ba..82027d4 100644 --- a/bindings/ruby/ext/ruby_whisper.cpp +++ b/bindings/ruby/ext/ruby_whisper.cpp @@ -199,7 +199,7 @@ static VALUE ruby_whisper_transcribe(int argc, VALUE *argv, VALUE self) { { static bool is_aborted = false; // NOTE: this should be atomic to avoid data race - rwp->params.encoder_begin_callback = [](struct whisper_context * /*ctx*/, void * user_data) { + rwp->params.encoder_begin_callback = [](struct whisper_context * /*ctx*/, struct whisper_state * /*state*/, void * user_data) { bool is_aborted = *(bool*)user_data; return !is_aborted; }; diff --git a/examples/addon.node/addon.cpp b/examples/addon.node/addon.cpp index 2ef895f..8252327 100644 --- a/examples/addon.node/addon.cpp +++ b/examples/addon.node/addon.cpp @@ -72,7 +72,7 @@ int timestamp_to_sample(int64_t t, int n_samples) { return std::max(0, std::min((int) n_samples - 1, (int) ((t*WHISPER_SAMPLE_RATE)/100))); } -void whisper_print_segment_callback(struct whisper_context * ctx, int n_new, void * user_data) { +void whisper_print_segment_callback(struct whisper_context * ctx, struct whisper_state * state, int n_new, void * user_data) { const auto & params = *((whisper_print_user_data *) user_data)->params; const auto & pcmf32s = *((whisper_print_user_data *) user_data)->pcmf32s; @@ -260,7 +260,7 @@ int run(whisper_params ¶ms, std::vector> &result) { { static bool is_aborted = false; // NOTE: this should be atomic to avoid data race - wparams.encoder_begin_callback = [](struct whisper_context * /*ctx*/, void * user_data) { + wparams.encoder_begin_callback = [](struct whisper_context * /*ctx*/, struct whisper_state * /*state*/, void * user_data) { bool is_aborted = *(bool*)user_data; return !is_aborted; }; diff --git a/examples/main/main.cpp b/examples/main/main.cpp index b8366b7..daf353a 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -193,7 +193,7 @@ struct whisper_print_user_data { const std::vector> * pcmf32s; }; -void whisper_print_segment_callback(struct whisper_context * ctx, int n_new, void * user_data) { +void whisper_print_segment_callback(struct whisper_context * ctx, struct whisper_state * state, int n_new, void * user_data) { const auto & params = *((whisper_print_user_data *) user_data)->params; const auto & pcmf32s = *((whisper_print_user_data *) user_data)->pcmf32s; @@ -607,7 +607,7 @@ int main(int argc, char ** argv) { { static bool is_aborted = false; // NOTE: this should be atomic to avoid data race - wparams.encoder_begin_callback = [](struct whisper_context * /*ctx*/, void * user_data) { + wparams.encoder_begin_callback = [](struct whisper_context * /*ctx*/, struct whisper_state * /*state*/, void * user_data) { bool is_aborted = *(bool*)user_data; return !is_aborted; };