private Boolean SetupDevice() { audioDevices = new AudioDevice(); midiDevice = new NanoKontrol2(audioDevices); if (!midiDevice.Found) { midiDevice = new XtouchMini(audioDevices); } if (!midiDevice.Found) { midiDevice = new OP1(audioDevices); } if (!midiDevice.Found) { midiDevice = new EasyControl(audioDevices); } audioDevices.midiDevice = midiDevice; logarithmic = System.Convert.ToBoolean(ConfigSaver.GetAppSettings("logarithmic")); SaveLogarithmic(); return(midiDevice.Found); }
public void LoadAssignments() { bool foundAssignments = false; foreach (var fader in faders) { Console.WriteLine("Getting setting: " + fader.faderNumber.ToString()); var ident = ConfigSaver.GetAppSettings(fader.faderNumber.ToString()); Console.WriteLine("Got setting: " + ident); if (ident != null) { if (ident.Equals("__FOCUS__")) { foundAssignments = true; fader.Assign(new MixerSession("", audioDevices, "Focus", SessionType.Focus)); } else if (ident.Equals("__MASTER__") || (ident.Substring(0, Math.Min(10, ident.Length)).Equals("__MASTER__"))) { foundAssignments = true; MMDevice mmDevice = audioDevices.GetDeviceByIdentifier(ident.IndexOf("|") >= 0 ? ident.Substring(ident.IndexOf("|") + 1) : ""); fader.Assign(new MixerSession(mmDevice.ID, audioDevices, "Master", SessionType.Master)); } else if (ident.Length > 0) { foundAssignments = true; var matchingSession = audioDevices.FindMixerSession(ident); if (matchingSession != null) { fader.Assign(matchingSession); } else { fader.AssignInactive(ident); } } else { fader.Unassign(); } } var savedSubFaderPosition = ConfigSaver.GetAppSettings(fader.faderNumber.ToString() + "m"); fader.faderPositionMultiplier = savedSubFaderPosition != null?float.Parse(savedSubFaderPosition) : 1; } // Load fader 8 as master volume control as default if no faders are set if (!foundAssignments) { if (faders.Count > 0) { faders.Last().Assign(new MixerSession(audioDevices.GetDeviceByIdentifier("").ID, audioDevices, "Master", SessionType.Master)); SaveAssignments(); } } }