dguitar.codecs.guitarPro.version4
Class GP4InputStream

java.lang.Object
  extended bydguitar.codecs.guitarPro.GPInputStream
      extended bydguitar.codecs.guitarPro.version4.GP4InputStream
All Implemented Interfaces:
Codec, CodecInputStream

public class GP4InputStream
extends GPInputStream

The class GP4InputStream allows to parse an InputStream containing a file encoded with the Guitar Pro 4 format.

Author:
Mauricio Gracia Gutierrez, Matthieu Wipliez

Field Summary
private static java.lang.String[] supportedVersions
          The versions this parser supports.
 
Fields inherited from class dguitar.codecs.guitarPro.GPInputStream
__fileName, __version
 
Constructor Summary
GP4InputStream(GPInputStream gpIn)
          Creates a new GP4InputStream by cloning an existing GPInputStream.
GP4InputStream(java.io.InputStream in)
          Creates a new GP4InputStream from an existing stream.
 
Method Summary
private  GPBeat readBeat()
          Reads a Guitar Pro beat
private  GPBend readBend()
          Reads a bend from the stream.
private  GPBendPoint readBendPoint()
          Reads a bend point from the stream.
private  GPChordDiagram readChordDiagram()
           
private  GPChordType readChordType()
           
private  GPColor readColor()
          Reads a Guitar Pro color object
private  GPEffectsOnBeat readEffectsOnBeat()
          Reads effects on the current beat from the stream.
private  GPEffectsOnNote readEffectsOnNote()
          Reads effects on the current note from the stream.
private  GPGraceNote readGraceNote()
          The grace notes are stored in the file with 4 variables, written in the followingorder.
private  GPMarker readMarker()
          Read a Guitar Pro marker
private  GPMeasure readMeasure(GPMeasure previous)
          Reads a Guitar Pro measure
private  GPMeasureTrackPair readMeasureTrackPair()
          Reads a measure track pair
private  GPMIDIChannel readMIDIChannel()
          Reads a MIDI Channel from the stream.
private  GPMixTableChange readMixTableChange()
          Reads a mix table change event from the stream.
private  GPNote readNote()
          Reads a Guitar Pro note
 GPSong readPiece()
          Reads a Piece from the stream.
private  GPChordNote readRoot()
           
private  GPTonalityType readTonalityType(int numBytes)
           
private  GPTrack readTrack()
          Reads a Guitar Pro track
static boolean supportedVersion(java.lang.String version)
          This method checks if the String version if supported.
static java.lang.String supportedVersions()
          This methods returns a String with the supported versions separated by '\n'.
 
Methods inherited from class dguitar.codecs.guitarPro.GPInputStream
assertBytesEqualTo, close, dumpBytes, dumpInts, read, read, readBoolean, readByte, readDouble, readFloat, readInt, readLong, readObject, readStringByte, readStringByteMaxLengthPlusOne, readStringInteger, readStringIntegerPlusOne, readUnsignedByte, skip, supportedExtension
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

supportedVersions

private static final java.lang.String[] supportedVersions
The versions this parser supports.

Constructor Detail

GP4InputStream

public GP4InputStream(java.io.InputStream in)
Creates a new GP4InputStream from an existing stream.

Parameters:
in - the original stream.

GP4InputStream

public GP4InputStream(GPInputStream gpIn)
Creates a new GP4InputStream by cloning an existing GPInputStream.

Parameters:
gpIn - the original GPInputStream.
Method Detail

supportedVersion

public static boolean supportedVersion(java.lang.String version)
This method checks if the String version if supported.

Parameters:
version - the version described by a string.
Returns:
true if the version is supported.

supportedVersions

public static java.lang.String supportedVersions()
This methods returns a String with the supported versions separated by '\n'.

Returns:
a string with the supported versions.

Currently this is "FICHIER GUITAR PRO v4.00\nFICHIER GUITAR PRO v4.06\nFICHIER GUITAR PRO L4.06"


readPiece

public GPSong readPiece()
                 throws java.io.IOException,
                        GPFormatException
Reads a Piece from the stream.

Returns:
The Piece read.
Throws:
java.io.IOException
GPFormatException

readBeat

private GPBeat readBeat()
                 throws java.io.IOException,
                        GPFormatException
Reads a Guitar Pro beat

Returns:
the GPBeat that was read
Throws:
java.io.IOException
GPFormatException

readColor

private GPColor readColor()
                   throws java.io.IOException
Reads a Guitar Pro color object

Returns:
the GPColor object read
Throws:
java.io.IOException

readMarker

private GPMarker readMarker()
                     throws java.io.IOException
Read a Guitar Pro marker

Returns:
the GPMarker that was read
Throws:
java.io.IOException

readMeasure

private GPMeasure readMeasure(GPMeasure previous)
                       throws java.io.IOException
Reads a Guitar Pro measure

Parameters:
previous -
Returns:
the GP measure that was read
Throws:
java.io.IOException

readMeasureTrackPair

private GPMeasureTrackPair readMeasureTrackPair()
                                         throws java.io.IOException,
                                                GPFormatException
Reads a measure track pair

Returns:
the GPMeasureTrackPair that was read
Throws:
java.io.IOException
GPFormatException

readMIDIChannel

private GPMIDIChannel readMIDIChannel()
                               throws java.io.IOException
Reads a MIDI Channel from the stream.

Returns:
The MIDI Channel read.
Throws:
java.io.IOException

readNote

private GPNote readNote()
                 throws java.io.IOException
Reads a Guitar Pro note

Returns:
the GPNote object that was read
Throws:
java.io.IOException

readTrack

private GPTrack readTrack()
                   throws java.io.IOException
Reads a Guitar Pro track

Returns:
the track object that was read
Throws:
java.io.IOException

readChordType

private GPChordType readChordType()
                           throws java.io.IOException
Throws:
java.io.IOException

readRoot

private GPChordNote readRoot()
                      throws java.io.IOException
Throws:
java.io.IOException

readTonalityType

private GPTonalityType readTonalityType(int numBytes)
                                 throws java.io.IOException
Throws:
java.io.IOException

readChordDiagram

private GPChordDiagram readChordDiagram()
                                 throws java.io.IOException,
                                        GPFormatException
Throws:
java.io.IOException
GPFormatException

readGraceNote

private GPGraceNote readGraceNote()
                           throws java.io.IOException
The grace notes are stored in the file with 4 variables, written in the followingorder. Fret: byte The fret number the grace note is made from. Dynamic: byte The grace note dynamic is coded like this: - 1: ppp - 2: pp - 3: p - 4: mp - 5: mf - 6: f - 7: ff - 8: fff The default value is 6. Transition: byte this variable determines the transition type used to make the grace note: - 0: None - 1: Slide - 2: Bend - 3: Hammer Duration: byte Determines the grace note duration, coded this way: - 1: Sixteenth note. - 2: Twenty-fourth note. - 3: Thirty-second note.

Throws:
java.io.IOException

readBendPoint

private GPBendPoint readBendPoint()
                           throws java.io.IOException
Reads a bend point from the stream.

Returns:
The BendPoint read.
Throws:
java.io.IOException

readBend

private GPBend readBend()
                 throws java.io.IOException
Reads a bend from the stream.

Returns:
The Bend read.
Throws:
java.io.IOException

readEffectsOnNote

private GPEffectsOnNote readEffectsOnNote()
                                   throws java.io.IOException
Reads effects on the current note from the stream.

Returns:
The EffectsOnNote read.
Throws:
java.io.IOException

readEffectsOnBeat

private GPEffectsOnBeat readEffectsOnBeat()
                                   throws java.io.IOException
Reads effects on the current beat from the stream.

Returns:
The EffectsOnBeat read.
Throws:
java.io.IOException

readMixTableChange

private GPMixTableChange readMixTableChange()
                                     throws java.io.IOException
Reads a mix table change event from the stream.

Returns:
The MixTableChange read.
Throws:
java.io.IOException