| 71 | } |
| 72 | |
| 73 | Context Context::from_buffer(void *buffer, size_t buffer_size, bool no_state) { |
| 74 | Context c; |
| 75 | NO_STATE_WARNING(no_state); |
| 76 | |
| 77 | if (no_state) { |
| 78 | c.set_context(whisper_init_from_buffer_no_state(buffer, buffer_size)); |
| 79 | } else { |
| 80 | c.set_context(whisper_init_from_buffer(buffer, buffer_size)); |
| 81 | c.set_init_with_state(true); |
| 82 | } |
| 83 | RAISE_IF_NULL(c.wctx); |
| 84 | return c; |
| 85 | } |
| 86 | |
| 87 | void Context::free_state() { |
| 88 | whisper_free_state(wstate); |