static void sb_sbArriveEvent(SlideBar.SlideBarData sbData) { if (sbData.bPosition < 10) { if (sbData.bAction == 5) { if (isLightBreathOn) { sb.SetSlideBarStatus(1, 1); isLightBreathOn = !isLightBreathOn; } else { sb.SetSlideBarStatus(1, 0); isLightBreathOn = !isLightBreathOn; } } return; } if (device != null) { float inVolume = 0; if (sbData.bPosition < 30) { inVolume = 0; } else { inVolume = (float)(sbData.bPosition - 30) / 225; } device.AudioEndpointVolume.MasterVolumeLevelScalar = inVolume; } }
void cb_CheckedChanged(object sender, EventArgs e) { CheckBox cb = sender as CheckBox; if (cb == null) { return; } foreach (SlideBar.Event sbEvt in Enum.GetValues(typeof(SlideBar.Event))) { if (cb.Text == sbEvt.ToString()) { rawInputBytes = sb.SetSlideBarStatus(sbEvt, cb.Checked); break; } } updateLabels(null); }