| 384 | + ":" + std::to_string(hash_audio_samples(audio)) |
| 385 | + (plan.truncate_clone_audio ? ":truncate" : ":full"); |
| 386 | } |
| 387 | return "clone:" + plan.clone_audio_path.string() + (plan.truncate_clone_audio ? ":truncate" : ":full"); |
| 388 | } |
| 389 | throw std::runtime_error("PocketTTS voice state cache key received unknown voice source"); |
| 390 | } |
| 391 | |
| 392 | std::size_t resolve_voice_state_cache_slots(const runtime::SessionOptions & options) { |
| 393 | const int64_t slots = runtime::parse_i64_option( |
| 394 | options.options, |
| 395 | {"pocket_tts.voice_state_cache_slots", "voice_state_cache_slots"}) |
| 396 | .value_or(kDefaultVoiceStateCacheSlots); |
| 397 | if (slots < 0) { |
| 398 | throw std::runtime_error("pocket_tts.voice_state_cache_slots must be non-negative"); |
| 399 | } |
| 400 | if (static_cast<std::uint64_t>(slots) > static_cast<std::uint64_t>(std::numeric_limits<std::size_t>::max())) { |
| 401 | throw std::runtime_error("pocket_tts.voice_state_cache_slots is too large"); |
no test coverage detected