[etoys-dev] Etoys: Sound-kfr.26.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Mar 7 16:21:12 EST 2012


Karl Ramberg uploaded a new version of Sound to project Etoys:
http://source.squeak.org/etoys/Sound-kfr.26.mcz

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

Name: Sound-kfr.26
Author: kfr
Time: 7 March 2012, 10:21:08 pm
UUID: 2579db7c-9553-bb4b-a8c7-6fd0d6bfb693
Ancestors: Sound-kfr.25

Update list info when contents is changed

=============== Diff against Sound-kfr.25 ===============

Item was added:
+ (PackageInfo named: 'Sound') preamble: 'nil'!

Item was changed:
  ----- Method: SoundLibraryTool>>compressWith: (in category 'menu') -----
  compressWith: aCodec 
  	"Compress the sound."
  	| newSound name writer |
  	soundIndex = 0
  		ifTrue: [^ self inform: 'No sound selected' translated].
  	
  	(SampledSound universalSoundKeys includes: self soundName)
  		ifTrue: [^ self inform: 'You can not compress this sound' translated].
  	newSound := currentSound compressWith: aCodec.
  	writer := ByteArray new writeStream.
  	newSound channels
  		do: [:channel | writer nextPutAll: channel].
  	name := self soundName.
  	SampledSound removeSoundNamed: self soundName.
  	SampledSound
  		addLibrarySoundNamed: name
  		bytes: writer contents
  		codecSignature: newSound codecSignature.
+ 	currentSound := SampledSound soundNamed: name.
+ 	self update!
- 	currentSound := SampledSound soundNamed: name!

Item was changed:
  ----- Method: SoundLibraryTool>>deleteSound (in category 'menu') -----
  deleteSound
  	"Delete the selected sound, if appropriate."
  
  	 
  	soundIndex = 0
  		ifTrue: [^ self inform: 'No sound selected' translated].
  	currentSound pause.
  	(SampledSound universalSoundKeys includes: self soundName)
  		ifTrue: [^self inform: 'You can not delete this sound' translated]
  		ifFalse: [ScriptingSystem removeFromSoundLibrary: self soundName].
  	self soundIndex: 0.
+ 	self update!
- 	listBox updateList!

Item was changed:
  ----- Method: SoundLibraryTool>>loadSoundFromDisk (in category 'menu') -----
  loadSoundFromDisk
  	"Put up a file chooser dialog inviting the user to import a sound file; accept it"
  
  	| aSound aName aFileStream fullName ext reply |
  	aFileStream := FileList2 modalFileSelectorForSuffixes: #(#AIFF #aiff #Wave #wav #wave ).
  	aFileStream
  		ifNil: [^ self].
  	fullName := aFileStream name.
  	('*.AIFF' match: fullName)
  		ifTrue: [aSound := SampledSound fromAIFFfileNamed: fullName]
  		ifFalse: [aSound := SampledSound fromWaveStream: aFileStream].
  	aFileStream close.
  	ext := FileDirectory extensionFor: fullName.
  	aName :=  (FileDirectory on: fullName) pathParts last.
  	ext size > 0 ifTrue:
  		[aName := aName copyFrom: 1 to: (aName size - (ext size + 1))].
  	
  	[reply := FillInTheBlank request: 'Please give a name for this sound' translated initialAnswer: aName.
  	reply isEmptyOrNil ifTrue: [^ self].
  	(SampledSound soundLibrary includesKey:  reply)
  		ifTrue:
  			[self inform: 'sorry, that name is already taken' translated.
  			false]
  		ifFalse:
  			[true]] whileFalse.
  	SampledSound addLibrarySoundNamed: reply samples: aSound samples samplingRate: aSound originalSamplingRate.
+ 	self update!
- 	listBox updateList!

Item was changed:
  ----- Method: SoundLibraryTool>>renameSound (in category 'menu') -----
  renameSound
  	"Rename the selected sound, if appropriate."
  
  	| name newName |
  	name := self soundName.
  	soundIndex = 0
  		ifTrue: [^ self inform: 'No sound selected' translated].
  	(SampledSound universalSoundKeys includes: name)
  		ifTrue: [^ self inform: 'You can not rename this sound' translated].
  
  	newName := FillInTheBlank request: 'New name for ' translated, name initialAnswer: name.
  	(newName isEmptyOrNil or: [newName = name]) ifTrue: [^ self].
  	(SampledSound soundLibrary includesKey: newName) ifTrue:
  		[^ self inform: 'sorry, that name is already used.' translated].
  	ScriptingSystem renameSound: name newName: newName.
+ 	self update.
- 	listBox updateList.
  	self soundIndex: (listBox getList indexOf: newName)!

Item was changed:
  ----- Method: SoundLibraryTool>>soundList (in category 'accessing') -----
  soundList
+ 	"Answer the list of sound keys in the sound library."
- 	"Answer the list of sound keys in the sound libraryi."
  
  	^ SampledSound soundLibrary keys asSortedArray!

Item was changed:
  ----- Method: SoundLibraryTool>>toggleShowCompression (in category 'menu') -----
  toggleShowCompression
  	showCompression _ showCompression not.
+ 	self update!
- 	self listing.!

Item was added:
+ ----- Method: SoundLibraryTool>>update (in category 'accessing') -----
+ update
+ 	self listing.
+ 	listBox updateList!

Item was added:
+ (PackageInfo named: 'Sound') postscript: 'nil'!



More information about the etoys-dev mailing list