buffer up all the audio upfront

This commit is contained in:
Chris Forbes
2010-08-11 22:56:32 +12:00
parent 8dd9848636
commit ca6debde66
4 changed files with 69 additions and 38 deletions

View File

@@ -6,14 +6,12 @@
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System;
using System.Drawing;
using System.Linq;
#endregion
using System;
using System.Drawing;
using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Traits;
using OpenRA.Widgets;
using OpenRA.FileFormats;
namespace OpenRA.Widgets
{
@@ -37,19 +35,22 @@ namespace OpenRA.Widgets
int lastTime;
bool advanceNext = false;
public override void DrawInner(World world)
{
if (video == null)
LoadVideo(Video);
{
if (video == null)
{
LoadVideo(Video);
Sound.PlayRaw(video.AudioData);
}
int t = Environment.TickCount;
int dt = t - lastTime;
if (advanceNext)
{
{
if (video.CurrentFrame == 0)
Sound.PlayRaw(video.AudioData);
advanceNext = false;
video.AdvanceFrame();
Sound.PlayRaw(video.AudioData);
video.AdvanceFrame();
}
if (dt > timestep)