Class HapticViewPort
- java.lang.Object
-
- uk.ac.qmul.eecs.depic.daw.haptics.HapticViewPort
-
public class HapticViewPort extends java.lang.Object
The haptic viewport is the specific portion of a track that is visible in the haptic view in every moment. It uses the same concept of a scrollable window: if the content is to big to be represented in a single window, then you only represent a portion of it and allow the user to scroll up and down. Likewise the haptic view port only represent one portion of audio track at the time and when the haptic proxy gets to the left or right ends of the view port, then the viewport is shifted of a certain amount of pixels.
-
-
Field Summary
Fields Modifier and Type Field and Description static int
DEFAULT_WIDTH
static float
STEP_SIZE
-
Constructor Summary
Constructors Constructor and Description HapticViewPort(int scaleFactor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description int
getPosition(float ratio)
Returns the position in the haptic view port that is mapped toratio
.int
getScaleFactor()
int
getWidth()
static double
log2(double x)
void
setScaleFactor(int scaleFactor)
void
setTrackSize(int trackSize)
void
shift(float amount)
-
-
-
Field Detail
-
DEFAULT_WIDTH
public static final int DEFAULT_WIDTH
- See Also:
- Constant Field Values
-
STEP_SIZE
public static final float STEP_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
shift
public void shift(float amount)
- Parameters:
amount
- the amount of shift in pixels (or chunks)
-
getPosition
public int getPosition(float ratio)
Returns the position in the haptic view port that is mapped toratio
.ratio
is a normalized value ranging from 0 to 1.- Parameters:
ratio
- the position on the haptic view port as a ratio of the haptic view port width- Returns:
- the the position on the haptic view port as chunk/pixel position
-
setTrackSize
public void setTrackSize(int trackSize)
-
getScaleFactor
public int getScaleFactor()
-
getWidth
public int getWidth()
-
setScaleFactor
public void setScaleFactor(int scaleFactor)
-
log2
public static double log2(double x)
-
-