Mercurial > mm7
comparison AudioPlayer.cpp @ 2085:52abdea20b9e
Door_switch_animation
author | Ritor1 |
---|---|
date | Wed, 11 Dec 2013 23:12:54 +0600 |
parents | 28cb79ae2f6f |
children | 9574c5bfb96f |
comparison
equal
deleted
inserted
replaced
2068:a290d9fbdc95 | 2085:52abdea20b9e |
---|---|
319 } | 319 } |
320 | 320 |
321 //----- (004A9D79) -------------------------------------------------------- | 321 //----- (004A9D79) -------------------------------------------------------- |
322 void SoundList::_4A9D79(int a2) | 322 void SoundList::_4A9D79(int a2) |
323 { | 323 { |
324 SoundList *v2; // esi@1 | 324 for ( int i = 0; i < (signed int)this->sNumSounds; ++i ) |
325 int v3; // edi@1 | 325 { |
326 signed int i; // ebx@1 | 326 if ( this->pSounds[i].eType != SOUND_DESC_SYSTEM && (a2 || this->pSounds[i].eType != SOUND_DESC_LOCK) ) |
327 SoundDesc *v5; // eax@2 | 327 { |
328 SOUND_DESC_TYPE v6; // ecx@2 | 328 if ( this->pSounds[i].pSoundData[0] ) |
329 void *v7; // eax@5 | 329 { |
330 | 330 ReleaseSoundData(this->pSounds[i].pSoundData[0]); |
331 v2 = this; | 331 this->pSounds[i].pSoundData[0] = 0; |
332 v3 = 0; | 332 } |
333 for ( i = 0; i < (signed int)v2->sNumSounds; ++v3 ) | 333 this->pSounds[i].uFlags &= ~SOUND_DESC_SYSTEM; |
334 { | 334 } |
335 v5 = &v2->pSounds[v3]; | |
336 v6 = v5->eType; | |
337 if ( v6 != SOUND_DESC_SYSTEM && (a2 || v6 != SOUND_DESC_LOCK) ) | |
338 { | |
339 v7 = v5->pSoundData[0]; | |
340 if ( v7 ) | |
341 { | |
342 ReleaseSoundData(v7); | |
343 v2->pSounds[v3].pSoundData[0] = 0; | |
344 } | |
345 v2->pSounds[v3].uFlags &= ~SOUND_DESC_SYSTEM; | |
346 } | |
347 ++i; | |
348 } | 335 } |
349 } | 336 } |
350 | 337 |
351 //----- (004A9DCD) -------------------------------------------------------- | 338 //----- (004A9DCD) -------------------------------------------------------- |
352 void SoundList::UnloadSound(unsigned int uSoundID, char a3) | 339 void SoundList::UnloadSound(unsigned int uSoundID, char a3) |
371 | 358 |
372 | 359 |
373 //----- (004A9E3D) -------------------------------------------------------- | 360 //----- (004A9E3D) -------------------------------------------------------- |
374 void SoundList::ToFile() | 361 void SoundList::ToFile() |
375 { | 362 { |
376 SoundList *v1; // esi@1 | |
377 FILE *v2; // eax@1 | 363 FILE *v2; // eax@1 |
378 FILE *v3; // edi@1 | 364 |
379 | |
380 v1 = this; | |
381 v2 = fopen("data\\dsounds.bin", "wb"); | 365 v2 = fopen("data\\dsounds.bin", "wb"); |
382 v3 = v2; | |
383 if ( !v2 ) | 366 if ( !v2 ) |
384 Error("Unable to save dsounds.bin!"); | 367 Error("Unable to save dsounds.bin!"); |
385 | 368 |
386 fwrite(v1, 4u, 1u, v2); | 369 fwrite(this, 4, 1, v2); |
387 fwrite(v1->pSounds, 0x78u, v1->sNumSounds, v3); | 370 fwrite(this->pSounds, 0x78u, this->sNumSounds, v2); |
388 fclose(v3); | 371 fclose(v2); |
389 } | 372 } |
390 | 373 |
391 //----- (004A9E89) -------------------------------------------------------- | 374 //----- (004A9E89) -------------------------------------------------------- |
392 void SoundList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) | 375 void SoundList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) |
393 { | 376 { |
413 } | 396 } |
414 | 397 |
415 //----- (004A9ED0) -------------------------------------------------------- | 398 //----- (004A9ED0) -------------------------------------------------------- |
416 int SoundList::FromFileTxt(const char *Args) | 399 int SoundList::FromFileTxt(const char *Args) |
417 { | 400 { |
418 SoundList *v2; // ebx@1 | |
419 __int32 v3; // edi@1 | 401 __int32 v3; // edi@1 |
420 FILE *v4; // eax@1 | 402 FILE *v4; // eax@1 |
421 unsigned int v5; // esi@3 | 403 unsigned int v5; // esi@3 |
422 void *v6; // eax@9 | 404 void *v6; // eax@9 |
423 FILE *v7; // ST0C_4@11 | 405 FILE *v7; // ST0C_4@11 |
433 FrameTableTxtLine v18; // [sp+200h] [bp-FCh]@4 | 415 FrameTableTxtLine v18; // [sp+200h] [bp-FCh]@4 |
434 FrameTableTxtLine v19; // [sp+27Ch] [bp-80h]@4 | 416 FrameTableTxtLine v19; // [sp+27Ch] [bp-80h]@4 |
435 FILE *File; // [sp+2F8h] [bp-4h]@1 | 417 FILE *File; // [sp+2F8h] [bp-4h]@1 |
436 unsigned int Argsa; // [sp+304h] [bp+8h]@3 | 418 unsigned int Argsa; // [sp+304h] [bp+8h]@3 |
437 | 419 |
438 v2 = this; | |
439 free(this->pSounds); | 420 free(this->pSounds); |
440 v3 = 0; | 421 v3 = 0; |
441 v2->pSounds = 0; | 422 this->pSounds = 0; |
442 v2->sNumSounds = 0; | 423 this->sNumSounds = 0; |
443 v4 = fopen(Args, "r"); | 424 v4 = fopen(Args, "r"); |
444 File = v4; | 425 File = v4; |
445 if ( !v4 ) | 426 if ( !v4 ) |
446 Error("SoundListClass::load - Unable to open file: %s."); | 427 Error("SoundListClass::load - Unable to open file: %s."); |
447 | 428 |
458 } | 439 } |
459 while ( fgets(&Buf, 490, File) ); | 440 while ( fgets(&Buf, 490, File) ); |
460 v5 = Argsa; | 441 v5 = Argsa; |
461 v3 = 0; | 442 v3 = 0; |
462 } | 443 } |
463 v2->sNumSounds = v5; | 444 this->sNumSounds = v5; |
464 v6 = malloc(120 * v5); | 445 v6 = malloc(120 * v5); |
465 v2->pSounds = (SoundDesc *)v6; | 446 this->pSounds = (SoundDesc *)v6; |
466 if ( v6 == (void *)v3 ) | 447 if ( v6 == (void *)v3 ) |
467 Error("SoundListClass::load - Out of Memory!"); | 448 Error("SoundListClass::load - Out of Memory!"); |
468 | 449 |
469 memset(v6, v3, 120 * v2->sNumSounds); | 450 memset(v6, v3, 120 * this->sNumSounds); |
470 v7 = File; | 451 v7 = File; |
471 v2->sNumSounds = v3; | 452 this->sNumSounds = v3; |
472 fseek(v7, v3, v3); | 453 fseek(v7, v3, v3); |
473 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | 454 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) |
474 { | 455 { |
475 *strchr(&Buf, 10) = 0; | 456 *strchr(&Buf, 10) = 0; |
476 memcpy(&v19, txt_file_frametable_parser(&Buf, &v18), sizeof(v19)); | 457 memcpy(&v19, txt_file_frametable_parser(&Buf, &v18), sizeof(v19)); |
477 if ( v19.uPropCount && *v19.pProperties[0] != 47 ) | 458 if ( v19.uPropCount && *v19.pProperties[0] != 47 ) |
478 { | 459 { |
479 sprintf(v2->pSounds[v2->sNumSounds].pSoundName, "%s", v19.pProperties[0]); | 460 sprintf(this->pSounds[this->sNumSounds].pSoundName, "%s", v19.pProperties[0]); |
480 v9 = atoi(v19.pProperties[1]); | 461 v9 = atoi(v19.pProperties[1]); |
481 v10 = v19.pProperties[2]; | 462 v10 = v19.pProperties[2]; |
482 v2->pSounds[v2->sNumSounds].uSoundID = v9; | 463 this->pSounds[this->sNumSounds].uSoundID = v9; |
483 if ( _stricmp(v10, "system") ) | 464 if ( _stricmp(v10, "system") ) |
484 { | 465 { |
485 if ( _stricmp(v19.pProperties[2], "swap") ) | 466 if ( _stricmp(v19.pProperties[2], "swap") ) |
486 { | 467 { |
487 v11 = _stricmp(v19.pProperties[2], "lock"); | 468 v11 = _stricmp(v19.pProperties[2], "lock"); |
488 v12 = v2->pSounds; | 469 v12 = this->pSounds; |
489 v13 = v11 == 0; | 470 v13 = v11 == 0; |
490 v14 = v2->sNumSounds; | 471 v14 = this->sNumSounds; |
491 if ( v13 ) | 472 if ( v13 ) |
492 v12[v14].eType = SOUND_DESC_LOCK; | 473 v12[v14].eType = SOUND_DESC_LOCK; |
493 else | 474 else |
494 v12[v14].eType = SOUND_DESC_LEVEL; | 475 v12[v14].eType = SOUND_DESC_LEVEL; |
495 } | 476 } |
496 else | 477 else |
497 { | 478 this->pSounds[this->sNumSounds].eType = SOUND_DESC_SWAP; |
498 v2->pSounds[v2->sNumSounds].eType = SOUND_DESC_SWAP; | |
499 } | |
500 } | 479 } |
501 else | 480 else |
502 { | 481 this->pSounds[this->sNumSounds].eType = SOUND_DESC_SYSTEM; |
503 v2->pSounds[v2->sNumSounds].eType = SOUND_DESC_SYSTEM; | |
504 } | |
505 if ( v19.uPropCount >= 4 && !_stricmp(v19.pProperties[3], "3D") ) | 482 if ( v19.uPropCount >= 4 && !_stricmp(v19.pProperties[3], "3D") ) |
506 { | 483 { |
507 v15 = (int)&v2->pSounds[v2->sNumSounds].uFlags; | 484 v15 = (int)&this->pSounds[this->sNumSounds].uFlags; |
508 *(int *)v15 |= SOUND_DESC_SWAP; | 485 *(int *)v15 |= SOUND_DESC_SWAP; |
509 } | 486 } |
510 ++v2->sNumSounds; | 487 ++this->sNumSounds; |
511 } | 488 } |
512 } | 489 } |
513 fclose(File); | 490 fclose(File); |
514 return 1; | 491 return 1; |
515 } | 492 } |
719 return; | 696 return; |
720 } | 697 } |
721 | 698 |
722 int start_channel = 0, | 699 int start_channel = 0, |
723 end_channel = 0; | 700 end_channel = 0; |
724 | 701 v62 = start_channel; |
725 assert(sound_id < pSoundList->sNumSounds); | 702 assert(sound_id < pSoundList->sNumSounds); |
726 SoundDesc* sound_desc = pSoundList->pSounds + sound_id; | 703 SoundDesc* sound_desc = &pSoundList->pSounds[sound_id]; |
727 if (!b3DSoundInitialized || sound_desc->Is3D()) | 704 if (!b3DSoundInitialized || sound_desc->Is3D()) |
728 { | 705 { |
729 if (!a3) // generic sound like from UI | 706 if (!a3) // generic sound like from UI |
730 { | 707 { |
731 start_channel = 10; | 708 start_channel = 10; |
732 end_channel = 12; | 709 end_channel = 12; |
733 goto LABEL_133; | |
734 } | |
735 else if (a3 == -1) // exclusive sounds - can override | |
736 { | |
737 start_channel = 13; | |
738 end_channel = 13; | |
739 goto LABEL_133; | |
740 } | |
741 else | |
742 { | |
743 if (a3 < 0) // exclusive sounds - no override | |
744 { | |
745 start_channel = 14; | |
746 end_channel = 14; | |
747 goto LABEL_123; | |
748 } | |
749 else | |
750 { | |
751 int object_type = PID_TYPE(a3), | |
752 object_id = PID_ID(a3); | |
753 switch (object_type) | |
754 { | |
755 case OBJECT_BLVDoor: | |
756 case OBJECT_Player: | |
757 { | |
758 start_channel = 10; | |
759 end_channel = 12; | |
760 goto LABEL_133; | |
761 } | |
762 break; | |
763 | |
764 case OBJECT_Actor: | |
765 { | |
766 start_channel = 0; | |
767 end_channel = 3; | |
768 | |
769 assert(object_id < uNumActors); | |
770 Actor* actor = &pActors[object_id]; | |
771 | |
772 sample_volume = GetSoundStrengthByDistanceFromParty(actor->vPosition.x, actor->vPosition.y, actor->vPosition.z); | |
773 if (!sample_volume) | |
774 return; | |
775 goto LABEL_123; | |
776 } | |
777 | |
778 case OBJECT_Decoration: | |
779 { | |
780 start_channel = 4; | |
781 end_channel = 4; | |
782 | |
783 assert(object_id < uNumLevelDecorations); | |
784 LevelDecoration* decor = &pLevelDecorations[object_id]; | |
785 | |
786 sample_volume = GetSoundStrengthByDistanceFromParty(decor->vPosition.x, decor->vPosition.y, decor->vPosition.z); | |
787 if (!sample_volume) | |
788 return; | |
789 goto LABEL_123; | |
790 } | |
791 break; | |
792 | |
793 case OBJECT_Item: | |
794 { | |
795 start_channel = 5; | |
796 end_channel = 7; | |
797 | |
798 assert(object_id < uNumSpriteObjects); | |
799 SpriteObject* object = &pSpriteObjects[object_id]; | |
800 | |
801 sample_volume = GetSoundStrengthByDistanceFromParty(object->vPosition.x, object->vPosition.y, object->vPosition.z); | |
802 if (!sample_volume) | |
803 return; | |
804 goto LABEL_123; | |
805 } | |
806 break; | |
807 | |
808 case OBJECT_BModel: | |
809 { | |
810 start_channel = 8; | |
811 end_channel = 9; | |
812 goto LABEL_123; | |
813 } | |
814 break; | |
815 | |
816 default: | |
817 assert(false); | |
818 } | |
819 } | |
820 } | |
821 LABEL_123: | |
822 for (uint i = 0; i < uMixerChannels; ++i) | |
823 { | |
824 MixerChannel* channel = &pMixerChannels[i]; | |
825 if (channel->source_pid == a3 && | |
826 AIL_sample_status(channel->hSample) == AIL::Sample::Playing) | |
827 { | |
828 if (channel->uSourceTrackIdx == sound_id) | |
829 return; // already playing the same sound from the same source - return | |
830 AIL_end_sample(channel->hSample); // requested new sound from the same source - end & switch | |
831 FreeChannel(channel); | |
832 } | |
833 } | |
834 LABEL_133: | |
835 v62 = start_channel; | |
836 //pAudioPlayer4 = pAudioPlayer; | |
837 for (v62 = start_channel; v62 <= end_channel; ++v62) | 710 for (v62 = start_channel; v62 <= end_channel; ++v62) |
838 { | 711 { |
839 MixerChannel* channel = pMixerChannels + v62; | 712 MixerChannel* channel = pMixerChannels + v62; |
840 if (AIL_sample_status(channel->hSample) == AIL::Sample::Done) | 713 if (AIL_sample_status(channel->hSample) == AIL::Sample::Done) |
841 { | 714 { |
843 if (channel->uSourceTrackIdx) | 716 if (channel->uSourceTrackIdx) |
844 FreeChannel(channel); | 717 FreeChannel(channel); |
845 break; | 718 break; |
846 } | 719 } |
847 } | 720 } |
721 } | |
722 else if (a3 == -1) // exclusive sounds - can override | |
723 { | |
724 start_channel = 13; | |
725 end_channel = 13; | |
726 for (v62 = start_channel; v62 <= end_channel; ++v62) | |
727 { | |
728 MixerChannel* channel = pMixerChannels + v62; | |
729 if (AIL_sample_status(channel->hSample) == AIL::Sample::Done) | |
730 { | |
731 AIL_end_sample(channel->hSample); | |
732 if (channel->uSourceTrackIdx) | |
733 FreeChannel(channel); | |
734 break; | |
735 } | |
736 } | |
737 } | |
738 else | |
739 { | |
740 if (a3 < 0) // exclusive sounds - no override | |
741 { | |
742 start_channel = 14; | |
743 end_channel = 14; | |
744 for (uint i = 0; i < uMixerChannels; ++i) | |
745 { | |
746 MixerChannel* channel = &pMixerChannels[i]; | |
747 if (channel->source_pid == a3 && AIL_sample_status(channel->hSample) == AIL::Sample::Playing) | |
748 { | |
749 if (channel->uSourceTrackIdx == sound_id) | |
750 return; // already playing the same sound from the same source - return | |
751 AIL_end_sample(channel->hSample); // requested new sound from the same source - end & switch | |
752 FreeChannel(channel); | |
753 } | |
754 } | |
755 } | |
756 else | |
757 { | |
758 int object_type = PID_TYPE(a3), | |
759 object_id = PID_ID(a3); | |
760 switch (object_type) | |
761 { | |
762 case OBJECT_BLVDoor: | |
763 case OBJECT_Player: | |
764 { | |
765 start_channel = 10; | |
766 end_channel = 12; | |
767 for (v62 = start_channel; v62 <= end_channel; ++v62) | |
768 { | |
769 MixerChannel* channel = pMixerChannels + v62; | |
770 if (AIL_sample_status(channel->hSample) == AIL::Sample::Done) | |
771 { | |
772 AIL_end_sample(channel->hSample); | |
773 if (channel->uSourceTrackIdx) | |
774 FreeChannel(channel); | |
775 break; | |
776 } | |
777 } | |
778 } | |
779 break; | |
780 | |
781 case OBJECT_Actor: | |
782 { | |
783 start_channel = 0; | |
784 end_channel = 3; | |
785 | |
786 assert(object_id < uNumActors); | |
787 Actor* actor = &pActors[object_id]; | |
788 | |
789 sample_volume = GetSoundStrengthByDistanceFromParty(actor->vPosition.x, actor->vPosition.y, actor->vPosition.z); | |
790 if (!sample_volume) | |
791 return; | |
792 for (uint i = 0; i < uMixerChannels; ++i) | |
793 { | |
794 MixerChannel* channel = &pMixerChannels[i]; | |
795 if (channel->source_pid == a3 && AIL_sample_status(channel->hSample) == AIL::Sample::Playing) | |
796 { | |
797 if (channel->uSourceTrackIdx == sound_id) | |
798 return; // already playing the same sound from the same source - return | |
799 AIL_end_sample(channel->hSample); // requested new sound from the same source - end & switch | |
800 FreeChannel(channel); | |
801 } | |
802 } | |
803 } | |
804 break; | |
805 | |
806 case OBJECT_Decoration: | |
807 { | |
808 start_channel = 4; | |
809 end_channel = 4; | |
810 | |
811 assert(object_id < uNumLevelDecorations); | |
812 LevelDecoration* decor = &pLevelDecorations[object_id]; | |
813 | |
814 sample_volume = GetSoundStrengthByDistanceFromParty(decor->vPosition.x, decor->vPosition.y, decor->vPosition.z); | |
815 if (!sample_volume) | |
816 return; | |
817 for (uint i = 0; i < uMixerChannels; ++i) | |
818 { | |
819 MixerChannel* channel = &pMixerChannels[i]; | |
820 if (channel->source_pid == a3 && AIL_sample_status(channel->hSample) == AIL::Sample::Playing) | |
821 { | |
822 if (channel->uSourceTrackIdx == sound_id) | |
823 return; // already playing the same sound from the same source - return | |
824 AIL_end_sample(channel->hSample); // requested new sound from the same source - end & switch | |
825 FreeChannel(channel); | |
826 } | |
827 } | |
828 } | |
829 break; | |
830 | |
831 case OBJECT_Item: | |
832 { | |
833 start_channel = 5; | |
834 end_channel = 7; | |
835 | |
836 assert(object_id < uNumSpriteObjects); | |
837 SpriteObject* object = &pSpriteObjects[object_id]; | |
838 | |
839 sample_volume = GetSoundStrengthByDistanceFromParty(object->vPosition.x, object->vPosition.y, object->vPosition.z); | |
840 if (!sample_volume) | |
841 return; | |
842 for (uint i = 0; i < uMixerChannels; ++i) | |
843 { | |
844 MixerChannel* channel = &pMixerChannels[i]; | |
845 if (channel->source_pid == a3 && AIL_sample_status(channel->hSample) == AIL::Sample::Playing) | |
846 { | |
847 if (channel->uSourceTrackIdx == sound_id) | |
848 return; // already playing the same sound from the same source - return | |
849 AIL_end_sample(channel->hSample); // requested new sound from the same source - end & switch | |
850 FreeChannel(channel); | |
851 } | |
852 } | |
853 } | |
854 break; | |
855 | |
856 case OBJECT_BModel: | |
857 { | |
858 start_channel = 8; | |
859 end_channel = 9; | |
860 for (uint i = 0; i < uMixerChannels; ++i) | |
861 { | |
862 MixerChannel* channel = &pMixerChannels[i]; | |
863 if (channel->source_pid == a3 && AIL_sample_status(channel->hSample) == AIL::Sample::Playing) | |
864 { | |
865 if (channel->uSourceTrackIdx == sound_id) | |
866 return; // already playing the same sound from the same source - return | |
867 AIL_end_sample(channel->hSample); // requested new sound from the same source - end & switch | |
868 FreeChannel(channel); | |
869 } | |
870 } | |
871 } | |
872 break; | |
873 | |
874 default: | |
875 assert(false); | |
876 } | |
877 } | |
878 } | |
848 /*if ( start_channel <= end_channel) | 879 /*if ( start_channel <= end_channel) |
849 { | 880 { |
850 pMixerChannel2 = &pAudioPlayer->pMixerChannels[start_channel]; | 881 pMixerChannel2 = &pAudioPlayer->pMixerChannels[start_channel]; |
851 while ( AIL_sample_status(pMixerChannel2->hSample) != AIL::Sample::Done) | 882 while ( AIL_sample_status(pMixerChannel2->hSample) != AIL::Sample::Done) |
852 { | 883 { |
859 if ( pMixerChannel2->uSourceTrackIdx ) | 890 if ( pMixerChannel2->uSourceTrackIdx ) |
860 _4ABE55(pMixerChannel2); | 891 _4ABE55(pMixerChannel2); |
861 } | 892 } |
862 LABEL_140:*/ | 893 LABEL_140:*/ |
863 | 894 |
864 if (v62 > end_channel) // no free channel - occupy the quitest one | 895 if (start_channel > end_channel) // no free channel - occupy the quitest one |
865 { | 896 { |
866 v62 = -1; | 897 start_channel = -1; |
867 | 898 |
868 int min_volume = sample_volume; | 899 int min_volume = sample_volume; |
869 for (uint i = start_channel; i <= end_channel; ++i) | 900 for (uint i = start_channel; i <= end_channel; ++i) |
870 { | 901 { |
871 MixerChannel* channel = &pMixerChannels[i]; | 902 MixerChannel* channel = &pMixerChannels[i]; |
872 | 903 |
873 int volume = AIL_sample_volume(channel->hSample); | 904 int volume = AIL_sample_volume(channel->hSample); |
874 if (volume < min_volume) | 905 if (volume < min_volume) |
875 { | 906 { |
876 min_volume = volume; | 907 min_volume = volume; |
877 v62 = i; | 908 start_channel = i; |
878 } | 909 } |
879 } | 910 } |
880 /*v65 = start_channel; | 911 /*v65 = start_channel; |
881 v91 = v93; | 912 v91 = v93; |
882 if (start_channel <= end_channel) | 913 if (start_channel <= end_channel) |
1802 } | 1833 } |
1803 | 1834 |
1804 //----- (004AB71F) -------------------------------------------------------- | 1835 //----- (004AB71F) -------------------------------------------------------- |
1805 void AudioPlayer::StopChannels(int uStartChannel, int uEndChannel) | 1836 void AudioPlayer::StopChannels(int uStartChannel, int uEndChannel) |
1806 { | 1837 { |
1807 //AudioPlayer *v3; // esi@1 | |
1808 int v4; // ecx@1 | 1838 int v4; // ecx@1 |
1809 //AudioPlayer_3DSample *v5; // edi@4 | |
1810 int v6; // ebx@12 | |
1811 MixerChannel *pChannel; // edi@14 | |
1812 //_STREAM *v8; // esi@23 | |
1813 int v9; // [sp+4h] [bp-4h]@3 | 1839 int v9; // [sp+4h] [bp-4h]@3 |
1814 | 1840 |
1815 if ( bPlayerReady ) | 1841 if ( bPlayerReady ) |
1816 { | 1842 { |
1817 if ( b3DSoundInitialized ) | 1843 if ( b3DSoundInitialized ) |
1818 { | 1844 { |
1819 v9 = 0; | 1845 v9 = 0; |
1820 if ( uNum3DSamples > 0 ) | 1846 if ( uNum3DSamples > 0 ) |
1821 { | 1847 { |
1822 //v5 = p3DSamples;//;(char *)&p3DSamples[0].field_8; | |
1823 for ( v4 = 0; v4 < uNum3DSamples; ++v4 ) | 1848 for ( v4 = 0; v4 < uNum3DSamples; ++v4 ) |
1824 { | 1849 { |
1825 if ( (uStartChannel == -1 || v4 < uStartChannel || v4 > uEndChannel) | 1850 if ( (uStartChannel == -1 || v4 < uStartChannel || v4 > uEndChannel) |
1826 && p3DSamples[v4].field_8 | 1851 && p3DSamples[v4].field_8 |
1827 && pSoundList->pSounds[p3DSamples[v4].field_8].eType != SOUND_DESC_SYSTEM) | 1852 && pSoundList->pSounds[p3DSamples[v4].field_8].eType != SOUND_DESC_SYSTEM) |
1828 { | 1853 { |
1829 AIL_end_3D_sample(p3DSamples[v4].hSample); | 1854 AIL_end_3D_sample(p3DSamples[v4].hSample); |
1830 _4ABF23(&p3DSamples[v4]); | 1855 _4ABF23(&p3DSamples[v4]); |
1831 p3DSamples[v4].field_4 = 0; | 1856 p3DSamples[v4].field_4 = 0; |
1832 v4 = v9; | 1857 v4 = v9; |
1833 } | 1858 } |
1834 //v5 += 16; | |
1835 v9 = v4; | 1859 v9 = v4; |
1836 } | 1860 } |
1837 } | 1861 } |
1838 } | 1862 } |
1839 if ( hDigDriver && uMixerChannels > 0 ) | 1863 if ( hDigDriver && uMixerChannels > 0 ) |
1840 { | 1864 { |
1841 pChannel = pMixerChannels; | 1865 for ( int i = 0; i < uMixerChannels; ++i ) |
1842 for ( v6 = 0; v6 < uMixerChannels; ++v6 ) | 1866 { |
1843 { | 1867 if ( (uStartChannel == -1 || i < uStartChannel || i > uEndChannel) |
1844 if ( (uStartChannel == -1 || v6 < uStartChannel || v6 > uEndChannel) | 1868 && pSoundList->pSounds[pMixerChannels[i].uSourceTrackIdx].eType != SOUND_DESC_SYSTEM) |
1845 && pSoundList->pSounds[pChannel->uSourceTrackIdx].eType != SOUND_DESC_SYSTEM) | 1869 { |
1846 { | 1870 AIL_end_sample(pMixerChannels[i].hSample); |
1847 AIL_end_sample(pChannel->hSample); | 1871 FreeChannel(&pMixerChannels[i]); |
1848 FreeChannel(pChannel); | 1872 pMixerChannels[i].source_pid = 0; |
1849 pChannel->source_pid = 0; | 1873 } |
1850 } | |
1851 ++pChannel; | |
1852 } | 1874 } |
1853 } | 1875 } |
1854 if (hSequence) | 1876 if (hSequence) |
1855 AIL_end_sequence(hSequence); | 1877 AIL_end_sequence(hSequence); |
1856 //v8 = hStream; | |
1857 if (hStream) | 1878 if (hStream) |
1858 AIL_pause_stream(hStream, 1); | 1879 AIL_pause_stream(hStream, 1); |
1859 } | 1880 } |
1860 } | 1881 } |
1861 | 1882 |
1884 int v3; // ebx@1 | 1905 int v3; // ebx@1 |
1885 //_DIG_DRIVER *v4; // eax@1 | 1906 //_DIG_DRIVER *v4; // eax@1 |
1886 char v5; // dl@5 | 1907 char v5; // dl@5 |
1887 _PROVIDER *v6; // eax@9 | 1908 _PROVIDER *v6; // eax@9 |
1888 //HWND v7; // ST00_4@9 | 1909 //HWND v7; // ST00_4@9 |
1889 MixerChannel *pChannel; // edi@14 | 1910 //MixerChannel *pChannel; // edi@14 |
1890 _SAMPLE *v9; // eax@15 | 1911 _SAMPLE *v9; // eax@15 |
1891 //_REDBOOK *v10; // eax@19 | 1912 //_REDBOOK *v10; // eax@19 |
1892 //int v11; // ecx@21 | 1913 //int v11; // ecx@21 |
1893 int v12; // [sp+Ch] [bp-Ch]@9 | 1914 int v12; // [sp+Ch] [bp-Ch]@9 |
1894 char *Str1; // [sp+10h] [bp-8h]@6 | 1915 char *Str1; // [sp+10h] [bp-8h]@6 |
1952 pAudioPlayer->_4AC0A2(); | 1973 pAudioPlayer->_4AC0A2(); |
1953 break; | 1974 break; |
1954 } | 1975 } |
1955 } | 1976 } |
1956 } | 1977 } |
1957 if ( uMixerChannels > 0 ) | 1978 for ( v3; v3 < uMixerChannels; ++v3 ) |
1958 { | 1979 { |
1959 pChannel = pMixerChannels; | 1980 pMixerChannels[v3].hSample = AIL_allocate_sample_handle(hDigDriver); |
1960 do | 1981 if ( !pMixerChannels[v3].hSample ) |
1961 { | 1982 break; |
1962 v9 = AIL_allocate_sample_handle(hDigDriver); | |
1963 pChannel->hSample = v9; | |
1964 if ( !v9 ) | |
1965 break; | |
1966 ++v3; | |
1967 ++pChannel; | |
1968 } | |
1969 while ( v3 < uMixerChannels ); | |
1970 } | 1983 } |
1971 uMixerChannels = v3; | 1984 uMixerChannels = v3; |
1972 if ( bPlayerReady ) | 1985 if ( bPlayerReady ) |
1973 StopChannels(-1, -1); | 1986 StopChannels(-1, -1); |
1974 //v10 = hAILRedbook; | 1987 //v10 = hAILRedbook; |
2195 } | 2208 } |
2196 if ( !num_playing_channels ) | 2209 if ( !num_playing_channels ) |
2197 { | 2210 { |
2198 LABEL_16: | 2211 LABEL_16: |
2199 pSoundList->UnloadSound(pChannel->uSourceTrackIdx, 1); | 2212 pSoundList->UnloadSound(pChannel->uSourceTrackIdx, 1); |
2200 v10 = 0; | 2213 for ( v10 = 0; v10 < num_same_sound_on_channels; v10++ ) |
2201 if ( num_same_sound_on_channels > 0 ) | 2214 { |
2202 { | 2215 v12 = 16 * (v14[v10] + 47); |
2203 do | 2216 pMixerChannels[v14[v10]].uSourceTrackID = 0; |
2204 { | 2217 *(unsigned int *)((char *)&bEAXSupported + v12) = 0; |
2205 v11 = v14[v10]; | |
2206 v12 = 16 * (v14[v10++] + 47); | |
2207 pMixerChannels[v11].uSourceTrackID = 0; | |
2208 //v13 = __OFSUB__(v10, num_same_sound_on_channels); | |
2209 //v6 = v10 - num_same_sound_on_channels < 0; | |
2210 *(unsigned int *)((char *)&bEAXSupported + v12) = 0; | |
2211 } | |
2212 while (v10 < num_same_sound_on_channels); | |
2213 } | 2218 } |
2214 } | 2219 } |
2215 } | 2220 } |
2216 } | 2221 } |
2217 } | 2222 } |