1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     snd_DspFxDelay.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_DELAY_H_
17 #define NN_SND_CTR_SND_DSP_FX_DELAY_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 DspFxDelay : private nn::util::NonCopyable<DspFxDelay>
37 {
38 public:
39     /* Please see man pages for details
40 
41      */
42     struct Param
43     {
44         //
45         u32 m_DelayTime;
46 
47         //
48         f32 m_FeedbackGain;
49 
50         //
51         f32 m_Damping;
52 
53         //
54         bool m_IsEnableSurround;
55         NN_PADDING3;
56 
57         /* Please see man pages for details
58 
59          */
ParamParam60         Param() : m_DelayTime(250), m_FeedbackGain(0.4f), m_Damping(0.5f), m_IsEnableSurround(false) {}
61     };
62 
63 public:
64     //----------------------------------------------------------------
65     //
66     //----------------------------------------------------------------
67     //
68     /* Please see man pages for details
69 
70      */
71     DspFxDelay();
72 
73     /* Please see man pages for details
74 
75      */
76     ~DspFxDelay();
77     //
78 
79     /* Please see man pages for details
80 
81 
82 
83      */
84     static size_t GetRequiredMemorySize(const DspFxDelay::Param& param);
85 
86     /* Please see man pages for details
87 
88 
89 
90 
91      */
92     bool Initialize(uptr buffer, size_t size);
93 
94     /* Please see man pages for details
95 
96      */
97     void Finalize();
98 
99     /* Please see man pages for details
100 
101 
102 
103      */
104     bool Attach(AuxBusId id);
105 
106     /* Please see man pages for details
107 
108      */
109     void Detach();
110 
111     /* Please see man pages for details
112 
113 
114 
115      */
116     bool SetParam(const DspFxDelay::Param& param);
117 
118     /* Please see man pages for details
119 
120 
121 
122      */
123     bool Enable(bool enable = true);
124 
125     /* Please see man pages for details
126 
127 
128      */
Disable()129     bool Disable()
130     {
131         return Enable(false);
132     }
133 
134     /* Please see man pages for details
135 
136 
137      */
IsEnabled()138     bool IsEnabled()
139     {
140         return m_IsEnabled;
141     }
142 
143     /* Please see man pages for details
144 
145 
146      */
147     bool IsBufferInUse();
148 
149 private:
150     bool AssignWorkBuffer(uptr buffer, size_t size);
151 
152     void ReleaseWorkBuffer();
153 
154     uptr                        m_Buffer;
155     uptr                        m_BufferPhysical;
156     size_t                      m_BufferSize;
157 
158     bool                        m_IsInitialized;
159     util::SizedEnum1<AuxBusId>  m_AuxBusId;
160     bool                        m_IsEnabled;
161     s8                          m_ProcessCount;  // Used to determine if memory can be deallocated
162 };
163 
164 }}} // namespace nn::snd::CTR
165 
166 #endif // __cplusplus
167 
168 #endif // NN_SND_CTR_SND_DSP_FX_DELAY_H_
169