mirror of
https://github.com/aaru-dps/RedBookPlayer.git
synced 2025-12-16 19:24:41 +00:00
Reuse Player object to avoid ALException crash
This commit is contained in:
@@ -163,12 +163,29 @@ namespace RedBookPlayer
|
|||||||
|
|
||||||
Console.WriteLine(FullTOC.Prettify(toc));
|
Console.WriteLine(FullTOC.Prettify(toc));
|
||||||
|
|
||||||
|
if (deEmphasisFilterLeft == null)
|
||||||
|
{
|
||||||
deEmphasisFilterLeft = new DeEmphasisFilter();
|
deEmphasisFilterLeft = new DeEmphasisFilter();
|
||||||
deEmphasisFilterRight = new DeEmphasisFilter();
|
deEmphasisFilterRight = new DeEmphasisFilter();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
deEmphasisFilterLeft.Reset();
|
||||||
|
deEmphasisFilterRight.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source == null)
|
||||||
|
{
|
||||||
source = new PlayerSource(ProviderRead);
|
source = new PlayerSource(ProviderRead);
|
||||||
|
|
||||||
soundOut = new ALSoundOut(50);
|
soundOut = new ALSoundOut(100);
|
||||||
soundOut.Initialize(source);
|
soundOut.Initialize(source);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
soundOut.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
if (autoPlay)
|
if (autoPlay)
|
||||||
{
|
{
|
||||||
soundOut.Play();
|
soundOut.Play();
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ namespace RedBookPlayer
|
|||||||
filter.Open(path);
|
filter.Open(path);
|
||||||
image.Open(filter);
|
image.Open(filter);
|
||||||
|
|
||||||
Player?.Stop();
|
|
||||||
Player = new Player();
|
|
||||||
Player.Init(image, App.Settings.AutoPlay);
|
Player.Init(image, App.Settings.AutoPlay);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user