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


C# Channel.Validate方法代码示例

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


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

示例1: EncodeNoteOn

 /// <summary>
 /// Encodes a Note On short message.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="note">The note.</param>
 /// <param name="velocity">The velocity 0..127.</param>
 /// <returns>A value that can be passed to midiOutShortMsg.</returns>
 public static UInt32 EncodeNoteOn(Channel channel, Note note, int velocity)
 {
     channel.Validate();
     note.Validate();
     if (velocity < 0 || velocity > 127)
     {
         throw new ArgumentOutOfRangeException("Velocity is out of range.");
     }
     return (UInt32)(0x90 | ((int)channel) | ((int)note << 8) | (velocity << 16));
 }
开发者ID:Robertorob,项目名称:GuitarMaster,代码行数:17,代码来源:ShortMsg.cs

示例2: EncodeNoteOn

 /// <summary>
 /// Encodes a Note On short message.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="pitch">The pitch.</param>
 /// <param name="velocity">The velocity 0..127.</param>
 /// <returns>A value that can be passed to midiOutShortMsg.</returns>
 /// <exception cref="ArgumentOutOfRangeException">pitch is not in MIDI range.</exception>
 public static UInt32 EncodeNoteOn(Channel channel, Pitch pitch, int velocity)
 {
     channel.Validate();
     if (!pitch.IsInMidiRange())
     {
         throw new ArgumentOutOfRangeException("Pitch out of MIDI range.");
     }
     if (velocity < 0 || velocity > 127)
     {
         throw new ArgumentOutOfRangeException("Velocity is out of range.");
     }
     return (UInt32)(0x90 | ((int)channel) | ((int)pitch << 8) | (velocity << 16));
 }
开发者ID:bejotka77,项目名称:midi-dot-net,代码行数:21,代码来源:ShortMsg.cs

示例3: EncodeProgramChange

 /// <summary>
 /// Encodes a Program Change short message.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="instrument">The instrument.</param>
 /// <returns>A value that can be passed to midiOutShortMsg.</returns>
 public static UInt32 EncodeProgramChange(Channel channel, Instrument instrument)
 {
     channel.Validate();
     instrument.Validate();
     return (UInt32)(0xC0 | (int)(channel) | ((int)instrument << 8));
 }
开发者ID:krowe,项目名称:MidiPi,代码行数:12,代码来源:ShortMsg.cs

示例4: EncodePitchBend

 /// <summary>
 /// Encodes a Pitch Bend short message.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="value">The pitch bend value, 0..16383, 8192 is centered.</param>
 /// <returns>A value that can be passed to midiOutShortMsg.</returns>
 public static UInt32 EncodePitchBend(Channel channel, int value)
 {
     channel.Validate();
     if (value < 0 || value > 16383)
     {
         throw new ArgumentOutOfRangeException("Value is out of range.");
     }
     return (UInt32)(0xE0 | (int)(channel) | ((value & 0x7f) << 8) |
         ((value & 0x3f80) << 9));
 }
开发者ID:krowe,项目名称:MidiPi,代码行数:16,代码来源:ShortMsg.cs

示例5: EncodeControlChange

 /// <summary>
 /// Encodes a Control Change short message.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="control">The control.</param>
 /// <param name="value">The new value 0..127.</param>
 /// <returns>A value that can be passed to midiOutShortMsg.</returns>
 public static UInt32 EncodeControlChange(Channel channel, Control control, int value)
 {
     channel.Validate();
     control.Validate();
     if (value < 0 || value > 127)
     {
         throw new ArgumentOutOfRangeException("Value is out of range.");
     }
     return (UInt32)(0xB0 | (int)(channel) | ((int)control << 8) | (value << 16));
 }
开发者ID:krowe,项目名称:MidiPi,代码行数:17,代码来源:ShortMsg.cs

示例6: ChannelMessage

 /// <summary>
 /// Protected constructor.
 /// </summary>
 protected ChannelMessage(DeviceBase device, Channel channel, float time)
     : base(device, time)
 {
     channel.Validate();
     this.channel = channel;
 }
开发者ID:yugsh,项目名称:PianoGame,代码行数:9,代码来源:Messages.cs


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