public DigitalMusicalMode(CsCoreModule cscore) { InitializeComponent(); CsCoreMod = cscore; CsCoreMod._DigitaltreblePrint3DSpectrum.UseAverage = Properties.Settings.Default.TrebleUseAverage; CsCoreMod._DigitaltreblePrint3DSpectrum.IsXLogScale = Properties.Settings.Default.TrebleIsXLogScale; CsCoreMod._DigitaltreblePrint3DSpectrum.MinimumFrequency = Properties.Settings.Default.TrebleMinFreq; CsCoreMod._DigitaltreblePrint3DSpectrum.MaximumFrequency = Properties.Settings.Default.TrebleMaxFreq; switch (Properties.Settings.Default.TrebleScaling) { case 0: CsCoreMod._DigitaltreblePrint3DSpectrum.ScalingStrategy = ScalingStrategy.Decibel; break; case 1: CsCoreMod._DigitaltreblePrint3DSpectrum.ScalingStrategy = ScalingStrategy.Linear; break; case 2: CsCoreMod._DigitaltreblePrint3DSpectrum.ScalingStrategy = ScalingStrategy.Sqrt; break; default: CsCoreMod._DigitaltreblePrint3DSpectrum.ScalingStrategy = ScalingStrategy.Linear; break; } CsCoreMod._DigitalMedioPrint3DSpectrum.UseAverage = Properties.Settings.Default.MediumUseAverage; CsCoreMod._DigitalMedioPrint3DSpectrum.IsXLogScale = Properties.Settings.Default.MediumIsXLogScale; CsCoreMod._DigitalMedioPrint3DSpectrum.MinimumFrequency = Properties.Settings.Default.MediumMinFreq; CsCoreMod._DigitalMedioPrint3DSpectrum.MaximumFrequency = Properties.Settings.Default.MediumMaxFreq; switch (Properties.Settings.Default.MediumScaling) { case 0: CsCoreMod._DigitalMedioPrint3DSpectrum.ScalingStrategy = ScalingStrategy.Decibel; break; case 1: CsCoreMod._DigitalMedioPrint3DSpectrum.ScalingStrategy = ScalingStrategy.Linear; break; case 2: CsCoreMod._DigitalMedioPrint3DSpectrum.ScalingStrategy = ScalingStrategy.Sqrt; break; default: CsCoreMod._DigitalMedioPrint3DSpectrum.ScalingStrategy = ScalingStrategy.Linear; break; } CsCoreMod._DigitalBassPrint3DSpectrum.UseAverage = Properties.Settings.Default.BassUseAverage; CsCoreMod._DigitalBassPrint3DSpectrum.IsXLogScale = Properties.Settings.Default.BassIsXLogScale; CsCoreMod._DigitalBassPrint3DSpectrum.MinimumFrequency = Properties.Settings.Default.BassMinFreq; CsCoreMod._DigitalBassPrint3DSpectrum.MaximumFrequency = Properties.Settings.Default.BassMaxFreq; switch (Properties.Settings.Default.BassScaling) { case 0: CsCoreMod._DigitalBassPrint3DSpectrum.ScalingStrategy = ScalingStrategy.Decibel; break; case 1: CsCoreMod._DigitalBassPrint3DSpectrum.ScalingStrategy = ScalingStrategy.Linear; break; case 2: CsCoreMod._DigitalBassPrint3DSpectrum.ScalingStrategy = ScalingStrategy.Sqrt; break; default: CsCoreMod._DigitalBassPrint3DSpectrum.ScalingStrategy = ScalingStrategy.Linear; break; } }
private void LedController_Load(object sender, EventArgs e) { AnalogCustomButtons[0] = AnalogLastCustom1; AnalogCustomButtons[1] = AnalogLastCustom2; AnalogCustomButtons[2] = AnalogLastCustom3; AnalogCustomButtons[3] = AnalogLastCustom4; AnalogCustomButtons[4] = AnalogLastCustom5; AnalogCustomButtons[5] = AnalogLastCustom6; DigitalCustomButtons[0] = DigitalLastCustom1; DigitalCustomButtons[1] = DigitalLastCustom2; DigitalCustomButtons[2] = DigitalLastCustom3; DigitalCustomButtons[3] = DigitalLastCustom4; DigitalCustomButtons[4] = DigitalLastCustom5; DigitalCustomButtons[5] = DigitalLastCustom6; cscore = new CsCoreModule(); cscore.FromDefaultDevice(); visualization.GenericSoundBarPropertyGrid.SelectedObject = cscore._GenericlineSpectrum; visualization.GenericSoundSpectrumPropertyGrid.SelectedObject = cscore._GenericvoicePrint3DSpectrum; DigitalMusicalModeForm = new DigitalMusicalMode(cscore); MusicalModeForm.CsCoreMod = cscore; //DigitalMusicalModeForm.CsCoreMod = cscore; visualization.VisibleChanged += Visualization_VisibleChanged; AvailableSerialPorts = new List <string>(SerialPort.GetPortNames()); firmata = new FirmataModule(); DigitalCustomPaletteMode.SetFirmata(firmata); DigitalCustomPaletteMode.SetLastActivatePalette(LastActivatedPalette); firmata.SetStatusLabel(ComPortStatusLabel, MessageStatusLabel); foreach (FirmataMode mode in firmata.AnalogModesAvailable) { AnalogComboBox.Items.Add(mode); } foreach (FirmataMode mode in firmata.DigitalModesAvailable) { DigitalComboBox.Items.Add(mode); } AnalogComboBox.SelectedIndex = 0; DigitalComboBox.SelectedIndex = 0; //only load config after instatiate firmata and add modes LoadConfigs(); foreach (String port in AvailableSerialPorts) { ToolStripMenuItem portOption = new ToolStripMenuItem(port); portOption.Click += new System.EventHandler(this.ContextMenuItemPort_Click); arduinoToolStripMenuItem.DropDown.Items.Add(portOption); } if (SelectedComPort != null && AvailableSerialPorts.IndexOf(SelectedComPort) != -1) { firmata.FirmataSetup(SelectedComPort); AnalogComboBox_SelectedIndexChanged(AnalogComboBox, EventArgs.Empty); DigitalComboBox_SelectedIndexChanged(DigitalComboBox, EventArgs.Empty); TempWorker.DoWork += TempWorker_DoWork; bw.DoWork += Bw_DoWork; TempWorker.RunWorkerAsync(); } //this piece of is here to //make the this form hidden to ALT-TAB Form form1 = new Form(); form1.FormBorderStyle = FormBorderStyle.FixedToolWindow; form1.ShowInTaskbar = false; this.Owner = form1; }