1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: snd_OutputCapture.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: 47340 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_SND_CTR_OUTPUT_CAPTURE_H_ 17 #define NN_SND_CTR_OUTPUT_CAPTURE_H_ 18 19 #include <nn/types.h> 20 #include <nn/config.h> 21 #include <nn/snd/CTR/Common/snd_Const.h> 22 23 #ifdef __cplusplus 24 25 namespace nn { 26 namespace snd { 27 namespace CTR { 28 29 class Dspsnd; 30 31 /* Please see man pages for details 32 33 */ 34 class OutputCapture 35 { 36 friend class Dspsnd; // Only Dspsnd can use OutputCapture::Write 37 38 private: 39 /* Please see man pages for details 40 41 42 43 */ 44 void Write(s16* pData, s32 length = NN_SND_SAMPLES_PER_FRAME); 45 46 public: 47 /* Please see man pages for details 48 49 50 */ 51 /* Please see man pages for details 52 53 */ 54 OutputCapture(); 55 56 /* Please see man pages for details 57 58 */ 59 ~OutputCapture(); 60 /* Please see man pages for details 61 62 */ 63 64 /* Please see man pages for details 65 66 67 */ 68 /* Please see man pages for details 69 70 71 72 */ GetRequiredMemorySize(s32 frames)73 static inline size_t GetRequiredMemorySize(s32 frames) 74 { 75 return NN_SND_SAMPLES_PER_FRAME * sizeof(s16) * 2 * frames; 76 } 77 78 /* Please see man pages for details 79 80 81 82 */ 83 void Initialize(void* buffer, size_t size); 84 85 /* Please see man pages for details 86 87 */ 88 void Finalize(); 89 /* 90 91 */ 92 93 /* Please see man pages for details 94 95 96 */ 97 /* Please see man pages for details 98 99 100 */ 101 void Enable(bool enable = true); 102 103 /* Please see man pages for details 104 105 */ Disable()106 void Disable() { Enable(false); } 107 108 /* Please see man pages for details 109 110 111 */ IsEnabled()112 bool IsEnabled() const { return m_IsEnabled; } 113 114 /* Please see man pages for details 115 116 117 118 119 */ 120 s32 Read(s16* pData, s32 length = NN_SND_SAMPLES_PER_FRAME); 121 122 /* Please see man pages for details 123 124 */ 125 void Reset(); 126 /* 127 128 */ 129 130 private: 131 static const size_t UNIT_SIZE = sizeof(s16) * 2; // 16bit, stereo 132 133 uptr m_BufferAddress; // Address of buffer that stores the data to obtain 134 s32 m_BufferLength; // Buffer length 135 s32 m_ReadPos; // Read position 136 s32 m_WritePos; // Light position 137 bool m_IsEnabled; // Enabled/disabled flag 138 NN_PADDING3; 139 }; // class OutputCapture 140 141 /* Please see man pages for details 142 143 144 */ 145 /* Please see man pages for details 146 147 148 */ 149 void SetOutputCapture(OutputCapture* pCapture); 150 /* 151 152 */ 153 154 } // namespace CTR 155 } // namespace snd 156 } // namespace nn 157 158 #endif // __cplusplus 159 160 #endif // NN_SND_CTR_OUTPUT_CAPTURE_H_ 161