Package guidoengine

Class guidoscorebase

  • Direct Known Subclasses:
    guidoscore

    public class guidoscorebase
    extends java.lang.Object
    The main score API.
    A guido score has an internal abstract representation (AR) that is converted into a graphic representation (GR). The guidoscore reflects this architecture and provices the method to convert an AR representation to GR representation.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.String AbstractExport​(int pagenum)
      Exports a graphic representation to a abstract representation format.
      int AR2GR()
      Converts an AR representation into a GR representation On output, fGRHandler contains a handler to the Guido GR representation.
      int AR2GR​(guidolayout layout)
      Converts an AR representation into a GR representation Makes use of the Guido Engine settings given as argument.
      int AR2MIDIFile​(java.lang.String filename, guido2midiparams params)
      Exports an AR representation to a MIDI file
      byte[] BinaryExport​(int pagenum)
      Exports a graphic representation to internal binary format.
      void close()
      close a score The close method must be called to notify the Guido Engine that the associated ressources can be released.
      int CloseParser()
      Close the parser.
      int CloseStream()
      Close the stream.
      int CountVoices()
      Give the score count of voices.
      void DrawBoundingBoxes​(int bbMap)
      Control bounding boxes drawing.
      int File2AR​(java.lang.String file)
      Parse a file and create the corresponding Abstract Representation.
      int FindEventPage​(guidodate date)  
      int FindPageAt​(guidodate date)
      Find a page at a given date.
      void FreeAR()
      Tells the engine to release the AR representation handler.
      void FreeGR()
      Tells the engine to release the GR representation handler.
      long getARHandler()
      Get the reference to an Abstract Representation.
      int GetDrawBoundingBoxes()
      Gives the drawn bounding boxes set.
      int GetDuration​(guidodate date)
      Give the score duration.
      int GetMap​(int page, float width, float height, int selector, mapcollector f)
      Retrieves the graphic to time RAW mapping
      int GetPageCount()
      Give the score pages count.
      int GetPageDate​(int pagenum, guidodate date)
      Give a page date.
      void GetPageFormat​(int pagenum, guidopageformat pf)
      Retrieve the format of a given page.
      int GetPageMap​(int page, float width, float height, guidoscoremapbase map)
      Gives the adjusted page mapping
      int GetRAWStaffMap​(int page, float width, float height, int staff, guidoscoremapbase map)
      Retrieves the graphic to time RAW mapping of a defined staff
      int GetRAWSystemMap​(int page, float width, float height, guidoscoremapbase map)
      Retrieves the graphic to time RAW mapping of the systems
      int GetRAWVoiceMap​(int page, float width, float height, int voice, guidoscoremapbase map)
      Retrieves the graphic to time RAW mapping of a defined voice
      int GetStaffMap​(int page, float width, float height, int staff, guidoscoremapbase map)
      Gives the adjusted staff mapping
      java.lang.String GetStream()
      Get the content of the guidoStream.
      int GetSystemCount​(int page)
      Give the system count of a page.
      int GetSystemMap​(int page, float width, float height, guidoscoremapbase map)
      Gives the adjusted system mapping
      int GetTimeMap​(timemapcollector f)
      Retrieves the wrapped to unwrapped time mapping
      int GetVoiceMap​(int page, float width, float height, int voice, guidoscoremapbase map)
      Gives the adjusted voice mapping
      java.lang.String GR2SVG​(int page, boolean embedFont, java.lang.String font, int mappingMode)
      Exports one page of score to SVG.
      java.lang.String GR2SVG​(int page, int w, int h, boolean embedFont)
      Exports one page of score to SVG.
      protected static void Init()
      Internal jni initialization method.
      int MarkVoice​(int voicenum, guidodate date, guidodate duration, int red, int green, int blue)
      Force the color of all notes of a voice in a given time interval.
      void OpenParser()
      Open a new Parser.
      void OpenStream()
      Open a new stream.
      int ParseFile​(java.lang.String filename)
      Deprecated.
      replaced by File2AR(String)
      parserError ParserGetErrorCode()
      Get a parser error if an error occurs after use File2AR, String2AR or Stream2AR.
      int ParseString​(java.lang.String gmn)
      Deprecated.
      replaced by String2AR(String)
      int ResetStream()
      Reset the content of the stream.
      int ResizePageToMusic()
      Resize the page sizes to the music size.
      int Stream2AR()
      Parse the gmnCode in the stream (@see OpenStream()) and create the corresponding Abstract Representation.
      int String2AR​(java.lang.String gmnCode)
      Parse the gmnCode and create the corresponding Abstract Representation.
      java.lang.String SVGExport​(int pagenum, java.lang.String fontFile)
      Deprecated.
      java.lang.String SVGExportWithFontSpec​(int pagenum, java.lang.String fontFile, java.lang.String fontSpec)
      Deprecated.
      int UpdateGR()
      Updates a GR representation Should be called for example after changing the default page format.
      int UpdateGR​(guidolayout layout)
      Updates a GR representation Makes use of the Guido Engine settings given as argument.
      int WriteStream​(java.lang.String gmnCode)
      Write a string in the stream.
      • Methods inherited from class java.lang.Object

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

      • guidoscorebase

        public guidoscorebase()
      • guidoscorebase

        public guidoscorebase​(long ar)
    • Method Detail

      • getARHandler

        public long getARHandler()
        Get the reference to an Abstract Representation.
        Returns:
        the current ARHandler
      • ParseFile

        @Deprecated
        public final int ParseFile​(java.lang.String filename)
        Deprecated.
        replaced by File2AR(String)
        Parse a guido file On output, fARHandler contains a handler to the Guido AR representation.
        Parameters:
        filename - the file name
        Returns:
        an error code.
      • ParseString

        @Deprecated
        public final int ParseString​(java.lang.String gmn)
        Deprecated.
        replaced by String2AR(String)
        Parse a guido string On output, fARHandler contains a handler to the Guido AR representation.
        Parameters:
        gmn - a string containing GMN code
        Returns:
        an error code.
        See Also:
        "The GUIDO Music Notation Format"
      • AR2GR

        public final int AR2GR()
        Converts an AR representation into a GR representation On output, fGRHandler contains a handler to the Guido GR representation.
        Returns:
        an error code.
      • AR2GR

        public final int AR2GR​(guidolayout layout)
        Converts an AR representation into a GR representation Makes use of the Guido Engine settings given as argument. On output, fGRHandler contains a handler to the Guido GR representation.
        Parameters:
        layout - layout settings
        Returns:
        an error code.
        See Also:
        guidolayout
      • AR2MIDIFile

        public final int AR2MIDIFile​(java.lang.String filename,
                                     guido2midiparams params)
        Exports an AR representation to a MIDI file
        Parameters:
        filename - the MIDI file name
        params - MIDI export settings
        Returns:
        an error code.
        See Also:
        guido2midiparams
      • AbstractExport

        public final java.lang.String AbstractExport​(int pagenum)
        Exports a graphic representation to a abstract representation format.
        Parameters:
        pagenum - the page to be exported
        Returns:
        the String with the draw command and their parameters.
      • BinaryExport

        public final byte[] BinaryExport​(int pagenum)
        Exports a graphic representation to internal binary format. The byte array can be read with guidobinaryparser.
        Parameters:
        pagenum - the page to be exported
        Returns:
        a byte array with the draw command and the parameters or a null object if an error occurs.
      • GR2SVG

        public final java.lang.String GR2SVG​(int page,
                                             boolean embedFont,
                                             java.lang.String font,
                                             int mappingMode)
        Exports one page of score to SVG.
        Parameters:
        page - the page number.
        embedFont - a boolean value. When true, the default svg guido font is embedded to the SVG.
        font - font path of the guido svg font file (ignored when embedFont is true)
        mappingMode - the mapping mode (see GuidoMapping).
        Returns:
        a String with the svg code or a null object if an error occurs.
      • GR2SVG

        public final java.lang.String GR2SVG​(int page,
                                             int w,
                                             int h,
                                             boolean embedFont)
        Exports one page of score to SVG.
        Parameters:
        page - the page number.
        w - the drawing area width
        h - the drawing area height
        embedFont - a boolean value. When true, the default svg guido font is embedded to the SVG.
        Returns:
        a String with the svg code or a null object if an error occurs.
      • SVGExport

        @Deprecated
        public final java.lang.String SVGExport​(int pagenum,
                                                java.lang.String fontFile)
        Deprecated.
        Exports a graphic representation to SVG
        Parameters:
        pagenum - the page to be exported
        fontFile - an optional Guido SVG font file (could be empty when there is no SVG font)
        Returns:
        a string containing the corresponding SVG code.
      • SVGExportWithFontSpec

        @Deprecated
        public final java.lang.String SVGExportWithFontSpec​(int pagenum,
                                                            java.lang.String fontFile,
                                                            java.lang.String fontSpec)
        Deprecated.
        Exports a graphic representation to SVG with a font spec
        Parameters:
        pagenum - the page to be exported
        fontFile - an optional Guido SVG font file (could be empty when there is no SVG font)
        fontSpec - an optional Guido SVG font spec, meaning a SVG file read into the string...will be big (could be empty when there is no SVG font)
        Returns:
        a string containing the corresponding SVG code.
      • UpdateGR

        public final int UpdateGR()
        Updates a GR representation Should be called for example after changing the default page format.
        Returns:
        an error code.
      • UpdateGR

        public final int UpdateGR​(guidolayout layout)
        Updates a GR representation Makes use of the Guido Engine settings given as argument.
        Parameters:
        layout - layout settings
        Returns:
        an error code.
        See Also:
        guidolayout
      • ResizePageToMusic

        public final int ResizePageToMusic()
        Resize the page sizes to the music size.
        Returns:
        an error code.
      • FreeAR

        public final void FreeAR()
        Tells the engine to release the AR representation handler.
      • FreeGR

        public final void FreeGR()
        Tells the engine to release the GR representation handler.
      • GetPageFormat

        public final void GetPageFormat​(int pagenum,
                                        guidopageformat pf)
        Retrieve the format of a given page.
        Parameters:
        pagenum - a page number, starting from 1
        pf - on output, the corresponding page format
      • MarkVoice

        public final int MarkVoice​(int voicenum,
                                   guidodate date,
                                   guidodate duration,
                                   int red,
                                   int green,
                                   int blue)
        Force the color of all notes of a voice in a given time interval.
        Parameters:
        voicenum - index of the voice to mark, starting from 1
        date - the date where the color-marking must begin (whole note = 1)
        duration - the duration that must be covered by the color marking.
        red - the red component of the marking color, from 0 to 255.
        green - green color component.
        blue - blue color component.
        Returns:
        a Guido error code.
      • GetPageCount

        public final int GetPageCount()
        Give the score pages count.
        Returns:
        the score pages count or an error code when < 0
      • GetSystemCount

        public final int GetSystemCount​(int page)
        Give the system count of a page.
        Parameters:
        page - a page number
        Returns:
        the system count or an error code when < 0
      • CountVoices

        public final int CountVoices()
        Give the score count of voices.
        Returns:
        the count of voices an error code when < 0
      • GetDuration

        public final int GetDuration​(guidodate date)
        Give the score duration.
        Parameters:
        date - on output, the score duration.
        Returns:
        an error code.
        See Also:
        guidodate
      • GetPageDate

        public final int GetPageDate​(int pagenum,
                                     guidodate date)
        Give a page date.
        Parameters:
        pagenum - a guido page number (starting from 1)
        date - on output, the page date when the page number is found.
        Returns:
        an error code.
        See Also:
        guidodate
      • FindEventPage

        public final int FindEventPage​(guidodate date)
      • FindPageAt

        public final int FindPageAt​(guidodate date)
        Find a page at a given date.
        Parameters:
        date - a guido date
        Returns:
        a page number (starting from 1) or 0 when no page is found.
        See Also:
        guidodate
      • GetMap

        public final int GetMap​(int page,
                                float width,
                                float height,
                                int selector,
                                mapcollector f)
        Retrieves the graphic to time RAW mapping
        Parameters:
        page - a page index, starting from 1.
        width - an area width (typically the current drawing zone width).
        height - an area height (typically the current drawing zone height).
        selector - a filter to focus on specific elements.
        f - a mapcollector object that will be called for each selected element.
        Returns:
        an error code.
        See Also:
        mapcollector
      • GetRAWStaffMap

        public final int GetRAWStaffMap​(int page,
                                        float width,
                                        float height,
                                        int staff,
                                        guidoscoremapbase map)
        Retrieves the graphic to time RAW mapping of a defined staff
        Parameters:
        page - a page index, starting from 1.
        width - an area width (typically the current drawing zone width).
        height - an area height (typically the current drawing zone height).
        staff - the staff index (starting from 1).
        map - on output, contains the staff map.
        Returns:
        an error code.
        See Also:
        mapcollector
      • GetRAWVoiceMap

        public final int GetRAWVoiceMap​(int page,
                                        float width,
                                        float height,
                                        int voice,
                                        guidoscoremapbase map)
        Retrieves the graphic to time RAW mapping of a defined voice
        Parameters:
        page - a page index, starting from 1.
        width - an area width (typically the current drawing zone width).
        height - an area height (typically the current drawing zone height).
        voice - the voice index (starting from 1).
        map - on output, contains the staff map.
        Returns:
        an error code.
        See Also:
        mapcollector
      • GetRAWSystemMap

        public final int GetRAWSystemMap​(int page,
                                         float width,
                                         float height,
                                         guidoscoremapbase map)
        Retrieves the graphic to time RAW mapping of the systems
        Parameters:
        page - a page index, starting from 1.
        width - an area width (typically the current drawing zone width).
        height - an area height (typically the current drawing zone height).
        map - on output, contains the staff map.
        Returns:
        an error code.
        See Also:
        mapcollector
      • GetTimeMap

        public final int GetTimeMap​(timemapcollector f)
        Retrieves the wrapped to unwrapped time mapping
        Parameters:
        f - a TimeMapCollector object that will be called for each time segment.
        Returns:
        an error code.
        See Also:
        timemapcollector
      • GetPageMap

        public final int GetPageMap​(int page,
                                    float width,
                                    float height,
                                    guidoscoremapbase map)
        Gives the adjusted page mapping
        Parameters:
        page - a page index, starting from 1.
        width - an area width (typically the current drawing zone width).
        height - an area height (typically the current drawing zone height).
        map - on output, contains the page map.
        Returns:
        an error code.
        See Also:
        mapcollector
      • GetStaffMap

        public final int GetStaffMap​(int page,
                                     float width,
                                     float height,
                                     int staff,
                                     guidoscoremapbase map)
        Gives the adjusted staff mapping
        Parameters:
        page - a page index, starting from 1.
        width - an area width (typically the current drawing zone width).
        height - an area height (typically the current drawing zone height).
        staff - the staff index (starting from 1).
        map - on output, contains the staff map.
        Returns:
        an error code.
        See Also:
        mapcollector
      • GetVoiceMap

        public final int GetVoiceMap​(int page,
                                     float width,
                                     float height,
                                     int voice,
                                     guidoscoremapbase map)
        Gives the adjusted voice mapping
        Parameters:
        page - a page index, starting from 1.
        width - an area width (typically the current drawing zone width).
        height - an area height (typically the current drawing zone height).
        voice - the voice index (starting from 1).
        map - on output, contains the staff map.
        Returns:
        an error code.
        See Also:
        mapcollector
      • GetSystemMap

        public final int GetSystemMap​(int page,
                                      float width,
                                      float height,
                                      guidoscoremapbase map)
        Gives the adjusted system mapping
        Parameters:
        page - a page index, starting from 1.
        width - an area width (typically the current drawing zone width).
        height - an area height (typically the current drawing zone height).
        map - on output, contains the staff map.
        Returns:
        an error code.
        See Also:
        mapcollector
      • close

        public void close()
        close a score The close method must be called to notify the Guido Engine that the associated ressources can be released.
      • DrawBoundingBoxes

        public final void DrawBoundingBoxes​(int bbMap)
        Control bounding boxes drawing. Bounding boxes are internal to the layout engine. This API is for the layout engine debugging purpose.
        Parameters:
        bbMap - a bits field indicating the set of bounding boxes to draw (default to none).
      • GetDrawBoundingBoxes

        public final int GetDrawBoundingBoxes()
        Gives the drawn bounding boxes set. This API is for the layout engine debugging purpose.
        Returns:
        a bits field indicating the set of bounding boxes.
      • OpenParser

        public final void OpenParser()
        Open a new Parser. A parser have to be closed with CloseParser().
      • CloseParser

        public final int CloseParser()
        Close the parser.
        Returns:
        an error code.
      • GetStream

        public final java.lang.String GetStream()
        Get the content of the guidoStream.
        Returns:
        The string int the GuidoStream
      • File2AR

        public final int File2AR​(java.lang.String file)
        Parse a file and create the corresponding Abstract Representation. The ar is stocked internally and have to be freed with FreeAR().
        To use this method you have to open a parser with OpenParser().
        Parameters:
        file - the name of the file to be parsed.
        Returns:
        a error code.
      • String2AR

        public final int String2AR​(java.lang.String gmnCode)
        Parse the gmnCode and create the corresponding Abstract Representation. The ar is stocked internally and have to be freed with FreeAR().
        To use this method you have to open a parser with OpenParser().
        Parameters:
        gmnCode - the code to be parsed.
        Returns:
        a error code.
      • Stream2AR

        public final int Stream2AR()
        Parse the gmnCode in the stream (@see OpenStream()) and create the corresponding Abstract Representation. The ar is stocked internally and 0 * have to be freed with FreeAR().
        To use this method you have to open a parser with OpenParser().
        Returns:
        an error code.
      • ParserGetErrorCode

        public final parserError ParserGetErrorCode()
        Get a parser error if an error occurs after use File2AR, String2AR or Stream2AR.
        Returns:
        a parser error code.
      • OpenStream

        public final void OpenStream()
        Open a new stream. The stream have to be closed with CloseStream().
      • CloseStream

        public final int CloseStream()
        Close the stream.
        Returns:
        an error code.
      • WriteStream

        public final int WriteStream​(java.lang.String gmnCode)
        Write a string in the stream.
        Parameters:
        gmnCode - a partial gmn code
        Returns:
        an error code.
      • ResetStream

        public final int ResetStream()
        Reset the content of the stream.
        Returns:
        an error code.
      • Init

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