Beispiel #1
0
        /// <summary>
        /// Threshold cue settings have changed. Release any previously allocated AudioHelper
        /// that was handling the threshold audio and allocate a new helper with the new
        /// configuration. Update the min/max bounds of the threshold.
        /// </summary>
        /// <param name="isEnabled"></param>
        /// <param name="updated"></param>
        public void UpdatedThresholdCues(bool isEnabled, CueUpdates updated)
        {
            if ((updated == CueUpdates.All) || ((updated & CueUpdates.Threshold) == CueUpdates.Threshold))
            {
                var steps = (int)Math.Round((Settings.Threshold * 0.01) * (_maxInt / 2));
                _alertLowerMax = (_maxInt / 2) - steps;
                _alertUpperMin = (_maxInt / 2) + steps;
            }

            if ((updated == CueUpdates.All) || ((updated & CueUpdates.Name) == CueUpdates.Name))
            {
                if (_audioThreshold != null)
                {
                    _audioThreshold.AudioCompleted -= _audioThreshold_AudioCompleted;
                    _audioThreshold.Dispose();
                    _audioThreshold = null;
                }
            }

            if (isEnabled)
            {
                if ((updated == CueUpdates.All) || ((updated & CueUpdates.Name) == CueUpdates.Name))
                {
                    var filename = Settings.FilenameForCue(Settings.ThresholdCue);
                    _audioThreshold = new AudioHelper(filename, Settings.ThresholdVol, false);
                    _audioThreshold.AudioCompleted += _audioThreshold_AudioCompleted;
                }
                else if ((updated & CueUpdates.Volume) == CueUpdates.Volume)
                {
                    _audioThreshold.Volume = Settings.ThresholdVol;
                }
            }

#if DEBUG_LOGGING
            Console.WriteLine($"UpdatedThresholdCues: alert [{_alertLowerMax}, {_alertUpperMin}], cue {Settings.ThresholdCue}, vol {Settings.ThresholdVol}");
#endif
        }
Beispiel #2
0
 /// <summary>
 /// Handle completion of an audio cue when audio and sampling is decoupled.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public override void HandleCueAudioCompleted(object sender, EventArgs e, AudioHelper cue)
 {
     Console.WriteLine("test");
 }
Beispiel #3
0
 /// <summary>
 /// Handle completion of an audio cue when audio and sampling is coupled.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public override void HandleCueAudioCompleted(object sender, EventArgs e, AudioHelper cue)
 {
     _timerSample.Start();
 }
Beispiel #4
0
 /// <summary>
 /// Handle the completion of an audio cue.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// <param name="cue"></param>
 public abstract void HandleCueAudioCompleted(object sender, EventArgs e, AudioHelper cue);