Squeak Class Documentation category index | class index  
 
ScorePlayer
  category: Sound-Scores
  superclass: AbstractSound
  subclasses:

This is a real-time player for MIDI scores (i.e., scores read from MIDI files). Score can be played using either the internal sound synthesis or an external MIDI synthesizer on platforms that support MIDI output.

instance methods
  accessing
  durationInTicks
infoForTrack:
instrumentForTrack:
instrumentForTrack:put:
midiPort
millisecondsSinceStart
mutedForTrack:
mutedForTrack:put:
mutedState
overallVolume
overallVolume:
panForTrack:
panForTrack:put:
positionInScore
positionInScore:
rate
rate:
repeat
repeat:
score
secsPerTick
settingsString
tempo
ticksForMSecs:
ticksSinceStart
ticksSinceStart:
trackCount
volumeForTrack:
volumeForTrack:put:

  copying
  copy
copySounds

  initialization
  initialize
onScore:
updateDuration

  midi output
  closeMIDIPort
midiPlayLoop
openMIDIPort:
processMIDIEventsAtTick:
startMIDIPlaying
stopMIDIPlaying
turnOffActiveMIDINotesAt:

  operating
  disableReverb:
pause
resumePlaying
tempoOrRateChanged

  sound generation
  doControl
isDone
isPlaying
jumpToTick:
mixSampleCount:into:startingAt:leftVol:rightVol:
processAllAtTick:
processAmbientEventsAtTick:
processNoteEventsAtTick:
processTempoMapAtTick:
reset
samplesRemaining
skipAmbientEventsThruTick:
skipNoteEventsThruTick:
startNote:forStartTick:trackIndex:

  volume
  adjustVolumeTo:overMSecs:

class methods
  instance creation
  onScore:

instance methods
  accessing top  
 

durationInTicks


 

infoForTrack:

Return the info string for the given track.


 

instrumentForTrack:


 

instrumentForTrack:put:


 

midiPort


 

millisecondsSinceStart

Answer the approximate number of milliseconds of real time since the beginning of the score. Since this calculation uses the current tempo, which can change throughout the piece, it is safer to use ticksSinceStart for synchronization.


 

mutedForTrack:


 

mutedForTrack:put:


 

mutedState


 

overallVolume


 

overallVolume:

Set the overally playback volume to a value between 0.0 (off) and 1.0 (full blast).


 

panForTrack:


 

panForTrack:put:

Set the left-right pan for this track to a value in the range [0.0..1.0], where 0.0 means full-left.


 

positionInScore


 

positionInScore:


 

rate


 

rate:

Set the playback rate. For example, a rate of 2.0 will playback at twice normal speed.


 

repeat

Return true if this player will repeat when it gets to the end of the score, false otherwise.


 

repeat:

Turn repeat mode on or off.


 

score


 

secsPerTick


 

settingsString


 

tempo

Return the current tempo in beats (quarter notes) per minute. The tempo at any given moment is defined by the score and cannot be changed by the client. To change the playback speed, the client may change the rate parameter.


 

ticksForMSecs:


 

ticksSinceStart

Answer the number of score ticks that have elapsed since this piece started playing. The duration of a tick is determined by the MIDI score.


 

ticksSinceStart:

Adjust ticks to folow, eg, piano roll autoscrolling


 

trackCount


 

volumeForTrack:


 

volumeForTrack:put:


  copying top  
 

copy

Copy my component sounds.


 

copySounds

Private! Support for copying.


  initialization top  
 

initialize


 

onScore:


 

updateDuration


  midi output top  
 

closeMIDIPort

Stop using MIDI for output. Music will be played using the built-in sound synthesis.


 

midiPlayLoop


 

openMIDIPort:

Open the given MIDI port. Music will be played as MIDI commands to the given MIDI port.


 

processMIDIEventsAtTick:

Process note events through the given score tick using MIDI.


 

startMIDIPlaying

Start up a process to play this score via MIDI.


 

stopMIDIPlaying

Terminate the MIDI player process and turn off any active notes.


 

turnOffActiveMIDINotesAt:

Turn off any active MIDI notes that should be turned off at the given score tick.


  operating top  
 

disableReverb:


 

pause

Pause this sound. It can be resumed from this point, or reset and resumed to start from the beginning.


 

resumePlaying

Resume playing. Start over if done.


 

tempoOrRateChanged

This method should be called after changing the tempo or rate.


  sound generation top  
 

doControl

Update the control parameters of this sound using its envelopes, if any.


 

isDone


 

isPlaying

Return true if the receiver is currently playing


 

jumpToTick:


 

mixSampleCount:into:startingAt:leftVol:rightVol:

Play a number of sounds concurrently. The level of each sound can be set independently for the left and right channels.


 

processAllAtTick:


 

processAmbientEventsAtTick:

Process ambient events through the given tick.


 

processNoteEventsAtTick:

Process note events through the given score tick using internal Squeak sound synthesis.


 

processTempoMapAtTick:

Process tempo changes through the given score tick.


 

reset

Reset my internal state for a replay. Methods that override this method should do super reset.


 

samplesRemaining

Answer the number of samples remaining until the end of this sound. A sound with an indefinite ending time should answer some large integer such as 1000000.


 

skipAmbientEventsThruTick:

Skip ambient events through the given score tick.


 

skipNoteEventsThruTick:

Skip note events through the given score tick using internal Squeak sound synthesis.


 

startNote:forStartTick:trackIndex:

Prepare a note to begin playing at the given tick. Used to start playing at an arbitrary point in the score. Handle both MIDI and built-in synthesis cases.


  volume top  
 

adjustVolumeTo:overMSecs:

Adjust the volume of this sound to the given volume, a number in the range [0.0..1.0], over the given number of milliseconds. The volume will be changed a little bit on each sample until the desired volume is reached.


class methods
  instance creation top  
 

onScore: