sscore.h

Includes:
"sscore_graphics.h"
<stdbool.h>

Introduction

The base C interface to SeeScoreLib

This interface provides functions to read a MusicXML file and create a score layout consisting of a set of systems to be displayed one above the next.

Important Types:

  • sscore (opaque) defines the whole score.

  • sscore_system (opaque) defines a single system with 1 or more parts, and a range of bars. Reference-counted

  • sscore_systemlist (opaque) is convenient (not required) for handling a set of systems

  • sscore_libkeytype is defined in a key file, either evaluation_key.c which is supplied with the SDK or a special key file provided by Dolphin Computing for a fee to unlock specific features and remove the 'watermark'

Important Functions:

  • sscore_getversion() return the version number of the library

  • sscore_loadxmlfile loads a MusicXML file (.xml or .mxl) and returns type sscore*

  • sscore_loadxmldata loads in-memory MusicXML text data and returns type sscore*. It will read .mxl data if sscore_loadoptions.compressed is set

  • sscore_dispose releases the memory allocated in the sscore*

  • sscore_numparts returns the total number of parts available in the score.

  • sscore_numbars returns the total number of bars (measures) in the score

  • sscore_getheader returns information in the MusicXML header - title, composer etc

  • sscore_layout1system returns a single part sscore_system, useful for displaying the first few bars of a part (eg for part selection UI)

  • sscore_layout lays out all systems in the entire score. Since this function takes appreciable time for a large score it is designed to be called on a background thread, with regular updates to the UI for each new complete system using sscore_layout_callback_fn, which is passed as an argument. Sample code is provided with the SDK to demonstrate the thread handling.

  • sscore_system_retain, sscore_system_release used to increment and decrement the reference-count for a sscore_system, which is automatically disposed when the reference count becomes 0

  • sscore_system_index the index of the system

  • sscore_system_numbars returns the start bar index and the number of bars in a system.

  • sscore_system_bounds returns the (width,height) of the system

  • sscore_system_draw draws the system

  • sscore_system_getcursorrect return the rectangle for a particular bar in a system which can be used for drawing a rectangular bar cursor

  • sscore_system_partindexforypos() and sscore_system_barindexforxpos() can be used to identify the location of a tap or mouse in a system

  • sscore_systemlist_create, sscore_systemlist_dispose,sscore_systemlist_clear, sscore_systemlist_size, sscore_systemlist_add,sscore_systemlist_at, sscore_systemlist_bounds,sscore_systemlist_sysforbar various convenient functions provided for handling sscore_systemlist

  • sscore_compressxml, sscore_decompressxml are convenience functions for converting between .xml and .mxl files

Coordinates: In all coordinates x increases to the left and y increases downwards

Bar indices: The first bar in the score has always index 0, and the bars are indexed sequentially to the end.

System indices: The top system has index 0, and other systems are indexed sequentially downwards.

Thread Info: All functions in this interface must be called from a single thread (probably the main thread) EXCEPT for sscore_layout.
NB The callback function sscore_layout_callback_fn is called on the same thread as sscore_layout, but it must still call other functions in this interface in the normal thread



C Pseudoclasses

sscore

the score

sscore_system

a single laid out system with all parts and a number of bars

sscore_systemlist

the list of systems



Groups

General utility Functions

Group members:

sscore_compressxml

convert xml file to mxl

sscore_decompressmxl

convert mxl file to xml

sscore_defaultfontnamefortext

the name of the font that will be registered by default for the text type

sscore_extractfilesection

extract a section of a text file around a given line number into a buffer

sscore_fontnamefortext

get the registered font name for a text type

sscore_getversion

return the version number of the library

sscore_setfontnamefortext

set the registered font name for a text type

 

The sscore_system interface

functions accessing the system - a range of bars and parts to display in a rectangle

Group members:

sscore_system_barindexforxpos

return the bar index for a x-coord in the system

sscore_system_bounds

return the bounding box of the system

sscore_system_defaultspacing

return a default system spacing

sscore_system_draw

draw the system at the given point

sscore_system_getbarlayout

return information (in result) about the dimensions of the barlines in a part

sscore_system_getcursorrect

return the cursor rectangle for a particular system and bar

sscore_system_getstafflayout

return information (in result) about the dimensions of the staves in a part

sscore_system_includesbar

return true if this system includes the given bar index

sscore_system_index

return the index (from the top of the score) of the system

sscore_system_magnification

return the default magnification at which the system will be drawn

sscore_system_magnify

magnify the single system with a single part

sscore_system_numbars

return the start bar index and number of bars for the given system

sscore_system_partindexforypos

return the part index for a y-coord in the system

sscore_system_pointstofontsize
sscore_system_print

draw the system at the given point optimised for printing or pdf generation

sscore_system_release

decrement the retain count of the system

sscore_system_retain

increment the retain count of the system

sscore_system_staff_bottom_ypos

return bottom ypos of the staff in the part

sscore_system_staff_height

return the height of the staff in the part

sscore_system_staffindexforypos

return the nearest staff index for a y-coord in the system/part

sscore_system_stafflocationforypos

is a y-location above or below the staff returned by sscore_system_staffindexforypos

 

The sscore_systemlist interface

functions to access a simple list of system

Group members:

sscore_stringforelementtype

get a string for enum sscore_element_type

sscore_systemlist_add

add a system to the end of ss

sscore_systemlist_at

get a system by index

sscore_systemlist_bounds

return the bounds of the score

sscore_systemlist_clear

clear all sytems from the list

sscore_systemlist_create

create a new sscore_systemlist

sscore_systemlist_defaultspacing

return the default inter-system spacing

sscore_systemlist_dispose

clear all systems from the list and dispose it

sscore_systemlist_size

return the number of systems held in ss

sscore_systemlist_sysforbar

return the system index for the bar index in the systemlist

 

The main sscore interface

obtain information about the score

Group members:

sscore_abbrevpartnameforpart

return the abbreviated partname for the part

sscore_barnumberforindex

return the number of the bar for the given bar index [0..numbars-1]

sscore_dispose

free the score memory, and any undisposed systems

sscore_fullpartnameforpart

return the partname for the part

sscore_getheader

get the xml score-header information

sscore_instrumentnameforpart

return the first non-empty instrument name for the part

sscore_ismodified

test for changed score eg to determine whether to save

sscore_layout

layout a set of systems and return them through a callback function

sscore_layout1system

layout a single system with a single part.

sscore_loadheaderfromfile

load only some header metadata quickly from file without loading the rest of the score

sscore_loadxmldata

load in-memory xml or mxl data and return score

sscore_loadxmlfile

load xml or mxl file and return score

sscore_numbars

return the total number of bars in the score

sscore_numparts

return the number of parts in the score

sscore_numstavesforpart

return the number of staves for the part

sscore_savefile

save the score to a file

sscore_updateheader

change the xml score-header information


Functions

sscore_abbrevpartnameforpart

return the abbreviated partname for the part

sscore_barnumberforindex

return the number of the bar for the given bar index [0..numbars-1]

sscore_black
sscore_compressxml

convert xml file to mxl

sscore_decompressmxl

convert mxl file to xml

sscore_defaultfontnamefortext

the name of the font that will be registered by default for the text type

sscore_dispose

free the score memory, and any undisposed systems

sscore_extractfilesection

extract a section of a text file around a given line number into a buffer

sscore_fontnamefortext

get the registered font name for a text type

sscore_fullpartnameforpart

return the partname for the part

sscore_getheader

get the xml score-header information

sscore_getversion

return the version number of the library

sscore_instrumentnameforpart

return the first non-empty instrument name for the part

sscore_ismodified

test for changed score eg to determine whether to save

sscore_layout

layout a set of systems and return them through a callback function

sscore_layout1system

layout a single system with a single part.

sscore_loadheaderfromfile

load only some header metadata quickly from file without loading the rest of the score

sscore_loadxmldata

load in-memory xml or mxl data and return score

sscore_loadxmlfile

load xml or mxl file and return score

sscore_numbars

return the total number of bars in the score

sscore_numparts

return the number of parts in the score

sscore_numstavesforpart

return the number of staves for the part

sscore_savefile

save the score to a file

sscore_setfontnamefortext

set the registered font name for a text type

sscore_stringforelementtype

get a string for enum sscore_element_type

sscore_system_barindexforxpos

return the bar index for a x-coord in the system

sscore_system_bounds

return the bounding box of the system

sscore_system_defaultspacing

return a default system spacing

sscore_system_draw

draw the system at the given point

sscore_system_getbarlayout

return information (in result) about the dimensions of the barlines in a part

sscore_system_getcursorrect

return the cursor rectangle for a particular system and bar

sscore_system_getstafflayout

return information (in result) about the dimensions of the staves in a part

sscore_system_includesbar

return true if this system includes the given bar index

sscore_system_index

return the index (from the top of the score) of the system

sscore_system_magnification

return the default magnification at which the system will be drawn

sscore_system_magnify

magnify the single system with a single part

sscore_system_numbars

return the start bar index and number of bars for the given system

sscore_system_partindexforypos

return the part index for a y-coord in the system

sscore_system_pointstofontsize
sscore_system_print

draw the system at the given point optimised for printing or pdf generation

sscore_system_release

decrement the retain count of the system

sscore_system_retain

increment the retain count of the system

sscore_system_staff_bottom_ypos

return bottom ypos of the staff in the part

sscore_system_staff_height

return the height of the staff in the part

sscore_system_staffindexforypos

return the nearest staff index for a y-coord in the system/part

sscore_system_stafflocationforypos

is a y-location above or below the staff returned by sscore_system_staffindexforypos

sscore_systemlist_add

add a system to the end of ss

sscore_systemlist_at

get a system by index

sscore_systemlist_bounds

return the bounds of the score

sscore_systemlist_clear

clear all sytems from the list

sscore_systemlist_create

create a new sscore_systemlist

sscore_systemlist_defaultspacing

return the default inter-system spacing

sscore_systemlist_dispose

clear all systems from the list and dispose it

sscore_systemlist_size

return the number of systems held in ss

sscore_systemlist_sysforbar

return the system index for the bar index in the systemlist

sscore_unionrect

return the union of 2 rectangles

sscore_updateheader

change the xml score-header information


sscore_abbrevpartnameforpart


return the abbreviated partname for the part

EXPORT const char *sscore_abbrevpartnameforpart(
    const sscore *sc,
    int partindex);  
Parameters
sc

the sscore pointer returned from sscore_load*

partindex

the index of the part [0..numparts-1]

Return Value

pointer to char NULL-terminated C-style string


sscore_barnumberforindex


return the number of the bar for the given bar index [0..numbars-1]

EXPORT const char *sscore_barnumberforindex(
    const sscore *sc,
    int barindex);  
Parameters
sc

the sscore pointer returned from sscore_load*

Return Value

the (string) bar number


sscore_black


Return Value

black colour


sscore_compressxml


convert xml file to mxl

EXPORT bool sscore_compressxml(
    const char *xmlfilepath,
    const char *dest_path,
    char *mxlfilename,
    int fnsize);  
Parameters
xmlfilepath

the full pathname for the xml source file

dest_path

the full pathname for the directory to receive the file to be created

mxlfilename

a buffer of size fnsize to receive the filename of the new file

fnsize

the size of the mxlfilename buffer

Return Value

true if success


sscore_decompressmxl


convert mxl file to xml

EXPORT bool sscore_decompressmxl(
    const char *mxlfilepath,
    const char *dest_path,
    char *xmlfilename,
    int fnsize);  
Parameters
mxlfilepath

the full pathname for the mxl source file

dest_path

the full pathname for the directory to receive the file to be created

xmlfilename

a buffer of size fnsize to receive the filename of the new file

fnsize

the size of the xmlfilename buffer

Return Value

return true if success


sscore_defaultfontnamefortext


the name of the font that will be registered by default for the text type

EXPORT const char *sscore_defaultfontnamefortext(
    enum sscore_texttype text);  
Parameters
text

the type of text in the score

Return Value

the (platform-dependent) font name which will be used by default for the text type if it is not overridden using sscore_setfontnamefortext


sscore_dispose


free the score memory, and any undisposed systems

EXPORT void sscore_dispose(
    sscore *sc);  
Parameters
sc

the sscore pointer returned from sscore_load*


sscore_extractfilesection


extract a section of a text file around a given line number into a buffer

EXPORT int sscore_extractfilesection(
    const char *filepath,
    int line,
    int numlines,
    char *buffer,
    int buffersize);  
Parameters
filepath

the pathname of the file

line

the centre line number

numlines

the number of lines to extract

buffer

pointer to a byte buffer

buffersize

the size of the buffer in bytes

Return Value

the number of bytes added to the buffer

Discussion

useful for displaying a section of an XML file around a given line where there is an error


sscore_fontnamefortext


get the registered font name for a text type

EXPORT const char *sscore_fontnamefortext(
    enum sscore_texttype text);  
Parameters
text

the type of text in the score

Return Value

the (platform-dependent) font name which will be used for the text type


sscore_fullpartnameforpart


return the partname for the part

EXPORT const char *sscore_fullpartnameforpart(
    const sscore *sc,
    int partindex);  
Parameters
sc

the sscore pointer returned from sscore_load*

partindex

the index of the part [0..numparts-1]

Return Value

pointer to char NULL-terminated C-style string


sscore_getheader


get the xml score-header information

EXPORT void sscore_getheader(
    const sscore *sc,
    sscore_header *header);  
Parameters
sc

the sscore pointer returned from sscore_load*

header

pointer to a struct of type sscore_header to receive the data

Discussion

NB The returned pointers inside header are owned by sc. The caller should copy any required data


sscore_getversion


return the version number of the library


sscore_instrumentnameforpart


return the first non-empty instrument name for the part

EXPORT const char *sscore_instrumentnameforpart(
    const sscore *sc,
    int partindex);  
Parameters
sc

the sscore pointer returned from sscore_load*

partindex

the index of the part [0..numparts-1]

Return Value

pointer to char NULL-terminated C-style string


sscore_ismodified


test for changed score eg to determine whether to save

EXPORT bool sscore_ismodified(
    const sscore *sc);  
Parameters
sc

the sscore pointer returned from sscore_load*

Return Value

true if score is modified


sscore_layout


layout a set of systems and return them through a callback function

EXPORT enum sscore_error sscore_layout(
    sscore *sc,
    sscore_graphics *graphics, 
    float width,
    float max_system_height, 
    const bool *parts, 
    sscore_layout_callback_fn cb,
    void *arg, 
    float magnification, 
    const sscore_layoutoptions *opt);  
Parameters
sc

the sscore pointer returned from sscore_load*

graphics

the sscore_graphics returned from sscore_graphics_create is used to measure bounds of items, particularly text.

width

the width available to display the systems in screen coordinates

max_system_height

the maximum height available to display each system to control truncation. =0 for no truncation

parts

array of bool, 1 per part, true to include, false to exclude

cb

the callback function to be called for each completed system

arg

the context argument to be passed to cb

magnification

the scale at which to display this (1.0 is default)

opt

pointer to options or NULL for default

Return Value

any error

Discussion

This should be called on a background thread and it will call cb for each system laid out, from top to bottom. cb will normally add the system to a sscore_systemlist on the foreground (gui event dispatch) thread. systems are stored in sc as they are produced


sscore_layout1system


layout a single system with a single part.

EXPORT sscore_system *sscore_layout1system(
    sscore *sc,
    sscore_graphics *graphics, 
    int startbarindex,
    float width,
    float max_height, 
    int partindex,
    float magnification, 
    const sscore_layoutoptions *opt, 
    int maxBars);  
Parameters
sc

the sscore pointer returned from sscore_load*

graphics

the sscore_graphics returned from sscore_graphics_create is used to measure bounds of items, particularly text.

startbarindex

the index of the first bar in the system (usually 0)

width

the width available to display the system in screen coordinates

max_height

the maximum height available to display the system to control truncation. =0 for no truncation

partindex

the index of the single part to layout [0..numparts-1]

magnification

the scale at which to display this (1.0 is default)

opt

layout options or NULL

maxBars

the maximum number of bars in the system (0 is no maximum)

Return Value

the system

Discussion

useful for display of a single part for part selection


sscore_loadheaderfromfile


load only some header metadata quickly from file without loading the rest of the score

EXPORT bool sscore_loadheaderfromfile(
    const char *filepath,
    sscore_miniheader *header);  
Parameters
filepath

the full pathname of the MusicXML file

header

should be allocated by the caller and is returned with the header data if the function returns true

Return Value

true if succeeded

Discussion

this is much quicker than loading the whole score and reading the header from that, and is suitable for presenting file metadata, title, composer etc in a list of MusicXML files.


sscore_loadxmldata


load in-memory xml or mxl data and return score

EXPORT sscore *sscore_loadxmldata(
    const char *data,
    int len, 
    const sscore_loadoptions *opt, 
    sscore_loaderror *err);  
Parameters
data

a pointer to the data in memory

len

the number of bytes of data

opt

the options for load, or NULL for default options

err

pointer to a struct to take error (and warning) information. May be NULL if info not required

Return Value

the score


sscore_loadxmlfile


load xml or mxl file and return score

EXPORT sscore *sscore_loadxmlfile(
    const char *filepath, 
    const sscore_loadoptions *opt, 
    sscore_loaderror *err);  
Parameters
filepath

the full pathname of the file

opt

the options for load, or NULL for default options

err

pointer to a struct to take error (and warning) information. May be NULL if info not required

Return Value

the score


sscore_numbars


return the total number of bars in the score

EXPORT int sscore_numbars(
    const sscore *sc);  
Parameters
sc

the sscore pointer returned from sscore_load*

Return Value

the number of bars in the score


sscore_numparts


return the number of parts in the score

EXPORT int sscore_numparts(
    const sscore *sc);  
Parameters
sc

the sscore pointer returned from sscore_load*

Return Value

the number of parts in the score


sscore_numstavesforpart


return the number of staves for the part

EXPORT int sscore_numstavesforpart(
    const sscore *sc,
    int partindex);  
Parameters
sc

the score

partindex

the part index [0..]

Return Value

the number of staves in this part (1..2)


sscore_savefile


save the score to a file

EXPORT enum sscore_error sscore_savefile(
    sscore *sc,
    const char *filepath,
    enum sscore_savetype savetype);  
Parameters
sc

the sscore pointer returned from sscore_load*

filepath

the full pathname of the file to save to without extension

savetype

compressed (.mxl) or uncompressed (.xml) or default (same as before if defined, else compressed)

Return Value

any error


sscore_setfontnamefortext


set the registered font name for a text type

EXPORT void sscore_setfontnamefortext(
    enum sscore_texttype text,
    const char *fontname);  
Parameters
text

the type of text in the score

fontname

the (platform-dependent) font name to be used for the type of text in the score


sscore_stringforelementtype


get a string for enum sscore_element_type

EXPORT const char *sscore_stringforelementtype(
    enum sscore_element_type tp);  

sscore_system_barindexforxpos


return the bar index for a x-coord in the system

EXPORT int sscore_system_barindexforxpos(
    const sscore_system *sys,
    float xpos);  
Parameters
sys

the system

xpos

the x coord

Return Value

the bar index in the system containing this x coord, or -1 if outside the system


sscore_system_bounds


return the bounding box of the system

Parameters
sys

the system

Return Value

the size of the system


sscore_system_defaultspacing


return a default system spacing

EXPORT float sscore_system_defaultspacing(
    const sscore_system *sys);  
Parameters
sys

the system

Return Value

the default inter-system spacing


sscore_system_draw


draw the system at the given point

EXPORT void sscore_system_draw(
    sscore_graphics *graphics,
    const sscore_system *sys,
    const sscore_point *tl,
    float magnification);  
Parameters
graphics

the graphics context returned from sscore_graphics_create

sys

the system to draw

tl

the top left point of the system rectangle

magnification

the scale to draw at. NB This is normally 1, except during active zooming. The overall magnification is set in sscore_layout


sscore_system_getbarlayout


return information (in result) about the dimensions of the barlines in a part

EXPORT sscore_barlayout sscore_system_getbarlayout(
    const sscore_system *sys,
    int partindex);  
Parameters
sys

the system being interrogated

partindex

the 0-based part index

Return Value

the bar layout information


sscore_system_getcursorrect


return the cursor rectangle for a particular system and bar

EXPORT sscore_cursor sscore_system_getcursorrect(
    sscore_graphics *graphics,
    const sscore_system *sys,
    int barIndex);  
Parameters
graphics

the graphics context returned from sscore_graphics_create

sys

the system

barIndex

the index of the bar in the system

Return Value

the cursor info


sscore_system_getstafflayout


return information (in result) about the dimensions of the staves in a part

EXPORT sscore_stafflayout sscore_system_getstafflayout(
    const sscore_system *sys,
    int partindex);  
Parameters
sys

the system being interrogated

partindex

the 0-based part index

Return Value

the staff layout information


sscore_system_includesbar


return true if this system includes the given bar index

EXPORT bool sscore_system_includesbar(
    const sscore_system *sys,
    int barindex);  
Parameters
sys

the system

barindex

index of the bar in the score

Return Value

return true if this system includes the given bar index


sscore_system_index


return the index (from the top of the score) of the system

EXPORT int sscore_system_index(
    const sscore_system *sys);  
Parameters
sys

the system

Return Value

the index of the system


sscore_system_magnification


return the default magnification at which the system will be drawn

EXPORT float sscore_system_magnification(
    const sscore_system *sys);  
Parameters
sys

the system

Return Value

the magnification - 1.0 is a close approximation to a standard printed score with 6mm staff height


sscore_system_magnify


magnify the single system with a single part

EXPORT sscore_system *sscore_system_magnify(
    sscore *sc,
    const sscore_system *sys,
    int partIndex);  
Parameters
sc

the score

sys

the system

partIndex

the part index

Return Value

a new magnified system


sscore_system_numbars


return the start bar index and number of bars for the given system

Parameters
sys

the system

Return Value

the start bar and number of bars in the system


sscore_system_partindexforypos


return the part index for a y-coord in the system

EXPORT int sscore_system_partindexforypos(
    const sscore_system *sys,
    float ypos);  
Parameters
sys

the system

ypos

the y coord

Return Value

the part index in the system containing this y coord


sscore_system_pointstofontsize


EXPORT float sscore_system_pointstofontsize(
    const sscore_system *sys,
    float points);  
Parameters
sys

the system being interrogated

points

the point size


sscore_system_print


draw the system at the given point optimised for printing or pdf generation

EXPORT void sscore_system_print(
    sscore_graphics *graphics,
    const sscore_system *sys,
    const sscore_point *tl,
    float magnification);  
Parameters
graphics

the graphics context returned from sscore_graphics_create

sys

the system to draw

tl

the top left point of the system rectangle

magnification

the scale to draw at. The layout magnification is set in sscore_layout


sscore_system_release


decrement the retain count of the system

EXPORT void sscore_system_release(
    sscore *sc,
    sscore_system *sys);  
Parameters
sc

the sscore pointer returned from sscore_load*

sys

the system to be retained

Discussion

The caller must release the system when it release its pointer


sscore_system_retain


increment the retain count of the system

EXPORT void sscore_system_retain(
    sscore *sc,
    sscore_system *sys);  
Parameters
sc

the sscore pointer returned from sscore_load*

sys

the system to be retained

Discussion

The caller must retain the system when it stores its pointer


sscore_system_staff_bottom_ypos


return bottom ypos of the staff in the part

EXPORT float sscore_system_staff_bottom_ypos(
    const sscore_system *sys,
    int partIndex,
    int staffIndex);  
Parameters
sys

the system

partIndex

the part index [0..]

staffIndex

the staff index [0..1]

Return Value

the distance from the top of the system to the bottom line of the given staff


sscore_system_staff_height


return the height of the staff in the part

EXPORT float sscore_system_staff_height(
    const sscore_system *sys,
    int partIndex,
    int staffIndex);  
Parameters
sys

the system

partIndex

the part index [0..]

staffIndex

the staff index [0..1]

Return Value

the height of the staff from the bottom line to the top line


sscore_system_staffindexforypos


return the nearest staff index for a y-coord in the system/part

EXPORT int sscore_system_staffindexforypos(
    const sscore_system *sys,
    int partindex,
    float ypos);  
Parameters
sys

the system

partindex

the 0-based part index

ypos

the y coord

Return Value

the 0-based index of the closest staff in the system/part containing this y coord


sscore_system_stafflocationforypos


is a y-location above or below the staff returned by sscore_system_staffindexforypos

EXPORT enum sscore_system_stafflocation_e sscore_system_stafflocationforypos(
    const sscore_system *sys,
    int partindex,
    int staffindex,
    float ypos);  
Parameters
sys

the system

partindex

the 0-based part index

staffindex

the 0-based staff index

ypos

the y position

Return Value

the above/instaff/below location relative to the staff


sscore_systemlist_add


add a system to the end of ss

Parameters
ss

the sscore_systemlist returned from sscore_systemlist_create

sys

the system to add to ss

Discussion

usually called from sscore_layout_callback_fn. sys retain count is incremented


sscore_systemlist_at


get a system by index

EXPORT sscore_system *sscore_systemlist_at(
    const sscore_systemlist *ss,
    int sysindex);  
Parameters
ss

the sscore_systemlist returned from sscore_systemlist_create

sysindex

the index of the system (usually from the top of the score)

Return Value

the system in the systemlist indexed by sysindex (indexed in order of add)


sscore_systemlist_bounds


return the bounds of the score

EXPORT sscore_size sscore_systemlist_bounds(
    const sscore_systemlist *ss, 
    float systemspacing);  
Parameters
ss

the sscore_systemlist returned from sscore_systemlist_create

systemspacing

the spacing between systems (0 = use default)

Return Value

the (width,height) of the score with the given systemspacing


sscore_systemlist_clear


clear all sytems from the list

Parameters
sc

the score

ss

the sscore_systemlist returned from sscore_systemlist_create


sscore_systemlist_create


create a new sscore_systemlist

Return Value

the new sscore_systemlist

Discussion

the returned value should be disposed with sscore_systemlist_dispose


sscore_systemlist_defaultspacing


return the default inter-system spacing

Parameters
ss

the sscore_systemlist returned from sscore_systemlist_create

Return Value

the default inter-system spacing


sscore_systemlist_dispose


clear all systems from the list and dispose it

Parameters
ss

the sscore_systemlist returned from sscore_systemlist_create

Discussion

If any system is still retained (may need to await completion on other threads) it will be deleted on disposal of sscore


sscore_systemlist_size


return the number of systems held in ss

EXPORT int sscore_systemlist_size(
    const sscore_systemlist *ss);  
Parameters
ss

the sscore_systemlist returned from sscore_systemlist_create

Return Value

the number of systems held in ss


sscore_systemlist_sysforbar


return the system index for the bar index in the systemlist

EXPORT int sscore_systemlist_sysforbar(
    const sscore_systemlist *ss,
    int barindex);  
Parameters
ss

the sscore_systemlist returned from sscore_systemlist_create

barindex

the index of the bar in the system

Return Value

return the system index for the bar index, or -1 if barindex invalid


sscore_unionrect


return the union of 2 rectangles

EXPORT sscore_rect sscore_unionrect(
    const sscore_rect *r1,
    const sscore_rect *r2);  
Parameters
r1

a rectangle

r2

a rectangle

Return Value

the rectangular union of r1 and r2


sscore_updateheader


change the xml score-header information

EXPORT void sscore_updateheader(
    sscore *sc,
    enum sscore_header_fieldid hid,
    const char *val);  
Parameters
sc

the sscore pointer returned from sscore_load*

hid

id of a header field

val

the value to write


Typedefs

sscore_barlayout

barline measurement information returned from sscore_system_getbarlayout

sscore_barrange

the range of bars in a system from sscore_system_numbars

sscore_colour

a colour

sscore_colour_alpha

a colour with alpha (opacity)

sscore_cursor

information about the cursor from sscore_system_getcursorrect

sscore_header

information in the score-header element of the xml file

sscore_item_handle

a unique handle for an item (note,rest,clef etc) in the score

sscore_layout_callback_fn

The type of a callback called from sscore_layout

sscore_layoutoptions

options for sscore_layout

sscore_libkeytype

a key obtained from Dolphin Computing for unlocking the SeeScoreLib capabilities

sscore_loaderror

a description of any error or warnings from sscore_load

sscore_loadoptions

options for sscore_load

sscore_miniheader

information in the score-header element of the xml file

sscore_partlayout

part staff measurement information returned from sscore_system_getstafflayout

sscore_point

a point

sscore_rect

coords for a rectangle

sscore_size

a size

sscore_stafflayout

part staff measurement information returned from sscore_system_getstafflayout

sscore_timesig

a conventional time signature

sscore_version

a version number


sscore_barlayout


barline measurement information returned from sscore_system_getbarlayout

typedef struct sscore_barlayout { 
    int partindex; // the 0-based index of the part increasing from the top 
    int numbarlines; // number in barline array, 0 if part not displayed 
    struct { 
        int barindex;  
        enum sscore_barlineloc_e loc; // all normal default barlines are left, except system right  
        sscore_rect rect; // a rectangle enclosing the barline  
        unsigned dummy[32];//unused 
        } barline[sscore_kMaxBarlinesInSystemPart];  
    unsigned dummy[128];//unused 
} sscore_barlayout;  

sscore_barrange


the range of bars in a system from sscore_system_numbars

typedef struct sscore_barrange { 
    int startbarindex; 
    int numbars; 
}sscore_barrange;  

sscore_colour


a colour

typedef struct sscore_colour { 
    float r,g,b; 
} sscore_colour;  

sscore_colour_alpha


a colour with alpha (opacity)

typedef struct sscore_colour_alpha { 
    float r,g,b,a; 
} sscore_colour_alpha;  

sscore_cursor


information about the cursor from sscore_system_getcursorrect

typedef struct sscore_cursor { 
    bool bar_in_system; 
    sscore_rect rect; 
} sscore_cursor;  

sscore_header


information in the score-header element of the xml file

typedef struct sscore_header { 
    const char *work_number; 
    const char *work_title; 
    const char *movement_number; 
    const char *movement_title; 
    const char *composer; 
    const char *lyricist; 
    const char *arranger;  
    int num_credits; 
    struct { 
        const char *credit_words; 
        } credits[sscore_kMaxCredits];  
    int num_parts; 
    struct { 
        const char *name; 
        const char *abbrev; 
        } parts[sscore_kMaxParts];  
}sscore_header;  
Discussion

all are null-terminated c-style strings or 0


sscore_item_handle


a unique handle for an item (note,rest,clef etc) in the score

typedef unsigned long sscore_item_handle;  

sscore_layout_callback_fn


The type of a callback called from sscore_layout

typedef bool ( *sscore_layout_callback_fn)(
    sscore_system *sys,
    void *arg);  
Parameters
sys

the system laid out

arg

the context argument passed to sscore_layout

Discussion

The callback is called by sscore_layout on a background thread for each system when it is laid out. This allows the ui to update while the layout is in progress The callback returns false to abort the layout, else true.


sscore_layoutoptions


options for sscore_layout

typedef struct sscore_layoutoptions { 
    bool hidepartnames; // set this so that part names are not displayed in the layout 
    bool hidebarnumbers; // set this so that bar numbers are not displayed 
    unsigned flags; // bit flags defined in enum sscore_layoutOptionsFlagBits. default set 0. 
    unsigned dummy[15]; // for future. set to zero 
} sscore_layoutoptions;  

sscore_libkeytype


a key obtained from Dolphin Computing for unlocking the SeeScoreLib capabilities

typedef struct sscore_libkeytype { 
    const char *identity; // C-style string associated with the application using the SeeScoreLib 
    unsigned capabilities[sscore_kNumCapabilityWords]; // encoded capabilities for this identity 
    unsigned key[sscore_kNumKeyWords]; // key associated with identity and capabilities 
} sscore_libkeytype;  

sscore_loaderror


a description of any error or warnings from sscore_load

typedef struct sscore_loaderror { 
    enum sscore_error err; // any error on load  
    int line; // line in the xml file of the (first) error (0 if none) 
    int col; // file column in the line (0 if none) 
    char text[sscore_kMaxErrorTextChars]; // any more information on the error  
    int numwarnings; // the number of warnings 
    struct { 
        enum sscore_warning w; // a warning value 
        int partindex; // -1 for all parts 
        int barindex; // -1 for all bars 
        enum sscore_element_type element; unsigned dummy; // for future 
        } warn[sscore_kMaxWarnings]; // any warnings on load  
    unsigned dummy[16]; // for future 
} sscore_loaderror;  

sscore_loadoptions


options for sscore_load

typedef struct sscore_loadoptions { 
    const sscore_libkeytype *key; // use NULL for evaluation of SeeScoreLib 
    bool compressed; 
    unsigned flags; // bit set of sscore_loadopt_flagbits 
    unsigned dummy[15]; // for future. set to zero 
} sscore_loadoptions;  

sscore_miniheader


information in the score-header element of the xml file

typedef struct sscore_miniheader { 
    char work_number[sscore_kMiniHeaderNumberSize]; 
    char work_title[sscore_kMiniHeaderStringSize]; 
    char movement_number[sscore_kMiniHeaderNumberSize]; 
    char movement_title[sscore_kMiniHeaderStringSize]; 
    char composer[sscore_kMiniHeaderStringSize]; 
    char lyricist[sscore_kMiniHeaderStringSize]; 
    char arranger[sscore_kMiniHeaderStringSize];  
    int num_credits; 
    struct { 
        char credit_words[sscore_kMiniHeaderStringSize]; 
        } credits[sscore_kMiniHeaderMaxCredits];  
    int num_parts; 
    struct { 
        char name[sscore_kMiniHeaderPartNameSize]; 
        } parts[sscore_kMiniHeaderMaxParts]; 
}sscore_miniheader;  
Discussion

all space in this struct is allocated by the client and strings are copied into this for quick read of file header and no explicit dealloc


sscore_partlayout


part staff measurement information returned from sscore_system_getstafflayout

typedef struct sscore_stafflayout { 
    int partindex; // the 0-based index of the part increasing from the top  
    float tenth_size; // the size in OS graphics units of one tenth of a staff line spacing (ie one 50th of the height of a 4-line staff)  
    int numstaves; // the number of staves in this system (usually 1 or 2) and the number of valid entries in the staff array  
    struct { 
        sscore_rect rect; // a rectangle defined by the left of the top staff line and the right of the bottom staff line (height = 0 if part not displayed)  
        int numlines; // the number of lines in the staff, 0 if this part is not displayed  
        unsigned dummy[32];//unused 
        } staff[sscore_kMaxStavesInPart];  
    unsigned dummy[128];//unused 
} sscore_stafflayout;  

See Also


sscore_point


a point

typedef struct sscore_point { 
    float x,y; 
} sscore_point;  

sscore_rect


coords for a rectangle

typedef struct sscore_rect { 
    float xorigin,yorigin,width,height; 
} sscore_rect;  

sscore_size


a size

typedef struct sscore_size { 
    float width,height; 
} sscore_size;  

sscore_stafflayout


part staff measurement information returned from sscore_system_getstafflayout

typedef struct sscore_stafflayout { 
    int partindex; // the 0-based index of the part increasing from the top  
    float tenth_size; // the size in OS graphics units of one tenth of a staff line spacing (ie one 50th of the height of a 4-line staff)  
    int numstaves; // the number of staves in this system (usually 1 or 2) and the number of valid entries in the staff array  
    struct { 
        sscore_rect rect; // a rectangle defined by the left of the top staff line and the right of the bottom staff line (height = 0 if part not displayed)  
        int numlines; // the number of lines in the staff, 0 if this part is not displayed  
        unsigned dummy[32];//unused 
        } staff[sscore_kMaxStavesInPart];  
    unsigned dummy[128];//unused 
} sscore_stafflayout;  

See Also


sscore_timesig


a conventional time signature

typedef struct sscore_timesig { 
    int numbeats; // number of beats in bar 
    int beattype; // 8 = quaver; 4 = crochet; 2 = minim etc 
} sscore_timesig;  

sscore_version


a version number

typedef struct sscore_version { 
    int major; 
    int minor; 
} sscore_version;  

Enumerated Types

sscore_element_type

element type for warning

sscore_error

all errors

sscore_layoutOptionsFlagBits

bit flags for layout options flags field

sscore_loadopt_flagbits

flag bits for load

sscore_savetype

save compressed or uncompressed

sscore_system_stafflocation_e

define vertical location relative to the staff

sscore_texttype

type of text determining preset font to use

sscore_warning

all warnings


sscore_element_type


element type for warning

enum sscore_element_type { 
    sscore_element_none, 
    sscore_element_beam, 
    sscore_element_slur, 
    sscore_element_tied, 
    sscore_element_lyric, 
    sscore_element_bracket, 
    sscore_element_tuplet, 
    sscore_element_slide, 
    sscore_element_glissando, 
    sscore_element_wedge, 
    sscore_element_dashes, 
    sscore_element_pedal, 
    sscore_element_octave_shift, 
    sscore_element_principal_voice, 
    sscore_element_part, 
    sscore_element_accidental, 
    sscore_element_stem, 
    sscore_element_tremolo, 
    sscore_element_unknown 
};  

sscore_error


all errors

enum sscore_error { 
    sscore_NoError = 0, 
    sscore_OutOfMemoryError, 
    sscore_FileOpenFailedError, 
    sscore_XMLValidationError, 
    sscore_NoBarsInFileError, 
    sscore_WidthTooSmallError, 
    sscore_NullGraphicsError, 
    sscore_MagnificationTooSmallError, 
    sscore_MagnificationTooLargeError, 
    sscore_NoPartsError, 
    sscore_NoPartsToDisplayError, 
    sscore_UnknownError, 
    sscore_BadHeightError, 
    sscore_WidthTooLargeForIphoneError, // the system width is limited on the iPhone-only licensed framework 
    sscore_HeightTooLargeForIphoneError, // the system height is limited on the iPhone-only licensed framework 
    sscore_NullScoreError, 
    sscore_NoBufferError, // the buffer point supplied to a function is NULL or the buffersize is too small 
    sscore_BadPartIndexError, 
    sscore_BadBarIndexError, 
    sscore_UnlicensedFunctionError, // a function has been called with an invalid license 
    sscore_NoImplError, // a function or feature is not currently implemented 
    sscore_InternalFault, 
    sscore_ItemNotFoundError, 
    sscore_ArgumentError, 
    sscore_SoundSampleLoadFailedError, 
    sscore_SoundSetupFailedError, 
    sscore_SynthStartFailedError, 
    sscore_SynthNoInstrumentsError, // addInstrument was not called 
    sscore_SynthNoPlayData, // synth not called setup before start 
    sscore_WrongTimingBarCountError,// sscore_pd_timing struct contains too few bars defined 
    sscore_SaveFailed 
};  

sscore_layoutOptionsFlagBits


bit flags for layout options flags field

enum sscore_layoutOptionsFlagBits { 
    sscore_simplifyHarmonyEnharmonicSpelling_bit = 0x01, // set this flag so F-double-sharp appears in a harmony as G 
    sscore_layoutopt_ignorexmlpositions_bit = 0x02, // set this flag to ignore default-x,default-y,relative-x,relative-y positions 
    sscore_layoutopt_expandrepeat_bit = 0x04, // not yet implemented 
    sscore_layoutopt_editmode_bit = 0x08, // set for edit mode increased staff spacings 
    sscore_layoutopt_heedXMLxLayout_bit = 0x10, // set to use any XML-defined x layout information (default-x in notes and measure widths) 
    sscore_layoutopt_redbeyondbarend_bit = 0x10000 // set to display notes in red if they are beyond the end of the bar as defined by the time signature 
};  

sscore_loadopt_flagbits


flag bits for load

enum sscore_loadopt_flagbits { 
    sscore_loadopt_checkxml_bit = 1, // when set various logical tests will be performed after loading and results reported as warnings 
    sscore_loadopt_generatebeams_bit = 2 
};  

sscore_savetype


save compressed or uncompressed

enum sscore_savetype { 
    sscore_savetype_uncompressed, 
    sscore_savetype_compressed, 
    sscore_savetype_default // use this to save as same type as source file (if there is a source file), else compressed 
};  

sscore_system_stafflocation_e


define vertical location relative to the staff

enum sscore_system_stafflocation_e {
    sscore_system_staffloc_undefined,
    sscore_system_staffloc_above,
    sscore_system_staffloc_instaff,
    sscore_system_staffloc_below 
};  

sscore_texttype


type of text determining preset font to use

enum sscore_texttype { 
    sscore_lyricText, // to define font for lyrics 
    sscore_directionText, // ..directions 
    sscore_metronomeText, // ..metronome marking 
    sscore_barNumberText, // ..bar numbers 
    sscore_repeatBarText, // ..repeat bar text 
    sscore_octaveShiftText, // ..octave shift 
    sscore_slideText, // text over slide 
    sscore_tupletText, // .. text over tuplets 
    sscore_harmonyText, // ..harmony text 
    sscore_harmonyFrameText, // .. guitar frame text 
    sscore_tabStaffText, // ..tab staff text 
    sscore_fingeringText, // .. fingering text 
    sscore_rehearsalText, // ..rehearsal marking text (eg A,B etc) 
    sscore_partNameText, // .. part name text 
    sscore_partGroupNameText // .. part group name text 
};  

sscore_warning


all warnings

enum sscore_warning { 
    sscore_warning_none, 
    sscore_warning_missingelement, // <accidental> or <stem> elements are not defined in the file and will be reconstructed by SeeScore 
    sscore_warning_measurecount, // different parts do not have the same number of measures 
    sscore_warning_beamcount, // a note has the wrong number of beams defined for the note type 
    sscore_warning_consistency, // an error in ordering of beam,slur,tied,tuplet begin/start,continue,end/stop 
    sscore_warning_unexpectedStart, // beam/slur/tie/tuplet.. 2nd start 
    sscore_warning_unexpectedContinue, // beam/slur continue without start 
    sscore_warning_unexpectedStop, // beam/slur/tie/tuplet stop without start 
    sscore_warning_unclosed, // beam/slur/tied/tuplet unclosed at end of score/measure 
    sscore_warning_unpaired, // half of paired type (start/stop) is missing or extra 
    sscore_warning_badlevel // level number is > 6 
};