~ubuntu-branches/ubuntu/lucid/tuxguitar/lucid-updates

« back to all changes in this revision

Viewing changes to TuxGuitar-gtp/src/org/herac/tuxguitar/io/gtp/GP1InputStream.java

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2009-04-25 19:49:27 UTC
  • mfrom: (1.1.3 upstream) (2.1.7 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090425194927-pblqed0zxp0pmyeq
Tags: 1.1-1
* New Upstream Release (Closes: #489859) (LP: #366476)
* Merged patch : tuxguitar_1.0.dak-1ubuntu1.patch
* debian/README.txt
  - suggests to install tuxguitar-jsa

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
import java.util.Iterator;
5
5
 
6
6
import org.herac.tuxguitar.io.base.TGFileFormat;
7
 
import org.herac.tuxguitar.io.base.TGInputStreamBase;
8
7
import org.herac.tuxguitar.song.managers.TGSongManager;
9
8
import org.herac.tuxguitar.song.models.TGBeat;
10
9
import org.herac.tuxguitar.song.models.TGChord;
20
19
import org.herac.tuxguitar.song.models.TGTimeSignature;
21
20
import org.herac.tuxguitar.song.models.TGTrack;
22
21
import org.herac.tuxguitar.song.models.TGVelocities;
 
22
import org.herac.tuxguitar.song.models.TGVoice;
23
23
import org.herac.tuxguitar.song.models.effects.TGEffectBend;
24
24
import org.herac.tuxguitar.song.models.effects.TGEffectHarmonic;
25
25
 
28
28
 * 
29
29
 * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates
30
30
 */
31
 
public class GP1InputStream extends GTPInputStream implements TGInputStreamBase {
 
31
public class GP1InputStream extends GTPInputStream {
32
32
        
33
33
        private static final String SUPPORTED_VERSIONS[] = new String[]{
34
34
                "FICHIER GUITARE PRO v1", "FICHIER GUITARE PRO v1.01","FICHIER GUITARE PRO v1.02", "FICHIER GUITARE PRO v1.03","FICHIER GUITARE PRO v1.04"
47
47
        
48
48
        private int trackCount;
49
49
        
50
 
        public GP1InputStream(){
51
 
                super(SUPPORTED_VERSIONS);
 
50
        public GP1InputStream(GTPSettings settings){
 
51
                super(settings, SUPPORTED_VERSIONS);
52
52
        }
53
53
        
54
54
        public TGFileFormat getFileFormat(){
185
185
                readInt();
186
186
                
187
187
                TGBeat beat = getFactory().newBeat();
 
188
                TGVoice voice = beat.getVoice(0);
188
189
                TGDuration duration = readDuration();
189
190
                TGNoteEffect effect = getFactory().newEffect();
190
191
                
216
217
                        if(lastReadedStart < start){
217
218
                                TGBeat previousBeat = getBeat(track, measure, lastReadedStart);
218
219
                                if(previousBeat != null){
219
 
                                        Iterator it = previousBeat.getNotes().iterator();
 
220
                                        TGVoice previousVoice = previousBeat.getVoice(0);
 
221
                                        Iterator it = previousVoice.getNotes().iterator();
220
222
                                        while(it.hasNext()){
221
223
                                                TGNote previous = (TGNote)it.next();
222
224
                                                TGNote note = getFactory().newNote();
225
227
                                                note.setVelocity(previous.getVelocity());
226
228
                                                note.setTiedNote(true);
227
229
                                                
228
 
                                                beat.addNote(note);
 
230
                                                voice.addNote(note);
229
231
                                        }
230
232
                                }
231
233
                        }
248
250
                                        note.setEffect(effect.clone(getFactory()));
249
251
                                        note.getEffect().setDeadNote(  (fret < 0 || fret >= 100)  );
250
252
                                        
251
 
                                        beat.addNote(note);
 
253
                                        voice.addNote(note);
252
254
                                }
253
255
                        }
254
256
                }
255
257
                
256
258
                beat.setStart(start);
257
 
                duration.copy(beat.getDuration());
 
259
                voice.setEmpty(false);
 
260
                duration.copy(voice.getDuration());
258
261
                measure.addBeat(beat);
259
262
                
260
263
                return duration.getTime();
310
313
                if (getVersionIndex() > 2) {
311
314
                        readInt(); // Number of frets
312
315
                        track.setName(readStringByteSizeOfByte());
313
 
                        track.getChannel().setSolo(readBoolean());
 
316
                        track.setSolo(readBoolean());
314
317
                        track.getChannel().setVolume((short)readInt());
315
318
                        track.getChannel().setBalance((short)readInt());
316
319
                        track.getChannel().setChorus((short)readInt());