This commit is contained in:
FluorescentCIAAfricanAmerican
2020-04-22 12:56:21 -04:00
commit 3bf9df6b27
15370 changed files with 5489726 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// stdafx.cpp : source file that includes just the standard includes
// voice_tweak.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
+36
View File
@@ -0,0 +1,36 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__87791E16_378A_44F7_B9EE_95423D655A32__INCLUDED_)
#define AFX_STDAFX_H__87791E16_378A_44F7_B9EE_95423D655A32__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <process.h>
#include <mmsystem.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__87791E16_378A_44F7_B9EE_95423D655A32__INCLUDED_)
+857
View File
@@ -0,0 +1,857 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
/*==========================================================================;
*
* Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
*
* File: dpvoice.h
* Content: DirectPlayVoice include file
***************************************************************************/
#ifndef __DVOICE__
#define __DVOICE__
#include <ole2.h> // for DECLARE_INTERFACE and HRESULT
#include <mmsystem.h>
#include <mmreg.h>
#include <msacm.h>
#include "dsound.h"
#ifdef __cplusplus
extern "C" {
#endif
/****************************************************************************
*
* DirectPlayVoice CLSIDs
*
****************************************************************************/
// {B9F3EB85-B781-4ac1-8D90-93A05EE37D7D}
DEFINE_GUID(CLSID_DirectPlayVoiceClient,
0xb9f3eb85, 0xb781, 0x4ac1, 0x8d, 0x90, 0x93, 0xa0, 0x5e, 0xe3, 0x7d, 0x7d);
// {D3F5B8E6-9B78-4a4c-94EA-CA2397B663D3}
DEFINE_GUID(CLSID_DirectPlayVoiceServer,
0xd3f5b8e6, 0x9b78, 0x4a4c, 0x94, 0xea, 0xca, 0x23, 0x97, 0xb6, 0x63, 0xd3);
// {0F0F094B-B01C-4091-A14D-DD0CD807711A}
DEFINE_GUID(CLSID_DirectPlayVoiceTest,
0xf0f094b, 0xb01c, 0x4091, 0xa1, 0x4d, 0xdd, 0xc, 0xd8, 0x7, 0x71, 0x1a);
/****************************************************************************
*
* DirectPlayVoice Interface IIDs
*
****************************************************************************/
// {1DFDC8EA-BCF7-41d6-B295-AB64B3B23306}
DEFINE_GUID(IID_IDirectPlayVoiceClient,
0x1dfdc8ea, 0xbcf7, 0x41d6, 0xb2, 0x95, 0xab, 0x64, 0xb3, 0xb2, 0x33, 0x6);
// {FAA1C173-0468-43b6-8A2A-EA8A4F2076C9}
DEFINE_GUID(IID_IDirectPlayVoiceServer,
0xfaa1c173, 0x468, 0x43b6, 0x8a, 0x2a, 0xea, 0x8a, 0x4f, 0x20, 0x76, 0xc9);
// {D26AF734-208B-41da-8224-E0CE79810BE1}
DEFINE_GUID(IID_IDirectPlayVoiceTest,
0xd26af734, 0x208b, 0x41da, 0x82, 0x24, 0xe0, 0xce, 0x79, 0x81, 0xb, 0xe1);
/****************************************************************************
*
* DirectPlayVoice Compression Type GUIDs
*
****************************************************************************/
// MS-ADPCM 32.8 kbit/s
//
// {699B52C1-A885-46a8-A308-97172419ADC7}
DEFINE_GUID(DPVCTGUID_ADPCM,
0x699b52c1, 0xa885, 0x46a8, 0xa3, 0x8, 0x97, 0x17, 0x24, 0x19, 0xad, 0xc7);
// Microsoft GSM 6.10 13 kbit/s
//
// {24768C60-5A0D-11d3-9BE4-525400D985E7}
DEFINE_GUID(DPVCTGUID_GSM,
0x24768c60, 0x5a0d, 0x11d3, 0x9b, 0xe4, 0x52, 0x54, 0x0, 0xd9, 0x85, 0xe7);
// MS-PCM 64 kbit/s
//
// {8DE12FD4-7CB3-48ce-A7E8-9C47A22E8AC5}
DEFINE_GUID(DPVCTGUID_NONE,
0x8de12fd4, 0x7cb3, 0x48ce, 0xa7, 0xe8, 0x9c, 0x47, 0xa2, 0x2e, 0x8a, 0xc5);
// Voxware SC03 3.2kbit/s
//
// {7D82A29B-2242-4f82-8F39-5D1153DF3E41}
DEFINE_GUID(DPVCTGUID_SC03,
0x7d82a29b, 0x2242, 0x4f82, 0x8f, 0x39, 0x5d, 0x11, 0x53, 0xdf, 0x3e, 0x41);
// Voxware SC06 6.4kbit/s
//
// {53DEF900-7168-4633-B47F-D143916A13C7}
DEFINE_GUID(DPVCTGUID_SC06,
0x53def900, 0x7168, 0x4633, 0xb4, 0x7f, 0xd1, 0x43, 0x91, 0x6a, 0x13, 0xc7);
// TrueSpeech(TM) 8.6 kbit/s
//
// {D7954361-5A0B-11d3-9BE4-525400D985E7}
DEFINE_GUID(DPVCTGUID_TRUESPEECH,
0xd7954361, 0x5a0b, 0x11d3, 0x9b, 0xe4, 0x52, 0x54, 0x0, 0xd9, 0x85, 0xe7);
// Voxware VR12 1.4kbit/s
//
// {FE44A9FE-8ED4-48bf-9D66-1B1ADFF9FF6D}
DEFINE_GUID(DPVCTGUID_VR12,
0xfe44a9fe, 0x8ed4, 0x48bf, 0x9d, 0x66, 0x1b, 0x1a, 0xdf, 0xf9, 0xff, 0x6d);
// Define the default compression type
#define DPVCTGUID_DEFAULT DPVCTGUID_SC03
/****************************************************************************
*
* DirectPlayVoice Interface Pointer definitions
*
****************************************************************************/
typedef struct IDirectPlayVoiceClient FAR *LPDIRECTPLAYVOICECLIENT, *PDIRECTPLAYVOICECLIENT;
typedef struct IDirectPlayVoiceServer FAR *LPDIRECTPLAYVOICESERVER, *PDIRECTPLAYVOICESERVER;
typedef struct IDirectPlayVoiceTest FAR *LPDIRECTPLAYVOICETEST, *PDIRECTPLAYVOICETEST;
/****************************************************************************
*
* DirectPlayVoice Callback Functions
*
****************************************************************************/
typedef HRESULT (FAR PASCAL *PDVMESSAGEHANDLER)(
PVOID pvUserContext,
DWORD dwMessageType,
LPVOID lpMessage
);
typedef PDVMESSAGEHANDLER LPDVMESSAGEHANDLER;
/****************************************************************************
*
* DirectPlayVoice Datatypes (Non-Structure / Non-Message)
*
****************************************************************************/
typedef DWORD DVID, *LPDVID, *PDVID;
/****************************************************************************
*
* DirectPlayVoice Message Types
*
****************************************************************************/
#define DVMSGID_BASE 0x0000
#define DVMSGID_MINBASE (DVMSGID_CREATEVOICEPLAYER)
#define DVMSGID_CREATEVOICEPLAYER (DVMSGID_BASE+0x0001)
#define DVMSGID_DELETEVOICEPLAYER (DVMSGID_BASE+0x0002)
#define DVMSGID_SESSIONLOST (DVMSGID_BASE+0x0003)
#define DVMSGID_PLAYERVOICESTART (DVMSGID_BASE+0x0004)
#define DVMSGID_PLAYERVOICESTOP (DVMSGID_BASE+0x0005)
#define DVMSGID_RECORDSTART (DVMSGID_BASE+0x0006)
#define DVMSGID_RECORDSTOP (DVMSGID_BASE+0x0007)
#define DVMSGID_CONNECTRESULT (DVMSGID_BASE+0x0008)
#define DVMSGID_DISCONNECTRESULT (DVMSGID_BASE+0x0009)
#define DVMSGID_INPUTLEVEL (DVMSGID_BASE+0x000A)
#define DVMSGID_OUTPUTLEVEL (DVMSGID_BASE+0x000B)
#define DVMSGID_HOSTMIGRATED (DVMSGID_BASE+0x000C)
#define DVMSGID_SETTARGETS (DVMSGID_BASE+0x000D)
#define DVMSGID_PLAYEROUTPUTLEVEL (DVMSGID_BASE+0x000E)
#define DVMSGID_LOSTFOCUS (DVMSGID_BASE+0x0010)
#define DVMSGID_GAINFOCUS (DVMSGID_BASE+0x0011)
#define DVMSGID_LOCALHOSTSETUP (DVMSGID_BASE+0x0012)
#define DVMSGID_MAXBASE (DVMSGID_LOCALHOSTSETUP)
/****************************************************************************
*
* DirectPlayVoice Constants
*
****************************************************************************/
//
// Buffer Aggresiveness Value Ranges
//
#define DVBUFFERAGGRESSIVENESS_MIN 0x00000001
#define DVBUFFERAGGRESSIVENESS_MAX 0x00000064
#define DVBUFFERAGGRESSIVENESS_DEFAULT 0x00000000
//
// Buffer Quality Value Ranges
//
#define DVBUFFERQUALITY_MIN 0x00000001
#define DVBUFFERQUALITY_MAX 0x00000064
#define DVBUFFERQUALITY_DEFAULT 0x00000000
#define DVID_SYS 0
//
// Used to identify the session host in client/server
//
#define DVID_SERVERPLAYER 1
//
// Used to target all players
//
#define DVID_ALLPLAYERS 0
//
// Used to identify the main buffer
//
#define DVID_REMAINING 0xFFFFFFFF
//
// Input level range
//
#define DVINPUTLEVEL_MIN 0x00000000
#define DVINPUTLEVEL_MAX 0x00000063 // 99 decimal
#define DVNOTIFYPERIOD_MINPERIOD 20
#define DVPLAYBACKVOLUME_DEFAULT DSBVOLUME_MAX
#define DVRECORDVOLUME_LAST 0x00000001
//
// Use the default value
//
#define DVTHRESHOLD_DEFAULT 0xFFFFFFFF
//
// Threshold Ranges
//
#define DVTHRESHOLD_MIN 0x00000000
#define DVTHRESHOLD_MAX 0x00000063 // 99 decimal
//
// Threshold field is not used
//
#define DVTHRESHOLD_UNUSED 0xFFFFFFFE
//
// Session Types
//
#define DVSESSIONTYPE_PEER 0x00000001
#define DVSESSIONTYPE_MIXING 0x00000002
#define DVSESSIONTYPE_FORWARDING 0x00000003
#define DVSESSIONTYPE_ECHO 0x00000004
/****************************************************************************
*
* DirectPlayVoice Flags
*
****************************************************************************/
//
// Enable automatic adjustment of the recording volume
//
#define DVCLIENTCONFIG_AUTORECORDVOLUME 0x00000008
//
// Enable automatic voice activation
//
#define DVCLIENTCONFIG_AUTOVOICEACTIVATED 0x00000020
//
// Enable echo suppression
//
#define DVCLIENTCONFIG_ECHOSUPPRESSION 0x08000000
//
// Voice Activation manual mode
//
#define DVCLIENTCONFIG_MANUALVOICEACTIVATED 0x00000004
//
// Only playback voices that have buffers created for them
//
#define DVCLIENTCONFIG_MUTEGLOBAL 0x00000010
//
// Mute the playback
//
#define DVCLIENTCONFIG_PLAYBACKMUTE 0x00000002
//
// Mute the recording
//
#define DVCLIENTCONFIG_RECORDMUTE 0x00000001
//
// Complete the operation before returning
//
#define DVFLAGS_SYNC 0x00000001
//
// Just check to see if wizard has been run, and if so what it's results were
//
#define DVFLAGS_QUERYONLY 0x00000002
//
// Shutdown the voice session without migrating the host
//
#define DVFLAGS_NOHOSTMIGRATE 0x00000008
//
// Allow the back button to be enabled in the wizard
//
#define DVFLAGS_ALLOWBACK 0x00000010
//
// Disable host migration in the voice session
//
#define DVSESSION_NOHOSTMIGRATION 0x00000001
//
// Server controlled targetting
//
#define DVSESSION_SERVERCONTROLTARGET 0x00000002
//
// Use DirectSound Normal Mode instead of priority
//
#define DVSOUNDCONFIG_NORMALMODE 0x00000001
//
// Automatically select the microphone
//
#define DVSOUNDCONFIG_AUTOSELECT 0x00000002
//
// Run in half duplex mode
//
#define DVSOUNDCONFIG_HALFDUPLEX 0x00000004
//
// No volume controls are available for the recording device
//
#define DVSOUNDCONFIG_NORECVOLAVAILABLE 0x00000010
//
// Disable capture sharing
//
#define DVSOUNDCONFIG_NOFOCUS 0x20000000
//
// Set system conversion quality to high
//
#define DVSOUNDCONFIG_SETCONVERSIONQUALITY 0x00000008
//
// Enable strict focus mode
//
#define DVSOUNDCONFIG_STRICTFOCUS 0x40000000
//
// Player is in half duplex mode
//
#define DVPLAYERCAPS_HALFDUPLEX 0x00000001
//
// Specifies that player is the local player
//
#define DVPLAYERCAPS_LOCAL 0x00000002
/****************************************************************************
*
* DirectPlayVoice Structures (Non-Message)
*
****************************************************************************/
//
// DirectPlayVoice Caps
// (GetCaps / SetCaps)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DWORD dwFlags; // Caps flags
} DVCAPS, *LPDVCAPS, *PDVCAPS;
//
// DirectPlayVoice Client Configuration
// (Connect / GetClientConfig)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DWORD dwFlags; // Flags for client config (DVCLIENTCONFIG_...)
LONG lRecordVolume; // Recording volume
LONG lPlaybackVolume; // Playback volume
DWORD dwThreshold; // Voice Activation Threshold
DWORD dwBufferQuality; // Buffer quality
DWORD dwBufferAggressiveness; // Buffer aggressiveness
DWORD dwNotifyPeriod; // Period of notification messages (ms)
} DVCLIENTCONFIG, *LPDVCLIENTCONFIG, *PDVCLIENTCONFIG;
//
// DirectPlayVoice Compression Type Information
// (GetCompressionTypes)
//
typedef struct
{
DWORD dwSize; // Size of this structure
GUID guidType; // GUID that identifies this compression type
LPWSTR lpszName; // String name of this compression type
LPWSTR lpszDescription; // Description for this compression type
DWORD dwFlags; // Flags for this compression type
DWORD dwMaxBitsPerSecond; // Maximum # of bit/s this compression type uses
} DVCOMPRESSIONINFO, *LPDVCOMPRESSIONINFO, *PDVCOMPRESSIONINFO;
//
// DirectPlayVoice Session Description
// (Host / GetSessionDesc)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DWORD dwFlags; // Session flags (DVSESSION_...)
DWORD dwSessionType; // Session type (DVSESSIONTYPE_...)
GUID guidCT; // Compression Type to use
DWORD dwBufferQuality; // Buffer quality
DWORD dwBufferAggressiveness; // Buffer aggresiveness
} DVSESSIONDESC, *LPDVSESSIONDESC, *PDVSESSIONDESC;
//
// DirectPlayVoice Client Sound Device Configuration
// (Connect / GetSoundDeviceConfig)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DWORD dwFlags; // Flags for sound config (DVSOUNDCONFIG_...)
GUID guidPlaybackDevice; // GUID of the playback device to use
LPDIRECTSOUND lpdsPlaybackDevice; // DirectSound Object to use (optional)
GUID guidCaptureDevice; // GUID of the capture device to use
LPDIRECTSOUNDCAPTURE lpdsCaptureDevice; // DirectSoundCapture Object to use (optional)
HWND hwndAppWindow; // HWND of your application's top-level window
LPDIRECTSOUNDBUFFER lpdsMainBuffer; // DirectSoundBuffer to use for playback (optional)
DWORD dwMainBufferFlags; // Flags to pass to Play() on the main buffer
DWORD dwMainBufferPriority; // Priority to set when calling Play() on the main buffer
} DVSOUNDDEVICECONFIG, *LPDVSOUNDDEVICECONFIG, *PDVSOUNDDEVICECONFIG;
/****************************************************************************
*
* DirectPlayVoice message handler call back structures
*
****************************************************************************/
//
// Result of the Connect() call. (If it wasn't called Async)
// (DVMSGID_CONNECTRESULT)
//
typedef struct
{
DWORD dwSize; // Size of this structure
HRESULT hrResult; // Result of the Connect() call
} DVMSG_CONNECTRESULT, *LPDVMSG_CONNECTRESULT, *PDVMSG_CONNECTRESULT;
//
// A new player has entered the voice session
// (DVMSGID_CREATEVOICEPLAYER)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DVID dvidPlayer; // DVID of the player who joined
DWORD dwFlags; // Player flags (DVPLAYERCAPS_...)
PVOID pvPlayerContext; // Context value for this player (user set)
} DVMSG_CREATEVOICEPLAYER, *LPDVMSG_CREATEVOICEPLAYER, *PDVMSG_CREATEVOICEPLAYER;
//
// A player has left the voice session
// (DVMSGID_DELETEVOICEPLAYER)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DVID dvidPlayer; // DVID of the player who left
PVOID pvPlayerContext; // Context value for the player
} DVMSG_DELETEVOICEPLAYER, *LPDVMSG_DELETEVOICEPLAYER, *PDVMSG_DELETEVOICEPLAYER;
//
// Result of the Disconnect() call. (If it wasn't called Async)
// (DVMSGID_DISCONNECTRESULT)
//
typedef struct
{
DWORD dwSize; // Size of this structure
HRESULT hrResult; // Result of the Disconnect() call
} DVMSG_DISCONNECTRESULT, *LPDVMSG_DISCONNECTRESULT, *PDVMSG_DISCONNECTRESULT;
//
// The voice session host has migrated.
// (DVMSGID_HOSTMIGRATED)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DVID dvidNewHostID; // DVID of the player who is now the host
LPDIRECTPLAYVOICESERVER pdvServerInterface;
// Pointer to the new host object (if local player is now host)
} DVMSG_HOSTMIGRATED, *LPDVMSG_HOSTMIGRATED, *PDVMSG_HOSTMIGRATED;
//
// The current input level / recording volume on the local machine
// (DVMSGID_INPUTLEVEL)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DWORD dwPeakLevel; // Current peak level of the audio
LONG lRecordVolume; // Current recording volume
PVOID pvLocalPlayerContext; // Context value for the local player
} DVMSG_INPUTLEVEL, *LPDVMSG_INPUTLEVEL, *PDVMSG_INPUTLEVEL;
//
// The local client is about to become the new host
// (DVMSGID_LOCALHOSTSETUP)
//
typedef struct
{
DWORD dwSize; // Size of this structure
PVOID pvContext; // Context value to be passed to Initialize() of new host object
PDVMESSAGEHANDLER pMessageHandler; // Message handler to be used by new host object
} DVMSG_LOCALHOSTSETUP, *LPDVMSG_LOCALHOSTSETUP, *PDVMSG_LOCALHOSTSETUP;
//
// The current output level for the combined output of all incoming streams.
// (DVMSGID_OUTPUTLEVEL)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DWORD dwPeakLevel; // Current peak level of the output
LONG lOutputVolume; // Current playback volume
PVOID pvLocalPlayerContext; // Context value for the local player
} DVMSG_OUTPUTLEVEL, *LPDVMSG_OUTPUTLEVEL, *PDVMSG_OUTPUTLEVEL;
//
// The current peak level of an individual player's incoming audio stream as it is
// being played back.
// (DVMSGID_PLAYEROUTPUTLEVEL)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DVID dvidSourcePlayerID; // DVID of the player
DWORD dwPeakLevel; // Peak level of the player's stream
PVOID pvPlayerContext; // Context value for the player
} DVMSG_PLAYEROUTPUTLEVEL, *LPDVMSG_PLAYEROUTPUTLEVEL, *PDVMSG_PLAYEROUTPUTLEVEL;
//
// An audio stream from the specified player has started playing back on the local client.
// (DVMSGID_PLAYERVOICESTART).
//
typedef struct
{
DWORD dwSize; // Size of this structure
DVID dvidSourcePlayerID; // DVID of the Player
PVOID pvPlayerContext; // Context value for this player
} DVMSG_PLAYERVOICESTART, *LPDVMSG_PLAYERVOICESTART, *PDVMSG_PLAYERVOICESTART;
//
// The audio stream from the specified player has stopped playing back on the local client.
// (DVMSGID_PLAYERVOICESTOP)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DVID dvidSourcePlayerID; // DVID of the player
PVOID pvPlayerContext; // Context value for this player
} DVMSG_PLAYERVOICESTOP, *LPDVMSG_PLAYERVOICESTOP, *PDVMSG_PLAYERVOICESTOP;
//
// Transmission has started on the local machine
// (DVMSGID_RECORDSTART)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DWORD dwPeakLevel; // Peak level that caused transmission to start
PVOID pvLocalPlayerContext; // Context value for the local player
} DVMSG_RECORDSTART, *LPDVMSG_RECORDSTART, *PDVMSG_RECORDSTART;
//
// Transmission has stopped on the local machine
// (DVMSGID_RECORDSTOP)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DWORD dwPeakLevel; // Peak level that caused transmission to stop
PVOID pvLocalPlayerContext; // Context value for the local player
} DVMSG_RECORDSTOP, *LPDVMSG_RECORDSTOP, *PDVMSG_RECORDSTOP;
//
// The voice session has been lost
// (DVMSGID_SESSIONLOST)
//
typedef struct
{
DWORD dwSize; // Size of this structure
HRESULT hrResult; // Reason the session was disconnected
} DVMSG_SESSIONLOST, *LPDVMSG_SESSIONLOST, *PDVMSG_SESSIONLOST;
//
// The target list has been updated for the local client
// (DVMSGID_SETTARGETS)
//
typedef struct
{
DWORD dwSize; // Size of this structure
DWORD dwNumTargets; // # of targets
PDVID pdvidTargets; // An array of DVIDs specifying the current targets
} DVMSG_SETTARGETS, *LPDVMSG_SETTARGETS, *PDVMSG_SETTARGETS;
/****************************************************************************
*
* DirectPlayVoice Functions
*
****************************************************************************/
extern HRESULT WINAPI DirectPlayVoiceCreate( const GUID * pcIID, void **ppvInterface, IUnknown *pUnknown);
/****************************************************************************
*
* DirectPlay8 Application Interfaces
*
****************************************************************************/
#undef INTERFACE
#define INTERFACE IDirectPlayVoiceClient
DECLARE_INTERFACE_( IDirectPlayVoiceClient, IUnknown )
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface)(THIS_ REFIID riid, PVOID *ppvObj) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectPlayVoiceClient methods ***/
STDMETHOD_(HRESULT, Initialize) (THIS_ LPUNKNOWN, PDVMESSAGEHANDLER, PVOID, PDWORD, DWORD ) PURE;
STDMETHOD_(HRESULT, Connect) (THIS_ PDVSOUNDDEVICECONFIG, PDVCLIENTCONFIG, DWORD ) PURE;
STDMETHOD_(HRESULT, Disconnect) (THIS_ DWORD ) PURE;
STDMETHOD_(HRESULT, GetSessionDesc)(THIS_ PDVSESSIONDESC ) PURE;
STDMETHOD_(HRESULT, GetClientConfig)(THIS_ PDVCLIENTCONFIG ) PURE;
STDMETHOD_(HRESULT, SetClientConfig)(THIS_ PDVCLIENTCONFIG ) PURE;
STDMETHOD_(HRESULT, GetCaps) (THIS_ PDVCAPS ) PURE;
STDMETHOD_(HRESULT, GetCompressionTypes)( THIS_ PVOID, PDWORD, PDWORD, DWORD ) PURE;
STDMETHOD_(HRESULT, SetTransmitTargets)( THIS_ PDVID, DWORD, DWORD ) PURE;
STDMETHOD_(HRESULT, GetTransmitTargets)( THIS_ PDVID, PDWORD, DWORD ) PURE;
STDMETHOD_(HRESULT, Create3DSoundBuffer)( THIS_ DVID, LPDIRECTSOUNDBUFFER, DWORD, DWORD, LPDIRECTSOUND3DBUFFER * ) PURE;
STDMETHOD_(HRESULT, Delete3DSoundBuffer)( THIS_ DVID, LPDIRECTSOUND3DBUFFER * ) PURE;
STDMETHOD_(HRESULT, SetNotifyMask)( THIS_ PDWORD, DWORD ) PURE;
STDMETHOD_(HRESULT, GetSoundDeviceConfig)( THIS_ PDVSOUNDDEVICECONFIG, PDWORD ) PURE;
};
#undef INTERFACE
#define INTERFACE IDirectPlayVoiceServer
DECLARE_INTERFACE_( IDirectPlayVoiceServer, IUnknown )
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IDirectPlayVoiceServer methods ***/
STDMETHOD_(HRESULT, Initialize) (THIS_ LPUNKNOWN, PDVMESSAGEHANDLER, PVOID, LPDWORD, DWORD ) PURE;
STDMETHOD_(HRESULT, StartSession) (THIS_ PDVSESSIONDESC, DWORD ) PURE;
STDMETHOD_(HRESULT, StopSession) (THIS_ DWORD ) PURE;
STDMETHOD_(HRESULT, GetSessionDesc)(THIS_ PDVSESSIONDESC ) PURE;
STDMETHOD_(HRESULT, SetSessionDesc)(THIS_ PDVSESSIONDESC ) PURE;
STDMETHOD_(HRESULT, GetCaps) (THIS_ PDVCAPS ) PURE;
STDMETHOD_(HRESULT, GetCompressionTypes)( THIS_ PVOID, PDWORD, PDWORD, DWORD ) PURE;
STDMETHOD_(HRESULT, SetTransmitTargets)( THIS_ DVID, PDVID, DWORD, DWORD ) PURE;
STDMETHOD_(HRESULT, GetTransmitTargets)( THIS_ DVID, PDVID, PDWORD, DWORD ) PURE;
STDMETHOD_(HRESULT, SetNotifyMask)( THIS_ PDWORD, DWORD ) PURE;
};
#undef INTERFACE
#define INTERFACE IDirectPlayVoiceTest
DECLARE_INTERFACE_( IDirectPlayVoiceTest, IUnknown )
{
/*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, PVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IDirectPlayVoiceTest methods ***/
STDMETHOD_(HRESULT, CheckAudioSetup) (THIS_ const GUID *, const GUID * , HWND, DWORD ) PURE;
};
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectPlayVoiceClient_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectPlayVoiceClient_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectPlayVoiceClient_Release(p) (p)->lpVtbl->Release(p)
#define IDirectPlayVoiceClient_Initialize(p,a,b,c,d,e) (p)->lpVtbl->Initialize(p,a,b,c,d,e)
#define IDirectPlayVoiceClient_Connect(p,a,b,c) (p)->lpVtbl->Connect(p,a,b,c)
#define IDirectPlayVoiceClient_Disconnect(p,a) (p)->lpVtbl->Disconnect(p,a)
#define IDirectPlayVoiceClient_GetSessionDesc(p,a) (p)->lpVtbl->GetSessionDesc(p,a)
#define IDirectPlayVoiceClient_GetClientConfig(p,a) (p)->lpVtbl->GetClientConfig(p,a)
#define IDirectPlayVoiceClient_SetClientConfig(p,a) (p)->lpVtbl->SetClientConfig(p,a)
#define IDirectPlayVoiceClient_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectPlayVoiceClient_GetCompressionTypes(p,a,b,c,d) (p)->lpVtbl->GetCompressionTypes(p,a,b,c,d)
#define IDirectPlayVoiceClient_SetTransmitTargets(p,a,b,c) (p)->lpVtbl->SetTransmitTargets(p,a,b,c)
#define IDirectPlayVoiceClient_GetTransmitTargets(p,a,b,c) (p)->lpVtbl->GetTransmitTargets(p,a,b,c)
#define IDirectPlayVoiceClient_Create3DSoundBuffer(p,a,b,c,d,e) (p)->lpVtbl->Create3DSoundBuffer(p,a,b,c,d,e)
#define IDirectPlayVoiceClient_Delete3DSoundBuffer(p,a,b) (p)->lpVtbl->Delete3DSoundBuffer(p,a,b)
#define IDirectPlayVoiceClient_SetNotifyMask(p,a,b) (p)->lpVtbl->SetNotifyMask(p,a,b)
#define IDirectPlayVoiceClient_GetSoundDeviceConfig(p,a,b) (p)->lpVtbl->GetSoundDeviceConfig(p,a,b)
#define IDirectPlayVoiceServer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectPlayVoiceServer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectPlayVoiceServer_Release(p) (p)->lpVtbl->Release(p)
#define IDirectPlayVoiceServer_Initialize(p,a,b,c,d,e) (p)->lpVtbl->Initialize(p,a,b,c,d,e)
#define IDirectPlayVoiceServer_StartSession(p,a,b) (p)->lpVtbl->StartSession(p,a,b)
#define IDirectPlayVoiceServer_StopSession(p,a) (p)->lpVtbl->StopSession(p,a)
#define IDirectPlayVoiceServer_GetSessionDesc(p,a) (p)->lpVtbl->GetSessionDesc(p,a)
#define IDirectPlayVoiceServer_SetSessionDesc(p,a) (p)->lpVtbl->SetSessionDesc(p,a)
#define IDirectPlayVoiceServer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a)
#define IDirectPlayVoiceServer_GetCompressionTypes(p,a,b,c,d) (p)->lpVtbl->GetCompressionTypes(p,a,b,c,d)
#define IDirectPlayVoiceServer_SetTransmitTargets(p,a,b,c,d) (p)->lpVtbl->SetTransmitTargets(p,a,b,c,d)
#define IDirectPlayVoiceServer_GetTransmitTargets(p,a,b,c,d) (p)->lpVtbl->GetTransmitTargets(p,a,b,c,d)
#define IDirectPlayVoiceServer_SetNotifyMask(p,a,b) (p)->lpVtbl->SetNotifyMask(p,a,b)
#define IDirectPlayVoiceTest_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectPlayVoiceTest_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectPlayVoiceTest_Release(p) (p)->lpVtbl->Release(p)
#define IDirectPlayVoiceTest_CheckAudioSetup(p,a,b,c,d) (p)->lpVtbl->CheckAudioSetup(p,a,b,c,d)
#else /* C++ */
#define IDirectPlayVoiceClient_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectPlayVoiceClient_AddRef(p) (p)->AddRef()
#define IDirectPlayVoiceClient_Release(p) (p)->Release()
#define IDirectPlayVoiceClient_Initialize(p,a,b,c,d,e) (p)->Initialize(a,b,c,d,e)
#define IDirectPlayVoiceClient_Connect(p,a,b,c) (p)->Connect(a,b,c)
#define IDirectPlayVoiceClient_Disconnect(p,a) (p)->Disconnect(a)
#define IDirectPlayVoiceClient_GetSessionDesc(p,a) (p)->GetSessionDesc(a)
#define IDirectPlayVoiceClient_GetClientConfig(p,a) (p)->GetClientConfig(a)
#define IDirectPlayVoiceClient_SetClientConfig(p,a) (p)->SetClientConfig(a)
#define IDirectPlayVoiceClient_GetCaps(p,a) (p)->GetCaps(a)
#define IDirectPlayVoiceClient_GetCompressionTypes(p,a,b,c,d) (p)->GetCompressionTypes(a,b,c,d)
#define IDirectPlayVoiceClient_SetTransmitTargets(p,a,b,c) (p)->SetTransmitTargets(a,b,c)
#define IDirectPlayVoiceClient_GetTransmitTargets(p,a,b,c) (p)->GetTransmitTargets(a,b,c)
#define IDirectPlayVoiceClient_Create3DSoundBuffer(p,a,b,c,d,e) (p)->Create3DSoundBuffer(a,b,c,d,e)
#define IDirectPlayVoiceClient_Delete3DSoundBuffer(p,a,b) (p)->Delete3DSoundBuffer(a,b)
#define IDirectPlayVoiceClient_SetNotifyMask(p,a,b) (p)->SetNotifyMask(a,b)
#define IDirectPlayVoiceClient_GetSoundDeviceConfig(p,a,b) (p)->GetSoundDeviceConfig(a,b)
#define IDirectPlayVoiceServer_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectPlayVoiceServer_AddRef(p) (p)->AddRef()
#define IDirectPlayVoiceServer_Release(p) (p)->Release()
#define IDirectPlayVoiceServer_Initialize(p,a,b,c,d,e) (p)->Initialize(a,b,c,d,e)
#define IDirectPlayVoiceServer_StartSession(p,a,b) (p)->StartSession(a,b)
#define IDirectPlayVoiceServer_StopSession(p,a) (p)->StopSession(a)
#define IDirectPlayVoiceServer_GetSessionDesc(p,a) (p)->GetSessionDesc(a)
#define IDirectPlayVoiceServer_SetSessionDesc(p,a) (p)->SetSessionDesc(a)
#define IDirectPlayVoiceServer_GetCaps(p,a) (p)->GetCaps(a)
#define IDirectPlayVoiceServer_GetCompressionTypes(p,a,b,c,d) (p)->GetCompressionTypes(a,b,c,d)
#define IDirectPlayVoiceServer_SetTransmitTargets(p,a,b,c,d) (p)->SetTransmitTargets(a,b,c,d)
#define IDirectPlayVoiceServer_GetTransmitTargets(p,a,b,c,d) (p)->GetTransmitTargets(a,b,c,d)
#define IDirectPlayVoiceServer_SetNotifyMask(p,a,b) (p)->SetNotifyMask(a,b)
#define IDirectPlayVoiceTest_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
#define IDirectPlayVoiceTest_AddRef(p) (p)->AddRef()
#define IDirectPlayVoiceTest_Release(p) (p)->Release()
#define IDirectPlayVoiceTest_CheckAudioSetup(p,a,b,c,d) (p)->CheckAudioSetup(a,b,c,d)
#endif
/****************************************************************************
*
* DIRECTPLAYVOICE ERRORS
*
* Errors are represented by negative values and cannot be combined.
*
****************************************************************************/
#define _FACDPV 0x15
#define MAKE_DVHRESULT( code ) MAKE_HRESULT( 1, _FACDPV, code )
#define DV_OK S_OK
#define DV_FULLDUPLEX MAKE_HRESULT( 0, _FACDPV, 0x0005 )
#define DV_HALFDUPLEX MAKE_HRESULT( 0, _FACDPV, 0x000A )
#define DV_PENDING MAKE_HRESULT( 0, _FACDPV, 0x0010 )
#define DVERR_BUFFERTOOSMALL MAKE_DVHRESULT( 0x001E )
#define DVERR_EXCEPTION MAKE_DVHRESULT( 0x004A )
#define DVERR_GENERIC E_FAIL
#define DVERR_INVALIDFLAGS MAKE_DVHRESULT( 0x0078 )
#define DVERR_INVALIDOBJECT MAKE_DVHRESULT( 0x0082 )
#define DVERR_INVALIDPARAM E_INVALIDARG
#define DVERR_INVALIDPLAYER MAKE_DVHRESULT( 0x0087 )
#define DVERR_INVALIDGROUP MAKE_DVHRESULT( 0x0091 )
#define DVERR_INVALIDHANDLE MAKE_DVHRESULT( 0x0096 )
#define DVERR_OUTOFMEMORY E_OUTOFMEMORY
#define DVERR_PENDING DV_PENDING
#define DVERR_NOTSUPPORTED E_NOTIMPL
#define DVERR_NOINTERFACE E_NOINTERFACE
#define DVERR_SESSIONLOST MAKE_DVHRESULT( 0x012C )
#define DVERR_NOVOICESESSION MAKE_DVHRESULT( 0x012E )
#define DVERR_CONNECTIONLOST MAKE_DVHRESULT( 0x0168 )
#define DVERR_NOTINITIALIZED MAKE_DVHRESULT( 0x0169 )
#define DVERR_CONNECTED MAKE_DVHRESULT( 0x016A )
#define DVERR_NOTCONNECTED MAKE_DVHRESULT( 0x016B )
#define DVERR_CONNECTABORTING MAKE_DVHRESULT( 0x016E )
#define DVERR_NOTALLOWED MAKE_DVHRESULT( 0x016F )
#define DVERR_INVALIDTARGET MAKE_DVHRESULT( 0x0170 )
#define DVERR_TRANSPORTNOTHOST MAKE_DVHRESULT( 0x0171 )
#define DVERR_COMPRESSIONNOTSUPPORTED MAKE_DVHRESULT( 0x0172 )
#define DVERR_ALREADYPENDING MAKE_DVHRESULT( 0x0173 )
#define DVERR_SOUNDINITFAILURE MAKE_DVHRESULT( 0x0174 )
#define DVERR_TIMEOUT MAKE_DVHRESULT( 0x0175 )
#define DVERR_CONNECTABORTED MAKE_DVHRESULT( 0x0176 )
#define DVERR_NO3DSOUND MAKE_DVHRESULT( 0x0177 )
#define DVERR_ALREADYBUFFERED MAKE_DVHRESULT( 0x0178 )
#define DVERR_NOTBUFFERED MAKE_DVHRESULT( 0x0179 )
#define DVERR_HOSTING MAKE_DVHRESULT( 0x017A )
#define DVERR_NOTHOSTING MAKE_DVHRESULT( 0x017B )
#define DVERR_INVALIDDEVICE MAKE_DVHRESULT( 0x017C )
#define DVERR_RECORDSYSTEMERROR MAKE_DVHRESULT( 0x017D )
#define DVERR_PLAYBACKSYSTEMERROR MAKE_DVHRESULT( 0x017E )
#define DVERR_SENDERROR MAKE_DVHRESULT( 0x017F )
#define DVERR_USERCANCEL MAKE_DVHRESULT( 0x0180 )
#define DVERR_RUNSETUP MAKE_DVHRESULT( 0x0183 )
#define DVERR_INCOMPATIBLEVERSION MAKE_DVHRESULT( 0x0184 )
#define DVERR_INITIALIZED MAKE_DVHRESULT( 0x0187 )
#define DVERR_INVALIDPOINTER E_POINTER
#define DVERR_NOTRANSPORT MAKE_DVHRESULT( 0x0188 )
#define DVERR_NOCALLBACK MAKE_DVHRESULT( 0x0189 )
#define DVERR_TRANSPORTNOTINIT MAKE_DVHRESULT( 0x018A )
#define DVERR_TRANSPORTNOSESSION MAKE_DVHRESULT( 0x018B )
#define DVERR_TRANSPORTNOPLAYER MAKE_DVHRESULT( 0x018C )
#define DVERR_USERBACK MAKE_DVHRESULT( 0x018D )
#define DVERR_NORECVOLAVAILABLE MAKE_DVHRESULT( 0x018E )
#define DVERR_INVALIDBUFFER MAKE_DVHRESULT( 0x018F )
#define DVERR_LOCKEDBUFFER MAKE_DVHRESULT( 0x0190 )
#ifdef __cplusplus
}
#endif
#endif
Binary file not shown.
+33
View File
@@ -0,0 +1,33 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef IWAVEOUT_H
#define IWAVEOUT_H
#pragma once
// Interface by the voice_tweak app for simple wave output. You must extern a
// specific factory function to create and initialize an instance.
class IWaveOut
{
public:
virtual ~IWaveOut() {}
virtual void Release() = 0;
// Give it samples to mix into the output. The input samples are 16-bit signed mono.
virtual bool PutSamples(short *pSamples, int nSamples) = 0;
// Do idle time processing.
virtual void Idle() = 0;
// Returns the number of samples you've put that haven't been played yet (sitting in the buffer
// waiting to be played).
virtual int GetNumBufferedSamples() = 0;
};
#endif // IWAVEOUT_H
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

+13
View File
@@ -0,0 +1,13 @@
//
// VOICE_TWEAK.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////
+128
View File
@@ -0,0 +1,128 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by voice_tweak.rc
//
#define IDS_HELPTEXT 1
#define IDS_ERROR 2
#define IDFURTHERHELP 3
#define IDS_CANTFINDMICBOOST 3
#define IDS_CANTFINDMICVOLUME 4
#define IDSYSTEMSETUP 4
#define IDS_CANTFINDMICMUTE 5
#define IDS_CANTCREATEWAVEIN 6
#define IDS_CANTLOADVOICEMODULE 7
#define IDS_CANTINITCODEC 8
#define IDS_CANTCREATEWAVEOUT 9
#define IDS_NODPLAYVOICE 10
#define IDS_WINDOWTITLE 11
#define IDS_OKAY 12
#define IDS_CANCEL 13
#define IDS_SYSTEMSETUP 14
#define IDS_HELP 15
#define IDS_VOICEINPUT 16
#define IDS_VOLUME 17
#define IDS_ENABLEGAIN 18
#define IDD_VOICE_TWEAK_DIALOG 102
#define IDR_MAINFRAME 128
#define IDC_INSTRUCTIONTEXT 1000
#define IDC_VOICEVOLUME 1001
#define IDC_VOLUMESLIDER 1003
#define IDC_HARDWAREGAIN 1004
#define IDC_VOICEINPUTFRAME 1005
#define IDC_VOLUMELABEL 1006
#define IDS_SPANISH_HELPTEXT 201
#define IDS_SPANISH_ERROR 202
#define IDS_SPANISH_CANTFINDMICBOOST 203
#define IDS_SPANISH_CANTFINDMICVOLUME 204
#define IDS_SPANISH_CANTFINDMICMUTE 205
#define IDS_SPANISH_CANTCREATEWAVEIN 206
#define IDS_SPANISH_CANTLOADVOICEMODULE 207
#define IDS_SPANISH_CANTINITCODEC 208
#define IDS_SPANISH_CANTCREATEWAVEOUT 209
#define IDS_SPANISH_NODPLAYVOICE 210
#define IDS_SPANISH_WINDOWTITLE 211
#define IDS_SPANISH_OKAY 212
#define IDS_SPANISH_CANCEL 213
#define IDS_SPANISH_SYSTEMSETUP 214
#define IDS_SPANISH_HELP 215
#define IDS_SPANISH_VOICEINPUT 216
#define IDS_SPANISH_VOLUME 217
#define IDS_SPANISH_ENABLEGAIN 218
#define IDS_FRENCH_HELPTEXT 300
#define IDS_FRENCH_ERROR 301
#define IDS_FRENCH_CANTFINDMICBOOST 302
#define IDS_FRENCH_CANTFINDMICVOLUME 303
#define IDS_FRENCH_CANTFINDMICMUTE 304
#define IDS_FRENCH_CANTCREATEWAVEIN 305
#define IDS_FRENCH_CANTLOADVOICEMODULE 306
#define IDS_FRENCH_CANTINITCODEC 307
#define IDS_FRENCH_CANTCREATEWAVEOUT 308
#define IDS_FRENCH_NODPLAYVOICE 309
#define IDS_FRENCH_WINDOWTITLE 310
#define IDS_FRENCH_OKAY 311
#define IDS_FRENCH_CANCEL 312
#define IDS_FRENCH_SYSTEMSETUP 313
#define IDS_FRENCH_HELP 314
#define IDS_FRENCH_VOICEINPUT 315
#define IDS_FRENCH_VOLUME 316
#define IDS_FRENCH_ENABLEGAIN 317
#define IDS_ITALIAN_HELPTEXT 400
#define IDS_ITALIAN_ERROR 401
#define IDS_ITALIAN_CANTFINDMICBOOST 402
#define IDS_ITALIAN_CANTFINDMICVOLUME 403
#define IDS_ITALIAN_CANTFINDMICMUTE 404
#define IDS_ITALIAN_CANTCREATEWAVEIN 405
#define IDS_ITALIAN_CANTLOADVOICEMODULE 406
#define IDS_ITALIAN_CANTINITCODEC 407
#define IDS_ITALIAN_CANTCREATEWAVEOUT 408
#define IDS_ITALIAN_NODPLAYVOICE 409
#define IDS_ITALIAN_WINDOWTITLE 410
#define IDS_ITALIAN_OKAY 411
#define IDS_ITALIAN_CANCEL 412
#define IDS_ITALIAN_SYSTEMSETUP 413
#define IDS_ITALIAN_HELP 414
#define IDS_ITALIAN_VOICEINPUT 415
#define IDS_ITALIAN_VOLUME 416
#define IDS_ITALIAN_ENABLEGAIN 417
#define IDS_GERMAN_HELPTEXT 500
#define IDS_GERMAN_ERROR 501
#define IDS_GERMAN_CANTFINDMICBOOST 502
#define IDS_GERMAN_CANTFINDMICVOLUME 503
#define IDS_GERMAN_CANTFINDMICMUTE 504
#define IDS_GERMAN_CANTCREATEWAVEIN 505
#define IDS_GERMAN_CANTLOADVOICEMODULE 506
#define IDS_GERMAN_CANTINITCODEC 507
#define IDS_GERMAN_CANTCREATEWAVEOUT 508
#define IDS_GERMAN_NODPLAYVOICE 509
#define IDS_GERMAN_WINDOWTITLE 510
#define IDS_GERMAN_OKAY 511
#define IDS_GERMAN_CANCEL 512
#define IDS_GERMAN_SYSTEMSETUP 513
#define IDS_GERMAN_HELP 514
#define IDS_GERMAN_VOICEINPUT 515
#define IDS_GERMAN_VOLUME 516
#define IDS_GERMAN_ENABLEGAIN 517
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 133
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1007
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
+256
View File
@@ -0,0 +1,256 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// voice_tweak.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include <assert.h>
#include "voice_tweak.h"
#include "waveout.h"
#include "voice_tweakDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//extern IVoiceRecord* CreateVoiceRecord_WaveIn(int sampleRate);
extern IVoiceRecord* CreateVoiceRecord_DSound(int sampleRate);
typedef enum
{
LANGUAGE_ENGLISH=0,
LANGUAGE_SPANISH=1,
LANGUAGE_FRENCH=2,
LANGUAGE_ITALIAN=3,
LANGUAGE_GERMAN=4,
LANGUAGE_COUNT=5
} VoiceTweakLanguageID;
VoiceTweakLanguageID g_CurrentLanguage = LANGUAGE_ENGLISH;
#define LANGENTRY(name) {IDS_##name##, IDS_SPANISH_##name##, IDS_FRENCH_##name##, IDS_ITALIAN_##name##, IDS_GERMAN_##name##}
int g_StringIDs[][LANGUAGE_COUNT] =
{
LANGENTRY(HELPTEXT),
LANGENTRY(ERROR),
LANGENTRY(CANTFINDMICBOOST),
LANGENTRY(CANTFINDMICVOLUME),
LANGENTRY(CANTFINDMICMUTE),
LANGENTRY(CANTCREATEWAVEIN),
LANGENTRY(CANTLOADVOICEMODULE),
LANGENTRY(CANTCREATEWAVEOUT),
LANGENTRY(NODPLAYVOICE),
LANGENTRY(WINDOWTITLE),
LANGENTRY(OKAY),
LANGENTRY(CANCEL),
LANGENTRY(SYSTEMSETUP),
LANGENTRY(HELP),
LANGENTRY(VOICEINPUT),
LANGENTRY(VOLUME),
LANGENTRY(ENABLEGAIN),
};
#define NUM_STRINGIDS (sizeof(g_StringIDs)/sizeof(g_StringIDs[0]))
// Pass in the english string ID, and this returns the string ID in the current language.
int MapLanguageStringID( int idEnglish )
{
for( int i=0; i < NUM_STRINGIDS; i++ )
{
if( idEnglish == g_StringIDs[i][LANGUAGE_ENGLISH] )
return g_StringIDs[i][g_CurrentLanguage];
}
assert( !"MapLanguageStringID: unknown string ID" );
return 0;
}
/////////////////////////////////////////////////////////////////////////////
// CVoiceTweakApp
BEGIN_MESSAGE_MAP(CVoiceTweakApp, CWinApp)
//{{AFX_MSG_MAP(CVoiceTweakApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVoiceTweakApp construction
CVoiceTweakApp::CVoiceTweakApp()
{
m_pVoiceRecord = 0;
m_pWaveOut = 0;
m_pMixerControls = 0;
}
CVoiceTweakApp::~CVoiceTweakApp()
{
StopDevices();
}
bool CVoiceTweakApp::StartDevices()
{
StopDevices();
CString str, errStr;
// Setup wave in.
if( !(m_pVoiceRecord = CreateVoiceRecord_DSound(VOICE_TWEAK_SAMPLE_RATE)) )
{
//if( !(m_pVoiceRecord = CreateVoiceRecord_WaveIn(VOICE_TWEAK_SAMPLE_RATE)) )
{
str.LoadString( MapLanguageStringID(IDS_CANTCREATEWAVEIN) );
::MessageBox(NULL, str, errStr, MB_OK);
return false;
}
}
m_pVoiceRecord->RecordStart();
if( !(m_pWaveOut = CreateWaveOut(VOICE_TWEAK_SAMPLE_RATE)) )
{
str.LoadString( MapLanguageStringID(IDS_CANTCREATEWAVEOUT) );
::MessageBox(NULL, str, errStr, MB_OK);
return false;
}
return true;
}
void CVoiceTweakApp::StopDevices()
{
if(m_pVoiceRecord)
{
m_pVoiceRecord->Release();
m_pVoiceRecord = NULL;
}
if(m_pWaveOut)
{
m_pWaveOut->Release();
m_pWaveOut = NULL;
}
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CVoiceTweakApp object
CVoiceTweakApp theApp;
char const* FindArg(char const *pName)
{
for(int i=0; i < __argc; i++)
if(stricmp(__argv[i], pName) == 0)
return ((i+1) < __argc) ? __argv[i+1] : "";
return NULL;
}
/////////////////////////////////////////////////////////////////////////////
// CVoiceTweakApp initialization
BOOL CVoiceTweakApp::InitInstance()
{
// Set the thread locale so it grabs the string resources for the right language. If
// we don't have resources for the system default language, it just uses English.
if( FindArg("-french") )
g_CurrentLanguage = LANGUAGE_FRENCH;
else if( FindArg("-spanish") )
g_CurrentLanguage = LANGUAGE_SPANISH;
else if(FindArg("-italian"))
g_CurrentLanguage = LANGUAGE_ITALIAN;
else if(FindArg("-german"))
g_CurrentLanguage = LANGUAGE_GERMAN;
else
g_CurrentLanguage = LANGUAGE_ENGLISH;
CString errStr, str;
errStr.LoadString( MapLanguageStringID(IDS_ERROR) );
m_pMixerControls = GetMixerControls();
// Initialize the mixer controls.
bool bFoundVolume, bFoundMute;
float volume, mute;
bFoundVolume = m_pMixerControls->GetValue_Float(IMixerControls::Control::MicVolume, volume);
bFoundMute = m_pMixerControls->GetValue_Float(IMixerControls::Control::MicMute, mute);
if(!bFoundVolume)
{
str.LoadString( MapLanguageStringID(IDS_CANTFINDMICVOLUME) );
::MessageBox(NULL, str, errStr, MB_OK);
return FALSE;
}
if(!bFoundMute)
{
str.LoadString( MapLanguageStringID(IDS_CANTFINDMICMUTE) );
::MessageBox(NULL, str, errStr, MB_OK);
return FALSE;
}
// Set mute and boost for them automatically.
m_pMixerControls->SetValue_Float(IMixerControls::Control::MicMute, 1);
// We cycle the mic boost because for some reason Windows misses the first call to set it to 1, but
// if the user clicks the checkbox on and off again, it works.
m_pMixerControls->SetValue_Float(IMixerControls::Control::MicBoost, 1);
m_pMixerControls->SetValue_Float(IMixerControls::Control::MicBoost, 0);
m_pMixerControls->SetValue_Float(IMixerControls::Control::MicBoost, 1);
// Enable the mic for wave input.
m_pMixerControls->SelectMicrophoneForWaveInput();
if(!StartDevices())
return false;
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CVoiceTweakDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
+82
View File
@@ -0,0 +1,82 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// voice_tweak.h : main header file for the VOICE_TWEAK application
//
#if !defined(AFX_VOICE_TWEAK_H__7343765B_B2E9_4E37_AA34_242E0B635AF1__INCLUDED_)
#define AFX_VOICE_TWEAK_H__7343765B_B2E9_4E37_AA34_242E0B635AF1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
#include "voice_mixer_controls.h"
#include "ivoicerecord.h"
#include "iwaveout.h"
#include "ivoicecodec.h"
#include "interface.h"
#include "voice_gain.h"
#define VOICE_TWEAK_SAMPLE_RATE 22050
// Pass in the english string ID, and this returns the string ID in the current language.
int MapLanguageStringID( int idEnglish );
/////////////////////////////////////////////////////////////////////////////
// CVoiceTweakApp:
// See voice_tweak.cpp for the implementation of this class
//
class CVoiceTweakApp : public CWinApp
{
public:
CVoiceTweakApp();
~CVoiceTweakApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CVoiceTweakApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Init and deinit the record, waveOut, and voice codec.
bool StartDevices();
void StopDevices();
IVoiceRecord *m_pVoiceRecord;
IWaveOut *m_pWaveOut;
IMixerControls *m_pMixerControls;
// Implementation
//{{AFX_MSG(CVoiceTweakApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VOICE_TWEAK_H__7343765B_B2E9_4E37_AA34_242E0B635AF1__INCLUDED_)
+353
View File
@@ -0,0 +1,353 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\voice_tweak.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\voice_tweak.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_VOICE_TWEAK_DIALOG DIALOGEX 0, 0, 314, 250
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Valve Voice Configuration"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "Slider1",IDC_VOLUMESLIDER,"msctls_trackbar32",TBS_VERT |
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,54,36,16,156
CONTROL "Enable +20dB hardware gain (leave checked if unsure)",
IDC_HARDWAREGAIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,
212,300,10
DEFPUSHBUTTON "OK",IDOK,7,229,96,14
PUSHBUTTON "Cancel",IDCANCEL,108,229,96,14
PUSHBUTTON "System Setup",IDSYSTEMSETUP,211,229,96,14
EDITTEXT IDC_INSTRUCTIONTEXT,91,7,216,197,ES_MULTILINE |
ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP
GROUPBOX "Voice Input",IDC_VOICEINPUTFRAME,7,7,75,197
CONTROL "Progress1",IDC_VOICEVOLUME,"msctls_progress32",
PBS_VERTICAL | WS_BORDER,19,28,11,160
LTEXT "Volume:",IDC_VOLUMELABEL,49,25,26,8
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "Valve\0"
VALUE "FileDescription", "Voice_Tweak Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "Voice_Tweak Application\0"
VALUE "LegalCopyright", "Copyright (c) 1996-2003\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "voice_tweak.exe\0"
VALUE "ProductName", "Voice_Tweak Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_VOICE_TWEAK_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 307
VERTGUIDE, 28
VERTGUIDE, 39
VERTGUIDE, 133
TOPMARGIN, 7
BOTTOMMARGIN, 243
HORZGUIDE, 28
HORZGUIDE, 188
HORZGUIDE, 204
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELPTEXT "The first step to getting voice working in the Half-Life platform is to make sure your microphone is plugged in.\r\n\r\nPlug your microphone into the microphone jack on your sound card. If you don't know which one is the microphone jack, try each one and speak into the microphone each time. When you've found the right one, you should hear your voice coming out of your PC speakers.\r\n\r\nNext, adjust the distance from the microphone to your mouth and adjust the volume slider until your voice sounds good to you. This is how you will sound to other players in the game.\r\n\r\nIf you are not using headphones for audio output, be sure that your microphone is far enough away from your speakers or else you may get feedback which manifests itself as a loud high-pitched whine.\r\n\r\nIf you are unable to get your microphone working here, try clicking System Setup, which will do more extensive tests to get your microphone working."
IDS_ERROR "Error!"
IDS_CANTFINDMICBOOST "Warning: couldn't find microphone boost control."
IDS_CANTFINDMICVOLUME "Couldn't find mic volume."
IDS_CANTFINDMICMUTE "Couldn't find mic mute."
IDS_CANTCREATEWAVEIN "Can't create a DirectSound or waveIn device."
IDS_CANTLOADVOICEMODULE "Can't load voice codec in %1!s!."
IDS_CANTINITCODEC "Can't initialize voice codec in %1!s!."
IDS_CANTCREATEWAVEOUT "Can't initialize waveOut."
IDS_NODPLAYVOICE "Can't initialize DirectPlayVoice setup."
IDS_WINDOWTITLE "Valve Voice Configuration"
IDS_OKAY "Okay"
IDS_CANCEL "Cancel"
IDS_SYSTEMSETUP "System Setup"
IDS_HELP "Help"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_VOICEINPUT "Voice Input"
IDS_VOLUME "Volume"
IDS_ENABLEGAIN "Enable +20dB hardware gain (leave checked if unsure)"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_SPANISH_HELPTEXT "El primer paso para que funcione la comunicación vocal en la plataforma de Half-Life es asegurarse de que el micrófono está conectado.\r\n\r\nConecta tu micrófono en la entrada apropiada de la tarjeta de sonido. Si no sabes cuál es, intenta cada una de ellas y habla por el micrófono. Cuando hayas encontrado la entrada correcta, oirás tu voz por los altavoces del PC.\r\n\r\nA continuación ajusta la distancia entre el micrófono y tu boca y ajusta el control deslizante del volumen hasta que te guste cómo suena tu voz. Así te oirán el resto de jugadores durante la partida.\r\n\r\nSi no utilizas auriculares para la salida de audio, asegúrate de que tu micrófono está lo suficientemente lejos de los altavoces o el sonido se emitirá como un silbido fuerte y agudo.\r\n\r\nSi no consigues que tu micrófono funcione, intenta hacer clic en System Setup (instalación del sistema) para hacer más pruebas y solucionar el problema."
IDS_SPANISH_ERROR "¡Error!"
IDS_SPANISH_CANTFINDMICBOOST
"Aviso: no se ha podido encontrar el control de graves del micrófono."
IDS_SPANISH_CANTFINDMICVOLUME
"No se ha podido encontrar el mic volume (volumen de las entradas de mic)."
IDS_SPANISH_CANTFINDMICMUTE
"No se ha podido encontrar mic mute (mic bloqueado)."
IDS_SPANISH_CANTCREATEWAVEIN
"No se puede crear el dispositivo de entrada de sonido (waveIn) (mono a 16 bits y 8 KB)."
IDS_SPANISH_CANTLOADVOICEMODULE
"No se puede cargar el codec vocal en %1!s!."
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_SPANISH_CANTINITCODEC
"No se puede inicializar el codec vocal en %1!s!."
IDS_SPANISH_CANTCREATEWAVEOUT
"No se puede inicializar el dispositivo de salida de sonido (waveOut)."
IDS_SPANISH_NODPLAYVOICE
"No se puede inicializar la instalación de DirectPlayVoice."
IDS_SPANISH_WINDOWTITLE "Configuración del procesador de voz"
IDS_SPANISH_OKAY "Aceptar"
IDS_SPANISH_CANCEL "Cancelar"
IDS_SPANISH_SYSTEMSETUP "Instalación del sistema"
IDS_SPANISH_HELP "Ayuda"
IDS_SPANISH_VOICEINPUT "Entrada de voz"
IDS_SPANISH_VOLUME "Volumen"
IDS_SPANISH_ENABLEGAIN "Permitir aumento de más de 20dB de hardware (déjalo marcado si no estás seguro)"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_FRENCH_HELPTEXT "Afin d'utiliser les communications vocales dans Half-Life, vous devez tout d'abord vérifier que votre microphone est correctement branché.\r\n\r\nBranchez le microphone dans la prise microphone de votre carte son. Si vous ne savez pas quelle prise de la carte son est la prise microphone, essayez toutes les prises libres et testez votre microphone à chaque fois. Lorsque vous avez trouvé la bonne prise, vous devriez entendre votre voix dans les haut-parleurs de votre PC.\r\n\r\nEnsuite, placez le microphone à bonne distance de votre bouche et réglez les paramètres de volume pour que votre voix ressorte correctement.\r\n\r\nSi vous n'utilisez pas un casque, assurez-vous que le microphone n'est pas placé trop prêt des haut-parleurs. Vous risquez sinon d'entendre des bruits parasites, par exemple un effet larsen qui se caractérise par un sifflement aigu.\r\n\r\nSi vous n'arrivez pas à faire fonctionner votre microphone, essayez de vérifier depuis Panneau de Configuration/Système que votre carte son et tous les ports correspondants sont correctement installés."
IDS_FRENCH_ERROR "Erreur !"
IDS_FRENCH_CANTFINDMICBOOST
"Attention : impossible de trouver le contrôle de gain microphone."
IDS_FRENCH_CANTFINDMICVOLUME "Impossible de trouver volume microphone."
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_FRENCH_CANTFINDMICMUTE "Impossible de trouver muet microphone."
IDS_FRENCH_CANTCREATEWAVEIN
"Impossible de créer un périphérique waveIn (16 bits mono en 8 k)."
IDS_FRENCH_CANTLOADVOICEMODULE
"Impossible de charger le codec voix en %1!s!."
IDS_FRENCH_CANTINITCODEC
"Impossible d'initialiser le codec voix en %1!s!."
IDS_FRENCH_CANTCREATEWAVEOUT "Impossible d'initialiser waveOut."
IDS_FRENCH_NODPLAYVOICE "Impossible d'initialiser le paramétrage de DirectPlayVoice."
IDS_FRENCH_WINDOWTITLE "Configuration Voix Valve"
IDS_FRENCH_OKAY "OK"
IDS_FRENCH_CANCEL "Annuler"
IDS_FRENCH_SYSTEMSETUP "Configuration"
IDS_FRENCH_HELP "Aide"
IDS_FRENCH_VOICEINPUT "Entrée voix"
IDS_FRENCH_VOLUME "Volume"
IDS_FRENCH_ENABLEGAIN "Activer un gain matériel de +20 Db (laissez cocher en cas de doute)"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ITALIAN_HELPTEXT "Il primo passo per utilizzare la voce in Half-Life è accertarsi che il microfono sia collegato correttamente.\r\n\r\nInserisci il microfono nell'apposita presa della scheda audio. Se non sai quale sia, provale tutte e procedi per tentativi provando a parlare nel microfono. Quando trovi quella giusta, dovresti sentire la tua voce provenire dagli altoparlanti del PC. \r\n\r\nA questo punto, aggiusta la distanza del microfono dalla bocca e regola il volume in modo che la voce risulti gradevole. Questo livello sarà infatti quello che sentiranno gli altri giocatori. \r\n\r\nSe non stai utilizzando le cuffie per ascoltare l'audio, assicurati che il microfono sia distante dagli altoparlanti. In caso contrario potrebbero manifestarsi dei disturbi legati al rientro dell'audio.\r\n\r\nSe non riesci a utilizzare il microfono, prova ad attivare il setup del sistema in modo che venga effettuato un test che verifichi accuratamente il funzionamento del microfono."
IDS_ITALIAN_ERROR "Errore!"
IDS_ITALIAN_CANTFINDMICBOOST
"Attenzione: impossibile trovare il controllo per incrementare il segnale del microfono."
IDS_ITALIAN_CANTFINDMICVOLUME
"Impossibile trovare il volume del microfono."
IDS_ITALIAN_CANTFINDMICMUTE
"Impossibile trovare il comando mute per il microfono."
IDS_ITALIAN_CANTCREATEWAVEIN
"Impossibile creare un device waveIn (16 Bit-Signed Mono a 8K)"
IDS_ITALIAN_CANTLOADVOICEMODULE
"Impossibile caricare il voice codec in %1!s!."
IDS_ITALIAN_CANTINITCODEC
"Impossibile inizializzare il voice codec in %1!s!."
IDS_ITALIAN_CANTCREATEWAVEOUT "Impossibile inizializzare waveOut."
IDS_ITALIAN_NODPLAYVOICE
"Impossibile inizializzare il setup di DirectPlayVoice."
IDS_ITALIAN_WINDOWTITLE "Configurazione supporto vocale Valve"
IDS_ITALIAN_OKAY "OK"
IDS_ITALIAN_CANCEL "Annulla"
IDS_ITALIAN_SYSTEMSETUP "Impostazioni di sistema"
IDS_ITALIAN_HELP "Aiuto"
IDS_ITALIAN_VOICEINPUT "Input vocale"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ITALIAN_VOLUME "Volume"
IDS_ITALIAN_ENABLEGAIN "Attiva l'incremento audio di 20 dB (lascia attivo se non sei sicuro)"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_GERMAN_HELPTEXT "Der erste Schritt zur Aktivierung des Sprach-Features bei der HALF-LIFE-Plattform besteht darin, sicherzustellen, dass das Mikrofon angeschlossen ist.\r\n\r\nVerbinden Sie das Mikrofon mit der Mikrofonbuchse Ihrer Soundkarte. Wenn Sie nicht wissen, welche die Mikrofonbuchse ist, probieren Sie alle aus und sprechen Sie dabei jedes Mal ins Mikrofon. Wenn Sie die richtige gefunden haben, sollten Sie Ihre Stimme über die Lautsprecher Ihres PCs hören.\r\n\r\nAls Nächstes stellen Sie die Entfernung zwischen Ihrem Mund und dem Mikrofon ein und regeln die Lautstärke so, dass Ihre Stimme gut zu verstehen ist. Die anderen Spieler werden Sie im Spiel genau so hören.\r\n\r\nWenn Sie für die Soundausgabe keinen Kopfhörer benutzen, achten Sie darauf, dass sich Ihr Mikrofon weit genug von den Lautsprechern entfernt befindet, da Sie anderenfalls eine Rückkopplung verursachen, die sich als lautes, hohes Pfeifen bemerkbar macht.\r\n\r\nSollte es Ihnen nicht gelingen, das Mikrofon in Betrieb zu nehmen, klicken Sie bitte auf System-Setup, um intensivere Tests durchzuführen und das Mikrofon auf diese Weise einzurichten."
IDS_GERMAN_ERROR "Fehler!"
IDS_GERMAN_CANTFINDMICBOOST
"Achtung: Verstärkersteuerung für Mikrofon konnte nicht gefunden werden."
IDS_GERMAN_CANTFINDMICVOLUME
"Mikro-Lautstärkeregelung konnte nicht gefunden werden."
IDS_GERMAN_CANTFINDMICMUTE
"Mikro-Stummschaltung konnte nicht gefunden werden."
IDS_GERMAN_CANTCREATEWAVEIN
"WaveIn-Gerät konnte nicht erstellt werden (16-Bit-Mono bei 8 K)."
IDS_GERMAN_CANTLOADVOICEMODULE
"Sprach-Codec konnte nicht in %1!s! geladen werden."
IDS_GERMAN_CANTINITCODEC
"Sprach-Codec konnte nicht in %1!s! initialisiert werden."
IDS_GERMAN_CANTCREATEWAVEOUT "WaveOut konnte nicht initialisiert werden."
IDS_GERMAN_NODPLAYVOICE "DirectPlayVoice-Setup konnte nicht initialisiert werden."
IDS_GERMAN_WINDOWTITLE "Valve - Sprach-Konfiguration"
IDS_GERMAN_OKAY "OK"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_GERMAN_CANCEL "Abbrechen"
IDS_GERMAN_SYSTEMSETUP "System - Setup"
IDS_GERMAN_HELP "Hilfe"
IDS_GERMAN_VOICEINPUT "Spracheingabe"
IDS_GERMAN_VOLUME "Lautst"
IDS_GERMAN_ENABLEGAIN "+20dB Hardware-Gain aktivieren (Markierung belassen, wenn nicht sicher)"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\voice_tweak.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
+302
View File
@@ -0,0 +1,302 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="voice_tweak"
ProjectGUID="{C570FFDC-AEFA-45BD-B3F4-44722478DE4F}"
SccProjectName=""
SccAuxPath=""
SccLocalPath=""
SccProvider=""
Keyword="MFCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\public,..\..\public\tier1,..\..\engine,..\..\common,.\dxsdk,..\..\engine\audio\private,..\..\engine\audio\public"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;VOICE_TWEAK_APP"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Debug/voice_tweak.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="4"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"
CommandLine="if exist ..\..\..\game\bin\&quot;$(TargetName)&quot;.exe attrib -r ..\..\..\game\bin\&quot;$(TargetName)&quot;.exe
copy &quot;$(TargetPath)&quot; ..\..\..\game\bin
"
Outputs="..\..\..\game\bin\$(TargetName).exe"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="nafxcwd.lib libcmtd.lib dxsdk\dxguid.lib winmm.lib dxguid.lib"
OutputFile=".\Debug/voice_tweak.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
IgnoreDefaultLibraryNames="libcmtd.lib,nafxcwd.lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/voice_tweak.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Debug/voice_tweak.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\public,..\..\public\tier1,..\..\engine,..\..\common,.\dxsdk,..\..\engine\audio\private,..\..\engine\audio\public"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;VOICE_TWEAK_APP"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Release/voice_tweak.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="4"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"
CommandLine="if exist ..\..\..\game\bin\&quot;$(TargetName)&quot;.exe attrib -r ..\..\..\game\bin\&quot;$(TargetName)&quot;.exe
copy &quot;$(TargetPath)&quot; ..\..\..\game\bin
"
Outputs="..\..\..\game\bin\$(TargetName).exe"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="nafxcw.lib libcmt.lib dxsdk\dxguid.lib winmm.lib dxguid.lib"
OutputFile=".\Release/voice_tweak.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
IgnoreDefaultLibraryNames="libcmt.lib,nafxcw.lib"
ProgramDatabaseFile=".\Release/voice_tweak.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Release/voice_tweak.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\..\engine\audio\private\circularbuffer.cpp">
</File>
<File
RelativePath="..\..\public\tier0\memoverride.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
</FileConfiguration>
</File>
<File
RelativePath="StdAfx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\engine\audio\private\voice_gain.cpp">
</File>
<File
RelativePath="..\..\engine\audio\private\voice_mixer_controls.cpp">
</File>
<File
RelativePath="..\..\engine\audio\private\voice_record_dsound.cpp">
</File>
<File
RelativePath="voice_tweak.cpp">
</File>
<File
RelativePath="voice_tweak.rc">
</File>
<File
RelativePath="voice_tweakDlg.cpp">
</File>
<File
RelativePath="..\..\engine\audio\private\voice_wavefile.cpp">
</File>
<File
RelativePath="waveout.cpp">
</File>
<File
RelativePath="win_idle.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="iwaveout.h">
</File>
<File
RelativePath="Resource.h">
</File>
<File
RelativePath="voice_tweak.h">
</File>
<File
RelativePath="voice_tweakDlg.h">
</File>
<File
RelativePath="waveout.h">
</File>
<File
RelativePath="win_idle.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="res\voice_tweak.ico">
</File>
<File
RelativePath="res\voice_tweak.rc2">
</File>
</Filter>
<File
RelativePath="ReadMe.txt">
</File>
<File
RelativePath="..\..\lib\public\tier0.lib">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description=""
CommandLine=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCustomBuildTool"
Description=""
CommandLine=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\lib\public\tier1.lib">
</File>
<File
RelativePath="..\..\lib\public\vstdlib.lib">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCustomBuildTool"
Description=""
CommandLine=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCustomBuildTool"
Description=""
CommandLine=""/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
+408
View File
@@ -0,0 +1,408 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// voice_tweakDlg.cpp : implementation file
//
#include "stdafx.h"
#include "voice_tweak.h"
#include "voice_tweakDlg.h"
#include "voice_gain.h"
#include "dvoice.h"
void TermDPlayVoice( HINSTANCE &hInst, IDirectPlayVoiceTest* &pVoice )
{
if( pVoice )
{
pVoice->Release();
pVoice = NULL;
}
if( hInst )
{
FreeLibrary( hInst );
hInst = NULL;
}
}
bool InitDPlayVoice( HINSTANCE &hInst, IDirectPlayVoiceTest* &pVoice )
{
typedef HRESULT (WINAPI *DirectPlayVoiceCreateFn)(
GUID* pcIID,
void** ppvInterface,
IUnknown* pUnknown
);
hInst = NULL;
pVoice = NULL;
hInst = LoadLibrary( "dpvoice.dll" );
if(hInst)
{
DirectPlayVoiceCreateFn fn = (DirectPlayVoiceCreateFn)GetProcAddress(hInst, "DirectPlayVoiceCreate");
if(fn)
{
HRESULT hr = fn((GUID*)&IID_IDirectPlayVoiceTest, (void**)&pVoice, NULL);
if( SUCCEEDED( hr ) )
return true;
}
}
TermDPlayVoice( hInst, pVoice );
return false;
}
bool IsDPlayVoiceAvailable()
{
HINSTANCE hInst;
IDirectPlayVoiceTest *pVoice;
bool bRet = InitDPlayVoice( hInst, pVoice );
TermDPlayVoice( hInst, pVoice );
return bRet;
}
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define VOLUMESLIDER_RANGE 1000
CVoiceTweakApp* TweakApp() {return (CVoiceTweakApp*)AfxGetApp();}
extern "C"
{
void Con_DPrintf (char *fmt, ...);
void Con_Printf (char *fmt, ...);
}
void PrintToTraceWindow(const char *fmt, va_list marker)
{
char msg[2048];
_vsnprintf(msg, sizeof(msg), fmt, marker);
OutputDebugString(msg);
}
void Con_DPrintf (char *fmt, ...)
{
va_list marker;
va_start(marker, fmt);
PrintToTraceWindow(fmt, marker);
va_end(marker);
}
void Con_Printf (char *fmt, ...)
{
va_list marker;
va_start(marker, fmt);
PrintToTraceWindow(fmt, marker);
va_end(marker);
}
/////////////////////////////////////////////////////////////////////////////
// CVoiceTweakDlg dialog
CVoiceTweakDlg::CVoiceTweakDlg(CWnd* pParent /*=NULL*/)
: CDialog(CVoiceTweakDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CVoiceTweakDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
CVoiceTweakDlg::~CVoiceTweakDlg()
{
Term();
}
void CVoiceTweakDlg::Term()
{
m_WinIdle.EndIdle();
}
void CVoiceTweakDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CVoiceTweakDlg)
DDX_Control(pDX, IDC_HARDWAREGAIN, m_HardwareGain);
DDX_Control(pDX, IDC_VOICEVOLUME, m_VoiceVolume);
DDX_Control(pDX, IDC_VOLUMESLIDER, m_VolumeSlider);
DDX_Control(pDX, IDC_INSTRUCTIONTEXT, m_InstructionText);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CVoiceTweakDlg, CDialog)
//{{AFX_MSG_MAP(CVoiceTweakDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_MESSAGE(WM_TWEAKIDLE, OnIdle)
ON_WM_DESTROY()
ON_BN_CLICKED(IDC_HARDWAREGAIN, OnHardwareGain)
ON_BN_CLICKED(IDFURTHERHELP, OnFurtherhelp)
ON_BN_CLICKED(IDSYSTEMSETUP, OnSystemSetup)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
IMixerControls* GetAppMixerControls()
{
return ((CVoiceTweakApp*)AfxGetApp())->m_pMixerControls;
}
void CVoiceTweakDlg::SetString(int childControl, int stringID)
{
if(CWnd *pWnd = GetDlgItem(childControl))
{
CString str;
str.LoadString(stringID);
pWnd->SetWindowText(str);
}
}
/////////////////////////////////////////////////////////////////////////////
// CVoiceTweakDlg message handlers
BOOL CVoiceTweakDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CString str;
str.LoadString( MapLanguageStringID(IDS_HELPTEXT) );
m_InstructionText.SetWindowText(str);
// Save off their old settings so we can restore if they hit cancel.
GetAppMixerControls()->GetValue_Float(IMixerControls::Control::MicVolume, m_OldVolume);
float bBoostOn;
if(GetAppMixerControls()->GetValue_Float(IMixerControls::Control::MicBoost, bBoostOn))
{
m_HardwareGain.SetCheck((int)bBoostOn);
}
else
{
m_HardwareGain.ShowWindow(SW_HIDE);
}
// Initialize the volume control.
m_VolumeSlider.SetRange(0, 1000);
m_VolumeSlider.SetPos((int)(VOLUMESLIDER_RANGE - m_OldVolume * VOLUMESLIDER_RANGE));
m_VoiceVolume.SetRange32(0, (1 << (BYTES_PER_SAMPLE*8-1)) - 1);
// Get idle messages...
m_WinIdle.StartIdle(GetSafeHwnd(), WM_TWEAKIDLE, 0,0, 10);
m_WinIdle.NextIdle();
// Set all the dialog item strings for localization.
SetString(IDOK, MapLanguageStringID(IDS_OKAY));
SetString(IDCANCEL, MapLanguageStringID(IDS_CANCEL));
SetString(IDC_VOICEINPUTFRAME, MapLanguageStringID(IDS_VOICEINPUT));
SetString(IDC_VOLUMELABEL, MapLanguageStringID(IDS_VOLUME));
SetString(IDC_HARDWAREGAIN, MapLanguageStringID(IDS_ENABLEGAIN));
SetString(IDSYSTEMSETUP, MapLanguageStringID(IDS_SYSTEMSETUP));
SetString(IDFURTHERHELP, MapLanguageStringID(IDS_HELP));
CString titleStr;
titleStr.LoadString( MapLanguageStringID(IDS_WINDOWTITLE) );
SetWindowText(titleStr);
if( !IsDPlayVoiceAvailable() )
{
CWnd *pWnd = GetDlgItem( IDSYSTEMSETUP );
if( pWnd )
pWnd->EnableWindow( false );
}
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CVoiceTweakDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CVoiceTweakDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BOOL CVoiceTweakDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
NMHDR *pHdr = (NMHDR*)lParam;
if(pHdr->hwndFrom == m_VolumeSlider.m_hWnd)
{
GetAppMixerControls()->SetValue_Float(IMixerControls::Control::MicVolume, (VOLUMESLIDER_RANGE - m_VolumeSlider.GetPos()) / (float)VOLUMESLIDER_RANGE);
}
return CDialog::OnNotify(wParam, lParam, pResult);
}
LONG CVoiceTweakDlg::OnIdle(UINT a, LONG b)
{
static DWORD startTime = GetTickCount();
if( TweakApp()->m_pVoiceRecord )
{
short samples[22 * 1024];
// If the output has too many buffered samples, skip some data.
TweakApp()->m_pWaveOut->Idle();
int nBufferedSamples = TweakApp()->m_pWaveOut->GetNumBufferedSamples();
float nSeconds = nBufferedSamples / (float)VOICE_TWEAK_SAMPLE_RATE;
int nMinSamples = VOICE_TWEAK_SAMPLE_RATE / 5;
if( nBufferedSamples < nMinSamples )
{
// We want at least a certain amount of buffered data.
int nSamplesToAdd = nMinSamples - nBufferedSamples;
memset( samples, 0, nSamplesToAdd*2 );
TweakApp()->m_pWaveOut->PutSamples( samples, nSamplesToAdd );
}
else
{
// Get the samples.
int nSamples = TweakApp()->m_pVoiceRecord->GetRecordedData(samples, sizeof(samples)/BYTES_PER_SAMPLE);
if( nSeconds < 0.5f )
{
// Find the highest value.
int highValue = -100000;
for(int i=0; i < nSamples; i++)
highValue = max(abs(samples[i]), highValue);
// Set our status bar accordingly.
highValue = (highValue >> 9) << 9; // Get rid of flicker.
m_VoiceVolume.SetPos(highValue);
// Give the samples to the wave output...
if(TweakApp()->m_pWaveOut)
{
// Ignore the first second or so.. it's usually garbage.
DWORD curTime = GetTickCount();
static DWORD silentTime = 500;
static DWORD fadeInTime = 1000;
if( curTime - startTime < silentTime )
{
memset( samples, 0, nSamples*2 );
}
else if( (curTime-silentTime) - startTime < fadeInTime )
{
float flFade = ((curTime-silentTime) - startTime) / (float)fadeInTime;
flFade = flFade*flFade;
for( int i=0; i < nSamples; i++ )
samples[i] = (short)( samples[i] * flFade );
}
TweakApp()->m_pWaveOut->PutSamples(samples, nSamples);
}
}
}
}
// Tell the idle thread we're ready for another idle message.
m_WinIdle.NextIdle();
return 0;
}
void CVoiceTweakDlg::OnDestroy()
{
Term();
CDialog::OnDestroy();
}
void CVoiceTweakDlg::OnHardwareGain()
{
if(m_HardwareGain.GetCheck())
GetAppMixerControls()->SetValue_Float(IMixerControls::Control::MicBoost, true);
else
GetAppMixerControls()->SetValue_Float(IMixerControls::Control::MicBoost, false);
}
void CVoiceTweakDlg::OnCancel()
{
// Restore old settings.
GetAppMixerControls()->SetValue_Float(IMixerControls::Control::MicVolume, m_OldVolume);
CDialog::OnCancel();
}
void CVoiceTweakDlg::OnFurtherhelp()
{
}
void CVoiceTweakDlg::OnSystemSetup()
{
TweakApp()->StopDevices();
bool bSucceeded = false;
HINSTANCE hInst;
IDirectPlayVoiceTest *pVoice;
if( InitDPlayVoice( hInst, pVoice ) )
{
pVoice->CheckAudioSetup(NULL, NULL, m_hWnd, DVFLAGS_ALLOWBACK);
TermDPlayVoice( hInst, pVoice );
}
else
{
CString str;
str.LoadString( MapLanguageStringID(IDS_NODPLAYVOICE) );
MessageBox(str);
}
if(!TweakApp()->StartDevices())
AfxPostQuitMessage(0);
}
+85
View File
@@ -0,0 +1,85 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// voice_tweakDlg.h : header file
//
#if !defined(AFX_VOICE_TWEAKDLG_H__DC9D9CC1_33D0_4783_ABEB_F491ABE65935__INCLUDED_)
#define AFX_VOICE_TWEAKDLG_H__DC9D9CC1_33D0_4783_ABEB_F491ABE65935__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "voice_mixer_controls.h"
#include "win_idle.h"
#include "voice_tweak.h"
#define WM_TWEAKIDLE (WM_USER + 111)
/////////////////////////////////////////////////////////////////////////////
// CVoiceTweakDlg dialog
class CVoiceTweakDlg : public CDialog
{
// Construction
public:
CVoiceTweakDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CVoiceTweakDlg();
void SetString(int childControl, int stringID);
void Term();
// Dialog Data
//{{AFX_DATA(CVoiceTweakDlg)
enum { IDD = IDD_VOICE_TWEAK_DIALOG };
CButton m_HardwareGain;
CProgressCtrl m_VoiceVolume;
CSliderCtrl m_VolumeSlider;
CEdit m_InstructionText;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CVoiceTweakDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
CWinIdle m_WinIdle;
CAutoGain m_Gain;
// Old settings (for cancel button).
float m_OldVolume;
// Generated message map functions
//{{AFX_MSG(CVoiceTweakDlg)
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg LONG OnIdle(UINT a, LONG b);
afx_msg void OnDestroy();
afx_msg void OnHardwareGain();
virtual void OnCancel();
afx_msg void OnFurtherhelp();
afx_msg void OnSystemSetup();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VOICE_TWEAKDLG_H__DC9D9CC1_33D0_4783_ABEB_F491ABE65935__INCLUDED_)
+205
View File
@@ -0,0 +1,205 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "stdafx.h"
#include <windows.h>
#include <assert.h>
#include <mmsystem.h>
#include "waveout.h"
#include "ivoicecodec.h"
class CWaveOutHdr
{
public:
WAVEHDR m_Hdr;
CWaveOutHdr *m_pNext;
char m_Data[1];
};
class CWaveOut : public IWaveOut
{
// IWaveOut overrides.
public:
CWaveOut();
virtual ~CWaveOut();
virtual void Release();
virtual bool PutSamples(short *pSamples, int nSamples);
virtual void Idle();
virtual int GetNumBufferedSamples();
public:
bool Init(int sampleRate);
void Term();
private:
void KillOldHeaders();
private:
HWAVEOUT m_hWaveOut;
CWaveOutHdr m_Headers; // Head of a linked list of WAVEHDRs.
int m_nBufferedSamples;
};
CWaveOut::CWaveOut()
{
m_hWaveOut = NULL;
m_Headers.m_pNext = NULL;
m_nBufferedSamples = 0;
}
CWaveOut::~CWaveOut()
{
Term();
}
void CWaveOut::Release()
{
delete this;
}
bool CWaveOut::PutSamples(short *pInSamples, int nInSamples)
{
int granularity = 2048;
while( nInSamples )
{
int nSamples = (nInSamples > granularity) ? granularity : nInSamples;
short *pSamples = pInSamples;
nInSamples -= nSamples;
pInSamples += nSamples;
if(!m_hWaveOut)
return false;
// Kill any old headers..
KillOldHeaders();
// Allocate a header..
CWaveOutHdr *pHdr;
if(!(pHdr = (CWaveOutHdr*)malloc(sizeof(CWaveOutHdr) - 1 + nSamples*2)))
return false;
// Make a new one.
memset(&pHdr->m_Hdr, 0, sizeof(pHdr->m_Hdr));
pHdr->m_Hdr.lpData = pHdr->m_Data;
pHdr->m_Hdr.dwBufferLength = nSamples * 2;
memcpy(pHdr->m_Data, pSamples, nSamples*2);
MMRESULT mmr = waveOutPrepareHeader(m_hWaveOut, &pHdr->m_Hdr, sizeof(pHdr->m_Hdr));
if(mmr != MMSYSERR_NOERROR)
return false;
mmr = waveOutWrite(m_hWaveOut, &pHdr->m_Hdr, sizeof(pHdr->m_Hdr));
if(mmr != MMSYSERR_NOERROR)
{
delete pHdr;
waveOutUnprepareHeader(m_hWaveOut, &pHdr->m_Hdr, sizeof(pHdr->m_Hdr));
return false;
}
m_nBufferedSamples += nSamples;
// Queue up this header until waveOut is done with it.
pHdr->m_pNext = m_Headers.m_pNext;
m_Headers.m_pNext = pHdr;
}
return true;
}
void CWaveOut::Idle()
{
KillOldHeaders();
}
int CWaveOut::GetNumBufferedSamples()
{
return m_nBufferedSamples;
}
bool CWaveOut::Init(int sampleRate)
{
Term();
WAVEFORMATEX format =
{
WAVE_FORMAT_PCM, // wFormatTag
1, // nChannels
sampleRate, // nSamplesPerSec
sampleRate*BYTES_PER_SAMPLE,// nAvgBytesPerSec
BYTES_PER_SAMPLE, // nBlockAlign
BYTES_PER_SAMPLE * 8, // wBitsPerSample
sizeof(WAVEFORMATEX)
};
MMRESULT mmr = waveOutOpen(
&m_hWaveOut,
0,
&format,
0,
0,
CALLBACK_NULL);
return mmr == MMSYSERR_NOERROR;
}
void CWaveOut::Term()
{
if(m_hWaveOut)
{
waveOutClose(m_hWaveOut);
m_hWaveOut = NULL;
}
}
void CWaveOut::KillOldHeaders()
{
// Look for any headers windows is done with.
CWaveOutHdr *pNext;
CWaveOutHdr **ppPrev = &m_Headers.m_pNext;
for(CWaveOutHdr *pCur=m_Headers.m_pNext; pCur; pCur=pNext)
{
pNext = pCur->m_pNext;
if(pCur->m_Hdr.dwFlags & WHDR_DONE)
{
m_nBufferedSamples -= (int)(pCur->m_Hdr.dwBufferLength / 2);
assert(m_nBufferedSamples >= 0);
waveOutUnprepareHeader(m_hWaveOut, &pCur->m_Hdr, sizeof(pCur->m_Hdr));
*ppPrev = pCur->m_pNext;
free(pCur);
}
else
{
ppPrev = &pCur->m_pNext;
}
}
}
IWaveOut* CreateWaveOut(int sampleRate)
{
CWaveOut *pRet = new CWaveOut;
if(pRet && pRet->Init(sampleRate))
{
return pRet;
}
else
{
delete pRet;
return NULL;
}
}
+19
View File
@@ -0,0 +1,19 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef WAVEOUT_H
#define WAVEOUT_H
#pragma once
#include "iwaveout.h"
IWaveOut* CreateWaveOut(int sampleRate);
#endif // WAVEOUT_H
+123
View File
@@ -0,0 +1,123 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// Class for sending idle messages to a window
#include "stdafx.h"
#include "win_idle.h"
// Stub function to get into the object's main thread loop
DWORD WINAPI CWinIdle::ThreadStub(LPVOID pIdle)
{
return ((CWinIdle *)pIdle)->RunIdle();
}
CWinIdle::CWinIdle() :
m_hIdleThread(NULL),
m_hIdleEvent(NULL),
m_hStopEvent(NULL),
m_hWnd(0),
m_uMsg(0),
m_dwDelay(0)
{
}
CWinIdle::~CWinIdle()
{
if (m_hIdleThread)
OutputDebugString("!!CWinIdle Warning!! Idle thread not shut down!\n");
}
DWORD CWinIdle::RunIdle()
{
// Set up an event list
HANDLE aEvents[2];
aEvents[0] = m_hStopEvent;
aEvents[1] = m_hIdleEvent;
// Wait for a stop or idle event
while (WaitForMultipleObjects(2, aEvents, FALSE, INFINITE) != WAIT_OBJECT_0)
{
// Send an idle message
PostMessage(m_hWnd, m_uMsg, m_wParam, m_lParam);
// Wait for a bit...
Sleep(m_dwDelay);
}
return 0;
}
BOOL CWinIdle::StartIdle(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam, DWORD dwDelay)
{
// Make sure it's not already running
if (m_hIdleThread)
return FALSE;
// Make sure they send in a valid handle..
if (!hWnd)
return FALSE;
// Create the events
m_hIdleEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
m_hStopEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
// Make sure the events got created
if ((!m_hIdleEvent) || (!m_hStopEvent))
return FALSE;
// Create the thread
DWORD dwThreadID;
m_hIdleThread = CreateThread(NULL, 0, CWinIdle::ThreadStub, (void *)this, 0, &dwThreadID);
if (m_hIdleThread)
{
SetThreadPriority(m_hIdleThread, THREAD_PRIORITY_IDLE);
m_hWnd = hWnd;
m_uMsg = uMessage;
m_wParam = wParam;
m_lParam = lParam;
m_dwDelay = dwDelay;
}
return m_hIdleThread != 0;
}
BOOL CWinIdle::EndIdle()
{
// Make sure it's running
if (!m_hIdleThread)
return FALSE;
// Stop the idle thread
SetEvent(m_hStopEvent);
WaitForSingleObject(m_hIdleThread, INFINITE);
CloseHandle(m_hIdleThread);
// Get rid of the event objects
CloseHandle(m_hIdleEvent);
CloseHandle(m_hStopEvent);
// Set everything back to 0
m_hIdleEvent = 0;
m_hStopEvent = 0;
m_hIdleThread = 0;
return TRUE;
}
void CWinIdle::NextIdle()
{
// Make sure the thread's running
if (!m_hIdleThread)
return;
// Signal an idle message
SetEvent(m_hIdleEvent);
}
+78
View File
@@ -0,0 +1,78 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// WinIdle.h - Defines a class for sending idle messages to a window from a secondary thread
#ifndef __WINIDLE_H__
#define __WINIDLE_H__
class CWinIdle
{
protected:
HANDLE m_hIdleEvent, m_hStopEvent;
HWND m_hWnd;
UINT m_uMsg;
WPARAM m_wParam;
LPARAM m_lParam;
DWORD m_dwDelay;
HANDLE m_hIdleThread;
// The thread calling stub
static DWORD WINAPI ThreadStub(LPVOID pIdle);
// The actual idle loop
virtual DWORD RunIdle();
public:
CWinIdle();
virtual ~CWinIdle();
inline DWORD GetDelay() {return m_dwDelay;}
inline void SetDelay(DWORD delay) {m_dwDelay = delay;}
// Member access
virtual HANDLE GetThreadHandle() const { return m_hIdleThread; };
// Start idling, and define the message and window to use
// Returns TRUE on success
virtual BOOL StartIdle(HWND hWnd, UINT uMessage, WPARAM wParam = 0, LPARAM lParam = 0, DWORD dwDelay = 0);
// Stop idling
// Returns TRUE on success
virtual BOOL EndIdle();
// Notify the idle process that the message was received.
// Note : If this function is not called, the idle thread will not send any messages
virtual void NextIdle();
};
// Used to slow down the idle thread while dialogs are up.
class IdleChanger
{
public:
IdleChanger(CWinIdle *pIdle, DWORD msDelay)
{
m_pIdle = pIdle;
m_OldDelay = pIdle->GetDelay();
pIdle->SetDelay(msDelay);
}
~IdleChanger()
{
m_pIdle->SetDelay(m_OldDelay);
}
CWinIdle *m_pIdle;
DWORD m_OldDelay;
};
#endif //__WINIDLE_H__