當前位置: 首頁>>代碼示例>>C#>>正文


C# WaveFormat.Serialize方法代碼示例

本文整理匯總了C#中NAudio.Wave.WaveFormat.Serialize方法的典型用法代碼示例。如果您正苦於以下問題:C# WaveFormat.Serialize方法的具體用法?C# WaveFormat.Serialize怎麽用?C# WaveFormat.Serialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NAudio.Wave.WaveFormat的用法示例。


在下文中一共展示了WaveFormat.Serialize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: WaveFileWriter

        /// <summary>
        /// WaveFileWriter that actually writes to a stream
        /// </summary>
        /// <param name="outStream">Stream to be written to</param>
        /// <param name="format">Wave format to use</param>
        public WaveFileWriter(Stream outStream, WaveFormat format)
        {
            this.outStream = outStream;
            this.format = format;
            this.writer = new BinaryWriter(outStream, System.Text.Encoding.UTF8);
            this.writer.Write(System.Text.Encoding.UTF8.GetBytes("RIFF"));
            this.writer.Write((int)0); // placeholder
            this.writer.Write(System.Text.Encoding.UTF8.GetBytes("WAVE"));

            this.writer.Write(System.Text.Encoding.UTF8.GetBytes("fmt "));
            format.Serialize(this.writer);

            CreateFactChunk();
            WriteDataChunkHeader();
        }
開發者ID:BGCX261,項目名稱:ziggy-pro-editor-svn-to-git,代碼行數:20,代碼來源:WaveFileWriter.cs

示例2: WaveFileWriter

        /// <summary>
        /// WaveFileWriter that actually writes to a stream
        /// </summary>
        /// <param name="outStream">Stream to be written to</param>
        /// <param name="format">Wave format to use</param>
        public WaveFileWriter(Stream outStream, WaveFormat format)
        {
            this.outStream = outStream;
            BinaryWriter w = new BinaryWriter(outStream, System.Text.Encoding.ASCII);
            w.Write(System.Text.Encoding.ASCII.GetBytes("RIFF"));
            w.Write((int)0); // placeholder
            w.Write(System.Text.Encoding.ASCII.GetBytes("WAVEfmt "));
            this.format = format;

            format.Serialize(w);

            CreateFactChunk(outStream, format, w);

            WriteDataChunkHeader(outStream, w);
        }
開發者ID:alexsigaras,項目名稱:auxy-robot,代碼行數:20,代碼來源:WaveFileWriter.cs

示例3: AudioFormat

        /// <summary>
        /// Creates a new instance of the AudioFormat class
        /// </summary>
        /// <param name="waveFormat">The WaveFormat representing the WAV header.</param>
        internal AudioFormat(WaveFormat waveFormat)
        {
            averageBytesPerSecond = waveFormat.AverageBytesPerSecond;
            bitsPerSample = waveFormat.BitsPerSample;
            blockAlign = waveFormat.BlockAlign;
            channelCount = waveFormat.Channels;
            format = (int)waveFormat.Encoding;
            sampleRate = waveFormat.SampleRate;

            var stream = new MemoryStream();
            using (var writer = new BinaryWriter(stream))
            {
                waveFormat.Serialize(writer);
                nativeWaveFormat = new List<byte>(stream.ToArray());
            }
        }
開發者ID:DrPandemic,項目名稱:EraParadox,代碼行數:20,代碼來源:AudioFormat.cs


注:本文中的NAudio.Wave.WaveFormat.Serialize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。