blob: 63c59b7b0c7f1df674c4cf605e550ae9f5f89d8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#include "nw4r/snd/snd_StrmSoundHandle.h"
/* Original source:
* kiwi515/ogws
* src/nw4r/snd/snd_StrmSoundHandle.cpp
*/
/*******************************************************************************
* headers
*/
#include "common.h" // nullptr
#include "nw4r/snd/snd_SoundHandle.h"
#include "nw4r/snd/snd_StrmSound.h"
#include "nw4r/ut/ut_RuntimeTypeInfo.h"
/*******************************************************************************
* functions
*/
namespace nw4r { namespace snd {
StrmSoundHandle::StrmSoundHandle(SoundHandle* handle)
: mSound(nullptr)
{
if (!handle)
return;
detail::BasicSound *basicSound = handle->detail_GetAttachedSound();
if (!basicSound)
return;
if (detail::StrmSound *sound =
ut::DynamicCast<detail::StrmSound *>(basicSound))
{
mSound = sound;
if (mSound->IsAttachedTempSpecialHandle())
mSound->DetachTempSpecialHandle();
mSound->mTempSpecialHandle = this;
}
}
void StrmSoundHandle::DetachSound()
{
if (IsAttachedSound())
{
if (mSound->mTempSpecialHandle == this)
mSound->mTempSpecialHandle = nullptr;
}
if (mSound)
mSound = nullptr;
}
}} // namespace nw4r::snd
|