Mercurial > mm7
comparison AudioPlayer.cpp @ 328:8e23edf57e27
little fix
author | Ritor1 |
---|---|
date | Wed, 20 Feb 2013 17:37:33 +0600 |
parents | ce39b96acf5c |
children | 50875632e776 5fd328336048 |
comparison
equal
deleted
inserted
replaced
327:a7f15da53e82 | 328:8e23edf57e27 |
---|---|
43 unsigned __int8 uMusicVolimeMultiplier = 4; | 43 unsigned __int8 uMusicVolimeMultiplier = 4; |
44 int bWalkSound; // idb | 44 int bWalkSound; // idb |
45 | 45 |
46 float pSoundVolumeLevels[10] = | 46 float pSoundVolumeLevels[10] = |
47 { | 47 { |
48 0.0, | 48 0.0000000f, 0.1099999f, 0.2199999f, 0.3300000f, 0.4399999f, |
49 0.10999999940395, | 49 0.5500000f, 0.6600000f, 0.7699999f, 0.8799999f, 0.9900000f |
50 0.21999999880791, | 50 }; |
51 0.33000001311302, | |
52 0.43999999761581, | |
53 0.55000001192093, | |
54 0.66000002622604, | |
55 0.76999998092651, | |
56 0.87999999523163, | |
57 0.99000000953674 | |
58 }; // idb | |
59 | 51 |
60 | 52 |
61 | 53 |
62 | 54 |
63 void ReleaseSoundData(void *_this); | 55 void ReleaseSoundData(void *_this); |
539 void AudioPlayer::PlayMusicTrack(MusicID eTrack) | 531 void AudioPlayer::PlayMusicTrack(MusicID eTrack) |
540 { | 532 { |
541 if (!bNoSound && bPlayerReady && hAILRedbook && uMusicVolimeMultiplier) | 533 if (!bNoSound && bPlayerReady && hAILRedbook && uMusicVolimeMultiplier) |
542 { | 534 { |
543 AIL_redbook_stop(hAILRedbook); | 535 AIL_redbook_stop(hAILRedbook); |
544 AIL_redbook_set_volume(hAILRedbook, (signed)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0)); | 536 AIL_redbook_set_volume(hAILRedbook, (signed)pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); |
545 AIL_redbook_track_info(hAILRedbook, eTrack, &uCurrentMusicTrackStartMS, &uCurrentMusicTrackEndMS); | 537 AIL_redbook_track_info(hAILRedbook, eTrack, &uCurrentMusicTrackStartMS, &uCurrentMusicTrackEndMS); |
546 AIL_redbook_play(hAILRedbook, uCurrentMusicTrackStartMS + 1, uCurrentMusicTrackEndMS); | 538 AIL_redbook_play(hAILRedbook, uCurrentMusicTrackStartMS + 1, uCurrentMusicTrackEndMS); |
547 uCurrentMusicTrackLength = ((uCurrentMusicTrackEndMS - uCurrentMusicTrackStartMS) * 128) / 1000; | 539 uCurrentMusicTrackLength = ((uCurrentMusicTrackEndMS - uCurrentMusicTrackStartMS) * 128) / 1000; |
548 } | 540 } |
549 } | 541 } |
558 AIL_redbook_set_volume(hAILRedbook, vol); | 550 AIL_redbook_set_volume(hAILRedbook, vol); |
559 } | 551 } |
560 } | 552 } |
561 | 553 |
562 //----- (004AA214) -------------------------------------------------------- | 554 //----- (004AA214) -------------------------------------------------------- |
563 void AudioPlayer::SetMasterVolume(unsigned int uVolume) | 555 void AudioPlayer::SetMasterVolume(float fVolume) |
564 { | 556 { |
565 AudioPlayer *v2; // esi@1 | 557 if ( bPlayerReady ) |
566 _DIG_DRIVER *hDrv; // eax@2 | 558 { |
567 | 559 uMasterVolume = fVolume; |
568 v2 = this; | 560 if ( hDigDriver ) |
569 if ( this->bPlayerReady ) | 561 AIL_set_digital_master_volume(hDigDriver, fVolume); |
570 { | 562 if ( b3DSoundInitialized ) |
571 hDrv = this->hDigDriver; | 563 s3DSoundVolume = fVolume * 0.5f; |
572 this->uMasterVolume = uVolume; | |
573 if ( hDrv ) | |
574 AIL_set_digital_master_volume(hDrv, uVolume); | |
575 if ( v2->b3DSoundInitialized ) | |
576 v2->s3DSoundVolume = (signed __int64)((double)(signed int)uVolume * 0.5); | |
577 } | 564 } |
578 } | 565 } |
579 // 4D8304: using guessed type int __stdcall AIL_set_digital_master_volume(int, int); | 566 // 4D8304: using guessed type int __stdcall AIL_set_digital_master_volume(int, int); |
580 | 567 |
581 //----- (004AA258) -------------------------------------------------------- | 568 //----- (004AA258) -------------------------------------------------------- |
1970 { | 1957 { |
1971 AIL_redbook_stop(hAILRedbook); | 1958 AIL_redbook_stop(hAILRedbook); |
1972 uNumRedbookTracks = AIL_redbook_tracks(hAILRedbook); | 1959 uNumRedbookTracks = AIL_redbook_tracks(hAILRedbook); |
1973 } | 1960 } |
1974 pAudioPlayer->sRedbookVolume = AIL_redbook_volume(hAILRedbook); | 1961 pAudioPlayer->sRedbookVolume = AIL_redbook_volume(hAILRedbook); |
1975 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0); | 1962 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); |
1976 if ( bPlayerReady && hAILRedbook ) | 1963 if ( bPlayerReady && hAILRedbook ) |
1977 AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0) >> 32); | 1964 AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f) >> 32); |
1978 LoadAudioSnd(); | 1965 LoadAudioSnd(); |
1979 } | 1966 } |
1980 | 1967 |
1981 //----- (004ABAF7) -------------------------------------------------------- | 1968 //----- (004ABAF7) -------------------------------------------------------- |
1982 _DIG_DRIVER *Audio_GetFirstHardwareDigitalDriver(void) | 1969 _DIG_DRIVER *Audio_GetFirstHardwareDigitalDriver(void) |