2020-07-12 11:59:14 +00:00
|
|
|
// Copyright 2020 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include "audio_core/sink_context.h"
|
|
|
|
|
|
|
|
namespace AudioCore {
|
|
|
|
SinkContext::SinkContext(std::size_t sink_count) : sink_count(sink_count) {}
|
|
|
|
SinkContext::~SinkContext() = default;
|
|
|
|
|
|
|
|
std::size_t SinkContext::GetCount() const {
|
|
|
|
return sink_count;
|
|
|
|
}
|
|
|
|
|
2020-11-17 03:14:29 +00:00
|
|
|
void SinkContext::UpdateMainSink(const SinkInfo::InParams& in) {
|
|
|
|
ASSERT(in.type == SinkTypes::Device);
|
|
|
|
|
2020-11-17 04:40:19 +00:00
|
|
|
has_downmix_coefs = in.device.down_matrix_enabled;
|
|
|
|
if (has_downmix_coefs) {
|
2020-11-17 03:14:29 +00:00
|
|
|
downmix_coefficients = in.device.down_matrix_coef;
|
|
|
|
}
|
2020-07-12 11:59:14 +00:00
|
|
|
in_use = in.in_use;
|
|
|
|
use_count = in.device.input_count;
|
2020-11-17 03:14:29 +00:00
|
|
|
buffers = in.device.input;
|
2020-07-12 11:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SinkContext::InUse() const {
|
|
|
|
return in_use;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<u8> SinkContext::OutputBuffers() const {
|
2020-10-21 02:07:39 +00:00
|
|
|
std::vector<u8> buffer_ret(use_count);
|
|
|
|
std::memcpy(buffer_ret.data(), buffers.data(), use_count);
|
2020-07-12 11:59:14 +00:00
|
|
|
return buffer_ret;
|
|
|
|
}
|
|
|
|
|
2020-11-17 03:14:29 +00:00
|
|
|
bool SinkContext::HasDownMixingCoefficients() const {
|
2020-11-17 04:40:19 +00:00
|
|
|
return has_downmix_coefs;
|
2020-11-17 03:14:29 +00:00
|
|
|
}
|
|
|
|
|
2020-11-17 04:40:19 +00:00
|
|
|
const DownmixCoefficients& SinkContext::GetDownmixCoefficients() const {
|
2020-11-17 03:14:29 +00:00
|
|
|
return downmix_coefficients;
|
|
|
|
}
|
|
|
|
|
2020-07-12 11:59:14 +00:00
|
|
|
} // namespace AudioCore
|