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