This commit is contained in:
2026-03-07 07:48:16 +03:00
parent a998771486
commit 95daf12fc5
48 changed files with 4613 additions and 66 deletions

View File

@@ -39,6 +39,9 @@ void SoundSystem::Init()
ma_uint32 uiSampleRate = ma_engine_get_sample_rate(&m_engine);
Msg("Sound sampling rate: %d\n", uiSampleRate);
// Initialize listener
SetListenerPosition(0.0f, 0.0f, 0.0f);
m_inited = true;
}
@@ -91,6 +94,15 @@ void SoundSystem::Play(SoundHandle handle, bool bLoop)
ma_sound_set_looping(&m_sounds[handle], true);
}
void SoundSystem::Play3D(SoundHandle handle, float x, float y, float z, bool bLoop)
{
if ( !m_inited )
return;
Play(handle, bLoop);
ma_sound_set_position(&m_sounds[handle], x, y, z);
}
void SoundSystem::Stop(SoundHandle handle)
{
if ( !m_inited )
@@ -121,4 +133,20 @@ void SoundSystem::SetMasterVolume(float volume)
float SoundSystem::GetMasterVolume()
{
return ma_engine_get_volume(&m_engine);
}
}
void SoundSystem::SetListenerPosition(float _x, float _y, float _z)
{
if ( !m_inited )
return;
ma_engine_listener_set_position(&m_engine, 0, _x, _y, _z);
}
void SoundSystem::SetListenerDirection(float _x, float _y, float _z)
{
if ( !m_inited )
return;
ma_engine_listener_set_direction(&m_engine, 0, _x, _y, _z);
}