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