dguitar.adaptors.guitarPro
Class GPAdaptor

java.lang.Object
  extended bydguitar.adaptors.guitarPro.GPAdaptor

public class GPAdaptor
extends java.lang.Object

An adaptor to give GP4Piece's the Song interface. Perhaps eventually we may not need this (the classes themselves could implement the interfaces).

Author:
crnash

Field Summary
private static java.lang.String className
           
private static java.util.logging.Logger logger
           
private static int PPQ_HIGH_RESOLUTION
           
private static int PPQ_SCALE_FACTOR
           
 
Constructor Summary
GPAdaptor()
           
 
Method Summary
private static int calculateDuration(GPDuration duration, boolean dotted, int ntuplet)
           
private static RepeatedSongPhrase makeRepeatedSongPhrase(Song song, java.util.ListIterator itM, java.util.ListIterator itMTP, java.util.List tracks)
          Create and return a regular SongMeasure from the current position of the iterators.
static Song makeSong(GPSong piece)
           
private static SongMeasure makeSongMeasure(Song song, java.util.ListIterator itM, java.util.ListIterator itMTP, java.util.List tracks)
          Create and return a regular SongMeasure from the current position of the iterators.
private static SongPhrase phraseFactory(Song song, java.util.ListIterator itM, java.util.ListIterator itMTP, java.util.List tracks)
          Look ahead at the next measure, build and determine a suitable SongPhrase to handle it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

className

private static java.lang.String className

logger

private static java.util.logging.Logger logger

PPQ_HIGH_RESOLUTION

private static final int PPQ_HIGH_RESOLUTION
See Also:
Constant Field Values

PPQ_SCALE_FACTOR

private static final int PPQ_SCALE_FACTOR
See Also:
Constant Field Values
Constructor Detail

GPAdaptor

public GPAdaptor()
Method Detail

makeRepeatedSongPhrase

private static RepeatedSongPhrase makeRepeatedSongPhrase(Song song,
                                                         java.util.ListIterator itM,
                                                         java.util.ListIterator itMTP,
                                                         java.util.List tracks)
                                                  throws GPFormatException
Create and return a regular SongMeasure from the current position of the iterators.

Parameters:
itM - an iterator over the measures collection. It must be pointing so that itM.next() returns the current measure, which will be marked as a repeatStart.
itMTP - an iterator over the measure-track pairs collection. It must be pointing so that itMTP.next() returns the first track of the current measure
tracks - The tracks definitions
Returns:
a new filled-out SongMeasure
Throws:
GP4AdaptorException
GPFormatException

makeSongMeasure

private static SongMeasure makeSongMeasure(Song song,
                                           java.util.ListIterator itM,
                                           java.util.ListIterator itMTP,
                                           java.util.List tracks)
Create and return a regular SongMeasure from the current position of the iterators.

Parameters:
itM - an iterator over the measures collection. It must be pointing so that itM.next() returns the current measure
itMTP - an iterator over the measure-track pairs collection. It must be pointing so that itMTP.next() returns the first track of the current measure
tracks - The tracks definitions
Returns:
a new filled-out SongMeasure
Throws:
GP4AdaptorException

calculateDuration

private static int calculateDuration(GPDuration duration,
                                     boolean dotted,
                                     int ntuplet)
Parameters:
duration -
dotted -
ntuplet -
Returns:
the beat duration

phraseFactory

private static SongPhrase phraseFactory(Song song,
                                        java.util.ListIterator itM,
                                        java.util.ListIterator itMTP,
                                        java.util.List tracks)
                                 throws GPFormatException
Look ahead at the next measure, build and determine a suitable SongPhrase to handle it.

Parameters:
itM - an iterator over the measures collection. It must be pointing so that itM.next() returns the current measure, which will be marked as a repeatStart.
itMTP - an iterator over the measure-track pairs collection. It must be pointing so that itMTP.next() returns the first track of the current measure
tracks - The tracks definitions
Returns:
the next SongPhrase
Throws:
GPFormatException

makeSong

public static Song makeSong(GPSong piece)
                     throws GPFormatException
Parameters:
piece - a loaded GP4 file
Returns:
a representation of the piece that supports the Song interface
Throws:
GP4AdaptorException
GPFormatException