1
package org.herac.tuxguitar.song.models;
3
import org.herac.tuxguitar.song.factory.TGFactory;
5
public abstract class TGStroke {
7
public static final int STROKE_NONE = 0;
8
public static final int STROKE_UP = 1;
9
public static final int STROKE_DOWN = -1;
11
private int direction;
15
this.direction = STROKE_NONE;
18
public int getDirection() {
19
return this.direction;
22
public void setDirection(int direction) {
23
this.direction = direction;
26
public int getValue() {
30
public void setValue(int value) {
34
public int getIncrementTime( TGBeat beat ){
37
for(int v = 0; v < beat.countVoices(); v ++){
38
TGVoice voice = beat.getVoice( v );
39
if( !voice.isEmpty() ){
40
long currentDuration = voice.getDuration().getTime();
41
if(duration == 0 || currentDuration < duration){
42
duration = ( currentDuration <= TGDuration.QUARTER_TIME ? currentDuration : TGDuration.QUARTER_TIME );
47
return Math.round( ( ( duration / 8.0f ) * ( 4.0f / this.value ) ) );
53
public TGStroke clone(TGFactory factory){
54
TGStroke stroke = factory.newStroke();
59
public void copy(TGStroke stroke){
60
stroke.setValue(getValue());
61
stroke.setDirection(getDirection());