Release audio resource for video when StopVideo is called.
This commit is contained in:
@@ -40,7 +40,7 @@ namespace OpenRA
|
||||
ISoundLoader[] loaders;
|
||||
IReadOnlyFileSystem fileSystem;
|
||||
Cache<string, ISoundSource> sounds;
|
||||
ISoundSource rawSource;
|
||||
ISoundSource videoSource;
|
||||
ISound music;
|
||||
ISound video;
|
||||
MusicInfo currentMusic;
|
||||
@@ -149,8 +149,9 @@ namespace OpenRA
|
||||
|
||||
public void PlayVideo(byte[] raw, int channels, int sampleBits, int sampleRate)
|
||||
{
|
||||
rawSource = soundEngine.AddSoundSourceFromMemory(raw, channels, sampleBits, sampleRate);
|
||||
video = soundEngine.Play2D(rawSource, false, true, WPos.Zero, InternalSoundVolume, false);
|
||||
StopVideo();
|
||||
videoSource = soundEngine.AddSoundSourceFromMemory(raw, channels, sampleBits, sampleRate);
|
||||
video = soundEngine.Play2D(videoSource, false, true, WPos.Zero, InternalSoundVolume, false);
|
||||
}
|
||||
|
||||
public void PlayVideo()
|
||||
@@ -168,7 +169,12 @@ namespace OpenRA
|
||||
public void StopVideo()
|
||||
{
|
||||
if (video != null)
|
||||
{
|
||||
soundEngine.StopSound(video);
|
||||
videoSource.Dispose();
|
||||
videoSource = null;
|
||||
video = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Tick()
|
||||
|
||||
Reference in New Issue
Block a user