metaforce/Runtime/Audio/CAudioSys.hpp

100 lines
2.8 KiB
C++
Raw Normal View History

2016-04-13 06:07:23 +00:00
#ifndef __URDE_CAUDIOSYS_HPP__
#define __URDE_CAUDIOSYS_HPP__
2015-08-18 05:54:43 +00:00
#include "../GCNTypes.hpp"
2016-03-04 23:04:53 +00:00
#include "zeus/CVector3f.hpp"
2016-09-14 05:54:09 +00:00
#include "amuse/amuse.hpp"
2016-12-14 22:56:59 +00:00
#include "boo/audiodev/IAudioVoiceEngine.hpp"
2017-01-20 03:53:32 +00:00
#include "RetroTypes.hpp"
#include "CToken.hpp"
2015-08-18 05:54:43 +00:00
2016-03-04 23:04:53 +00:00
namespace urde
2015-08-18 05:54:43 +00:00
{
2017-01-20 03:53:32 +00:00
class CSimplePool;
class CAudioGroupSet;
CFactoryFnReturn FAudioTranslationTableFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& vparms,
CObjectReference* selfRef);
2015-08-18 05:54:43 +00:00
class CAudioSys
{
public:
2017-01-10 07:15:49 +00:00
enum class ESurroundModes
{
Mono,
Stereo,
Surround
};
2017-01-23 07:22:17 +00:00
private:
static CAudioSys* g_SharedSys;
boo::IAudioVoiceEngine* m_voiceEngine;
amuse::Engine m_engine;
2017-02-06 03:21:58 +00:00
static void _UpdateVolume();
2017-01-23 07:22:17 +00:00
public:
2015-08-20 02:52:07 +00:00
struct C3DEmitterParmData
{
zeus::CVector3f x0_pos;
zeus::CVector3f xc_dir;
float x18_maxDist;
float x1c_distComp;
u32 x20_flags;
u16 x24_sfxId;
2016-12-29 05:53:00 +00:00
float x26_maxVol;
float x27_minVol;
2017-06-03 06:03:07 +00:00
bool x28_important; // Can't be allocated over, regardless of priority
u8 x29_prio;
2015-08-20 02:52:07 +00:00
};
2016-12-14 22:56:59 +00:00
CAudioSys(boo::IAudioVoiceEngine* voiceEngine,
amuse::IBackendVoiceAllocator& backend, u8,u8,u8,u8,u32)
: m_voiceEngine(voiceEngine), m_engine(backend)
2015-08-18 05:54:43 +00:00
{
2016-12-14 22:56:59 +00:00
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;
2015-08-18 05:54:43 +00:00
}
2017-01-10 07:15:49 +00:00
static void SetSurroundMode(ESurroundModes mode)
{
}
2017-01-20 03:53:32 +00:00
static TLockedToken<CAudioGroupSet> FindGroupSet(const std::string& name);
static const std::string& SysGetGroupSetName(ResId id);
static bool SysLoadGroupSet(CSimplePool* pool, ResId id);
static bool SysLoadGroupSet(const TLockedToken<CAudioGroupSet>& set, const std::string& name, ResId id);
static void SysUnloadAudioGroupSet(const std::string& name);
static bool SysIsGroupSetLoaded(const std::string& name);
static void SysAddGroupIntoAmuse(const std::string& name);
static void SysRemoveGroupFromAmuse(const std::string& name);
2017-01-23 07:22:17 +00:00
static void SysSetVolume(u8 volume);
2017-02-06 03:21:58 +00:00
static void SysSetSfxVolume(u8 volume, u16 time, bool music, bool fx);
2017-01-23 07:22:17 +00:00
static s16 GetDefaultVolumeScale();
static void SetDefaultVolumeScale(s16 scale);
static void SetVolumeScale(s16 scale);
2015-08-18 05:54:43 +00:00
};
}
2016-04-13 06:07:23 +00:00
#endif // __URDE_CAUDIOSYS_HPP__