blob: d637592e8dc0d8053c29abdb77619e01a04246a1 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
//
// Copyright (c) 2019-2020 Ryujinx
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
using System.Diagnostics;
namespace Ryujinx.Audio.Renderer.Server.Effect
{
/// <summary>
/// Effect context.
/// </summary>
public class EffectContext
{
/// <summary>
/// Storage for <see cref="BaseEffect"/>.
/// </summary>
private BaseEffect[] _effects;
/// <summary>
/// The total effect count.
/// </summary>
private uint _effectCount;
/// <summary>
/// Create a new <see cref="EffectContext"/>.
/// </summary>
public EffectContext()
{
_effects = null;
_effectCount = 0;
}
/// <summary>
/// Initialize the <see cref="EffectContext"/>.
/// </summary>
/// <param name="effectCount">The total effect count.</param>
public void Initialize(uint effectCount)
{
_effectCount = effectCount;
_effects = new BaseEffect[effectCount];
for (int i = 0; i < _effectCount; i++)
{
_effects[i] = new BaseEffect();
}
}
/// <summary>
/// Get the total effect count.
/// </summary>
/// <returns>The total effect count.</returns>
public uint GetCount()
{
return _effectCount;
}
/// <summary>
/// Get a reference to a <see cref="BaseEffect"/> at the given <paramref name="index"/>.
/// </summary>
/// <param name="index">The index to use.</param>
/// <returns>A reference to a <see cref="BaseEffect"/> at the given <paramref name="index"/>.</returns>
public ref BaseEffect GetEffect(int index)
{
Debug.Assert(index >= 0 && index < _effectCount);
return ref _effects[index];
}
}
}
|