18#define ASOUNDMANAGER_MAX_NUM_CUE 128
21 ,
public Toshi::TSingleton<ASoundManager>
38 Toshi::TVector4
Position = Toshi::TVector4::VEC_ZERO;
39 Toshi::TVector4
Velocity = Toshi::TVector4::VEC_ZERO;
40 Toshi::TVector4
Forward = Toshi::TVector4::VEC_ZERO;
41 Toshi::TVector4
Up = Toshi::TVector4::VEC_ZERO;
140 if ( fStartTime1 > fStartTime2 )
143 if ( fStartTime1 >= fStartTime2 )
160 if ( a_rcVal1->Size() <= 0 )
161 return ( a_rcVal2->Size() == 0 ) ? 0 : -1;
163 if ( a_rcVal2->Size() <= 0 )
228 Callback_t fnCallback =
TNULL;
243 using PauseListener = Toshi::TListener<Toshi::TSystemManager, TBOOL, ASoundManager>;
332 void CreatePlaySoundEvent(
Cue* a_pCue,
TINT a_iTrackIndex,
TINT a_iFirstWaveIndex,
TINT a_iLastWaveIndex,
TINT a_iFlags,
TFLOAT a_fDelay1,
TFLOAT a_fDelay2 );
344 void AddEventToCue(
Cue* a_pCue,
SoundEvent* a_pSoundEvent );
356 void EventHandler_PlaySound(
SoundEvent* a_pEvent );
357 void EventHandler_PlayStream(
SoundEvent* a_pEvent );
358 void EventHandler_StopAudio(
SoundEvent* a_pEvent );
359 void EventHandler_UpdateChannelVolume(
SoundEvent* a_pEvent );
360 void EventHandler_UpdateChannelFrequency(
SoundEvent* a_pEvent );
361 void EventHandler_UpdatePosition(
SoundEvent* a_pEvent );
366 AWaveBank* LoadWaveBankFromAsset(
const Toshi::TString8& a_strName,
TUINT32 a_uiForcedFlags );
367 AWaveBank* AllocateWaveBank(
const Toshi::TPString8& a_strBank,
const Toshi::TPString8& a_strLibrary,
const Toshi::TPString8& a_strType,
const Toshi::TPString8& a_strPath );
369 TBOOL LoadSoundBankImpl(
const TCHAR* a_szName,
TBOOL a_bSimpleSound,
TBOOL a_bLoadImmediately );
372 static TUINT GetCueIndex(
Cue* a_pCue );
379 inline static Toshi::TFileSystem* ms_pFileSystem;
380 inline static Toshi::T2Map<Toshi::TPString8, AWaveBank*, Toshi::TPString8::Comparator> ms_WaveBanks;
381 inline static TINT ms_iNumPauses;
384 Toshi::T2DynamicObjectPool<SoundEvent> m_SoundEventPool;
385 Toshi::T2DynamicObjectPool<StreamRef> m_StreamRefPool;
386 Toshi::T2DynamicObjectPool<ChannelRef> m_ChannelRefPool;
387 Toshi::T2DynamicObjectPool<ChannelRefLegacy> m_ChannelRefLegacyPool;
388 Toshi::T2Map<Toshi::TPString8, TSIZE, Toshi::TPString8::Comparator> m_CategoryIndices;
389 Toshi::T2Map<TINT, ASound*> m_SoundIdToSound;
390 Toshi::T2Map<TINT, ASoundLegacy*> m_SoundIdToSoundLegacy;
394 Toshi::T2DList<StreamRef> m_StreamRefs;
397 TINT m_iLastAvailableSoundExSlot;
402 TBOOL m_bUseMinHardwareChannels;
403 TINT m_iMinHWChannels;
405 TINT m_iGlobalFrequency;
408 Toshi::T2DList<S4> m_FreeListS4;
409 Toshi::T2DList<S4> m_UnkList1;
410 Toshi::T2DList<ASoundBank> m_SoundBanks;
411 Toshi::T2DList<S2> m_FreeListS2;
Core file system interface for the Toshi engine.
#define TDECLARE_CLASS(THIS_CLASS, PARENT_CLASS)
#define ASOUNDMANAGER_MAX_NUM_CUE
Toshi::T2DListNodeWrapper< Toshi::T2SortedList< SoundEvent, Toshi::T2DList< SoundEvent >, SoundEventSortResults > > SoundEventList
virtual TBOOL OnCreate() override
void CancelCueEvents(Cue *a_pCue, SOUNDEVENT a_eEventType)
TINT GetAvailableCueIndex()
TBOOL LoadWaveBankSamples(const Toshi::TPString8 &a_rcName, AWaveBank::LOADFLAGS a_eLoadFlags, TINT a_iBufferSize)
TINT PlayCueEx(ASoundId a_iSound, TFLOAT a_fVolume, TBOOL a_bFlag, TFLOAT a_fDelay, TINT a_iTrack)
AWaveBank * FindWaveBank(const Toshi::TPString8 &a_rcName)
virtual TBOOL OnUpdate(TFLOAT a_fDeltaTime) override
virtual void OnDestroy() override
ASoundBank * FindSoundBank(const Toshi::TPString8 &a_rcName)
static constexpr const TCHAR * SOUNDS_BASE_DIRECTORY
@ SOUNDEVENT_UpdateChannelPosition
@ SOUNDEVENT_UpdateChannelVolume
@ SOUNDEVENT_UpdateChannelFrequency
TBOOL IsCuePlaying(TINT a_iCueIndex)
void LoadSoundBankSamples(const Toshi::TPString8 &a_rcName)
void StopCue(TINT &a_rCueIndex)
void StopCueAsync(TINT &a_rCueIndex, TFLOAT a_fDelay)
static TBOOL ms_bShouldUpdateLoadingScreen
Toshi::TListener< Toshi::TSystemManager, TBOOL, ASoundManager > PauseListener
TBOOL LoadSoundBank(const Toshi::TPString8 &a_rcName, TBOOL a_bSimpleSound, TBOOL a_bLoadImmediately)
TINT PlayCue(ASoundId a_iSound)
virtual TBOOL Reset() override
TBOOL LoadWaveBanksInfo(const TCHAR *a_szFileName)
void PauseAllCues(TBOOL a_bPause)
static constexpr TUINT MAX_NUM_CATEGORIES
TFLOAT operator[](TUINT a_uiIndex) const
TFLOAT aParams[MAX_NUM_PARAMS]
TFLOAT & operator[](TUINT a_uiIndex)
static constexpr TSIZE MAX_NUM_PARAMS
void(*)(TINT a_iType, TINT a_iCueIndex, void *a_pUserData) Callback_t
SoundEvent(SOUNDEVENT a_eEventType, TFLOAT a_fStartTime, Cue *a_pCue, ASound::Sample *a_pWave, ChannelRef *a_pChannel, TINT a_iFlags, TINT a_iTrackIndex)
EventParameters oParameters
TINT operator()(const SoundEvent &a_rcVal1, const SoundEvent &a_rcVal2) const
TINT operator()(const SoundEventList &a_rcVal1, const SoundEventList &a_rcVal2) const
Toshi::TVector4 vecPosition
Toshi::T2DList< ChannelRef > oChannelRefs
Toshi::T2DList< ChannelRefLegacy > aChannelRefsLegacy[2]
SoundEventList oEventList
TBOOL HasEventOfType(SOUNDEVENT a_eEventType) const
Toshi::T2Vector< TINT, 15 > vecLoopStarts
Toshi::T2DList< Cue > PlayingCues
void SetEventHandler(SOUNDEVENT a_eEventType, EventHandler::Callback_t a_fnHandler)
void ExecuteEvent(SOUNDEVENT a_eEventType, ASoundManager *a_pSoundManager, SoundEvent *a_pEvent)
~SoundEventManager()=default
SoundEventManager()=default