RingRacers/src/audio/expand_mono.cpp
2023-01-09 20:02:19 -06:00

28 lines
879 B
C++

// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2022-2023 by Ronald "Eidolon" Kinard
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
#include "expand_mono.hpp"
#include <algorithm>
using std::size_t;
using namespace srb2::audio;
ExpandMono::~ExpandMono() = default;
size_t ExpandMono::filter(tcb::span<Sample<1>> input_buffer, tcb::span<Sample<2>> buffer)
{
for (size_t i = 0; i < std::min(input_buffer.size(), buffer.size()); i++)
{
buffer[i].amplitudes[0] = input_buffer[i].amplitudes[0];
buffer[i].amplitudes[1] = input_buffer[i].amplitudes[0];
}
return std::min(input_buffer.size(), buffer.size());
}