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


Java TGDuration.QUARTER_TIME属性代码示例

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


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

示例1: readMeasures

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,代码来源:GP3InputStream.java

示例2: readMeasures

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,代码行数:17,代码来源:GP4InputStream.java

示例3: readMeasures

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,代码行数:18,代码来源:GP5InputStream.java

示例4: MidiRepeatController

public MidiRepeatController(TGSong song, int sHeader , int eHeader){
	this.song = song;
	this.sHeader = sHeader;
	this.eHeader = eHeader;
	this.count = song.countMeasureHeaders();
	this.index = 0;
	this.lastIndex = -1;
	this.shouldPlay = true;
	this.repeatOpen = true;
	this.repeatAlternative = 0;
	this.repeatStart = TGDuration.QUARTER_TIME;
	this.repeatEnd = 0;
	this.repeatMove = 0;
	this.repeatStartIndex = 0;
	this.repeatNumber = 0;
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:16,代码来源:MidiRepeatController.java

示例5: updateLoop

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,代码行数:24,代码来源:MidiPlayer.java

示例6: parseTrack

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,代码行数:22,代码来源:PTSongParser.java

示例7: processAction

protected void processAction(TGActionContext context){
	int applyTo = ((Integer) context.getAttribute(ATTRIBUTE_APPLY_TO)).intValue();
	int tempoValue = ((Integer) context.getAttribute(ATTRIBUTE_TEMPO)).intValue();
	if( tempoValue >= MIN_TEMPO && MAX_TEMPO <= 320 ){
		TGSongManager tgSongManager = getSongManager(context);
		TGSong tgSong = ((TGSong) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_SONG));
		TGMeasureHeader tgHeader = (TGMeasureHeader) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_HEADER);
		TGTempo tgTempo = tgSongManager.getFactory().newTempo();
		tgTempo.setValue(tempoValue);
		
		long start = (applyTo == APPLY_TO_ALL ? TGDuration.QUARTER_TIME : ((TGMeasureHeader) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_HEADER)).getStart());
		boolean toEnd = (applyTo == APPLY_TO_ALL || applyTo == APPLY_TO_END);
		
		TGMeasureHeader startHeader = tgSongManager.getMeasureHeaderAt(tgSong, start);
		if( startHeader != null ) {
			int oldValue = startHeader.getTempo().getValue();
			Iterator<?> it = tgSongManager.getMeasureHeadersAfter(tgSong, startHeader.getNumber() - 1).iterator();
			while(it.hasNext()){
				TGMeasureHeader nextHeader = (TGMeasureHeader)it.next();
				if( toEnd || nextHeader.getTempo().getValue() == oldValue ){
					context.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_HEADER, nextHeader);
					context.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_TEMPO, tgTempo);
					
					TGActionManager.getInstance(getContext()).execute(TGChangeTempoAction.NAME, context);
				} else{
					break;
				}
			}
		}
		
		context.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_HEADER, tgHeader);
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:33,代码来源:TGChangeTempoRangeAction.java

示例8: getDisplayPosition

public float getDisplayPosition(long start, float quarterWidth){
	long newStart = (start - this.getStart());
	float displayPosition = 0f;
	if( newStart > 0 ){
		float position = ((float)newStart / (float)TGDuration.QUARTER_TIME);
		displayPosition = (position * quarterWidth);
	}
	return displayPosition;
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:9,代码来源:TGMeasureImpl.java

示例9: 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;
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:12,代码来源:TGSongManager.java

示例10: getMaxStart

public long getMaxStart(){
	long result = TGDuration.QUARTER_TIME;
	for(int i = 0; i < this.voices.length; i ++){
		for(int j = 0; j < this.voices[i].length; j ++){
			result = Math.max(result,this.voices[i][j] );
		}
	}
	// checkRestMeasures
	if( this.measureRest && this.measureEmpty ){
		result = Math.max(result, (this.barStart + this.barLength));
	}
	return fixValue(result);
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:13,代码来源:TrackStartHelper.java

示例11: MidiSequenceParser

public MidiSequenceParser(TGSong song, TGSongManager songManager, int flags) {
	this.song = song;
	this.songManager = songManager;
	this.flags = flags;
	this.tempoPercent = 100;
	this.transpose = 0;
	this.sHeader = -1;
	this.eHeader = -1;
	this.firstTickMove = (int)(((flags & ADD_FIRST_TICK_MOVE) != 0)?(-TGDuration.QUARTER_TIME):0);
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:10,代码来源:MidiSequenceParser.java

示例12: makeSlide

public void makeSlide(MidiSequenceHelper sh,int track,long tick1,int value1,long tick2,int value2,int channel, int midiVoice, boolean bendMode){
	long distance = (value2 - value1);
	long length = (tick2 - tick1);
	int points = (int)(length / (TGDuration.QUARTER_TIME / 8));
	for(int i = 1;i <= points; i ++){
		float tone = ((((length / points) * (float)i) * distance) / length);
		int bend = (DEFAULT_BEND + (int)(tone * (DEFAULT_BEND_SEMI_TONE * 2)));
		addBend(sh, track, tick1 + ( (length / points) * i), bend, channel, midiVoice, bendMode);
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:10,代码来源:MidiSequenceParser.java

示例13: reset

public void reset(){
	try {
		this.lock();
		
		this.stop();
		this.tickPosition = TGDuration.QUARTER_TIME;
		this.setChangeTickPosition(false);
	} finally {
		this.unlock();
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:11,代码来源:MidiPlayer.java

示例14: process

public void process() {
	this.lastTime = this.time;
	this.time = System.currentTimeMillis();
	if(!this.tickChanged){
		this.tick += (TGDuration.QUARTER_TIME * ((float)getTempo() * (float)(this.time - this.lastTime) / 60f) / SECOND_IN_MILLIS);
	}
	this.tickChanged = false;
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:8,代码来源:MidiTickPlayer.java

示例15: parseMasterBars

private void parseMasterBars(TGSong tgSong){
	long tgStart = TGDuration.QUARTER_TIME;
	
	List<GPXMasterBar> masterBars = this.document.getMasterBars();
	for( int i = 0 ; i < masterBars.size() ; i ++ ){
		GPXMasterBar mbar = (GPXMasterBar) masterBars.get(i);
		GPXAutomation gpTempoAutomation = this.document.getAutomation("Tempo", i);
		
		TGMeasureHeader tgMeasureHeader = this.factory.newHeader();
		tgMeasureHeader.setStart(tgStart);
		tgMeasureHeader.setNumber( i + 1 );
		tgMeasureHeader.setRepeatOpen(mbar.isRepeatStart());
		tgMeasureHeader.setRepeatClose(mbar.getRepeatCount());
		tgMeasureHeader.setTripletFeel(parseTripletFeel(mbar));
		if( mbar.getTime() != null && mbar.getTime().length == 2){
			tgMeasureHeader.getTimeSignature().setNumerator(mbar.getTime()[0]);
			tgMeasureHeader.getTimeSignature().getDenominator().setValue(mbar.getTime()[1]);
		}
		if( gpTempoAutomation != null && gpTempoAutomation.getValue().length == 2 ){
			int tgTempo = gpTempoAutomation.getValue()[0];
			if( gpTempoAutomation.getValue()[1] == 1 ){
				tgTempo = (tgTempo / 2);
			}else if( gpTempoAutomation.getValue()[1] == 3 ){
				tgTempo = (tgTempo + (tgTempo / 2));
			}else if( gpTempoAutomation.getValue()[1] == 4 ){
				tgTempo = (tgTempo * 2);
			}else if( gpTempoAutomation.getValue()[1] == 5 ){
				tgTempo = (tgTempo + (tgTempo * 2));
			}
			tgMeasureHeader.getTempo().setValue( tgTempo );
		}
		tgSong.addMeasureHeader(tgMeasureHeader);
		
		for( int t = 0 ; t < tgSong.countTracks() ; t ++ ){
			TGTrack tgTrack = tgSong.getTrack(t);
			TGMeasure tgMeasure = this.factory.newMeasure(tgMeasureHeader);
			
			int accidental = mbar.getAccidentalCount();
			if( accidental < 0 ){
				accidental = 7 - accidental; // translate -1 to 8, etc.
			}
			if( accidental >= 0 && accidental <= 14 ){
				tgMeasure.setKeySignature(accidental);
			}
			
			tgTrack.addMeasure(tgMeasure);
			
			int gpMasterBarIndex = i;
			GPXBar gpBar = ( t < mbar.getBarIds().length ? this.document.getBar( mbar.getBarIds()[t] ) : null );
			while( gpBar != null && gpBar.getSimileMark() != null ){
				String gpMark = gpBar.getSimileMark();
				if( gpMark.equals("Simple") ){
					gpMasterBarIndex = (gpMasterBarIndex - 1);
				}else if((gpMark.equals("FirstOfDouble") || gpMark.equals("SecondOfDouble")) ){
					gpMasterBarIndex = (gpMasterBarIndex - 2);
				}
				if( gpMasterBarIndex >= 0 ){
					GPXMasterBar gpMasterBarCopy = (GPXMasterBar) masterBars.get(gpMasterBarIndex);
					gpBar = (t < gpMasterBarCopy.getBarIds().length ? this.document.getBar(gpMasterBarCopy.getBarIds()[t]) : null);
				}else{
					gpBar = null;
				}
			}
			
			if( gpBar != null ){
				this.parseBar( gpBar , tgMeasure );
			}
		}
		
		tgStart += tgMeasureHeader.getLength();
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:72,代码来源:GPXDocumentParser.java


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