public class SScore
extends java.lang.Object
loadXMLFile() or loadXMLData() should be used to load a file and create a SScore object
layout() should be called on a background thread to create a layout, and SSystems are generated sequentially from the top and can be added to the display as they are produced. This is handled by uk.co.dolphin_com.seescoreandroid.SeeScoreView
numBars(), numParts(), getHeader(), getPartNameForPart(), getBarNumberForIndex() all return basic information about the score.
setTranspose() allows you to transpose the score.
Other methods return detailed information about items in the score and require a contents or contents-detail licence.
Modifier and Type | Method and Description |
---|---|
BarGroup |
getBarContents(int partindex,
int barindex)
Get information about the contents of a particular part/bar.
|
java.lang.String |
getBarNumberForIndex(int barindex)
Get the bar number (String) given the index.
|
Header |
getHeader()
Get the xml score-header information.
|
TimedItem |
getItemForHandle(int partindex,
int barindex,
int item_h)
return detailed information about an item in the score.
|
LoadWarning[] |
getLoadWarnings()
Get any warnings about problems with the file consistency discovered during load.
|
PartName |
getPartNameForPart(int partindex)
Return the name for the part.
|
int |
getTranspose()
Get the current transpose value set with setTranspose.
|
static Version |
getVersion()
Get the version of the SeeScore library
|
java.lang.String |
getXmlForBar(int partindex,
int barindex)
Return the raw XML for this given part/bar index as a String.
|
java.lang.String |
getXmlForItem(int partindex,
int barindex,
int item_h)
return the XML for the item in the part/bar.
|
void |
layout(Canvas canvas,
AssetManager am,
int displayDPI,
float width,
float max_system_height,
boolean[] parts,
LayoutCallback cb,
float magnification,
LayoutOptions opt)
Layout a set of systems and return them through a callback function.
|
SSystem |
layout1System(Canvas canvas,
AssetManager am,
int displayDPI,
int startbarindex,
float width,
float max_height,
int partindex,
float magnification)
Layout a single system with a single part.
|
static SScore |
loadXMLData(byte[] buffer,
LoadOptions loadOptions)
Load xml data in UTF-8 byte buffer and return score.
|
static SScore |
loadXMLFile(java.io.File file,
LoadOptions loadOptions)
Load xml file and return score.
|
int |
numBars()
Get the total number of bars in the score.
|
int |
numParts()
Get the number of parts in the score.
|
void |
setTranspose(int semitones)
set a transposition for the score.
|
public static Version getVersion()
public static SScore loadXMLData(byte[] buffer, LoadOptions loadOptions) throws ScoreException
buffer
- contains the xmlloadOptions
- the options for load, or NULL for default optionsScoreException
- defining any error on loadpublic static SScore loadXMLFile(java.io.File file, LoadOptions loadOptions) throws ScoreException
file
- the full pathname of the file to loadloadOptions
- the options for load including the licence keyScoreException
- defining any error on loadpublic LoadWarning[] getLoadWarnings()
public int numBars()
public int numParts()
public PartName getPartNameForPart(int partindex)
partindex
- the index of the part [0..numparts-1]public SSystem layout1System(Canvas canvas, AssetManager am, int displayDPI, int startbarindex, float width, float max_height, int partindex, float magnification)
Useful for display of individual parts for part selection.
canvas
- the canvas is used to measure bounds of itemsam
- the AssetManager is used to load fonts from assetsdisplayDPI
- the dots-per-inch value for the display viz. android.view.Display.getMetrics(android.util.DisplayMetrics).densityDPIstartbarindex
- the index of the first bar in the system (usually 0)max_height
- the maximum height available to display the system to control truncation. =0 for no truncationpartindex
- the index of the single part to layout [0..numparts-1]magnification
- the scale at which to display this (1.0 is default)public void layout(Canvas canvas, AssetManager am, int displayDPI, float width, float max_system_height, boolean[] parts, LayoutCallback cb, float magnification, LayoutOptions opt) throws ScoreException
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 this SScore as they are produced.
This allows the UI to remain active during concurrent layout which may take many seconds
canvas
- the canvas is used to measure bounds of itemsam
- the AssetManager is used to load fonts from assetsdisplayDPI
- the dots-per-inch value for the display viz. android.view.Display.getMetrics(android.util.DisplayMetrics).densityDPIwidth
- the width available to display the systems in screen coordinatesmax_system_height
- the maximum height available to display each system to control truncation. =0 for no truncationparts
- array of boolean, 1 per part, true to include, false to excludecb
- the callback function to be called for each completed systemmagnification
- the scale at which to display this (1.0 is default)opt
- pointer to options or NULL for defaultScoreException
- defining any error encountered during layoutpublic Header getHeader()
public java.lang.String getBarNumberForIndex(int barindex)
barindex
- integer index [0..numBars-1]public void setTranspose(int semitones) throws ScoreException
Requires the transpose licence.
semitones
- (- for down, + for up)ScoreException
public int getTranspose()
Requires the transpose licence.
public TimedItem getItemForHandle(int partindex, int barindex, int item_h) throws ScoreException
Requires contents-detail licence.
partindex
- 0-based part index - 0 is the top partbarindex
- 0-based bar indexitem_h
- unique id for itemScoreException
public java.lang.String getXmlForItem(int partindex, int barindex, int item_h) throws ScoreException
Requires contents licence.
partindex
- the 0-based part index - 0 is topbarindex
- the 0-based bar indexitem_h
- the unique id of the itemScoreException
public BarGroup getBarContents(int partindex, int barindex) throws ScoreException
Requires contents licence.
partindex
- the index of the part (0-based)barindex
- the index of the bar (0-based)ScoreException
public java.lang.String getXmlForBar(int partindex, int barindex) throws ScoreException
Requires contents-detail licence.
partindex
- the index of the part (0-based)barindex
- the index of the bar (0-based)ScoreException