Nicolas Cellier uploaded a new version of Sound to project The Trunk:
http://source.squeak.org/trunk/Sound-nice.23.mcz ==================== Summary ==================== Name: Sound-nice.23 Author: nice Time: 21 September 2010, 9:39:17.308 pm UUID: 2b488c41-dcae-43ae-a4a3-42cf47217b50 Ancestors: Sound-ar.22 merge pharo minor refactorings: 1) use super initialize 2) _ -> := =============== Diff against Sound-ar.22 =============== Item was changed: ----- Method: AbstractSound>>initialize (in category 'initialization') ----- initialize + super initialize. - envelopes := #(). mSecsSinceStart := 0. samplesUntilNextControl := 0. scaledVol := (1.0 * ScaleFactor) rounded. scaledVolIncr := 0. scaledVolLimit := scaledVol. ! Item was changed: ----- Method: AbstractSound>>storeSampleCount:bigEndian:on: (in category 'file i/o') ----- storeSampleCount: samplesToStore bigEndian: bigEndianFlag on: aBinaryStream "Store my samples on the given stream at the current SoundPlayer sampling rate. If bigFlag is true, then each 16-bit sample is stored most-significant byte first (AIFF files), otherwise it is stored least-significant byte first (WAV files). If self isStereo is true, both channels are stored, creating a stereo file. Otherwise, only the left channel is stored, creating a mono file." | bufSize stereoBuffer reverseBytes | self reset. bufSize := (2 * self samplingRate rounded) min: samplesToStore. "two second buffer" stereoBuffer := SoundBuffer newStereoSampleCount: bufSize. reverseBytes := bigEndianFlag ~= (SmalltalkImage current isBigEndian). + 'Storing audio...' + displayProgressAt: Sensor cursorPoint - 'Storing audio...' displayProgressAt: Sensor cursorPoint from: 0 to: samplesToStore during: [:bar | | remaining out | remaining := samplesToStore. [remaining > 0] whileTrue: [ bar value: samplesToStore - remaining. stereoBuffer primFill: 0. "clear the buffer" self playSampleCount: (bufSize min: remaining) into: stereoBuffer startingAt: 1. + out := self isStereo + ifTrue: [stereoBuffer] + ifFalse: [stereoBuffer extractLeftChannel]. - self isStereo - ifTrue: [out := stereoBuffer] - ifFalse: [out := stereoBuffer extractLeftChannel]. reverseBytes ifTrue: [out reverseEndianness]. (aBinaryStream isKindOf: StandardFileStream) ifTrue: [ "optimization for files: write sound buffer directly to file" aBinaryStream next: (out size // 2) putAll: out startingAt: 1] "size in words" ifFalse: [ "for non-file streams:" 1 to: out monoSampleCount do: [:i | aBinaryStream int16: (out at: i)]]. remaining := remaining - bufSize]]. ! Item was changed: ----- Method: MIDIScore>>initialize (in category 'initialization') ----- initialize + super initialize. tracks := #(). ambientTrack := Array new. tempoMap := #(). ticksPerQuarterNote := 100. ! Item was changed: ----- Method: MIDISynth>>initialize (in category 'as yet unclassified') ----- initialize + super initialize. midiParser := MIDIInputParser on: nil. channels := (1 to: 16) collect: [:ch | MIDISynthChannel new initialize]. ! Item was changed: ----- Method: MIDISynthChannel>>initialize (in category 'initialization') ----- initialize + super initialize. instrument := FMSound default. muted := false. masterVolume := 0.5. channelVolume := 1.0. pan := 0.5. pitchBend := 0.0. activeSounds := OrderedCollection new. ! Item was changed: ----- Method: RandomEnvelope>>initialize (in category 'initialization') ----- initialize + super initialize. rand := Random new. lowLimit := 0.994. highLimit := 1.006. delta := 0.0002. currValue := 1.0. scale := 1.0. ! Item was changed: ----- Method: SampledInstrument>>initialize (in category 'accessing') ----- initialize + super initialize. sustainedThreshold := 0.15. loudThreshold := 0.5. ! Item was changed: ----- Method: SimpleMIDIPort class>>portDescription: (in category 'utilities') ----- portDescription: portNum "Answer a string indicating the directionality of the given MIDI port." "(0 to: SimpleMIDIPort primPortCount - 1) collect: [:i | SimpleMIDIPort portDescription: i]" | portName dir | + portName := (self primPortNameOf: portNum) convertFromSystemString. + dir := self primPortDirectionalityOf: portNum. - portName _ (self primPortNameOf: portNum) convertFromSystemString. - dir _ self primPortDirectionalityOf: portNum. dir = 1 ifTrue: [^ portName, ' (in)']. dir = 2 ifTrue: [^ portName, ' (out)']. dir = 3 ifTrue: [^ portName, ' (in/out)']. ^ self error: 'unknown MIDI port directionality' ! Item was changed: ----- Method: SoundRecorder>>initialize (in category 'initialization') ----- initialize "SoundRecorder new" + super initialize. stereo := false. samplingRate := 11025. recordLevel := 0.5. self initializeRecordingState. ! |
Free forum by Nabble | Edit this page |