sscore_playdata.h

Includes:

Introduction

The C interface to play information in SeeScoreLib

The barindex parameter is zero-based. ie 0 is the first bar in the score. All times are in milliseconds



C Pseudoclasses

sscore_playdata

hidden score data



Groups

sscore_pd_barnotes_iterator

Group members:

sscore_pd_bi_begin

an iterator to notes in the current and next bar

sscore_pd_bi_endnext

an iterator 1 past the last note in next bar so begin->endnext includes all notes in 2 bars so that the bar transition is covered

sscore_pd_bi_endthis

an iterator 1 past the last note in the bar/part

sscore_pd_bi_metronome_begin

an iterator to pseudo metronome notes in the current and next bar

sscore_pd_bi_metronome_endnext

an iterator 1 past the last note in the metronome sequence for this bar and the next bar

sscore_pd_bi_metronome_endthis

an iterator 1 past the last note in the metronome sequence for the bar

sscore_pd_bni_dec

decrement the barnotes iterator so sscore_pd_bni_getnote returns the previous note

sscore_pd_bni_equal

compare 2 iterators

sscore_pd_bni_getnote

get the note information at the current iterator position

sscore_pd_bni_inc

increment the barnotes iterator so sscore_pd_bni_getnote returns the next note

sscore_pd_bni_incbyindex

increment the barnotes iterator by index

sscore_pd_bni_less

compare 2 iterators

sscore_pd_create_midifile

create a MIDI file from the playdata

sscore_pd_create_midifile_control

create a MIDI file from the playdata

sscore_pd_scalemidifiletempo

poke a new tickrate value into the midi file to scale the tempo

 

sscore_pd_bar_iterator

all functions must be called on a single thread

Group members:

sscore_pd_begin

an iterator to the start bar of the piece (viz STL container)

sscore_pd_bi_barduration

the duration of the current bar in ms

sscore_pd_bi_barduration_midi

the duration of the current bar in midi ticks (24 per crotchet)

sscore_pd_bi_barindex

get the index of the current bar

sscore_pd_bi_canchangebar

true if sscore_pd_bi_changebar will succeed with these parameters

sscore_pd_bi_changebar

move the bar iterator to the given bar index. This will fail if it is outside the range of any defined loop on this iterator

sscore_pd_bi_converttocountin

convert an iterator to work for a count-in bar ie with a maximum of 4 beats

sscore_pd_bi_dec

move the bar iterator to the previous bar accounting for repeats. Unchanged if at beginning

sscore_pd_bi_equal

compare 2 iterators

sscore_pd_bi_getnotesampleinfo

get information about notes required for preloading note samples ahead of time

sscore_pd_bi_inc

move the bar iterator to the next bar accounting for repeats. Unchanged if at end. If bi is a looping iterator and it is at the last bar in the loop it goes to the first bar in the loop

sscore_pd_bi_incbyindex

increment the bar iterator by index

sscore_pd_bi_iscountin

count-in bar?

sscore_pd_bi_key

the key signature in the bar

sscore_pd_bi_keysig

the key signature in the bar

sscore_pd_bi_less

compare 2 iterators

sscore_pd_bi_metronomebeatsinbar

the number of metronome ticks, max 4 if count-in bar

sscore_pd_bi_nextbarindex

index of next bar

sscore_pd_bi_seqindex

play index of bar in nondecreasing sequence

sscore_pd_bi_tempo_crotchet_bpm

return the crotchet beats per minute in this bar

sscore_pd_bi_timesig

the time signature in the bar

sscore_pd_end

an iterator to 1 past the end bar of the piece

sscore_pd_loopbegin

get an iterator which goes repeatedly from startBarIndex to loopBarIndex for the given number of repeats

sscore_pd_loopend

get an iterator for the end of looping of loopbegin

 

sscore_playdata

Group members:

sscore_pd_abbrevpartname
sscore_pd_disposeplaydata

dispose the playdata

sscore_pd_firstbaranacrusis

detect partial first bar (anacrusis)

sscore_pd_fullpartname
sscore_pd_getusertempo

internal function

sscore_pd_hasdataformetronome
sscore_pd_hasdataforpart
sscore_pd_maxdynamic

maximum value of any sound dynamic value in all bars

sscore_pd_midiprogramchange
sscore_pd_newplaydata

create playdata which provides iterators for bar and note access

sscore_pd_newplaydata_singlebar

create playdata for single part/single bar only

sscore_pd_newplaydata_singlechord

create playdata for single note or chord only

sscore_pd_newplaydata_singlepart

create playdata for single part/single bar only

sscore_pd_newplaydata_withtiming

create playdata which is synchronised to the timing array

sscore_pd_numparts
sscore_pd_numstavesforpart
sscore_pd_title
sscore_pd_virtualinstrumentlibrary
sscore_pd_virtualinstrumentname

Functions

sscore_pd_abbrevpartname
sscore_pd_actualbeatsforbar

get the effective time signature information for a bar

sscore_pd_bartypeforbar

get information about a partial bar with fewer beats than the time signature (anacrusis or double-barline bar)

sscore_pd_begin

an iterator to the start bar of the piece (viz STL container)

sscore_pd_bi_barduration

the duration of the current bar in ms

sscore_pd_bi_barduration_midi

the duration of the current bar in midi ticks (24 per crotchet)

sscore_pd_bi_barindex

get the index of the current bar

sscore_pd_bi_begin

an iterator to notes in the current and next bar

sscore_pd_bi_canchangebar

true if sscore_pd_bi_changebar will succeed with these parameters

sscore_pd_bi_changebar

move the bar iterator to the given bar index. This will fail if it is outside the range of any defined loop on this iterator

sscore_pd_bi_converttocountin

convert an iterator to work for a count-in bar ie with a maximum of 4 beats

sscore_pd_bi_dec

move the bar iterator to the previous bar accounting for repeats. Unchanged if at beginning

sscore_pd_bi_endnext

an iterator 1 past the last note in next bar so begin->endnext includes all notes in 2 bars so that the bar transition is covered

sscore_pd_bi_endthis

an iterator 1 past the last note in the bar/part

sscore_pd_bi_equal

compare 2 iterators

sscore_pd_bi_getnotesampleinfo

get information about notes required for preloading note samples ahead of time

sscore_pd_bi_inc

move the bar iterator to the next bar accounting for repeats. Unchanged if at end. If bi is a looping iterator and it is at the last bar in the loop it goes to the first bar in the loop

sscore_pd_bi_incbyindex

increment the bar iterator by index

sscore_pd_bi_iscountin

count-in bar?

sscore_pd_bi_key

the key signature in the bar

sscore_pd_bi_keysig

the key signature in the bar

sscore_pd_bi_less

compare 2 iterators

sscore_pd_bi_metronome_begin

an iterator to pseudo metronome notes in the current and next bar

sscore_pd_bi_metronome_endnext

an iterator 1 past the last note in the metronome sequence for this bar and the next bar

sscore_pd_bi_metronome_endthis

an iterator 1 past the last note in the metronome sequence for the bar

sscore_pd_bi_metronomebeatsinbar

the number of metronome ticks, max 4 if count-in bar

sscore_pd_bi_nextbarindex

index of next bar

sscore_pd_bi_seqindex

play index of bar in nondecreasing sequence

sscore_pd_bi_tempo_crotchet_bpm

return the crotchet beats per minute in this bar

sscore_pd_bi_timesig

the time signature in the bar

sscore_pd_bni_dec

decrement the barnotes iterator so sscore_pd_bni_getnote returns the previous note

sscore_pd_bni_equal

compare 2 iterators

sscore_pd_bni_getnote

get the note information at the current iterator position

sscore_pd_bni_inc

increment the barnotes iterator so sscore_pd_bni_getnote returns the next note

sscore_pd_bni_incbyindex

increment the barnotes iterator by index

sscore_pd_bni_less

compare 2 iterators

sscore_pd_converttempotobpm

convert a tempo with a given beat type to the given time sig beat type

sscore_pd_create_midifile

create a MIDI file from the playdata

sscore_pd_create_midifile_control

create a MIDI file from the playdata

sscore_pd_disposeplaydata

dispose the playdata

sscore_pd_end

an iterator to 1 past the end bar of the piece

sscore_pd_firstbaranacrusis

detect partial first bar (anacrusis)

sscore_pd_fullpartname
sscore_pd_getbarbeats

get the beats and divisions in a bar and the duration

sscore_pd_getusertempo

internal function

sscore_pd_hasdataformetronome
sscore_pd_hasdataforpart
sscore_pd_hasdefinedtempo

is tempo defined in the score?

sscore_pd_loopbegin

get an iterator which goes repeatedly from startBarIndex to loopBarIndex for the given number of repeats

sscore_pd_loopend

get an iterator for the end of looping of loopbegin

sscore_pd_maxdynamic

maximum value of any sound dynamic value in all bars

sscore_pd_metronomeforbar

get any metronome defined in or before a bar

sscore_pd_midiprogramchange
sscore_pd_newplaydata

create playdata which provides iterators for bar and note access

sscore_pd_newplaydata_singlebar

create playdata for single part/single bar only

sscore_pd_newplaydata_singlechord

create playdata for single note or chord only

sscore_pd_newplaydata_singlepart

create playdata for single part/single bar only

sscore_pd_newplaydata_withtiming

create playdata which is synchronised to the timing array

sscore_pd_numparts
sscore_pd_numstavesforpart
sscore_pd_scalemidifiletempo

poke a new tickrate value into the midi file to scale the tempo

sscore_pd_tempoatbar

get any tempo applying at the start of the given bar

sscore_pd_tempoatstart

get any tempo applying at the start of the score

sscore_pd_timesigforbar

get information about the notated time signature which applies to a bar

sscore_pd_title
sscore_pd_virtualinstrumentlibrary
sscore_pd_virtualinstrumentname

sscore_pd_abbrevpartname


EXPORT const char *sscore_pd_abbrevpartname(
    const sscore_playdata *pd,
    int partindex);  
Return Value

the abbreviated name of the part eg "Pno"


sscore_pd_actualbeatsforbar


get the effective time signature information for a bar

EXPORT enum sscore_error sscore_pd_actualbeatsforbar(
    const sscore *sc,
    int barindex,
    sscore_timesig *timesig);  
Parameters
sc

the score

barindex

the index of the bar

timesig

receives the effective time signature by counting divisions in (top part) bar

Return Value

any error

Discussion

This should return the same value as sscore_timesigforbar for a full bar, less for a partial bar


sscore_pd_bartypeforbar


get information about a partial bar with fewer beats than the time signature (anacrusis or double-barline bar)

EXPORT enum sscore_bartype_e sscore_pd_bartypeforbar(
    const sscore *sc,
    int barindex);  
Parameters
sc

the score

barindex

the index of the bar (the first bar has index 0)

Return Value

type of partial bar

Discussion

it is important to know if a partial bar contains the first beat or the last beat


sscore_pd_begin


an iterator to the start bar of the piece (viz STL container)

Parameters
pd

the playdata

Return Value

an iterator to the start bar of the piece

Discussion

increment the iterator to move to the next bar in play order allowing for repeats


sscore_pd_bi_barduration


the duration of the current bar in ms

Parameters
bi

the bar iterator

Return Value

duration of bar in ms


sscore_pd_bi_barduration_midi


the duration of the current bar in midi ticks (24 per crotchet)

EXPORT int sscore_pd_bi_barduration_midi(
    const sscore_pd_bar_iterator *bi,
    int crotchet_duration);  
Parameters
bi

the bar iterator

crotchet_duration

midi crotchet duration ticks

Return Value

duration of bar in midi ticks


sscore_pd_bi_barindex


get the index of the current bar

Parameters
bi

the bar iterator

Return Value

the index of the bar which the iterator refers to (0 for first bar)


sscore_pd_bi_begin


an iterator to notes in the current and next bar

Parameters
bi

the bar iterator

partindex

the part index

Return Value

the start barnotes iterator pointing to the first played note in the bar.

Discussion

increment the returned iterator (sscore_pd_bni_inc) to move to the next note in time order in the given part 'dereference' the iterator (sscore_pd_bni_getnote) to get the note information NB The iterator never returns the right hand note of a tie, as that only modifies the duration of the first tied note


sscore_pd_bi_canchangebar


true if sscore_pd_bi_changebar will succeed with these parameters

EXPORT bool sscore_pd_bi_canchangebar(
    const sscore_pd_bar_iterator *bi,
    int barindex);  
Parameters
bi

the iterator

barindex

the new bar index


sscore_pd_bi_changebar


move the bar iterator to the given bar index. This will fail if it is outside the range of any defined loop on this iterator

EXPORT bool sscore_pd_bi_changebar(
    sscore_pd_bar_iterator *bi,
    int barindex);  
Parameters
bi

the bar iterator

barindex

the new bar index - if repeat it is the closest repeat to the current position

Return Value

true if successful


sscore_pd_bi_converttocountin


convert an iterator to work for a count-in bar ie with a maximum of 4 beats

Parameters
bi

the normal bar iterator

Return Value

an iterator converted to produce a count-in bar


sscore_pd_bi_dec


move the bar iterator to the previous bar accounting for repeats. Unchanged if at beginning

Parameters
bi

the iterator to be updated.


sscore_pd_bi_endnext


an iterator 1 past the last note in next bar so begin->endnext includes all notes in 2 bars so that the bar transition is covered

Parameters
bi

the bar iterator

partindex

the part index

Return Value

the past-end barnotes iterator

Discussion

compare a barnotes iterator with this to detect the end of sequence


sscore_pd_bi_endthis


an iterator 1 past the last note in the bar/part

Parameters
bi

the bar iterator

partindex

the part index

Return Value

the past-end barnotes iterator

Discussion

compare a barnotes iterator with this to detect the end of sequence for the bar


sscore_pd_bi_equal


compare 2 iterators

EXPORT bool sscore_pd_bi_equal(
    const sscore_pd_bar_iterator *bi1,
    const sscore_pd_bar_iterator *bi2);  
Parameters
bi1
bi2
Return Value

true if iterators are equal (point to the same bar, same repeat)


sscore_pd_bi_getnotesampleinfo


get information about notes required for preloading note samples ahead of time

EXPORT enum sscore_error sscore_pd_bi_getnotesampleinfo(
    const sscore_pd_bar_iterator *bi,
    int numbars,
    const sscore_pd_partset *partset,
    sscore_pd_notesamples *rval);  
Parameters
bi

the bar iterator

numbars

the number of bars to collect note sample data for, ahead of the current bar (1 for just the current bar)

partset

the set of parts to harvest information from (eg the set of parts played by a particular instrument for precacheing notes for that instrument)

rval

on return contains the information about notes required in coming numbars. NB The maximum time for any particular note is returned

Return Value

any error


sscore_pd_bi_inc


move the bar iterator to the next bar accounting for repeats. Unchanged if at end. If bi is a looping iterator and it is at the last bar in the loop it goes to the first bar in the loop

Parameters
bi

the iterator to be updated.


sscore_pd_bi_incbyindex


increment the bar iterator by index

EXPORT void sscore_pd_bi_incbyindex(
    sscore_pd_bar_iterator *bi,
    int index);  
Parameters
bi

the iterator to be updated.


sscore_pd_bi_iscountin


count-in bar?

Parameters
bi

the normal bar iterator

Return Value

true for a count-in bar


sscore_pd_bi_key


the key signature in the bar

EXPORT int sscore_pd_bi_keysig(
    int partindex,
    const sscore_pd_bar_iterator *bi);  
Parameters
partindex

the part index

bi

the bar iterator

Return Value

key signature - positive indicates number of sharps in key sig, negative indicates number of flats


sscore_pd_bi_keysig


the key signature in the bar

EXPORT int sscore_pd_bi_keysig(
    int partindex,
    const sscore_pd_bar_iterator *bi);  
Parameters
partindex

the part index

bi

the bar iterator

Return Value

key signature - positive indicates number of sharps in key sig, negative indicates number of flats


sscore_pd_bi_less


compare 2 iterators

EXPORT bool sscore_pd_bi_less(
    const sscore_pd_bar_iterator *bi1,
    const sscore_pd_bar_iterator *bi2);  
Parameters
bi1
bi2
Return Value

true if bi1 is at an earlier bar than bi2


sscore_pd_bi_metronome_begin


an iterator to pseudo metronome notes in the current and next bar

Parameters
bi

the bar iterator

Return Value

the barnotes iterator

Discussion

the metronome is modelled as a series of notes, 1 per beat in each bar. The correct bar sequence time signature changes are followed


sscore_pd_bi_metronome_endnext


an iterator 1 past the last note in the metronome sequence for this bar and the next bar

Parameters
bi

the bar iterator

Return Value

the barnotes iterator


sscore_pd_bi_metronome_endthis


an iterator 1 past the last note in the metronome sequence for the bar

Parameters
bi

the bar iterator

Return Value

the barnotes iterator


sscore_pd_bi_metronomebeatsinbar


the number of metronome ticks, max 4 if count-in bar

Parameters
bi

the bar iterator

Return Value

the number of metronome beats in the bar


sscore_pd_bi_nextbarindex


index of next bar

Parameters
bi

the iterator

Return Value

index of the next bar after inc if canadvance, else sscore_pd_kAfterEndBarIndex


sscore_pd_bi_seqindex


play index of bar in nondecreasing sequence

Parameters
bi

the iterator

Return Value

sequential play index of the bar accounting for any repeats


sscore_pd_bi_tempo_crotchet_bpm


return the crotchet beats per minute in this bar

Parameters
bi

the bar iterator

Return Value

the crotchet tempo


sscore_pd_bi_timesig


the time signature in the bar

EXPORT sscore_timesig sscore_pd_bi_timesig(
    int partindex,
    const sscore_pd_bar_iterator *bi);  
Parameters
partindex

the part index

bi

the bar iterator

Return Value

time signature


sscore_pd_bni_dec


decrement the barnotes iterator so sscore_pd_bni_getnote returns the previous note

Parameters
bni

the iterator


sscore_pd_bni_equal


compare 2 iterators

Parameters
bni1
bni2
Return Value

true if iterators are equal


sscore_pd_bni_getnote


get the note information at the current iterator position

Parameters
bni

the barnotes iterator

Return Value

play information about a note


sscore_pd_bni_inc


increment the barnotes iterator so sscore_pd_bni_getnote returns the next note

Parameters
bni

the iterator

Discussion

notes are returned in non-decreasing start time order


sscore_pd_bni_incbyindex


increment the barnotes iterator by index

EXPORT void sscore_pd_bni_incbyindex(
    sscore_pd_barnotes_iterator *bni,
    int index);  
Parameters
bni

the barnotes iterator


sscore_pd_bni_less


compare 2 iterators

Parameters
bni1
bni2
Return Value

true if bni1 is earlier in the score than bni2 (assuming same playdata and part)


sscore_pd_converttempotobpm


convert a tempo with a given beat type to the given time sig beat type

EXPORT int sscore_pd_converttempotobpm(
    const sscore_pd_tempo *tempo,
    const sscore_timesig *timesig);  
Parameters
tempo

the tempo value to convert

timesig

the time signature for conversion

Return Value

beats per minute

Discussion

this is useful for converting sound tempo values, which are always crotchet relative (beat = 4) to the current time signature


sscore_pd_create_midifile


create a MIDI file from the playdata

EXPORT enum sscore_error sscore_pd_create_midifile(
    const sscore_playdata *pd,
    const char *midifilename);  
Parameters
pd

the playdata

midifilename

full pathname for the midifile

Return Value

error


sscore_pd_create_midifile_control


create a MIDI file from the playdata

EXPORT enum sscore_error sscore_pd_create_midifile_control(
    const sscore_playdata *pd, 
    const char *midifilename, 
    const sscore_pd_controls *controls, 
    const sscore_pd_midi_params *params);  
Parameters
pd

the playdata

midifilename

full pathname for the midifile

controls

define which parts and which staves are enabled for output to the file

params

other optional parameters, may be NULL if unused

Return Value

error

Discussion

licence playloop_capable is required to use the playloop function


sscore_pd_disposeplaydata


dispose the playdata

EXPORT void sscore_pd_disposeplaydata(
    const sscore_playdata *pd);  
Parameters
pd

the playdata

Discussion

dispose the memory allocated for this by sscore_pd_newplaydata


sscore_pd_end


an iterator to 1 past the end bar of the piece

Parameters
pd

the playdata

Return Value

an iterator to 1 past the end bar of the piece

Discussion

if the iterator is equal to this then the play is finished


sscore_pd_firstbaranacrusis


detect partial first bar (anacrusis)

EXPORT bool sscore_pd_firstbaranacrusis(
    const sscore_playdata *pd);  
Parameters
pd

the sscore_playdata

Return Value

true if 1st bar starts after first beat


sscore_pd_fullpartname


EXPORT const char *sscore_pd_fullpartname(
    const sscore_playdata *pd,
    int partindex);  
Return Value

the full name of the part eg "Piano"


sscore_pd_getbarbeats


get the beats and divisions in a bar and the duration

EXPORT enum sscore_error sscore_pd_getbarbeats(
    const sscore *sc,
    int barindex,
    int bpm,
    enum sscore_bartype_e bartype,
    sscore_pd_barbeats *barbeats);  
Parameters
sc

the score

barindex

the index of the bar

bpm

the beats-per-minute value

bartype

use sscore_bartype_full_bar to get all the beats in the time signature, or sscore_bartype_default to get the actual number

barbeats

receives the number and duration of beats in the given bar with the given beats per minute

Return Value

any error


sscore_pd_getusertempo


internal function

Parameters
pd

the sscore_playdata

Return Value

the sscore_pd_usertempo


sscore_pd_hasdataformetronome


Return Value

true if the metronome is enabled for play


sscore_pd_hasdataforpart


EXPORT bool sscore_pd_hasdataforpart(
    const sscore_playdata *pd,
    int partindex);  
Return Value

true if the part is enabled for play


sscore_pd_hasdefinedtempo


is tempo defined in the score?

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

the score

Return Value

true if the score defines tempo (metronome or sound tempo element).

Discussion

If this returns true then sscore_pd_usertempo.get_user_tempo_scaling will be called, else sscore_pd_usertempo.get_user_bpm will be used


sscore_pd_loopbegin


get an iterator which goes repeatedly from startBarIndex to loopBarIndex for the given number of repeats

EXPORT sscore_pd_bar_iterator sscore_pd_loopbegin(
    const sscore_playdata *pd,
    int startBarIndex,
    int loopBarIndex,
    int numRepeats);  
Parameters
pd

the playdata

startBarIndex

the index for the bar to loop from and return to at the start of each loop

loopBarIndex

the index for the last bar to play in the loop

numRepeats

the number of loops

Return Value

an iterator which loops between the specified bars

Discussion

licence playloop_capable is required to use this function


sscore_pd_loopend


get an iterator for the end of looping of loopbegin

Parameters
pd

the playdata

begin

the start iterator returned from sscore_pd_loopbegin

Return Value

an iterator to the end of the loop


sscore_pd_maxdynamic


maximum value of any sound dynamic value in all bars

EXPORT float sscore_pd_maxdynamic(
    const sscore_playdata *pd);  
Parameters
pd

the sscore_playdata

Return Value

max sound dynamic value in score or 0 if none defined


sscore_pd_metronomeforbar


get any metronome defined in or before a bar

EXPORT enum sscore_error sscore_pd_metronomeforbar(
    const sscore *sc,
    int barindex,
    sscore_pd_tempo *tempo);  
Parameters
sc

the score

barindex

the index of the bar

tempo

on exit contains any metronome defined at the bar, or 0 if undefined

Return Value

sscore_ItemNotFoundError if no metronome value defined


sscore_pd_midiprogramchange


EXPORT int sscore_pd_midiprogramchange(
    const sscore_playdata *pd,
    int partindex);  
Return Value

the program change value if virtual instrument is correctly defined in the MusicXML, else return 0

Discussion

if the <virtual-instrument><virtual-library> element contains "General MIDI" then lookup the string value of the <virtual-instrument><virtual-name> element in Program Change table of standard instrument names in MIDI spec 1.1 http://www.midimusic.org.uk/tech/midispec.html of the


sscore_pd_newplaydata


create playdata which provides iterators for bar and note access

EXPORT const sscore_playdata *sscore_pd_newplaydata(
    const sscore *sc, 
    const sscore_pd_usertempo *usertempo, 
    const sscore_libkeytype *key);  
Parameters
sc

the score

usertempo

callbacks for realtime user defined tempo

key

the key defining licenses owned by the user. If this key does not include a playdata licence then this will operate in evaluation mode and a limited number of notes will be returned after the app is started, after which every sscore_pd_note returned from sscore_pd_bni_getnote will have all fields set to 0

Return Value

pointer to new playdata


sscore_pd_newplaydata_singlebar


create playdata for single part/single bar only

EXPORT const sscore_playdata *sscore_pd_newplaydata_singlebar(
    const sscore *sc, 
    int partIndex,
    int barIndex, 
    const sscore_pd_usertempo *usertempo, 
    const sscore_libkeytype *key);  
Parameters
sc

the score

partIndex

the part index

barIndex

the bar index

usertempo

callbacks for realtime user defined tempo

key

the key defining licenses owned by the user.

Return Value

pointer to new playdata


sscore_pd_newplaydata_singlechord


create playdata for single note or chord only

EXPORT const sscore_playdata *sscore_pd_newplaydata_singlechord(
    const sscore *sc, 
    int partIndex,
    int barIndex,
    sscore_item_handle noteId, 
    const sscore_libkeytype *key);  
Parameters
sc

the score

partIndex

the part index

barIndex

the bar index

noteId

the sscore_item_handle for the note

key

the key defining licenses owned by the user.

Return Value

pointer to new playdata


sscore_pd_newplaydata_singlepart


create playdata for single part/single bar only

EXPORT const sscore_playdata *sscore_pd_newplaydata_singlepart(
    const sscore *sc, 
    int partIndex,
    int barIndex, 
    const sscore_pd_usertempo *usertempo, 
    const sscore_libkeytype *key);  
Parameters
sc

the score

partIndex

the part index

barIndex

the bar index

usertempo

callbacks for realtime user defined tempo

key

the key defining licenses owned by the user.

Return Value

pointer to new playdata


sscore_pd_newplaydata_withtiming


create playdata which is synchronised to the timing array

EXPORT const sscore_playdata *sscore_pd_newplaydata_withtiming(
    const sscore *sc, 
    const sscore_pd_usertempo *usertempo, 
    const sscore_pd_timinginfo *timing, 
    const sscore_libkeytype *key, 
    enum sscore_error *error);  
Parameters
sc

the score

usertempo

callbacks for realtime user defined tempo

timing

definition of timing to synchronise the playdata

key

the key defining licenses owned by the user. If this key does not include a playdata licence then this will operate in evaluation mode and a limited number of notes will be returned after the app is started, after which every sscore_pd_note returned from sscore_pd_bni_getnote will have all fields set to 0

error

if non-null this will be set to an error value

Return Value

pointer to new playdata


sscore_pd_numparts


EXPORT int sscore_pd_numparts(
    const sscore_playdata *pd);  
Return Value

number of parts in score


sscore_pd_numstavesforpart


EXPORT int sscore_pd_numstavesforpart(
    const sscore_playdata *pd,
    int partindex);  
Return Value

number of staves in part


sscore_pd_scalemidifiletempo


poke a new tickrate value into the midi file to scale the tempo

EXPORT void sscore_pd_scalemidifiletempo(
    const char *midifilename,
    float temposcaling);  
Parameters
midifilename

full pathname for the midifile

temposcaling

the new tempo scaling (nominal = 1.0)

Return Value

error


sscore_pd_tempoatbar


get any tempo applying at the start of the given bar

EXPORT enum sscore_error sscore_pd_tempoatbar(
    const sscore *sc,
    int barindex,
    sscore_pd_tempo *tempo);  
Parameters
sc

the score

tempo

on exit contains any tempo value defined

Return Value

sscore_ItemNotFoundError if no tempo value defined

Discussion

this returns in tempo a) any metronome value or b) any sound tempo value defined at the start of the given bar


sscore_pd_tempoatstart


get any tempo applying at the start of the score

EXPORT enum sscore_error sscore_pd_tempoatstart(
    const sscore *sc,
    sscore_pd_tempo *tempo);  
Parameters
sc

the score

tempo

on exit contains any tempo defined at the start of the piece

Return Value

sscore_ItemNotFoundError if no tempo value defined

Discussion

this returns in tempo a) any metronome value or b) any sound tempo value defined at the start of the score


sscore_pd_timesigforbar


get information about the notated time signature which applies to a bar

EXPORT enum sscore_error sscore_pd_timesigforbar(
    const sscore *sc,
    int barindex,
    sscore_timesig *timesig);  
Parameters
sc

the score

barindex

the index of the bar

timesig

receives the time signature info for the given bar (the first bar has index 0)

Return Value

any error


sscore_pd_title


EXPORT const char *sscore_pd_title(
    const sscore_playdata *pd);  
Parameters
pd

the playdata

Return Value

a suitable title string if available


sscore_pd_virtualinstrumentlibrary


EXPORT const char *sscore_pd_virtualinstrumentlibrary(
    const sscore_playdata *pd,
    int partindex);  
Return Value

the string value of the <virtual-instrument><virtual-library> element for the part - empty if non-existent


sscore_pd_virtualinstrumentname


EXPORT const char *sscore_pd_virtualinstrumentname(
    const sscore_playdata *pd,
    int partindex);  
Return Value

the string value of the <virtual-instrument><virtual-name> element for the part - empty if non-existent


Typedefs

sscore_barbeats

number and duration of beats in a bar

sscore_pd_bar_iterator

private bar iterator for accessing bars in correct sequence when playing

sscore_pd_barbeats

number and duration of beats in a bar

sscore_pd_barnotes_iterator

private bar notes iterator for playing

sscore_pd_controls

link to UI which defines playing parameters

sscore_pd_midi_params

define various midi parameters

sscore_pd_note

information about a note for playing

sscore_pd_notesample

information required for pre-loading a note sample

sscore_pd_notesamples

information required for pre-loading note samples

sscore_pd_partset

define playing parts

sscore_pd_tempo

tempo information

sscore_pd_timinginfo

specification of beat timing for media synchronisation

sscore_pd_usertempo

define realtime user tempo specification


sscore_barbeats


number and duration of beats in a bar

typedef struct sscore_pd_barbeats { 
    int beatsinbar; 
    int beattime; // ms 
} sscore_pd_barbeats;  

See Also


sscore_pd_bar_iterator


private bar iterator for accessing bars in correct sequence when playing

typedef struct sscore_pd_bar_iterator { 
    // private fields 
    const sscore_playdata *pd; 
    int idx; 
    int ci; 
    unsigned loop; 
    int loopc; 
    unsigned dummy[5]; 
} sscore_pd_bar_iterator;  
Discussion

this is not multi-thread safe. ie all functions using this must be called on a single thread


sscore_pd_barbeats


number and duration of beats in a bar

typedef struct sscore_pd_barbeats { 
    int beatsinbar; 
    int beattime; // ms 
} sscore_pd_barbeats;  

See Also


sscore_pd_barnotes_iterator


private bar notes iterator for playing

typedef struct sscore_pd_barnotes_iterator { 
    // private fields 
    sscore_pd_bar_iterator bi; 
    int pidx; 
    int nidx; 
    unsigned dummy[8]; 
} sscore_pd_barnotes_iterator;  
Discussion

this provides notes sequentially with non-decreasing start time from the start of the bar to the end of the _following_ bar, ie notes in 2 bars, so that there is not an inter-bar discontinuity when using non-bar-aligned buffers NB This must be used with the supplied functions. The private fields should not be tampered with


sscore_pd_controls


link to UI which defines playing parameters

typedef struct sscore_pd_controls { 
    void *context; 
    sscore_pd_bool_intfn partEnabled; // return true to output notes in this part into MIDI file 
    sscore_pd_int_intfn midiProgramForPart; // define MIDI program change value for part if > 0 
    sscore_pd_bool_intintfn partStaffEnabled; // return true to output notes in 
    unsigned dummy[64]; // for future enhancement 
} sscore_pd_controls;  

sscore_pd_midi_params


define various midi parameters

typedef struct sscore_pd_midi_params { 
    int loopStartBarIndex; // define loop start bar index 
    int loopEndBarIndex; // define end loop bar index 
    int loopNumRepeats; // 0 for no play loop 
    unsigned dummy[128];// future expansion 
} sscore_pd_midi_params;  

sscore_pd_note


information about a note for playing

typedef struct sscore_pd_note { 
    int midipitch; // 60 = C4. 0 = unpitched (eg rest or percussion) (also used as beat index for metronome) 
    int startbarindex; // index of bar in which this note starts (may be tied) 
    int start; // start time from start of bar (milliseconds) 
    int duration; // (ms) may be longer than a bar if tied 
    int dynamic; // [0..100] value of the last dynamic 
    enum sscore_pd_grace_e grace; // set for grace note 
    sscore_item_handle item_h; // item handle used in sscore_contents 
    int midi_start; // midi start time (24 ticks per crotchet/quarter note) 
    int midi_duration; // midi duration (24 ticks per crotchet/quarter note) 
    int staffindex; // index of the staff containing this note. 0 is top (or only) staff 
    unsigned articulation_flags; // bit flags sscore_pd_articulation_flags_e. A rest has pitch = 0 and .._rest_flag set 
    unsigned dummy[4]; // future 
} sscore_pd_note;  
Discussion

NB The right-hand note of a tie is included in the duration of the left hand note and omitted from the list


sscore_pd_notesample


information required for pre-loading a note sample

typedef struct sscore_pd_notesample { 
    int midipitch; // 60 = C4. 0 = unpitched (eg percussion) 
    int duration; // (ms) may be longer than a bar if tied 
    unsigned articulation_flags; // bit flags sscore_pd_articulation_flags_e 
    unsigned dummy[1]; 
} sscore_pd_notesample;  

sscore_pd_notesamples


information required for pre-loading note samples

typedef struct sscore_pd_notesamples { 
    int num; 
    sscore_pd_notesample samples[sscore_pd_MaxNoteSamples]; 
    unsigned dummy[8]; 
} sscore_pd_notesamples;  

sscore_pd_partset


define playing parts

typedef struct sscore_pd_partset { 
    int num; // the number of parts 
    bool parts[sscore_kMaxParts]; // play value per part 
} sscore_pd_partset;  

sscore_pd_tempo


tempo information

typedef struct sscore_pd_tempo { 
    int bpm; 
    int beattype; 
    bool dot; 
    bool usebeattype; // set if this is a beat type from a metronome mark and should be displayed, else it is a standard 4 for a sound tempo and is irrelevant to the beat 
    unsigned dummy[8]; 
} sscore_pd_tempo;  

sscore_pd_timinginfo


specification of beat timing for media synchronisation

typedef struct sscore_pd_timinginfo { 
    int mediaStart_ms; // if non-zero specifies a delay before starting synchronised media 
    int numbars;  
    struct { 
        int barIndex; // the 0-based index of this bar 
        int duration_ms; // duration of bar in ms 
        int numSubsequentBeats; // = 3 for a 4-beat bar  
        struct { 
            int time_ms; // time of subsequent beat from start (first beat) of bar  
            unsigned dummy[4]; 
                } beat[sscore_pd_kMaxBeatsInBar];  
        unsigned dummy[4]; 
        } bar[sscore_kMaxBars];  
    unsigned dummy[64]; 
} sscore_pd_timinginfo;  

sscore_pd_usertempo


define realtime user tempo specification

typedef struct sscore_pd_usertempo {  
    sscore_pd_int_fn get_user_bpm;   
    sscore_pd_float_fn get_user_tempo_scaling;   
    void *context; 
    unsigned dummy[8]; 
} sscore_pd_usertempo;  
Fields
get_user_bpm

get_user_bpm an explicit bpm value specified by the user (to use only if no tempo is defined in the score)

get_user_tempo_scaling

get_user_tempo_scaling a scaling value defined by the user to multiply tempo values specified in the score

context

context pointer to use as an argument to the above functions


Enumerated Types

sscore_bartype_e

categorise partial bars


sscore_bartype_e


categorise partial bars

enum sscore_bartype_e { 
    sscore_bartype_full_bar, // normal full bar 
    sscore_bartype_partial_first_bar, // partial bar is first bar in score (ie anacrusis) 
    sscore_bartype_partial_bar_start, // partial bar including beat 1 (ie before repeat mark) 
    sscore_bartype_partial_bar_end, // partial bar missing beat 1 (ie after repeat mark) 
    sscore_bartype_default // for default argument 
};  

Macro Definitions

sscore_pd_kAfterEndBarIndex

special value to indicate beyond the last bar in the piece

sscore_pd_kInvalidBarIndex

an invalid bar index


sscore_pd_kAfterEndBarIndex


special value to indicate beyond the last bar in the piece

Value

0xfffffffffffffffe (-2)


sscore_pd_kInvalidBarIndex


an invalid bar index

Value

0xffffffffffffffff (-1)