//////////////////////////////////////////////////////////////////////////////
//
// Asura_GameSpy_Voice.h
//
// Copyright (c) 2004 Rebellion. All rights reserved.
//
// Description:
//
//     Asura interface for GameSpy Voice2 SDK
//
//////////////////////////////////////////////////////////////////////////////

// B E G I N   F I L E   W R A P P E R ///////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef ___ASURA_GAMESPY_VOICE_H___
#define ___ASURA_GAMESPY_VOICE_H___ 1

#ifdef ASURA_SUPPORT_GAMESPY

class Asura_GameSpy_Voice
{

	friend class Asura_GameSpy_Voice_Internal;

public:
	
	static void Initialise( void );
	static void Reset( void );
	static void Shutdown( void );

	static void Update( void );

	static void SetTalkButton( int iKeyID )
	{
		s_iTalkButtonID = iKeyID;
	}

	static void SetLocalEcho( bool bEnable )
	{
		s_bLocalEcho = bEnable;
	}

	static void SetTalking(bool bOnOff)
	{
		if (s_bIsTalking ^ bOnOff)
		{
			ToggleTalking();
		}
	}

	static bool IsUnplugged()
	{
		return !s_bHasFoundDevices;
	}

	static bool IsTalking()
	{
		return s_bIsTalking;
	}
	
	static float GetCaptureVolume();

	// called by Network code. returns the guid of the source stored
	// in the voice packet.
	// voice packet message:
	// [voicedata] - iSource - FrameStamp
	// voicedatasize = uDataSize - sizeof(int) - sizeof(GVFrameStamp)
	static int PlayVoicePacket( const u_char* pucData, u_int uDataSize, int dummy=0 );
	static void SendHeartbeat ( void );
private:
	
	static bool Platform_Initialise( void );

	static bool FindDevices( void );
	static void ToggleTalking( void );

	static void SendVoicePacket( const u_char* pucData, u_int uNumBytes );
	
	static bool  s_bInitialised;
	static bool  s_bHasFoundDevices;
	static int   s_iTalkButtonID;
	static bool  s_bLocalEcho;
	static bool  s_bIsTalking;
};

#endif //#ifdef ASURA_SUPPORT_GAMESPY
// E N D   F I L E   W R A P P E R ///////////////////////////////////////////

#endif // #ifndef ___ASURA_GAMESPY_VOICE_H___
