コード例 #1
0
        public ISoundData Decode(Stream stream)
        {
            try
            {
                FlacFile file   = new FlacFile(stream);
                byte[]   buffer = new byte[stream.Length];
                file.Read(buffer, 0, buffer.Length);

                return(new SoundData(file.WaveFormat.Channels, file.WaveFormat.BitsPerSample, file.WaveFormat.SampleRate,
                                     buffer, buffer.Length));
            }
            catch (FlacException e)
            {
                Debug.WriteLine("Failed to parse flac file: " + e);
                return(null);
            }
        }