当前位置: 首页>>代码示例>>C#>>正文


C# ByteArray.ToMemoryStream方法代码示例

本文整理汇总了C#中ByteArray.ToMemoryStream方法的典型用法代码示例。如果您正苦于以下问题:C# ByteArray.ToMemoryStream方法的具体用法?C# ByteArray.ToMemoryStream怎么用?C# ByteArray.ToMemoryStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ByteArray的用法示例。


在下文中一共展示了ByteArray.ToMemoryStream方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadToMemoryStream

		public static MemoryStream ReadToMemoryStream(this BinaryReader e, int length)
		{
			var o = new ByteArray();

			e.BaseStream.ToByteArray().readBytes(o, 0, (uint)length);

			return o.ToMemoryStream();
		}
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:8,代码来源:ArchiveExtensions.cs

示例2: Invoke

        public void Invoke(Action<string> yield)
        {
            // 203f4a3d71
            // 20713d4a3f
            {
                var m = new ByteArray();

                // !
                m.endian = Endian.LITTLE_ENDIAN;

                m.writeByte(' ');

                //m.endian
                m.writeFloat(0.79);

                var bytes = m.ToMemoryStream().ToBytes();

                var base64 = Convert.ToBase64String(bytes);

                yield(base64);
            }

            // 20713d4a3f
            {
                var m = new MemoryStream();

                m.WriteByte((byte)' ');

                //                Implementation not found for type import :
                //type: System.IO.BinaryWriter
                //method: Void Write(Single)

                var w = new BinaryWriter(m);

                w.Write((float)0.79);

                var bytes = m.ToBytes();

                var base64 = Convert.ToBase64String(bytes);

                yield(base64);
            }
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:43,代码来源:ApplicationSprite.cs

示例3: MP3PitchLoop

        public MP3PitchLoop(Sound SourceAudio, bool autoplay = false)
        {
            MP3PitchLoopCount++;

            this.SourceAudio = SourceAudio;
            this.Rate = 1.0;

            // X:\jsc.svn\examples\actionscript\air\AIRThreadedSoundAsyncLoop\AIRThreadedSoundAsyncLoop\ApplicationSprite.cs
            // X:\jsc.svn\examples\actionscript\air\AIRAudioWorker\AIRAudioWorker\ApplicationSprite.cs
            // on mobile AIR, something behaves differently?
            var SourceAudioBytes = new ByteArray { endian = Endian.LITTLE_ENDIAN };


            var samplesperchannel = (int)SourceAudio.extract(SourceAudioBytes, 0x100000, 0);

            #region Autoconfigure
            {
                var bytes = SourceAudioBytes.ToMemoryStream();
                bytes.Position = 0;

                var r = new BinaryReader(bytes);

                var floats = new double[bytes.Length / 4];

                //Console.WriteLine("floats " + new { floats.Length });


                for (int i = 0; i < floats.Length; i++)
                {
                    floats[i] = r.ReadSingle();
                }

                var paddingmode_yellow = true;
                var paddingsamples_yellow = 0;
                var paddingmode_yellow_agg = 0.0;
                var paddingmode_yellow_grace = 411;

                var paddingmode_red = true;
                var paddingsamples_red = 0;
                var paddingmode_red_agg = 0.0;
                var paddingmode_red_grace = 411;


                #region max
                var min = 0.0;
                var minset = false;

                var max = 0.0;
                var maxset = false;


                for (int ix = 0; ix < floats.Length; ix += 2)
                {
                    //                                    arg[0] is typeof System.Single
                    //script: error JSC1000: No implementation found for this native method, please implement [static System.Console.WriteLine(System.Single)]

                    var l0 = floats[ix];
                    var r0 = floats[ix + 1];

                    if (l0 != 0)
                        if (minset)
                        {
                            min = Math.Min(min, l0);
                        }
                        else
                        {
                            min = l0;
                            minset = true;
                        }

                    if (maxset)
                    {
                        max = Math.Max(max, l0);
                    }
                    else
                    {
                        max = l0;
                        maxset = true;
                    }
                }

                var absmax = max.Max(Math.Abs(min));

                #endregion


                #region paddingmode_yellow
                for (int ix = 0; ix < floats.Length; ix += 2)
                {
                    //                                    arg[0] is typeof System.Single
                    //script: error JSC1000: No implementation found for this native method, please implement [static System.Console.WriteLine(System.Single)]

                    var l0 = floats[ix];
                    var r0 = floats[ix + 1];




                    if (paddingmode_yellow)
                    {
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:MP3PitchLoop.cs

示例4: ApplicationSprite


//.........这里部分代码省略.........


                loopjeep.AtDiagnostics +=
                  text =>
                  {
                      Rate.text = text;

                  };

                loophelicopter1.AtDiagnostics +=
                    text =>
                    {
                        Rate.text = text;

                    };


                PlayDiesel = delegate
                {
                    loopdiesel2.Sound.play();


                };


                #region f
                Func<MP3PitchLoop, AnalyzeThenPlay> f =
                    x =>
                        yield =>
                        {
                            var m = new ByteArray { endian = Endian.LITTLE_ENDIAN };
                            x.SourceAudio.extract(m, MP3PitchLoop.BLOCK_SIZE * 160, 0);

                            var bytes = m.ToMemoryStream().ToArray();
                            var base64 = Convert.ToBase64String(bytes);


                            yield(base64,
                                (paddingleft,
                                    paddingright, stop, yield_position) =>
                                {
                                    x.SourceAudioInitialPosition = Convert.ToDouble(paddingleft);
                                    x.SourceAudioPosition = Convert.ToDouble(paddingleft);

                                    x.SourceAudioPaddingRight = Convert.ToDouble(paddingright);

                                    var s = x.Sound.play();

                                    var diagnostics = new MemoryStream();
                                    var w = new BinaryWriter(diagnostics);

                                    var once = 0;

                                    x.SourceAudioPositionChanged +=
                                        delegate
                                        {
                                            if (s == null)
                                                return;

                                            if (once == 1)
                                            {
                                                once++;

                                                foreach (var item in x.glitch)
                                                {
                                                    w.Write((float)item);
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:67,代码来源:ApplicationSprite.cs


注:本文中的ByteArray.ToMemoryStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。