| 2216 | } |
| 2217 | |
| 2218 | void rcli_stop_processing(RCLIHandle handle) { |
| 2219 | if (!handle) return; |
| 2220 | auto* engine = static_cast<RCLIEngine*>(handle); |
| 2221 | if (engine->initialized) { |
| 2222 | engine->pipeline.llm().cancel(); |
| 2223 | if (engine->pipeline.using_metalrt()) |
| 2224 | engine->pipeline.metalrt_llm().cancel(); |
| 2225 | } |
| 2226 | // Cancel streaming TTS pipeline |
| 2227 | engine->streaming_cancelled.store(true, std::memory_order_release); |
| 2228 | // Clear ring buffer to stop audio immediately |
| 2229 | auto* rb = engine->pipeline.playback_ring_buffer(); |
| 2230 | if (rb) rb->clear(); |
| 2231 | |
| 2232 | rcli_stop_speaking(handle); |
| 2233 | rcli_stop_listening(handle); |
| 2234 | } |
| 2235 | |
| 2236 | void rcli_clear_history(RCLIHandle handle) { |
| 2237 | if (!handle) return; |
no test coverage detected