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();
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();
public void ComposeControlChangeTest() { IMidiOutputDevice device = MidiDeviceLocator.SelectForOutput(0); Assume.That(device != null); Assert.IsNotNull(device.ComposeControlChange()); }
public void SetDefaultChannel_InvalidTest(byte channel) { IMidiOutputDevice device = MidiDeviceLocator.SelectForOutput(0); Assume.That(device != null); Assert.Throws <ArgumentException>(() => device.SetDefaultChannel(channel)); }
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)); } }
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); } }
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)); }
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"); } }
private async void AmpControl_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { var devices = await MidiDeviceLocator.GetAllOutputDevicesAsync(); this.ViewModel.SetDevices(devices); }