Sign in to follow this  
Guest Patrick_Waugh

Can't making looping sound stop

Recommended Posts

I am using the following code. The looping sound turns on just fine. But it won't shut off when the variable Alarm_pos is set to 0.switch(service_id){case PANEL_SERVICE_PRE_UPDATE:MGaugeSound = GetModuleHandle("GaugeSound");if (MGaugeSound == NULL) {MGaugeSound = LoadLibrary("GaugeSound");}GaugePlaySound = (TGaugePlaySound)GetProcAddress(MGaugeSound,"GaugePlaySound");GaugeStopSound = (TGaugeStopSound)GetProcAddress(MGaugeSound,"GaugeStopSound");TerminateSounds = (TTerminateSounds)GetProcAddress(MGaugeSound,"TerminateSounds"); if(Alarm_pos == 1) (GaugePlaySound)("SoundAlarm.wav","alarm",1); else (GaugeStopSound)("alarm");break;}Any help would be appreciated.Rob

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Like Doug said, it seems not to work in my MSVC++ .NET 2003 compiler either. Works just fine with the MinGW compiler of course.However, TerminateSounds works just fine. Unfortunately, it will stop ALL sounds currently being played with the GaugeSound.dll, but...

Share this post


Link to post
Share on other sites

Yeah, instead use DxSound.zip, which you can find here on AVSIM I believe.It is very easy to use, and then you don't have to learn DirectSound. You just load sounds when the panel loads, then use them in callbacks, and then free buffers as the panel unloads.

Share this post


Link to post
Share on other sites

I am not using the VC++ envionment, but compiling using that which comes with Dev Studio 6.Any ideas?Rob

Share this post


Link to post
Share on other sites

Isn't that an older compiler? Why not use the new one, especially since you can get a free version of it. Why make life harder than it has to be.

Share this post


Link to post
Share on other sites

Nice find.Glad you didn't figure this out 2 years ago, or I wouldn't have forced myself to learn DirectSound, haha. =)Now I'm free to do whatever I want sound-wise.

Share this post


Link to post
Share on other sites

>OK, eight months later I think I have it figured out...>Enable "String Pooling" in the VS environment:Jesu, Maria, Guiseppe! I would NEVER have thought to look there...Great find! ;)Now I'm off to fix a bunch of gauges that need this... If I'm ever in your neck of the woods Doug, I own you at least a couple cases of your favorite beverage! :-beerchug

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this