Package guidoengine

Class guidofactory


  • public class guidofactory
    extends java.lang.Object
    The GUIDO Factory provides a set of methods to dynamically create a GUIDO abstract representation. The GUIDO Factory is a state machine that operates on implicit current elements: for example, once you open a voice (OpenVoice()), it becomes the current voice and all subsequent created events are implicitly added to this current voice. The elements of the factory state are:
    • the current score: modified by OpenMusic() and CloseMusic()
    • the current voice: modified by OpenVoice() and CloseVoice()
    • the current chord: modified by OpenChord() and CloseChord()
    • the current event: modified by OpenEvent() and CloseEvent()
    • the current tag: modified by OpenTag() and CloseTag()
    • Field Summary

      Fields 
      Modifier and Type Field Description
      long fFactoryHandler  
    • Constructor Summary

      Constructors 
      Constructor Description
      guidofactory()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      int AddFlat()
      Add a flat to the current event.
      int AddSharp()
      Adds a sharp to the current event.
      int AddTagParameterFloat​(double val)
      Adds a new floating-point parameter to the current tag.
      int AddTagParameterInt​(int val)
      Adds a new integer parameter to the current tag.
      int AddTagParameterString​(java.lang.String val)
      Adds a new string parameter to the current tag.
      void Close()
      Closes the Guido Factory.
      int CloseChord()
      Closes the current chord.
      int CloseEvent()
      Closes the current event.
      long CloseMusic()
      Closes the current music score.
      int CloseTag()
      Closes the current tag.
      int CloseVoice()
      Closes the current voice.
      int EndTag()
      Indicates the end of a range tag.
      protected static void Init()
      Internal jni initialization method.
      int InsertCommata()
      Begins a new chord note commata.
      int IsRangeTag()
      int Open()
      Opens the Guido Factory.
      int OpenChord()
      Creates and open a new chord.
      int OpenEvent​(java.lang.String eventName)
      Creates and opens a new event (note or rest).
      int OpenMusic()
      Creates and opens a new music score.
      int OpenRangeTag​(java.lang.String tagName, long tagID)
      Add a range tag to the current voice.
      int OpenTag​(java.lang.String tagName, long tagID)
      Add a tag to the current voice.
      int OpenVoice()
      Creates and opens a new voice.
      int SetDuration​(int numerator, int denominator)
      Sets the duration of the current event.
      int SetEventAccidentals​(int accident)
      Sets the accidentals of the current event.
      int SetEventDots​(int dots)
      Sets the number of dots of the current event.
      int SetOctave​(int octave)
      Sets the octave of the current event.
      int SetParameterName​(java.lang.String name)
      Defines the name (when applicable) of the last added tag-parameter
      int SetParameterUnit​(java.lang.String unit)
      Defines the unit of the last added tag-parameter
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • fFactoryHandler

        public final long fFactoryHandler
    • Constructor Detail

      • guidofactory

        public guidofactory()
    • Method Detail

      • Open

        public final int Open()
        Opens the Guido Factory. Must be called before any other call to the Guido Factory API.
        Returns:
        an integer that is an error code if not null.
      • Close

        public final void Close()
        Closes the Guido Factory. Must be called to release the factory associated resources.
      • OpenMusic

        public final int OpenMusic()
        Creates and opens a new music score. The function modifies the factory state: the new score becomes the current factory score. It fails if a music score is already opened. A music score has to be closed using CloseMusic()
        Returns:
        an integer that is an error code if not null.
        See Also:
        CloseMusic()
      • CloseMusic

        public final long CloseMusic()
        Closes the current music score. The function modifies the factory state if a music score is currently opened: the current factory score is set to null. It fails if no music score is opened. You must not have pending events nor pending voice at this point. The logicical music layout (conversion from abstract to abstract representation) is part of the function operations.
        Returns:
        a GUIDO handler to the new AR structure, or 0. This handler may be used to build a new guidoscore.
        See Also:
        OpenMusic()
      • OpenVoice

        public final int OpenVoice()
        Creates and opens a new voice. The function modifies the factory state: the new voice becomes the current factory voice. It fails if a voice is already opened. A voice has to be closed using CloseVoice() Voices are similar to sequence is GMN.
        Returns:
        an error code
        See Also:
        CloseVoice()
      • CloseVoice

        public final int CloseVoice()
        Closes the current voice. The function modifies the factory state if a voice is currently opened: the current factory voice is set to null. It fails if no voice is opened. You must not have pending events at this point. The voice is first converted to its normal form and next added to the current score.
        Returns:
        an error code
        See Also:
        OpenVoice()
      • OpenChord

        public final int OpenChord()
        Creates and open a new chord. The function modifies the factory state: the new chord becomes the current factory chord. It fails if a chord is already opened. A chord has to be closed using CloseChord()
        Returns:
        an error code
        See Also:
        CloseChord()
      • CloseChord

        public final int CloseChord()
        Closes the current chord. The function modifies the factory state if a chord is currently opened: the current factory chord is set to null. It fails if no chord is opened. The chord is added to the current voice.
        Returns:
        an error code
        See Also:
        OpenChord()
      • InsertCommata

        public final int InsertCommata()
        Begins a new chord note commata. Called to tell the factory that a new chord-voice is beginning. This is important for the ranges that need to be added (dispdur and shareStem)
        Returns:
        an error code
      • OpenEvent

        public final int OpenEvent​(java.lang.String eventName)
        Creates and opens a new event (note or rest). The function modifies the factory state: the new event becomes the current factory event. It fails if an event is already opened. An event has to be closed using CloseEvent()
        Parameters:
        eventName - a note, rest or empty name confroming to the GMN format
        Returns:
        an error code
        See Also:
        CloseEvent()
      • CloseEvent

        public final int CloseEvent()
        Closes the current event. The function modifies the factory state if an event is currently opened: the current factory event is set to null. It fails if no event is opened. The event is added to the current voice.
        Returns:
        an error code
        See Also:
        OpenEvent(java.lang.String)
      • AddSharp

        public final int AddSharp()
        Adds a sharp to the current event. The current event must be a note.
        Returns:
        an error code
      • AddFlat

        public final int AddFlat()
        Add a flat to the current event. The current event must be a note.
        Returns:
        an error code.
      • SetEventDots

        public final int SetEventDots​(int dots)
        Sets the number of dots of the current event.
        Parameters:
        dots - the number of dots to be carried by the current event.
        Returns:
        an error code.
      • SetEventAccidentals

        public final int SetEventAccidentals​(int accident)
        Sets the accidentals of the current event.
        Parameters:
        accident - positive values are used for sharp and negative values for flats
        Returns:
        an error code.
      • SetOctave

        public final int SetOctave​(int octave)
        Sets the octave of the current event. The current event must be a note. The octave number becomes the current octave i.e. next notes will carry this octave number until otherwise specified.
        Parameters:
        octave - is an integer value indicating the octave of the note where a1 is A 440Hz. All octaves start with the pitch class c.
        Returns:
        an error code.
      • SetDuration

        public final int SetDuration​(int numerator,
                                     int denominator)
        Sets the duration of the current event. Durations are expressed as fractional value of a whole note: e.g. a quarter note duration is 1/4. The duration becomes the current duration i.e. next notes will carry this duration until otherwise specified.
        Parameters:
        numerator - the rational duration numerator
        denominator - the rational duration denominator
        Returns:
        an error code.
      • OpenTag

        public final int OpenTag​(java.lang.String tagName,
                                 long tagID)
        Add a tag to the current voice.
        Parameters:
        tagName - the tag name
        tagID - is the number that the parser generates for advanced GUIDO ?????
        Returns:
        an error code.
      • OpenRangeTag

        public final int OpenRangeTag​(java.lang.String tagName,
                                      long tagID)
        Add a range tag to the current voice.
        Parameters:
        tagName - the tag name
        tagID - a tag identifier
        Returns:
        an error code.
      • EndTag

        public final int EndTag()
        Indicates the end of a range tag. The function is applied to the current tag. It must be called when the end of a tag's range has been reached. If the tag has no range, it must be called directly after CloseTag(). With the following examples:
        • staff<1> c d : call EndTag() after CloseTag() and before creating the c note
        • slur(c d e) f : call EndTag() before creating the f note
        Returns:
        an error code.
      • CloseTag

        public final int CloseTag()
        Closes the current tag. The function is applied to the current tag. Must be called after adding parameter and before the range. With the following examples:
        • tag<1,2,3>(c d e ) : call CloseTag(), next IsRangeTag() creating the c d e notes and call EndTag()
        • tag<1,2> c d : call CloseTag() before creating the c note
        Returns:
        an error code.
      • AddTagParameterString

        public final int AddTagParameterString​(java.lang.String val)
        Adds a new string parameter to the current tag.
        Parameters:
        val - the string parameter value
        Returns:
        an error code.
      • AddTagParameterInt

        public final int AddTagParameterInt​(int val)
        Adds a new integer parameter to the current tag.
        Parameters:
        val - the parameter value
        Returns:
        an error code.
      • AddTagParameterFloat

        public final int AddTagParameterFloat​(double val)
        Adds a new floating-point parameter to the current tag.
        Parameters:
        val - the parameter value
        Returns:
        an error code.
      • SetParameterName

        public final int SetParameterName​(java.lang.String name)
        Defines the name (when applicable) of the last added tag-parameter
        Parameters:
        name - the tag parameter name
        Returns:
        an error code.
      • SetParameterUnit

        public final int SetParameterUnit​(java.lang.String unit)
        Defines the unit of the last added tag-parameter
        Parameters:
        unit - a string defining the unit. The following units are supported:
        • m - meter
        • cm - centimeter
        • mm - millimeter
        • in - inch
        • pt - point (= 1/72.27 inch)
        • pc - pica (= 12pt)
        • hs - halfspace (half of the space between two lines of the current staff)
        • rl - relative measure in percent (used for positioning on score page)
        Returns:
        an error code.
      • Init

        protected static void Init()
        Internal jni initialization method. Automatically called at package init.