public float getNextFrequency ( float delta ) throws IOException { float last = frequencyCounter . getFrequency ( ) ; float min = last - delta ; float max = last + delta ; while ( true ) { int sample = getSample ( ) ; if ( frequencyCounter . update ( sample ) ) { float next = frequencyCounter . getFrequency ( ) ; if ( next > max || next < min ) { return next ; } } } }
Returns next frequency that deviates more than delta from previous .