'From etoys2.3 of 3 December 2007 [latest update: #1820] on 5 December 2007 at 3:13:43 pm'! "Change Set: SoundLibraryCompress Date: 5 December 2007 Author: Karl Ramberg Add a halo menu item that GSM compress and replace the selected sound "! !SoundLibraryTool methodsFor: 'menu' stamp: 'kfr 12/5/2007 15:11'! addCustomMenuItems: aMenu hand: aHand "Add custom menu items to a menu" super addCustomMenuItems: aMenu hand: aHand. aMenu addTranslatedList: #( ('wave editor' edit 'open a tool which, operating with the selected sound as a point of departure, will allow you to construct a new "instrument"') ('GSM compress sound' compress 'compress the sound with GSM compression and replace the uncompressed one') ) translatedNoop! ! !SoundLibraryTool methodsFor: 'menu' stamp: 'kfr 12/5/2007 15:10'! compress "Compress the sound." | newSound name writer | soundIndex > 0 ifTrue: [newSound _ GSMCodec new compressSound:currentSound .]. writer := ByteArray new writeStream. newSound channels do: [:channel | writer nextPutAll: channel]. name := listBox getList at: soundIndex. SampledSound removeSoundNamed: name. SampledSound addLibrarySoundNamed: name bytes: writer contents codecSignature: newSound codecSignature ! !