本文整理汇总了Java中org.herac.tuxguitar.song.models.TGDuration.EIGHTH属性的典型用法代码示例。如果您正苦于以下问题:Java TGDuration.EIGHTH属性的具体用法?Java TGDuration.EIGHTH怎么用?Java TGDuration.EIGHTH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.herac.tuxguitar.song.models.TGDuration
的用法示例。
在下文中一共展示了TGDuration.EIGHTH属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVoiceWidth
/**
* Calcula el Espacio que ocupara el pulso
*/
public float getVoiceWidth(TGVoiceImpl voice){
float scale = getScale();
TGDuration duration = voice.getDuration();
if(duration != null){
switch(duration.getValue()){
case TGDuration.WHOLE:
return (30.0f * scale);
case TGDuration.HALF:
return (25.0f * scale);
case TGDuration.QUARTER:
return (21.0f * scale);
case TGDuration.EIGHTH:
return (20.0f * scale);
case TGDuration.SIXTEENTH:
return (19.0f * scale);
case TGDuration.THIRTY_SECOND:
return (18.0f * scale);
default:
return this.getMinBeatWidth();
}
}
return (20.0f * scale);
}
示例2: toStrokeValue
private int toStrokeValue( TGStroke stroke ){
if( stroke.getValue() == TGDuration.SIXTY_FOURTH ){
return 2;
}
if( stroke.getValue() == TGDuration.THIRTY_SECOND ){
return 3;
}
if( stroke.getValue() == TGDuration.SIXTEENTH ){
return 4;
}
if( stroke.getValue() == TGDuration.EIGHTH ){
return 5;
}
if( stroke.getValue() == TGDuration.QUARTER ){
return 6;
}
return 2;
}
示例3: toStrokeValue
private int toStrokeValue( int value ){
if( value == 1 || value == 2){
return TGDuration.SIXTY_FOURTH;
}
if( value == 3){
return TGDuration.THIRTY_SECOND;
}
if( value == 4){
return TGDuration.SIXTEENTH;
}
if( value == 5){
return TGDuration.EIGHTH;
}
if( value == 6){
return TGDuration.QUARTER;
}
return TGDuration.SIXTY_FOURTH;
}
示例4: makeBeamEighthNoteBytes
private byte[] makeBeamEighthNoteBytes(TGTimeSignature ts){
byte[] bytes = new byte[]{0,0,0,0};
if( ts.getDenominator().getValue() <= TGDuration.EIGHTH ){
int eighthsInDenominator = (TGDuration.EIGHTH / ts.getDenominator().getValue());
int total = (eighthsInDenominator * ts.getNumerator());
int byteValue = ( total / 4 );
int missingValue = ( total - (4 * byteValue) );
for( int i = 0 ; i < bytes.length; i ++ ){
bytes[i] = (byte)byteValue;
}
if( missingValue > 0 ){
bytes[0] += missingValue;
}
}
return bytes;
}
示例5: canJoin
public boolean canJoin(TGSongManager manager,TGVoiceImpl b1,TGVoiceImpl b2){
if( b1 == null || b2 == null || b1.isRestVoice() || b2.isRestVoice() ){
return false;
}
long divisionLength = getDivisionLength();
long start = getStart();
long start1 = (manager.getMeasureManager().getRealStart(this, b1.getBeat().getStart()) - start);
long start2 = (manager.getMeasureManager().getRealStart(this, b2.getBeat().getStart()) - start);
if(b1.getDuration().getValue() < TGDuration.EIGHTH || b2.getDuration().getValue() < TGDuration.EIGHTH ){
return ( start1 == start2);
}
long p1 = ((divisionLength + start1) / divisionLength);
long p2 = ((divisionLength + start2) / divisionLength);
return ( p1 == p2 );
}
示例6: getMinSpacing
/**
* Calcula el Espacio minimo que quedara entre nota y nota
*/
protected float getMinSpacing(TGDuration duration){
float scale = getScale();
switch(duration.getValue()){
case TGDuration.WHOLE:
return (50.0f * scale);
case TGDuration.HALF:
return (30.0f * scale);
case TGDuration.QUARTER:
return (25.0f * scale);
case TGDuration.EIGHTH:
return (20.0f * scale);
default:
return (18.0f * scale);
}
}
示例7: fillDurations
public void fillDurations(View view, TGNote note) {
int duration = TGDuration.EIGHTH;
if( note != null && note.getEffect().isTrill() ){
duration = note.getEffect().getTrill().getDuration().getValue();
}
this.fillDuration(view, R.id.trill_dlg_duration_16, TGDuration.SIXTEENTH, duration);
this.fillDuration(view, R.id.trill_dlg_duration_32, TGDuration.THIRTY_SECOND, duration);
this.fillDuration(view, R.id.trill_dlg_duration_64, TGDuration.SIXTY_FOURTH, duration);
}
示例8: findSelectedDuration
public int findSelectedDuration(View view) {
RadioGroup optionsGroup = (RadioGroup) view.findViewById(R.id.trill_dlg_duration_group);
int radioButtonId = optionsGroup.getCheckedRadioButtonId();
if( radioButtonId != -1 ) {
RadioButton radioButton = (RadioButton) optionsGroup.findViewById(radioButtonId);
if( radioButton != null ) {
return ((Integer)radioButton.getTag()).intValue();
}
}
return TGDuration.EIGHTH;
}
示例9: fillDurations
public void fillDurations(View view, TGNote note) {
int duration = TGDuration.EIGHTH;
if( note != null && note.getEffect().isTremoloPicking() ){
duration = note.getEffect().getTremoloPicking().getDuration().getValue();
}
this.fillDuration(view, R.id.tremolo_picking_dlg_duration_8, TGDuration.EIGHTH, duration);
this.fillDuration(view, R.id.tremolo_picking_dlg_duration_16, TGDuration.SIXTEENTH, duration);
this.fillDuration(view, R.id.tremolo_picking_dlg_duration_32, TGDuration.THIRTY_SECOND, duration);
}
示例10: getDivisionLength
public static long getDivisionLength(TGMeasureHeader header){
long defaultLength = TGDuration.QUARTER_TIME;
int denominator = header.getTimeSignature().getDenominator().getValue();
switch(denominator){
case TGDuration.EIGHTH:
if(header.getTimeSignature().getNumerator() % 3 == 0){
defaultLength += TGDuration.QUARTER_TIME / 2;
}
break;
}
return defaultLength;
}
示例11: writeTremoloPicking
public void writeTremoloPicking(TGEffectTremoloPicking effect) throws IOException{
if(effect.getDuration().getValue() == TGDuration.EIGHTH){
writeUnsignedByte(1);
}else if(effect.getDuration().getValue() == TGDuration.SIXTEENTH){
writeUnsignedByte(2);
}else if(effect.getDuration().getValue() == TGDuration.THIRTY_SECOND){
writeUnsignedByte(3);
}
}
示例12: parseDuration
private byte parseDuration(TGDuration duration) {
byte value = 0;
switch (duration.getValue()) {
case TGDuration.WHOLE:
value = -2;
break;
case TGDuration.HALF:
value = -1;
break;
case TGDuration.QUARTER:
value = 0;
break;
case TGDuration.EIGHTH:
value = 1;
break;
case TGDuration.SIXTEENTH:
value = 2;
break;
case TGDuration.THIRTY_SECOND:
value = 3;
break;
case TGDuration.SIXTY_FOURTH:
value = 4;
break;
}
return value;
}
示例13: writeTremoloPicking
private void writeTremoloPicking(TGEffectTremoloPicking tremoloPicking) throws IOException{
if(tremoloPicking.getDuration().getValue() == TGDuration.EIGHTH){
writeByte((byte)1);
}else if(tremoloPicking.getDuration().getValue() == TGDuration.SIXTEENTH){
writeByte((byte)2);
}else if(tremoloPicking.getDuration().getValue() == TGDuration.THIRTY_SECOND){
writeByte((byte)3);
}
}
示例14: paintSilence
public void paintSilence(TGLayout layout,TGPainter painter, float fromX, float fromY) {
int style = layout.getStyle();
float x = 0;
float lineSpacing = 0;
float y = 0;
float scale = 0;
if((style & TGLayout.DISPLAY_SCORE) != 0 ){
x = fromX + getPosX() + getBeatImpl().getSpacing(layout);
y = fromY + getPaintPosition(TGTrackSpacing.POSITION_SCORE_MIDDLE_LINES) + this.silenceY;
lineSpacing = layout.getScoreLineSpacing();
scale = (lineSpacing / 9.0f);
}else{
x = fromX + getPosX() + getBeatImpl().getSpacing(layout) - 1;
y = fromY + getPaintPosition(TGTrackSpacing.POSITION_TABLATURE) + this.silenceY;
lineSpacing = layout.getStringSpacing();
scale = (lineSpacing / 10.0f);
}
setStyle(layout, painter,(layout.isPlayModeEnabled() && isPlaying(layout)));
painter.initPath(TGPainter.PATH_FILL);
int duration = getDuration().getValue();
if(duration == TGDuration.WHOLE){
TGSilencePainter.paintWhole(painter, x, y , scale);
}
else if(duration == TGDuration.HALF){
TGSilencePainter.paintHalf(painter, x, y , scale);
}
else if(duration == TGDuration.QUARTER){
TGSilencePainter.paintQuarter(painter, x, y, scale);
}
else if(duration == TGDuration.EIGHTH){
TGSilencePainter.paintEighth(painter, x, y, scale);
}
else if(duration == TGDuration.SIXTEENTH){
TGSilencePainter.paintSixteenth(painter, x, y, scale);
}
else if(duration == TGDuration.THIRTY_SECOND){
TGSilencePainter.paintThirtySecond(painter, x, y, scale);
}
else if(duration == TGDuration.SIXTY_FOURTH){
TGSilencePainter.paintSixtyFourth(painter, x, y, scale);
}
painter.closePath();
if(getDuration().isDotted() || getDuration().isDoubleDotted()){
layout.setDotStyle(painter);
painter.initPath();
painter.moveTo(x + 10,y +1);
painter.addOval(x + 10,y +1,1,1);
if(getDuration().isDoubleDotted()){
painter.moveTo(x + 13,y +1);
painter.addOval(x + 13,y +1,1,1);
}
painter.closePath();
}
if(!getDuration().getDivision().isEqual(TGDivisionType.NORMAL)){
layout.setDivisionTypeStyle(painter);
if((style & TGLayout.DISPLAY_SCORE) != 0 ){
painter.drawString(Integer.toString(getDuration().getDivision().getEnters()), x,(fromY + getPaintPosition(TGTrackSpacing.POSITION_DIVISION_TYPE)));
}else{
painter.drawString(Integer.toString(getDuration().getDivision().getEnters()),x,(fromY + getPaintPosition(TGTrackSpacing.POSITION_DIVISION_TYPE)));
}
}
}
示例15: paintScoreBeat
public void paintScoreBeat(TGLayout layout,TGPainter painter, float fromX, float fromY, float spacing){
float vX = ( fromX + getPosX() + spacing );
//division type
if (!getDuration().getDivision().isEqual(TGDivisionType.NORMAL)) {
layout.setDivisionTypeStyle(painter);
painter.drawString(Integer.toString(getDuration().getDivision().getEnters()),vX ,((fromY - getPaintPosition(TGTrackSpacing.POSITION_SCORE_MIDDLE_LINES)) + getPaintPosition(TGTrackSpacing.POSITION_DIVISION_TYPE)));
}
//dibujo el pie
if( getDuration().getValue() >= TGDuration.HALF ){
layout.setScoreNoteFooterStyle(painter);
float scale = layout.getScale();
float lineSpacing = layout.getScoreLineSpacing();
int direction = this.group.getDirection();
int dir = (direction == TGBeatGroup.DIRECTION_DOWN ? 1 : -1);
int key = getBeat().getMeasure().getKeySignature();
int clef = getBeat().getMeasure().getClef();
float scoreNoteWidth = layout.getScoreNoteWidth();
float xMove = (direction == TGBeatGroup.DIRECTION_UP ? scoreNoteWidth : 0f);
float yMove = ((lineSpacing / 2f) + (((lineSpacing / 10f) * 1.20f)) * dir);
float vY1 = fromY + ( direction == TGBeatGroup.DIRECTION_DOWN ? this.maxNote.getScorePosY() : this.minNote.getScorePosY() );
float vY2 = fromY + this.group.getY2(layout,getPosX() + spacing, key, clef);
painter.initPath(TGPainter.PATH_FILL);
painter.moveTo(vX + xMove - (0.5f * scale), vY1 + yMove);
painter.lineTo(vX + xMove + (0.5f * scale), vY1 + yMove);
painter.lineTo(vX + xMove + (0.5f * scale), vY2);
painter.lineTo(vX + xMove - (0.5f * scale), vY2);
painter.moveTo(vX + xMove - (0.5f * scale), vY1 + yMove);
painter.closePath();
if( getDuration().getValue() >= TGDuration.EIGHTH ) {
int index = ( getDuration().getIndex() - 3);
if( index >= 0 ) {
int joinedType = getJoinedType();
boolean joinedGreaterThanQuarter = isJoinedGreaterThanQuarter();
if((joinedType == TGVoiceImpl.JOINED_TYPE_NONE_LEFT || joinedType == TGVoiceImpl.JOINED_TYPE_NONE_RIGHT) && !joinedGreaterThanQuarter){
float hX = (fromX + xMove + getPosX() + spacing - (0.5f * scale));
float hY = ((fromY + this.group.getY2(layout,getPosX() + spacing,key,clef)) - ( (lineSpacing * 2)* dir )) ;
for(int i = 0; i <= index; i ++){
painter.initPath(TGPainter.PATH_FILL);
TGNotePainter.paintFooter(painter, hX, (hY - ( (i * (lineSpacing / 2.0f)) * dir)),dir,lineSpacing);
painter.closePath();
}
}else{
float hX1 = 0;
float hX2 = 0;
if(joinedType == TGVoiceImpl.JOINED_TYPE_NONE_RIGHT){
hX1 = getPosX() + spacing;
hX2 = getPosX() + spacing + (6f * scale);
}else if(joinedType == TGVoiceImpl.JOINED_TYPE_NONE_LEFT){
hX1 = getPosX() + spacing - (5f * scale);
hX2 = getPosX() + spacing;
}else{
hX1 = getJoin1().getPosX() + getJoin1().getBeatImpl().getSpacing(layout);
hX2 = getJoin2().getPosX() + getJoin2().getBeatImpl().getSpacing(layout);
}
float hY1 = fromY + this.group.getY2(layout,hX1,key,clef);
float hY2 = fromY + this.group.getY2(layout,hX2,key,clef);
painter.setLineWidth(TGPainter.THINNEST_LINE_WIDTH);
painter.initPath(TGPainter.PATH_FILL);
for(int i = 0; i <= index; i ++){
painter.moveTo(fromX + xMove + hX1 - (0.5f * scale), hY1 - ((i * (5f * scale)) * dir) - (1.5f * scale));
painter.lineTo(fromX + xMove + hX1 - (0.5f * scale), hY1 - ((i * (5f * scale)) * dir) + (1.5f * scale));
painter.lineTo(fromX + xMove + hX2 + (0.5f * scale), hY2 - ((i * (5f * scale)) * dir) + (1.5f * scale));
painter.lineTo(fromX + xMove + hX2 + (0.5f * scale), hY2 - ((i * (5f * scale)) * dir) - (1.5f * scale));
painter.lineTo(fromX + xMove + hX1 - (0.5f * scale), hY1 - ((i * (5f * scale)) * dir) - (1.5f * scale));
}
painter.closePath();
painter.setLineWidth(1f * scale);
}
}
}
}
}