From 4ba79980c9232474c6fa4580d6495d3506546728 Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Wed, 24 Jul 2019 17:42:59 -0400 Subject: [PATCH] Automatically clear the playlist for the audio player to prevent dupes --- .../Forms/Editors/Audio/AudioPlayerPanel.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Switch_Toolbox_Library/Forms/Editors/Audio/AudioPlayerPanel.cs b/Switch_Toolbox_Library/Forms/Editors/Audio/AudioPlayerPanel.cs index 110bb794..0e2fe118 100644 --- a/Switch_Toolbox_Library/Forms/Editors/Audio/AudioPlayerPanel.cs +++ b/Switch_Toolbox_Library/Forms/Editors/Audio/AudioPlayerPanel.cs @@ -66,10 +66,13 @@ namespace Toolbox.Library.Forms } - public void LoadFile(IWaveSource source, IFileFormat fileFormat, bool ClearPlaylist = false, object AudioStruct = null) + public void LoadFile(IWaveSource source, IFileFormat fileFormat, bool ClearPlaylist = true, object AudioStruct = null) { if (ClearPlaylist) + { audioListView.Items.Clear(); + AudioFileFormats.Clear(); + } AudioFile file = new AudioFile(); file.Title = fileFormat.FileName; @@ -83,8 +86,6 @@ namespace Toolbox.Library.Forms } AudioFileFormats.Add(fileFormat); - - audioListView.AddObject(file); AudioChannel audioChannel = new AudioChannel(); @@ -105,10 +106,13 @@ namespace Toolbox.Library.Forms } - public void LoadFile(AudioData audioData, IFileFormat fileFormat, bool ClearPlaylist = false) + public void LoadFile(AudioData audioData, IFileFormat fileFormat, bool ClearPlaylist = true) { if (ClearPlaylist) + { audioListView.Items.Clear(); + AudioFileFormats.Clear(); + } AudioFileFormats.Add(fileFormat);