//public void NewSignal() //{ // int channelID = e.channelID; // int sampleCount = e.sampleCount; // double sample = e.samples; // if (!IsVariableChannel.ContainsKey(channelID)) // { // IsVariableChannel[channelID] = false; // } // if (bx.AllChanels.GetSelectedVisChannelId() == channelID && bx.ControlVisibility) // { // ProcessSignalWithEffectSetter(channelID, sample, FeedbackType.Visual); // } // if (bx.AllChanels.GetSelectedVolChannelId() == channelID && bx.ControlVolume) // { // ProcessSignalWithEffectSetter(channelID, sample, FeedbackType.Audio); // } // if (bx.AllChanels.GetSelectedKeyChannelId() == channelID && bx.ControlSendKey) // { // ProcessSignalWithEffectSetter(channelID, sample, FeedbackType.Keyboard); // } //} //private void ProcessSignalWithEffectSetter(int channelID, double sample, FeedbackType feedbackType) { // if (!IsVariableChannel[channelID] && (sample == 1.0 || sample == 0)) { // IsVariableChannel[channelID] = false; // PerformDiscreteSignalAction((int)sample, feedbackType); // } else { // IsVariableChannel[channelID] = true; // if (feedbackType == FeedbackType.Visual) { // PerformVariableSignalAction(sample, feedbackType, Globals.VariableVisSamples.AddSample(sample)); // } else if (feedbackType == FeedbackType.Audio) { // Globals.VariableVolSamples.AddSample(sample); // PerformVariableSignalAction(sample, feedbackType, Globals.VariableVolSamples.AddSample(sample)); // } // } //} void PerformVariableSignalAction(double sample, FeedbackType feedbackType, VariableSamples variableSamples) { if (feedbackType == FeedbackType.Visual) { ActivateVisEffectSetter(SignalType.Variable); bx.variableVisibility.ProcessSample(sample, bx.TrackVis, variableSamples); } else if (feedbackType == FeedbackType.Audio) { ActivateVolEffectSetter(SignalType.Variable); bx.variableVolume.ProcessSample(sample, bx.TrackVol, variableSamples); } }
public void ProcessSample(double sample, TrackBar trackerbar, VariableSamples variableSamples) { float percentReward = variableSamples.GetRewardLevelForSample(sample, 5, (int)updnMaximumThresholdPercent.Value, (int)updnMinimumThresholdPercent.Value, chkReverse.Checked, false); int scale = trackerbar.Maximum - trackerbar.Minimum; int reward = (int)Math.Ceiling(scale * percentReward); trackerbar.Value = trackerbar.Minimum + reward; }