當前位置: 首頁>>代碼示例>>Java>>正文


Java TETrack類代碼示例

本文整理匯總了Java中org.herac.tuxguitar.io.tef.base.TETrack的典型用法代碼示例。如果您正苦於以下問題:Java TETrack類的具體用法?Java TETrack怎麽用?Java TETrack使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TETrack類屬於org.herac.tuxguitar.io.tef.base包,在下文中一共展示了TETrack類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addComponents

import org.herac.tuxguitar.io.tef.base.TETrack; //導入依賴的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: addNote

import org.herac.tuxguitar.io.tef.base.TETrack; //導入依賴的package包/類
private void addNote(TETrack track,TEComponentNote note,int string,int strings,TGMeasure tgMeasure){
	int value = note.getFret();
	if(track.isPercussion() ){
		int tuning = (Math.min( (strings - 2) ,(PERCUSSION_TUNINGS.length )) - 1);
		if(string >= 0 && string < PERCUSSION_TUNINGS[tuning].length){
			value += PERCUSSION_TUNINGS[tuning][string];
		}
	}
	
	TGNote tgNote = this.manager.getFactory().newNote();
	tgNote.setString( string + 1 );
	tgNote.setValue( value );
	
	TGDuration tgDuration = getDuration( note.getDuration() );
	TGBeat tgBeat = getBeat(tgMeasure, getStart(tgDuration, tgMeasure, note.getPosition()));
	tgBeat.getVoice(0).getDuration().copyFrom(tgDuration);
	tgBeat.getVoice(0).addNote(tgNote);
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:19,代碼來源:TESongStream.java

示例3: addTrackValues

import org.herac.tuxguitar.io.tef.base.TETrack; //導入依賴的package包/類
private void addTrackValues(TETrack[] tracks){
	for(int i = 0; i < tracks.length; i ++){
		TGTrack track = this.manager.getSong().getTrack(i);
		track.getChannel().setVolume((short)((  (15 - tracks[i].getVolume()) * 127) / 15));
		track.getChannel().setBalance((short)(( tracks[i].getPan() * 127) / 15));
		track.getChannel().setInstrument((short)tracks[i].getInstrument());
		if(tracks[i].isPercussion()){
			TGChannel.setPercussionChannel(track.getChannel());
		}
		track.getStrings().clear();
		int strings[] = tracks[i].getStrings();
		
		for(int j = 0; j < strings.length;j ++){
			if(j >= 7){
				break;
			}
			TGString string = this.manager.getFactory().newString();
			string.setNumber( (j + 1) );
			string.setValue( (tracks[i].isPercussion() ?0:(96 - strings[j])) );
			track.getStrings().add(string);
		}
	}
}
 
開發者ID:Totallicks,項目名稱:totallicks-tuxguitar,代碼行數:24,代碼來源:TESongImporter.java

示例4: addComponents

import org.herac.tuxguitar.io.tef.base.TETrack; //導入依賴的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

示例5: addNote

import org.herac.tuxguitar.io.tef.base.TETrack; //導入依賴的package包/類
private void addNote(TETrack track,TEComponentNote note,int string,int strings,TGMeasure tgMeasure){
	int value = note.getFret();
	if(track.isPercussion() ){
		int tuning = (Math.min( (strings - 2) ,(PERCUSSION_TUNINGS.length )) - 1);
		if(string >= 0 && string < PERCUSSION_TUNINGS[tuning].length){
			value += PERCUSSION_TUNINGS[tuning][string];
		}
	}
	
	TGNote tgNote = this.manager.getFactory().newNote();
	tgNote.setString( string + 1 );
	tgNote.setValue( value );
	
	TGDuration tgDuration = getDuration( note.getDuration() );
	TGBeat tgBeat = getBeat(tgMeasure, getStart(tgDuration, tgMeasure, note.getPosition()));
	tgDuration.copy(tgBeat.getVoice(0).getDuration());
	tgBeat.getVoice(0).addNote(tgNote);
}
 
開發者ID:Totallicks,項目名稱:totallicks-tuxguitar,代碼行數:19,代碼來源:TESongImporter.java

示例6: addTrackValues

import org.herac.tuxguitar.io.tef.base.TETrack; //導入依賴的package包/類
private void addTrackValues(TGSong tgSong, TETrack[] tracks){
	for(int i = 0; i < tracks.length; i ++){
		TGTrack track = tgSong.getTrack(i);
		
		TGChannel tgChannel = this.manager.addChannel(tgSong);
		tgChannel.setVolume((short)((  (15 - tracks[i].getVolume()) * 127) / 15));
		tgChannel.setBalance((short)(( tracks[i].getPan() * 127) / 15));
		tgChannel.setProgram((short)tracks[i].getInstrument());
		tgChannel.setBank( tracks[i].isPercussion() ? TGChannel.DEFAULT_PERCUSSION_BANK : TGChannel.DEFAULT_BANK);
		tgChannel.setName(this.manager.createChannelNameFromProgram(tgSong, tgChannel));
		
		track.setChannelId(tgChannel.getChannelId());
		
		track.getStrings().clear();
		int strings[] = tracks[i].getStrings();
		
		for(int j = 0; j < strings.length;j ++){
			if(j >= 7){
				break;
			}
			TGString string = this.manager.getFactory().newString();
			string.setNumber( (j + 1) );
			string.setValue( (tracks[i].isPercussion() ?0:(96 - strings[j])) );
			track.getStrings().add(string);
		}
	}
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:28,代碼來源:TESongStream.java

示例7: readTracks

import org.herac.tuxguitar.io.tef.base.TETrack; //導入依賴的package包/類
private void readTracks(){
	for(int i = 0; i < this.song.getTracks().length; i ++){
		int[] strings = new int[this.readByte()];
		
		this.skip(5);
		int type = this.readByte();
		
		this.skip(1);
		int instrument = this.readByte();
		
		this.skip(3);
		int capo = this.readByte();
		
		this.skip(1);
		
		int clefType = this.readByte();
		int clefNumber = this.readByte();
		
		this.skip(1);
		
		int pan = this.readByte();
		int volume = this.readByte();
		int flags = this.readByte();
		
		for(int string = 0; string < strings.length; string ++){
			strings[string] = (this.readByte() & 0xff);
		}
		this.skip(12 - strings.length);
		
		String name = new String(this.readBytes(16));
		
		this.song.setTrack(i,new TETrack( (type == 98),instrument,capo, clefType, clefNumber, pan, volume, flags, strings, name));
		this.skip(2);
	}
}
 
開發者ID:theokyr,項目名稱:TuxGuitar-1.3.1-fork,代碼行數:36,代碼來源:TEInputStream.java


注:本文中的org.herac.tuxguitar.io.tef.base.TETrack類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。