Playing AIFF sounds

Bob Arning arning at charm.net
Sun May 7 16:17:24 UTC 2000


On Sun, 07 May 2000 00:07:47 -0700 John M McIntosh <johnmci at smalltalkconsulting.com> wrote:
>Of course the other application gets control via getnextevent to have a
>slice of time for processing. 

I spent some time yesterday searching Apple's developer web site trying to get better details on what happens here, but fell short of epiphany. The implication is that WaitNextEvent is better if you want to give up control occasionally, but it never states definitively that GetNextEvent will not. I'd really like to know more about how this is handled.

>If the sound buffer doesn't have sufficient
>bytes in it then you'll get a pause or the replay? until control returns to
>squeak and you get more bytes into the sound manager. Mind this is
>speculation on my part 

This is verifiable. If you put some logging in SoundPlayer class>>playLoop to see how often it sends data to the SoundManager, you can see longer than usual waits correlating with repeated sounds. Incidentally, sound glitches come in at least two varieties:

a pause happens if the SoundPlayer is running at a reasonable speed, but successive requests to play sounds are delayed.

a repeat happens if the SoundPlayer has the data it needs but is unable to refill the SoundManager buffer fast enough.

>but it would be interesting to know how many msecs
>are buffered versus how long that getnext/waitnextevent takes. Say for
>example what if that Endora app sucks up 750ms once and awhile?

That's fairly easy to find out. I modified 

	ProcessorScheduler class>>relinquishProcessorForMicroseconds:

to record the time spent in each call. On the Mac all this does is SystemTask() and GetNextEvent(), so we can get an idea. Below are the millisecond times observed and number of occurrences. It is *almost* always fast, but there's an interesting cluster from 100 to 120 ms. (BTW, this is with Squeak 2.8 in the forground and I.E.+Squeak 2.5 in the background.

0->5595088
1->72988
2->939
3->300
4->119
5->108
6->90
7->97
8->57
9->67
10->71
11->51
12->70
13->86
14->77
15->68
16->57
17->32
18->42
19->224
20->34
21->12
22->4
23->6
25->6
26->5
27->12
28->2
29->5
30->5
31->4
32->3
33->4
34->3
35->5
36->5
38->1
39->1
41->1
44->1
45->3
46->3
47->3
48->2
49->3
50->2
52->1
53->1
54->3
55->5
56->4
57->5
58->8
59->5
60->2
61->4
62->2
65->2
66->1
68->1
69->2
70->3
72->1
74->1
75->2
77->2
78->2
79->2
80->1
81->2
82->1
83->2
84->5
85->208
86->159
87->31
88->14
89->11
90->9
91->7
92->17
93->15
94->13
95->43
96->21
97->13
98->7
99->4
100->6
101->3
102->44
103->60
104->75
105->66
106->70
107->55
108->59
109->58
110->21
111->15
112->13
113->11
114->10
115->19
116->12
117->12
118->20
119->10
120->4
121->7
122->3
124->2
125->6
126->2
127->3
128->1
129->4
130->1
131->2
132->5
133->4
134->2
135->5
136->2
137->3
138->1
139->3
140->1
141->1
142->5
143->3
144->10
145->5
146->6
147->2
148->1
149->1
151->1
152->1
158->1
161->2
162->2
163->4
164->5
165->7
166->5
167->1
168->2
169->2
170->2
171->2
172->3
173->2
174->2
177->1
181->1
183->2
184->1
185->1
186->6
187->5
188->2
189->3
190->2
193->1
196->1
197->1
199->1
218->1
219->1
250->1
266->1
268->1
273->1
278->1
327->1
434->3
435->6
436->1
437->1
444->2
445->3
446->3
447->1
448->7
450->1
451->5
452->1
453->2
454->1
455->1
461->2
462->4
463->1
464->1
465->2
468->1
483->1
500->1
501->1
537->1
550->1
553->1
554->1
555->1
558->1
563->1
564->1
565->1
568->1
571->1
572->1
573->1
578->1
586->1
683->1
723->1
790->1

Cheers,
Bob

P.S. With no other applications running, the numbers are rather different:

0->5845990
1->76961
2->989
3->540
4->459
5->424
6->441
7->401
8->410
9->344
10->377
11->349
12->245
13->59
14->34
15->14
16->17
17->10
18->10
19->9
21->2
23->1
27->3
31->1
59->1
276->1





More information about the Squeak-dev mailing list