Video pausing support; sync video to audio nicer.

This commit is contained in:
Paul Chote
2010-08-14 17:21:54 +12:00
parent 5c8c8d5e6e
commit a569c712f0
5 changed files with 89 additions and 46 deletions

View File

@@ -78,13 +78,25 @@ namespace OpenRA
Play(name, pos);
}
public static void PlayVideoSoundtrack(byte[] raw)
public static void PlayVideo(byte[] raw)
{
rawSource = LoadSoundRaw(raw);
video = soundEngine.Play2D(rawSource, false, true, float2.Zero, SoundVolume);
}
public static void StopVideoSoundtrack()
public static void PlayVideo()
{
if (video != null)
soundEngine.PauseSound(video, false);
}
public static void PauseVideo()
{
if (video != null)
soundEngine.PauseSound(video, true);
}
public static void StopVideo()
{
if (video != null)
soundEngine.StopSound(video);
@@ -153,6 +165,11 @@ namespace OpenRA
get { return (music != null)? music.SeekPosition : 0; }
}
public static float VideoSeekPosition
{
get { return (video != null)? video.SeekPosition : 0; }
}
// Returns true if it played a phrase
public static bool PlayVoice(string phrase, Actor voicedUnit)
{
@@ -412,8 +429,8 @@ namespace OpenRA
get
{
float pos;
Al.alGetSourcef(source, Al.AL_SEC_OFFSET, out pos);
return pos;
Al.alGetSourcef(source, Al.AL_SAMPLE_OFFSET, out pos);
return pos/22050f;
}
}
}