public static StreamingSource Stream(Stream stream) { PeekStream peekStream = new PeekStream(stream, 64); SoundFileFormat format = DetermineFileFormat(peekStream.GetInitialBytesStream()); return(Stream(peekStream, format)); }
public static StreamingSource Stream(string fileName, SoundFileFormat format) { using (Stream stream = Storage.OpenFile(fileName, OpenFileMode.Read)) { return(Stream(stream, format)); } }
public static void Save(SoundData soundData, string fileName, SoundFileFormat format) { using (Stream stream = Storage.OpenFile(fileName, OpenFileMode.Create)) { Save(soundData, stream, format); } }
public static SoundData Load(string fileName, SoundFileFormat format) { using (Stream stream = Storage.OpenFile(fileName, OpenFileMode.Read)) { return(Load(stream, format)); } }
public object Read(ContentStream stream, object existingObject) { if (existingObject == null) { SoundFileFormat format = SoundData.DetermineFileFormat(stream); return(SoundData.Stream(stream.Duplicate(), format)); } throw new NotSupportedException(); }
public static void Save(SoundData soundData, Stream stream, SoundFileFormat format) { if (format == SoundFileFormat.Wav) { Wav.Save(soundData, stream); return; } throw new InvalidOperationException("Unsupported sound file format."); }
public static StreamingSource Stream(Stream stream, SoundFileFormat format) { switch (format) { case SoundFileFormat.Wav: return(Wav.Stream(stream)); case SoundFileFormat.Ogg: return(Ogg.Stream(stream)); default: throw new InvalidOperationException("Unsupported sound file format."); } }
public static SoundBuffer Load(string fileName, SoundFileFormat format) { return(Load(SoundData.Load(fileName, format))); }
public static SoundBuffer Load(Stream stream, SoundFileFormat format) { return(Load(SoundData.Load(stream, format))); }