feat(sound): add SI2::IsPlaying

This commit is contained in:
fallenoak 2025-11-26 18:59:06 -06:00
parent f64e75a490
commit 4669e306c3
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
5 changed files with 37 additions and 0 deletions

View File

@ -538,6 +538,21 @@ void SESound::CompleteLoad() {
}
}
bool SESound::IsPlaying() {
if (!this->m_internal) {
return 0;
}
if (!this->m_internal->m_fmodChannel) {
return 0;
}
bool isPlaying;
this->m_internal->m_fmodChannel->isPlaying(&isPlaying);
return isPlaying;
}
int32_t SESound::Load(const char* filename, int32_t a3, FMOD::SoundGroup* soundGroup1, FMOD::SoundGroup* soundGroup2, bool a6, bool a7, uint32_t a8, int32_t a9, uint32_t a10) {
if (!SESound::s_Initialized) {
return 0;

View File

@ -35,6 +35,7 @@ class SESound {
// Public member functions
void CompleteLoad();
bool IsPlaying();
int32_t Load(const char* filename, int32_t a3, FMOD::SoundGroup* soundGroup1, FMOD::SoundGroup* soundGroup2, bool a6, bool a7, uint32_t a8, int32_t a9, uint32_t a10);
void Play();

View File

@ -5,6 +5,7 @@
#include "sound/SESound.hpp"
#include "sound/SOUNDKITDEF.hpp"
#include "sound/SOUNDKITLOOKUP.hpp"
#include "sound/SOUNDKITOBJECT.hpp"
#include "ui/FrameScript.hpp"
TSGrowableArray<SOUNDKITDEF*> SI2::s_SoundKitDefs;
@ -230,6 +231,10 @@ void SI2::InitSoundKitGroups() {
}
}
bool SI2::IsPlaying(SOUNDKITOBJECT* object) {
return object->m_sound->IsPlaying();
}
int32_t SI2::PlaySoundKit(int32_t id, int32_t a2, void* handle, SoundKitProperties* properties, int32_t a5, void* a6, int32_t a7, int32_t a8) {
// Basic validations

View File

@ -9,6 +9,7 @@
class SOUNDKITDEF;
struct SOUNDKITLOOKUP;
class SOUNDKITOBJECT;
class SoundKitProperties;
class SI2 {
@ -25,6 +26,7 @@ class SI2 {
static int32_t Init(int32_t a1);
static void InitSoundKitDefs();
static void InitSoundKitGroups();
static bool IsPlaying(SOUNDKITOBJECT* object);
static int32_t PlaySoundKit(int32_t id, int32_t a2, void* handle, SoundKitProperties* properties, int32_t a5, void* a6, int32_t a7, int32_t a8);
static void PlayUISound(int32_t id);
static void RegisterCVars();

View File

@ -0,0 +1,14 @@
#ifndef SOUND_SOUND_KIT_OBJECT_HPP
#define SOUND_SOUND_KIT_OBJECT_HPP
class SESound;
class SOUNDKITOBJECT {
public:
// Member variables
// TODO
SESound* m_sound;
// TODO
};
#endif