aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/audio_core/sink_context.cpp
blob: 3d713814ad97923dab55c88ab9fbd3afe522e8c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// 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(SinkInfo::InParams& in) {
    in_use = in.in_use;
    use_count = in.device.input_count;
    std::memcpy(buffers.data(), in.device.input.data(), AudioCommon::MAX_CHANNEL_COUNT);
}

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

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

} // namespace AudioCore