~ubuntu-branches/ubuntu/oneiric/tuxguitar/oneiric

« back to all changes in this revision

Viewing changes to TuxGuitar-midi/src/org/herac/tuxguitar/io/midi/base/MidiSequence.java

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2008-06-19 00:30:30 UTC
  • mto: (5.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20080619003030-h719szrhsngou7c6
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.herac.tuxguitar.io.midi.base;
 
2
 
 
3
import java.util.ArrayList;
 
4
import java.util.List;
 
5
 
 
6
public class MidiSequence {
 
7
        
 
8
        public static final float PPQ = 0.0f;
 
9
        public static final float SMPTE_24 = 24.0f;
 
10
        public static final float SMPTE_25 = 25.0f;
 
11
        public static final float SMPTE_30DROP = 29.97f;
 
12
        public static final float SMPTE_30 = 30.0f;
 
13
        
 
14
        protected float divisionType;
 
15
        protected int resolution;
 
16
        private List tracks;
 
17
        
 
18
        public MidiSequence(float divisionType, int resolution){
 
19
                this.divisionType = divisionType;
 
20
                this.resolution = resolution;
 
21
                this.tracks = new ArrayList();
 
22
        }
 
23
        
 
24
        public void addTrack(MidiTrack track){
 
25
                this.tracks.add(track);
 
26
        }
 
27
        
 
28
        public MidiTrack getTrack(int index){
 
29
                return (MidiTrack)this.tracks.get(index);
 
30
        }
 
31
        
 
32
        public int countTracks(){
 
33
                return this.tracks.size();
 
34
        }
 
35
        
 
36
        public float getDivisionType() {
 
37
                return this.divisionType;
 
38
        }
 
39
        
 
40
        public int getResolution() {
 
41
                return this.resolution;
 
42
        }
 
43
        
 
44
        public void sort(){
 
45
                for(int i = 0; i < this.tracks.size(); i ++){
 
46
                        MidiTrack track = (MidiTrack)this.tracks.get(i);
 
47
                        track.sort();
 
48
                }
 
49
        }
 
50
        
 
51
        public void finish(){
 
52
                for(int i = 0; i < this.tracks.size(); i ++){
 
53
                        MidiTrack track = (MidiTrack)this.tracks.get(i);
 
54
                        track.add(new MidiEvent(MidiMessage.metaMessage(47,new byte[]{}),track.ticks()));
 
55
                        track.sort();
 
56
                }
 
57
        }
 
58
}
 
59
 
 
 
b'\\ No newline at end of file'