public override SoundInput TryOpen(IBinaryStream file) { var header = file.ReadHeader(0x16); if (!header.AsciiEqual(8, "WAVE")) { return(null); } ushort tag = header.ToUInt16(0x14); if (0xFFFF == tag || 0x676F == tag || 0x6770 == tag || 0x674F == tag) { return(null); } file.Position = 0; SoundInput sound = new WaveInput(file.AsStream); if (EmbeddedFormats.Contains(sound.Format.FormatTag)) { var bin = new BinaryStream(sound, file.Name); try { var embedded = AudioFormat.Read(bin); if (null != embedded) { sound = embedded; } } catch { sound.Position = 0; } } return(sound); }
public override SoundInput TryOpen(Stream file) { SoundInput sound = new WaveInput (file); if (EmbeddedFormats.Contains (sound.Format.FormatTag)) { try { var embedded = AudioFormat.Read (sound); if (null != embedded) { sound.Dispose(); sound = embedded; } } catch { sound.Position = 0; } } return sound; }
public override SoundInput TryOpen(Stream file) { SoundInput sound = new WaveInput(file); if (EmbeddedFormats.Contains(sound.Format.FormatTag)) { try { var embedded = AudioFormat.Read(sound); if (null != embedded) { sound.Dispose(); sound = embedded; } } catch { sound.Position = 0; } } return(sound); }