org.dstadler.audio.player.ConstantTempoStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-audio Show documentation
Show all versions of commons-audio Show documentation
Common utilities I find useful when developing audio-related projects.
package org.dstadler.audio.player;
/**
* A simple tempo strategy which always returns the tempo-value that was defined
* during construction.
*/
public class ConstantTempoStrategy implements TempoStrategy {
private final float tempo;
/**
* Construct the strategy with the given tempo value.
*
* @param tempo The tempo to use, 1.0 for normal speed, lower values for
* slower playback, higher values for faster playback. Values
* in the range [0.8, 1.2] seem to still sound fairly good.
*/
public ConstantTempoStrategy(float tempo) {
this.tempo = tempo;
}
@Override
public float calculateTempo() {
return tempo;
}
@Override
public String name() {
return CONSTANT;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy