Esempio n. 1
0
        public void Should_SerializeUInt7()
        {
            UInt7 value = UInt7.MaxValue; // range 0 to 127

            Assert.AreEqual(1, value.GetBit(0));
            Assert.AreEqual(1, value.GetBit(1));
            Assert.AreEqual(1, value.GetBit(2));
            Assert.AreEqual(1, value.GetBit(3));
            Assert.AreEqual(1, value.GetBit(4));
            Assert.AreEqual(1, value.GetBit(5));
            Assert.AreEqual(1, value.GetBit(6));
            Assert.AreEqual(new Bit[] { 1, 1, 1, 1, 1, 1, 1 }, value.GetBits());

            value = (UInt7)2;
            Assert.AreEqual(0, value.GetBit(0));
            Assert.AreEqual(1, value.GetBit(1));
            Assert.AreEqual(0, value.GetBit(2));
            Assert.AreEqual(0, value.GetBit(3));
            Assert.AreEqual(0, value.GetBit(4));
            Assert.AreEqual(0, value.GetBit(5));
            Assert.AreEqual(0, value.GetBit(6));
            Assert.AreEqual(new Bit[] { 0, 1, 0, 0, 0, 0, 0 }, value.GetBits());

            // test overflow
            value = (UInt7)136;
            Assert.AreEqual(8, value);
            Assert.AreEqual(0, value.GetBit(0));
            Assert.AreEqual(0, value.GetBit(1));
            Assert.AreEqual(0, value.GetBit(2));
            Assert.AreEqual(1, value.GetBit(3));
            Assert.AreEqual(0, value.GetBit(4));
            Assert.AreEqual(0, value.GetBit(5));
            Assert.AreEqual(0, value.GetBit(6));
            Assert.AreEqual(new Bit[] { 0, 0, 0, 1, 0, 0, 0 }, value.GetBits());
        }
Esempio n. 2
0
 private static void OnAppExit()
 {
     for (UInt7 i = 0; i < 127; i++)
     {
         Devices.OutputDevice.SendNoteOff(Channel.Channel1, i, 0);
     }
 }
Esempio n. 3
0
 public void SendControlChange(Channel channel, UInt7 note, UInt7 value)
 {
     lock (this)
     {
         this.CheckOpen();
         CheckReturnCode(Win32Api.Api.midiOutShortMsg(this.handle, ShortMessage.EncodeMessage(channel, note, value, ShortMessageType.ControlChange)));
     }
 }
Esempio n. 4
0
 public void SendNoteOff(Channel channel, UInt7 note, UInt7 velocity)
 {
     lock (this)
     {
         this.CheckOpen();
         CheckReturnCode(Win32Api.Api.midiOutShortMsg(this.handle, ShortMessage.EncodeMessage(channel, note, velocity, ShortMessageType.NoteOff)));
     }
 }