Mercurial > mm7
comparison AudioPlayer.cpp @ 1572:19f1735fca80
Слияние
author | Ritor1 |
---|---|
date | Sun, 08 Sep 2013 17:07:58 +0600 |
parents | c4ab816fcc5e |
children | 75fafd8ced59 |
comparison
equal
deleted
inserted
replaced
1571:ef20d4608b1a | 1572:19f1735fca80 |
---|---|
1 #ifdef _MSC_VER | 1 #ifdef _MSC_VER |
2 #define _CRT_SECURE_NO_WARNINGS | 2 #define _CRT_SECURE_NO_WARNINGS |
3 #endif | 3 #endif |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 #include <assert.h> | |
7 | 6 |
8 #include "mm7_data.h" | 7 #include "mm7_data.h" |
9 #include "VideoPlayer.h" | 8 #include "VideoPlayer.h" |
10 #include "AudioPlayer.h" | 9 #include "AudioPlayer.h" |
11 #include "Allocator.h" | 10 #include "Allocator.h" |
20 #include "OSInfo.h" | 19 #include "OSInfo.h" |
21 #include "Math.h" | 20 #include "Math.h" |
22 #include "MapInfo.h" | 21 #include "MapInfo.h" |
23 #include "GUIWindow.h" | 22 #include "GUIWindow.h" |
24 #include "Log.h" | 23 #include "Log.h" |
24 #include "ErrorHandling.h" | |
25 | 25 |
26 #include "Bink_Smacker.h" | 26 #include "Bink_Smacker.h" |
27 | 27 |
28 #include "MM7.h" | 28 #include "MM7.h" |
29 | 29 |
262 v14 = &pAudioPlayer->pSoundHeaders[v7]; | 262 v14 = &pAudioPlayer->pSoundHeaders[v7]; |
263 v15 = (DWORD *)&v14->uDecompressedSize; | 263 v15 = (DWORD *)&v14->uDecompressedSize; |
264 a2 = v14->uDecompressedSize; | 264 a2 = v14->uDecompressedSize; |
265 v16 = a2; | 265 v16 = a2; |
266 if ( (signed int)a2 > uBufferSizeLeft ) | 266 if ( (signed int)a2 > uBufferSizeLeft ) |
267 Abortf("Sound %s is size %i bytes, sound buffer size is %i bytes", Args, a2, uBufferSizeLeft); | 267 Error("Sound %s is size %i bytes, sound buffer size is %i bytes", Args, a2, uBufferSizeLeft); |
268 | |
268 SetFilePointer(pAudioPlayer->hAudioSnd, v14->uFileOffset, 0, 0); | 269 SetFilePointer(pAudioPlayer->hAudioSnd, v14->uFileOffset, 0, 0); |
269 v17 = v14->uCompressedSize; | 270 v17 = v14->uCompressedSize; |
270 if ( (signed int)v17 >= (signed int)*v15 ) | 271 if ( (signed int)v17 >= (signed int)*v15 ) |
271 { | 272 { |
272 if ( v17 == *v15 ) | 273 if ( v17 == *v15 ) |
378 | 379 |
379 v1 = this; | 380 v1 = this; |
380 v2 = fopen("data\\dsounds.bin", "wb"); | 381 v2 = fopen("data\\dsounds.bin", "wb"); |
381 v3 = v2; | 382 v3 = v2; |
382 if ( !v2 ) | 383 if ( !v2 ) |
383 Abortf("Unable to save dsounds.bin!"); | 384 Error("Unable to save dsounds.bin!"); |
385 | |
384 fwrite(v1, 4u, 1u, v2); | 386 fwrite(v1, 4u, 1u, v2); |
385 fwrite(v1->pSounds, 0x78u, v1->sNumSounds, v3); | 387 fwrite(v1->pSounds, 0x78u, v1->sNumSounds, v3); |
386 fclose(v3); | 388 fclose(v3); |
387 } | 389 } |
388 | 390 |
439 v2->pSounds = 0; | 441 v2->pSounds = 0; |
440 v2->sNumSounds = 0; | 442 v2->sNumSounds = 0; |
441 v4 = fopen(Args, "r"); | 443 v4 = fopen(Args, "r"); |
442 File = v4; | 444 File = v4; |
443 if ( !v4 ) | 445 if ( !v4 ) |
444 Abortf("SoundListClass::load - Unable to open file: %s."); | 446 Error("SoundListClass::load - Unable to open file: %s."); |
447 | |
445 v5 = 0; | 448 v5 = 0; |
446 Argsa = 0; | 449 Argsa = 0; |
447 if ( fgets(&Buf, 490, v4) ) | 450 if ( fgets(&Buf, 490, v4) ) |
448 { | 451 { |
449 do | 452 do |
459 } | 462 } |
460 v2->sNumSounds = v5; | 463 v2->sNumSounds = v5; |
461 v6 = pAllocator->AllocNamedChunk(v2->pSounds, 120 * v5, "Snd Des."); | 464 v6 = pAllocator->AllocNamedChunk(v2->pSounds, 120 * v5, "Snd Des."); |
462 v2->pSounds = (SoundDesc *)v6; | 465 v2->pSounds = (SoundDesc *)v6; |
463 if ( v6 == (void *)v3 ) | 466 if ( v6 == (void *)v3 ) |
464 Abortf("SoundListClass::load - Out of Memory!"); | 467 Error("SoundListClass::load - Out of Memory!"); |
468 | |
465 memset(v6, v3, 120 * v2->sNumSounds); | 469 memset(v6, v3, 120 * v2->sNumSounds); |
466 v7 = File; | 470 v7 = File; |
467 v2->sNumSounds = v3; | 471 v2->sNumSounds = v3; |
468 fseek(v7, v3, v3); | 472 fseek(v7, v3, v3); |
469 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | 473 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) |