本文整理汇总了Java中org.herac.tuxguitar.io.tef.base.TETimeSignatureChange类的典型用法代码示例。如果您正苦于以下问题:Java TETimeSignatureChange类的具体用法?Java TETimeSignatureChange怎么用?Java TETimeSignatureChange使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TETimeSignatureChange类属于org.herac.tuxguitar.io.tef.base包,在下文中一共展示了TETimeSignatureChange类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readComponents
import org.herac.tuxguitar.io.tef.base.TETimeSignatureChange; //导入依赖的package包/类
private void readComponents(){
int tsSize = ( (256 * this.song.getTimeSignature().getNumerator()) / this.song.getTimeSignature().getDenominator() );
int tsMove = 0;
int mIndex = 0;
int mData = 0;
int count = this.readShort();
for(int i = 0; i < count; i ++){
byte[] data = this.readBytes(6);
int location = ( (data[0] & 0xff) + (256 * (mData + (data[1] & 0xff))));
if( ( location / ( tsSize * this.song.getStrings() ) ) < mIndex ){
mData += 256;
location = ((data[0] & 0xff) + (256 * (mData + (data[1] & 0xff))));
}
int position = (location % tsSize);
int string = ( (location / tsSize) % this.song.getStrings()) ;
int measure = ( location / ( tsSize * this.song.getStrings() ) );
tsMove = (mIndex == measure)?tsMove:0;
position -= tsMove;
if( ((data[2] & 0xff) & 0x1f) > 0 && ((data[2] & 0xff) & 0x1f) <= 25 ){
int duration = (data[3] & 0xf);
int dynamic = (data[3] >> 4);
int effect = data[4];
int fret = (((data[2] & 0xff) & 0x1f) - 1);
if((((data[2] & 0xff) >> 5) & 0x01) != 0 ) {
fret += (data[5] & 0xff);
}
this.song.getComponents().add( new TEComponentNote(position, measure, string ,fret,duration,dynamic,effect ) );
}
else if( ((data[2] & 0xff) & 0x1f) == 27 ){
//TIME SIGNATURE CHANGE
tsMove = (4 * (data[3] & 0xff ) );
int denominator = (int)( ( Math.pow( 2 , ( ( data[2] & 0xff ) >> 5 ) ) / 2 ) );
int numerator = ((( (tsSize / 4) - (data[3] & 0xff) ) * denominator) / 64);
this.song.addTimeSignatureChange(new TETimeSignatureChange(measure, new TETimeSignature(numerator,denominator)));
}
else if( ((data[2] & 0xff) & 0x1f) == 28 && (data[2] & 0x20) != 0){
//SCALE DIAGRAM
}
else if( ((data[2] & 0xff) & 0x1f) == 28){
//CHORD
this.song.getComponents().add( new TEComponentChord(position, measure, string , data[3]) );
}
else if( ((data[2] & 0xff) & 0x1f) == 29 ){
//SCALE DIAGRAM | SPECIAL CHAR | SYNCOPATION CHANGE
}
else if( ((data[2] & 0xff) & 0x1f) == 30 ){
//TEMPO CHANGE | VOICE CHANGE | DRUM EVENT | CRESCENDO ACCENT | REPEAT/ENDING
}
mIndex = measure;
}
}