[futurebasic] Re: Sound handle...

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1998 : Group Archive : Group : All Groups

From: Al Staff <AlStaff@...>
Date: Tue, 12 May 1998 07:41:33 EDT
<<<<I need to start playing a sound very fast because otherwise, it slows down
my animations everytime it starts. (as with the Sound command).

The next code is using the Sound Manager by allocating a sound channel and
playing a sound asyncronously.

Everything is OK but calling FN GETRESOURCE and RELEASERESOURCE everytime i
want to play the sound takes too much time. (not sure)

Is it possible to keep the handle in memory until the end of the program ?>>>>


Yes, you can keep the handle in memory. I would make SndHandle& a global, then
do the GETRESOURCE in your initialization routine and lock the handle with
HLOCK. Then you can play it anytime without calling GETRESOURCE or
RELEASERESOURCE. When your program quits, check that SndHandle& is valid. If
so then HUNLOCK and RELEASERESOURCE.


Al Staffieri Jr.

AlStaff@...
http://members.aol.com/AlStaff/index.html