1
package org.herac.tuxguitar.player.base;
3
public class MidiPlayerMode{
5
public static final int DEFAULT_TEMPO_PERCENT = 100;
7
public static final int TYPE_SINGLE = 1;
8
public static final int TYPE_CUSTOM = 2;
12
private int singlePercent;
13
private int customPercentFrom;
14
private int customPercentTo;
15
private int customPercentIncrement;
17
private int currentPercent;
19
public MidiPlayerMode(){
21
this.type = TYPE_SINGLE;
22
this.singlePercent = DEFAULT_TEMPO_PERCENT;
23
this.customPercentFrom = DEFAULT_TEMPO_PERCENT;
24
this.customPercentTo = DEFAULT_TEMPO_PERCENT;
25
this.customPercentIncrement = 0;
30
if(getType() == TYPE_SINGLE){
31
this.currentPercent = getSinglePercent();
33
else if(getType() == TYPE_CUSTOM){
34
this.currentPercent = getCustomPercentFrom();
38
public void notifyLoop(){
39
if(getType() == TYPE_SINGLE){
40
this.currentPercent = getSinglePercent();
42
else if(getType() == TYPE_CUSTOM){
43
this.currentPercent = (Math.min(getCustomPercentTo(),(getCurrentPercent() + getCustomPercentIncrement())));
47
public int getCurrentPercent(){
48
return this.currentPercent;
51
public boolean isLoop() {
55
public void setLoop(boolean loop) {
59
public int getType() {
63
public void setType(int type) {
67
public int getCustomPercentFrom() {
68
return this.customPercentFrom;
71
public void setCustomPercentFrom(int customPercentFrom) {
72
this.customPercentFrom = customPercentFrom;
75
public int getCustomPercentIncrement() {
76
return this.customPercentIncrement;
79
public void setCustomPercentIncrement(int customPercentIncrement) {
80
this.customPercentIncrement = customPercentIncrement;
83
public int getCustomPercentTo() {
84
return this.customPercentTo;
87
public void setCustomPercentTo(int customPercentTo) {
88
this.customPercentTo = customPercentTo;
91
public int getSinglePercent() {
92
return this.singlePercent;
95
public void setSinglePercent(int singlePercent) {
96
this.singlePercent = singlePercent;