示例#1
0
        public static StreamingSource Stream(Stream stream)
        {
            PeekStream      peekStream = new PeekStream(stream, 64);
            SoundFileFormat format     = DetermineFileFormat(peekStream.GetInitialBytesStream());

            return(Stream(peekStream, format));
        }
示例#2
0
 public static StreamingSource Stream(string fileName, SoundFileFormat format)
 {
     using (Stream stream = Storage.OpenFile(fileName, OpenFileMode.Read))
     {
         return(Stream(stream, format));
     }
 }
示例#3
0
 public static void Save(SoundData soundData, string fileName, SoundFileFormat format)
 {
     using (Stream stream = Storage.OpenFile(fileName, OpenFileMode.Create))
     {
         Save(soundData, stream, format);
     }
 }
示例#4
0
 public static SoundData Load(string fileName, SoundFileFormat format)
 {
     using (Stream stream = Storage.OpenFile(fileName, OpenFileMode.Read))
     {
         return(Load(stream, format));
     }
 }
示例#5
0
 public object Read(ContentStream stream, object existingObject)
 {
     if (existingObject == null)
     {
         SoundFileFormat format = SoundData.DetermineFileFormat(stream);
         return(SoundData.Stream(stream.Duplicate(), format));
     }
     throw new NotSupportedException();
 }
示例#6
0
 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.");
 }
示例#7
0
        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.");
            }
        }
示例#8
0
 public static SoundBuffer Load(string fileName, SoundFileFormat format)
 {
     return(Load(SoundData.Load(fileName, format)));
 }
示例#9
0
 public static SoundBuffer Load(Stream stream, SoundFileFormat format)
 {
     return(Load(SoundData.Load(stream, format)));
 }