mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2024-12-21 05:33:06 +00:00
whisper : free backends + fix compile warning
This commit is contained in:
parent
dcf9511dbb
commit
12030358ee
@ -181,7 +181,7 @@ private:
|
|||||||
// It is assumed that PCM data is normalized to a range from -1 to 1
|
// It is assumed that PCM data is normalized to a range from -1 to 1
|
||||||
bool write_audio(const float * data, size_t length) {
|
bool write_audio(const float * data, size_t length) {
|
||||||
for (size_t i = 0; i < length; ++i) {
|
for (size_t i = 0; i < length; ++i) {
|
||||||
const auto intSample = static_cast<const int16_t>(data[i] * 32767);
|
const int16_t intSample = data[i] * 32767;
|
||||||
file.write(reinterpret_cast<const char *>(&intSample), sizeof(int16_t));
|
file.write(reinterpret_cast<const char *>(&intSample), sizeof(int16_t));
|
||||||
dataSize += sizeof(int16_t);
|
dataSize += sizeof(int16_t);
|
||||||
}
|
}
|
||||||
|
@ -3276,6 +3276,12 @@ void whisper_free(struct whisper_context * ctx) {
|
|||||||
|
|
||||||
whisper_free_state(ctx->state);
|
whisper_free_state(ctx->state);
|
||||||
|
|
||||||
|
ggml_backend_free(ctx->backend_cpu);
|
||||||
|
|
||||||
|
if (ctx->backend_gpu) {
|
||||||
|
ggml_backend_free(ctx->backend_gpu);
|
||||||
|
}
|
||||||
|
|
||||||
delete ctx;
|
delete ctx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user