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 | Field and Description |
---|---|
static int |
Bartype_default
for default argument
|
static int |
Bartype_full_bar
a normal full bar
|
static int |
Bartype_partial_bar_end
partial bar missing beat 1 (ie after repeat mark)
|
static int |
Bartype_partial_bar_start
partial bar including beat 1 (ie before repeat mark)
|
static int |
Bartype_partial_first_bar
partial bar is first bar in score (ie anacrusis)
|
Modifier and Type | Method and Description |
---|---|
TimeSig |
actualBeatsForBar(int barIndex)
get the actual number of beats in the bar and the beat type
This is normally the same as timeSigForBar, but will have fewer beats for a partial bar (eg anacrusis)
|
int |
barTypeForBar(int barIndex)
get the type of the bar
|
int |
convertTempoToBPM(Tempo tempo,
TimeSig timesig)
get a beats-per-minute value for a given Tempo and TimeSig
|
BarBeats |
getBarBeats(int barIndex,
int bpm,
int bartype)
get the number of beats in a bar and the beat timing
|
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.
|
boolean |
hasDefinedTempo()
does the score define any tempo at the start with metronome or sound tempo elements?
|
void |
layout(android.graphics.Canvas canvas,
android.content.res.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(android.graphics.Canvas canvas,
android.content.res.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.
|
Tempo |
metronomeForBar(int barIndex)
get information about any metronome defined in the bar
|
int |
numBars()
Get the total number of bars in the score.
|
int |
numParts()
Get the number of parts in the score.
|
int |
numStavesForPart(int partIndex)
Get the number of staves in a given part
|
void |
setTranspose(int semitones)
set a transposition for the score.
|
Tempo |
tempoAtBar(int barIndex)
get the effective tempo at the bar accounting for any sound tempo elements and metronome elements
|
Tempo |
tempoAtStart()
get the effective tempo at start of the score accounting for any sound tempo elements and metronome elements
|
TimeSig |
timeSigForBar(int barIndex)
get the applicable time signature for a particular bar
|
public static final int Bartype_full_bar
public static final int Bartype_partial_first_bar
public static final int Bartype_partial_bar_start
public static final int Bartype_partial_bar_end
public static final int Bartype_default
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 int numStavesForPart(int partIndex)
partIndex
- the part indexpublic PartName getPartNameForPart(int partindex)
partindex
- the index of the part [0..numparts-1]public SSystem layout1System(android.graphics.Canvas canvas, android.content.res.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(android.graphics.Canvas canvas, android.content.res.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
public boolean hasDefinedTempo()
public int barTypeForBar(int barIndex)
barIndex
- public TimeSig timeSigForBar(int barIndex) throws ScoreException
barIndex
- the index of the bar. 0 is the first barScoreException
- on errorpublic TimeSig actualBeatsForBar(int barIndex) throws ScoreException
barIndex
- the index of the bar. 0 is the first barScoreException
- on errorpublic Tempo metronomeForBar(int barIndex) throws ScoreException
barIndex
- the index of the bar. 0 is the first barScoreException
- on errorpublic Tempo tempoAtBar(int barIndex) throws ScoreException
barIndex
- the index of the bar (0 is 1st)ScoreException
- on errorpublic Tempo tempoAtStart() throws ScoreException
ScoreException
- on errorpublic int convertTempoToBPM(Tempo tempo, TimeSig timesig)
tempo
- the score-defined or user-defined tempotimesig
- the effective time signaturepublic BarBeats getBarBeats(int barIndex, int bpm, int bartype) throws ScoreException
barIndex
- the index of the bar (0 is 1st)bpm
- the effective beats-per-minute valuebartype
- one of Bartype_?ScoreException