当前位置: 首页>>代码示例>>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;未经允许,请勿转载。