MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / make_linear_fade_window

Function make_linear_fade_window

src/framework/audio/chunking.cpp:324–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322 }
323 split = std::max<int64_t>(index + 1, std::min<int64_t>(split, total));
324 chunks.push_back({index, split});
325 index = split;
326 }
327 return chunks;
328}
329
330runtime::AudioBuffer slice_audio_buffer(
331 const runtime::AudioBuffer & audio,
332 const runtime::TimeSpan & span) {
333 if (audio.sample_rate <= 0) {
334 throw std::runtime_error("Audio chunker slice requires a positive sample rate");
335 }
336 require_positive(audio.channels, "audio channels");
337 if (audio.samples.empty()) {
338 throw std::runtime_error("Audio chunker slice requires non-empty audio");
339 }
340 if (audio.samples.size() % static_cast<size_t>(audio.channels) != 0) {
341 throw std::runtime_error("Audio chunker slice input size is not divisible by channel count");
342 }
343 const int64_t frames = static_cast<int64_t>(audio.samples.size() / static_cast<size_t>(audio.channels));
344 require_valid_time_span(span, frames, "Audio chunker slice");

Callers 1

RoformerSessionMethod · 0.85

Calls 1

require_positiveFunction · 0.70

Tested by

no test coverage detected