feat(sound): add SESound::CreateMasterChannelGroup

This commit is contained in:
fallenoak 2025-11-29 09:58:02 -06:00
parent 4291944518
commit 0865230059
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 19 additions and 0 deletions

View File

@ -11,6 +11,7 @@
SESound::Log_Write(__LINE__, __FILE__, result, __VA_ARGS__);
STORM_LIST(SoundCacheNode) SESound::s_CacheList;
TSGrowableArray<SEChannelGroup> SESound::s_ChannelGroups;
SCritSect SESound::s_CritSect3;
int32_t SESound::s_Initialized;
SCritSect SESound::s_InternalCritSect;
@ -157,6 +158,17 @@ FMOD_RESULT SESeekCallback(void* handle, uint32_t pos, void* userdata) {
return FMOD_OK;
}
void SESound::CreateMasterChannelGroup() {
SESound::s_ChannelGroups.Clear();
auto masterChannelGroup = SESound::s_ChannelGroups.New();
masterChannelGroup->m_nameHash = SStrHashHT("<master>");
masterChannelGroup->m_parentChannelGroup = -1;
masterChannelGroup->m_volume = 1.0f;
masterChannelGroup->m_muteVolume = 1.0f;
masterChannelGroup->m_dirty = false;
}
FMOD::SoundGroup* SESound::CreateSoundGroup(const char* name, int32_t maxAudible) {
FMOD::SoundGroup* group = nullptr;
FMOD_RESULT result;
@ -317,6 +329,10 @@ void SESound::Init(int32_t maxChannels, int32_t* a2, int32_t enableReverb, int32
// TODO
SESound::CreateMasterChannelGroup();
// TODO
SESound::s_Initialized = 1;
LOG_WRITE(FMOD_OK, " - FMOD System Init OK!");

View File

@ -1,6 +1,7 @@
#ifndef SOUND_SE_SOUND_HPP
#define SOUND_SE_SOUND_HPP
#include "sound/SEChannelGroup.hpp"
#include "sound/SESoundInternal.hpp"
#include "sound/SEUserData.hpp"
#include <cstdint>
@ -16,6 +17,7 @@ class SESound {
public:
// Public static variables
static STORM_LIST(SoundCacheNode) s_CacheList;
static TSGrowableArray<SEChannelGroup> s_ChannelGroups;
static SCritSect s_CritSect3;
static int32_t s_Initialized;
static SCritSect s_InternalCritSect;
@ -48,6 +50,7 @@ class SESound {
private:
// Private static functions
static void CreateMasterChannelGroup();
static int32_t LoadDiskSound(FMOD::System* fmodSystem, const char* filename, FMOD_MODE fmodMode, SESound* sound, FMOD::SoundGroup* fmodSoundGroup1, FMOD::SoundGroup* fmodSoundGroup2, bool a7, int32_t a8, uint32_t a9, int32_t a10, uint32_t decodeBufferSize, int32_t a12, float a13, float a14, float a15, float* a16);
static void ProcessReadyDiskSounds();