- FMV sound fadeout when button pressed

This commit is contained in:
Ilya Shurumov 2020-09-21 02:07:03 +06:00
parent c785dc7f33
commit c64f283d1b

View File

@ -240,6 +240,8 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles)
int frame_size;
int queue_counter = 0;
int fade_out = 0;
while (true)
{
if (SDL_GetTicks() <= nextTime) // wait for frame
@ -255,6 +257,15 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles)
if (frame_size < 0)
break;
if (fade_out > 0)
{
fade_out -= 18;
if (fade_out < 0)
break;
alSourcef(audioStreamSource, AL_GAIN, float(fade_out) / 255.0);
}
if (frame_size > 0)
{
if (frame_entry.type == ReadAVI::ctype_compressed_video_frame)
@ -311,8 +322,8 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles)
ReadControllers();
if (Pads[0].mapnew > 0)
break;
if (fade_out == 0 && Pads[0].mapnew > 0)
fade_out = 255;
}
alDeleteSources(1, &audioStreamSource);