21 class SoundHandle :
private ut::NonCopyable
26 SoundHandle() : mSound() {}
27 ~SoundHandle() { DetachSound(); }
32 bool IsAttachedSound()
const {
return mSound !=
nullptr; }
38 void FadeIn(
int fadeFrames) {
39 if (IsAttachedSound())
40 mSound->FadeIn(fadeFrames);
43 void SetVolume(f32 volume,
int frames) {
44 if (IsAttachedSound())
45 mSound->SetVolume(volume, frames);
48 void SetPitch(f32 volume) {
49 if (IsAttachedSound())
50 mSound->SetPitch(volume);
53 void Stop(
int fadeFrames) {
54 if (IsAttachedSound())
55 mSound->Stop(fadeFrames);
58 void Pause(
bool flag,
int fadeFrames) {
59 if (IsAttachedSound())
60 mSound->Pause(flag, fadeFrames);
63 void SetPan(f32 pan) {
64 if (IsAttachedSound())
68 bool IsPause()
const {
69 return IsAttachedSound() && mSound->IsPause();
72 int GetRemainingFadeFrames()
const {
73 if (IsAttachedSound())
74 return mSound->GetRemainingFadeFrames();
81 if (IsAttachedSound())
82 return mSound->GetId();
84 return detail::BasicSound::INVALID_ID;
89 if (IsAttachedSound())
90 mSound->StartPrepared();