Collapse a dual-mono resample bake to one channel, like every other capture
prepareLanding takes the shared collapse on the staged buffer before the hash and the channel-count read, so hash, entry and file all derive from one buffer. A true-stereo bake stays byte-identical.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <cstdio> // std::snprintf (hash hex render)
|
||||
#include <cstring> // std::memcpy, std::memcmp
|
||||
#include <utility> // std::move
|
||||
|
||||
namespace reasampler::capture {
|
||||
|
||||
@@ -300,6 +301,23 @@ MonoCollapse collapseToMono(const std::vector<std::uint8_t>& bytes) {
|
||||
return out;
|
||||
}
|
||||
|
||||
CollapsedWav applyMonoCollapse(std::vector<std::uint8_t> bytes) {
|
||||
CollapsedWav out;
|
||||
MonoCollapse collapse = collapseToMono(bytes);
|
||||
if (collapse.collapsed) {
|
||||
const WavLayout rebuilt = parseWavLayout(collapse.bytes);
|
||||
if (rebuilt.valid) {
|
||||
out.bytes = std::move(collapse.bytes);
|
||||
out.layout = rebuilt;
|
||||
out.collapsed = true;
|
||||
return out;
|
||||
}
|
||||
}
|
||||
out.bytes = std::move(bytes);
|
||||
out.layout = parseWavLayout(out.bytes);
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string monoCollapseSuffix(MonoCollapseOutcome outcome) {
|
||||
switch (outcome) {
|
||||
case MonoCollapseOutcome::Declined: return {};
|
||||
|
||||
Reference in New Issue
Block a user