[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: sleep 0.2 acts more like sleep 1

Cliff Rowley

5/16/2007 9:12:00 PM

> -----Original Message-----
> From: Gordon Thiesfeld [mailto:gthiesfeld@gmail.com]
> Sent: 15 May 2007 15:45
> To: ruby-talk ML
> Subject: Re: sleep 0.2 acts more like sleep 1
>
> If I understand your question, you want to play a wav file
> repeatedly, as quickly as possible. This code is from the
> example file in the win32-sound gem. It plays chimes.wav 5
> times in 3 seconds on both of my XP machines.
>
> <code>
> require "win32/sound"
> include Win32
>
> wav = "c:\\windows\\media\\chimes.wav"
>
> Sound.play(wav,Sound::ASYNC|Sound::LOOP)
> sleep 3
> Sound.stop
>
> </code>
>
> Hope it helps.
>
> Gordon

It would also make sense to me to use a longer sound file. A 3 second sound
file containing 15 beeps, or something.. Seems a little less like brute
force to me, playing the sound only 4 or 5 times in 15 seconds, or
something.

Just my 2p.


1 Answer

RichardOnRails

5/22/2007 8:02:00 PM

0

Hi Cliff,

I agree completely, but I didn't know where to get (of how to
construct) a longer file. And I'd rather learn a better Ruby
technique (as Cliff provided on May 15, for example) than research
multimedia issues.

But thanks for posting a valid idea.

Best wishes,
Richard

On May 16, 5:11 pm, "Cliff Rowley" <cliffrow...@gmail.com> wrote:
> > -----Original Message-----
> > From: Gordon Thiesfeld [mailto:gthiesf...@gmail.com]
> > Sent: 15 May 2007 15:45
> > To: ruby-talk ML
> > Subject: Re: sleep 0.2 acts more like sleep 1
>
> > If I understand your question, you want to play a wav file
> > repeatedly, as quickly as possible. This code is from the
> > example file in the win32-sound gem. It plays chimes.wav 5
> > times in 3 seconds on both of my XP machines.
>
> > <code>
> > require "win32/sound"
> > include Win32
>
> > wav = "c:\\windows\\media\\chimes.wav"
>
> > Sound.play(wav,Sound::ASYNC|Sound::LOOP)
> > sleep 3
> > Sound.stop
>
> > </code>
>
> > Hope it helps.
>
> > Gordon
>
> It would also make sense to me to use a longer sound file. A 3 second sound
> file containing 15 beeps, or something.. Seems a little less like brute
> force to me, playing the sound only 4 or 5 times in 15 seconds, or
> something.
>
> Just my 2p.