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