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


Java TESong类代码示例

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


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

示例1: addComponents

import org.herac.tuxguitar.io.tef.base.TESong; //导入依赖的package包/类
private void addComponents(TGSong tgSong, TESong song){
	Iterator<TEComponent> it = song.getComponents().iterator();
	while(it.hasNext()){
		TEComponent component = (TEComponent)it.next();
		
		if(component.getMeasure() >= 0 && component.getMeasure() < tgSong.countMeasureHeaders()){
			int offset = 0;
			TETrack[] tracks = song.getTracks();
			for(int i = 0; i < tracks.length; i ++){
				int strings = tracks[i].getStrings().length;
				int string = (component.getString() - offset);
				if( string >= 0 && string <  strings && string < 7){
					TGTrack tgTrack = tgSong.getTrack(i);
					TGMeasure tgMeasure = tgTrack.getMeasure(component.getMeasure());
					if(component instanceof TEComponentNote){
						addNote(tracks[i], (TEComponentNote)component,string,strings,tgMeasure);
					}
					else if(component instanceof TEComponentChord){
						addChord(song.getChords(),(TEComponentChord)component,tgTrack,tgMeasure);
					}
				}
				offset += strings;
			}
		}
	}
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:27,代码来源:TESongStream.java

示例2: addComponents

import org.herac.tuxguitar.io.tef.base.TESong; //导入依赖的package包/类
private void addComponents(TESong song){
	Iterator it = song.getComponents().iterator();
	while(it.hasNext()){
		TEComponent component = (TEComponent)it.next();
		
		if(component.getMeasure() >= 0 && component.getMeasure() < this.manager.getSong().countMeasureHeaders()){
			int offset = 0;
			TETrack[] tracks = song.getTracks();
			for(int i = 0; i < tracks.length; i ++){
				int strings = tracks[i].getStrings().length;
				int string = (component.getString() - offset);
				if( string >= 0 && string <  strings && string < 7){
					TGTrack tgTrack = this.manager.getSong().getTrack(i);
					TGMeasure tgMeasure = tgTrack.getMeasure(component.getMeasure());
					if(component instanceof TEComponentNote){
						addNote(tracks[i], (TEComponentNote)component,string,strings,tgMeasure);
					}
					else if(component instanceof TEComponentChord){
						addChord(song.getChords(),(TEComponentChord)component,tgTrack,tgMeasure);
					}
				}
				offset += strings;
			}
		}
	}
}
 
开发者ID:Totallicks,项目名称:totallicks-tuxguitar,代码行数:27,代码来源:TESongImporter.java

示例3: process

import org.herac.tuxguitar.io.tef.base.TESong; //导入依赖的package包/类
public void process() throws TGFileFormatException {
	try {
		this.manager = this.context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_SONG_MANAGER);
		InputStream stream = this.context.getAttribute(InputStream.class.getName());
		
		TESong teSong = new TEInputStream(stream).readSong();
		TGSong tgSong = this.parseSong(teSong);
		
		this.context.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_SONG, tgSong);
	} catch (Exception e) {
		throw new TGFileFormatException();
	}
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:14,代码来源:TESongStream.java

示例4: parseSong

import org.herac.tuxguitar.io.tef.base.TESong; //导入依赖的package包/类
private TGSong parseSong(TESong song){
	TGSong tgSong = this.manager.newSong();
	
	this.sortComponents(song);
	this.addTracksAndHeaders(tgSong, song.getTracks().length,song.getMeasures(),song.getTempo().getValue());
	this.addMeasureValues(tgSong, song);
	this.addTrackValues(tgSong, song.getTracks());
	this.addComponents(tgSong, song);
	
	return new TGSongAdjuster(this.manager, tgSong).process();
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:12,代码来源:TESongStream.java

示例5: addMeasureValues

import org.herac.tuxguitar.io.tef.base.TESong; //导入依赖的package包/类
private void addMeasureValues(TGSong tgSong, TESong song){
	TGTimeSignature timeSignature = this.manager.getFactory().newTimeSignature();
	for(int i = 0; i < tgSong.countMeasureHeaders(); i ++){
		TGMeasureHeader header = tgSong.getMeasureHeader(i);
		TETimeSignature ts = song.getTimeSignature(i);
		timeSignature.setNumerator( ts.getNumerator() );
		timeSignature.getDenominator().setValue( ts.getDenominator() );
		this.manager.changeTimeSignature(tgSong, header, timeSignature,false);
	}
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:11,代码来源:TESongStream.java

示例6: sortComponents

import org.herac.tuxguitar.io.tef.base.TESong; //导入依赖的package包/类
public void sortComponents(TESong song){
	Collections.sort(song.getComponents(),new Comparator<TEComponent>() {
		public int compare(TEComponent c1, TEComponent c2) {
			if( c1 != null && c2 != null ){
				if ( c1.getMeasure() < c2.getMeasure() ){
					return -1;
				}
				if ( c1.getMeasure() > c2.getMeasure() ){
					return 1;
				}
				if ( c1.getPosition() < c2.getPosition() ){
					return -1;
				}
				if ( c1.getPosition() > c2.getPosition() ){
					return 1;
				}
				if(  ( c1 instanceof TEComponentNote ) && !( c2 instanceof TEComponentNote ) ){
					return -1;
				}
				if(  ( c2 instanceof TEComponentNote ) && !( c1 instanceof TEComponentNote ) ){
					return 1;
				}
			}
			return 0;
		}
	});
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:28,代码来源:TESongStream.java

示例7: parseSong

import org.herac.tuxguitar.io.tef.base.TESong; //导入依赖的package包/类
private TGSong parseSong(TESong song){
	this.sortComponents(song);
	this.newTGSong(song.getTracks().length,song.getMeasures(),song.getTempo().getValue());
	this.addMeasureValues(song);
	this.addTrackValues(song.getTracks());
	this.addComponents(song);
	
	return new TGSongAdjuster(this.manager).process();
}
 
开发者ID:Totallicks,项目名称:totallicks-tuxguitar,代码行数:10,代码来源:TESongImporter.java

示例8: addMeasureValues

import org.herac.tuxguitar.io.tef.base.TESong; //导入依赖的package包/类
private void addMeasureValues(TESong song){
	TGTimeSignature timeSignature = this.manager.getFactory().newTimeSignature();
	for(int i = 0; i < this.manager.getSong().countMeasureHeaders(); i ++){
		TGMeasureHeader header = this.manager.getSong().getMeasureHeader(i);
		TETimeSignature ts = song.getTimeSignature(i);
		timeSignature.setNumerator( ts.getNumerator() );
		timeSignature.getDenominator().setValue( ts.getDenominator() );
		this.manager.changeTimeSignature(header, timeSignature,false);
	}
}
 
开发者ID:Totallicks,项目名称:totallicks-tuxguitar,代码行数:11,代码来源:TESongImporter.java

示例9: sortComponents

import org.herac.tuxguitar.io.tef.base.TESong; //导入依赖的package包/类
public void sortComponents(TESong song){
	Collections.sort(song.getComponents(),new Comparator() {
		public int compare(Object o1, Object o2) {
			if(o1 instanceof TEComponent && o2 instanceof TEComponent){
				TEComponent c1 = (TEComponent)o1;
				TEComponent c2 = (TEComponent)o2;
				
				if ( c1.getMeasure() < c2.getMeasure() ){
					return -1;
				}
				if ( c1.getMeasure() > c2.getMeasure() ){
					return 1;
				}
				if ( c1.getPosition() < c2.getPosition() ){
					return -1;
				}
				if ( c1.getPosition() > c2.getPosition() ){
					return 1;
				}
				if(  ( c1 instanceof TEComponentNote ) && !( c2 instanceof TEComponentNote ) ){
					return -1;
				}
				if(  ( c2 instanceof TEComponentNote ) && !( c1 instanceof TEComponentNote ) ){
					return 1;
				}
			}
			return 0;
		}
	});
}
 
开发者ID:Totallicks,项目名称:totallicks-tuxguitar,代码行数:31,代码来源:TESongImporter.java

示例10: readSong

import org.herac.tuxguitar.io.tef.base.TESong; //导入依赖的package包/类
public TESong readSong(){
	this.song = new TESong();
	
	this.readInfo();
	
	this.song.setMeasures((this.readByte() & 0xff));
	
	this.skip(1);
	this.readTimeSignature();
	
	this.skip(15);
	this.readTempo();
	
	this.song.setRepeats( (this.readByte() & 0xff) );
	
	this.skip(5);
	this.song.setTexts((this.readByte() & 0xff));
	
	this.skip(5);
	this.song.setPercussions((this.readByte() & 0xff));
	this.song.setRhythms((this.readByte() & 0xff));
	
	this.song.setChords((this.readByte() & 0xff));
	
	this.skip(1);
	boolean notes = ((this.readByte() & 0xff) > 0);
	
	this.skip(1);
	this.song.setStrings((this.readByte() & 0xff));
	
	this.song.setTracks((this.readByte() & 0xff) + 1);
	
	this.skip(14);
	this.readComponents();
	this.readRepeats();
	this.readTexts();
	
	this.readPercussions();
	
	this.readChords();
	
	
	this.readRhythms();
	this.readNotes(notes);
	this.readTracks();
	
	this.close();
	
	return this.song;
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:51,代码来源:TEInputStream.java


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