#include <C4SoundInstance.h>
Public Member Functions | |
~C4SoundInstance () | |
C4Object * | getObj () const |
bool | isStarted () const |
void | Clear () |
bool | Create (C4SoundEffect *pEffect, bool fLoop=false, int32_t iVolume=100, C4Object *pObj=nullptr, int32_t iNearInstanceMax=0, int32_t iFalloffDistance=0, int32_t inPitch=0, C4SoundModifier *modifier=nullptr) |
bool | CheckStart () |
bool | Start () |
bool | Stop () |
bool | Playing () |
void | Execute () |
void | SetVolume (int32_t inVolume) |
void | SetPan (int32_t inPan) |
void | SetPitch (int32_t inPitch) |
void | SetVolumeByPos (int32_t x, int32_t y, int32_t relative_volume=100) |
void | SetObj (C4Object *pnObj) |
void | ClearPointers (C4Object *pObj) |
bool | Inside (int32_t iX, int32_t iY, int32_t iRad) |
C4SoundModifier * | GetModifier () const |
void | SetModifier (C4SoundModifier *new_modifier, bool is_global) |
void | SetPlayer (int32_t new_player) |
Protected Member Functions | |
C4SoundInstance () | |
Protected Attributes | |
C4SoundEffect * | pEffect {nullptr} |
int32_t | iVolume {0} |
int32_t | iPan {0} |
int32_t | iPitch {0} |
int32_t | iChannel {-1} |
bool | pitch_dirty {false} |
C4TimeMilliseconds | tStarted |
int32_t | iNearInstanceMax |
bool | fLooping |
C4Object * | pObj |
int32_t | iFalloffDistance |
C4SoundModifier * | modifier {nullptr} |
bool | has_local_modifier {false} |
C4SoundInstance * | pNext {nullptr} |
int32_t | player |
Friends | |
class | C4SoundEffect |
class | C4SoundSystem |
class | C4SoundModifier |
Definition at line 57 of file C4SoundInstance.h.
|
protected |
Definition at line 196 of file C4SoundInstance.cpp.
C4SoundInstance::~C4SoundInstance | ( | ) |
Definition at line 201 of file C4SoundInstance.cpp.
References Clear().
bool C4SoundInstance::CheckStart | ( | ) |
Definition at line 252 of file C4SoundInstance.cpp.
References C4NearSoundRadius, fLooping, C4SoundEffect::GetStartedInstanceCount(), C4Object::GetX(), C4Object::GetY(), iNearInstanceMax, isStarted(), C4SoundEffect::Length, C4TimeMilliseconds::Now(), pEffect, pObj, Start(), and tStarted.
Referenced by Execute().
void C4SoundInstance::Clear | ( | ) |
Definition at line 206 of file C4SoundInstance.cpp.
References C4SoundModifier::DelRef(), has_local_modifier, iChannel, modifier, and Stop().
Referenced by ~C4SoundInstance().
void C4SoundInstance::ClearPointers | ( | C4Object * | pObj | ) |
Definition at line 397 of file C4SoundInstance.cpp.
References fLooping, C4Object::GetX(), C4Object::GetY(), Playing(), pObj, SetVolumeByPos(), and Stop().
Referenced by Execute().
bool C4SoundInstance::Create | ( | C4SoundEffect * | pEffect, |
bool | fLoop = false , |
||
int32_t | iVolume = 100 , |
||
C4Object * | pObj = nullptr , |
||
int32_t | iNearInstanceMax = 0 , |
||
int32_t | iFalloffDistance = 0 , |
||
int32_t | inPitch = 0 , |
||
C4SoundModifier * | modifier = nullptr |
||
) |
Definition at line 218 of file C4SoundInstance.cpp.
References C4SoundModifier::AddRef(), Config, Execute(), fLooping, has_local_modifier, iChannel, iFalloffDistance, iNearInstanceMax, iPan, iPitch, iVolume, modifier, NO_OWNER, C4TimeMilliseconds::Now(), pEffect, pitch_dirty, Playing(), pObj, C4ConfigSound::RXSound, SetPlayer(), C4Config::Sound, Stop(), and tStarted.
Referenced by C4SoundEffect::New().
void C4SoundInstance::Execute | ( | ) |
Definition at line 334 of file C4SoundInstance.cpp.
References C4Object::Audible, C4Object::AudiblePan, C4Object::AudiblePlayer, C4AudibilityRadius, CheckStart(), Clamp(), ClearPointers(), Config, iChannel, iFalloffDistance, iPan, iPitch, isStarted(), iVolume, pitch_dirty, player, pObj, SetPlayer(), C4Config::Sound, C4ConfigSound::SoundVolume, and C4PropList::Status.
Referenced by Create(), SoundLevel(), SoundPan(), SoundPitch(), SoundUpdate(), and Start().
|
inline |
|
inline |
bool C4SoundInstance::Inside | ( | int32_t | iX, |
int32_t | iY, | ||
int32_t | iRad | ||
) |
Definition at line 412 of file C4SoundInstance.cpp.
References C4Object::GetX(), C4Object::GetY(), and pObj.
|
inline |
Definition at line 86 of file C4SoundInstance.h.
References iChannel.
Referenced by CheckStart(), Execute(), SetModifier(), and Start().
bool C4SoundInstance::Playing | ( | ) |
Definition at line 315 of file C4SoundInstance.cpp.
References Application, fLooping, iChannel, C4MusicSystem::MODInitialized, C4Application::MusicSystem, and pEffect.
Referenced by ClearPointers(), Create(), and Stop().
void C4SoundInstance::SetModifier | ( | C4SoundModifier * | new_modifier, |
bool | is_global | ||
) |
Definition at line 418 of file C4SoundInstance.cpp.
References C4SoundModifier::AddRef(), C4SoundModifier::ApplyTo(), C4SoundModifier::DelRef(), has_local_modifier, iChannel, isStarted(), and modifier.
Referenced by SetPlayer().
|
inline |
|
inline |
Definition at line 95 of file C4SoundInstance.h.
References iPan.
Referenced by SoundPan().
void C4SoundInstance::SetPitch | ( | int32_t | inPitch | ) |
Definition at line 245 of file C4SoundInstance.cpp.
References iPitch, and pitch_dirty.
Referenced by SoundPitch(), and SoundUpdate().
void C4SoundInstance::SetPlayer | ( | int32_t | new_player | ) |
Definition at line 456 of file C4SoundInstance.cpp.
References Application, C4SoundModifierList::GetGlobalModifier(), C4SoundSystem::Modifiers, player, SetModifier(), and C4Application::SoundSystem.
Referenced by Create(), Execute(), and SetVolumeByPos().
|
inline |
Definition at line 94 of file C4SoundInstance.h.
References iVolume.
Referenced by SoundLevel(), and SoundUpdate().
void C4SoundInstance::SetVolumeByPos | ( | int32_t | x, |
int32_t | y, | ||
int32_t | relative_volume = 100 |
||
) |
Definition at line 390 of file C4SoundInstance.cpp.
References C4ViewportList::GetAudibility(), iPan, iVolume, NO_OWNER, player, SetPlayer(), and Viewports.
Referenced by ClearPointers(), and StartSoundEffectAt().
bool C4SoundInstance::Start | ( | ) |
Definition at line 268 of file C4SoundInstance.cpp.
References Application, C4SoundModifier::ApplyTo(), Execute(), fLooping, iChannel, isStarted(), modifier, C4MusicSystem::MODInitialized, C4Application::MusicSystem, pEffect, C4SoundEffect::pSample, and C4MusicSystem::SelectContext().
Referenced by CheckStart().
bool C4SoundInstance::Stop | ( | ) |
Definition at line 292 of file C4SoundInstance.cpp.
References fLooping, iChannel, pEffect, Playing(), and tStarted.
Referenced by Clear(), ClearPointers(), Create(), and StopSoundEffect().
|
friend |
Definition at line 59 of file C4SoundInstance.h.
|
friend |
Definition at line 61 of file C4SoundInstance.h.
|
friend |
Definition at line 60 of file C4SoundInstance.h.
|
protected |
Definition at line 72 of file C4SoundInstance.h.
Referenced by CheckStart(), ClearPointers(), Create(), Playing(), Start(), and Stop().
|
protected |
Definition at line 76 of file C4SoundInstance.h.
Referenced by Clear(), Create(), and SetModifier().
|
protected |
Definition at line 68 of file C4SoundInstance.h.
Referenced by Clear(), Create(), Execute(), isStarted(), Playing(), SetModifier(), Start(), and Stop().
|
protected |
Definition at line 74 of file C4SoundInstance.h.
|
protected |
Definition at line 71 of file C4SoundInstance.h.
Referenced by CheckStart(), and Create().
|
protected |
Definition at line 68 of file C4SoundInstance.h.
Referenced by Create(), Execute(), SetPan(), and SetVolumeByPos().
|
protected |
Definition at line 68 of file C4SoundInstance.h.
Referenced by Create(), Execute(), and SetPitch().
|
protected |
Definition at line 68 of file C4SoundInstance.h.
Referenced by Create(), Execute(), SetVolume(), and SetVolumeByPos().
|
protected |
Definition at line 75 of file C4SoundInstance.h.
Referenced by Clear(), Create(), GetModifier(), SetModifier(), and Start().
|
protected |
Definition at line 67 of file C4SoundInstance.h.
Referenced by CheckStart(), Create(), C4SoundSystem::GetNextInstance(), Playing(), Start(), and Stop().
|
protected |
Definition at line 69 of file C4SoundInstance.h.
Referenced by Create(), Execute(), and SetPitch().
|
protected |
Definition at line 83 of file C4SoundInstance.h.
Referenced by Execute(), SetPlayer(), and SetVolumeByPos().
|
protected |
Definition at line 77 of file C4SoundInstance.h.
Referenced by C4SoundEffect::AddInst(), C4SoundEffect::ClearPointers(), C4SoundEffect::Execute(), C4SoundEffect::GetInstance(), C4SoundSystem::GetNextInstance(), C4SoundEffect::GetStartedInstanceCount(), and C4SoundEffect::RemoveInst().
|
protected |
Definition at line 73 of file C4SoundInstance.h.
Referenced by CheckStart(), ClearPointers(), Create(), Execute(), getObj(), Inside(), and SetObj().
|
protected |
Definition at line 70 of file C4SoundInstance.h.
Referenced by CheckStart(), Create(), and Stop().