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


C# Channels类代码示例

本文整理汇总了C#中Channels的典型用法代码示例。如果您正苦于以下问题:C# Channels类的具体用法?C# Channels怎么用?C# Channels使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Average

        public static float Average(this Color color, Channels channels)
        {
            float average = 0;
            int axisCount = 0;

            if (channels.Contains(Channels.R))
            {
                average += color.r;
                axisCount += 1;
            }

            if (channels.Contains(Channels.G))
            {
                average += color.g;
                axisCount += 1;
            }

            if (channels.Contains(Channels.B))
            {
                average += color.b;
                axisCount += 1;
            }

            if (channels.Contains(Channels.A))
            {
                average += color.a;
                axisCount += 1;
            }

            return average / axisCount;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:31,代码来源:ColorExtensions.cs

示例2: OpusDecoder

 private OpusDecoder(IntPtr decoder, SamplingRate.Template outputSamplingRateHz, Channels.Template outputChannels)
 {
     _decoder = decoder;
     OutputSamplingRate = outputSamplingRateHz;
     OutputChannels = outputChannels;
     MaxDataBytes = 4000;
 }
开发者ID:NecoMeco,项目名称:BookToVoice,代码行数:7,代码来源:OpusDecoder.cs

示例3: Average

        public static float Average(this Color color, Channels channels)
        {
            float sum = 0f;
            int channelCount = 0;

            if ((channels & Channels.R) != 0)
            {
                sum += color.r;
                channelCount++;
            }

            if ((channels & Channels.G) != 0)
            {
                sum += color.g;
                channelCount++;
            }

            if ((channels & Channels.B) != 0)
            {
                sum += color.b;
                channelCount++;
            }

            if ((channels & Channels.A) != 0)
            {
                sum += color.a;
                channelCount++;
            }

            return sum / channelCount;
        }
开发者ID:Magicolo,项目名称:PseudoFramework,代码行数:31,代码来源:ColorExtensions.cs

示例4: Tv

 public Tv(string nameTv, bool stateTv, Channels channelCur, byte volumeCur, byte brightCur)
     : base(nameTv, stateTv)
 {
     channel = channelCur;
     volume = new Param(volumeCur, 1, 5);
     bright = new Param(brightCur, 1, 5);
 }
开发者ID:agorishniy,项目名称:SmartHouseWebForm,代码行数:7,代码来源:Tv.cs

示例5: Grabber

        public Grabber(CheatEngineReader table, MemoryReader reader)
        {
            Config = new Configuration(this);

            //TEMPORARY configuration!
            Config.SamplesBeforeTrigger = 750;
            Config.SamplesAfterTrigger = 750;
            Config.SampleWaitTime = 10000;//ms, 1ms here

            Config.Trigger_Simple_Channel = 0; // gear
            Config.Trigger_Simple_Condition = TriggerCondition.IN_RANGE; // Rising up
            Config.Trigger_Simple_ValueType = MemoryChannelType.INT32;
            Config.Trigger_Simple_Value = new byte[4] { 3, 0, 0, 0 }; // INT32 (5)
            Config.Trigger_Simple_Value2 = new byte[4] { 5, 0, 0, 0 }; // INT32 (5)
            Config.Trigger_Simple = true;

            Channels = new Channels(this,table);
            Waveform = new Waveform(this);
            Trigger = new Triggering(this);

            this.Reader = reader;

            _mGrabberTiming = new MicroStopwatch();

            TritonBase.PreExit += Stop;
        }
开发者ID:nlhans,项目名称:MemoryVision,代码行数:26,代码来源:Grabber.cs

示例6: RegisterChannel

 public static void RegisterChannel(string prefix, Channels.Channel channel)
 {
     lock (m_channels)
     {
         m_channels.Add(prefix, channel);
     }
 }
开发者ID:Emudofus,项目名称:ArkaliaCore,代码行数:7,代码来源:ChannelManager.cs

示例7: can_read_after_select_on_queued_Channels

 public void can_read_after_select_on_queued_Channels()
 {
     var ch1 = new Channel<int>(1);
     var ch2 = new Channel<bool>(1);
     ThreadPool.QueueUserWorkItem(state => {
         ch1.Send(123);
         ch2.Send(true);
         ch2.Close();
         ch1.Send(124);
         ch1.Close();
     });
     using (var select = new Channels(Op.Recv(ch1), Op.Recv(ch2))) {
         var got = select.Select();
         Debug.Print("got.Index = " + got.Index);
         if (got.Index == 0) {
             Assert.AreEqual(123, got.Value, "got.Value");
             Assert.AreEqual(Maybe<bool>.Some(true), ch2.Recv());
         }
         else {
             Assert.AreEqual(1, got.Index, "got.Index");
             Assert.AreEqual(true, got.Value, "got.Value");
             Assert.AreEqual(Maybe<int>.Some(123), ch1.Recv());
         }
         select.ClearAt(1);
         got = select.Select();
         Assert.AreEqual(0, got.Index, "got.Index, value =" + got.Value);
         Assert.AreEqual(124, got.Value, "got.Value");
     }
 }
开发者ID:busterwood,项目名称:NetChan,代码行数:29,代码来源:SelectTests.cs

示例8: GetChannel

        /// <summary>
        /// 
        /// </summary>
        /// <param name="channel"></param>
        /// <returns></returns>
        public int GetChannel(Channels channel)
        {
            //Odd high
            //Even low

            byte[] msb = new byte[]
            {
                (byte)((int)channel << 1)
            };

            byte[] lsb = new byte[]
            {
                (byte)(((int)channel << 1) + 1)
            };

            byte[] msbOut = new byte[1];
            byte[] lsbOut = new byte[1];

            I2CDevice.I2CTransaction[] transaction = new I2CDevice.I2CTransaction[]
            {
                I2CDevice.CreateWriteTransaction(msb),
                I2CDevice.CreateReadTransaction(msbOut),
                I2CDevice.CreateWriteTransaction(lsb),
                I2CDevice.CreateReadTransaction(lsbOut),
            };

            int output = ((((int) msbOut[0]) << 8) | (lsbOut[0]));

            return output;
        }
开发者ID:wramsdell,项目名称:Netduino_Example,代码行数:35,代码来源:FpgaPpmReader.cs

示例9: Initialize

 /// <summary>
 /// Initialize the mixer API.
 /// This must be called before using other functions in this library.
 /// </summary>
 /// <param name="frequency">Output sampling frequency in samples per second (Hz). You might use DEFAULT_FREQUENCY(22050) since that is a good value for most games. </param>
 /// <param name="audioFormat">Output sample format.</param>
 /// <param name="channels">Number of sound channels in output. Set to Channels.STEREO(2) for stereo, Channels.MONO(1) for mono. This has nothing to do with mixing channels. </param>
 /// <param name="sampleSize">Bytes used per output sample.</param>
 public void Initialize(int frequency, ushort audioFormat, Channels channels, int sampleSize)
 {
     int iResult = SDL_mixer.Mix_OpenAudio(frequency, audioFormat, (int)channels, sampleSize);
     if (0 != iResult)
     {
         throw new Exception("Error while trying to initialize SDL_mixer: " + SDL.SDL_GetError());
     }
     _bAudioInitialized = true;
 }
开发者ID:notisrac,项目名称:SimpleSDLWrapperDotNET,代码行数:17,代码来源:SDLMixerWrapper.cs

示例10: Lerp

        public static Color Lerp(this Color color, Color target, float time, Channels channels)
        {
            color.r = channels.Contains(Channels.R) && Mathf.Abs(target.r - color.r) > epsilon ? Mathf.Lerp(color.r, target.r, time) : color.r;
            color.g = channels.Contains(Channels.G) && Mathf.Abs(target.g - color.g) > epsilon ? Mathf.Lerp(color.g, target.g, time) : color.g;
            color.b = channels.Contains(Channels.B) && Mathf.Abs(target.b - color.b) > epsilon ? Mathf.Lerp(color.b, target.b, time) : color.b;
            color.a = channels.Contains(Channels.A) && Mathf.Abs(target.a - color.a) > epsilon ? Mathf.Lerp(color.a, target.a, time) : color.a;

            return color;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:9,代码来源:ColorExtensions.cs

示例11: Div

        public static Color Div(this Color color, Color otherVector, Channels channels)
        {
            color.r = channels.Contains(Channels.R) ? color.r / otherVector.r : color.r;
            color.g = channels.Contains(Channels.G) ? color.g / otherVector.g : color.g;
            color.b = channels.Contains(Channels.B) ? color.b / otherVector.b : color.b;
            color.a = channels.Contains(Channels.A) ? color.a / otherVector.a : color.a;

            return color;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:9,代码来源:ColorExtensions.cs

示例12: Create

 /// <summary>
 /// Creates a new Opus decoder.
 /// </summary>
 /// <param name="outputSamplingRateHz">Sample rate to decode at (Hz). This must be one of 8000, 12000, 16000, 24000, or 48000.</param>
 /// <param name="outputChannels">Number of channels to decode.</param>
 /// <returns>A new <c>OpusDecoder</c>.</returns>
 public static OpusDecoder Create(SamplingRate.Template outputSamplingRateHz, Channels.Template outputChannels)
 {
     IntPtr error;
     IntPtr decoder = Api.opus_decoder_create((int)outputSamplingRateHz, (int)outputChannels, out error);
     if ((ErrorCode)error != ErrorCode.OK)
     {
         throw new Exception("Exception occured while creating decoder");
     }
     return new OpusDecoder(decoder, outputSamplingRateHz, outputChannels);
 }
开发者ID:NecoMeco,项目名称:BookToVoice,代码行数:16,代码来源:OpusDecoder.cs

示例13: TV

 public TV(string name, Channels channel = Channels.Discovery, bool status = false, byte volume = 0, byte contrast = 0, byte abruptness = 0 )
     : base(name, status)
 {
     this.Name = name;
     this.Status = status;
     this.channel = channel;
     this.Volume = volume;
     this.Abruptness = abruptness;
     this.Contrast = contrast;
 }
开发者ID:Galatsan,项目名称:Smart,代码行数:10,代码来源:TV.cs

示例14: TestIntensity

    public void TestIntensity(Channels channel){

		data = new byte[]{0xC3, 0xD0, 0x05, 
			(byte)((channel == Channels.ChannelA)?0x01:0x02), 
			0x0, 0x1, 0x02,
			(byte)((channel == Channels.ChannelA)?0x01:0x02), 
			(channel == Channels.ChannelA)?Settings.Instance.AmplitudeA.CurrentGlobalVal:Settings.Instance.AmplitudeB.CurrentGlobalVal, 
			0x42, 0x03, 0x02, 0xD2};

		TransmitData ();
	}
开发者ID:maneatingsheep,项目名称:Games4Pain,代码行数:11,代码来源:BluetoothProxy.cs

示例15: SetColor

        public static void SetColor(this Renderer renderer, Color color, bool shared = false, Channels channels = Channels.RGBA)
        {
            var spriteRenderer = renderer as SpriteRenderer;

            if (spriteRenderer != null && spriteRenderer.sharedMaterial == null)
                spriteRenderer.color = spriteRenderer.color.SetValues(color, channels);
            else if (shared)
                renderer.sharedMaterial.SetColor(color, channels);
            else
                renderer.material.SetColor(color, channels);
        }
开发者ID:Magicolo,项目名称:PseudoFramework,代码行数:11,代码来源:RendererExtensions.cs


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