[Etoys] [ENH]SoundLibraryCompress2
karl
karl.ramberg at comhem.se
Wed Dec 5 17:55:22 EST 2007
karl wrote:
> "Change Set: SoundLibraryCompress
> Date: 5 December 2007
> Author: Karl Ramberg
>
> Add a halo menu item that GSM compress and replace the selected sound
> Now also OggVorbis and OggSpeex codec"
> ------------------------------------------------------------------------
>
> _______________________________________________
> Etoys mailing list
> Etoys at lists.laptop.org
> http://lists.laptop.org/listinfo/etoys
-------------- next part --------------
'From etoys2.3 of 2 December 2007 [latest update: #1820] on 5 December 2007 at 11:11:48 pm'!
"Change Set: SoundLibraryCompress
Date: 5 December 2007
Author: Karl Ramberg
Add a halo menu item that GSM compress and replace the selected sound
Now also OggVorbis and OggSpeex codec"!
!SoundLibraryTool methodsFor: 'menu' stamp: 'kfr 12/5/2007 22:03'!
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' compressWithGSM 'compress the sound with GSM compression and replace the uncompressed one')
('OggSpeex compress sound' compressWithOggSpeex 'compress the sound with OggSpeex compression and replace the uncompressed one')
('OggVorbis compress sound' compressWithOggVorbis 'compress the sound with OggVorbis compression and replace the uncompressed one')
) translatedNoop! !
!SoundLibraryTool methodsFor: 'menu' stamp: 'kfr 12/5/2007 16:16'!
compressWithGSM
"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
! !
!SoundLibraryTool methodsFor: 'menu' stamp: 'kfr 12/5/2007 23:10'!
compressWithOggSpeex
"Compress the sound."
| name newSound writer |
soundIndex > 0
ifTrue: [newSound _ currentSound compressWith: OggSpeexCodec].
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! !
!SoundLibraryTool methodsFor: 'menu' stamp: 'kfr 12/5/2007 23:11'!
compressWithOggVorbis
"Compress the sound."
| newSound name writer |
soundIndex > 0
ifTrue: [newSound _ currentSound compressWith: OggVorbisCodec].
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
! !
More information about the etoys-dev
mailing list