Re: Beep Beep



Rick Raisley wrote:
Jim, I notice when using your code that calling the sound does not
wait until it is done playing. I looped together some rising
sounds, each 200 ms long, expecting to hear a steadily increasing
frequency. But it kind of muddled together. Apparently, calling a
200 ms (or 1000 ms, whatever) sound returns to the program
immediately, while the sound continues to play. Now, that's not
unexpected, but it means you can't string several play commands
together, and have it sound like a "song".

I could add a Sleep command, to delay the duration of the note, but
my guess is that it will result in no sound playing for a brief
period. Still, that might be fine.

Is there anything within the DLL that could optionally keep code
from returning to the calling routine until the sound is done
playing?

Internally, the DLL uses PlaySound with the SND_ASNYC flag, which is
normally what you want. I could add an option to play sync or async,
but it's just as easy for you to do it. The .Play method is mainly a
fillip - the real power is in the .Generate method.

First, Declare PlaySound yourself, and the SND_MEMORY flag.

Then, use the DLL to .Generate each sound, and save the returned
buffers in local byte arrays. See the file save example code for
inspiration.

When you want to play a series of sounds, make your own calls to
PlaySound using the stored buffers in any sequence. You can use a
Variant array to hold a series of byte arrays, BTW.

Also, I believe PlaySound works just as well with a series of
concatenated WAV images. If so you could just string out a set of
..SoundBuffers into one big array.

Private Const SND_ASYNC As Long = 1 ' leave this out
Private Const SND_MEMORY As Long = 4

Private Declare Function PlaySound Lib "winmm" _
Alias "PlaySoundA" (ByRef snd As Byte, _
ByVal hFil As Long, ByVal flags As Long) As Long

PlaySound bytBuffer(0), 0, SND_MEMORY 'Or SND_ASYNC

--
Jim Mack
Twisted tees at http://www.cafepress.com/2050inc
"We sew confusion"

.



Relevant Pages

  • Re: Shostakovichs 8th symphony?
    ... but the PSO simply doesn't have enough sound and impact ... They play very well, but they just don't have a very impactful ... playing style. ... the conductors who shape the sound of the orchestra. ...
    (rec.music.classical.recordings)
  • Re: Shostakovichs 8th symphony?
    ... but the PSO simply doesn't have enough sound and impact ... They play very well, but they just don't have a very impactful ... Francisco sounds to me compared to my favorite orchestras (I think ... playing style. ...
    (rec.music.classical.recordings)
  • Re: Shostakovichs 8th symphony?
    ... but the PSO simply doesn't have enough sound and impact ... They play very well, but they just don't have a very impactful ... Francisco sounds to me compared to my favorite orchestras (I think ... playing style. ...
    (rec.music.classical.recordings)
  • Re: Who still live at Leeds
    ... we are Cream @ the Royal Albert Hall (unless we are playing Red House, ... Cream was the ultimate proof of that. ... isn't about the notes you play, it is about the notes you DON'T play. ... The wall of sound has its place, but if they can't ever do without it then ...
    (rec.music.gdead)
  • Re: A gig perspective..........
    ... noisy crowd. ... > able to hear myself play. ... I opted for no monitors during sound check, ... > as the sound coming from the house was just fine, and I was playing ...
    (rec.music.makers.guitar.acoustic)

Loading