private void checkPauseStyle() { if (!apa.isSpeaking && apa.voiceCadence == AudioPreAnalysis.Cadence.goodPause) { int size = postureStyleList.Count; if (size > 0) { if (!postureStyleList[size-1].hasEnded){ postureStyleList[size - 1].ended(); Style z = new Style(Style.Type.goodPause); postureStyleList.Add(z); } } else { Style z = new Style(Style.Type.goodPause); postureStyleList.Add(z); } } }
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 checkPostureStyle() { if (bfpa.bodyPosture == BodyFramePreAnalysis.Posture.good) { if (bfpa.resetPosture && !apa.isSpeaking) { if (postureStyleList.Count > 0) { if (postureStyleList[postureStyleList.Count - 1].hasEnded) { Style z = new Style(Style.Type.goodPosture); postureStyleList.Add(z); postureStyleFlag = true; } } else { Style z = new Style(Style.Type.goodPosture); postureStyleList.Add(z); postureStyleFlag = true; } } else if (apa.isSpeaking && postureStyleList.Count > 0) { postureStyleList[postureStyleList.Count - 1].ended(); postureStyleFlag = false; } } else { if (postureStyleList.Count > 0) postureStyleList[postureStyleList.Count - 1].ended(); postureStyleFlag = false; } }