NW4F Snd
Loading...
Searching...
No Matches
snd_SoundHandle.h
Go to the documentation of this file.
1#ifndef NW_SND_SOUND_HANDLE_H_
2#define NW_SND_SOUND_HANDLE_H_
3
4#include <nw/snd/snd_BasicSound.h>
5#include <nw/snd/snd_Global.h>
6
7namespace nw { namespace snd {
8
10{
11public:
20
22 : m_pSound(NULL)
23 {
24 }
25
27 {
29 }
30
36
37 void Stop(int fadeFrames)
38 {
40 {
41 //NW_SND_LOG_APICALL_NW("SoundHandle::Stop [ID:%08x]", m_pSound->GetId());
42 m_pSound->Stop(fadeFrames);
43 }
44 }
45
46 void Pause(bool flag, int fadeFrames)
47 {
49 {
50 //NW_SND_LOG_APICALL_NW("SoundHandle::Pause [ID:%08x flag:%s frame:%d]", m_pSound->GetId(),flag?"true":"false",fadeFrames);
51 m_pSound->Pause(flag, fadeFrames);
52 }
53 }
54
55 bool IsPrepared() const
56 {
58 return true;
59
60 return false;
61 }
62
63 bool IsPause() const
64 {
66 return true;
67
68 return false;
69 }
70
72 {
75
77 return static_cast<PauseState>(state);
78 }
79
80 void FadeIn(int frames)
81 {
84 }
85
86 /*
87 int GetRemainingFadeFrames() const
88 {
89 if (IsAttachedSound())
90 return m_pSound->GetRemainingFadeFrames();
91
92 return 0;
93 }
94
95 int GetRemainingPauseFadeFrames() const
96 {
97 if (IsAttachedSound())
98 return m_pSound->GetRemainingPauseFadeFrames();
99
100 return 0;
101 }
102 */
103
104 void SetVolume(f32 volume, int frames = 0)
105 {
107 m_pSound->SetVolume(volume, frames);
108 }
109
110 void SetPan(f32 pan)
111 {
113 m_pSound->SetPan(pan);
114 }
115
116 /*
117 void SetSurroundPan(f32 surroundPan)
118 {
119 if (IsAttachedSound())
120 m_pSound->SetSurroundPan(surroundPan);
121 }
122
123 void SetMainSend(f32 send)
124 {
125 if (IsAttachedSound())
126 m_pSound->SetMainSend(send);
127 }
128
129 void SetFxSend(AuxBus bus, f32 send)
130 {
131 if (IsAttachedSound())
132 m_pSound->SetFxSend(bus, send);
133 }
134 */
135
136 void SetPitch(f32 pitch)
137 {
139 m_pSound->SetPitch(pitch);
140 }
141
142 /*
143 void SetLpfFreq(f32 lpfFreq)
144 {
145 if (IsAttachedSound())
146 m_pSound->SetLpfFreq(lpfFreq);
147 }
148
149 void SetBiquadFilter(int type, f32 value)
150 {
151 //NW_MINMAX_ASSERT(type, BIQUAD_FILTER_TYPE_MIN , BIQUAD_FILTER_TYPE_MAX);
152 if (IsAttachedSound())
153 m_pSound->SetBiquadFilter(type, value);
154 }
155
156 void SetPlayerPriority(int priority)
157 {
158 if (IsAttachedSound())
159 m_pSound->SetPlayerPriority(priority);
160 }
161 */
162
163 void SetOutputLine(u32 lineFlag)
164 {
166 m_pSound->SetOutputLine(lineFlag);
167 }
168
174
175 void SetOutputVolume(OutputDevice device, f32 volume)
176 {
178 m_pSound->SetOutputVolume(device, volume);
179 }
180
181 /*
182 void SetOutputPan(OutputDevice device, f32 pan)
183 {
184 if (IsAttachedSound())
185 m_pSound->SetOutputPan(device, pan);
186 }
187
188 void SetOutputSurroundPan(OutputDevice device, f32 span)
189 {
190 if (IsAttachedSound())
191 m_pSound->SetOutputSurroundPan(device, span);
192 }
193
194 void SetOutputMainSend(OutputDevice device, f32 send)
195 {
196 if (IsAttachedSound())
197 m_pSound->SetOutputMainSend(device, send);
198 }
199
200 void SetOutputFxSend(OutputDevice device, AuxBus bus, f32 send)
201 {
202 if (IsAttachedSound())
203 m_pSound->SetOutputFxSend(device, bus, send);
204 }
205 */
206
207 void SetMainOutVolume(f32 volume)
208 {
209 SetOutputVolume(OUTPUT_DEVICE_MAIN, volume);
210 }
211
212 void SetDrcOutVolume(f32 volume, u32 drcIndex = 0)
213 {
214 (void)drcIndex;
215 SetOutputVolume(OUTPUT_DEVICE_DRC, volume);
216 }
217
218 /*
219 void SetDrcPan(f32 pan, u32 drcIndex = 0)
220 {
221 (void)drcIndex;
222 SetOutputPan(OUTPUT_DEVICE_DRC, pan);
223 }
224 */
225
226 void SetRemoteOutVolume(u32 remoteIndex, f32 volume)
227 {
229 m_pSound->SetRemoteOutVolume(remoteIndex, volume);
230 }
231
232 /*
233 void SetRemoteMainSend(u32 remoteIndex, f32 send)
234 {
235 if (IsAttachedSound())
236 m_pSound->SetRemoteMainSend(remoteIndex, send);
237 }
238
239 void SetRemoteFxSend(u32 remoteIndex, f32 send)
240 {
241 if (IsAttachedSound())
242 m_pSound->SetRemoteFxSend(remoteIndex, send);
243 }
244 */
245
246 bool IsAttachedSound() const
247 {
248 if (m_pSound != NULL)
249 return true;
250
251 return false;
252 }
253
255
256 void SetId(u32 id)
257 {
259 m_pSound->SetId(id);
260 }
261
262 u32 GetId() const
263 {
265 return m_pSound->GetId();
266
267 return internal::BasicSound::INVALID_ID;
268 }
269
271 {
272 if (!IsAttachedSound())
273 return NULL;
274
276 }
277
278 void* GetUserParam() const
279 {
280 if (!IsAttachedSound())
281 return NULL;
282
284 }
285
286
289
294
296 {
297 return m_pSound;
298 }
299
300 /*
301 void detail_DuplicateHandle(SoundHandle* handle);
302 */
303
304private:
306
308};
309static_assert(sizeof(SoundHandle) == 4);
310
311} } // namespace nw::snd
312
313#endif // NW_SND_SOUND_HANDLE_H_
Definition snd_SoundHandle.h:10
void SetId(u32 id)
Definition snd_SoundHandle.h:256
bool IsPrepared() const
Definition snd_SoundHandle.h:55
SoundHandle()
Definition snd_SoundHandle.h:21
void SetVolume(f32 volume, int frames=0)
Definition snd_SoundHandle.h:104
void ResetOutputLine()
Definition snd_SoundHandle.h:169
void detail_AttachSound(internal::BasicSound *sound)
void * GetUserParam() const
Definition snd_SoundHandle.h:278
bool IsAttachedSound() const
Definition snd_SoundHandle.h:246
void SetDrcOutVolume(f32 volume, u32 drcIndex=0)
Definition snd_SoundHandle.h:212
internal::BasicSound * m_pSound
Definition snd_SoundHandle.h:307
void SetPan(f32 pan)
Definition snd_SoundHandle.h:110
const internal::BasicSound * detail_GetAttachedSound() const
Definition snd_SoundHandle.h:295
void FadeIn(int frames)
Definition snd_SoundHandle.h:80
~SoundHandle()
Definition snd_SoundHandle.h:26
void StartPrepared()
Definition snd_SoundHandle.h:31
void SetOutputLine(u32 lineFlag)
Definition snd_SoundHandle.h:163
void SetPitch(f32 pitch)
Definition snd_SoundHandle.h:136
const SoundParam * GetAmbientParam() const
Definition snd_SoundHandle.h:270
PauseState GetPauseState() const
Definition snd_SoundHandle.h:71
PauseState
Definition snd_SoundHandle.h:13
@ PAUSE_STATE_PAUSING
Definition snd_SoundHandle.h:15
@ PAUSE_STATE_NORMAL
Definition snd_SoundHandle.h:14
@ PAUSE_STATE_UNPAUSING
Definition snd_SoundHandle.h:17
@ PAUSE_STATE_PAUSED
Definition snd_SoundHandle.h:16
@ PAUSE_STATE_INVALID
Definition snd_SoundHandle.h:18
void SetOutputVolume(OutputDevice device, f32 volume)
Definition snd_SoundHandle.h:175
void Pause(bool flag, int fadeFrames)
Definition snd_SoundHandle.h:46
internal::BasicSound * detail_GetAttachedSound()
Definition snd_SoundHandle.h:290
void detail_AttachSoundAsTempHandle(internal::BasicSound *sound)
void SetMainOutVolume(f32 volume)
Definition snd_SoundHandle.h:207
u32 GetId() const
Definition snd_SoundHandle.h:262
void Stop(int fadeFrames)
Definition snd_SoundHandle.h:37
void SetRemoteOutVolume(u32 remoteIndex, f32 volume)
Definition snd_SoundHandle.h:226
bool IsPause() const
Definition snd_SoundHandle.h:63
Definition snd_BasicSound.h:146
PauseState GetPauseState() const
Definition snd_BasicSound.h:317
virtual bool IsPrepared() const =0
PauseState
Definition snd_BasicSound.h:311
void Pause(bool flag, int fadeFrames)
const SoundParam & GetAmbientParam() const
Definition snd_BasicSound.h:297
void Stop(int fadeFrames)
void * GetUserParam()
Definition snd_BasicSound.h:308
Definition snd_BasicSound.cpp:3
Definition snd_BasicSound.cpp:3
OutputDevice
Definition snd_Global.h:17
Definition snd_BasicSound.h:38