comparison AudioPlayer.cpp @ 2481:4f4eb812af28

KEY_ALL_ACCESS
author Ritor1
date Fri, 22 Aug 2014 17:41:25 +0600
parents 908baf8e7d23
children 5abd8fc8f1c6
comparison
equal deleted inserted replaced
2480:24fd08aef81e 2481:4f4eb812af28
2123 //----- (004AB818) -------------------------------------------------------- 2123 //----- (004AB818) --------------------------------------------------------
2124 void AudioPlayer::LoadAudioSnd() 2124 void AudioPlayer::LoadAudioSnd()
2125 { 2125 {
2126 DWORD NumberOfBytesRead; // [sp+Ch] [bp-4h]@3 2126 DWORD NumberOfBytesRead; // [sp+Ch] [bp-4h]@3
2127 2127
2128 hAudioSnd = CreateFileA("Sounds\\Audio.snd", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0); 2128 hAudioSnd = CreateFileA("Sounds\\Audio.snd", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, 0);
2129 if (hAudioSnd == INVALID_HANDLE_VALUE) 2129 if (hAudioSnd == INVALID_HANDLE_VALUE)
2130 { 2130 {
2131 Log::Warning(L"Can't open file: %s", L"Sounds\\Audio.snd"); 2131 Log::Warning(L"Can't open file: %s", L"Sounds\\Audio.snd");
2132 return; 2132 return;
2133 } 2133 }
2176 if ( ReadWindowsRegistryInt("Disable3DSound", 0) != 1 && true)//pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ) 2176 if ( ReadWindowsRegistryInt("Disable3DSound", 0) != 1 && true)//pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT )
2177 { 2177 {
2178 v14 = 0; 2178 v14 = 0;
2179 bEAXSupported = 0; 2179 bEAXSupported = 0;
2180 b3DSoundInitialized = 0; 2180 b3DSoundInitialized = 0;
2181 ReadWindowsRegistryString("3DSoundProvider", p3DSoundProvider, 128u, "NONE"); 2181 ReadWindowsRegistryString("3DSoundProvider", p3DSoundProvider, 128, "NONE");
2182 CheckA3DSupport(true); 2182 CheckA3DSupport(true);
2183 HPROVIDER prov; 2183 HPROVIDER prov;
2184 while ( AIL_enumerate_3D_providers(&v14, &prov, &Str1) ) 2184 while ( AIL_enumerate_3D_providers(&v14, &prov, &Str1) )
2185 { 2185 {
2186 if ( !strcmp(Str1, p3DSoundProvider) ) 2186 if ( !strcmp(Str1, p3DSoundProvider) )
2223 AIL_redbook_stop(hAILRedbook); 2223 AIL_redbook_stop(hAILRedbook);
2224 uNumRedbookTracks = AIL_redbook_tracks(hAILRedbook); 2224 uNumRedbookTracks = AIL_redbook_tracks(hAILRedbook);
2225 } 2225 }
2226 pAudioPlayer->sRedbookVolume = AIL_redbook_volume(hAILRedbook); 2226 pAudioPlayer->sRedbookVolume = AIL_redbook_volume(hAILRedbook);
2227 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); 2227 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
2228 //unsigned __int64 t = (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f);
2228 if ( bPlayerReady && hAILRedbook ) 2229 if ( bPlayerReady && hAILRedbook )
2229 AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f) >> 32); 2230 //AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f));
2231 AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f) >> 32);
2232 //int v = AIL_redbook_volume(pAudioPlayer->hAILRedbook);
2233 //if (v)
2234 //__debugbreak();
2230 LoadAudioSnd(); 2235 LoadAudioSnd();
2231 } 2236 }
2232 2237
2233 //----- (004ABAF7) -------------------------------------------------------- 2238 //----- (004ABAF7) --------------------------------------------------------
2234 _DIG_DRIVER *Audio_GetFirstHardwareDigitalDriver(void) 2239 _DIG_DRIVER *Audio_GetFirstHardwareDigitalDriver(void)
2235 { 2240 {
2236 int v0; // ecx@1 2241 int v0; // ecx@1
2237 unsigned int v1; // ebp@2
2238 size_t v2; // eax@4 2242 size_t v2; // eax@4
2239 signed int v3; // kr14_4@9 2243 signed int v3; // kr14_4@9
2240 char *v5; // [sp+10h] [bp-Ch]@2 2244 int v5; // [sp+10h] [bp-Ch]@2
2241 unsigned int pNum_devices; // [sp+14h] [bp-8h]@1 2245 unsigned int pNum_devices; // [sp+14h] [bp-8h]@1
2242 _DIG_DRIVER *hDrv; // [sp+18h] [bp-4h]@3 2246 _DIG_DRIVER *hDrv; // [sp+18h] [bp-4h]@3
2243 2247
2244 static int sample_Rate = 22050; 2248 static int sample_Rate = 22050;
2245 static int bitsPerSample = 16; 2249 static int bitsPerSample = 16;
2252 pAudioPlayer->uNumDevices = 0; 2256 pAudioPlayer->uNumDevices = 0;
2253 pNum_devices = 0; 2257 pNum_devices = 0;
2254 2258
2255 if ( sample_Rate < 11025 ) 2259 if ( sample_Rate < 11025 )
2256 return 0; 2260 return 0;
2257 v1 = 0; 2261 v5 = 0;
2258 v5 = (char *)pAudioPlayer->array_000BF0;
2259 while ( 1 ) 2262 while ( 1 )
2260 { 2263 {
2261 while ( 1 ) 2264 while ( 1 )
2262 { 2265 {
2263 pcmWaveFormat.wf.wFormatTag = WAVE_FORMAT_PCM; 2266 pcmWaveFormat.wf.wFormatTag = WAVE_FORMAT_PCM;
2266 pcmWaveFormat.wf.nBlockAlign = channels * bitsPerSample / 8; //количество данных в блоке 2269 pcmWaveFormat.wf.nBlockAlign = channels * bitsPerSample / 8; //количество данных в блоке
2267 pcmWaveFormat.wBitsPerSample = bitsPerSample; 2270 pcmWaveFormat.wBitsPerSample = bitsPerSample;
2268 pcmWaveFormat.wf.nAvgBytesPerSec = pcmWaveFormat.wf.nSamplesPerSec * pcmWaveFormat.wf.nBlockAlign; 2271 pcmWaveFormat.wf.nAvgBytesPerSec = pcmWaveFormat.wf.nSamplesPerSec * pcmWaveFormat.wf.nBlockAlign;
2269 if ( !AIL_waveOutOpen(&hDrv, 0, -1, &pcmWaveFormat.wf) ) 2272 if ( !AIL_waveOutOpen(&hDrv, 0, -1, &pcmWaveFormat.wf) )
2270 { 2273 {
2271 strcpy(pAudioPlayer->pDeviceNames[v1 / 8], "Device: "); 2274 strcpy(pAudioPlayer->pDeviceNames[v5], "Device: ");
2272 v2 = strlen(pAudioPlayer->pDeviceNames[v1 / 8]); 2275 v2 = strlen(pAudioPlayer->pDeviceNames[v5]);
2273 AIL_digital_configuration(hDrv, (int *)v5, (int *)(v5 + 64), (char *)pAudioPlayer->pDeviceNames + v2 + v1 * 16); 2276 AIL_digital_configuration(hDrv, (int *)pAudioPlayer->array_000BF0 + v5, (int *)pAudioPlayer->array_000C30 + v5, (char *)pAudioPlayer->pDeviceNames + v2 + v5 * 32);
2274 ++pNum_devices; 2277 ++pNum_devices;
2275 v1 += 8; 2278 v5++;
2276 v5 += 4;
2277 pAudioPlayer->uNumDevices = pNum_devices; 2279 pAudioPlayer->uNumDevices = pNum_devices;
2278 if ( AIL_get_preference(15) ) 2280 if ( AIL_get_preference(15) )
2279 return hDrv; 2281 return hDrv;
2280 if ( !strstr(pAudioPlayer->pDeviceNames[v1 / 8 - 1], "Emulated") ) 2282 if ( !strstr(pAudioPlayer->pDeviceNames[v5 - 1], "Emulated") )
2281 return hDrv; 2283 return hDrv;
2282 AIL_waveOutClose(hDrv); 2284 AIL_waveOutClose(hDrv);
2283 AIL_set_preference(15, 1); 2285 AIL_set_preference(15, 1);
2284 break; 2286 break;
2285 } 2287 }
2314 { 2316 {
2315 DWORD cbData; // [sp+8h] [bp-Ch]@1 2317 DWORD cbData; // [sp+8h] [bp-Ch]@1
2316 HKEY hKey; // [sp+10h] [bp-4h]@1 2318 HKEY hKey; // [sp+10h] [bp-4h]@1
2317 hKey = 0; 2319 hKey = 0;
2318 cbData = 4; 2320 cbData = 4;
2319 if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Aureal\\A3D", 0, 0x2001F, &hKey)) 2321 if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Aureal\\A3D", 0, KEY_READ|KEY_WOW64_32KEY, &hKey))
2320 { 2322 {
2321 int Aureal3D_SplashAudio = 0; 2323 int Aureal3D_SplashAudio = 0;
2322 if (query) 2324 if (query)
2323 RegQueryValueExA(hKey, "SplashAudio", 0, 0, (LPBYTE)&Aureal3D_SplashAudio, &cbData); 2325 RegQueryValueExA(hKey, "SplashAudio", 0, 0, (LPBYTE)&Aureal3D_SplashAudio, &cbData);
2324 RegSetValueExA(hKey, "SplashAudio", 0, 4, (const BYTE *)&Aureal3D_SplashAudio, 4); 2326 RegSetValueExA(hKey, "SplashAudio", 0, 4, (const BYTE *)&Aureal3D_SplashAudio, 4);
2550 { 2552 {
2551 unsigned int map_id; // eax@1 2553 unsigned int map_id; // eax@1
2552 void *v9; // eax@8 2554 void *v9; // eax@8
2553 int v12; // [sp+1Ch] [bp-8h]@1 2555 int v12; // [sp+1Ch] [bp-8h]@1
2554 2556
2555 //__debugbreak();//Ritor1
2556
2557 if ( this->b3DSoundInitialized ) 2557 if ( this->b3DSoundInitialized )
2558 { 2558 {
2559 //v5 = &this->uNum3DSamples; 2559 //v5 = &this->uNum3DSamples;
2560 AIL_3D_provider_attribute(this->h3DSoundProvider, "Maximum supported samples", &this->uNum3DSamples); 2560 AIL_3D_provider_attribute(this->h3DSoundProvider, "Maximum supported samples", &this->uNum3DSamples);
2561 if ( this->uNum3DSamples > 32 ) 2561 if ( this->uNum3DSamples > 32 )
2610 for ( uint i = 0; i < 2999; i++ ) 2610 for ( uint i = 0; i < 2999; i++ )
2611 { 2611 {
2612 if ( pSounds[i].pSoundData == _this ) 2612 if ( pSounds[i].pSoundData == _this )
2613 { 2613 {
2614 free(_this); 2614 free(_this);
2615 memset(&pSounds[i], 0, 0x80u); 2615 memset(&pSounds[i], 0, sizeof(pSounds[i]));
2616 } 2616 }
2617 } 2617 }
2618 2618
2619 } 2619 }
2620 2620