[squeak-dev] The Trunk: EToys-ct.455.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Jan 3 18:42:37 UTC 2022
Christoph Thiede uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-ct.455.mcz
==================== Summary ====================
Name: EToys-ct.455
Author: ct
Time: 3 January 2022, 7:42:29.166703 pm
UUID: 9495aecb-a9c1-884e-bfc7-67c3deaf0691
Ancestors: EToys-mt.454
Improves multilingual support and performs recategorizations for Squeakland-Sound and FileStream extensions.
=============== Diff against EToys-mt.454 ===============
Item was changed:
+ ----- Method: CodecDemoMorph>>codecClassName: (in category 'accessing') -----
- ----- Method: CodecDemoMorph>>codecClassName: (in category 'as yet unclassified') -----
codecClassName: aStringOrSymbol
| label |
codecClassName := aStringOrSymbol asSymbol.
self removeAllMorphs.
label := StringMorph contents: aStringOrSymbol.
label position: self position + (5 at 5).
self addMorph: label.
label lock: true.
self extent: label extent + (10 at 10).
!
Item was changed:
+ ----- Method: CodecDemoMorph>>selectCodec (in category 'accessing') -----
- ----- Method: CodecDemoMorph>>selectCodec (in category 'as yet unclassified') -----
selectCodec
| aMenu codecs newCodec |
+ aMenu := CustomMenu new title: 'Codec:' translated.
- aMenu := CustomMenu new title: 'Codec:'.
codecs := SoundCodec allSubclasses collect: [:c | c name] as: OrderedCollection.
codecs add: 'None'.
codecs sort do:[:cName | aMenu add: cName action: cName].
newCodec := aMenu startUp ifNil: [^ self].
self codecClassName: newCodec.
!
Item was changed:
+ ----- Method: MIDIPianoKeyboardMorph>>closeMIDIPort (in category 'accessing') -----
- ----- Method: MIDIPianoKeyboardMorph>>closeMIDIPort (in category 'as yet unclassified') -----
closeMIDIPort
midiPort := nil.
!
Item was changed:
+ ----- Method: MIDIPianoKeyboardMorph>>makeMIDIController: (in category 'accessing') -----
- ----- Method: MIDIPianoKeyboardMorph>>makeMIDIController: (in category 'as yet unclassified') -----
makeMIDIController: evt
self world activeHand attachMorph:
(MIDIControllerMorph new midiPort: midiPort).
!
Item was changed:
+ ----- Method: MIDIPianoKeyboardMorph>>openMIDIPort (in category 'accessing') -----
- ----- Method: MIDIPianoKeyboardMorph>>openMIDIPort (in category 'as yet unclassified') -----
openMIDIPort
| portNum |
portNum := SimpleMIDIPort outputPortNumFromUser.
portNum ifNil: [^ self].
midiPort := SimpleMIDIPort openOnPortNumber: portNum.
!
Item was changed:
+ ----- Method: MIDIPianoKeyboardMorph>>turnOffNote (in category 'accessing') -----
- ----- Method: MIDIPianoKeyboardMorph>>turnOffNote (in category 'as yet unclassified') -----
turnOffNote
midiPort notNil & soundPlaying notNil ifTrue: [
soundPlaying isInteger ifTrue: [
midiPort midiCmd: 16r90 channel: channel byte: soundPlaying byte: 0]].
soundPlaying := nil.
!
Item was changed:
+ ----- Method: MIDIPianoKeyboardMorph>>turnOnNote: (in category 'accessing') -----
- ----- Method: MIDIPianoKeyboardMorph>>turnOnNote: (in category 'as yet unclassified') -----
turnOnNote: midiKey
midiPort midiCmd: 16r90 channel: channel byte: midiKey byte: velocity.
soundPlaying := midiKey.
!
Item was changed:
+ ----- Method: MidiInputMorph>>addChannel (in category 'actions') -----
- ----- Method: MidiInputMorph>>addChannel (in category 'as yet unclassified') -----
addChannel
"Add a set of controls for another channel. Prompt the user for the channel number."
| menu existingChannels newChannel |
menu := CustomMenu new.
existingChannels := Set new.
1 to: 16 do: [:ch | (instrumentSelector at: ch) ifNotNil: [existingChannels add: ch]].
1 to: 16 do: [:ch |
(existingChannels includes: ch) ifFalse: [
menu add: ch printString action: ch]].
newChannel := menu startUp.
newChannel ifNotNil: [self addChannelControlsFor: newChannel].
!
Item was changed:
+ ----- Method: MidiInputMorph>>addChannelControlsFor: (in category 'accessing') -----
- ----- Method: MidiInputMorph>>addChannelControlsFor: (in category 'as yet unclassified') -----
addChannelControlsFor: channelIndex
| r divider col |
r := self makeRow
hResizing: #shrinkWrap;
vResizing: #shrinkWrap.
r addMorphBack: (self channelNumAndMuteButtonFor: channelIndex).
r addMorphBack: (Morph new extent: 10 at 5; color: color). "spacer"
r addMorphBack: (self panAndVolControlsFor: channelIndex).
divider := AlignmentMorph new
extent: 10 at 1;
layoutInset: 0;
borderStyle: (BorderStyle raised width: 1);
color: color;
hResizing: #spaceFill;
vResizing: #rigid.
col := self lastSubmorph.
col addMorphBack: divider.
col addMorphBack: r.
!
Item was changed:
+ ----- Method: MidiInputMorph>>atChannel:from:selectInstrument: (in category 'accessing') -----
- ----- Method: MidiInputMorph>>atChannel:from:selectInstrument: (in category 'as yet unclassified') -----
atChannel: channelIndex from: aPopUpChoice selectInstrument: selection
| oldSnd name snd instSelector |
oldSnd := midiSynth instrumentForChannel: channelIndex.
(selection beginsWith: 'edit ')
ifTrue:
[name := selection copyFrom: 6 to: selection size.
aPopUpChoice contentsClipped: name.
(oldSnd isKindOf: FMSound) | (oldSnd isKindOf: LoopedSampledSound)
ifTrue: [EnvelopeEditorMorph openOn: oldSnd title: name].
(oldSnd isKindOf: SampledInstrument)
ifTrue: [EnvelopeEditorMorph openOn: oldSnd allNotes first title: name].
^self].
snd := nil.
1 to: instrumentSelector size
do:
[:i |
(channelIndex ~= i and:
[(instSelector := instrumentSelector at: i) notNil
and: [selection = instSelector contents]])
ifTrue: [snd := midiSynth instrumentForChannel: i]]. "use existing instrument prototype"
snd ifNil:
[snd := (selection = 'clink'
ifTrue:
[(SampledSound samples: SampledSound coffeeCupClink samplingRate: 11025)]
ifFalse: [(AbstractSound soundNamed: selection) ])copy ].
midiSynth instrumentForChannel: channelIndex put: snd.
(instrumentSelector at: channelIndex) contentsClipped: selection!
Item was changed:
+ ----- Method: MidiInputMorph>>channelNumAndMuteButtonFor: (in category 'accessing') -----
- ----- Method: MidiInputMorph>>channelNumAndMuteButtonFor: (in category 'as yet unclassified') -----
channelNumAndMuteButtonFor: channelIndex
| muteButton instSelector r |
muteButton := SimpleSwitchMorph new
onColor: (Color r: 1.0 g: 0.6 b: 0.6);
offColor: color;
color: color;
+ label: 'Mute' translated;
- label: 'Mute';
target: midiSynth;
actionSelector: #mutedForChannel:put:;
arguments: (Array with: channelIndex).
instSelector := PopUpChoiceMorph new
extent: 95 at 14;
contentsClipped: 'oboe1';
target: self;
actionSelector: #atChannel:from:selectInstrument:;
getItemsSelector: #instrumentChoicesForChannel:;
getItemsArgs: (Array with: channelIndex).
instSelector arguments:
(Array with: channelIndex with: instSelector).
instrumentSelector at: channelIndex put: instSelector.
r := self makeRow
hResizing: #rigid;
vResizing: #spaceFill;
extent: 70 at 10.
r addMorphBack:
(StringMorph
contents: channelIndex printString
font: (TextStyle default fontOfSize: 24)).
channelIndex < 10
ifTrue: [r addMorphBack: (Morph new color: color; extent: 19 at 8)] "spacer"
ifFalse: [r addMorphBack: (Morph new color: color; extent: 8 at 8)]. "spacer"
r addMorphBack: instSelector.
r addMorphBack: (AlignmentMorph newRow color: color). "spacer"
r addMorphBack: muteButton.
+ ^ r!
- ^ r
- !
Item was changed:
+ ----- Method: MidiInputMorph>>closeMIDIPort (in category 'accessing') -----
- ----- Method: MidiInputMorph>>closeMIDIPort (in category 'as yet unclassified') -----
closeMIDIPort
midiSynth isOn ifTrue: [midiSynth stopMIDITracking].
midiSynth closeMIDIPort.
!
Item was changed:
+ ----- Method: MidiInputMorph>>disableReverb: (in category 'accessing') -----
- ----- Method: MidiInputMorph>>disableReverb: (in category 'as yet unclassified') -----
disableReverb: aBoolean
Preferences setPreference: #soundReverb toValue: aBoolean not
!
Item was changed:
+ ----- Method: MidiInputMorph>>instrumentChoicesForChannel: (in category 'accessing') -----
- ----- Method: MidiInputMorph>>instrumentChoicesForChannel: (in category 'as yet unclassified') -----
instrumentChoicesForChannel: channelIndex
| names inst |
names := AbstractSound soundNames asOrderedCollection.
names := names collect: [:n |
inst := AbstractSound soundNamed: n.
(inst isKindOf: UnloadedSound)
ifTrue: [n, '(out)']
ifFalse: [n]].
names add: 'clink'.
names add: 'edit ', (instrumentSelector at: channelIndex) contents.
^ names asArray
!
Item was changed:
+ ----- Method: MidiInputMorph>>invokeMenu (in category 'actions') -----
- ----- Method: MidiInputMorph>>invokeMenu (in category 'as yet unclassified') -----
invokeMenu
"Invoke a menu of additonal commands."
| aMenu |
aMenu := CustomMenu new.
aMenu add: 'add channel' translated action: #addChannel.
aMenu add: 'reload instruments' translated target: AbstractSound selector: #updateScorePlayers.
midiSynth isOn ifFalse: [
aMenu add: 'set MIDI port' translated action: #setMIDIPort.
midiSynth midiPort
ifNotNil: [aMenu add: 'close MIDI port' translated action: #closeMIDIPort]].
aMenu invokeOn: self defaultSelection: nil.
!
Item was changed:
+ ----- Method: MidiInputMorph>>makeControls (in category 'initialization') -----
- ----- Method: MidiInputMorph>>makeControls (in category 'as yet unclassified') -----
makeControls
| bb r reverbSwitch onOffSwitch |
bb := SimpleButtonMorph new
target: self;
borderStyle: (BorderStyle raised width: 2);
color: color.
r := AlignmentMorph newRow.
r color: bb color; borderWidth: 0; layoutInset: 0.
r hResizing: #shrinkWrap; vResizing: #shrinkWrap; extent: 5 at 5.
r addMorphBack: (
bb label: '<>';
actWhen: #buttonDown;
actionSelector: #invokeMenu).
onOffSwitch := SimpleSwitchMorph new
offColor: color;
onColor: (Color r: 1.0 g: 0.6 b: 0.6);
borderWidth: 2;
+ label: 'On' translated;
- label: 'On';
actionSelector: #toggleOnOff;
target: self;
setSwitchState: false.
r addMorphBack: onOffSwitch.
reverbSwitch := SimpleSwitchMorph new
offColor: color;
onColor: (Color r: 1.0 g: 0.6 b: 0.6);
borderWidth: 2;
+ label: 'Reverb Disable' translated;
- label: 'Reverb Disable';
actionSelector: #disableReverb:;
target: self;
setSwitchState: SoundPlayer isReverbOn not.
r addMorphBack: reverbSwitch.
+ ^ r!
- ^ r
- !
Item was changed:
+ ----- Method: MidiInputMorph>>makeRow (in category 'initialization') -----
- ----- Method: MidiInputMorph>>makeRow (in category 'as yet unclassified') -----
makeRow
^ AlignmentMorph newRow
color: color;
layoutInset: 0;
wrapCentering: #center; cellPositioning: #leftCenter;
hResizing: #spaceFill;
vResizing: #shrinkWrap
!
Item was changed:
+ ----- Method: MidiInputMorph>>panAndVolControlsFor: (in category 'initialization') -----
- ----- Method: MidiInputMorph>>panAndVolControlsFor: (in category 'as yet unclassified') -----
panAndVolControlsFor: channelIndex
| volSlider panSlider c r middleLine |
volSlider := SimpleSliderMorph new
color: color;
extent: 101 at 2;
target: midiSynth;
arguments: (Array with: channelIndex);
actionSelector: #volumeForChannel:put:;
minVal: 0.0;
maxVal: 1.0;
adjustToValue: (midiSynth volumeForChannel: channelIndex).
panSlider := SimpleSliderMorph new
color: color;
extent: 101 at 2;
target: midiSynth;
arguments: (Array with: channelIndex);
actionSelector: #panForChannel:put:;
minVal: 0.0;
maxVal: 1.0;
adjustToValue: (midiSynth panForChannel: channelIndex).
c := AlignmentMorph newColumn
color: color;
layoutInset: 0;
wrapCentering: #center; cellPositioning: #topCenter;
hResizing: #spaceFill;
vResizing: #shrinkWrap.
middleLine := Morph new "center indicator for pan slider"
color: (Color r: 0.4 g: 0.4 b: 0.4);
extent: 1@(panSlider height - 4);
position: panSlider center x@(panSlider top + 2).
panSlider addMorphBack: middleLine.
r := self makeRow.
r addMorphBack: (StringMorph contents: '0').
r addMorphBack: volSlider.
r addMorphBack: (StringMorph contents: '10').
c addMorphBack: r.
r := self makeRow.
r addMorphBack: (StringMorph contents: 'L').
r addMorphBack: panSlider.
r addMorphBack: (StringMorph contents: 'R').
c addMorphBack: r.
^ c
!
Item was changed:
+ ----- Method: MidiInputMorph>>setMIDIPort (in category 'accessing') -----
- ----- Method: MidiInputMorph>>setMIDIPort (in category 'as yet unclassified') -----
setMIDIPort
| portNum |
portNum := SimpleMIDIPort outputPortNumFromUser.
portNum ifNil: [^ self].
midiPortNumber := portNum.
!
Item was changed:
+ ----- Method: MidiInputMorph>>toggleOnOff (in category 'accessing') -----
- ----- Method: MidiInputMorph>>toggleOnOff (in category 'as yet unclassified') -----
toggleOnOff
midiSynth isOn
ifTrue: [
midiSynth stopMIDITracking]
ifFalse: [
midiPortNumber ifNil: [self setMIDIPort].
midiPortNumber ifNil: [midiPortNumber := 0].
midiSynth midiPort: (SimpleMIDIPort openOnPortNumber: midiPortNumber).
midiSynth startMIDITracking].
!
Item was changed:
+ ----- Method: MidiInputMorph>>updateInstrumentsFromLibraryExcept: (in category 'fileIn/out') -----
- ----- Method: MidiInputMorph>>updateInstrumentsFromLibraryExcept: (in category 'as yet unclassified') -----
updateInstrumentsFromLibraryExcept: soundsBeingEdited
"The instrument library has been modified. Update my instruments with the new versions from the library. Use a single instrument prototype for all parts with the same name; this allows the envelope editor to edit all the parts by changing a single sound prototype."
"soundsBeingEdited is a collection of sounds being edited (by an EnvelopeEditor). If any of my instruments share one of these, then they will be left alone so as not to disturb that dynamic linkage."
| unloadPostfix myInstruments name displaysAsUnloaded isUnloaded |
unloadPostfix := '(out)'.
myInstruments := Dictionary new.
1 to: instrumentSelector size do: [:i |
name := (instrumentSelector at: i) contents.
displaysAsUnloaded := name endsWith: unloadPostfix.
displaysAsUnloaded ifTrue: [
name := name copyFrom: 1 to: name size - unloadPostfix size].
(myInstruments includesKey: name) ifFalse: [
myInstruments at: name put:
(name = 'clink'
ifTrue: [
(SampledSound
samples: SampledSound coffeeCupClink
samplingRate: 11025) copy]
ifFalse: [
(AbstractSound
soundNamed: name
ifAbsent: [
(instrumentSelector at: i) contentsClipped: 'default'.
FMSound default]) copy])].
(soundsBeingEdited includes: (midiSynth instrumentForChannel: i)) ifFalse:
["Do not update any instrument that is currently being edited"
midiSynth instrumentForChannel: i put: (myInstruments at: name)].
"update loaded/unloaded status in instrumentSelector if necessary"
isUnloaded := (myInstruments at: name) isKindOf: UnloadedSound.
(displaysAsUnloaded and: [isUnloaded not])
ifTrue: [(instrumentSelector at: i) contentsClipped: name].
(displaysAsUnloaded not and: [isUnloaded])
ifTrue: [(instrumentSelector at: i) contentsClipped: name, unloadPostfix]].
!
Item was changed:
----- Method: OggDriver class>>example3 (in category 'examples') -----
example3
"OggDriver example3"
"Primitive metatada test: Reading Ogg Vorbis and output to Transcript."
| f compressed driver ogg vendor comment commentSize fileName rate channels |
fileName := 'majorChord.ogg'.
f := FileDirectory default readOnlyFileNamed: fileName.
[f binary.
compressed := f contents]
ensure: [f close].
driver := self new.
ogg := driver
primitiveOpen: (SqVorbis bitOr: SqOggDecode).
driver
primitiveWrite: ogg
buffer: compressed
size: compressed size.
self assert: (driver primitiveGetState: ogg)
== SqOggRunning.
rate := driver primitiveGetRate: ogg.
channels := driver primitiveGetChannels: ogg.
Transcript cr;
+ show: ('Bitstream is {1} channel, {2} Hz' translated format: {rate. channels}).
- show: ('Bitstream is {1} channel, {2} Hz' format: {rate. channels}).
vendor := String new: 1024.
driver
primitiveGetVendor: ogg
buffer: vendor
size: 1024.
Transcript cr; show: 'Encoded by:'
, (vendor readStream
upTo: (Character value: 0)).
commentSize := driver primitiveGetCommentSize: ogg.
comment := String new: commentSize.
driver
primitiveGetComment: ogg
buffer: comment
size: commentSize.
Transcript cr; show: comment.
driver primitiveClose: ogg!
Item was changed:
----- Method: OggDriver class>>services (in category 'class initialization') -----
services
| service |
service := SimpleServiceEntry
+ provider: self
+ label: 'sound file' translatedNoop
+ selector: #playFileNamed:
+ description: 'play the sound' translatedNoop
+ buttonLabel: 'play' translatedNoop.
- provider: self
- label: 'sound file'
- selector: #playFileNamed:
- description: 'play the sound'
- buttonLabel: 'play'.
^ Array with: service!
Item was changed:
----- Method: OggDriver>>decodeCompressedData: (in category 'compress/decompress') -----
decodeCompressedData: aByteArray
"Answer decompressed SoundBuffer, or nil if it needs more data"
| decoded size result |
state
ifNil: [state := self startDecoder].
result := self
primitiveWrite: state
buffer: aByteArray
size: aByteArray size.
result = SqOggSuccess
+ ifFalse: [self error: 'Compressed data is corrupt' translated].
- ifFalse: [self error: 'Compressed data is corrupt'].
size := self primitiveReadSize: state.
size = 0
ifTrue: [^ nil].
decoded := SoundBuffer newMonoSampleCount: size // 2.
self
primitiveRead: state
buffer: decoded
size: size.
self hasHeader
ifFalse: [self headerComplete].
^ decoded!
Item was changed:
----- Method: OggSoundData>>asSound (in category 'asSound') -----
asSound
| codecClass theDecoder |
self isHeader
ifTrue: [codecClass := Smalltalk
at: codecName
+ ifAbsent: [^ self error: 'The codec for decompressing this sound is not available' translated].
- ifAbsent: [^ self error: 'The codec for decompressing this sound is not available'].
codecClass isAvailable
+ ifFalse: [^ self error: 'The codec for decompressing this sound is not available' translated].
- ifFalse: [^ self error: 'The codec for decompressing this sound is not available'].
decoder
ifNotNil: [decoder release].
theDecoder := decoder := codecClass new]
ifFalse: [theDecoder := header decoder].
^ theDecoder soundFromCompressedData: channels first!
Item was changed:
----- Method: OggSoundData>>decoder (in category 'accessing') -----
decoder
self isHeader
ifTrue: [^ decoder].
+ self error: 'Only header has a decoder.' translated.!
- self error: 'Only header has a decoder.'!
Item was changed:
+ ----- Method: RecordingControls class>>additionsToViewerCategories (in category 'scripting') -----
- ----- Method: RecordingControls class>>additionsToViewerCategories (in category 'as yet unclassified') -----
additionsToViewerCategories
"Answer a list of (<categoryName> <list of category specs>) pairs that characterize the phrases this kind of morph wishes to add to various Viewer categories."
^ #((#'sound recorder'
((command recordButtonHit 'start recording')
(command stopButtonHit 'stop recording or playback')
(command playButtonHit 'play recording')
)))!
Item was changed:
----- Method: RecordingControls>>makeSoundMorph (in category 'private') -----
makeSoundMorph
"Hand the user an anonymous-sound object representing the receiver's sound."
| m aName |
recorder verifyExistenceOfRecordedSound ifFalse: [^ self].
recorder pause.
recordingSaved := true.
m := AnonymousSoundMorph new.
+ m sound: recorder recordedSound interimName: (aName := 'Unnamed Sound' translated).
- m sound: recorder recordedSound interimName: (aName := 'Unnamed Sound').
m setNameTo: aName.
self currentHand attachMorph: m.!
Item was changed:
+ ----- Method: SoundDemoMorph>>makeControls (in category 'private') -----
- ----- Method: SoundDemoMorph>>makeControls (in category 'as yet unclassified') -----
makeControls
| bb r cc |
cc := Color black.
r := AlignmentMorph newRow.
r color: cc; borderWidth: 0; layoutInset: 0.
r hResizing: #shrinkWrap; vResizing: #shrinkWrap; extent: 5 at 5.
bb := SimpleButtonMorph new target: self; borderColor: cc.
r addMorphBack: (bb label: 'V1'; actionSelector: #playV1).
bb := SimpleButtonMorph new target: self; borderColor: cc.
r addMorphBack: (bb label: 'V2'; actionSelector: #playV2).
bb := SimpleButtonMorph new target: self; borderColor: cc.
r addMorphBack: (bb label: 'V3'; actionSelector: #playV3).
bb := SimpleButtonMorph new target: self; borderColor: cc.
r addMorphBack: (bb label: 'All'; actionSelector: #playAll).
bb := SimpleButtonMorph new target: self; borderColor: cc.
r addMorphBack: (bb label: 'Stop'; actionSelector: #stopSound).
^ r
!
Item was changed:
+ ----- Method: SoundDemoMorph>>playAll (in category 'private') -----
- ----- Method: SoundDemoMorph>>playAll (in category 'as yet unclassified') -----
playAll
| snd |
soundColumn submorphs isEmpty
ifTrue: [^ self].
self setTimbreFromTile: soundColumn submorphs first.
snd := SampledSound bachFugueVoice1On: SampledSound new.
soundColumn submorphs size >= 2
ifTrue: [""self setTimbreFromTile: soundColumn submorphs second.
snd := snd
+ (AbstractSound bachFugueVoice2On: SampledSound new)].
soundColumn submorphs size >= 3
ifTrue: [""self setTimbreFromTile: soundColumn submorphs third.
snd := snd
+ (AbstractSound bachFugueVoice3On: SampledSound new)].
snd play!
Item was changed:
+ ----- Method: SoundDemoMorph>>playV1 (in category 'private') -----
- ----- Method: SoundDemoMorph>>playV1 (in category 'as yet unclassified') -----
playV1
soundColumn submorphs isEmpty
ifTrue: [^ self].
self
setTimbreFromTile: (soundColumn submorphs first).
(SampledSound bachFugueVoice1On: SampledSound new) play!
Item was changed:
+ ----- Method: SoundDemoMorph>>playV2 (in category 'private') -----
- ----- Method: SoundDemoMorph>>playV2 (in category 'as yet unclassified') -----
playV2
soundColumn submorphs size < 2
ifTrue: [^ self].
self
setTimbreFromTile: (soundColumn submorphs second).
(SampledSound bachFugueVoice2On: SampledSound new) playSilentlyUntil: 4.8;
resumePlaying!
Item was changed:
+ ----- Method: SoundDemoMorph>>playV3 (in category 'private') -----
- ----- Method: SoundDemoMorph>>playV3 (in category 'as yet unclassified') -----
playV3
soundColumn submorphs size < 3
ifTrue: [^ self].
self
setTimbreFromTile: (soundColumn submorphs third).
(AbstractSound bachFugueVoice3On: SampledSound new) playSilentlyUntil: 14.4;
resumePlaying!
Item was changed:
+ ----- Method: SoundDemoMorph>>setTimbreFromTile: (in category 'private') -----
- ----- Method: SoundDemoMorph>>setTimbreFromTile: (in category 'as yet unclassified') -----
setTimbreFromTile: aSoundTile
SampledSound defaultSampleTable: aSoundTile sound samples.
SampledSound nominalSamplePitch: 400.
!
Item was changed:
+ ----- Method: SoundDemoMorph>>stopSound (in category 'private') -----
- ----- Method: SoundDemoMorph>>stopSound (in category 'as yet unclassified') -----
stopSound
SoundPlayer shutDown.
!
Item was changed:
+ ----- Method: SoundMorph>>buildImage (in category 'accessing') -----
- ----- Method: SoundMorph>>buildImage (in category 'as yet unclassified') -----
buildImage
| scale env h imageColor |
owner ifNil: [scale := 128 at 128] "Default is 128 pix/second, 128 pix fullscale"
ifNotNil: [scale := owner soundScale].
env := sound volumeEnvelopeScaledTo: scale.
self image: (ColorForm extent: env size @ env max).
1 to: image width do:
[:x | h := env at: x.
image fillBlack: ((x-1)@(image height-h//2) extent: 1 at h)].
imageColor := #(black red orange green blue) atPin:
(sound pitch / 110.0) rounded highBit.
image colors: (Array with: Color transparent with: (Color perform: imageColor)).
!
Item was changed:
+ ----- Method: SoundMorph>>reset (in category 'accessing') -----
- ----- Method: SoundMorph>>reset (in category 'as yet unclassified') -----
reset
sound reset!
Item was changed:
+ ----- Method: SoundMorph>>sound (in category 'accessing') -----
- ----- Method: SoundMorph>>sound (in category 'as yet unclassified') -----
sound
^ sound!
Item was changed:
+ ----- Method: SoundMorph>>sound: (in category 'accessing') -----
- ----- Method: SoundMorph>>sound: (in category 'as yet unclassified') -----
sound: aSound
sound := aSound copy.
sound reset.
self buildImage!
Item was changed:
+ ----- Method: SoundSequencerMorph>>makeControlPanel (in category 'initialization') -----
- ----- Method: SoundSequencerMorph>>makeControlPanel (in category 'as yet unclassified') -----
makeControlPanel
| bb cc |
cc := Color black.
bb := SimpleButtonMorph new target: self; borderColor: cc.
controlPanel := AlignmentMorph newRow.
bb := SimpleButtonMorph new target: self; borderColor: cc.
controlPanel color: bb color; borderWidth: 0; layoutInset: 0.
controlPanel hResizing: #shrinkWrap; vResizing: #shrinkWrap; extent: 5 at 5.
bb := SimpleButtonMorph new target: self; borderColor: cc.
+ controlPanel addMorphBack: (bb label: 'reset' translated; actionSelector: #reset).
- controlPanel addMorphBack: (bb label: 'reset'; actionSelector: #reset).
bb := SimpleButtonMorph new target: self; borderColor: cc.
+ controlPanel addMorphBack: (bb label: 'stop' translated; actionSelector: #stop).
- controlPanel addMorphBack: (bb label: 'stop'; actionSelector: #stop).
bb := SimpleButtonMorph new target: self; borderColor: cc.
+ controlPanel addMorphBack: (bb label: 'play' translated; actionSelector: #play).
- controlPanel addMorphBack: (bb label: 'play'; actionSelector: #play).
!
Item was changed:
+ ----- Method: SoundSequencerMorph>>play (in category 'accessing') -----
- ----- Method: SoundSequencerMorph>>play (in category 'as yet unclassified') -----
play
self submorphsDo: [:m | m == controlPanel ifFalse: [m play]]!
Item was changed:
+ ----- Method: SoundSequencerMorph>>reset (in category 'accessing') -----
- ----- Method: SoundSequencerMorph>>reset (in category 'as yet unclassified') -----
reset
self submorphsDo: [:m | m == controlPanel ifFalse: [m reset]]!
Item was changed:
+ ----- Method: SpectrumAnalyzerMorph class>>descriptionForPartsBin (in category 'parts bin') -----
- ----- Method: SpectrumAnalyzerMorph class>>descriptionForPartsBin (in category 'as yet unclassified') -----
descriptionForPartsBin
^ self
partName: 'Spectrum Analyzer' translatedNoop
categories: {'Multimedia' translatedNoop}
documentation: 'A device for analyzing sound input' translatedNoop
!
Item was changed:
----- Method: StandardFileStream class>>fileDoesNotExistUserHandling: (in category '*Etoys-Squeakland-error handling') -----
fileDoesNotExistUserHandling: fullFileName
| selection newName |
selection := (PopUpMenu labels:
'create a new file
choose another name
cancel' translated)
startUpWithCaption: ('{1}
does not exist.' translated format: {FileDirectory localNameFor: fullFileName}) .
selection = 1 ifTrue:
[^ self new open: fullFileName forWrite: true].
selection = 2 ifTrue:
[ newName := FillInTheBlank request: 'Enter a new file name' translated
initialAnswer: fullFileName.
^ self oldFileNamed:
(self fullName: newName)].
+ ^ self error: 'Could not open a file' translated!
- ^ self error: 'Could not open a file'!
Item was changed:
----- Method: StandardFileStream class>>readOnlyFileDoesNotExistUserHandling: (in category '*Etoys-Squeakland-error handling') -----
readOnlyFileDoesNotExistUserHandling: fullFileName
| dir files choices selection newName fileName |
dir := FileDirectory forFileName: fullFileName.
files := dir fileNames.
fileName := FileDirectory localNameFor: fullFileName.
choices := fileName correctAgainst: files.
choices add: 'Choose another name' translated.
choices add: 'Cancel' translated.
selection := (PopUpMenu labelArray: choices lines: (Array with: 5) )
startUpWithCaption: ( '{1}
does not exist.' translated format: {FileDirectory localNameFor: fullFileName}).
selection = choices size ifTrue:["cancel" ^ nil "should we raise another exception here?"].
selection < (choices size - 1) ifTrue: [
newName := (dir pathName , FileDirectory slash , (choices at: selection))].
selection = (choices size - 1) ifTrue: [
newName := FillInTheBlank
request: 'Enter a new file name' translated
initialAnswer: fileName].
newName = '' ifFalse: [^ self readOnlyFileNamed: (self fullName: newName)].
+ ^ self error: 'Could not open a file' translated!
- ^ self error: 'Could not open a file'!
More information about the Squeak-dev
mailing list
|