update VoiceCallback
This commit is contained in:
		
							parent
							
								
									cc2dff2afd
								
							
						
					
					
						commit
						c40ac00ed9
					
				|  | @ -2,8 +2,7 @@ | |||
| #include "..\e2dbase.h" | ||||
| #include "..\e2dtool.h" | ||||
| 
 | ||||
| e2d::VoiceCallback::VoiceCallback(Music * music) | ||||
| 	: _music(music) | ||||
| e2d::VoiceCallback::VoiceCallback() | ||||
| { | ||||
| } | ||||
| 
 | ||||
|  | @ -21,11 +20,6 @@ void e2d::VoiceCallback::OnLoopEnd(void * pBufferContext) | |||
| 
 | ||||
| void e2d::VoiceCallback::OnStreamEnd() | ||||
| { | ||||
| 	if (_music) | ||||
| 	{ | ||||
| 		_music->_playing = false; | ||||
| 	} | ||||
| 	 | ||||
| 	if (_streamEndFunc) | ||||
| 	{ | ||||
| 		_streamEndFunc(); | ||||
|  | @ -38,31 +32,6 @@ void e2d::VoiceCallback::OnBufferEnd(void * pBufferContext) | |||
| 	{ | ||||
| 		_loopEndFunc(); | ||||
| 	} | ||||
| 
 | ||||
| 	if (_music) | ||||
| 	{ | ||||
| 		_music->release(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void e2d::VoiceCallback::OnBufferStart(void * pBufferContext) | ||||
| { | ||||
| 	if (_music) | ||||
| 	{ | ||||
| 		_music->retain(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void e2d::VoiceCallback::OnVoiceProcessingPassEnd() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void e2d::VoiceCallback::OnVoiceProcessingPassStart(UINT32 SamplesRequired) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void e2d::VoiceCallback::OnVoiceError(void * pBufferContext, HRESULT Error) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void e2d::VoiceCallback::SetFuncOnStreamEnd(const Function & func) | ||||
|  |  | |||
|  | @ -69,7 +69,7 @@ e2d::Music::Music() | |||
| 	, _waveData(nullptr) | ||||
| 	, _dwSize(0) | ||||
| 	, _voice(nullptr) | ||||
| 	, _voiceCallback(this) | ||||
| 	, _voiceCallback() | ||||
| { | ||||
| 	auto xAudio2 = XAudio2Tool::getInstance()->getXAudio2(); | ||||
| 	xAudio2->AddRef(); | ||||
|  | @ -84,7 +84,7 @@ e2d::Music::Music(const e2d::String & filePath) | |||
| 	, _waveData(nullptr) | ||||
| 	, _dwSize(0) | ||||
| 	, _voice(nullptr) | ||||
| 	, _voiceCallback(this) | ||||
| 	, _voiceCallback() | ||||
| { | ||||
| 	auto xAudio2 = XAudio2Tool::getInstance()->getXAudio2(); | ||||
| 	xAudio2->AddRef(); | ||||
|  | @ -101,7 +101,7 @@ e2d::Music::Music(const Resource& res) | |||
| 	, _waveData(nullptr) | ||||
| 	, _dwSize(0) | ||||
| 	, _voice(nullptr) | ||||
| 	, _voiceCallback(this) | ||||
| 	, _voiceCallback() | ||||
| { | ||||
| 	auto xAudio2 = XAudio2Tool::getInstance()->getXAudio2(); | ||||
| 	xAudio2->AddRef(); | ||||
|  |  | |||
|  | @ -13,36 +13,23 @@ class VoiceCallback | |||
| 	: public IXAudio2VoiceCallback | ||||
| { | ||||
| public: | ||||
| 	explicit VoiceCallback( | ||||
| 		Music * music | ||||
| 	); | ||||
| 	VoiceCallback(); | ||||
| 
 | ||||
| 	~VoiceCallback(); | ||||
| 
 | ||||
| 	void __stdcall OnStreamEnd(); | ||||
| 	STDMETHOD_(void, OnVoiceProcessingPassStart) (THIS_ UINT32 BytesRequired) {} | ||||
| 
 | ||||
| 	void __stdcall OnBufferEnd( | ||||
| 		void * pBufferContext | ||||
| 	); | ||||
| 	STDMETHOD_(void, OnVoiceProcessingPassEnd) (THIS) {} | ||||
| 
 | ||||
| 	void __stdcall OnBufferStart( | ||||
| 		void * pBufferContext | ||||
| 	); | ||||
| 	STDMETHOD_(void, OnStreamEnd) (THIS); | ||||
| 
 | ||||
| 	void __stdcall OnLoopEnd( | ||||
| 		void * pBufferContext | ||||
| 	); | ||||
| 	STDMETHOD_(void, OnBufferStart) (THIS_ void* pBufferContext) {} | ||||
| 
 | ||||
| 	void __stdcall OnVoiceProcessingPassEnd(); | ||||
| 	STDMETHOD_(void, OnBufferEnd) (THIS_ void* pBufferContext); | ||||
| 
 | ||||
| 	void __stdcall OnVoiceProcessingPassStart( | ||||
| 		UINT32 SamplesRequired | ||||
| 	); | ||||
| 	STDMETHOD_(void, OnLoopEnd) (THIS_ void* pBufferContext); | ||||
| 
 | ||||
| 	void __stdcall OnVoiceError( | ||||
| 		void * pBufferContext, | ||||
| 		HRESULT Error | ||||
| 	); | ||||
| 	STDMETHOD_(void, OnVoiceError) (THIS_ void* pBufferContext, HRESULT Error) {} | ||||
| 
 | ||||
| 	void SetFuncOnStreamEnd( | ||||
| 		const Function& func | ||||
|  | @ -53,7 +40,6 @@ public: | |||
| 	); | ||||
| 
 | ||||
| protected: | ||||
| 	Music * _music; | ||||
| 	Function _loopEndFunc; | ||||
| 	Function _streamEndFunc; | ||||
| }; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue