mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 15:44:56 +00:00
New code style refactor
This commit is contained in:
@@ -1,40 +1,33 @@
|
||||
#include "CAudioGroupSet.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace urde {
|
||||
|
||||
amuse::AudioGroupData CAudioGroupSet::LoadData()
|
||||
{
|
||||
athena::io::MemoryReader r(m_buffer.get(), INT32_MAX);
|
||||
x10_baseName = r.readString();
|
||||
x20_name = r.readString();
|
||||
amuse::AudioGroupData CAudioGroupSet::LoadData() {
|
||||
athena::io::MemoryReader r(m_buffer.get(), INT32_MAX);
|
||||
x10_baseName = r.readString();
|
||||
x20_name = r.readString();
|
||||
|
||||
u8* buf = m_buffer.get() + r.position();
|
||||
uint32_t poolLen = hecl::SBig(*reinterpret_cast<uint32_t*>(buf));
|
||||
unsigned char* pool = buf + 4;
|
||||
buf += poolLen + 4;
|
||||
uint32_t projLen = hecl::SBig(*reinterpret_cast<uint32_t*>(buf));
|
||||
unsigned char* proj = buf + 4;
|
||||
buf += projLen + 4;
|
||||
uint32_t sampLen = hecl::SBig(*reinterpret_cast<uint32_t*>(buf));
|
||||
unsigned char* samp = buf + 4;
|
||||
buf += sampLen + 4;
|
||||
uint32_t sdirLen = hecl::SBig(*reinterpret_cast<uint32_t*>(buf));
|
||||
unsigned char* sdir = buf + 4;
|
||||
u8* buf = m_buffer.get() + r.position();
|
||||
uint32_t poolLen = hecl::SBig(*reinterpret_cast<uint32_t*>(buf));
|
||||
unsigned char* pool = buf + 4;
|
||||
buf += poolLen + 4;
|
||||
uint32_t projLen = hecl::SBig(*reinterpret_cast<uint32_t*>(buf));
|
||||
unsigned char* proj = buf + 4;
|
||||
buf += projLen + 4;
|
||||
uint32_t sampLen = hecl::SBig(*reinterpret_cast<uint32_t*>(buf));
|
||||
unsigned char* samp = buf + 4;
|
||||
buf += sampLen + 4;
|
||||
uint32_t sdirLen = hecl::SBig(*reinterpret_cast<uint32_t*>(buf));
|
||||
unsigned char* sdir = buf + 4;
|
||||
|
||||
return {proj, projLen, pool, poolLen, sdir, sdirLen, samp, sampLen, amuse::GCNDataTag{}};
|
||||
return {proj, projLen, pool, poolLen, sdir, sdirLen, samp, sampLen, amuse::GCNDataTag{}};
|
||||
}
|
||||
|
||||
CAudioGroupSet::CAudioGroupSet(std::unique_ptr<u8[]>&& in)
|
||||
: m_buffer(std::move(in)), m_data(LoadData())
|
||||
{}
|
||||
CAudioGroupSet::CAudioGroupSet(std::unique_ptr<u8[]>&& in) : m_buffer(std::move(in)), m_data(LoadData()) {}
|
||||
|
||||
CFactoryFnReturn FAudioGroupSetDataFactory(const urde::SObjectTag& tag,
|
||||
std::unique_ptr<u8[]>&& in, u32 len,
|
||||
const urde::CVParamTransfer& vparms,
|
||||
CObjectReference* selfRef)
|
||||
{
|
||||
return TToken<CAudioGroupSet>::GetIObjObjectFor(std::make_unique<CAudioGroupSet>(std::move(in)));
|
||||
CFactoryFnReturn FAudioGroupSetDataFactory(const urde::SObjectTag& tag, std::unique_ptr<u8[]>&& in, u32 len,
|
||||
const urde::CVParamTransfer& vparms, CObjectReference* selfRef) {
|
||||
return TToken<CAudioGroupSet>::GetIObjObjectFor(std::make_unique<CAudioGroupSet>(std::move(in)));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace urde
|
||||
|
||||
@@ -7,26 +7,22 @@
|
||||
#include "IOStreams.hpp"
|
||||
#include "amuse/AudioGroupData.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace urde {
|
||||
|
||||
class CAudioGroupSet {
|
||||
std::unique_ptr<u8[]> m_buffer;
|
||||
std::string x10_baseName;
|
||||
std::string x20_name;
|
||||
amuse::AudioGroupData m_data;
|
||||
amuse::AudioGroupData LoadData();
|
||||
|
||||
class CAudioGroupSet
|
||||
{
|
||||
std::unique_ptr<u8[]> m_buffer;
|
||||
std::string x10_baseName;
|
||||
std::string x20_name;
|
||||
amuse::AudioGroupData m_data;
|
||||
amuse::AudioGroupData LoadData();
|
||||
public:
|
||||
CAudioGroupSet(std::unique_ptr<u8[]>&& in);
|
||||
const amuse::AudioGroupData& GetAudioGroupData() const {return m_data;}
|
||||
std::string_view GetName() const { return x20_name; }
|
||||
CAudioGroupSet(std::unique_ptr<u8[]>&& in);
|
||||
const amuse::AudioGroupData& GetAudioGroupData() const { return m_data; }
|
||||
std::string_view GetName() const { return x20_name; }
|
||||
};
|
||||
|
||||
CFactoryFnReturn FAudioGroupSetDataFactory(const urde::SObjectTag& tag,
|
||||
std::unique_ptr<u8[]>&& in, u32 len,
|
||||
const urde::CVParamTransfer& vparms,
|
||||
CObjectReference* selfRef);
|
||||
|
||||
}
|
||||
CFactoryFnReturn FAudioGroupSetDataFactory(const urde::SObjectTag& tag, std::unique_ptr<u8[]>&& in, u32 len,
|
||||
const urde::CVParamTransfer& vparms, CObjectReference* selfRef);
|
||||
|
||||
} // namespace urde
|
||||
|
||||
@@ -2,121 +2,90 @@
|
||||
#include "CSimplePool.hpp"
|
||||
#include "CAudioGroupSet.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace urde {
|
||||
|
||||
CAudioSys* CAudioSys::g_SharedSys = nullptr;
|
||||
static std::unordered_map<std::string, TLockedToken<CAudioGroupSet>> mpGroupSetDB;
|
||||
static std::unordered_map<CAssetId, std::string> mpGroupSetResNameDB;
|
||||
static const std::string mpDefaultInvalidString = "NULL";
|
||||
|
||||
TLockedToken<CAudioGroupSet> CAudioSys::FindGroupSet(std::string_view name)
|
||||
{
|
||||
auto search = mpGroupSetDB.find(name.data());
|
||||
if (search == mpGroupSetDB.cend())
|
||||
return {};
|
||||
return search->second;
|
||||
TLockedToken<CAudioGroupSet> CAudioSys::FindGroupSet(std::string_view name) {
|
||||
auto search = mpGroupSetDB.find(name.data());
|
||||
if (search == mpGroupSetDB.cend())
|
||||
return {};
|
||||
return search->second;
|
||||
}
|
||||
|
||||
std::string_view CAudioSys::SysGetGroupSetName(CAssetId id)
|
||||
{
|
||||
auto search = mpGroupSetResNameDB.find(id);
|
||||
if (search == mpGroupSetResNameDB.cend())
|
||||
return mpDefaultInvalidString;
|
||||
return search->second;
|
||||
std::string_view CAudioSys::SysGetGroupSetName(CAssetId id) {
|
||||
auto search = mpGroupSetResNameDB.find(id);
|
||||
if (search == mpGroupSetResNameDB.cend())
|
||||
return mpDefaultInvalidString;
|
||||
return search->second;
|
||||
}
|
||||
|
||||
bool CAudioSys::SysLoadGroupSet(CSimplePool* pool, CAssetId id)
|
||||
{
|
||||
if (!FindGroupSet(SysGetGroupSetName(id)))
|
||||
{
|
||||
TLockedToken<CAudioGroupSet> set = pool->GetObj(SObjectTag{FOURCC('AGSC'), id});
|
||||
mpGroupSetDB.emplace(std::make_pair(set->GetName(), set));
|
||||
mpGroupSetResNameDB.emplace(std::make_pair(id, set->GetName()));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool CAudioSys::SysLoadGroupSet(CSimplePool* pool, CAssetId id) {
|
||||
if (!FindGroupSet(SysGetGroupSetName(id))) {
|
||||
TLockedToken<CAudioGroupSet> set = pool->GetObj(SObjectTag{FOURCC('AGSC'), id});
|
||||
mpGroupSetDB.emplace(std::make_pair(set->GetName(), set));
|
||||
mpGroupSetResNameDB.emplace(std::make_pair(id, set->GetName()));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CAudioSys::SysLoadGroupSet(const TLockedToken<CAudioGroupSet>& set, std::string_view name, CAssetId id)
|
||||
{
|
||||
if (!FindGroupSet(name))
|
||||
{
|
||||
mpGroupSetDB.emplace(std::make_pair(set->GetName(), set));
|
||||
mpGroupSetResNameDB.emplace(std::make_pair(id, set->GetName()));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool CAudioSys::SysLoadGroupSet(const TLockedToken<CAudioGroupSet>& set, std::string_view name, CAssetId id) {
|
||||
if (!FindGroupSet(name)) {
|
||||
mpGroupSetDB.emplace(std::make_pair(set->GetName(), set));
|
||||
mpGroupSetResNameDB.emplace(std::make_pair(id, set->GetName()));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioSys::SysUnloadAudioGroupSet(std::string_view name)
|
||||
{
|
||||
auto set = FindGroupSet(name);
|
||||
if (!set)
|
||||
return;
|
||||
void CAudioSys::SysUnloadAudioGroupSet(std::string_view name) {
|
||||
auto set = FindGroupSet(name);
|
||||
if (!set)
|
||||
return;
|
||||
|
||||
mpGroupSetDB.erase(name.data());
|
||||
mpGroupSetResNameDB.erase(set.GetObjectTag()->id);
|
||||
mpGroupSetDB.erase(name.data());
|
||||
mpGroupSetResNameDB.erase(set.GetObjectTag()->id);
|
||||
}
|
||||
|
||||
bool CAudioSys::SysIsGroupSetLoaded(std::string_view name)
|
||||
{
|
||||
return FindGroupSet(name).operator bool();
|
||||
bool CAudioSys::SysIsGroupSetLoaded(std::string_view name) { return FindGroupSet(name).operator bool(); }
|
||||
|
||||
void CAudioSys::SysAddGroupIntoAmuse(std::string_view name) {
|
||||
if (auto set = FindGroupSet(name))
|
||||
AddAudioGroup(set->GetAudioGroupData());
|
||||
}
|
||||
|
||||
void CAudioSys::SysAddGroupIntoAmuse(std::string_view name)
|
||||
{
|
||||
if (auto set = FindGroupSet(name))
|
||||
AddAudioGroup(set->GetAudioGroupData());
|
||||
}
|
||||
|
||||
void CAudioSys::SysRemoveGroupFromAmuse(std::string_view name)
|
||||
{
|
||||
if (auto set = FindGroupSet(name))
|
||||
RemoveAudioGroup(set->GetAudioGroupData());
|
||||
void CAudioSys::SysRemoveGroupFromAmuse(std::string_view name) {
|
||||
if (auto set = FindGroupSet(name))
|
||||
RemoveAudioGroup(set->GetAudioGroupData());
|
||||
}
|
||||
|
||||
static float s_MasterVol = 1.f;
|
||||
static float s_SfxVol = 1.f;
|
||||
void CAudioSys::_UpdateVolume()
|
||||
{
|
||||
GetAmuseEngine().setVolume(s_MasterVol * s_SfxVol);
|
||||
void CAudioSys::_UpdateVolume() { GetAmuseEngine().setVolume(s_MasterVol * s_SfxVol); }
|
||||
|
||||
void CAudioSys::SysSetVolume(u8 volume) {
|
||||
s_MasterVol = volume / 127.f;
|
||||
_UpdateVolume();
|
||||
}
|
||||
|
||||
void CAudioSys::SysSetVolume(u8 volume)
|
||||
{
|
||||
s_MasterVol = volume / 127.f;
|
||||
_UpdateVolume();
|
||||
}
|
||||
|
||||
void CAudioSys::SysSetSfxVolume(u8 volume, u16 time, bool music, bool fx)
|
||||
{
|
||||
s_SfxVol = volume / 127.f;
|
||||
_UpdateVolume();
|
||||
void CAudioSys::SysSetSfxVolume(u8 volume, u16 time, bool music, bool fx) {
|
||||
s_SfxVol = volume / 127.f;
|
||||
_UpdateVolume();
|
||||
}
|
||||
|
||||
static s16 s_VolumeScale = 0x7f;
|
||||
static s16 s_DefaultVolumeScale = 0x7f;
|
||||
|
||||
s16 CAudioSys::GetDefaultVolumeScale()
|
||||
{
|
||||
return s_DefaultVolumeScale;
|
||||
}
|
||||
s16 CAudioSys::GetDefaultVolumeScale() { return s_DefaultVolumeScale; }
|
||||
|
||||
void CAudioSys::SetDefaultVolumeScale(s16 scale)
|
||||
{
|
||||
s_DefaultVolumeScale = scale;
|
||||
}
|
||||
void CAudioSys::SetDefaultVolumeScale(s16 scale) { s_DefaultVolumeScale = scale; }
|
||||
|
||||
void CAudioSys::SetVolumeScale(s16 scale)
|
||||
{
|
||||
s_VolumeScale = scale;
|
||||
}
|
||||
void CAudioSys::SetVolumeScale(s16 scale) { s_VolumeScale = scale; }
|
||||
|
||||
}
|
||||
} // namespace urde
|
||||
|
||||
@@ -7,91 +7,61 @@
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CToken.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace urde {
|
||||
class CSimplePool;
|
||||
class CAudioGroupSet;
|
||||
|
||||
CFactoryFnReturn FAudioTranslationTableFactory(const SObjectTag& tag, CInputStream& in,
|
||||
const CVParamTransfer& vparms,
|
||||
CFactoryFnReturn FAudioTranslationTableFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
|
||||
CObjectReference* selfRef);
|
||||
|
||||
class CAudioSys
|
||||
{
|
||||
class CAudioSys {
|
||||
public:
|
||||
enum class ESurroundModes
|
||||
{
|
||||
Mono,
|
||||
Stereo,
|
||||
Surround
|
||||
};
|
||||
enum class ESurroundModes { Mono, Stereo, Surround };
|
||||
|
||||
private:
|
||||
static CAudioSys* g_SharedSys;
|
||||
boo::IAudioVoiceEngine* m_voiceEngine;
|
||||
amuse::Engine m_engine;
|
||||
static void _UpdateVolume();
|
||||
static CAudioSys* g_SharedSys;
|
||||
boo::IAudioVoiceEngine* m_voiceEngine;
|
||||
amuse::Engine m_engine;
|
||||
static void _UpdateVolume();
|
||||
|
||||
public:
|
||||
struct C3DEmitterParmData
|
||||
{
|
||||
zeus::CVector3f x0_pos;
|
||||
zeus::CVector3f xc_dir;
|
||||
float x18_maxDist;
|
||||
float x1c_distComp;
|
||||
u32 x20_flags;
|
||||
u16 x24_sfxId;
|
||||
float x26_maxVol;
|
||||
float x27_minVol;
|
||||
bool x28_important; // Can't be allocated over, regardless of priority
|
||||
u8 x29_prio;
|
||||
};
|
||||
CAudioSys(boo::IAudioVoiceEngine* voiceEngine,
|
||||
amuse::IBackendVoiceAllocator& backend, u8,u8,u8,u8,u32)
|
||||
: m_voiceEngine(voiceEngine), m_engine(backend)
|
||||
{
|
||||
g_SharedSys = this;
|
||||
}
|
||||
~CAudioSys()
|
||||
{
|
||||
g_SharedSys = nullptr;
|
||||
}
|
||||
struct C3DEmitterParmData {
|
||||
zeus::CVector3f x0_pos;
|
||||
zeus::CVector3f xc_dir;
|
||||
float x18_maxDist;
|
||||
float x1c_distComp;
|
||||
u32 x20_flags;
|
||||
u16 x24_sfxId;
|
||||
float x26_maxVol;
|
||||
float x27_minVol;
|
||||
bool x28_important; // Can't be allocated over, regardless of priority
|
||||
u8 x29_prio;
|
||||
};
|
||||
CAudioSys(boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend, u8, u8, u8, u8, u32)
|
||||
: m_voiceEngine(voiceEngine), m_engine(backend) {
|
||||
g_SharedSys = this;
|
||||
}
|
||||
~CAudioSys() { g_SharedSys = nullptr; }
|
||||
|
||||
static void AddAudioGroup(const amuse::AudioGroupData& data)
|
||||
{
|
||||
g_SharedSys->m_engine.addAudioGroup(data);
|
||||
}
|
||||
static void RemoveAudioGroup(const amuse::AudioGroupData& data)
|
||||
{
|
||||
g_SharedSys->m_engine.removeAudioGroup(data);
|
||||
}
|
||||
static boo::IAudioVoiceEngine* GetVoiceEngine()
|
||||
{
|
||||
return g_SharedSys->m_voiceEngine;
|
||||
}
|
||||
static amuse::Engine& GetAmuseEngine()
|
||||
{
|
||||
return g_SharedSys->m_engine;
|
||||
}
|
||||
static void SetSurroundMode(ESurroundModes mode)
|
||||
{
|
||||
static void AddAudioGroup(const amuse::AudioGroupData& data) { g_SharedSys->m_engine.addAudioGroup(data); }
|
||||
static void RemoveAudioGroup(const amuse::AudioGroupData& data) { g_SharedSys->m_engine.removeAudioGroup(data); }
|
||||
static boo::IAudioVoiceEngine* GetVoiceEngine() { return g_SharedSys->m_voiceEngine; }
|
||||
static amuse::Engine& GetAmuseEngine() { return g_SharedSys->m_engine; }
|
||||
static void SetSurroundMode(ESurroundModes mode) {}
|
||||
static TLockedToken<CAudioGroupSet> FindGroupSet(std::string_view name);
|
||||
static std::string_view SysGetGroupSetName(CAssetId id);
|
||||
static bool SysLoadGroupSet(CSimplePool* pool, CAssetId id);
|
||||
static bool SysLoadGroupSet(const TLockedToken<CAudioGroupSet>& set, std::string_view name, CAssetId id);
|
||||
static void SysUnloadAudioGroupSet(std::string_view name);
|
||||
static bool SysIsGroupSetLoaded(std::string_view name);
|
||||
static void SysAddGroupIntoAmuse(std::string_view name);
|
||||
static void SysRemoveGroupFromAmuse(std::string_view name);
|
||||
static void SysSetVolume(u8 volume);
|
||||
static void SysSetSfxVolume(u8 volume, u16 time, bool music, bool fx);
|
||||
|
||||
}
|
||||
static TLockedToken<CAudioGroupSet> FindGroupSet(std::string_view name);
|
||||
static std::string_view SysGetGroupSetName(CAssetId id);
|
||||
static bool SysLoadGroupSet(CSimplePool* pool, CAssetId id);
|
||||
static bool SysLoadGroupSet(const TLockedToken<CAudioGroupSet>& set, std::string_view name, CAssetId id);
|
||||
static void SysUnloadAudioGroupSet(std::string_view name);
|
||||
static bool SysIsGroupSetLoaded(std::string_view name);
|
||||
static void SysAddGroupIntoAmuse(std::string_view name);
|
||||
static void SysRemoveGroupFromAmuse(std::string_view name);
|
||||
static void SysSetVolume(u8 volume);
|
||||
static void SysSetSfxVolume(u8 volume, u16 time, bool music, bool fx);
|
||||
|
||||
static s16 GetDefaultVolumeScale();
|
||||
static void SetDefaultVolumeScale(s16 scale);
|
||||
static void SetVolumeScale(s16 scale);
|
||||
static s16 GetDefaultVolumeScale();
|
||||
static void SetDefaultVolumeScale(s16 scale);
|
||||
static void SetVolumeScale(s16 scale);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
||||
@@ -1,60 +1,52 @@
|
||||
#include "CMidiManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace urde {
|
||||
|
||||
std::unordered_set<CMidiHandle> CMidiManager::m_MidiWrappers = {};
|
||||
|
||||
void CMidiManager::StopAll()
|
||||
{
|
||||
for (auto it = m_MidiWrappers.begin() ; it != m_MidiWrappers.end() ;)
|
||||
it = Stop(it, 0.f);
|
||||
void CMidiManager::StopAll() {
|
||||
for (auto it = m_MidiWrappers.begin(); it != m_MidiWrappers.end();)
|
||||
it = Stop(it, 0.f);
|
||||
}
|
||||
|
||||
void CMidiManager::Stop(const CMidiHandle& handle, float fadeTime)
|
||||
{
|
||||
handle->GetAudioSysHandle()->stopSong(fadeTime);
|
||||
m_MidiWrappers.erase(handle);
|
||||
void CMidiManager::Stop(const CMidiHandle& handle, float fadeTime) {
|
||||
handle->GetAudioSysHandle()->stopSong(fadeTime);
|
||||
m_MidiWrappers.erase(handle);
|
||||
}
|
||||
|
||||
std::unordered_set<CMidiHandle>::iterator
|
||||
CMidiManager::Stop(std::unordered_set<CMidiHandle>::iterator handle, float fadeTime)
|
||||
{
|
||||
const CMidiHandle& h = *handle;
|
||||
h->GetAudioSysHandle()->stopSong(fadeTime);
|
||||
return m_MidiWrappers.erase(handle);
|
||||
std::unordered_set<CMidiHandle>::iterator CMidiManager::Stop(std::unordered_set<CMidiHandle>::iterator handle,
|
||||
float fadeTime) {
|
||||
const CMidiHandle& h = *handle;
|
||||
h->GetAudioSysHandle()->stopSong(fadeTime);
|
||||
return m_MidiWrappers.erase(handle);
|
||||
}
|
||||
|
||||
CMidiHandle CMidiManager::Play(const CMidiData& data, float fadeTime, bool stopExisting, float volume)
|
||||
{
|
||||
if (stopExisting)
|
||||
for (auto it = m_MidiWrappers.begin() ; it != m_MidiWrappers.end() ;)
|
||||
it = Stop(it, fadeTime);
|
||||
CMidiHandle CMidiManager::Play(const CMidiData& data, float fadeTime, bool stopExisting, float volume) {
|
||||
if (stopExisting)
|
||||
for (auto it = m_MidiWrappers.begin(); it != m_MidiWrappers.end();)
|
||||
it = Stop(it, fadeTime);
|
||||
|
||||
CMidiHandle handle = *m_MidiWrappers.insert(std::make_shared<CMidiWrapper>()).first;
|
||||
handle->SetAudioSysHandle(CAudioSys::GetAmuseEngine().seqPlay(
|
||||
data.GetGroupId(), data.GetSetupId(), data.GetArrData()));
|
||||
handle->GetAudioSysHandle()->setVolume(volume, fadeTime);
|
||||
handle->SetSongId(data.GetSetupId());
|
||||
return handle;
|
||||
CMidiHandle handle = *m_MidiWrappers.insert(std::make_shared<CMidiWrapper>()).first;
|
||||
handle->SetAudioSysHandle(
|
||||
CAudioSys::GetAmuseEngine().seqPlay(data.GetGroupId(), data.GetSetupId(), data.GetArrData()));
|
||||
handle->GetAudioSysHandle()->setVolume(volume, fadeTime);
|
||||
handle->SetSongId(data.GetSetupId());
|
||||
return handle;
|
||||
}
|
||||
|
||||
CMidiManager::CMidiData::CMidiData(CInputStream& in)
|
||||
{
|
||||
in.readUint32Big();
|
||||
x0_setupId = in.readUint32Big();
|
||||
x2_groupId = in.readUint32Big();
|
||||
x4_agscId = in.readUint32Big();
|
||||
u32 length = in.readUint32Big();
|
||||
x8_arrData.reset(new u8[length]);
|
||||
in.readUBytesToBuf(x8_arrData.get(), length);
|
||||
CMidiManager::CMidiData::CMidiData(CInputStream& in) {
|
||||
in.readUint32Big();
|
||||
x0_setupId = in.readUint32Big();
|
||||
x2_groupId = in.readUint32Big();
|
||||
x4_agscId = in.readUint32Big();
|
||||
u32 length = in.readUint32Big();
|
||||
x8_arrData.reset(new u8[length]);
|
||||
in.readUBytesToBuf(x8_arrData.get(), length);
|
||||
}
|
||||
|
||||
CFactoryFnReturn FMidiDataFactory(const SObjectTag& tag, CInputStream& in,
|
||||
const CVParamTransfer& parms,
|
||||
CObjectReference* selfRef)
|
||||
{
|
||||
return TToken<CMidiManager::CMidiData>::GetIObjObjectFor(std::make_unique<CMidiManager::CMidiData>(in));
|
||||
CFactoryFnReturn FMidiDataFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& parms,
|
||||
CObjectReference* selfRef) {
|
||||
return TToken<CMidiManager::CMidiData>::GetIObjObjectFor(std::make_unique<CMidiManager::CMidiData>(in));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace urde
|
||||
|
||||
@@ -2,59 +2,55 @@
|
||||
|
||||
#include "CSfxManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace urde {
|
||||
|
||||
class CMidiManager
|
||||
{
|
||||
class CMidiManager {
|
||||
public:
|
||||
class CMidiData
|
||||
{
|
||||
u16 x0_setupId;
|
||||
u16 x2_groupId;
|
||||
CAssetId x4_agscId;
|
||||
std::unique_ptr<u8[]> x8_arrData;
|
||||
public:
|
||||
u16 GetSetupId() const { return x0_setupId; }
|
||||
u16 GetGroupId() const { return x2_groupId; }
|
||||
CAssetId GetAGSCAssetId() const { return x4_agscId; }
|
||||
const u8* GetArrData() const { return x8_arrData.get(); }
|
||||
CMidiData(CInputStream& in);
|
||||
};
|
||||
class CMidiData {
|
||||
u16 x0_setupId;
|
||||
u16 x2_groupId;
|
||||
CAssetId x4_agscId;
|
||||
std::unique_ptr<u8[]> x8_arrData;
|
||||
|
||||
class CMidiWrapper
|
||||
{
|
||||
amuse::ObjToken<amuse::Sequencer> x0_sequencer;
|
||||
//CSfxHandle x4_handle;
|
||||
u16 x8_songId;
|
||||
bool xa_available = true;
|
||||
public:
|
||||
amuse::ObjToken<amuse::Sequencer> GetAudioSysHandle() const { return x0_sequencer; }
|
||||
void SetAudioSysHandle(amuse::ObjToken<amuse::Sequencer> sequencer) { x0_sequencer = sequencer; }
|
||||
//const CSfxHandle& GetManagerHandle() const { return x4_handle; }
|
||||
//void SetMidiHandle(const CSfxHandle& handle) { x4_handle = handle; }
|
||||
bool IsAvailable() const { return xa_available; }
|
||||
void SetAvailable(bool available) { xa_available = available; }
|
||||
u16 GetSongId() const { return x8_songId; }
|
||||
void SetSongId(u16 songId) { x8_songId = songId; }
|
||||
};
|
||||
using CMidiHandle = std::shared_ptr<CMidiWrapper>;
|
||||
public:
|
||||
u16 GetSetupId() const { return x0_setupId; }
|
||||
u16 GetGroupId() const { return x2_groupId; }
|
||||
CAssetId GetAGSCAssetId() const { return x4_agscId; }
|
||||
const u8* GetArrData() const { return x8_arrData.get(); }
|
||||
CMidiData(CInputStream& in);
|
||||
};
|
||||
|
||||
static void StopAll();
|
||||
static void Stop(const CMidiHandle& handle, float fadeTime);
|
||||
static std::unordered_set<CMidiHandle>::iterator
|
||||
Stop(std::unordered_set<CMidiHandle>::iterator handle, float fadeTime);
|
||||
static CMidiHandle Play(const CMidiData& data, float fadeTime, bool stopExisting, float volume);
|
||||
class CMidiWrapper {
|
||||
amuse::ObjToken<amuse::Sequencer> x0_sequencer;
|
||||
// CSfxHandle x4_handle;
|
||||
u16 x8_songId;
|
||||
bool xa_available = true;
|
||||
|
||||
public:
|
||||
amuse::ObjToken<amuse::Sequencer> GetAudioSysHandle() const { return x0_sequencer; }
|
||||
void SetAudioSysHandle(amuse::ObjToken<amuse::Sequencer> sequencer) { x0_sequencer = sequencer; }
|
||||
// const CSfxHandle& GetManagerHandle() const { return x4_handle; }
|
||||
// void SetMidiHandle(const CSfxHandle& handle) { x4_handle = handle; }
|
||||
bool IsAvailable() const { return xa_available; }
|
||||
void SetAvailable(bool available) { xa_available = available; }
|
||||
u16 GetSongId() const { return x8_songId; }
|
||||
void SetSongId(u16 songId) { x8_songId = songId; }
|
||||
};
|
||||
using CMidiHandle = std::shared_ptr<CMidiWrapper>;
|
||||
|
||||
static void StopAll();
|
||||
static void Stop(const CMidiHandle& handle, float fadeTime);
|
||||
static std::unordered_set<CMidiHandle>::iterator Stop(std::unordered_set<CMidiHandle>::iterator handle,
|
||||
float fadeTime);
|
||||
static CMidiHandle Play(const CMidiData& data, float fadeTime, bool stopExisting, float volume);
|
||||
|
||||
private:
|
||||
static std::unordered_set<CMidiHandle> m_MidiWrappers;
|
||||
static std::unordered_set<CMidiHandle> m_MidiWrappers;
|
||||
};
|
||||
|
||||
CFactoryFnReturn FMidiDataFactory(const SObjectTag& tag, CInputStream& in,
|
||||
const CVParamTransfer& parms,
|
||||
CFactoryFnReturn FMidiDataFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& parms,
|
||||
CObjectReference* selfRef);
|
||||
|
||||
using CMidiHandle = CMidiManager::CMidiHandle;
|
||||
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,256 +6,238 @@
|
||||
#include "CAudioSys.hpp"
|
||||
#include "DNAMP1/SFX/SFX.h"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace urde {
|
||||
|
||||
class CSfxManager {
|
||||
static std::vector<u16>* mpSfxTranslationTable;
|
||||
|
||||
class CSfxManager
|
||||
{
|
||||
static std::vector<u16>* mpSfxTranslationTable;
|
||||
public:
|
||||
enum class ESfxChannels { Invalid = -1, Default = 0, Game, PauseScreen };
|
||||
|
||||
enum class ESfxChannels
|
||||
{
|
||||
Invalid = -1,
|
||||
Default = 0,
|
||||
Game,
|
||||
PauseScreen
|
||||
};
|
||||
enum class ESfxAudibility { Aud0, Aud1, Aud2, Aud3 };
|
||||
|
||||
enum class ESfxAudibility
|
||||
{
|
||||
Aud0,
|
||||
Aud1,
|
||||
Aud2,
|
||||
Aud3
|
||||
};
|
||||
enum class EAuxEffect { None = -1, ReverbHi = 0, Chorus, ReverbStd, Delay };
|
||||
|
||||
enum class EAuxEffect
|
||||
{
|
||||
None = -1,
|
||||
ReverbHi = 0,
|
||||
Chorus,
|
||||
ReverbStd,
|
||||
Delay
|
||||
};
|
||||
class CBaseSfxWrapper;
|
||||
using CSfxHandle = std::shared_ptr<CBaseSfxWrapper>;
|
||||
|
||||
class CBaseSfxWrapper;
|
||||
using CSfxHandle = std::shared_ptr<CBaseSfxWrapper>;
|
||||
/* Original imp, kept for reference
|
||||
class CSfxHandle
|
||||
{
|
||||
static u32 mRefCount;
|
||||
u32 x0_idx;
|
||||
public:
|
||||
CSfxHandle(u32 id)
|
||||
: x0_idx(++mRefCount << 14 | (id & 0xFFFF)) {}
|
||||
};
|
||||
*/
|
||||
|
||||
/* Original imp, kept for reference
|
||||
class CSfxHandle
|
||||
{
|
||||
static u32 mRefCount;
|
||||
u32 x0_idx;
|
||||
public:
|
||||
CSfxHandle(u32 id)
|
||||
: x0_idx(++mRefCount << 14 | (id & 0xFFFF)) {}
|
||||
};
|
||||
class CSfxChannel {
|
||||
friend class CSfxManager;
|
||||
zeus::CVector3f x0_pos;
|
||||
zeus::CVector3f xc_;
|
||||
zeus::CVector3f x18_;
|
||||
zeus::CVector3f x24_;
|
||||
/*
|
||||
float x30_ = 0.f;
|
||||
float x34_ = 0.f;
|
||||
float x38_ = 0.f;
|
||||
u32 x3c_ = 0;
|
||||
bool x40_ = false;
|
||||
*/
|
||||
bool x44_listenerActive = false;
|
||||
std::unordered_set<CSfxHandle> x48_handles;
|
||||
};
|
||||
|
||||
class CSfxChannel
|
||||
{
|
||||
friend class CSfxManager;
|
||||
zeus::CVector3f x0_pos;
|
||||
zeus::CVector3f xc_;
|
||||
zeus::CVector3f x18_;
|
||||
zeus::CVector3f x24_;
|
||||
/*
|
||||
float x30_ = 0.f;
|
||||
float x34_ = 0.f;
|
||||
float x38_ = 0.f;
|
||||
u32 x3c_ = 0;
|
||||
bool x40_ = false;
|
||||
*/
|
||||
bool x44_listenerActive = false;
|
||||
std::unordered_set<CSfxHandle> x48_handles;
|
||||
};
|
||||
class CBaseSfxWrapper : public std::enable_shared_from_this<CBaseSfxWrapper> {
|
||||
float x4_timeRemaining = 15.f;
|
||||
s16 x8_rank = 0;
|
||||
s16 xa_prio;
|
||||
// CSfxHandle xc_handle;
|
||||
TAreaId x10_area;
|
||||
bool x14_24_isActive : 1;
|
||||
bool x14_25_isPlaying : 1;
|
||||
bool x14_26_looped : 1;
|
||||
bool x14_27_inArea : 1;
|
||||
bool x14_28_isReleased : 1;
|
||||
bool x14_29_useAcoustics : 1;
|
||||
|
||||
class CBaseSfxWrapper : public std::enable_shared_from_this<CBaseSfxWrapper>
|
||||
{
|
||||
float x4_timeRemaining = 15.f;
|
||||
s16 x8_rank = 0;
|
||||
s16 xa_prio;
|
||||
//CSfxHandle xc_handle;
|
||||
TAreaId x10_area;
|
||||
bool x14_24_isActive:1;
|
||||
bool x14_25_isPlaying:1;
|
||||
bool x14_26_looped:1;
|
||||
bool x14_27_inArea:1;
|
||||
bool x14_28_isReleased:1;
|
||||
bool x14_29_useAcoustics:1;
|
||||
protected:
|
||||
bool m_isEmitter:1;
|
||||
bool m_isClosed:1;
|
||||
public:
|
||||
virtual ~CBaseSfxWrapper() = default;
|
||||
virtual void SetActive(bool v) { x14_24_isActive = v; }
|
||||
virtual void SetPlaying(bool v) { x14_25_isPlaying = v; }
|
||||
virtual void SetRank(short v) { x8_rank = v; }
|
||||
virtual void SetInArea(bool v) { x14_27_inArea = v; }
|
||||
virtual bool IsInArea() const { return x14_27_inArea; }
|
||||
virtual bool IsPlaying() const { return x14_25_isPlaying; }
|
||||
virtual bool UseAcoustics() const { return x14_29_useAcoustics; }
|
||||
virtual bool IsLooped() const { return x14_26_looped; }
|
||||
virtual bool IsActive() const { return x14_24_isActive; }
|
||||
virtual s16 GetRank() const { return x8_rank; }
|
||||
virtual s16 GetPriority() const { return xa_prio; }
|
||||
virtual TAreaId GetArea() const { return x10_area; }
|
||||
virtual CSfxHandle GetSfxHandle() { return shared_from_this(); }
|
||||
virtual void Play()=0;
|
||||
virtual void Stop()=0;
|
||||
virtual bool Ready()=0;
|
||||
virtual ESfxAudibility GetAudible(const zeus::CVector3f&)=0;
|
||||
virtual amuse::ObjToken<amuse::Voice> GetVoice() const=0;
|
||||
virtual u16 GetSfxId() const=0;
|
||||
virtual void UpdateEmitterSilent()=0;
|
||||
virtual void UpdateEmitter()=0;
|
||||
virtual void SetReverb(float rev)=0;
|
||||
bool IsEmitter() const { return m_isEmitter; }
|
||||
protected:
|
||||
bool m_isEmitter : 1;
|
||||
bool m_isClosed : 1;
|
||||
|
||||
void Release() { x14_28_isReleased = true; x4_timeRemaining = 15.f; }
|
||||
bool IsReleased() const { return x14_28_isReleased; }
|
||||
public:
|
||||
virtual ~CBaseSfxWrapper() = default;
|
||||
virtual void SetActive(bool v) { x14_24_isActive = v; }
|
||||
virtual void SetPlaying(bool v) { x14_25_isPlaying = v; }
|
||||
virtual void SetRank(short v) { x8_rank = v; }
|
||||
virtual void SetInArea(bool v) { x14_27_inArea = v; }
|
||||
virtual bool IsInArea() const { return x14_27_inArea; }
|
||||
virtual bool IsPlaying() const { return x14_25_isPlaying; }
|
||||
virtual bool UseAcoustics() const { return x14_29_useAcoustics; }
|
||||
virtual bool IsLooped() const { return x14_26_looped; }
|
||||
virtual bool IsActive() const { return x14_24_isActive; }
|
||||
virtual s16 GetRank() const { return x8_rank; }
|
||||
virtual s16 GetPriority() const { return xa_prio; }
|
||||
virtual TAreaId GetArea() const { return x10_area; }
|
||||
virtual CSfxHandle GetSfxHandle() { return shared_from_this(); }
|
||||
virtual void Play() = 0;
|
||||
virtual void Stop() = 0;
|
||||
virtual bool Ready() = 0;
|
||||
virtual ESfxAudibility GetAudible(const zeus::CVector3f&) = 0;
|
||||
virtual amuse::ObjToken<amuse::Voice> GetVoice() const = 0;
|
||||
virtual u16 GetSfxId() const = 0;
|
||||
virtual void UpdateEmitterSilent() = 0;
|
||||
virtual void UpdateEmitter() = 0;
|
||||
virtual void SetReverb(float rev) = 0;
|
||||
bool IsEmitter() const { return m_isEmitter; }
|
||||
|
||||
void Close() { m_isClosed = true; }
|
||||
bool IsClosed() const { return m_isClosed; }
|
||||
void Release() {
|
||||
x14_28_isReleased = true;
|
||||
x4_timeRemaining = 15.f;
|
||||
}
|
||||
bool IsReleased() const { return x14_28_isReleased; }
|
||||
|
||||
float GetTimeRemaining() const { return x4_timeRemaining; }
|
||||
void SetTimeRemaining(float t) { x4_timeRemaining = t; }
|
||||
void Close() { m_isClosed = true; }
|
||||
bool IsClosed() const { return m_isClosed; }
|
||||
|
||||
CBaseSfxWrapper(bool looped, s16 prio, /*const CSfxHandle& handle,*/ bool useAcoustics, TAreaId area)
|
||||
: x8_rank(0), xa_prio(prio), /*xc_handle(handle),*/ x10_area(area), x14_24_isActive(true), x14_25_isPlaying(false),
|
||||
x14_26_looped(looped), x14_27_inArea(true), x14_28_isReleased(false), m_isClosed(false),
|
||||
x14_29_useAcoustics(useAcoustics) {}
|
||||
};
|
||||
float GetTimeRemaining() const { return x4_timeRemaining; }
|
||||
void SetTimeRemaining(float t) { x4_timeRemaining = t; }
|
||||
|
||||
class CSfxEmitterWrapper : public CBaseSfxWrapper
|
||||
{
|
||||
float x1a_reverb;
|
||||
CAudioSys::C3DEmitterParmData x24_parmData;
|
||||
amuse::ObjToken<amuse::Emitter> x50_emitterHandle;
|
||||
bool x54_ready = true;
|
||||
float x55_cachedMaxVol;
|
||||
public:
|
||||
bool IsPlaying() const;
|
||||
void Play();
|
||||
void Stop();
|
||||
bool Ready();
|
||||
ESfxAudibility GetAudible(const zeus::CVector3f&);
|
||||
amuse::ObjToken<amuse::Voice> GetVoice() const { return x50_emitterHandle->getVoice(); }
|
||||
u16 GetSfxId() const;
|
||||
void UpdateEmitterSilent();
|
||||
void UpdateEmitter();
|
||||
void SetReverb(float rev);
|
||||
CAudioSys::C3DEmitterParmData& GetEmitterData() { return x24_parmData; }
|
||||
CBaseSfxWrapper(bool looped, s16 prio, /*const CSfxHandle& handle,*/ bool useAcoustics, TAreaId area)
|
||||
: x8_rank(0)
|
||||
, xa_prio(prio)
|
||||
, /*xc_handle(handle),*/ x10_area(area)
|
||||
, x14_24_isActive(true)
|
||||
, x14_25_isPlaying(false)
|
||||
, x14_26_looped(looped)
|
||||
, x14_27_inArea(true)
|
||||
, x14_28_isReleased(false)
|
||||
, m_isClosed(false)
|
||||
, x14_29_useAcoustics(useAcoustics) {}
|
||||
};
|
||||
|
||||
amuse::ObjToken<amuse::Emitter> GetHandle() const { return x50_emitterHandle; }
|
||||
class CSfxEmitterWrapper : public CBaseSfxWrapper {
|
||||
float x1a_reverb;
|
||||
CAudioSys::C3DEmitterParmData x24_parmData;
|
||||
amuse::ObjToken<amuse::Emitter> x50_emitterHandle;
|
||||
bool x54_ready = true;
|
||||
float x55_cachedMaxVol;
|
||||
|
||||
CSfxEmitterWrapper(bool looped, s16 prio, const CAudioSys::C3DEmitterParmData& data,
|
||||
/*const CSfxHandle& handle,*/ bool useAcoustics, TAreaId area)
|
||||
: CBaseSfxWrapper(looped, prio, /*handle,*/ useAcoustics, area), x24_parmData(data)
|
||||
{
|
||||
m_isEmitter = true;
|
||||
}
|
||||
};
|
||||
public:
|
||||
bool IsPlaying() const;
|
||||
void Play();
|
||||
void Stop();
|
||||
bool Ready();
|
||||
ESfxAudibility GetAudible(const zeus::CVector3f&);
|
||||
amuse::ObjToken<amuse::Voice> GetVoice() const { return x50_emitterHandle->getVoice(); }
|
||||
u16 GetSfxId() const;
|
||||
void UpdateEmitterSilent();
|
||||
void UpdateEmitter();
|
||||
void SetReverb(float rev);
|
||||
CAudioSys::C3DEmitterParmData& GetEmitterData() { return x24_parmData; }
|
||||
|
||||
class CSfxWrapper : public CBaseSfxWrapper
|
||||
{
|
||||
u16 x18_sfxId;
|
||||
amuse::ObjToken<amuse::Voice> x1c_voiceHandle;
|
||||
float x20_vol;
|
||||
float x22_pan;
|
||||
bool x24_ready = true;
|
||||
public:
|
||||
bool IsPlaying() const;
|
||||
void Play();
|
||||
void Stop();
|
||||
bool Ready();
|
||||
ESfxAudibility GetAudible(const zeus::CVector3f&) { return ESfxAudibility::Aud3; }
|
||||
amuse::ObjToken<amuse::Voice> GetVoice() const { return x1c_voiceHandle; }
|
||||
u16 GetSfxId() const;
|
||||
void UpdateEmitterSilent();
|
||||
void UpdateEmitter();
|
||||
void SetReverb(float rev);
|
||||
void SetVolume(float vol) { x20_vol = vol; }
|
||||
amuse::ObjToken<amuse::Emitter> GetHandle() const { return x50_emitterHandle; }
|
||||
|
||||
CSfxWrapper(bool looped, s16 prio, u16 sfxId, float vol, float pan,
|
||||
/*const CSfxHandle& handle,*/ bool useAcoustics, TAreaId area)
|
||||
: CBaseSfxWrapper(looped, prio, /*handle,*/ useAcoustics, area),
|
||||
x18_sfxId(sfxId), x20_vol(vol), x22_pan(pan)
|
||||
{
|
||||
m_isEmitter = false;
|
||||
}
|
||||
};
|
||||
CSfxEmitterWrapper(bool looped, s16 prio, const CAudioSys::C3DEmitterParmData& data,
|
||||
/*const CSfxHandle& handle,*/ bool useAcoustics, TAreaId area)
|
||||
: CBaseSfxWrapper(looped, prio, /*handle,*/ useAcoustics, area), x24_parmData(data) {
|
||||
m_isEmitter = true;
|
||||
}
|
||||
};
|
||||
|
||||
static CSfxChannel m_channels[4];
|
||||
static ESfxChannels m_currentChannel;
|
||||
static bool m_doUpdate;
|
||||
static void* m_usedSounds;
|
||||
static bool m_muted;
|
||||
static bool m_auxProcessingEnabled;
|
||||
static float m_reverbAmount;
|
||||
static EAuxEffect m_activeEffect;
|
||||
static EAuxEffect m_nextEffect;
|
||||
static amuse::ObjToken<amuse::Listener> m_listener;
|
||||
class CSfxWrapper : public CBaseSfxWrapper {
|
||||
u16 x18_sfxId;
|
||||
amuse::ObjToken<amuse::Voice> x1c_voiceHandle;
|
||||
float x20_vol;
|
||||
float x22_pan;
|
||||
bool x24_ready = true;
|
||||
|
||||
static u16 kMaxPriority;
|
||||
static u16 kMedPriority;
|
||||
static u16 kInternalInvalidSfxId;
|
||||
static u32 kAllAreas;
|
||||
public:
|
||||
bool IsPlaying() const;
|
||||
void Play();
|
||||
void Stop();
|
||||
bool Ready();
|
||||
ESfxAudibility GetAudible(const zeus::CVector3f&) { return ESfxAudibility::Aud3; }
|
||||
amuse::ObjToken<amuse::Voice> GetVoice() const { return x1c_voiceHandle; }
|
||||
u16 GetSfxId() const;
|
||||
void UpdateEmitterSilent();
|
||||
void UpdateEmitter();
|
||||
void SetReverb(float rev);
|
||||
void SetVolume(float vol) { x20_vol = vol; }
|
||||
|
||||
static bool LoadTranslationTable(CSimplePool* pool, const SObjectTag* tag);
|
||||
static bool IsAuxProcessingEnabled() { return m_auxProcessingEnabled; }
|
||||
static void SetChannel(ESfxChannels);
|
||||
static void KillAll(ESfxChannels);
|
||||
static void TurnOnChannel(ESfxChannels);
|
||||
static void TurnOffChannel(ESfxChannels);
|
||||
static ESfxChannels GetCurrentChannel() {return m_currentChannel;}
|
||||
static void AddListener(ESfxChannels channel,
|
||||
const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||
const zeus::CVector3f& heading, const zeus::CVector3f& up,
|
||||
float frontRadius, float surroundRadius, float soundSpeed,
|
||||
u32 flags /* 0x1 for doppler */, float vol);
|
||||
static void UpdateListener(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||
const zeus::CVector3f& heading, const zeus::CVector3f& up,
|
||||
float vol);
|
||||
CSfxWrapper(bool looped, s16 prio, u16 sfxId, float vol, float pan,
|
||||
/*const CSfxHandle& handle,*/ bool useAcoustics, TAreaId area)
|
||||
: CBaseSfxWrapper(looped, prio, /*handle,*/ useAcoustics, area), x18_sfxId(sfxId), x20_vol(vol), x22_pan(pan) {
|
||||
m_isEmitter = false;
|
||||
}
|
||||
};
|
||||
|
||||
static bool PlaySound(const CSfxHandle& handle);
|
||||
static void StopSound(const CSfxHandle& handle);
|
||||
static s16 GetRank(CBaseSfxWrapper* sfx);
|
||||
static void ApplyReverb();
|
||||
static float GetReverbAmount();
|
||||
static void PitchBend(const CSfxHandle& handle, float pitch);
|
||||
static void SfxVolume(const CSfxHandle& handle, float vol);
|
||||
static void SfxSpan(const CSfxHandle& handle, float span);
|
||||
static u16 TranslateSFXID(u16);
|
||||
static void SfxStop(const CSfxHandle& handle);
|
||||
static CSfxHandle SfxStart(u16 id, float vol, float pan, bool useAcoustics, s16 prio, bool looped, s32 areaId);
|
||||
static bool IsPlaying(const CSfxHandle& handle);
|
||||
static void RemoveEmitter(const CSfxHandle& handle);
|
||||
static void UpdateEmitter(const CSfxHandle& handle, const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||
float maxVol);
|
||||
static CSfxHandle AddEmitter(u16 id, const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||
bool useAcoustics, bool looped, s16 prio, s32 areaId);
|
||||
static CSfxHandle AddEmitter(u16 id, const zeus::CVector3f& pos, const zeus::CVector3f& dir, float vol,
|
||||
bool useAcoustics, bool looped, s16 prio, s32 areaId);
|
||||
static CSfxHandle AddEmitter(const CAudioSys::C3DEmitterParmData& parmData,
|
||||
bool useAcoustics, s16 prio, bool looped, s32 areaId);
|
||||
static void StopAndRemoveAllEmitters();
|
||||
static void DisableAuxCallback();
|
||||
static void EnableAuxCallback();
|
||||
static void PrepareDelayCallback(const amuse::EffectDelayInfo& info);
|
||||
static void PrepareReverbStdCallback(const amuse::EffectReverbStdInfo& info);
|
||||
static void PrepareChorusCallback(const amuse::EffectChorusInfo& info);
|
||||
static void PrepareReverbHiCallback(const amuse::EffectReverbHiInfo& info);
|
||||
static void DisableAuxProcessing();
|
||||
static CSfxChannel m_channels[4];
|
||||
static ESfxChannels m_currentChannel;
|
||||
static bool m_doUpdate;
|
||||
static void* m_usedSounds;
|
||||
static bool m_muted;
|
||||
static bool m_auxProcessingEnabled;
|
||||
static float m_reverbAmount;
|
||||
static EAuxEffect m_activeEffect;
|
||||
static EAuxEffect m_nextEffect;
|
||||
static amuse::ObjToken<amuse::Listener> m_listener;
|
||||
|
||||
static void SetActiveAreas(const rstl::reserved_vector<TAreaId, 10>& areas);
|
||||
static u16 kMaxPriority;
|
||||
static u16 kMedPriority;
|
||||
static u16 kInternalInvalidSfxId;
|
||||
static u32 kAllAreas;
|
||||
|
||||
static void Update(float dt);
|
||||
static void Shutdown();
|
||||
static bool LoadTranslationTable(CSimplePool* pool, const SObjectTag* tag);
|
||||
static bool IsAuxProcessingEnabled() { return m_auxProcessingEnabled; }
|
||||
static void SetChannel(ESfxChannels);
|
||||
static void KillAll(ESfxChannels);
|
||||
static void TurnOnChannel(ESfxChannels);
|
||||
static void TurnOffChannel(ESfxChannels);
|
||||
static ESfxChannels GetCurrentChannel() { return m_currentChannel; }
|
||||
static void AddListener(ESfxChannels channel, const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||
const zeus::CVector3f& heading, const zeus::CVector3f& up, float frontRadius,
|
||||
float surroundRadius, float soundSpeed, u32 flags /* 0x1 for doppler */, float vol);
|
||||
static void UpdateListener(const zeus::CVector3f& pos, const zeus::CVector3f& dir, const zeus::CVector3f& heading,
|
||||
const zeus::CVector3f& up, float vol);
|
||||
|
||||
static bool PlaySound(const CSfxHandle& handle);
|
||||
static void StopSound(const CSfxHandle& handle);
|
||||
static s16 GetRank(CBaseSfxWrapper* sfx);
|
||||
static void ApplyReverb();
|
||||
static float GetReverbAmount();
|
||||
static void PitchBend(const CSfxHandle& handle, float pitch);
|
||||
static void SfxVolume(const CSfxHandle& handle, float vol);
|
||||
static void SfxSpan(const CSfxHandle& handle, float span);
|
||||
static u16 TranslateSFXID(u16);
|
||||
static void SfxStop(const CSfxHandle& handle);
|
||||
static CSfxHandle SfxStart(u16 id, float vol, float pan, bool useAcoustics, s16 prio, bool looped, s32 areaId);
|
||||
static bool IsPlaying(const CSfxHandle& handle);
|
||||
static void RemoveEmitter(const CSfxHandle& handle);
|
||||
static void UpdateEmitter(const CSfxHandle& handle, const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||
float maxVol);
|
||||
static CSfxHandle AddEmitter(u16 id, const zeus::CVector3f& pos, const zeus::CVector3f& dir, bool useAcoustics,
|
||||
bool looped, s16 prio, s32 areaId);
|
||||
static CSfxHandle AddEmitter(u16 id, const zeus::CVector3f& pos, const zeus::CVector3f& dir, float vol,
|
||||
bool useAcoustics, bool looped, s16 prio, s32 areaId);
|
||||
static CSfxHandle AddEmitter(const CAudioSys::C3DEmitterParmData& parmData, bool useAcoustics, s16 prio, bool looped,
|
||||
s32 areaId);
|
||||
static void StopAndRemoveAllEmitters();
|
||||
static void DisableAuxCallback();
|
||||
static void EnableAuxCallback();
|
||||
static void PrepareDelayCallback(const amuse::EffectDelayInfo& info);
|
||||
static void PrepareReverbStdCallback(const amuse::EffectReverbStdInfo& info);
|
||||
static void PrepareChorusCallback(const amuse::EffectChorusInfo& info);
|
||||
static void PrepareReverbHiCallback(const amuse::EffectReverbHiInfo& info);
|
||||
static void DisableAuxProcessing();
|
||||
|
||||
static void SetActiveAreas(const rstl::reserved_vector<TAreaId, 10>& areas);
|
||||
|
||||
static void Update(float dt);
|
||||
static void Shutdown();
|
||||
};
|
||||
|
||||
using CSfxHandle = CSfxManager::CSfxHandle;
|
||||
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
||||
@@ -2,110 +2,100 @@
|
||||
#include "CDvdFile.hpp"
|
||||
#include "CDvdRequest.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace urde {
|
||||
|
||||
#define RSF_BUFFER_SIZE 0x20000
|
||||
|
||||
CStaticAudioPlayer::CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, std::string_view path,
|
||||
int loopStart, int loopEnd)
|
||||
: x0_path(path), x1c_loopStartSamp(loopStart & 0xfffffffe), x20_loopEndSamp(loopEnd & 0xfffffffe),
|
||||
m_voiceCallback(*this), m_voice(engine.allocateNewStereoVoice(32000, &m_voiceCallback))
|
||||
{
|
||||
// These are mixed directly into boo voice engine instead
|
||||
//x28_dmaLeft.reset(new u8[640]);
|
||||
//x30_dmaRight.reset(new u8[640]);
|
||||
CStaticAudioPlayer::CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, std::string_view path, int loopStart,
|
||||
int loopEnd)
|
||||
: x0_path(path)
|
||||
, x1c_loopStartSamp(loopStart & 0xfffffffe)
|
||||
, x20_loopEndSamp(loopEnd & 0xfffffffe)
|
||||
, m_voiceCallback(*this)
|
||||
, m_voice(engine.allocateNewStereoVoice(32000, &m_voiceCallback)) {
|
||||
// These are mixed directly into boo voice engine instead
|
||||
// x28_dmaLeft.reset(new u8[640]);
|
||||
// x30_dmaRight.reset(new u8[640]);
|
||||
|
||||
CDvdFile file(path);
|
||||
x10_rsfRem = file.Length();
|
||||
x14_rsfLength = x10_rsfRem;
|
||||
CDvdFile file(path);
|
||||
x10_rsfRem = file.Length();
|
||||
x14_rsfLength = x10_rsfRem;
|
||||
|
||||
u32 bufCount = (x10_rsfRem + RSF_BUFFER_SIZE - 1) / RSF_BUFFER_SIZE;
|
||||
x48_buffers.reserve(bufCount);
|
||||
x38_dvdRequests.reserve(bufCount);
|
||||
u32 bufCount = (x10_rsfRem + RSF_BUFFER_SIZE - 1) / RSF_BUFFER_SIZE;
|
||||
x48_buffers.reserve(bufCount);
|
||||
x38_dvdRequests.reserve(bufCount);
|
||||
|
||||
for (int remBytes = x10_rsfRem; remBytes > 0; remBytes -= RSF_BUFFER_SIZE)
|
||||
{
|
||||
u32 thisSz = RSF_BUFFER_SIZE;
|
||||
if (remBytes < RSF_BUFFER_SIZE)
|
||||
thisSz = ROUND_UP_32(remBytes);
|
||||
for (int remBytes = x10_rsfRem; remBytes > 0; remBytes -= RSF_BUFFER_SIZE) {
|
||||
u32 thisSz = RSF_BUFFER_SIZE;
|
||||
if (remBytes < RSF_BUFFER_SIZE)
|
||||
thisSz = ROUND_UP_32(remBytes);
|
||||
|
||||
x48_buffers.emplace_back(new u8[thisSz]);
|
||||
x38_dvdRequests.push_back(file.AsyncRead(x48_buffers.back().get(), thisSz));
|
||||
}
|
||||
x48_buffers.emplace_back(new u8[thisSz]);
|
||||
x38_dvdRequests.push_back(file.AsyncRead(x48_buffers.back().get(), thisSz));
|
||||
}
|
||||
|
||||
g72x_init_state(&x58_leftState);
|
||||
g72x_init_state(&x8c_rightState);
|
||||
g72x_init_state(&x58_leftState);
|
||||
g72x_init_state(&x8c_rightState);
|
||||
}
|
||||
|
||||
bool CStaticAudioPlayer::IsReady()
|
||||
{
|
||||
if (x38_dvdRequests.size())
|
||||
return x38_dvdRequests.back()->IsComplete();
|
||||
return true;
|
||||
bool CStaticAudioPlayer::IsReady() {
|
||||
if (x38_dvdRequests.size())
|
||||
return x38_dvdRequests.back()->IsComplete();
|
||||
return true;
|
||||
}
|
||||
|
||||
void CStaticAudioPlayer::DecodeMonoAndMix(s16* bufOut, u32 numSamples,
|
||||
u32 cur, u32 loopEndCur, u32 loopStartCur,
|
||||
void CStaticAudioPlayer::DecodeMonoAndMix(s16* bufOut, u32 numSamples, u32 cur, u32 loopEndCur, u32 loopStartCur,
|
||||
int vol, g72x_state& state,
|
||||
std::experimental::optional<g72x_state>& loopState) const
|
||||
{
|
||||
for (u32 remBytes = numSamples / 2; remBytes;)
|
||||
{
|
||||
u32 curBuf = cur / RSF_BUFFER_SIZE;
|
||||
u32 thisBytes = (curBuf + 1) * RSF_BUFFER_SIZE - cur;
|
||||
thisBytes = std::min(thisBytes, remBytes);
|
||||
u32 remTillLoop = loopEndCur - cur;
|
||||
remTillLoop = std::min(remTillLoop, thisBytes);
|
||||
std::experimental::optional<g72x_state>& loopState) const {
|
||||
for (u32 remBytes = numSamples / 2; remBytes;) {
|
||||
u32 curBuf = cur / RSF_BUFFER_SIZE;
|
||||
u32 thisBytes = (curBuf + 1) * RSF_BUFFER_SIZE - cur;
|
||||
thisBytes = std::min(thisBytes, remBytes);
|
||||
u32 remTillLoop = loopEndCur - cur;
|
||||
remTillLoop = std::min(remTillLoop, thisBytes);
|
||||
|
||||
const std::unique_ptr<u8[]>& buf = x48_buffers[curBuf];
|
||||
const u8* byte = &buf[cur - curBuf * RSF_BUFFER_SIZE];
|
||||
const std::unique_ptr<u8[]>& buf = x48_buffers[curBuf];
|
||||
const u8* byte = &buf[cur - curBuf * RSF_BUFFER_SIZE];
|
||||
|
||||
for (u32 i=0; i<remTillLoop; ++i, ++byte)
|
||||
{
|
||||
if (!loopState && cur + i == loopStartCur)
|
||||
loopState.emplace(state);
|
||||
for (u32 i = 0; i < remTillLoop; ++i, ++byte) {
|
||||
if (!loopState && cur + i == loopStartCur)
|
||||
loopState.emplace(state);
|
||||
|
||||
*bufOut = SampClamp(((g721_decoder(*byte & 0xf, &state) * vol) >> 15));
|
||||
bufOut += 2;
|
||||
*bufOut = SampClamp(((g721_decoder(*byte & 0xf, &state) * vol) >> 15));
|
||||
bufOut += 2;
|
||||
|
||||
*bufOut = SampClamp(((g721_decoder(*byte >> 4 & 0xf, &state) * vol) >> 15));
|
||||
bufOut += 2;
|
||||
}
|
||||
|
||||
cur += remTillLoop;
|
||||
remBytes -= remTillLoop;
|
||||
if (cur == loopEndCur)
|
||||
{
|
||||
cur = loopStartCur;
|
||||
if (loopState)
|
||||
state = *loopState;
|
||||
}
|
||||
*bufOut = SampClamp(((g721_decoder(*byte >> 4 & 0xf, &state) * vol) >> 15));
|
||||
bufOut += 2;
|
||||
}
|
||||
}
|
||||
|
||||
void CStaticAudioPlayer::Decode(s16* bufOut, u32 numSamples)
|
||||
{
|
||||
DecodeMonoAndMix(bufOut, numSamples, x18_curSamp / 2,
|
||||
x20_loopEndSamp / 2, x1c_loopStartSamp / 2,
|
||||
xc0_volume, x58_leftState, m_leftStateLoop);
|
||||
|
||||
u32 halfway = x14_rsfLength / 2;
|
||||
DecodeMonoAndMix(bufOut + 1, numSamples, x18_curSamp / 2 + halfway,
|
||||
x20_loopEndSamp / 2 + halfway, x1c_loopStartSamp / 2 + halfway,
|
||||
xc0_volume, x8c_rightState, m_rightStateLoop);
|
||||
|
||||
for (u32 remSamples = numSamples; remSamples;)
|
||||
{
|
||||
u32 remTillLoop = x20_loopEndSamp - x18_curSamp;
|
||||
remTillLoop = std::min(remTillLoop, remSamples);
|
||||
|
||||
x18_curSamp += remTillLoop;
|
||||
remSamples -= remTillLoop;
|
||||
|
||||
if (x18_curSamp == x20_loopEndSamp)
|
||||
x18_curSamp = x1c_loopStartSamp;
|
||||
cur += remTillLoop;
|
||||
remBytes -= remTillLoop;
|
||||
if (cur == loopEndCur) {
|
||||
cur = loopStartCur;
|
||||
if (loopState)
|
||||
state = *loopState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CStaticAudioPlayer::Decode(s16* bufOut, u32 numSamples) {
|
||||
DecodeMonoAndMix(bufOut, numSamples, x18_curSamp / 2, x20_loopEndSamp / 2, x1c_loopStartSamp / 2, xc0_volume,
|
||||
x58_leftState, m_leftStateLoop);
|
||||
|
||||
u32 halfway = x14_rsfLength / 2;
|
||||
DecodeMonoAndMix(bufOut + 1, numSamples, x18_curSamp / 2 + halfway, x20_loopEndSamp / 2 + halfway,
|
||||
x1c_loopStartSamp / 2 + halfway, xc0_volume, x8c_rightState, m_rightStateLoop);
|
||||
|
||||
for (u32 remSamples = numSamples; remSamples;) {
|
||||
u32 remTillLoop = x20_loopEndSamp - x18_curSamp;
|
||||
remTillLoop = std::min(remTillLoop, remSamples);
|
||||
|
||||
x18_curSamp += remTillLoop;
|
||||
remSamples -= remTillLoop;
|
||||
|
||||
if (x18_curSamp == x20_loopEndSamp)
|
||||
x18_curSamp = x1c_loopStartSamp;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
||||
@@ -6,82 +6,63 @@
|
||||
#include "boo/audiodev/IAudioVoice.hpp"
|
||||
#include "boo/audiodev/IAudioVoiceEngine.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace urde {
|
||||
class IDvdRequest;
|
||||
|
||||
class CStaticAudioPlayer
|
||||
{
|
||||
std::string x0_path;
|
||||
u32 x10_rsfRem = -1;
|
||||
u32 x14_rsfLength;
|
||||
u32 x18_curSamp = 0;
|
||||
u32 x1c_loopStartSamp;
|
||||
u32 x20_loopEndSamp;
|
||||
//u32 x24_ = 0;
|
||||
//std::unique_ptr<u8[]> x28_dmaLeft;
|
||||
//std::unique_ptr<u8[]> x30_dmaRight;
|
||||
std::vector<std::shared_ptr<IDvdRequest>> x38_dvdRequests;
|
||||
std::vector<std::unique_ptr<u8[]>> x48_buffers;
|
||||
g72x_state x58_leftState;
|
||||
g72x_state x8c_rightState;
|
||||
std::experimental::optional<g72x_state> m_leftStateLoop;
|
||||
std::experimental::optional<g72x_state> m_rightStateLoop;
|
||||
u32 xc0_volume = 32768; // Out of 32768
|
||||
class CStaticAudioPlayer {
|
||||
std::string x0_path;
|
||||
u32 x10_rsfRem = -1;
|
||||
u32 x14_rsfLength;
|
||||
u32 x18_curSamp = 0;
|
||||
u32 x1c_loopStartSamp;
|
||||
u32 x20_loopEndSamp;
|
||||
// u32 x24_ = 0;
|
||||
// std::unique_ptr<u8[]> x28_dmaLeft;
|
||||
// std::unique_ptr<u8[]> x30_dmaRight;
|
||||
std::vector<std::shared_ptr<IDvdRequest>> x38_dvdRequests;
|
||||
std::vector<std::unique_ptr<u8[]>> x48_buffers;
|
||||
g72x_state x58_leftState;
|
||||
g72x_state x8c_rightState;
|
||||
std::experimental::optional<g72x_state> m_leftStateLoop;
|
||||
std::experimental::optional<g72x_state> m_rightStateLoop;
|
||||
u32 xc0_volume = 32768; // Out of 32768
|
||||
|
||||
static int16_t SampClamp(int32_t val)
|
||||
{
|
||||
if (val < -32768) val = -32768;
|
||||
else if (val > 32767) val = 32767;
|
||||
return val;
|
||||
static int16_t SampClamp(int32_t val) {
|
||||
if (val < -32768)
|
||||
val = -32768;
|
||||
else if (val > 32767)
|
||||
val = 32767;
|
||||
return val;
|
||||
}
|
||||
|
||||
struct AudioVoiceCallback : boo::IAudioVoiceCallback {
|
||||
CStaticAudioPlayer& m_parent;
|
||||
void preSupplyAudio(boo::IAudioVoice&, double) {}
|
||||
size_t supplyAudio(boo::IAudioVoice& voice, size_t frames, int16_t* data) {
|
||||
if (m_parent.IsReady()) {
|
||||
m_parent.x38_dvdRequests.clear();
|
||||
m_parent.Decode(data, frames);
|
||||
} else
|
||||
memset(data, 0, 4 * frames);
|
||||
return frames;
|
||||
}
|
||||
|
||||
struct AudioVoiceCallback : boo::IAudioVoiceCallback
|
||||
{
|
||||
CStaticAudioPlayer& m_parent;
|
||||
void preSupplyAudio(boo::IAudioVoice&, double) {}
|
||||
size_t supplyAudio(boo::IAudioVoice& voice, size_t frames, int16_t* data)
|
||||
{
|
||||
if (m_parent.IsReady())
|
||||
{
|
||||
m_parent.x38_dvdRequests.clear();
|
||||
m_parent.Decode(data, frames);
|
||||
}
|
||||
else
|
||||
memset(data, 0, 4 * frames);
|
||||
return frames;
|
||||
}
|
||||
AudioVoiceCallback(CStaticAudioPlayer& p) : m_parent(p) {}
|
||||
} m_voiceCallback;
|
||||
boo::ObjToken<boo::IAudioVoice> m_voice;
|
||||
AudioVoiceCallback(CStaticAudioPlayer& p) : m_parent(p) {}
|
||||
} m_voiceCallback;
|
||||
boo::ObjToken<boo::IAudioVoice> m_voice;
|
||||
|
||||
public:
|
||||
CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, std::string_view path,
|
||||
int loopStart, int loopEnd);
|
||||
CStaticAudioPlayer(std::string_view path,
|
||||
int loopStart, int loopEnd)
|
||||
: CStaticAudioPlayer(*CAudioSys::GetVoiceEngine(), path, loopStart, loopEnd) {}
|
||||
CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, std::string_view path, int loopStart, int loopEnd);
|
||||
CStaticAudioPlayer(std::string_view path, int loopStart, int loopEnd)
|
||||
: CStaticAudioPlayer(*CAudioSys::GetVoiceEngine(), path, loopStart, loopEnd) {}
|
||||
|
||||
bool IsReady();
|
||||
void DecodeMonoAndMix(s16* bufOut, u32 numSamples,
|
||||
u32 cur, u32 loopEndCur, u32 loopStartCur,
|
||||
int vol, g72x_state& state,
|
||||
std::experimental::optional<g72x_state>& loopState) const;
|
||||
void Decode(s16* bufOut, u32 numSamples);
|
||||
void SetVolume(float vol)
|
||||
{
|
||||
xc0_volume = zeus::clamp(0.f, vol, 1.f) * 32768.f;
|
||||
}
|
||||
bool IsReady();
|
||||
void DecodeMonoAndMix(s16* bufOut, u32 numSamples, u32 cur, u32 loopEndCur, u32 loopStartCur, int vol,
|
||||
g72x_state& state, std::experimental::optional<g72x_state>& loopState) const;
|
||||
void Decode(s16* bufOut, u32 numSamples);
|
||||
void SetVolume(float vol) { xc0_volume = zeus::clamp(0.f, vol, 1.f) * 32768.f; }
|
||||
|
||||
void StartMixing()
|
||||
{
|
||||
m_voice->start();
|
||||
}
|
||||
void StopMixing()
|
||||
{
|
||||
m_voice->stop();
|
||||
}
|
||||
void StartMixing() { m_voice->start(); }
|
||||
void StopMixing() { m_voice->stop(); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,38 +2,34 @@
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace urde {
|
||||
|
||||
class CStreamAudioManager
|
||||
{
|
||||
static u8 g_MusicVolume;
|
||||
static u8 g_SfxVolume;
|
||||
static bool g_MusicUnmute;
|
||||
static bool g_SfxUnmute;
|
||||
class CStreamAudioManager {
|
||||
static u8 g_MusicVolume;
|
||||
static u8 g_SfxVolume;
|
||||
static bool g_MusicUnmute;
|
||||
static bool g_SfxUnmute;
|
||||
|
||||
static float GetTargetDSPVolume(float fileVol, bool music);
|
||||
static void StopStreaming(bool oneshot);
|
||||
static void UpdateDSP(bool oneshot, float dt);
|
||||
static void UpdateDSPStreamers(float dt);
|
||||
static void StopAllStreams();
|
||||
static float GetTargetDSPVolume(float fileVol, bool music);
|
||||
static void StopStreaming(bool oneshot);
|
||||
static void UpdateDSP(bool oneshot, float dt);
|
||||
static void UpdateDSPStreamers(float dt);
|
||||
static void StopAllStreams();
|
||||
|
||||
public:
|
||||
static void Start(bool oneshot, std::string_view fileName, float volume,
|
||||
bool music, float fadeIn, float fadeOut);
|
||||
static void Stop(bool oneshot, std::string_view fileName);
|
||||
static void FadeBackIn(bool oneshot, float fadeTime);
|
||||
static void TemporaryFadeOut(bool oneshot, float fadeTime);
|
||||
static void Update(float dt);
|
||||
static void StopAll();
|
||||
static void SetMusicUnmute(bool unmute);
|
||||
static void SetSfxVolume(u8 volume);
|
||||
static void SetMusicVolume(u8 volume);
|
||||
static void Start(bool oneshot, std::string_view fileName, float volume, bool music, float fadeIn, float fadeOut);
|
||||
static void Stop(bool oneshot, std::string_view fileName);
|
||||
static void FadeBackIn(bool oneshot, float fadeTime);
|
||||
static void TemporaryFadeOut(bool oneshot, float fadeTime);
|
||||
static void Update(float dt);
|
||||
static void StopAll();
|
||||
static void SetMusicUnmute(bool unmute);
|
||||
static void SetSfxVolume(u8 volume);
|
||||
static void SetMusicVolume(u8 volume);
|
||||
|
||||
static void Initialize();
|
||||
static void StopOneShot();
|
||||
static void Shutdown();
|
||||
static void Initialize();
|
||||
static void StopOneShot();
|
||||
static void Shutdown();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
||||
Reference in New Issue
Block a user