当前位置: 首页>>代码示例>>Java>>正文


Java TGDuration类代码示例

本文整理汇总了Java中org.herac.tuxguitar.song.models.TGDuration的典型用法代码示例。如果您正苦于以下问题:Java TGDuration类的具体用法?Java TGDuration怎么用?Java TGDuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TGDuration类属于org.herac.tuxguitar.song.models包,在下文中一共展示了TGDuration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toStrokeValue

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
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;
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:19,代码来源:GP4OutputStream.java

示例2: readMeasures

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
private void readMeasures(TGSong song, int measures, int tracks, int tempoValue) throws IOException{
	TGTempo tempo = getFactory().newTempo();
	tempo.setValue(tempoValue);
	long start = TGDuration.QUARTER_TIME;
	for (int i = 0; i < measures; i++) {
		TGMeasureHeader header = song.getMeasureHeader(i);
		header.setStart(start);
		for (int j = 0; j < tracks; j++) {
			TGTrack track = song.getTrack(j);
			TGMeasure measure = getFactory().newMeasure(header);
			
			track.addMeasure(measure);
			readMeasure(measure, track, tempo);
		}
		header.getTempo().copyFrom(tempo);
		start += header.getLength();
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:19,代码来源:GP3InputStream.java

示例3: toStrokeValue

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
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;
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:19,代码来源:GP3InputStream.java

示例4: readMeasures

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
private void readMeasures(TGSong song, int measures, int tracks, int tempoValue) throws IOException{
	TGTempo tempo = getFactory().newTempo();
	tempo.setValue(tempoValue);
	long start = TGDuration.QUARTER_TIME;
	for (int i = 0; i < measures; i++) {
		TGMeasureHeader header = song.getMeasureHeader(i);
		header.setStart(start);
		for (int j = 0; j < tracks; j++) {
			TGTrack track = song.getTrack(j);
			TGMeasure measure = getFactory().newMeasure(header);
			track.addMeasure(measure);
			readMeasure(measure, track, tempo);
		}
		header.getTempo().copyFrom(tempo);
		start += header.getLength();
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:18,代码来源:GP4InputStream.java

示例5: readMeasures

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
private void readMeasures(TGSong song, int measures, int tracks, int tempoValue) throws IOException{
	TGTempo tempo = getFactory().newTempo();
	tempo.setValue(tempoValue);
	long start = TGDuration.QUARTER_TIME;
	for (int i = 0; i < measures; i++) {
		TGMeasureHeader header = song.getMeasureHeader(i);
		header.setStart(start);
		for (int j = 0; j < tracks; j++) {
			TGTrack track = song.getTrack(j);
			TGMeasure measure = getFactory().newMeasure(header);
			track.addMeasure(measure);
			readMeasure(measure, track, tempo);
			skip(1);
		}
		header.getTempo().copyFrom(tempo);
		start += header.getLength();
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:19,代码来源:GP5InputStream.java

示例6: readTrill

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
private void readTrill(TGNoteEffect effect) throws IOException{
	byte fret = readByte();
	byte period = readByte();
	TGEffectTrill trill = getFactory().newEffectTrill();
	trill.setFret(fret);
	if(period == 1){
		trill.getDuration().setValue(TGDuration.SIXTEENTH);
		effect.setTrill(trill);
	}else if(period == 2){
		trill.getDuration().setValue(TGDuration.THIRTY_SECOND);
		effect.setTrill(trill);
	}else if(period == 3){
		trill.getDuration().setValue(TGDuration.SIXTY_FOURTH);
		effect.setTrill(trill);
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:17,代码来源:GP5InputStream.java

示例7: processAction

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
protected void processAction(TGActionContext context){
	Long start = (Long) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_POSITION);
	Integer fret = (Integer) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_FRET);
	Integer velocity = (Integer) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_VELOCITY);
	TGDuration duration = (TGDuration) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_DURATION);
	TGVoice voice = ((TGVoice) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_VOICE));
	TGMeasure measure = (TGMeasure) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_MEASURE);
	TGString string = (TGString) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_STRING);
	TGSongManager songManager = getSongManager(context);
	
	if( measure != null && fret >= 0 ) {
		this.addNote(songManager, measure, voice, duration, string, start, fret, velocity);
		
		context.setAttribute(ATTRIBUTE_SUCCESS, Boolean.TRUE);
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:17,代码来源:TGChangeNoteAction.java

示例8: parseTrack

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
private void parseTrack(TGSong tgSong, PTTrack track){
	this.helper.reset( track.getDefaultInfo() );
	
	long start = TGDuration.QUARTER_TIME;
	for( int sIndex = 0; sIndex < track.getSections().size(); sIndex ++){
		PTSection section = (PTSection) track.getSections().get(sIndex);
		section.sort();
		
		//calculo el siguiente start del compas
		this.helper.getStartHelper().init(section.getNumber(),section.getStaffs());
		this.helper.getStartHelper().initVoices(start);
		
		//parseo las posiciones
		for( int pIndex = 0; pIndex < section.getPositions().size(); pIndex ++){
			PTPosition position = (PTPosition)section.getPositions().get(pIndex);
			parsePosition(tgSong, track, position);
		}
		
		//Calculo el start para la proxima seccion
		start = this.helper.getStartHelper().getMaxStart();
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:23,代码来源:PTSongParser.java

示例9: processAction

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
protected void processAction(TGActionContext context){
	TGSongManager songManager = getSongManager(context);
	TGMeasure measure = ((TGMeasure) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_MEASURE));
	TGBeat beat = ((TGBeat) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_BEAT));
	TGVoice voice = ((TGVoice) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_VOICE));
	TGNote note = ((TGNote) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_NOTE));
	TGDuration duration = ((TGDuration) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_DURATION));
	TGString string = ((TGString) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_STRING));
	int velocity = ((Integer) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_VELOCITY)).intValue();
	
	if( note == null ){
		note = songManager.getFactory().newNote();
		note.setValue(0);
		note.setVelocity(velocity);
		note.setString(string.getNumber());
		
		TGDuration noteDuration = duration.clone(songManager.getFactory());
					
		songManager.getMeasureManager().addNote(measure, beat.getStart(), note, noteDuration, voice.getIndex());
	}
	songManager.getMeasureManager().changeDeadNote(note);
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:23,代码来源:TGChangeDeadNoteAction.java

示例10: parseRhythm

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
private void parseRhythm(GPXRhythm gpRhythm , TGDuration tgDuration){
	tgDuration.setDotted(gpRhythm.getAugmentationDotCount() == 1);
	tgDuration.setDoubleDotted(gpRhythm.getAugmentationDotCount() == 2);
	tgDuration.getDivision().setTimes(gpRhythm.getPrimaryTupletDen());
	tgDuration.getDivision().setEnters(gpRhythm.getPrimaryTupletNum());
	if(gpRhythm.getNoteValue().equals("Whole")){
		tgDuration.setValue(TGDuration.WHOLE);
	}else if(gpRhythm.getNoteValue().equals("Half")){
		tgDuration.setValue(TGDuration.HALF);
	}else if(gpRhythm.getNoteValue().equals("Quarter")){
		tgDuration.setValue(TGDuration.QUARTER);
	}else if(gpRhythm.getNoteValue().equals("Eighth")){
		tgDuration.setValue(TGDuration.EIGHTH);
	}else if(gpRhythm.getNoteValue().equals("16th")){
		tgDuration.setValue(TGDuration.SIXTEENTH);
	}else if(gpRhythm.getNoteValue().equals("32nd")){
		tgDuration.setValue(TGDuration.THIRTY_SECOND);
	}else if(gpRhythm.getNoteValue().equals("64th")){
		tgDuration.setValue(TGDuration.SIXTY_FOURTH);
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:22,代码来源:GPXDocumentParser.java

示例11: updateLoop

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
public void updateLoop( boolean force ){
	try {
		this.lock();
		
		if( force || !this.isRunning() ){
			this.loopSHeader = -1;
			this.loopEHeader = -1;
			this.loopSPosition = TGDuration.QUARTER_TIME;
			if( getMode().isLoop() ){
				int hCount = this.getSong().countMeasureHeaders();
				this.loopSHeader = ( getMode().getLoopSHeader() <= hCount ? getMode().getLoopSHeader() : -1 ) ;
				this.loopEHeader = ( getMode().getLoopEHeader() <= hCount ? getMode().getLoopEHeader() : -1 ) ;
				if( this.loopSHeader > 0 && this.loopSHeader <= hCount ){
					TGMeasureHeader header = this.getSongManager().getMeasureHeader( getSong(), this.loopSHeader );
					if( header != null ){
						this.loopSPosition = header.getStart();
					}
				}
			}
		}
	} finally {
		this.unlock();
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:25,代码来源:MidiPlayer.java

示例12: getMinSpacing

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
/**
 * 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);
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:19,代码来源:TGLayout.java

示例13: fillSong

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
public void fillSong(TGSong song){
	TGChannel channel = getFactory().newChannel();
	channel.setChannelId(1);
	channel.setName(createDefaultChannelName(song, channel));
	
	TGMeasureHeader header = getFactory().newHeader();
	header.setNumber(1);
	header.setStart(TGDuration.QUARTER_TIME);
	header.getTimeSignature().setNumerator(4);
	header.getTimeSignature().getDenominator().setValue(TGDuration.QUARTER);
	
	TGTrack track = getFactory().newTrack();
	track.setNumber(1);
	track.setName(getDefaultTrackName(track));
	track.setChannelId(channel.getChannelId());
	track.setStrings(createDefaultInstrumentStrings());
	track.addMeasure(getFactory().newMeasure(header));
	track.getColor().copyFrom(TGColor.RED);
	
	song.addChannel(channel);
	song.addMeasureHeader(header);
	song.addTrack(track);
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:24,代码来源:TGSongManager.java

示例14: removeBeat

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
/**
 * Elimina un silencio del compas.
 * si se asigna moveNextComponents = true. los componentes que le siguen
 * se moveran para completar el espacio vacio que dejo el silencio
 */
public void removeBeat(TGBeat beat,boolean moveNextBeats){
	TGMeasure measure = beat.getMeasure();
	
	removeBeat(beat);
	if(moveNextBeats){
		TGDuration minimumDuration = getMinimumDuration(beat);
		long start = beat.getStart();
		long length = (minimumDuration != null ? minimumDuration.getTime() : 0);
		
		TGBeat next = getNextBeat(measure.getBeats(),beat);
		if(next != null){
			length = next.getStart() - start;
		}
		moveBeatsInMeasure(beat.getMeasure(),start + length,-length, minimumDuration);
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:22,代码来源:TGMeasureManager.java

示例15: getRealStart

import org.herac.tuxguitar.song.models.TGDuration; //导入依赖的package包/类
public long getRealStart(TGMeasure measure,long currStart){
	long beatLength = TGSongManager.getDivisionLength(measure.getHeader());
	long start = currStart;
	boolean startBeat = (start % beatLength == 0);
	if(!startBeat){
		TGDuration minDuration = getSongManager().getFactory().newDuration();
		minDuration.setValue(TGDuration.SIXTY_FOURTH);
		minDuration.getDivision().setEnters(3);
		minDuration.getDivision().setTimes(2);
		for(int i = 0;i < minDuration.getTime();i++){
			start ++;
			startBeat = (start % beatLength == 0);
			if(startBeat){
			   break;
			}
		}
		if(!startBeat){
			start = currStart;
		}
	}
	return start;
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:23,代码来源:TGMeasureManager.java


注:本文中的org.herac.tuxguitar.song.models.TGDuration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。