1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     snd_DspFxReverb.h
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 46347 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_SND_CTR_SND_DSP_FX_REVERB_H_
17 #define NN_SND_CTR_SND_DSP_FX_REVERB_H_
18 
19 #include <nn/os.h>
20 #include <nn/snd/CTR/Common/snd_Types.h>
21 #include <nn/util/util_NonCopyable.h>
22 
23 #ifdef __cplusplus
24 
25 /* Please see man pages for details
26 
27 */
28 
29 namespace nn  {
30 namespace snd {
31 namespace CTR {
32 
33 /* Please see man pages for details
34 
35  */
36 class DspFxReverb : private nn::util::NonCopyable<DspFxReverb>
37 {
38 public:
39     /* Please see man pages for details
40 
41      */
42     struct FilterSize
43     {
44         u32  m_Comb0;    //
45         u32  m_Comb1;    //
46         u32  m_AllPass;  //
47     };
48     /* Please see man pages for details
49 
50      */
51     struct Param
52     {
53         //
54         u32 m_EarlyReflectionTime;
55 
56         //
57         u32 m_FusedTime;
58 
59         //
60         u32 m_PreDelayTime;
61 
62         f32 m_Coloration;   //
63 
64         f32 m_Damping;      //
65 
66         //
67         FilterSize* m_pFilterSize;
68 
69         f32 m_EarlyGain;    //
70         f32 m_FusedGain;    //
71 
72         bool m_UseHpfDamping;   //
73         NN_PADDING3;
74 
75         /* Please see man pages for details
76 
77          */
78         Param();
79     };
80 
81 public:
82     //----------------------------------------------------------------
83     //
84     //----------------------------------------------------------------
85     //
86     /* Please see man pages for details
87 
88      */
89     DspFxReverb();
90 
91     /* Please see man pages for details
92 
93      */
94     ~DspFxReverb();
95     //
96 
97     /* Please see man pages for details
98 
99 
100 
101      */
102     static size_t GetRequiredMemorySize(const DspFxReverb::Param& param);
103 
104     /* Please see man pages for details
105 
106 
107 
108 
109      */
110     bool Initialize(uptr buffer, size_t size);
111 
112     /* Please see man pages for details
113 
114      */
115     void Finalize();
116 
117     /* Please see man pages for details
118 
119 
120 
121      */
122     bool Attach(AuxBusId id);
123 
124     /* Please see man pages for details
125 
126      */
127     void Detach();
128 
129     /* Please see man pages for details
130 
131 
132 
133      */
134     bool SetParam(const DspFxReverb::Param& param);
135 
136     /* Please see man pages for details
137 
138 
139 
140      */
141     bool Enable(bool enable = true);
142 
143     /* Please see man pages for details
144 
145 
146      */
Disable()147     bool Disable()
148     {
149         return Enable(false);
150     }
151 
152     /* Please see man pages for details
153 
154 
155      */
IsEnabled()156     bool IsEnabled()
157     {
158         return m_IsEnabled;
159     }
160 
161     /* Please see man pages for details
162 
163 
164      */
165     bool IsBufferInUse();
166 
167 private:
168     bool AssignWorkBuffer(uptr buffer, size_t size);
169 
170     void ReleaseWorkBuffer();
171 
172     static FilterSize s_DefaultFilterSize;
173 
174     uptr                        m_Buffer;
175     uptr                        m_BufferPhysical;
176     size_t                      m_BufferSize;
177 
178     bool                        m_IsInitialized;
179     util::SizedEnum1<AuxBusId>  m_AuxBusId;
180     bool                        m_IsEnabled;
181     s8                          m_ProcessCount;  // Used to determine if memory can be deallocated
182 };
183 
184 }}} // namespace nn::snd::CTR
185 
186 #endif // __cplusplus
187 
188 #endif // NN_SND_CTR_SND_DSP_FX_REVERB_H_
189