Microsoft Small Basic

Program Listing: RWR532
n = 3
delay = 1000
total = 0
TextWindow.WriteLine("Sound.PlayBellRing():")
For i = 1 To n
ms = Clock.ElapsedMilliseconds
Sound.PlayBellRing()
ms = Clock.ElapsedMilliseconds - ms
TextWindow.WriteLine(ms + "[ms]")
total = total + ms
EndFor
TextWindow.WriteLine("Average " + (total / n) + "[ms]")
Program.Delay(delay)
total = 0
TextWindow.WriteLine("Sound.PlayBellRingAndWait():")
For i = 1 To n
ms = Clock.ElapsedMilliseconds
Sound.PlayBellRingAndWait()
ms = Clock.ElapsedMilliseconds - ms
TextWindow.WriteLine(ms + "[ms]")
total = total + ms
EndFor
TextWindow.WriteLine("Average " + (total / n) + "[ms]")
Program.Delay(delay)
total = 0
TextWindow.WriteLine("Sound.PlayChime():")
For i = 1 To n
ms = Clock.ElapsedMilliseconds
Sound.PlayChime()
ms = Clock.ElapsedMilliseconds - ms
TextWindow.WriteLine(ms + "[ms]")
total = total + ms
EndFor
TextWindow.WriteLine("Average " + (total / n) + "[ms]")
Program.Delay(delay)
total = 0
TextWindow.WriteLine("Sound.PlayChimeAndWait():")
For i = 1 To n
ms = Clock.ElapsedMilliseconds
Sound.PlayChimeAndWait()
ms = Clock.ElapsedMilliseconds - ms
TextWindow.WriteLine(ms + "[ms]")
total = total + ms
EndFor
TextWindow.WriteLine("Average " + (total / n) + "[ms]")
Program.Delay(delay)
total = 0
TextWindow.WriteLine("Sound.PlayChimes():")
For i = 1 To n
ms = Clock.ElapsedMilliseconds
Sound.PlayChimes()
ms = Clock.ElapsedMilliseconds - ms
TextWindow.WriteLine(ms + "[ms]")
total = total + ms
EndFor
TextWindow.WriteLine("Average " + (total / n) + "[ms]")
Program.Delay(delay)
total = 0
TextWindow.WriteLine("Sound.PlayChimesAndWait():")
For i = 1 To n
ms = Clock.ElapsedMilliseconds
Sound.PlayChimesAndWait()
ms = Clock.ElapsedMilliseconds - ms
TextWindow.WriteLine(ms + "[ms]")
total = total + ms
EndFor
TextWindow.WriteLine("Average " + (total / n) + "[ms]")
Program.Delay(delay)
total = 0
TextWindow.WriteLine("Sound.PlayClick():")
For i = 1 To n
ms = Clock.ElapsedMilliseconds
Sound.PlayClick()
ms = Clock.ElapsedMilliseconds - ms
TextWindow.WriteLine(ms + "[ms]")
total = total + ms
EndFor
TextWindow.WriteLine("Average " + (total / n) + "[ms]")
Program.Delay(delay)
total = 0
TextWindow.WriteLine("Sound.PlayClickAndWait():")
For i = 1 To n
ms = Clock.ElapsedMilliseconds
Sound.PlayClickAndWait()
ms = Clock.ElapsedMilliseconds - ms
TextWindow.WriteLine(ms + "[ms]")
total = total + ms
EndFor
TextWindow.WriteLine("Average " + (total / n) + "[ms]")
Program.Delay(delay)