Ejemplo n.º 1
0
 public async Task SetToggleAsync(bool toggleValue, byte controlNumber, IAmpProfile profile, IMidiOutputDevice device, byte channel)
 => await MidiDeviceLocator.SelectForOutput(device.DeviceId)
 .ComposeControlChange()
 .WithChannel(channel)
 .WithControlNumber(controlNumber)
 .WithValue(this.GetToggleValue(toggleValue, profile))
 .SendAsync();
Ejemplo n.º 2
0
 public async Task SetValueAsync(byte value, byte controlNumber, IMidiOutputDevice device, byte channel)
 => await MidiDeviceLocator.SelectForOutput(device.DeviceId)
 .ComposeControlChange()
 .WithChannel(channel)
 .WithControlNumber(controlNumber)
 .WithValue(value)
 .SendAsync();
Ejemplo n.º 3
0
        public void ComposeControlChangeTest()
        {
            IMidiOutputDevice device = MidiDeviceLocator.SelectForOutput(0);

            Assume.That(device != null);

            Assert.IsNotNull(device.ComposeControlChange());
        }
Ejemplo n.º 4
0
        public void SetDefaultChannel_InvalidTest(byte channel)
        {
            IMidiOutputDevice device = MidiDeviceLocator.SelectForOutput(0);

            Assume.That(device != null);

            Assert.Throws <ArgumentException>(() => device.SetDefaultChannel(channel));
        }
Ejemplo n.º 5
0
        public void SelectForOutput_InvalidDeviceNumber(int deviceId)
        {
            IEnumerable <IMidiOutputDevice> devices = MidiDeviceLocator.GetAllOutputDevices();

            Assume.That(devices.Any()); // whether or not there are actually any midi output devices is going to be dependant on the machine the test is running on
            Assume.That(devices.Count() < 9999);

            Assert.Throws <ArgumentException>(() => MidiDeviceLocator.SelectForOutput(deviceId));
        }
        private IMidiControlChangeComposer GetComposer()
        {
            IMidiOutputDevice device = MidiDeviceLocator.SelectForOutput(0);

            Assume.That(device != null);

            IMidiControlChangeComposer composer = device.ComposeControlChange();

            Assume.That(composer != null);
            return(composer);
        }
        public async Task GetAllOutputDevicesAsync()
        {
            IEnumerable <IMidiOutputDevice> devices = await MidiDeviceLocator.GetAllOutputDevicesAsync();

            Assert.IsTrue(devices.Any());
            foreach (IMidiOutputDevice device in devices)
            {
                Assert.IsFalse(string.IsNullOrWhiteSpace(device.DeviceId));
                Assert.IsFalse(string.IsNullOrWhiteSpace(device.Name));
            }
        }
Ejemplo n.º 8
0
        public void SetDefaultChannelTest()
        {
            IMidiOutputDevice device = MidiDeviceLocator.SelectForOutput(0);

            Assume.That(device != null);

            for (byte i = 1; i <= 16; i++)
            {
                Assert.AreSame(device, device.SetDefaultChannel(i));
                Assert.AreEqual(i, device.DefaultChannel);
            }
        }
Ejemplo n.º 9
0
        public void SelectForOutputTest()
        {
            IEnumerable <IMidiOutputDevice> devices = MidiDeviceLocator.GetAllOutputDevices();

            Assume.That(devices.Any()); // whether or not there are actually any midi output devices is going to be dependant on the machine the test is running on

            IMidiOutputDevice device = MidiDeviceLocator.SelectForOutput(0);

            Assert.IsNotNull(device);
            Assert.AreEqual(0, device.DeviceId);
            Assert.False(string.IsNullOrWhiteSpace(device.Name));
        }
Ejemplo n.º 10
0
        public void GetAllOutputDevicesTest()
        {
            IEnumerable <IMidiOutputDevice> devices = MidiDeviceLocator.GetAllOutputDevices();

            Assume.That(devices.Any()); // whether or not there are actually any midi output devices is going to be dependant on the machine the test is running on

            HashSet <int> uniqueDeviceIds = new HashSet <int>();

            foreach (IMidiOutputDevice device in devices)
            {
                Assert.IsNotNull(device);
                Assert.True(device.DeviceId > -1);
                Assert.False(string.IsNullOrWhiteSpace(device.Name));

                Assert.True(uniqueDeviceIds.Add(device.DeviceId), "Not all MIDI output devices have a unique device ID");
            }
        }
Ejemplo n.º 11
0
        private async void AmpControl_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            var devices = await MidiDeviceLocator.GetAllOutputDevicesAsync();

            this.ViewModel.SetDevices(devices);
        }