SSSynth
Introductionthe interface to the synthesizer which plays the MusicXML score Methods
addSampledInstrument:add a sampled instrument and return its unique identifier -(sscore_sy_instrumentid)addSampledInstrument:(const sscore_sy_sampledinstrumentinfo *)info; ParametersaddSynthesizedInstrument:add a synthesized instrument (metronome tick) -(sscore_sy_instrumentid)addSynthesizedInstrument:(const sscore_sy_synthesizedinstrumentinfo *)info; ParameterschangedControlsnotification that the SSSyControls have changed -(void)changedControls; createSynth:create the synthesizer +(SSSynth*)createSynth:(id<SSSyControls>)controls score:(SSScore*)score; ParametersSee Also createSynth:score:create the synthesizer +(SSSynth*)createSynth:(id<SSSyControls>)controls score:(SSScore*)score; ParametersSee Also pausepause play -(void)pause; removeInstrument:remove the instrument -(void)removeInstrument:(sscore_sy_instrumentid)instrument; Parametersresetstop play and reset the play position to the start -(void)reset; Discussionyou need to call setup: again to play after reset resumeresume play if paused -(void)resume; setBarChangeHandler:register an event handler to be called at the start of each bar -(void)setBarChangeHandler:(id<SSEventHandler>) handler delay:(int)delay_ms; ParametersSee Also setBarChangeHandler:delay:register an event handler to be called at the start of each bar -(void)setBarChangeHandler:(id<SSEventHandler>) handler delay:(int)delay_ms; ParametersSee Also setBeatHandler:register an event handler to be called on each beat in the bar -(void)setBeatHandler:(id<SSEventHandler>) handler delay:(int)delay_ms; ParametersSee Also setBeatHandler:delay:register an event handler to be called on each beat in the bar -(void)setBeatHandler:(id<SSEventHandler>) handler delay:(int)delay_ms; ParametersSee Also setEndHandler:register an event handler to be called on completion of play -(void)setEndHandler:(id<SSEventHandler>) handler delay:(int)delay_ms; ParametersSee Also setEndHandler:delay:register an event handler to be called on completion of play -(void)setEndHandler:(id<SSEventHandler>) handler delay:(int)delay_ms; ParametersSee Also setNextBarToPlayif the bar is within range (with the current settings including loop settings) then set the next bar to play. The synth will automatically stop play and restart at the new bar -(bool)setNextBarToPlay:(int)barIndex at:(dispatch_time_t)restart_time; ParametersReturn Valuefalse if failed See Also setNextBarToPlay:at:if the bar is within range (with the current settings including loop settings) then set the next bar to play. The synth will automatically stop play and restart at the new bar -(bool)setNextBarToPlay:(int)barIndex at:(dispatch_time_t)restart_time; ParametersSee Also setNoteHandler:register an event handler to be called on start and end of new note/chord -(void)setNoteHandler:(id<SSNoteHandler>) handler delay:(int)delay_ms; ParametersDiscussionThis can be used to move a cursor onto each note as it is played. NB for a piece with many fast notes you need to ensure your handler is fast enough to handle the throughput. You will probably define the endNote() method to do nothing as this is called for every note, unlike startNotes which is only called once per chord See Also setNoteHandler:delay:register an event handler to be called on start and end of new note/chord -(void)setNoteHandler:(id<SSNoteHandler>) handler delay:(int)delay_ms; ParametersDiscussionThis can be used to move a cursor onto each note as it is played. NB for a piece with many fast notes you need to ensure your handler is fast enough to handle the throughput. You will probably define the endNote() method to do nothing as this is called for every note, unlike startNotes which is only called once per chord See Also setup:setup the synthesizer with the play data -(enum sscore_error)setup:(SSPData*)playdata; ParametersstartAt:start playing at the given time from the start of the given bar -(enum sscore_error)startAt:(dispatch_time_t)start_time bar:(int)barIndex countIn:(bool)countIn; ParametersSee Also startAt:bar:countIn:start playing at the given time from the start of the given bar -(enum sscore_error)startAt:(dispatch_time_t)start_time bar:(int)barIndex countIn:(bool)countIn; ParametersSee Also updateTempoAt:called on changing something which will affect the return value from SSUTempo which was supplied to the SSPData. The play tempo will update at the given time -(void)updateTempoAt:(dispatch_time_t)restart_time; ParametersProperties
isPausedtrue if paused @property (readonly) bool isPaused; isPlayingtrue if playing @property (readonly) bool isPlaying; playingBarthe 0-based index of the bar which is currently being played @property (readonly) int playingBar; |