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));
|
||||
|
||||
deEmphasisFilterLeft = new DeEmphasisFilter();
|
||||
deEmphasisFilterRight = new DeEmphasisFilter();
|
||||
source = new PlayerSource(ProviderRead);
|
||||
if (deEmphasisFilterLeft == null)
|
||||
{
|
||||
deEmphasisFilterLeft = new DeEmphasisFilter();
|
||||
deEmphasisFilterRight = new DeEmphasisFilter();
|
||||
}
|
||||
else
|
||||
{
|
||||
deEmphasisFilterLeft.Reset();
|
||||
deEmphasisFilterRight.Reset();
|
||||
}
|
||||
|
||||
if (source == null)
|
||||
{
|
||||
source = new PlayerSource(ProviderRead);
|
||||
|
||||
soundOut = new ALSoundOut(100);
|
||||
soundOut.Initialize(source);
|
||||
}
|
||||
else
|
||||
{
|
||||
soundOut.Stop();
|
||||
}
|
||||
|
||||
soundOut = new ALSoundOut(50);
|
||||
soundOut.Initialize(source);
|
||||
if (autoPlay)
|
||||
{
|
||||
soundOut.Play();
|
||||
|
||||
@@ -51,8 +51,6 @@ namespace RedBookPlayer
|
||||
filter.Open(path);
|
||||
image.Open(filter);
|
||||
|
||||
Player?.Stop();
|
||||
Player = new Player();
|
||||
Player.Init(image, App.Settings.AutoPlay);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user