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


Java MidiTrack.size方法代码示例

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


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

示例1: writeTrack

import org.herac.tuxguitar.io.midi.base.MidiTrack; //导入方法依赖的package包/类
private static int writeTrack(MidiTrack track,DataOutputStream out)throws IOException{
	int length = 0;
	if (out != null){
		out.writeInt(TRACK_MAGIC);
	}
	if (out != null){
		out.writeInt( writeTrack(track, null) );
	}
	MidiEvent previous = null;
	for (int i = 0; i < track.size(); i++){
		MidiEvent event = track.get(i);
		length += writeEvent(event,previous,out);
		previous = event;
	}
	return length;
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:17,代码来源:MidiFileWriter.java

示例2: importSong

import org.herac.tuxguitar.io.midi.base.MidiTrack; //导入方法依赖的package包/类
public TGSong importSong() throws TGFileFormatException {
	try {
		if(this.settings == null || this.factory == null || this.stream == null ){
			return null;
		}
		MidiSequence sequence = new MidiFileReader().getSequence(this.stream);
		initFields(sequence);
		for(int i = 0; i < sequence.countTracks(); i++){
			MidiTrack track = sequence.getTrack(i);
			int trackNumber = getNextTrackNumber();
			int events = track.size();
			for(int j = 0;j < events;j ++){
				MidiEvent event = track.get(j);
				parseMessage(trackNumber,event.getTick(),event.getMessage());
			}
		}
		checkAll();
		
		TGSong song = this.factory.newSong();
		
		Iterator headers = this.headers.iterator();
		while(headers.hasNext()){
			song.addMeasureHeader((TGMeasureHeader)headers.next());
		}
		Iterator tracks = this.tracks.iterator();
		while(tracks.hasNext()){
			song.addTrack((TGTrack)tracks.next());
		}
		return new SongAdjuster(this.factory,song).adjustSong();
	} catch (Throwable throwable) {
		throw new TGFileFormatException(throwable);
	}
}
 
开发者ID:Totallicks,项目名称:totallicks-tuxguitar,代码行数:34,代码来源:MidiSongImporter.java

示例3: process

import org.herac.tuxguitar.io.midi.base.MidiTrack; //导入方法依赖的package包/类
public void process() throws TGFileFormatException {
	try {			
		InputStream stream = this.context.getAttribute(InputStream.class.getName());
		TGSongManager tgSongManager = this.context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_SONG_MANAGER);
		
		this.factory = tgSongManager.getFactory();
		this.settings = this.context.getAttribute(MidiSettings.class.getName());
		if( this.settings == null ) {
			this.settings = MidiSettings.getDefaults();
		}
		
		MidiSequence sequence = new MidiFileReader().getSequence(stream);
		initFields(sequence);
		for(int i = 0; i < sequence.countTracks(); i++){
			MidiTrack track = sequence.getTrack(i);
			int trackNumber = getNextTrackNumber();
			int events = track.size();
			for(int j = 0;j < events;j ++){
				MidiEvent event = track.get(j);
				parseMessage(trackNumber,event.getTick(),event.getMessage());
			}
		}
		
		TGSong tgSong = this.factory.newSong();
		
		this.checkAll(tgSongManager);
		
		Iterator<TGChannel> channels = this.channels.iterator();
		while(channels.hasNext()){
			tgSong.addChannel((TGChannel)channels.next());
		}
		Iterator<TGMeasureHeader> headers = this.headers.iterator();
		while(headers.hasNext()){
			tgSong.addMeasureHeader((TGMeasureHeader)headers.next());
		}
		Iterator<TGTrack> tracks = this.tracks.iterator();
		while(tracks.hasNext()){
			tgSong.addTrack((TGTrack)tracks.next());
		}
		
		this.context.setAttribute(TGDocumentContextAttributes.ATTRIBUTE_SONG, new SongAdjuster(this.factory, tgSong).adjustSong());
	} catch (Throwable throwable) {
		throw new TGFileFormatException(throwable);
	}
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:46,代码来源:MidiSongImporter.java


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