OROCHI
 
Loading...
Searching...
No Matches
GxSysSound.h
Go to the documentation of this file.
1//===========================================================================
9//===========================================================================
10#pragma once
11
12GX_SOUND_NAMESPACE_BEGIN()
13
14//===========================================================================
16//===========================================================================
18{
19 //-------------------------------------------------------------
21 //-------------------------------------------------------------
23public:
24 // RTTI宣言
26 // 禁止宣言
28
29
30 //-------------------------------------------------------------
32 //-------------------------------------------------------------
34
37
39 //-------------------------------------------------------------
41 //-------------------------------------------------------------
43
45 void loadJson(const GxJson::GxJsonNode& jsonNode) override;
46
48};
49
50class GxUnitSound;
52class GxResSound;
53//===========================================================================
55//===========================================================================
57{
58 //-------------------------------------------------------------
60 //-------------------------------------------------------------
62public:
63#if defined(_WINDOWS) || defined(_XBOX_XS)
65 class GxEngineCallback : public IXAudio2EngineCallback
66 {
67 //-------------------------------------------------------------
69 //-------------------------------------------------------------
71
72 // Called by XAudio2 just before an audio processing pass begins.
73 void OnProcessingPassStart(void) {}
74 // Called just after an audio processing pass ends.
75 void OnProcessingPassEnd(void) {}
76 // Called in the event of a critical system error which requires XAudio2
77 // to be closed down and restarted. The error code is given in Error.
78 void OnCriticalError(HRESULT error) { GX_ERROR(false, "GxUnitSound error(0x%x)", error); }
79
81 };
82#endif //_WINDOWS || _XBOX_XS
83
84 static const s32 LOOP_DEFAULT = -1;
85#if defined(_WINDOWS) || defined(_XBOX_XS)
86 static const s32 LOOP_INFINITY = XAUDIO2_LOOP_INFINITE;
87#else //_WINDOWS || _XBOX_XS
88 static const s32 LOOP_INFINITY = 255;
89#endif // !(_WINDOWS || _XBOX_XS)
90
91 // RTTI定義
92 GX_RTTI_ABSTRACT_CLASS(GxSysSound, GxSysSoundBase)
93 // GxClassBase継承クラス用禁止宣言
95
96
97 //-------------------------------------------------------------
99 //-------------------------------------------------------------
101public:
103 GxSysSound(void);
105 ~GxSysSound(void) override {}
106
108 b32 initialize(const GxClassBase* pInitialInformationBase) override;
110 void terminate(void) override;
111
113 //-------------------------------------------------------------
115 //-------------------------------------------------------------
117
119 void update(void) override;
120
122 GX_FORCE_INLINE b32 isPause(void) const override { return _isPause; }
124 void pause(b32 enable) override;
125
127 GxUnitSound* createSound(GxResSound* pResSound, s32 loopCount = LOOP_DEFAULT, f32 volume = 1.0f, f32 pitch = 1.0f, b32 is3D = true, GxUnitLocate* pParent = nullptr);
129 GxUnitSound* createStream(GX_CSTR path, s32 loopCount = LOOP_DEFAULT, f32 volume = 1.0f, f32 pitch = 1.0f, b32 is3D = true, f32 fadeTime = 0.f, GxUnitLocate* pParent = nullptr);
131 GxUnitSoundInteractive* createSoundInteractive(GX_CSTR path0, GX_CSTR path1, f32 controlValue = 0.f, s32 loopCount = LOOP_DEFAULT, f32 volume = 1.0f, f32 pitch = 1.0f, f32 fadeTime = 0.f);
132
134 //-------------------------------------------------------------
136 //-------------------------------------------------------------
138public:
139#if defined(_WINDOWS) || defined(_XBOX_XS)
141 constexpr IXAudio2* getXaudio2(void) const { return _pXAudio2; }
143 constexpr IXAudio2MasteringVoice* getXaudio2MasteringVoice(void) const { return _pXAudio2MasteringVoice; }
145 GX_FORCE_INLINE const XAUDIO2_VOICE_DETAILS& getXaudio2VoiceDetails(void) const { return _xaudio2VoiceDetails; }
147 GX_FORCE_INLINE const X3DAUDIO_HANDLE& getX3dAudioHandle(void) const { return _x3dAudioHandle; }
149 GX_FORCE_INLINE const X3DAUDIO_LISTENER& getX3dAudioListener(void) const { return _x3dAudioListener; }
150#endif //_WINDOWS || _XBOX_XS
152 constexpr GxUnitLocate* getListenerUnit(void) const { return _pListenerUnit; }
154 constexpr void setListenerUnit(GxUnitLocate* pUnit) { _pListenerUnit = pUnit; }
155
157 //-------------------------------------------------------------
159 //-------------------------------------------------------------
161private:
162 GxVector3 _positionListenerBefore;
163 GxUnitLocate* _pListenerUnit;
164 b32 _isPause;
165#if defined(_WINDOWS) || defined(_XBOX_XS)
166 GxEngineCallback _callback;
167 IXAudio2* _pXAudio2;
168 IXAudio2MasteringVoice* _pXAudio2MasteringVoice;
169 XAUDIO2_VOICE_DETAILS _xaudio2VoiceDetails;
170 X3DAUDIO_HANDLE _x3dAudioHandle;
171 X3DAUDIO_LISTENER _x3dAudioListener;
172#endif //_WINDOWS || _XBOX_XS
173
175};
176
177// アクセスインターフェース
178GX_FORCE_INLINE GxSysSound* getGxSysSound(void){ return static_cast<GxSysSound*>(GxSysSound::getSingletonPointer()); }
179
180GX_SOUND_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE(__CLASS__)
GxClassBase継承の禁止宣言
Definition GxBase.h:240
オブジェクト基底クラス
Definition GxBase.h:88
JSON解析用ノード
Definition GxJson.h:108
サウンドリソースクラス
Definition GxResSound.h:18
初期化クラス
Definition GxSysSoundBase.h:19
初期化情報クラス
Definition GxSysSound.h:18
サウンドシステム基底クラス
Definition GxSysSoundBase.h:55
サウンドシステムクラス
Definition GxSysSound.h:57
constexpr void setListenerUnit(GxUnitLocate *pUnit)
リスナーユニットを設定
Definition GxSysSound.h:154
GX_FORCE_INLINE b32 isPause(void) const override
一時停止判定
Definition GxSysSound.h:122
void pause(b32 enable) override
一時停止設定
Definition GxSysSound.cpp:146
GxUnitSoundInteractive * createSoundInteractive(GX_CSTR path0, GX_CSTR path1, f32 controlValue=0.f, s32 loopCount=LOOP_DEFAULT, f32 volume=1.0f, f32 pitch=1.0f, f32 fadeTime=0.f)
インタラクティブサウンドを作成
Definition GxSysSound.cpp:218
b32 initialize(const GxClassBase *pInitialInformationBase) override
初期化
Definition GxSysSound.cpp:58
void terminate(void) override
終了処理
Definition GxSysSound.cpp:95
void update(void) override
更新処理
Definition GxSysSound.cpp:107
GxSysSound(void)
デフォルトコンストラクタ
Definition GxSysSound.cpp:44
GxUnitSound * createSound(GxResSound *pResSound, s32 loopCount=LOOP_DEFAULT, f32 volume=1.0f, f32 pitch=1.0f, b32 is3D=true, GxUnitLocate *pParent=nullptr)
サウンドユニットを作成
Definition GxSysSound.cpp:161
static const s32 LOOP_DEFAULT
デフォルトのループ回数の設定値
Definition GxSysSound.h:84
~GxSysSound(void) override
デストラクタ
Definition GxSysSound.h:105
GxUnitSound * createStream(GX_CSTR path, s32 loopCount=LOOP_DEFAULT, f32 volume=1.0f, f32 pitch=1.0f, b32 is3D=true, f32 fadeTime=0.f, GxUnitLocate *pParent=nullptr)
ストリーミングユニットを作成
Definition GxSysSound.cpp:187
static const s32 LOOP_INFINITY
無限ループの設定値
Definition GxSysSound.h:88
座標ユニット基礎クラス
Definition GxUnitLocate.h:23
サウンド再生ユニット
Definition GxUnitSound.h:18
インタラクティブサウンド再生ユニット
Definition GxUnitSoundInteractive.h:18
static constexpr GxSysSoundBase * getSingletonPointer(void)
Definition GxSingleton.h:59
3次元ベクトル
Definition GxVector.h:245
32bitブーリアン
Definition GxDefine.h:173