mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-04-24 02:32:18 +00:00
Astyle
This commit is contained in:
parent
63b6934ad6
commit
0f52880767
4 changed files with 143 additions and 130 deletions
|
@ -2047,7 +2047,7 @@ struct jpeg_error_mgr jerr;
|
|||
*/
|
||||
|
||||
#ifdef USE_NEWER_JPEG
|
||||
METHODDEF(boolean)
|
||||
METHODDEF( boolean )
|
||||
#else
|
||||
METHODDEF boolean
|
||||
#endif
|
||||
|
@ -2083,7 +2083,7 @@ fill_input_buffer( j_decompress_ptr cinfo )
|
|||
*/
|
||||
|
||||
#ifdef USE_NEWER_JPEG
|
||||
METHODDEF(void)
|
||||
METHODDEF( void )
|
||||
#else
|
||||
METHODDEF void
|
||||
#endif
|
||||
|
@ -2111,7 +2111,7 @@ init_source( j_decompress_ptr cinfo )
|
|||
*/
|
||||
|
||||
#ifdef USE_NEWER_JPEG
|
||||
METHODDEF(void)
|
||||
METHODDEF( void )
|
||||
#else
|
||||
METHODDEF void
|
||||
#endif
|
||||
|
@ -2151,7 +2151,7 @@ skip_input_data( j_decompress_ptr cinfo, long num_bytes )
|
|||
*/
|
||||
|
||||
#ifdef USE_NEWER_JPEG
|
||||
METHODDEF(void)
|
||||
METHODDEF( void )
|
||||
#else
|
||||
METHODDEF void
|
||||
#endif
|
||||
|
@ -2162,7 +2162,7 @@ term_source( j_decompress_ptr cinfo )
|
|||
}
|
||||
|
||||
#ifdef USE_NEWER_JPEG
|
||||
GLOBAL(void)
|
||||
GLOBAL( void )
|
||||
#else
|
||||
GLOBAL void
|
||||
#endif
|
||||
|
|
|
@ -455,7 +455,7 @@ static void LoadJPG( const char* filename, unsigned char** pic, int* width, int*
|
|||
byte* fbuffer;
|
||||
byte* bbuf;
|
||||
int len;
|
||||
|
||||
|
||||
/* In this example we want to open the input file before doing anything else,
|
||||
* so that the setjmp() error recovery below can assume the file is open.
|
||||
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
|
||||
|
@ -509,7 +509,7 @@ static void LoadJPG( const char* filename, unsigned char** pic, int* width, int*
|
|||
#ifdef USE_NEWER_JPEG
|
||||
jpeg_mem_src( &cinfo, fbuffer, len );
|
||||
#else
|
||||
jpeg_stdio_src( &cinfo, fbuffer );
|
||||
jpeg_stdio_src( &cinfo, fbuffer );
|
||||
#endif
|
||||
/* Step 3: read file parameters with jpeg_read_header() */
|
||||
|
||||
|
|
|
@ -258,123 +258,135 @@ void idSoundHardware_XAudio2::Init()
|
|||
// Register the sound engine callback
|
||||
pXAudio2->RegisterForCallbacks( &soundEngineCallback );
|
||||
soundEngineCallback.hardware = this;
|
||||
UINT32 deviceCount = 0;
|
||||
DWORD outputSampleRate = 44100; // Max( (DWORD)XAUDIO2FX_REVERB_MIN_FRAMERATE, Min( (DWORD)XAUDIO2FX_REVERB_MAX_FRAMERATE, deviceDetails.OutputFormat.Format.nSamplesPerSec ) );
|
||||
|
||||
// RB: not available on Windows 8 SDK
|
||||
UINT32 deviceCount = 0;
|
||||
DWORD outputSampleRate = 44100; // Max( (DWORD)XAUDIO2FX_REVERB_MIN_FRAMERATE, Min( (DWORD)XAUDIO2FX_REVERB_MAX_FRAMERATE, deviceDetails.OutputFormat.Format.nSamplesPerSec ) );
|
||||
|
||||
// RB: not available on Windows 8 SDK
|
||||
#if defined(USE_WINRT) //(_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
|
||||
|
||||
IMMDeviceEnumerator *immDevEnum = nullptr;
|
||||
IMMDeviceCollection *immDevCollection = nullptr;
|
||||
IMMDevice *immDev = nullptr;
|
||||
std::vector<AudioDevice> vAudioDevices;
|
||||
|
||||
HRESULT hResult = CoCreateInstance(
|
||||
__uuidof(MMDeviceEnumerator), NULL,
|
||||
CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), (void**) &immDevEnum);
|
||||
|
||||
if (FAILED(hResult)) {
|
||||
idLib::Warning( "Failed to get audio enumerator" );
|
||||
pXAudio2->Release();
|
||||
pXAudio2 = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
hResult = immDevEnum->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &immDevCollection);
|
||||
if (FAILED(hResult)) {
|
||||
idLib::Warning( "Failed to get audio endpoints" );
|
||||
pXAudio2->Release();
|
||||
pXAudio2 = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
hResult = immDevCollection->GetCount(&deviceCount);
|
||||
if (FAILED(hResult)) {
|
||||
idLib::Warning( "No audio devices found" );
|
||||
pXAudio2->Release();
|
||||
pXAudio2 = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
for (UINT i = 0; i < deviceCount; i++) {
|
||||
IPropertyStore *propStore = nullptr;
|
||||
PROPVARIANT varName;
|
||||
PROPVARIANT varId;
|
||||
|
||||
PropVariantInit(&varId);
|
||||
PropVariantInit(&varName);
|
||||
|
||||
hResult = immDevCollection->Item(i, &immDev);
|
||||
if (SUCCEEDED(hResult)) {
|
||||
hResult = immDev->OpenPropertyStore(STGM_READ, &propStore);
|
||||
}
|
||||
if (SUCCEEDED(hResult)) {
|
||||
hResult = propStore->GetValue(PKEY_AudioEndpoint_Path, &varId);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hResult)) {
|
||||
hResult = propStore->GetValue(PKEY_Device_FriendlyName, &varName);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hResult)) {
|
||||
assert(varId.vt == VT_LPWSTR);
|
||||
assert(varName.vt == VT_LPWSTR);
|
||||
|
||||
// Now save somewhere the device display name & id
|
||||
AudioDevice ad;
|
||||
ad.name = varName.pwszVal;
|
||||
ad.id = varId.pwszVal;
|
||||
|
||||
vAudioDevices.push_back(ad);
|
||||
}
|
||||
|
||||
PropVariantClear(&varName);
|
||||
PropVariantClear(&varId);
|
||||
|
||||
if (propStore != nullptr) {
|
||||
propStore->Release();
|
||||
}
|
||||
|
||||
if (immDev != nullptr) {
|
||||
immDev->Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
immDevCollection->Release();
|
||||
immDevEnum->Release();
|
||||
|
||||
int preferredDevice = s_device.GetInteger();
|
||||
if (!vAudioDevices.empty()) {
|
||||
if (SUCCEEDED(pXAudio2->CreateMasteringVoice(&pMasterVoice,
|
||||
XAUDIO2_DEFAULT_CHANNELS,
|
||||
outputSampleRate,
|
||||
0,
|
||||
vAudioDevices.at(0).id.c_str(),
|
||||
NULL,
|
||||
AudioCategory_GameEffects)))
|
||||
{
|
||||
XAUDIO2_VOICE_DETAILS deviceDetails;
|
||||
pMasterVoice->GetVoiceDetails(&deviceDetails);
|
||||
|
||||
pMasterVoice->SetVolume(DBtoLinear(s_volume_dB.GetFloat()));
|
||||
|
||||
outputChannels = deviceDetails.InputChannels;
|
||||
DWORD win8_channelMask;
|
||||
pMasterVoice->GetChannelMask(&win8_channelMask);
|
||||
|
||||
channelMask = (unsigned int)win8_channelMask;
|
||||
idLib::Printf( "Using device %s\n", vAudioDevices.at(0).name );
|
||||
}
|
||||
else {
|
||||
idLib::Warning("Failed to create master voice");
|
||||
pXAudio2->Release();
|
||||
pXAudio2 = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
IMMDeviceEnumerator* immDevEnum = nullptr;
|
||||
IMMDeviceCollection* immDevCollection = nullptr;
|
||||
IMMDevice* immDev = nullptr;
|
||||
std::vector<AudioDevice> vAudioDevices;
|
||||
|
||||
HRESULT hResult = CoCreateInstance(
|
||||
__uuidof( MMDeviceEnumerator ), NULL,
|
||||
CLSCTX_ALL, __uuidof( IMMDeviceEnumerator ), ( void** ) &immDevEnum );
|
||||
|
||||
if( FAILED( hResult ) )
|
||||
{
|
||||
idLib::Warning( "Failed to get audio enumerator" );
|
||||
pXAudio2->Release();
|
||||
pXAudio2 = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
hResult = immDevEnum->EnumAudioEndpoints( eRender, DEVICE_STATE_ACTIVE, &immDevCollection );
|
||||
if( FAILED( hResult ) )
|
||||
{
|
||||
idLib::Warning( "Failed to get audio endpoints" );
|
||||
pXAudio2->Release();
|
||||
pXAudio2 = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
hResult = immDevCollection->GetCount( &deviceCount );
|
||||
if( FAILED( hResult ) )
|
||||
{
|
||||
idLib::Warning( "No audio devices found" );
|
||||
pXAudio2->Release();
|
||||
pXAudio2 = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
for( UINT i = 0; i < deviceCount; i++ )
|
||||
{
|
||||
IPropertyStore* propStore = nullptr;
|
||||
PROPVARIANT varName;
|
||||
PROPVARIANT varId;
|
||||
|
||||
PropVariantInit( &varId );
|
||||
PropVariantInit( &varName );
|
||||
|
||||
hResult = immDevCollection->Item( i, &immDev );
|
||||
if( SUCCEEDED( hResult ) )
|
||||
{
|
||||
hResult = immDev->OpenPropertyStore( STGM_READ, &propStore );
|
||||
}
|
||||
if( SUCCEEDED( hResult ) )
|
||||
{
|
||||
hResult = propStore->GetValue( PKEY_AudioEndpoint_Path, &varId );
|
||||
}
|
||||
|
||||
if( SUCCEEDED( hResult ) )
|
||||
{
|
||||
hResult = propStore->GetValue( PKEY_Device_FriendlyName, &varName );
|
||||
}
|
||||
|
||||
if( SUCCEEDED( hResult ) )
|
||||
{
|
||||
assert( varId.vt == VT_LPWSTR );
|
||||
assert( varName.vt == VT_LPWSTR );
|
||||
|
||||
// Now save somewhere the device display name & id
|
||||
AudioDevice ad;
|
||||
ad.name = varName.pwszVal;
|
||||
ad.id = varId.pwszVal;
|
||||
|
||||
vAudioDevices.push_back( ad );
|
||||
}
|
||||
|
||||
PropVariantClear( &varName );
|
||||
PropVariantClear( &varId );
|
||||
|
||||
if( propStore != nullptr )
|
||||
{
|
||||
propStore->Release();
|
||||
}
|
||||
|
||||
if( immDev != nullptr )
|
||||
{
|
||||
immDev->Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
immDevCollection->Release();
|
||||
immDevEnum->Release();
|
||||
|
||||
int preferredDevice = s_device.GetInteger();
|
||||
if( !vAudioDevices.empty() )
|
||||
{
|
||||
if( SUCCEEDED( pXAudio2->CreateMasteringVoice( &pMasterVoice,
|
||||
XAUDIO2_DEFAULT_CHANNELS,
|
||||
outputSampleRate,
|
||||
0,
|
||||
vAudioDevices.at( 0 ).id.c_str(),
|
||||
NULL,
|
||||
AudioCategory_GameEffects ) ) )
|
||||
{
|
||||
XAUDIO2_VOICE_DETAILS deviceDetails;
|
||||
pMasterVoice->GetVoiceDetails( &deviceDetails );
|
||||
|
||||
pMasterVoice->SetVolume( DBtoLinear( s_volume_dB.GetFloat() ) );
|
||||
|
||||
outputChannels = deviceDetails.InputChannels;
|
||||
DWORD win8_channelMask;
|
||||
pMasterVoice->GetChannelMask( &win8_channelMask );
|
||||
|
||||
channelMask = ( unsigned int )win8_channelMask;
|
||||
idLib::Printf( "Using device %s\n", vAudioDevices.at( 0 ).name );
|
||||
}
|
||||
else
|
||||
{
|
||||
idLib::Warning( "Failed to create master voice" );
|
||||
pXAudio2->Release();
|
||||
pXAudio2 = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
if( pXAudio2->GetDeviceCount( &deviceCount ) != S_OK || deviceCount == 0 )
|
||||
{
|
||||
idLib::Warning( "No audio devices found" );
|
||||
|
@ -427,7 +439,7 @@ void idSoundHardware_XAudio2::Init()
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( FAILED( pXAudio2->CreateMasteringVoice( &pMasterVoice, XAUDIO2_DEFAULT_CHANNELS, outputSampleRate, 0, preferredDevice, NULL ) ) )
|
||||
{
|
||||
idLib::Warning( "Failed to create master voice" );
|
||||
|
@ -439,9 +451,9 @@ void idSoundHardware_XAudio2::Init()
|
|||
|
||||
outputChannels = deviceDetails.OutputFormat.Format.nChannels;
|
||||
channelMask = deviceDetails.OutputFormat.dwChannelMask;
|
||||
|
||||
|
||||
#endif // #if (_WIN32_WINNT < 0x0602 /*_WIN32_WINNT_WIN8*/)
|
||||
|
||||
|
||||
idSoundVoice::InitSurround( outputChannels, channelMask );
|
||||
|
||||
#if defined(USE_DOOMCLASSIC)
|
||||
|
|
|
@ -145,13 +145,14 @@ ID_INLINE_EXTERN ALCenum CheckALCErrors_( ALCdevice* device, const char* filenam
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_Path, 0x9c119480, 0xddc2, 0x4954, 0xa1, 0x50, 0x5b, 0xd2, 0x40, 0xd4, 0x54, 0xad, 1);
|
||||
DEFINE_PROPERTYKEY( PKEY_AudioEndpoint_Path, 0x9c119480, 0xddc2, 0x4954, 0xa1, 0x50, 0x5b, 0xd2, 0x40, 0xd4, 0x54, 0xad, 1 );
|
||||
|
||||
#pragma comment(lib,"xaudio2.lib")
|
||||
|
||||
struct AudioDevice {
|
||||
std::wstring name;
|
||||
std::wstring id;
|
||||
struct AudioDevice
|
||||
{
|
||||
std::wstring name;
|
||||
std::wstring id;
|
||||
};
|
||||
#else
|
||||
#include <dxsdkver.h>
|
||||
|
|
Loading…
Reference in a new issue