diff --git a/src/Makevars b/src/Makevars index d9cfea9..25fb24e 100644 --- a/src/Makevars +++ b/src/Makevars @@ -8,8 +8,8 @@ SOURCES = whisper_cpp/ggml/src/ggml-quants.c whisper_cpp/ggml/src/ggml-backend.c OBJECTS = whisper_cpp/ggml/src/ggml-quants.o whisper_cpp/ggml/src/ggml-backend.o whisper_cpp/ggml/src/ggml-alloc.o whisper_cpp/ggml/src/ggml-aarch64.o whisper_cpp/ggml/src/ggml.o ## utils from examples -SOURCES += whisper_cpp/examples/grammar-parser.cpp -OBJECTS += whisper_cpp/examples/grammar-parser.o +SOURCES += whisper_cpp/examples/grammar-parser.cpp whisper_cpp/examples/common.cpp +OBJECTS += whisper_cpp/examples/grammar-parser.o whisper_cpp/examples/common.o ## whisper source code + R wrapper SOURCES += whisper_cpp/src/whisper.cpp rcpp_whisper_utils.cpp rcpp_whisper.cpp RcppExports.cpp diff --git a/src/rcpp_whisper.cpp b/src/rcpp_whisper.cpp index da70df8..17fdd3f 100644 --- a/src/rcpp_whisper.cpp +++ b/src/rcpp_whisper.cpp @@ -17,27 +17,6 @@ #pragma warning(disable: 4244 4267) // possible loss of data #endif -// 500 -> 00:05.000 -// 6000 -> 01:00.000 -std::string to_timestamp(int64_t t, bool comma) { - int64_t msec = t * 10; - int64_t hr = msec / (1000 * 60 * 60); - msec = msec - hr * (1000 * 60 * 60); - int64_t min = msec / (1000 * 60); - msec = msec - min * (1000 * 60); - int64_t sec = msec / 1000; - msec = msec - sec * 1000; - - char buf[32]; - snprintf(buf, sizeof(buf), "%02d:%02d:%02d%s%03d", (int) hr, (int) min, (int) sec, comma ? "," : ".", (int) msec); - - return std::string(buf); -} - -int timestamp_to_sample(int64_t t, int n_samples, int whisper_sample_rate) { - return std::max(0, std::min((int) n_samples - 1, (int) ((t*whisper_sample_rate)/100))); -} - // command-line parameters struct whisper_params { int32_t n_threads = std::min(4, (int32_t) std::thread::hardware_concurrency());