Example #1
0
        public ChannelPressureMessage(Channel channel, int pressure)
        {
            StructHelper.IsWithin7BitRange(nameof(pressure), pressure);

            Channel  = channel;
            Pressure = pressure;
        }
        // TODO Create detail enum of General MIDI instruments, see https://en.wikipedia.org/wiki/General_MIDI

        public ProgramChangeMessage(Channel channel, int program)
        {
            StructHelper.IsWithin7BitRange(nameof(program), program);

            Channel = channel;
            Program = program;
        }
        public PitchBendMessage(Channel channel, int value)
        {
            StructHelper.IsWithin14BitRange(nameof(value), value);

            Channel = channel;
            Value   = value;
        }
Example #4
0
        public NoteOnMessage(Channel channel, Key key, int velocity)
        {
            StructHelper.IsWithin7BitRange(nameof(velocity), velocity);

            Channel  = channel;
            Key      = key;
            Velocity = velocity;
        }
Example #5
0
 internal byte[] Encode()
 {
     return(new[]
     {
         Midi.Status.MidiTimeCodeQuarterFrame,
         StructHelper.DataByte((MessageType << 3) | Values)
     });
 }
Example #6
0
        public MidiTimeCodeQuarterFrameMessage(int messageType, int values)
        {
            StructHelper.IsWithin3BitRange(nameof(messageType), messageType);
            StructHelper.IsWithin3BitRange(nameof(values), values);

            MessageType = messageType;
            Values      = values;
        }
        public PolyphonicKeyPressureMessage(Channel channel, Key key, int pressure)
        {
            StructHelper.IsWithin7BitRange(nameof(pressure), pressure);

            Channel  = channel;
            Key      = key;
            Pressure = pressure;
        }
Example #8
0
 internal byte[] Encode()
 {
     return(new[]
     {
         Midi.Status.SongSelect,
         StructHelper.DataByte(Song)
     });
 }
 internal byte[] Encode()
 {
     return(new[]
     {
         StructHelper.StatusByte(Midi.Status.ProgramChangeBitmask, Channel),
         StructHelper.DataByte(Program)
     });
 }
Example #10
0
 internal byte[] Encode()
 {
     return(new[]
     {
         StructHelper.StatusByte(Midi.Status.ChannelPressureBitmask, Channel),
         StructHelper.DataByte(Pressure)
     });
 }
Example #11
0
 internal byte[] Encode()
 {
     return(new[]
     {
         StructHelper.StatusByte(Midi.Status.PitchBendChange, Channel),
         StructHelper.DataByte(Value),
         StructHelper.DataByte(Value >> 7)
     });
 }
 internal byte[] Encode()
 {
     return(new[]
     {
         Midi.Status.SongPositionPointer,
         StructHelper.DataByte(MidiBeats),
         StructHelper.DataByte(MidiBeats >> 7)
     });
 }
Example #13
0
 internal byte[] Encode()
 {
     return(new[]
     {
         StructHelper.StatusByte(Midi.Status.NoteOnBitmask, Channel),
         StructHelper.DataByte(Key),
         StructHelper.DataByte(Velocity)
     });
 }
 internal byte[] Encode()
 {
     return(new[]
     {
         StructHelper.StatusByte(Midi.Status.ControlChangeBitmask, Channel),
         StructHelper.DataByte(Control),
         StructHelper.DataByte(Value)
     });
 }
Example #15
0
        public NrpnMessage(Channel channel, int parameter, int value)
        {
            StructHelper.IsWithin14BitRange(nameof(parameter), parameter);
            StructHelper.IsWithin14BitRange(nameof(value), value);

            Channel   = channel;
            Parameter = parameter;
            Value     = value;
        }
        public ControlChangeMessage(Channel channel, int control, int value)
        {
            StructHelper.IsWithin7BitRange(nameof(control), control);
            StructHelper.IsWithin7BitRange(nameof(value), value);

            Channel         = channel;
            Control         = control;
            ControlFunction = ControlFunction.Undefined.OrValueIfDefined(control);
            Value           = value;
        }
Example #17
0
        public SongSelectMessage(int song)
        {
            StructHelper.IsWithin7BitRange(nameof(song), song);

            Song = song;
        }
        public SongPositionPointerMessage(int midiBeats)
        {
            StructHelper.IsWithin14BitRange(nameof(midiBeats), midiBeats);

            MidiBeats = midiBeats;
        }
 public SysExMessage(byte[] data)
 {
     Data = StructHelper.IsValidSysEx(data);
 }
 internal byte[] Encode()
 {
     return(StructHelper.FormatSysEx(Data));
 }