Mercurial > mm7
comparison AudioPlayer.cpp @ 2106:b52c09e01e7e
PlaySound() blv_door and other sounds
author | Ritor1 |
---|---|
date | Fri, 20 Dec 2013 00:37:39 +0600 |
parents | 7ee21636d67a |
children | 18b0ff5e1bf1 |
comparison
equal
deleted
inserted
replaced
2105:7ee21636d67a | 2106:b52c09e01e7e |
---|---|
557 } | 557 } |
558 | 558 |
559 //----- (004AA306) -------------------------------------------------------- | 559 //----- (004AA306) -------------------------------------------------------- |
560 void AudioPlayer::PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int PartyX, signed int PartyY, int a7, unsigned int uVolume, int sPlaybackRate) | 560 void AudioPlayer::PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int PartyX, signed int PartyY, int a7, unsigned int uVolume, int sPlaybackRate) |
561 { | 561 { |
562 //AudioPlayer *pAudioPlayer1; // esi@1 | |
563 //signed int pNum; // edx@5 | |
564 //int *pSoundID; // ecx@6 | |
565 int v12; // edi@13 | 562 int v12; // edi@13 |
566 signed int v13; // ecx@17 | 563 signed int v13; // ecx@17 |
567 signed int v14; // eax@20 | 564 signed int v14; // eax@20 |
568 int v15; // eax@24 | 565 int v15; // eax@24 |
569 signed int v16; // eax@25 | 566 signed int v16; // eax@25 |
585 int v32; // ebx@70 | 582 int v32; // ebx@70 |
586 int v33; // eax@70 | 583 int v33; // eax@70 |
587 int v34; // eax@70 | 584 int v34; // eax@70 |
588 char v35; // zf@70 | 585 char v35; // zf@70 |
589 signed int v36; // ebx@74 | 586 signed int v36; // ebx@74 |
590 //AudioPlayer *pAudioPlayer2; // edi@79 | |
591 AudioPlayer_3DSample *pAudioPlayer_3DSample3; // esi@79 | 587 AudioPlayer_3DSample *pAudioPlayer_3DSample3; // esi@79 |
592 //unsigned int v39; // ebx@80 | |
593 int v40; // eax@81 | 588 int v40; // eax@81 |
594 char *v41; // edi@82 | 589 char *v41; // edi@82 |
595 int v42; // esi@82 | 590 int v42; // esi@82 |
596 double v43; // st7@91 | 591 double v43; // st7@91 |
597 SpriteObject *pLayingItem2; // eax@92 | 592 SpriteObject *pLayingItem2; // eax@92 |
603 int v50; // ST18_4@104 | 598 int v50; // ST18_4@104 |
604 int v51; // ebx@104 | 599 int v51; // ebx@104 |
605 int v52; // eax@104 | 600 int v52; // eax@104 |
606 float v53; // ST0C_4@106 | 601 float v53; // ST0C_4@106 |
607 float v54; // ST04_4@106 | 602 float v54; // ST04_4@106 |
608 //AudioPlayer *pAudioPlayer3; // edx@106 | |
609 SoundDesc *pSoundDesc; // edx@107 | 603 SoundDesc *pSoundDesc; // edx@107 |
610 SpriteObject *pLayingItem3; // eax@114 | 604 SpriteObject *pLayingItem3; // eax@114 |
611 //int v58; // edx@115 | |
612 //int v59; // ecx@115 | |
613 //Actor *pActor2; // eax@118 | |
614 //MixerChannel *pMixerChannel; // esi@126 | |
615 signed int v62; // esi@133 | 605 signed int v62; // esi@133 |
616 //AudioPlayer *pAudioPlayer4; // ebx@133 | |
617 //MixerChannel *pMixerChannel2; // edi@134 | |
618 //int v65; // ebx@141 | |
619 //AudioPlayer *pAudioPlayer5; // ecx@142 | |
620 //MixerChannel *pMixerChannel3; // edi@142 | |
621 int v68; // eax@143 | 606 int v68; // eax@143 |
622 //MixerChannel *pMixerChannel4; // edi@149 | |
623 //int v70; // ecx@152 | |
624 //SoundDesc *pSoundDesc2; // eax@153 | |
625 //int v72; // edi@156 | |
626 //MixerChannel *pMixerChannel5; // esi@157 | |
627 //unsigned int pVolume; // eax@157 | |
628 //int pPartyX; // ebx@159 | |
629 //int v76; // ebx@160 | |
630 //SpriteObject *pLayingItem4; // edi@164 | |
631 //unsigned int pPosY; // edx@166 | |
632 //unsigned int pPosX; // ecx@166 | |
633 //int v80; // eax@167 | |
634 //Actor *pActor3; // edi@168 | |
635 //BLVDoor *pBLVDoor2; // edi@173 | |
636 //int v83; // eax@183 | |
637 //int v84; // eax@183 | |
638 //_SAMPLE *v85; // ST18_4@186 | |
639 unsigned int v86; // [sp+14h] [bp-60h]@84 | 607 unsigned int v86; // [sp+14h] [bp-60h]@84 |
640 //int v87; // [sp+14h] [bp-60h]@115 | |
641 RenderVertexSoft pRenderVertexSoft; // [sp+24h] [bp-50h]@1 | 608 RenderVertexSoft pRenderVertexSoft; // [sp+24h] [bp-50h]@1 |
642 //unsigned int v89; // [sp+54h] [bp-20h]@12 | |
643 int v90; // [sp+58h] [bp-1Ch]@68 | 609 int v90; // [sp+58h] [bp-1Ch]@68 |
644 float v91; // [sp+5Ch] [bp-18h]@68 | 610 float v91; // [sp+5Ch] [bp-18h]@68 |
645 //unsigned int v92; // [sp+60h] [bp-14h]@10 | |
646 float v93; // [sp+64h] [bp-10h]@1 | 611 float v93; // [sp+64h] [bp-10h]@1 |
647 signed int varC; // [sp+68h] [bp-Ch]@68 | 612 signed int varC; // [sp+68h] [bp-Ch]@68 |
648 //AudioPlayer *pAudioPlayer; // [sp+6Ch] [bp-8h]@1 | |
649 int v96; // [sp+70h] [bp-4h]@19 | 613 int v96; // [sp+70h] [bp-4h]@19 |
650 signed int uNumRepeatsb; // [sp+84h] [bp+10h]@93 | 614 signed int uNumRepeatsb; // [sp+84h] [bp+10h]@93 |
651 float uNumRepeatsa; // [sp+84h] [bp+10h]@104 | 615 float uNumRepeatsa; // [sp+84h] [bp+10h]@104 |
652 float v99; // [sp+8Ch] [bp+18h]@104 | 616 float v99; // [sp+8Ch] [bp+18h]@104 |
653 signed int v100; // [sp+90h] [bp+1Ch]@32 | 617 signed int v100; // [sp+90h] [bp+1Ch]@32 |
654 int v101; // [sp+90h] [bp+1Ch]@52 | 618 int v101; // [sp+90h] [bp+1Ch]@52 |
655 int v102; // [sp+90h] [bp+1Ch]@60 | 619 int v102; // [sp+90h] [bp+1Ch]@60 |
656 int v103; // [sp+90h] [bp+1Ch]@68 | 620 int v103; // [sp+90h] [bp+1Ch]@68 |
657 | 621 |
658 if (!bPlayerReady) | 622 if ( !bPlayerReady || !uSoundVolumeMultiplier || !hDigDriver || eSoundID == SOUND_Invalid ) |
659 return; | 623 return; |
660 if (!uSoundVolumeMultiplier) | 624 |
661 return; | |
662 if (!hDigDriver) | |
663 return; | |
664 if (eSoundID == SOUND_Invalid) | |
665 return; | |
666 | |
667 //pAudioPlayer = this; | |
668 //v35 = this->bPlayerReady == 0; | |
669 //pAudioPlayer = this; | |
670 //LODWORD(v93) = 10000; | |
671 int sample_volume = 10000; | 625 int sample_volume = 10000; |
672 | |
673 | 626 |
674 int sound_id = 0; | 627 int sound_id = 0; |
675 for (uint i = 0; i < pSoundList->sNumSounds; ++i) | 628 for (uint i = 0; i < pSoundList->sNumSounds; ++i) |
676 if (pSoundList->pSounds[i].uSoundID == eSoundID) | 629 if (pSoundList->pSounds[i].uSoundID == eSoundID) |
677 { | 630 { |
683 { | 636 { |
684 Log::Warning(L"SoundID = %u not found", eSoundID); | 637 Log::Warning(L"SoundID = %u not found", eSoundID); |
685 return; | 638 return; |
686 } | 639 } |
687 assert(sound_id < pSoundList->sNumSounds); | 640 assert(sound_id < pSoundList->sNumSounds); |
688 SoundDesc* sound_desc = &pSoundList->pSounds[sound_id]; | 641 if ( !a7 ) |
689 if ( !a7 ) | 642 { |
690 { | 643 if ( !pSoundList->pSounds[sound_id].pSoundData[0] ) |
691 //pSoundDesc = pSoundList->pSounds; | 644 { |
692 //pSoundDesc2 = &pSoundList->pSounds[sound_id]; | 645 if ( pSoundList->pSounds[sound_id].eType == SOUND_DESC_SWAP ) |
693 if ( !sound_desc->pSoundData[0] ) | 646 pSoundList->LoadSound(eSoundID, 0); |
694 { | 647 } |
695 if ( sound_desc->eType == SOUND_DESC_SWAP ) | 648 } |
696 pSoundList->LoadSound(eSoundID, 0); | 649 if ( !pSoundList->pSounds[sound_id].pSoundData[a7] ) |
697 } | 650 return; |
698 } | |
699 //v72 = 4 * (a7 + 30 * sound_id) + 44; | |
700 if ( !pSoundList->pSounds[sound_id].pSoundData[a7] ) | |
701 return; | |
702 | 651 |
703 int start_channel = 0, | 652 int start_channel = 0, |
704 end_channel = 0; | 653 end_channel = 0; |
705 v62 = start_channel; | 654 v62 = start_channel; |
706 | 655 |
707 if (!b3DSoundInitialized || sound_desc->Is3D()) | 656 if (!b3DSoundInitialized || pSoundList->pSounds[sound_id].Is3D()) |
708 { | 657 { |
709 if (a3 == 0) // generic sound like from UI | 658 if (a3 == 0) // generic sound like from UI |
710 { | 659 { |
711 for (int i = 10; i <= 12; ++i) | 660 start_channel = 10; |
712 { | 661 end_channel = 12; |
713 if (AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Done) | 662 for (uint i = start_channel; i <= end_channel; ++i) |
714 { | 663 { |
715 AIL_end_sample(pMixerChannels[i].hSample); | 664 if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) |
716 if ( pMixerChannels[i].uSourceTrackIdx ) | 665 { |
717 FreeChannel(&pMixerChannels[i]); | 666 if ( pMixerChannels[i].uSourceTrackIdx == sound_id ) |
718 break; | 667 return; // already playing the same sound from the same source - return |
719 } | 668 AIL_end_sample(pMixerChannels[i].hSample); // requested new sound from the same source - end & switch |
720 } | 669 FreeChannel(&pMixerChannels[i]); |
670 } | |
671 } | |
672 for ( uint j = start_channel; j <= end_channel; j++ ) | |
673 { | |
674 if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done ) | |
675 { | |
676 AIL_init_sample(pMixerChannels[j].hSample); | |
677 AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); | |
678 if ( sample_volume == 10000 ) | |
679 sample_volume = uMasterVolume; | |
680 if (uVolume) | |
681 sample_volume = uVolume; | |
682 int object_type = PID_TYPE(a3), | |
683 object_id = PID_ID(a3); | |
684 /*if (PartyX != -1) | |
685 { | |
686 if (!PartyX) | |
687 PartyX = pParty->vPosition.x; | |
688 if (!PartyY) | |
689 PartyY = pParty->vPosition.y; | |
690 AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(PartyX, PartyY)); | |
691 AIL_set_sample_volume(pMixerChannels[v62].hSample, GetSoundStrengthByDistanceFromParty(PartyX, PartyY, pParty->vPosition.z)); | |
692 } */ | |
693 if (uNumRepeats) | |
694 AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); | |
695 pMixerChannels[j].uSourceTrackIdx = sound_id; | |
696 pMixerChannels[j].source_pid = a3; | |
697 pMixerChannels[j].uSourceTrackID = eSoundID; | |
698 int rval = AIL_start_sample(pMixerChannels[j].hSample); | |
699 if ( sPlaybackRate ) | |
700 AIL_set_sample_playback_rate(pMixerChannels[j].hSample, sPlaybackRate); | |
701 if (object_type == OBJECT_Player) | |
702 AIL_sample_ms_position(pMixerChannels[j].hSample, &sLastTrackLengthMS, 0); | |
703 return; | |
704 } | |
705 } | |
706 return; | |
721 } | 707 } |
722 else if (a3 == -1) // exclusive sounds - can override | 708 else if (a3 == -1) // exclusive sounds - can override |
723 { | 709 { |
724 if ( AIL_sample_status(pMixerChannels[13].hSample) == AIL::Sample::Done ) | 710 if ( AIL_sample_status(pMixerChannels[13].hSample) == AIL::Sample::Done ) |
725 { | 711 { |
726 AIL_end_sample(pMixerChannels[13].hSample); | 712 AIL_end_sample(pMixerChannels[13].hSample); |
727 if ( pMixerChannels[13].uSourceTrackIdx ) | 713 if ( pMixerChannels[13].uSourceTrackIdx ) |
728 FreeChannel(&pMixerChannels[13]); | 714 FreeChannel(&pMixerChannels[13]); |
729 } | 715 } |
730 } | 716 } |
717 else if (a3 < 0) // exclusive sounds - no override (close chest) | |
718 { | |
719 start_channel = 14; | |
720 end_channel = 14; | |
721 for (uint i = start_channel; i <= end_channel; ++i) | |
722 { | |
723 if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) | |
724 { | |
725 if ( pMixerChannels[i].uSourceTrackIdx == sound_id ) | |
726 return; // already playing the same sound from the same source - return | |
727 AIL_end_sample(pMixerChannels[i].hSample); // requested new sound from the same source - end & switch | |
728 FreeChannel(&pMixerChannels[i]); | |
729 } | |
730 } | |
731 for ( uint j = start_channel; j <= end_channel; j++ ) | |
732 { | |
733 if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done ) | |
734 { | |
735 AIL_init_sample(pMixerChannels[j].hSample); | |
736 AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); | |
737 if ( sample_volume == 10000 ) | |
738 sample_volume = uMasterVolume; | |
739 if (uVolume) | |
740 sample_volume = uVolume; | |
741 int object_type = PID_TYPE(a3), | |
742 object_id = PID_ID(a3); | |
743 if (uNumRepeats) | |
744 AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); | |
745 pMixerChannels[j].uSourceTrackIdx = sound_id; | |
746 pMixerChannels[j].source_pid = a3; | |
747 pMixerChannels[j].uSourceTrackID = eSoundID; | |
748 int rval = AIL_start_sample(pMixerChannels[j].hSample);//no sound chest close | |
749 if ( sPlaybackRate ) | |
750 AIL_set_sample_playback_rate(pMixerChannels[j].hSample, sPlaybackRate); | |
751 if (object_type == OBJECT_Player) | |
752 AIL_sample_ms_position(pMixerChannels[j].hSample, &sLastTrackLengthMS, 0); | |
753 return; | |
754 } | |
755 } | |
756 return; | |
757 } | |
731 else | 758 else |
732 { | 759 { |
733 if (a3 < 0) // exclusive sounds - no override | |
734 { | |
735 if ( pMixerChannels[14].source_pid == a3 && AIL_sample_status(pMixerChannels[14].hSample) == AIL::Sample::Playing ) | |
736 { | |
737 if ( pMixerChannels[14].uSourceTrackIdx == sound_id ) | |
738 return; // already playing the same sound from the same source - return | |
739 AIL_end_sample(pMixerChannels[14].hSample); // requested new sound from the same source - end & switch | |
740 FreeChannel(&pMixerChannels[14]); | |
741 } | |
742 } | |
743 else | |
744 { | |
745 int object_type = PID_TYPE(a3), | 760 int object_type = PID_TYPE(a3), |
746 object_id = PID_ID(a3); | 761 object_id = PID_ID(a3); |
747 switch (object_type) | 762 switch (object_type) |
748 { | 763 { |
749 case OBJECT_BLVDoor: | 764 case OBJECT_BLVDoor: |
772 AIL_init_sample(pMixerChannels[j].hSample); | 787 AIL_init_sample(pMixerChannels[j].hSample); |
773 AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); | 788 AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); |
774 if (uVolume) | 789 if (uVolume) |
775 sample_volume = uVolume; | 790 sample_volume = uVolume; |
776 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume); | 791 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume); |
777 if (!GetSoundStrengthByDistanceFromParty(pIndoor->pDoors[object_id].pXOffsets[0], pIndoor->pDoors[object_id].pYOffsets[0], pIndoor->pDoors[object_id].pZOffsets[0])) | 792 /*if (!GetSoundStrengthByDistanceFromParty(pIndoor->pDoors[object_id].pXOffsets[0], pIndoor->pDoors[object_id].pYOffsets[0], pIndoor->pDoors[object_id].pZOffsets[0])) |
778 { | 793 { |
779 AIL_end_sample(pMixerChannels[j].hSample); | 794 AIL_end_sample(pMixerChannels[j].hSample); |
780 FreeChannel(&pMixerChannels[j]); | 795 FreeChannel(&pMixerChannels[j]); |
781 return; | 796 return; |
782 } | 797 } */ |
783 AIL_set_sample_pan(pMixerChannels[j].hSample, sub_4AB66C(pIndoor->pDoors[object_id].pXOffsets[0], pIndoor->pDoors[object_id].pYOffsets[0])); | 798 AIL_set_sample_pan(pMixerChannels[j].hSample, sub_4AB66C(pIndoor->pDoors[object_id].pXOffsets[0], pIndoor->pDoors[object_id].pYOffsets[0])); |
784 if (uNumRepeats) | 799 if (uNumRepeats) |
785 AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); | 800 AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); |
786 pMixerChannels[j].uSourceTrackIdx = sound_id; | 801 pMixerChannels[j].uSourceTrackIdx = sound_id; |
787 pMixerChannels[j].source_pid = a3; | 802 pMixerChannels[j].source_pid = a3; |
1015 | 1030 |
1016 default: | 1031 default: |
1017 assert(false); | 1032 assert(false); |
1018 } | 1033 } |
1019 } | 1034 } |
1020 } | 1035 |
1021 /*if ( start_channel <= end_channel) | 1036 __debugbreak();//Ritor1 |
1022 { | |
1023 pMixerChannel2 = &pAudioPlayer->pMixerChannels[start_channel]; | |
1024 while ( AIL_sample_status(pMixerChannel2->hSample) != AIL::Sample::Done) | |
1025 { | |
1026 ++v62; | |
1027 ++pMixerChannel2; | |
1028 if ( v62 > end_channel ) | |
1029 goto LABEL_140; | |
1030 } | |
1031 AIL_end_sample(pMixerChannel2->hSample); | |
1032 if ( pMixerChannel2->uSourceTrackIdx ) | |
1033 _4ABE55(pMixerChannel2); | |
1034 } | |
1035 LABEL_140:*/ | |
1036 | |
1037 if (start_channel > end_channel) // no free channel - occupy the quitest one | 1037 if (start_channel > end_channel) // no free channel - occupy the quitest one |
1038 { | 1038 { |
1039 start_channel = -1; | 1039 start_channel = -1; |
1040 | |
1041 int min_volume = sample_volume; | 1040 int min_volume = sample_volume; |
1042 for (uint i = start_channel; i <= end_channel; ++i) | 1041 for (uint i = start_channel; i <= end_channel; ++i) |
1043 { | 1042 { |
1044 int volume = AIL_sample_volume(pMixerChannels[i].hSample); | 1043 int volume = AIL_sample_volume(pMixerChannels[i].hSample); |
1045 if (volume < min_volume) | 1044 if (volume < min_volume) |
1046 { | 1045 { |
1047 min_volume = volume; | 1046 min_volume = volume; |
1048 start_channel = i; | 1047 start_channel = i; |
1049 } | 1048 } |
1050 } | 1049 } |
1051 /*v65 = start_channel; | |
1052 v91 = v93; | |
1053 if (start_channel <= end_channel) | |
1054 { | |
1055 //pAudioPlayer5 = pAudioPlayer; | |
1056 pMixerChannel3 = &pAudioPlayer->pMixerChannels[start_channel]; | |
1057 do | |
1058 { | |
1059 v68 = AIL_sample_volume(pMixerChannel3->hSample); | |
1060 if ( v68 < SLODWORD(v91) ) | |
1061 { | |
1062 LODWORD(v91) = v68; | |
1063 v62 = v65; | |
1064 } | |
1065 ++v65; | |
1066 ++pMixerChannel3; | |
1067 } | |
1068 while ( v65 <= end_channel );*/ | |
1069 | |
1070 if (v62 == -1) // no free channels at all - only channel 13 allows override (a3 == -1) | 1050 if (v62 == -1) // no free channels at all - only channel 13 allows override (a3 == -1) |
1071 { | 1051 { |
1072 if (start_channel != 13) | 1052 if (start_channel != 13) |
1073 return; | 1053 return; |
1074 v62 = 13; | 1054 v62 = 13; |
1075 } | 1055 } |
1076 | |
1077 AIL_end_sample(pMixerChannels[v62].hSample); | 1056 AIL_end_sample(pMixerChannels[v62].hSample); |
1078 FreeChannel(&pMixerChannels[v62]); | 1057 FreeChannel(&pMixerChannels[v62]); |
1079 } | 1058 } |
1080 | 1059 |
1081 if (v62 > end_channel)//10!=13 | 1060 if (v62 > end_channel)//10!=13 |
1082 return; | 1061 return; |
1083 | 1062 |
1084 if ( sample_volume == 10000 ) | 1063 if ( sample_volume == 10000 ) |
1085 sample_volume = uMasterVolume; | 1064 sample_volume = uMasterVolume; |
1086 | |
1087 //v70 = 0; | |
1088 if ( !a7 ) | |
1089 { | |
1090 //pSoundDesc = pSoundList->pSounds; | |
1091 //pSoundDesc2 = &pSoundList->pSounds[sound_id]; | |
1092 if ( !sound_desc->pSoundData[0] ) | |
1093 { | |
1094 if ( sound_desc->eType == SOUND_DESC_SWAP ) | |
1095 pSoundList->LoadSound(eSoundID, 0); | |
1096 } | |
1097 } | |
1098 //v72 = 4 * (a7 + 30 * sound_id) + 44; | |
1099 if ( !pSoundList->pSounds[sound_id].pSoundData[a7] ) | |
1100 return; | |
1101 | 1065 |
1102 AIL_init_sample(pMixerChannels[v62].hSample); | 1066 AIL_init_sample(pMixerChannels[v62].hSample); |
1103 AIL_set_sample_file(pMixerChannels[v62].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); | 1067 AIL_set_sample_file(pMixerChannels[v62].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); |
1104 if (uVolume) | 1068 if (uVolume) |
1105 sample_volume = uVolume; | 1069 sample_volume = uVolume; |
1114 if (!PartyY) | 1078 if (!PartyY) |
1115 PartyY = pParty->vPosition.y; | 1079 PartyY = pParty->vPosition.y; |
1116 AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(PartyX, PartyY)); | 1080 AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(PartyX, PartyY)); |
1117 AIL_set_sample_volume(pMixerChannels[v62].hSample, GetSoundStrengthByDistanceFromParty(PartyX, PartyY, pParty->vPosition.z)); | 1081 AIL_set_sample_volume(pMixerChannels[v62].hSample, GetSoundStrengthByDistanceFromParty(PartyX, PartyY, pParty->vPosition.z)); |
1118 } | 1082 } |
1119 /*else if (object_type == OBJECT_BLVDoor) | |
1120 { | |
1121 assert(uCurrentlyLoadedLevelType == LEVEL_Indoor); | |
1122 assert(object_id < pIndoor->uNumDoors); | |
1123 if ( !pIndoor->pDoors[object_id].uDoorID ) | |
1124 return; | |
1125 | |
1126 if (!GetSoundStrengthByDistanceFromParty(pIndoor->pDoors[object_id].pXOffsets[0], pIndoor->pDoors[object_id].pYOffsets[0], pIndoor->pDoors[object_id].pZOffsets[0])) | |
1127 { | |
1128 AIL_end_sample(pMixerChannels[v62].hSample); | |
1129 FreeChannel(&pMixerChannels[v62]); | |
1130 return; | |
1131 } | |
1132 AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(pIndoor->pDoors[object_id].pXOffsets[0], pIndoor->pDoors[object_id].pYOffsets[0])); | |
1133 } | |
1134 else if (object_type == OBJECT_Item) | |
1135 { | |
1136 assert(object_id < uNumSpriteObjects); | |
1137 if (!GetSoundStrengthByDistanceFromParty(pSpriteObjects[object_id].vPosition.x, pSpriteObjects[object_id].vPosition.y, pSpriteObjects[object_id].vPosition.z) ) | |
1138 return; | |
1139 AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(pSpriteObjects[object_id].vPosition.x, pSpriteObjects[object_id].vPosition.y)); | |
1140 } | |
1141 else if (object_type == OBJECT_Actor) | |
1142 { | |
1143 assert(object_id < uNumActors); | |
1144 if (!GetSoundStrengthByDistanceFromParty(pActors[object_id].vPosition.x, pActors[object_id].vPosition.y, pActors[object_id].vPosition.z)) | |
1145 return; | |
1146 AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(pActors[object_id].vPosition.x, pActors[object_id].vPosition.y)); | |
1147 if (uNumRepeats) | |
1148 AIL_set_sample_loop_count(pMixerChannels[v62].hSample, uNumRepeats - 1); | |
1149 pMixerChannels[v62].uSourceTrackIdx = sound_id; | |
1150 pMixerChannels[v62].source_pid = a3; | |
1151 pMixerChannels[v62].uSourceTrackID = eSoundID; | |
1152 int rval = AIL_start_sample(pMixerChannels[v62].hSample); | |
1153 if ( sPlaybackRate ) | |
1154 AIL_set_sample_playback_rate(pMixerChannels[v62].hSample, sPlaybackRate); | |
1155 if (object_type == OBJECT_Player) | |
1156 AIL_sample_ms_position(pMixerChannels[v62].hSample, &sLastTrackLengthMS, 0); | |
1157 return; | |
1158 } | |
1159 else if (object_type == OBJECT_Decoration) | |
1160 { | |
1161 assert(object_id < uNumLevelDecorations); | |
1162 if (!GetSoundStrengthByDistanceFromParty(pLevelDecorations[object_id].vPosition.x, pLevelDecorations[object_id].vPosition.y, pLevelDecorations[object_id].vPosition.z)) | |
1163 return; | |
1164 AIL_set_sample_pan(pMixerChannels[v62].hSample, sub_4AB66C(pLevelDecorations[object_id].vPosition.x, pLevelDecorations[object_id].vPosition.y)); | |
1165 if (uNumRepeats) | |
1166 AIL_set_sample_loop_count(pMixerChannels[v62].hSample, uNumRepeats - 1); | |
1167 pMixerChannels[v62].uSourceTrackIdx = sound_id; | |
1168 pMixerChannels[v62].source_pid = a3; | |
1169 pMixerChannels[v62].uSourceTrackID = eSoundID; | |
1170 int rval = AIL_start_sample(pMixerChannels[v62].hSample); | |
1171 if ( sPlaybackRate ) | |
1172 AIL_set_sample_playback_rate(pMixerChannels[v62].hSample, sPlaybackRate); | |
1173 if (object_type == OBJECT_Player) | |
1174 AIL_sample_ms_position(pMixerChannels[v62].hSample, &sLastTrackLengthMS, 0); | |
1175 return; | |
1176 } */ | |
1177 | 1083 |
1178 if (uNumRepeats) | 1084 if (uNumRepeats) |
1179 AIL_set_sample_loop_count(pMixerChannels[v62].hSample, uNumRepeats - 1); | 1085 AIL_set_sample_loop_count(pMixerChannels[v62].hSample, uNumRepeats - 1); |
1180 pMixerChannels[v62].uSourceTrackIdx = sound_id; | 1086 pMixerChannels[v62].uSourceTrackIdx = sound_id; |
1181 pMixerChannels[v62].source_pid = a3; | 1087 pMixerChannels[v62].source_pid = a3; |