summaryrefslogblamecommitdiffstats
path: root/src/audio_core/sink_context.cpp
blob: cdb47ba81c1ad5a9092fd378e8fc63f2caed763f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                            






                                                                

                                      
                              






                                                    

                                                              


                      







                                                                            
                        
// 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;
}

void SinkContext::UpdateMainSink(const SinkInfo::InParams& in) {
    ASSERT(in.type == SinkTypes::Device);

    downmix = in.device.down_matrix_enabled;
    if (downmix) {
        downmix_coefficients = in.device.down_matrix_coef;
    }
    in_use = in.in_use;
    use_count = in.device.input_count;
    buffers = in.device.input;
}

bool SinkContext::InUse() const {
    return in_use;
}

std::vector<u8> SinkContext::OutputBuffers() const {
    std::vector<u8> buffer_ret(use_count);
    std::memcpy(buffer_ret.data(), buffers.data(), use_count);
    return buffer_ret;
}

bool SinkContext::HasDownMixingCoefficients() const {
    return downmix;
}

const std::array<float_le, 4>& SinkContext::GetDownmixCoefficients() const {
    return downmix_coefficients;
}

} // namespace AudioCore