1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: snd_FxDelay.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:$ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_SND_CTR_MPCORE_SND_FX_DELAY_H_ 17 #define NN_SND_CTR_MPCORE_SND_FX_DELAY_H_ 18 19 #ifdef __cplusplus 20 21 namespace nn { namespace snd { namespace CTR { 22 23 //--------------------------------------------------------------------------- 24 // 25 // 26 // 27 // 28 // 29 // 30 // 31 // 32 // 33 // 34 // 35 // 36 // 37 //--------------------------------------------------------------------------- 38 class FxDelay 39 { 40 public: 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 struct Param 82 { 83 // 84 u32 m_DelayTime; 85 86 // 87 f32 m_FeedbackGain; 88 89 // 90 f32 m_Damping; 91 92 // 93 bool m_IsEnableSurround; 94 95 NN_PADDING3; 96 97 //--------------------------------------------------------------------------- 98 // 99 // 100 // 101 // 102 //--------------------------------------------------------------------------- ParamParam103 Param() 104 : m_DelayTime( 250 ), 105 m_FeedbackGain( 0.4f ), 106 m_Damping( 0.5f ), 107 m_IsEnableSurround( false ) 108 {} 109 }; 110 111 //---------------------------------------------------------------- 112 // 113 //---------------------------------------------------------------- 114 // 115 //--------------------------------------------------------------------------- 116 // 117 // 118 // 119 //--------------------------------------------------------------------------- 120 FxDelay(); 121 122 //--------------------------------------------------------------------------- 123 // 124 // 125 // 126 //--------------------------------------------------------------------------- 127 virtual ~FxDelay(); 128 // 129 130 //---------------------------------------------------------------- 131 // 132 //---------------------------------------------------------------- 133 // 134 //--------------------------------------------------------------------------- 135 // 136 // 137 // 138 // 139 // 140 // 141 // 142 // 143 // 144 // 145 // 146 // 147 // 148 // 149 // 150 // 151 // 152 // 153 // 154 // 155 // 156 // 157 // 158 // 159 // 160 // 161 // 162 // 163 // 164 // 165 // 166 // 167 // 168 // 169 // 170 // 171 // 172 //--------------------------------------------------------------------------- 173 bool SetParam( const FxDelay::Param& param ); 174 175 //--------------------------------------------------------------------------- 176 // 177 // 178 // 179 // 180 // 181 // 182 // 183 //--------------------------------------------------------------------------- GetParam()184 const Param& GetParam() const 185 { 186 return m_Param; 187 } 188 // 189 190 //---------------------------------------- 191 // 192 // 193 //--------------------------------------------------------------------------- 194 // 195 // 196 // 197 // 198 // 199 // 200 // 201 // 202 // 203 // 204 //--------------------------------------------------------------------------- 205 size_t GetRequiredMemSize(); 206 207 //--------------------------------------------------------------------------- 208 // 209 // 210 // 211 // 212 // 213 // 214 // 215 // 216 // 217 // 218 // 219 // 220 // 221 // 222 // 223 // 224 // 225 // 226 // 227 //--------------------------------------------------------------------------- 228 bool AssignWorkBuffer( uptr buffer, size_t size ); 229 230 //--------------------------------------------------------------------------- 231 // 232 // 233 // 234 // 235 // 236 // 237 // 238 // 239 // 240 // 241 //--------------------------------------------------------------------------- 242 void ReleaseWorkBuffer(); 243 // 244 245 /* Please see man pages for details */ 246 bool Initialize(); 247 248 /* Please see man pages for details */ 249 void Finalize(); 250 251 /* Please see man pages for details */ 252 void UpdateBuffer( uptr data ); 253 254 255 private: 256 struct WorkBuffer 257 { 258 s32* m_Delay[4]; // 259 s32 m_Lpf[4]; // 260 }; 261 262 void AllocBuffer(); 263 void FreeBuffer(); 264 void InitializeParam(); 265 266 Param m_Param; 267 uptr m_pBuffer; // 268 size_t m_BufferSize; // 269 270 WorkBuffer m_WorkBuffer; // 271 272 u32 m_DelayFrames; // 273 u32 m_CurFrame; // 274 275 s32 m_FeedbackGain; // 276 s32 m_LpfCoef1; // 277 s32 m_LpfCoef2; // 278 279 u32 m_DelayTimeAtInitialize; 280 bool m_IsEnableSurroundAtInitialize; 281 282 u8 m_ProcessChannelCount; 283 bool m_IsActive; // 284 285 NN_PADDING1; 286 }; 287 288 }}} // namespace nn::snd::CTR 289 290 #endif // __cplusplus 291 292 #endif /* NN_SND_CTR_MPCORE_SND_FX_DELAY_H_ */ 293 294