summaryrefslogtreecommitdiff
path: root/engine/audio/private/snd_dev_xaudio.h
blob: 83ec00bb0ce35ea5d94831f12fc29bcd34ebec7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=====================================================================================//

#ifndef SND_DEV_XAUDIO_H
#define SND_DEV_XAUDIO_H
#pragma once
#include "audio_pch.h"
#include "inetmessage.h"
#include "netmessages.h"

class IAudioDevice;
IAudioDevice *Audio_CreateXAudioDevice( void );

#if defined ( _X360 )

class CClientInfo;
void VOICE_AddPlayerToVoiceList( CClientInfo *pClient, bool bLocal );

class CXboxVoice
{
public:

	static const DWORD MAX_VOICE_BUFFER_TIME = 200;  // 200ms
	CXboxVoice( void );
	void		VoiceInit( void );
	void		VoiceShutdown( void );
	void		AddPlayerToVoiceList( CClientInfo *pClient, bool bLocal );
	void		RemovePlayerFromVoiceList( CClientInfo *pClient, bool bLocal );
	bool		VoiceUpdateData( void );
	void		GetVoiceData( CLC_VoiceData *pData );
	void		VoiceSendData( INetChannel	*pChannel );
	void		VoiceResetLocalData( void );
	void		PlayIncomingVoiceData( XUID xuid, const byte *pbData, DWORD pdwSize );
	void		UpdateHUDVoiceStatus( void );
	void		GetRemoteTalkers( int *pNumTalkers, XUID *pRemoteTalkers );
	void		SetPlaybackPriority( XUID remoteTalker, DWORD dwUserIndex, XHV_PLAYBACK_PRIORITY playbackPriority );
	bool		IsPlayerTalking( XUID uid, bool bLocal );
	bool		IsHeadsetPresent( int id );
	void		RemoveAllTalkers( CClientInfo *pLocal );

private:
	PIXHV2ENGINE			m_pXHVEngine;


	// Local chat data
	static const WORD m_ChatBufferSize = XHV_VOICECHAT_MODE_PACKET_SIZE * XHV_MAX_VOICECHAT_PACKETS;
	BYTE        m_ChatBuffer[ m_ChatBufferSize ];
	WORD        m_wLocalDataSize;

	// Last voice data sent
	DWORD       m_dwLastVoiceSend;
};

CXboxVoice *Audio_GetXVoice( void );
IXAudio2 *Audio_GetXAudio2( void );

#endif



#endif // SND_DEV_XAUDIO_H