[prev in list] [next in list] [prev in thread] [next in thread]
List: olpc-etoys
Subject: [etoys-dev] Etoys Inbox: Sound-kfr.21.mcz
From: commits () source ! squeak ! org
Date: 2012-02-22 20:36:25
[Download RAW message or body]
A new version of Sound was added to project Etoys Inbox:
http://source.squeak.org/etoysinbox/Sound-kfr.21.mcz
==================== Summary ====================
Name: Sound-kfr.21
Author: kfr
Time: 22 February 2012, 9:36:33 pm
UUID: faaa5c22-e2d8-614d-942c-9113403e7c57
Ancestors: Sound-kfr.20
In image handling of sound volume
=============== Diff against Sound-kfr.20 ===============
Item was added:
+ (PackageInfo named: 'Sound') preamble: '"below, add code to be run before the \
loading of this package" +
+ SoundPlayer initialize'!
Item was changed:
----- Method: AbstractSound>>playSampleCount:into:startingAt: (in category \
'playing') ----- playSampleCount: n into: aSoundBuffer startingAt: startIndex
"Mix the next n samples of this sound into the given buffer starting at the given \
index. Update the receiver's control parameters periodically."
| fullVol samplesBetweenControlUpdates pastEnd i remainingSamples count |
+ fullVol := AbstractSound scaleFactor * SoundPlayer soundVolume average.
- fullVol _ AbstractSound scaleFactor.
samplesBetweenControlUpdates _ self samplingRate // self controlRate.
pastEnd _ startIndex + n. "index just after the last sample"
i _ startIndex.
[i < pastEnd] whileTrue: [
remainingSamples _ self samplesRemaining.
remainingSamples <= 0 ifTrue: [^ self].
count _ pastEnd - i.
samplesUntilNextControl < count ifTrue: [count _ samplesUntilNextControl].
remainingSamples < count ifTrue: [count _ remainingSamples].
self mixSampleCount: count into: aSoundBuffer startingAt: i leftVol: fullVol \
rightVol: fullVol. samplesUntilNextControl _ samplesUntilNextControl - count.
samplesUntilNextControl <= 0 ifTrue: [
self doControl.
samplesUntilNextControl _ samplesBetweenControlUpdates].
i _ i + count].
!
Item was changed:
Object subclass: #SoundPlayer
instanceVariableNames: ''
+ classVariableNames: 'ActiveSounds Buffer BufferIndex BufferMSecs LastBuffer \
PlayerProcess PlayerSemaphore ReadyForBuffer ReverbState SamplingRate \
SoundJustStarted SoundSupported Stereo UseReadySemaphore UseReverb \
Volume'
- classVariableNames: 'ActiveSounds Buffer BufferIndex BufferMSecs LastBuffer \
PlayerProcess PlayerSemaphore ReadyForBuffer ReverbState SamplingRate \
SoundJustStarted SoundSupported Stereo UseReadySemaphore UseReverb' \
poolDictionaries: '' category: 'Sound-Synthesis'!
Item was changed:
----- Method: SoundPlayer class>>initialize (in category 'initialization') -----
initialize
"SoundPlayer initialize; shutDown; startUp"
"Details: BufferMSecs represents a tradeoff between latency and quality. If \
BufferMSecs is too low, the sound will not play smoothly, especially during \
long-running primitives such as large BitBlts. If BufferMSecs is too high, there will \
be a long time lag between when a sound buffer is submitted to be played and when \
that sound is actually heard. BufferMSecs is typically in the range 50-200." + \
Volume ifNil:[Volume := #(1.0 1.0) ].
-
SamplingRate := 22050.
BufferMSecs := 120.
Stereo := true.
Preferences
addPreference: #soundReverb
categories: #(media)
+ default: false
- default: true
balloonHelp: 'If true, a little echo will be added, making it sound as if it is \
in a larger space.' projectLocal: true
changeInformee: self
changeSelector: #reverbChanged.
self reverbChanged.
!
Item was changed:
----- Method: SoundPlayer class>>setVolumeLeft:volumeRight: (in category \
'accessing') ----- setVolumeLeft: aLeftVolume volumeRight: aRightVolume
"Set sound pass in float 0.0-1.0 for left and right channel, with possible 2.0 or \
higher to overdrive sound channel " + Volume at:1 put:aLeftVolume.
+ Volume at:2 put:aRightVolume.!
- self primSoundSetVolumeLeft: aLeftVolume volumeRight: aRightVolume!
Item was changed:
----- Method: SoundPlayer class>>soundVolume (in category 'accessing') -----
soundVolume
"Return sound as array of doubles left then right channel, range is 0.0 to 1.0 but \
may be overdriven" + ^Volume!
- ^self primSoundGetVolume!
_______________________________________________
etoys-dev mailing list
etoys-dev@squeakland.org
http://lists.squeakland.org/mailman/listinfo/etoys-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic