| 244 | } |
| 245 | |
| 246 | std::vector<float> mono_from_audio(const runtime::AudioBuffer & audio) { |
| 247 | if (audio.sample_rate <= 0 || audio.channels <= 0) { |
| 248 | throw std::runtime_error("OmniVoice postprocess requires valid audio metadata"); |
| 249 | } |
| 250 | if (audio.samples.empty()) { |
| 251 | return {}; |
| 252 | } |
| 253 | if (audio.samples.size() % static_cast<size_t>(audio.channels) != 0) { |
| 254 | throw std::runtime_error("OmniVoice postprocess received invalid interleaved audio"); |
| 255 | } |
| 256 | return engine::audio::mixdown_interleaved_to_mono_average(audio.samples, audio.channels); |
| 257 | } |
| 258 | |
| 259 | runtime::AudioBuffer make_audio_buffer(std::vector<float> mono, int sample_rate) { |
| 260 | runtime::AudioBuffer out; |
no test coverage detected