From 2e3ce571859d2d62101ed15ed8ebc654142ab74b Mon Sep 17 00:00:00 2001 From: alcexhim Date: Mon, 2 Jun 2014 15:41:06 -0400 Subject: [PATCH] Maintain static DataFormatReference and initialize brand new one to avoid clashing with base RIFF DataFormat --- .../MicrosoftWave/MicrosoftWaveDataFormat.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Multimedia/DataFormats/Multimedia/Audio/Waveform/MicrosoftWave/MicrosoftWaveDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.Multimedia/DataFormats/Multimedia/Audio/Waveform/MicrosoftWave/MicrosoftWaveDataFormat.cs index a49635ac..abe69caf 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.Multimedia/DataFormats/Multimedia/Audio/Waveform/MicrosoftWave/MicrosoftWaveDataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.Multimedia/DataFormats/Multimedia/Audio/Waveform/MicrosoftWave/MicrosoftWaveDataFormat.cs @@ -13,14 +13,17 @@ namespace UniversalEditor.DataFormats.Multimedia.Audio.Waveform.MicrosoftWave { public class MicrosoftWaveDataFormat : RIFFDataFormat { + private static DataFormatReference _dfr = null; public override DataFormatReference MakeReference() { - DataFormatReference dfr = base.MakeReference(); - dfr.Title = "Microsoft waveform audio"; - dfr.Filters.Add("Microsoft waveform audio", new byte?[][] { new byte?[] { (byte)'R', (byte)'I', (byte)'F', (byte)'F', null, null, null, null, (byte)'W', (byte)'A', (byte)'V', (byte)'E', (byte)'f', (byte)'m', (byte)'t', (byte)' ' } }, new string[] { "*.wav", "*.wave" }); - dfr.Filters.Add("Sony ATRAC3+ encoded waveform audio", new string[] { "*.at3" }); - dfr.Capabilities.Add(typeof(WaveformAudioObjectModel), DataFormatCapabilities.All); - return dfr; + if (_dfr == null) + { + _dfr = new DataFormatReference(GetType()); + _dfr.Filters.Add("Microsoft waveform audio", new byte?[][] { new byte?[] { (byte)'R', (byte)'I', (byte)'F', (byte)'F', null, null, null, null, (byte)'W', (byte)'A', (byte)'V', (byte)'E', (byte)'f', (byte)'m', (byte)'t', (byte)' ' } }, new string[] { "*.wav", "*.wave" }); + _dfr.Filters.Add("Sony ATRAC3+ encoded waveform audio", new string[] { "*.at3" }); + _dfr.Capabilities.Add(typeof(WaveformAudioObjectModel), DataFormatCapabilities.All); + } + return _dfr; } // TODO: Test IsObjectModelSupported!!!