/** * Calculates the time value corresponding to the given sample index. * * @param aSampleIndex * the sample index to get the time value for, >= 0. * @return the time value, in seconds. */ public double calculateTime( final int aSampleIndex ) { double timestamp = calculateTimeOffset( getTimestamps()[aSampleIndex] ); return ( timestamp / getSampleRate() ); }
/** * Returns the (absolute) time value for the cursor indicated by the given * index. * * @param aCursorIdx * the index of the cursor to return as time, should be >= 0 and < * 10. * @return the time value (in seconds), or -1.0 if the cursor is not * available. */ public Double getCursorTimeValue( final int aCursorIdx ) { if ( !isCursorPositionSet( aCursorIdx ) ) { return null; } Long cursorPos = getCursorPosition( aCursorIdx ); return Double.valueOf( calculateTimeOffset( cursorPos.longValue() ) / ( double )getAcquisitionData().getSampleRate() ); }