[squeak-dev] The Trunk: Sound-mt.51.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Apr 6 16:04:50 UTC 2016


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

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

Name: Sound-mt.51
Author: mt
Time: 6 April 2016, 6:04:45.917125 pm
UUID: ee88ba13-414b-8e49-ba8e-2a0c42a9b886
Ancestors: Sound-mt.50

Fixes MIDI support wrt. to using real MIDI devices and CMD+Dot behavior. Keep sounds and music playing when only snapshotting but not quitting the image.

=============== Diff against Sound-mt.50 ===============

Item was changed:
  ----- Method: BaseSoundSystem>>shutDown (in category 'misc') -----
  shutDown
+ 
+ 	SoundPlayer shutDown: true.
+ 	ScorePlayer shutDown: true.!
- 	SoundPlayer shutDown
- !

Item was added:
+ ----- Method: MIDISound>>play (in category 'as yet unclassified') -----
+ play
+ 	"The base class ScorePlayer has two interfaces: a sound and a sound player. Choose the right interface depending on whether MIDI support is present."
+ 	
+ 	SimpleMIDIPort useMIDIDeviceForOutput ifTrue: [
+ 		[self openMIDIPort]
+ 			on: Error
+ 			do: [
+ 				SimpleMIDIPort askForDefault.
+ 				self openMIDIPort]].
+ 
+ 	self reset; resumePlaying.!

Item was added:
+ ----- Method: ScorePlayer class>>initialize (in category 'as yet unclassified') -----
+ initialize
+ 
+ 	Smalltalk addToShutDownList: self.!

Item was added:
+ ----- Method: ScorePlayer class>>shutDown: (in category 'snapshotting') -----
+ shutDown: quitting
+ 
+ 	quitting ifTrue: [
+ 		ScorePlayer allSubInstancesDo: [:ea | [ea stopMIDIPlaying] on: Error do: [] ] ].!

Item was added:
+ ----- Method: ScorePlayer>>openMIDIPort (in category 'midi output') -----
+ openMIDIPort
+ 
+ 	midiPort := SimpleMIDIPort openDefault.!

Item was changed:
  Object subclass: #SimpleMIDIPort
  	instanceVariableNames: 'portNumber accessSema lastCommandByteOut'
+ 	classVariableNames: 'DefaultPortNumber InterfaceClockRate UseMIDIDeviceForOutput'
- 	classVariableNames: 'DefaultPortNumber InterfaceClockRate'
  	poolDictionaries: ''
  	category: 'Sound-Scores'!
  
  !SimpleMIDIPort commentStamp: '<historical>' prior: 0!
  This is a first cut at a simple MIDI output port.
  !

Item was added:
+ ----- Method: SimpleMIDIPort class>>anyPortNumFromUser (in category 'utilities') -----
+ anyPortNumFromUser
+ 
+ 	^ UIManager default
+ 		chooseFrom: ((0 to: self primPortCount - 1) collect:[:i| self portDescription: i])
+ 		values: (0 to: self primPortCount - 1)
+ 		title: 'MIDI port for default usage:' translated
+ !

Item was added:
+ ----- Method: SimpleMIDIPort class>>askForDefault (in category 'utilities') -----
+ askForDefault
+ 	"self askForDefault"
+ 	
+ 	self anyPortNumFromUser ifNotNil: [:num |
+ 		DefaultPortNumber := num].!

Item was added:
+ ----- Method: SimpleMIDIPort class>>useMIDIDeviceForOutput (in category 'preferences') -----
+ useMIDIDeviceForOutput
+ 
+ 	<preference: 'Use MIDI device for output'
+ 		category: #media
+ 		description: 'If true, will try to open a native MIDI device when playing MIDI scores.'
+ 		type: #Boolean>
+ 	^ UseMIDIDeviceForOutput ifNil: [false]!

Item was added:
+ ----- Method: SimpleMIDIPort class>>useMIDIDeviceForOutput: (in category 'preferences') -----
+ useMIDIDeviceForOutput: boolean
+ 
+ 	UseMIDIDeviceForOutput := boolean.!

Item was changed:
  ----- Method: SimpleMIDIPort>>midiCmd:channel:byte: (in category 'output') -----
  midiCmd: cmd channel: channel byte: dataByte
+ 	"Immediately output the given MIDI command with the given channel and argument byte to this MIDI port. Assume that the port is open."
- 	"Immediately output the given MIDI command with the given channel and 
- 	argument byte to this MIDI port. Assume that the port is open."
  
  	accessSema critical: [
+ 		self primMIDIWritePort: portNumber
- 		self primMIDIWriteNoErrorPort: portNumber
  			from: (ByteArray
  					with: (cmd bitOr: channel)
  					with: dataByte)
  			at: 0].
  !

Item was changed:
  ----- Method: SimpleMIDIPort>>midiCmd:channel:byte:byte: (in category 'output') -----
  midiCmd: cmd channel: channel byte: dataByte1 byte: dataByte2
+ 	"Immediately output the given MIDI command with the given channel and argument bytes to this MIDI port. Assume that the port is open."
- 	"Immediately output the given MIDI command with the given channel 
- 	and argument bytes to this MIDI port. Assume that the port is open."
  
  	accessSema critical: [
+ 		self primMIDIWritePort: portNumber
- 		self primMIDIWriteNoErrorPort: portNumber
  			from: (ByteArray
  					with: (cmd bitOr: channel)
  					with: dataByte1
  					with: dataByte2)
  			at: 0].
  !

Item was removed:
- ----- Method: SoundPlayer class>>shutDown (in category 'snapshotting') -----
- shutDown
- 	"Stop player process, for example before snapshotting."
- 
- 	self stopPlayerProcess.
- 	ReverbState := nil.
- !

Item was added:
+ ----- Method: SoundPlayer class>>shutDown: (in category 'snapshotting') -----
+ shutDown: quitting
+ 	"Stop player process, for example before snapshotting."
+ 
+ 	quitting ifTrue: [
+ 		self stopPlayerProcess.
+ 		ReverbState := nil].!



More information about the Squeak-dev mailing list