void rulesAnalyzer_feedBackEvent(object sender, Mistake x) { if (x.hasEnded) { textFeedback.CurrentFeedback.Content = ":-D"; } else { textFeedback.CurrentFeedback.Content = x.getString(); } }
private void mistakeFeedback(Mistake x) { ghost.hideFeedback(); switch (x.type) { case Mistake.Type.posture: badPostureFeedback(); break; case Mistake.Type.handMovement: handMovementFeedback(); break; case Mistake.Type.cadence: cadenceMistakeFeedback(x); break; case Mistake.Type.volume: voiceVolumeFeedback(x); break; } }
private void fireBiggestEvent(Mistake biggestMistake, Style biggestStyle) { double mistakeGravity=0; double styleGravity = 0; if (biggestMistake != null) mistakeGravity = getPointsOfMistake(biggestMistake); if (biggestStyle != null) styleGravity = biggestStyle.gravity; //If no mistake, nothing will be done (mistakes should have been ended in switch blocks) //-Compare biggest mistake with Current feedback //--If no current feedback add this mistake to feedbacklist //--If current feedback has ended, add this mistake to feedbackList. //--If bigger than current feedback, add this mistake to feedbacklist (note that since the feedbacklist only contains references to mistakes, you only have to add new mistakes) //--If smaller or equal than current feedback, do nothing. if (mistakeGravity > styleGravity) { feedBackList.Add(biggestMistake); } else if (styleGravity > mistakeGravity) { feedBackList.Add(biggestStyle); } if (MainWindow.myState == MainWindow.States.freestyle) { int size = feedBackList.Count; if (size > 0) { try { if (interruption) { //makeReport(); mostRepeatedMistake = getMostRepeatedMistake(); biggestOfAllMistakes = (Mistake)feedBackList[feedBackList.Count - 1]; if (repetitions > REPETITION_THRESHOLD && !interrupted) { isRepetitionInterruption = true; triggered = mostRepeatedMistake; increaseInterruptions(triggered); clearReport(); //parent.freestyleMode.loadInterruption(); parent.freestyleMode.doInterruption(); //makeLog(); interrupted = true; //Mistake x = (Mistake) feedBackList[feedBackList.Count -1]; //resetForMistake(x); } else if (getPointsOfMistake(biggestOfAllMistakes) > MAX_POINTS_THRESHOLD && !interrupted) { isRepetitionInterruption = false; pointsOfBiggestOfAllMistakes = getPointsOfMistake(biggestOfAllMistakes); triggered = biggestOfAllMistakes.subType; increaseInterruptions(triggered); clearReport(); //parent.freestyleMode.loadInterruption(); parent.freestyleMode.doInterruption(); //makeLog(); interrupted = true; //Mistake x = (Mistake)feedBackList[feedBackList.Count - 1]; //resetForMistake(x); } } PresentationEvent temp = feedBackList[size - 1]; if (fired == null || fired != temp) { feedBackEvent(this, temp); fired = temp; firedHasEnded = false; } else //fired == temp { if (temp.hasEnded && !firedHasEnded) { feedBackEvent(this, temp); firedHasEnded = true; } } } catch { } } } else { //sendEvent(volumeMistakeList[volumeMistakeList.Count - 1]); //sendEvent(cadenceMistakeList[cadenceMistakeList.Count - 1]); //sendEvent(postureMistakeList[postureMistakeList.Count - 1]); //sendEvent(handMovementMistakeList[handMovementMistakeList.Count - 1]); } }
public void checkHandMovementMistake() { checkEnoughHandMovement(); switch (bfpa.handMovement) { case BodyFramePreAnalysis.HandMovement.good: { if (handMovementMistakeList.Count > 0) { Mistake x = handMovementMistakeList[handMovementMistakeList.Count - 1]; if (!x.hasEnded) { x.ended(); } } //since bool is set to false at the start, no need to do it again. break; } case BodyFramePreAnalysis.HandMovement.notEnough: { if (handMovementMistakeList.Count > 0) { Mistake x = handMovementMistakeList[handMovementMistakeList.Count - 1]; if (x.hasEnded) { Mistake z = new Mistake(Mistake.Type.handMovement, Mistake.SubType.noHandMovement, Mistake.GravityType.notEnough); handMovementMistakeList.Add(z); } else if (x.subType == Mistake.SubType.tooMuchHandMovement) { x.ended(); Mistake z = new Mistake(Mistake.Type.handMovement, Mistake.SubType.noHandMovement, Mistake.GravityType.notEnough); handMovementMistakeList.Add(z); } //if notEnoughMovement mistake, nothing changes } else { Mistake z = new Mistake(Mistake.Type.handMovement, Mistake.SubType.noHandMovement, Mistake.GravityType.notEnough); handMovementMistakeList.Add(z); } handMovementMistake = true; break; } case BodyFramePreAnalysis.HandMovement.tooMuch: { if (handMovementMistakeList.Count > 0) { Mistake x = handMovementMistakeList[handMovementMistakeList.Count - 1]; if (x.hasEnded) { Mistake z = new Mistake(Mistake.Type.handMovement, Mistake.SubType.tooMuchHandMovement, Mistake.GravityType.tooMuch); handMovementMistakeList.Add(z); } else if (x.subType == Mistake.SubType.noHandMovement) { x.ended(); Mistake z = new Mistake(Mistake.Type.handMovement, Mistake.SubType.tooMuchHandMovement, Mistake.GravityType.tooMuch); handMovementMistakeList.Add(z); } //if tooMuchMovement mistake, nothing changes } else { Mistake z = new Mistake(Mistake.Type.handMovement, Mistake.SubType.tooMuchHandMovement, Mistake.GravityType.tooMuch); handMovementMistakeList.Add(z); } handMovementMistake = true; break; } } }
public void checkPostureMistake() { switch (bfpa.bodyPosture) { case BodyFramePreAnalysis.Posture.bad: { if (postureMistakeList.Count > 0) { Mistake x = postureMistakeList[postureMistakeList.Count - 1]; if (x.hasEnded) { Mistake z = new Mistake(Mistake.Type.posture, Mistake.SubType.badPosture, Mistake.GravityType.bad); postureMistakeList.Add(z); } // if x has not ended, no need to do anything! } else { Mistake z = new Mistake(Mistake.Type.posture, Mistake.SubType.badPosture, Mistake.GravityType.bad); postureMistakeList.Add(z); } postureMistake = true; break; } case BodyFramePreAnalysis.Posture.good: { if (postureMistakeList.Count > 0) { Mistake x = postureMistakeList[postureMistakeList.Count - 1]; if (!x.hasEnded) { x.ended(); } } //since bool is set to false at the start, no need to do it again. break; } } }
void rulesAnalyzer_pauseMistakeEvent(object sender, Mistake x) { textFeedback.CurrentFeedback.Content = x.getString(); }
private void oldVoiceVolumeFeedback(Mistake mistake) { var uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_hands.png", UriKind.Relative); switch (mistake.subType) { case Mistake.SubType.soft: uriSource = new Uri(@"/PresentationTrainer;component/Images/ic_fb_raise_volume.png", UriKind.Relative); oldTextFeedback.FeedbackIMG.Source = new BitmapImage(uriSource); oldTextFeedback.FeedbackIMG.Visibility = Visibility.Visible; oldTextFeedback.CurrentFeedback.Content = " Speak Louder "; ghostMoving.CurrentFeedback.Content = " Speak Louder "; uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_raiseVolume.png", UriKind.Relative); ghostMoving.ghostImg.Source = new BitmapImage(uriSource); break; case Mistake.SubType.loud: uriSource = new Uri(@"/PresentationTrainer;component/Images/ic_fb_lower_volume.png", UriKind.Relative); oldTextFeedback.FeedbackIMG.Source = new BitmapImage(uriSource); oldTextFeedback.FeedbackIMG.Visibility = Visibility.Visible; oldTextFeedback.CurrentFeedback.Content = " Speak softer "; ghostMoving.CurrentFeedback.Content = " Speak softer "; uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_lowerVolume.png", UriKind.Relative); ghostMoving.ghostImg.Source = new BitmapImage(uriSource); break; case Mistake.SubType.moduleVolume: uriSource = new Uri(@"/PresentationTrainer;component/Images/ic_fb_module_volume.png", UriKind.Relative); oldTextFeedback.FeedbackIMG.Source = new BitmapImage(uriSource); oldTextFeedback.FeedbackIMG.Visibility = Visibility.Visible; oldTextFeedback.CurrentFeedback.Content = " Module Volume "; ghostMoving.CurrentFeedback.Content = " Module Volumer "; uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_moduleVolume.png", UriKind.Relative); ghostMoving.ghostImg.Source = new BitmapImage(uriSource); break; } ghostAnimation(); }
private void oldCadenceMistakeFeedback(Mistake mistake) { var uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_hands.png", UriKind.Relative); switch (mistake.subType) { case Mistake.SubType.longSpeakingTime: uriSource = new Uri(@"/PresentationTrainer;component/Images/ic_fb_pause_speaking.png", UriKind.Relative); oldTextFeedback.FeedbackIMG.Source = new BitmapImage(uriSource); oldTextFeedback.FeedbackIMG.Visibility = Visibility.Visible; uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_pause.png", UriKind.Relative); ghostMoving.ghostImg.Source = new BitmapImage(uriSource); oldTextFeedback.CurrentFeedback.Content = " Stop Speaking "; ghostMoving.CurrentFeedback.Content = " Stop Speaking "; break; case Mistake.SubType.longPause: uriSource = new Uri(@"/PresentationTrainer;component/Images/ic_fb_start_speaking.png", UriKind.Relative); oldTextFeedback.FeedbackIMG.Source = new BitmapImage(uriSource); oldTextFeedback.FeedbackIMG.Visibility = Visibility.Visible; uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_startSpeaking.png", UriKind.Relative); ghostMoving.ghostImg.Source = new BitmapImage(uriSource); oldTextFeedback.CurrentFeedback.Content = " Start Speaking "; ghostMoving.CurrentFeedback.Content = " Start Speaking "; break; case Mistake.SubType.shortSpeakingTime: oldTextFeedback.FeedbackIMG.Visibility = Visibility.Collapsed; oldTextFeedback.CurrentFeedback.Content = " Speak Longer "; break; case Mistake.SubType.shortPause: oldTextFeedback.FeedbackIMG.Visibility = Visibility.Collapsed; oldTextFeedback.CurrentFeedback.Content = " Pause Longer "; break; } ghostAnimation(); }
public void resetForMistake(Mistake mistake) { switch (mistake.type) { case Mistake.Type.volume:{ volumeMistakeListCopy.AddRange(volumeMistakeList); volumeMistakeList = new List<Mistake>(); break; } case Mistake.Type.cadence:{ if ((mistake.subType == Mistake.SubType.shortPause || mistake.subType == Mistake.SubType.shortSpeakingTime) && mistake.shortMistake) { shortMistakeListCopy.AddRange(shortMistakeList); shortMistakeList = new List<Mistake>(); } else { cadenceMistakeListCopy.AddRange(cadenceMistakeList); cadenceMistakeList = new List<Mistake>(); } break; } case Mistake.Type.posture:{ postureMistakeListCopy.AddRange(postureMistakeList); postureMistakeList = new List<Mistake>(); break; } case Mistake.Type.handMovement:{ handMovementMistakeListCopy.AddRange(handMovementMistakeList); handMovementMistakeList = new List<Mistake>(); break; } } }
public void clearReport() { nrOfMistakes = 0; nrOfVolumeMistakes = 0; nrOfCadenceMistakes = 0; nrOfPostureMistakes = 0; nrOfHandMovementMistakes = 0; nrOfShortMistakes = 0; averageMistakePoints = 0; standardDeviationOfMistakePoints = 0; biggestOfAllMistakes = new Mistake(Mistake.Type.volume, Mistake.SubType.moduleVolume, Mistake.GravityType.bad); mostRepeatedMistake = Mistake.SubType.moduleVolume; repetitions = 0; }
public void makeReport() { nrOfVolumeMistakes = 0; for (int i = 0; i < volumeMistakeList.Count; i++) { if (volumeMistakeList[i].volumeMistakeLongEnough) { nrOfVolumeMistakes++; } } //nrOfVolumeMistakes = volumeMistakeList.Count; nrOfCadenceMistakes = 0; for (int i = 0; i < cadenceMistakeList.Count; i++) { if (cadenceMistakeList[i].subType == Mistake.SubType.longPause || cadenceMistakeList[i].subType == Mistake.SubType.longSpeakingTime) { nrOfCadenceMistakes++; } } //nrOfCadenceMistakes = cadenceMistakeList.Count; nrOfPostureMistakes = postureMistakeList.Count; nrOfHandMovementMistakes = handMovementMistakeList.Count; nrOfShortMistakes = 0; for (int i = 0; i < shortMistakeList.Count; i++) { if (shortMistakeList[i].shortMistake) { nrOfShortMistakes++; } } //nrOfShortMistakes = shortMistakeList.Count; nrOfMistakes += nrOfVolumeMistakes + nrOfCadenceMistakes + nrOfPostureMistakes + nrOfHandMovementMistakes + nrOfShortMistakes; double biggest = 0; double x = 0; double sumOfMistakes = 0; for (int i =0; i<volumeMistakeList.Count; i++ ){ if (volumeMistakeList[i].volumeMistakeLongEnough) { x = getPointsOfMistake(volumeMistakeList[i]); sumOfMistakes += x; if (x > biggest) { biggest = x; biggestOfAllMistakes = volumeMistakeList[i]; } } } for (int i = 0; i < cadenceMistakeList.Count; i++) { if (cadenceMistakeList[i].subType == Mistake.SubType.longPause || cadenceMistakeList[i].subType == Mistake.SubType.longSpeakingTime) { x = getPointsOfMistake(cadenceMistakeList[i]); sumOfMistakes += x; if (x > biggest) { biggest = x; biggestOfAllMistakes = cadenceMistakeList[i]; } } } for (int i = 0; i < postureMistakeList.Count; i++) { x = getPointsOfMistake(postureMistakeList[i]); sumOfMistakes += x; if (x > biggest) { biggest = x; biggestOfAllMistakes = postureMistakeList[i]; } } for (int i = 0; i < handMovementMistakeList.Count; i++) { x = getPointsOfMistake(handMovementMistakeList[i]); sumOfMistakes += x; if (x > biggest) { biggest = x; biggestOfAllMistakes = handMovementMistakeList[i]; } } for (int i = 0; i < shortMistakeList.Count; i++) { if (shortMistakeList[i].shortMistake) { x = getPointsOfMistake(shortMistakeList[i]); sumOfMistakes += x; if (x > biggest) { biggest = x; biggestOfAllMistakes = shortMistakeList[i]; } } } averageMistakePoints = sumOfMistakes / nrOfMistakes; double sdSum = 0; for (int i = 0; i < volumeMistakeList.Count; i++) { if (volumeMistakeList[i].volumeMistakeLongEnough) sdSum += Math.Pow((getPointsOfMistake(volumeMistakeList[i])-averageMistakePoints),2); } for (int i = 0; i < cadenceMistakeList.Count; i++) { if (cadenceMistakeList[i].subType == Mistake.SubType.longPause || cadenceMistakeList[i].subType == Mistake.SubType.longSpeakingTime) sdSum += Math.Pow((getPointsOfMistake(cadenceMistakeList[i]) - averageMistakePoints), 2); } for (int i = 0; i < postureMistakeList.Count; i++) { sdSum += Math.Pow((getPointsOfMistake(postureMistakeList[i]) - averageMistakePoints), 2); } for (int i = 0; i < handMovementMistakeList.Count; i++) { sdSum += Math.Pow((getPointsOfMistake(handMovementMistakeList[i]) - averageMistakePoints), 2); } for (int i = 0; i < shortMistakeList.Count; i++) { if (shortMistakeList[i].shortMistake) sdSum += Math.Pow((getPointsOfMistake(shortMistakeList[i]) - averageMistakePoints), 2); } standardDeviationOfMistakePoints = Math.Sqrt(sdSum / nrOfMistakes); mostRepeatedMistake = getMostRepeatedMistake(); //moduleVolume means it is null!! keep this in mind!! }
public void sendEvent(Mistake x) { if (!x.hasEnded) { switch (x.type) { case Mistake.Type.volume: { volumeMistakeEvent(this, x); break; } case Mistake.Type.cadence: { cadenceMistakeEvent(this, x); break; } case Mistake.Type.posture: { postureMistakeEvent(this, x); break; } case Mistake.Type.handMovement: { handMovementMistakeEvent(this, x); break; } } } }
public int getRepetition(Mistake mistake) { int repeated = 0; switch (mistake.type) { case Mistake.Type.volume: { int size = volumeMistakeList.Count; if (size > 0) { for (int i = 0; i < size; i++) { if (volumeMistakeList[i].subType == mistake.subType && volumeMistakeList[i].volumeMistakeLongEnough) { repeated++; } } } break; } case Mistake.Type.cadence: { if (mistake.subType == Mistake.SubType.shortPause || mistake.subType == Mistake.SubType.shortSpeakingTime) { int size = shortMistakeList.Count; if (size > 0){ if (mistake.shortMistake) { for (int i = 0; i < size; i++) { if (shortMistakeList[i].subType == mistake.subType && shortMistakeList[i].shortMistake) { repeated++; } } } } } else { int size = cadenceMistakeList.Count; if (size > 0) { for (int i = 0; i < size; i++) { if (cadenceMistakeList[i].subType == mistake.subType) { repeated++; } } } } break; } case Mistake.Type.posture: { if (postureMistakeList.Count > 0) { //every mistake is a bad mistake, therefore, every mistake in the mistake list should be added to repeated repeated = postureMistakeList.Count; } break; } case Mistake.Type.handMovement: { int size = handMovementMistakeList.Count; if (size > 0) { for (int i = 0; i < size; i++) { if (handMovementMistakeList[i].subType == mistake.subType) { repeated++; } } } break; } } return repeated; }
//NOT CALIBRATED YET public double getPointsOfMistake(Mistake mistake) { double points = 0; double lengthOfMistake = DateTime.Now.TimeOfDay.TotalMilliseconds - mistake.timeStarted; //can be divided by 250, 500 or 1000, depending on how important the steps of time are. double lengthPoints = lengthOfMistake / 1000; int repeated = getRepetition(mistake); //Calibrate this formula! //lengthPoints can also be a multiplier //repeated can also be a multiplier points = mistake.gravity +lengthPoints + repeated; // Alternative (base of the exponents still to be determent): //double lengthPointsMultiplier = Math.Pow(1.2, lengthPoints); //double repeatedMultiplier = Math.Pow(1.2, repeated); //points = mistake.gravity * lengthPointsMultiplier * repeatedMultiplier; return points; }
private void mistakeOldFeedback(Mistake mistake) { switch (mistake.type) { case Mistake.Type.posture: oldBadPostureFeedback(); break; case Mistake.Type.handMovement: oldHandMovementFeedback(); break; case Mistake.Type.cadence: oldCadenceMistakeFeedback(mistake); break; case Mistake.Type.volume: oldVoiceVolumeFeedback(mistake); break; } }
private void cadenceMistakeFeedback(Mistake mistake) { float factor = 345.45f; float displacement = 373; float xHead = parent.bodyFrameHandler.bodyFramePreAnalysis.body.Joints[JointType.Head].Position.X; float leftPositionGhost = factor * xHead + displacement; Canvas.SetLeft(ghost, factor * xHead + displacement); var uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_hands.png", UriKind.Relative); switch (mistake.subType) { case Mistake.SubType.longSpeakingTime: uriSource = new Uri(@"/PresentationTrainer;component/Images/ic_fb_pause_speaking.png", UriKind.Relative); textFeedback.FeedbackIMG.Source = new BitmapImage(uriSource); textFeedback.FeedbackIMG.Visibility = Visibility.Visible; uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_pause.png", UriKind.Relative); ghost.ghostImg.Source = new BitmapImage(uriSource); ghost.Visibility = Visibility.Visible; textFeedback.CurrentFeedback.Content = " Stop Speaking "; ghost.CurrentFeedback.Content = " Stop Speaking "; break; case Mistake.SubType.longPause: uriSource = new Uri(@"/PresentationTrainer;component/Images/ic_fb_start_speaking.png", UriKind.Relative); textFeedback.FeedbackIMG.Source = new BitmapImage(uriSource); textFeedback.FeedbackIMG.Visibility = Visibility.Visible; uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_startSpeaking.png", UriKind.Relative); ghost.ghostImg.Source = new BitmapImage(uriSource); ghost.Visibility = Visibility.Visible; textFeedback.CurrentFeedback.Content = " Start Speaking "; ghost.CurrentFeedback.Content = " Start Speaking "; break; case Mistake.SubType.shortSpeakingTime: textFeedback.FeedbackIMG.Visibility = Visibility.Collapsed; textFeedback.CurrentFeedback.Content = " Speak Longer "; break; case Mistake.SubType.shortPause: textFeedback.FeedbackIMG.Visibility = Visibility.Collapsed; textFeedback.CurrentFeedback.Content = " Pause Longer "; break; } }
public void increaseInterruptions(Mistake.SubType subType) { switch (subType) { case Mistake.SubType.loud: interruptions[0]++; break; case Mistake.SubType.soft: interruptions[1]++; break; case Mistake.SubType.longSpeakingTime: interruptions[2]++; break; case Mistake.SubType.longPause: interruptions[3]++; break; case Mistake.SubType.shortSpeakingTime: interruptions[4]++; break; case Mistake.SubType.shortPause: interruptions[5]++; break; case Mistake.SubType.badPosture: interruptions[6]++; break; case Mistake.SubType.noHandMovement: interruptions[7]++; break; case Mistake.SubType.tooMuchHandMovement: interruptions[8]++; break; } }
private void voiceVolumeFeedback(Mistake mistake) { float factor = 345.45f; float displacement = 373; float xHead = parent.bodyFrameHandler.bodyFramePreAnalysis.body.Joints[JointType.Head].Position.X; float leftPositionGhost = factor * xHead + displacement; Canvas.SetLeft(ghost, factor * xHead + displacement); ghost.Visibility = Visibility.Visible; var uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_hands.png", UriKind.Relative); switch (mistake.subType) { case Mistake.SubType.soft: uriSource = new Uri(@"/PresentationTrainer;component/Images/ic_fb_raise_volume.png", UriKind.Relative); textFeedback.FeedbackIMG.Source = new BitmapImage(uriSource); textFeedback.FeedbackIMG.Visibility = Visibility.Visible; uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_raiseVolume.png", UriKind.Relative); ghost.ghostImg.Source = new BitmapImage(uriSource); textFeedback.CurrentFeedback.Content = " Speak Louder "; ghost.CurrentFeedback.Content = " Speak Louder "; break; case Mistake.SubType.loud: uriSource = new Uri(@"/PresentationTrainer;component/Images/ic_fb_lower_volume.png", UriKind.Relative); textFeedback.FeedbackIMG.Source = new BitmapImage(uriSource); textFeedback.FeedbackIMG.Visibility = Visibility.Visible; uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_lowerVolume.png", UriKind.Relative); ghost.ghostImg.Source = new BitmapImage(uriSource); textFeedback.CurrentFeedback.Content = " Speak softer "; ghost.CurrentFeedback.Content = " Speak softer "; break; case Mistake.SubType.moduleVolume: uriSource = new Uri(@"/PresentationTrainer;component/Images/ic_fb_module_volume.png", UriKind.Relative); textFeedback.FeedbackIMG.Source = new BitmapImage(uriSource); textFeedback.FeedbackIMG.Visibility = Visibility.Visible; uriSource = new Uri(@"/PresentationTrainer;component/Images/ghost_moduleVolume.png", UriKind.Relative); ghost.ghostImg.Source = new BitmapImage(uriSource); textFeedback.CurrentFeedback.Content = " Module Volume "; ghost.CurrentFeedback.Content = " Module Volume "; break; } }
public void checkVolumeMistake() { switch (apa.voiceVolume) { case AudioPreAnalysis.Volume.loud: { if (volumeMistakeList.Count > 0) { Mistake x = volumeMistakeList[volumeMistakeList.Count - 1]; if (x.hasEnded) { Mistake z = new Mistake(Mistake.Type.volume, Mistake.SubType.loud, Mistake.GravityType.loud); volumeMistakeList.Add(z); } else if (x.subType == Mistake.SubType.soft) { x.ended(); Mistake z = new Mistake(Mistake.Type.volume, Mistake.SubType.loud, Mistake.GravityType.loud); volumeMistakeList.Add(z); } //else, do nothing, since if previous was loud mistake, no change, and if previous was veryLoud mistake, dont change gravity. } else { Mistake z = new Mistake(Mistake.Type.volume, Mistake.SubType.loud, Mistake.GravityType.loud); volumeMistakeList.Add(z); } volumeMistake = true; break; } case AudioPreAnalysis.Volume.veryLoud: { if (volumeMistakeList.Count > 0) { Mistake x = volumeMistakeList[volumeMistakeList.Count - 1]; if (x.hasEnded) { Mistake z = new Mistake(Mistake.Type.volume, Mistake.SubType.loud, Mistake.GravityType.veryLoud); volumeMistakeList.Add(z); } else if (x.subType == Mistake.SubType.soft) { x.ended(); Mistake z = new Mistake(Mistake.Type.volume, Mistake.SubType.loud, Mistake.GravityType.veryLoud); volumeMistakeList.Add(z); } else if (x.gravityType == Mistake.GravityType.loud) { x.setGravity(Mistake.GravityType.veryLoud); } } else { Mistake z = new Mistake(Mistake.Type.volume, Mistake.SubType.loud, Mistake.GravityType.veryLoud); volumeMistakeList.Add(z); } volumeMistake = true; break; } case AudioPreAnalysis.Volume.soft: { if (volumeMistakeList.Count > 0) { Mistake x = volumeMistakeList[volumeMistakeList.Count - 1]; if (x.hasEnded) { Mistake z = new Mistake(Mistake.Type.volume, Mistake.SubType.soft, Mistake.GravityType.soft); volumeMistakeList.Add(z); } else if (x.subType == Mistake.SubType.loud) { x.ended(); Mistake z = new Mistake(Mistake.Type.volume, Mistake.SubType.soft, Mistake.GravityType.soft); volumeMistakeList.Add(z); } //else, do nothing, since if previous was soft mistake, no change, and if previous was verySoft mistake, dont change gravity. } else { Mistake z = new Mistake(Mistake.Type.volume, Mistake.SubType.soft, Mistake.GravityType.soft); volumeMistakeList.Add(z); } volumeMistake = true; break; } case AudioPreAnalysis.Volume.verySoft: { if (volumeMistakeList.Count > 0) { Mistake x = volumeMistakeList[volumeMistakeList.Count - 1]; if (x.hasEnded) { Mistake z = new Mistake(Mistake.Type.volume, Mistake.SubType.soft, Mistake.GravityType.verySoft); volumeMistakeList.Add(z); } else if (x.subType == Mistake.SubType.loud) { x.ended(); Mistake z = new Mistake(Mistake.Type.volume, Mistake.SubType.soft, Mistake.GravityType.verySoft); volumeMistakeList.Add(z); } else if (x.gravityType == Mistake.GravityType.soft) { x.setGravity(Mistake.GravityType.verySoft); } } else { Mistake z = new Mistake(Mistake.Type.volume, Mistake.SubType.soft, Mistake.GravityType.verySoft); volumeMistakeList.Add(z); } volumeMistake = true; break; } case AudioPreAnalysis.Volume.good: { if (volumeMistakeList.Count > 0) { Mistake x = volumeMistakeList[volumeMistakeList.Count - 1]; if (!x.hasEnded) { x.ended(); } } //since bool is set to false at the start, no need to do it again. break; } } }
public static String getMistakeFeedBack(Mistake.SubType mistake) { string temp = "x"; switch (mistake) { case SubType.loud: { temp = "Speaking too loud offends your audience." + "\n" + "Speaking a bit softer will remedy this."; break; } case SubType.soft: { temp = "Speaking too soft makes it hard for your audience to" + "\n" + "understand you. Speaking a bit louder will remedy this."; break; } case SubType.longPause: { temp = "Pausing for too long can irritate your audience." + "\n" + "Make sure you pause for a shorter time."; break; } case SubType.longSpeakingTime: { temp = "Speaking for too long makes it harder for your audience to" + "\n" + "understand you. Pausing once in a while remedies this."; break; } case SubType.badPosture: { temp = "Keep in mind that you should stand straight and keep your hands" + "\n" + "above your hips. This sends out a message of confidence which" + "\n" + "is important for capturing your audience."; break; } case SubType.noHandMovement: { temp = "Use hand movements to emphasize your statements. This will " + "\n" + "make it easier for the audience to remember them."; break; } case SubType.tooMuchHandMovement: { temp = "Overusing hand movements negates the positive effect of " + "\n" + "emphasizing statements. You should use less hand movements."; break; } case SubType.shortSpeakingTime: { temp = "Speaking for a short time makes it harder for your audience" + "\n" + "to understand you. Make sure you speak a little longer."; break; } case SubType.shortPause: { temp = "Pausing for a short time makes it look like you do not know" + "\n" + "what you are talking about. Make sure you have a little bit " + "\n" + "longer pauses."; break; } case SubType.moduleVolume: { temp = "No Feedback availabe for no mistake"; break; } } return temp; }
public void checkCadenceMistake() { switch (apa.voiceCadence) { case AudioPreAnalysis.Cadence.longPause: { if (cadenceMistakeList.Count > 0) { Mistake x = cadenceMistakeList[cadenceMistakeList.Count - 1]; if (x.hasEnded) { Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.longPause, Mistake.GravityType.longPause); cadenceMistakeList.Add(z); } else if (x.subType == Mistake.SubType.shortPause) { x.setGravity(Mistake.GravityType.longPause); x.subType = Mistake.SubType.longPause; } else if (x.subType != Mistake.SubType.longPause) { if (x.subType == Mistake.SubType.shortSpeakingTime) { x.shortMistake = true; shortMistake = true; x.setGravity(Mistake.GravityType.shortSpeakingTime); shortMistakeList.Add(x); cadenceMistakeList.Remove(x); } else { x.ended(); } Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.longPause, Mistake.GravityType.longPause); cadenceMistakeList.Add(z); } //else, do nothing, since if previous was longPause mistake, no change, and if previous was veryLongPause mistake, dont change gravity. } else { Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.longPause, Mistake.GravityType.longPause); cadenceMistakeList.Add(z); } cadenceMistake = true; break; } case AudioPreAnalysis.Cadence.veryLongPause: { if (cadenceMistakeList.Count > 0) { Mistake x = cadenceMistakeList[cadenceMistakeList.Count - 1]; if (x.hasEnded) { Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.longPause, Mistake.GravityType.veryLongPause); cadenceMistakeList.Add(z); } else if (x.subType == Mistake.SubType.shortPause) { x.setGravity(Mistake.GravityType.veryLongPause); x.subType = Mistake.SubType.longPause; } else if (x.subType != Mistake.SubType.longPause) { if (x.subType == Mistake.SubType.shortSpeakingTime) { x.shortMistake = true; shortMistake = true; x.setGravity(Mistake.GravityType.shortSpeakingTime); shortMistakeList.Add(x); cadenceMistakeList.Remove(x); } else { x.ended(); } Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.longPause, Mistake.GravityType.veryLongPause); cadenceMistakeList.Add(z); } else if (x.gravityType == Mistake.GravityType.longPause) { x.setGravity(Mistake.GravityType.veryLongPause); } } else { Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.longPause, Mistake.GravityType.veryLongPause); cadenceMistakeList.Add(z); } cadenceMistake = true; break; } case AudioPreAnalysis.Cadence.longSpeakingTime: { if (cadenceMistakeList.Count > 0) { Mistake x = cadenceMistakeList[cadenceMistakeList.Count - 1]; if (x.hasEnded) { Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.longSpeakingTime, Mistake.GravityType.longSpeakingTime); cadenceMistakeList.Add(z); } else if (x.subType == Mistake.SubType.shortSpeakingTime) { x.setGravity(Mistake.GravityType.longSpeakingTime); x.subType = Mistake.SubType.longSpeakingTime; } else if (x.subType != Mistake.SubType.longSpeakingTime) { if (x.subType == Mistake.SubType.shortPause) { x.shortMistake = true; shortMistake = true; x.setGravity(Mistake.GravityType.shortPause); shortMistakeList.Add(x); cadenceMistakeList.Remove(x); } else { x.ended(); } Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.longSpeakingTime, Mistake.GravityType.longSpeakingTime); cadenceMistakeList.Add(z); } //else, do nothing, since if previous was longPause mistake, no change, and if previous was veryLongNoPause mistake, dont change gravity. } else { Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.longSpeakingTime, Mistake.GravityType.longSpeakingTime); cadenceMistakeList.Add(z); } cadenceMistake = true; break; } case AudioPreAnalysis.Cadence.veryLongSpeakingTime: { if (cadenceMistakeList.Count > 0) { Mistake x = cadenceMistakeList[cadenceMistakeList.Count - 1]; if (x.hasEnded) { Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.longSpeakingTime, Mistake.GravityType.veryLongSpeakingTime); cadenceMistakeList.Add(z); } else if (x.subType == Mistake.SubType.shortSpeakingTime) { x.setGravity(Mistake.GravityType.veryLongSpeakingTime); x.subType = Mistake.SubType.longSpeakingTime; } else if (x.subType != Mistake.SubType.longSpeakingTime) { if (x.subType == Mistake.SubType.shortPause) { x.shortMistake = true; shortMistake = true; x.setGravity(Mistake.GravityType.shortPause); shortMistakeList.Add(x); cadenceMistakeList.Remove(x); } else { x.ended(); } Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.longSpeakingTime, Mistake.GravityType.veryLongSpeakingTime); cadenceMistakeList.Add(z); } else if (x.gravityType == Mistake.GravityType.longSpeakingTime) { x.setGravity(Mistake.GravityType.veryLongSpeakingTime); } } else { Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.longSpeakingTime, Mistake.GravityType.veryLongSpeakingTime); cadenceMistakeList.Add(z); } cadenceMistake = true; break; } case AudioPreAnalysis.Cadence.goodPause: { if (cadenceMistakeList.Count > 0) { Mistake x = cadenceMistakeList[cadenceMistakeList.Count - 1]; if (!x.hasEnded) { x.ended(); } } //since bool is set to false at the start, no need to do it again. break; } case AudioPreAnalysis.Cadence.goodSpeakingTime: { if (cadenceMistakeList.Count > 0) { Mistake x = cadenceMistakeList[cadenceMistakeList.Count - 1]; if (!x.hasEnded) { x.ended(); } } //since bool is set to false at the start, no need to do it again. break; } case AudioPreAnalysis.Cadence.shortPause: { if (cadenceMistakeList.Count > 0) { Mistake x = cadenceMistakeList[cadenceMistakeList.Count - 1]; //if (x.subType == Mistake.SubType.shortSpeakingTime) //{ // x.shortMistake = true; // shortMistake = true; // x.setGravity(Mistake.GravityType.shortSpeakingTime); // shortMistakeList.Add(x); // cadenceMistakeList.Remove(x); //} //else if (!x.hasEnded) { x.ended(); } Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.shortPause, Mistake.GravityType.shortPause); cadenceMistakeList.Add(z); } else { Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.shortPause, Mistake.GravityType.shortPause); cadenceMistakeList.Add(z); } //pauseMistake = true; break; } case AudioPreAnalysis.Cadence.shortSpeakingTime: { if (cadenceMistakeList.Count > 0) { Mistake x = cadenceMistakeList[cadenceMistakeList.Count - 1]; //if (x.subType == Mistake.SubType.shortPause) //{ // x.shortMistake = true; // shortMistake = true; // x.setGravity(Mistake.GravityType.shortPause); // shortMistakeList.Add(x); // cadenceMistakeList.Remove(x); //} //else if (!x.hasEnded) { x.ended(); } Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.shortSpeakingTime, Mistake.GravityType.shortSpeakingTime); cadenceMistakeList.Add(z); } else { Mistake z = new Mistake(Mistake.Type.cadence, Mistake.SubType.shortSpeakingTime, Mistake.GravityType.shortSpeakingTime); cadenceMistakeList.Add(z); } //pauseMistake = true; break; } } }