summaryrefslogtreecommitdiffstats
path: root/src/audio_core/renderer/sink/sink_context.h
blob: 66925b48e7fda02d07a8afbc6173c506022b66e4 (plain) (blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <span>

#include "audio_core/renderer/sink/sink_info_base.h"
#include "common/common_types.h"

namespace AudioCore::Renderer {
/**
 * Manages output sinks.
 */
class SinkContext {
public:
    /**
     * Initialize the sink context.
     *
     * @param sink_infos - Workbuffer for the sinks.
     * @param sink_count - Number of sinks in the buffer.
     */
    void Initialize(std::span<SinkInfoBase> sink_infos, u32 sink_count);

    /**
     * Get a given index's info.
     *
     * @param index - Sink index to get.
     * @return The sink info base for the given index.
     */
    SinkInfoBase* GetInfo(u32 index);

    /**
     * Get the current number of sinks.
     *
     * @return The number of sinks.
     */
    u32 GetCount() const;

private:
    /// Buffer of sink infos
    std::span<SinkInfoBase> sink_infos{};
    /// Number of sinks in the buffer
    u32 sink_count{};
};

} // namespace AudioCore::Renderer