当前位置: 首页>>代码示例>>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;未经允许,请勿转载。