63 // if keepPlaying is given and true, |
63 // if keepPlaying is given and true, |
64 // then the sound's playback won't be interrupted if asked to play again. |
64 // then the sound's playback won't be interrupted if asked to play again. |
65 procedure PlaySound(snd: TSound); |
65 procedure PlaySound(snd: TSound); |
66 procedure PlaySound(snd: TSound; keepPlaying: boolean); |
66 procedure PlaySound(snd: TSound; keepPlaying: boolean); |
67 procedure PlaySound(snd: TSound; keepPlaying: boolean; ignoreMask: boolean); |
67 procedure PlaySound(snd: TSound; keepPlaying: boolean; ignoreMask: boolean); |
|
68 procedure PlaySound(snd: TSound; keepPlaying, ignoreMask, soundAsMusic: boolean); |
68 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack); |
69 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack); |
69 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean); |
70 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean); |
70 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean; ignoreMask: boolean); |
71 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying, ignoreMask: boolean); |
|
72 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying, ignoreMask, soundAsMusic: boolean); |
|
73 |
|
74 // Plays/stops a sound to replace the main background music temporarily. |
|
75 procedure PlayMusicSound(snd: TSound); |
|
76 procedure StopMusicSound(snd: TSound); |
71 |
77 |
72 // Plays sound snd [of voicepack] in a loop, but starts with fadems milliseconds of fade-in. |
78 // Plays sound snd [of voicepack] in a loop, but starts with fadems milliseconds of fade-in. |
73 // Returns sound channel of the looped sound. |
79 // Returns sound channel of the looped sound. |
74 function LoopSound(snd: TSound): LongInt; |
80 function LoopSound(snd: TSound): LongInt; |
75 function LoopSound(snd: TSound; fadems: LongInt): LongInt; |
81 function LoopSound(snd: TSound; fadems: LongInt): LongInt; |
77 function LoopSoundV(snd: TSound; voicepack: PVoicepack; fadems: LongInt): LongInt; |
83 function LoopSoundV(snd: TSound; voicepack: PVoicepack; fadems: LongInt): LongInt; |
78 |
84 |
79 // Stops the normal/looped sound of the given type/in the given channel |
85 // Stops the normal/looped sound of the given type/in the given channel |
80 // [with a fade-out effect for fadems milliseconds]. |
86 // [with a fade-out effect for fadems milliseconds]. |
81 procedure StopSound(snd: TSound); |
87 procedure StopSound(snd: TSound); |
|
88 procedure StopSound(snd: TSound; soundAsMusic: boolean); |
82 procedure StopSoundChan(chn: LongInt); |
89 procedure StopSoundChan(chn: LongInt); |
83 procedure StopSoundChan(chn, fadems: LongInt); |
90 procedure StopSoundChan(chn, fadems: LongInt); |
84 |
91 |
85 procedure AddVoice(snd: TSound; voicepack: PVoicepack); |
92 procedure AddVoice(snd: TSound; voicepack: PVoicepack); |
86 procedure AddVoice(snd: TSound; voicepack: PVoicepack; ignoreMask: boolean); |
93 procedure AddVoice(snd: TSound; voicepack: PVoicepack; ignoreMask: boolean); |
433 end; |
440 end; |
434 end; |
441 end; |
435 |
442 |
436 procedure PlaySound(snd: TSound); |
443 procedure PlaySound(snd: TSound); |
437 begin |
444 begin |
438 PlaySoundV(snd, nil, false, false); |
445 PlaySoundV(snd, nil, false, false, false); |
439 end; |
446 end; |
440 |
447 |
441 procedure PlaySound(snd: TSound; keepPlaying: boolean); |
448 procedure PlaySound(snd: TSound; keepPlaying: boolean); |
442 begin |
449 begin |
443 PlaySoundV(snd, nil, keepPlaying, false); |
450 PlaySoundV(snd, nil, keepPlaying, false, false); |
444 end; |
451 end; |
445 |
452 |
446 procedure PlaySound(snd: TSound; keepPlaying: boolean; ignoreMask: boolean); |
453 procedure PlaySound(snd: TSound; keepPlaying: boolean; ignoreMask: boolean); |
447 begin |
454 begin |
448 PlaySoundV(snd, nil, keepPlaying, ignoreMask); |
455 PlaySoundV(snd, nil, keepPlaying, ignoreMask, false); |
|
456 end; |
|
457 |
|
458 procedure PlaySound(snd: TSound; keepPlaying: boolean; ignoreMask, soundAsMusic: boolean); |
|
459 begin |
|
460 PlaySoundV(snd, nil, keepPlaying, ignoreMask, soundAsMusic); |
449 end; |
461 end; |
450 |
462 |
451 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack); |
463 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack); |
452 begin |
464 begin |
453 PlaySoundV(snd, voicepack, false, false); |
465 PlaySoundV(snd, voicepack, false, false, false); |
454 end; |
466 end; |
455 |
467 |
456 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean); |
468 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean); |
457 begin |
469 begin |
458 PlaySoundV(snd, voicepack, keepPlaying, false); |
470 PlaySoundV(snd, voicepack, keepPlaying, false, false); |
459 end; |
471 end; |
460 |
472 |
461 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean; ignoreMask: boolean); |
473 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying, ignoreMask: boolean); |
|
474 begin |
|
475 PlaySoundV(snd, voicepack, keepPlaying, ignoreMask, false); |
|
476 end; |
|
477 |
|
478 procedure PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying, ignoreMask, soundAsMusic: boolean); |
462 var s:shortstring; |
479 var s:shortstring; |
463 rwops: PSDL_RWops; |
480 rwops: PSDL_RWops; |
464 begin |
481 begin |
465 if (not isSoundEnabled) or fastUntilLag then |
482 if ((not isSoundEnabled) and (not (soundAsMusic and isMusicEnabled))) or fastUntilLag then |
466 exit; |
483 exit; |
467 |
484 |
468 if keepPlaying and (lastChan[snd] <> -1) and (Mix_Playing(lastChan[snd]) <> 0) then |
485 if keepPlaying and (lastChan[snd] <> -1) and (Mix_Playing(lastChan[snd]) <> 0) then |
469 exit; |
486 exit; |
470 |
487 |
526 end; |
543 end; |
527 lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], 0, -1) |
544 lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], 0, -1) |
528 end; |
545 end; |
529 end; |
546 end; |
530 |
547 |
|
548 procedure PlayMusicSound(snd: TSound); |
|
549 begin |
|
550 PauseMusic; |
|
551 PlaySound(snd, false, false, true); |
|
552 end; |
|
553 |
|
554 procedure StopMusicSound(snd: TSound); |
|
555 begin |
|
556 StopSound(snd, true); |
|
557 ResumeMusic; |
|
558 end; |
|
559 |
531 procedure AddVoice(snd: TSound; voicepack: PVoicepack); |
560 procedure AddVoice(snd: TSound; voicepack: PVoicepack); |
532 begin |
561 begin |
533 AddVoice(snd, voicepack, false); |
562 AddVoice(snd, voicepack, false); |
534 end; |
563 end; |
535 |
564 |