當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。