[Pkg] The Trunk: Sound-mt.52.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Apr 6 16:06:48 UTC 2016


Marcel Taeumel uploaded a new version of Sound to project The Trunk:
http://source.squeak.org/trunk/Sound-mt.52.mcz

==================== Summary ====================

Name: Sound-mt.52
Author: mt
Time: 6 April 2016, 6:06:14.405125 pm
UUID: c5f62084-edd7-a64f-a95a-9ae29db062f6
Ancestors: Sound-mt.51

Adds descriptive process names to the processes that are playing sound and MIDI.

=============== Diff against Sound-mt.51 ===============

Item was changed:
  ----- Method: MIDIFileReader>>asScore (in category 'chunk reading') -----
  asScore
  
  	^ MIDIScore new
  		tracks: tracks;
  		trackInfo: trackInfo;
  		tempoMap: tempoMap;
+ 		ticksPerQuarterNote: ticksPerQuarter;
+ 		source: stream localName
- 		ticksPerQuarterNote: ticksPerQuarter
  !

Item was changed:
  Object subclass: #MIDIScore
+ 	instanceVariableNames: 'tracks trackInfo ambientTrack tempoMap ticksPerQuarterNote source'
- 	instanceVariableNames: 'tracks trackInfo ambientTrack tempoMap ticksPerQuarterNote'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Sound-Scores'!
  
  !MIDIScore commentStamp: '<historical>' prior: 0!
  A MIDIScore is a container for a number of MIDI tracks as well as an ambient track for such things as sounds, book page triggers and other related events.!

Item was added:
+ ----- Method: MIDIScore>>printOn: (in category 'printing') -----
+ printOn: stream
+ 
+ 	self source
+ 		ifNotNil: [:s | s printOn: stream]
+ 		ifNil: [super printOn: stream].!

Item was added:
+ ----- Method: MIDIScore>>source (in category 'accessing') -----
+ source
+ 	^ source!

Item was added:
+ ----- Method: MIDIScore>>source: (in category 'accessing') -----
+ source: anObject
+ 	source := anObject.!

Item was changed:
  ----- Method: ScorePlayer>>startMIDIPlaying (in category 'midi output') -----
  startMIDIPlaying
  	"Start up a process to play this score via MIDI."
  
  	midiPort ensureOpen.
  	midiPlayerProcess ifNotNil: [midiPlayerProcess terminate].
  	midiPlayerProcess := [self midiPlayLoop] newProcess.
  	midiPlayerProcess
+ 		name: 'Score Player (', self score printString, ')';
  		priority: Processor userInterruptPriority;
  		resume.
  !

Item was changed:
  ----- Method: SoundPlayer class>>resumePlaying:quickStart: (in category 'playing') -----
  resumePlaying: aSound quickStart: quickStart
  	"Start playing the given sound without resetting it; it will resume playing from where it last stopped. If quickStart is true, then try to start playing the given sound immediately."
  
  	| doQuickStart |
  	SoundService soundEnabled ifFalse: [^ self].
  	doQuickStart := quickStart.
  	self soundQuickStart ifFalse: [doQuickStart := false].
  	PlayerProcess == nil ifTrue: [
  		self canStartPlayer ifFalse: [^ self].
  		^self startUpWithSound: aSound].
+ 	
- 
  	PlayerSemaphore critical: [
  		(ActiveSounds includes: aSound)
  			ifTrue: [doQuickStart := false]
+ 			ifFalse: [doQuickStart ifFalse: [ActiveSounds add: aSound]].
+ 		PlayerProcess name: 'Sound Player (', ActiveSounds size asString, ')'].
- 			ifFalse: [
- 				doQuickStart ifFalse: [ActiveSounds add: aSound]]].
  
  	"quick-start the given sound, unless the sound player has just started"
  	doQuickStart ifTrue: [self startPlayingImmediately: aSound].
  !

Item was changed:
  ----- Method: SoundPlayer class>>startPlayerProcessBufferSize:rate:stereo:sound: (in category 'player process') -----
  startPlayerProcessBufferSize: bufferSize rate: samplesPerSecond stereo: stereoFlag sound: aSound
  	"Start the sound player process. Terminate the old process, if any."
  	"SoundPlayer startPlayerProcessBufferSize: 1000 rate: 11025 stereo: false"
  
  	self stopPlayerProcess.
  	aSound
  		ifNil:[ActiveSounds := OrderedCollection new]
  		ifNotNil:[ActiveSounds := OrderedCollection with: aSound].
  	Buffer := SoundBuffer newStereoSampleCount: (bufferSize // 4) * 4.
  	LastBuffer ifNotNil:[LastBuffer := SoundBuffer basicNew: Buffer basicSize].
  	PlayerSemaphore := Semaphore forMutualExclusion.
  	SamplingRate := samplesPerSecond.
  	Stereo := stereoFlag.
  	SoundSupported := true. "Assume so"
  	UseReadySemaphore := true.  "set to false if ready semaphore not supported by VM"
  	Smalltalk newExternalSemaphoreDo: [ :semaphore :index |
  		ReadyForBuffer := semaphore.
  		self primSoundStartBufferSize: Buffer stereoSampleCount
  			rate: samplesPerSecond
  			stereo: Stereo
  			semaIndex: index ].
  	"Check if sound start prim was successful"
  	SoundSupported ifFalse:[
  		Smalltalk unregisterExternalObject: ReadyForBuffer.
  		ReadyForBuffer := nil.
  		^self ].
  	UseReadySemaphore
  		ifTrue: [PlayerProcess := [SoundPlayer playLoop] newProcess]
  		ifFalse: [PlayerProcess := [SoundPlayer oldStylePlayLoop] newProcess].
  	UseReverb ifTrue: [self startReverb].
  
+ 	PlayerProcess
+ 		name: 'Sound Player (', ActiveSounds size asString, ')';
+ 		priority: Processor userInterruptPriority;
+ 		resume!
- 	PlayerProcess priority: Processor userInterruptPriority.
- 	PlayerProcess resume!



More information about the Packages mailing list