Пример #1
0
    void checkIfInhaling()
    {
        //Moč pod  exhale thresholdom && varianca < inhale threshold
        //ALI loudness občutno pod thresholdom
        if (currentState == Breathing.Exhale && ((micControl.loudness < exhaleLoudnessThreshold && variance < inhaleVarianceThreshold) ||
                                                 micControl.loudness < inhaleLoudnessThreshold))
        {
            currentState = Breathing.Inhale;             //Change state to inhaling

            BreathingEvents.TriggerOnInhale();           //Trigger onInhale event
        }
    }
Пример #2
0
    void checkIfExhaling()
    {
        if (currentState == Breathing.Inhale)
        {
            //Exhaling if loudness higher than threshold && variance over threshold && next 2 variances under threshold
            if (micControl.loudness > exhaleLoudnessThreshold && variance > exhaleVarianceThreshold)
            {
                fastExhalePossible = true;
            }

            if ((fastExhalePossible && varianceUnderThresholdCounter >= 2) ||
                (micControl.loudness > exhaleLoudnessThreshold && varianceUnderThresholdCounter > 8))                   //ALI moč precej velika && zadnjihnekaj varianc pod thresholdom
            {
                varianceUnderThresholdCounter = 0;
                fastExhalePossible            = false;

                currentState = Breathing.Exhale;                 //Change state to exhaling
                BreathingEvents.TriggerOnExhale();               //Trigger onExhale event
            }
        }
    }