Results 1 to 1 of 1

Thread: Using GaugeSound.dll with MSVC++ .NET (all editions)

  1. #1
    Join Date
    Mar 2005
    Hammond, IN USA

    Default Using GaugeSound.dll with MSVC++ .NET (all editions)

    Anyone who's attempted to implement the use of GaugeSound.dll in their projects compiled with anything other than MinGW has undoubtedly encountered the problem with "looped sounds" failing to "stop" when commanded with the (GaugeStopSound)("stop_flag"); function.

    Here then is a slight modification that will overcome this limitation.

    Change the LPTSTR in the 2nd param of "TGaugePlaySound" to an LPSTR, change the LPTSTR in "TGaugeStopSound" to an LPSTR, and
    then explicitly create the necessary LPSTR buffers and initialize them with constants:

    // Sound declarations
        typedef VOID (*TGaugePlaySound)(LPTSTR,LPSTR,int);
        typedef VOID (*TGaugeStopSound)(LPSTR);
        typedef VOID (*TTerminateSounds)();
        TGaugePlaySound GaugePlaySound;
        TGaugeStopSound GaugeStopSound;
        TTerminateSounds TerminateSounds;
        HMODULE MGaugeSound;
        LPSTR flap = "flap";
        LPSTR gearhorn = "gearhorn";
        LPSTR overspeed = "overspeed";
        LPSTR firetest = "firetest";
        LPSTR geartest = "geartest";
        LPSTR speedtest = "speedtest";
        LPSTR warning = "warning";
    Then, in the gauge's function calls, use the named pointer instead of a "string":

                if ( *rotartest == 1 ) 
                    { (GaugePlaySound)("sound\\esdg\\fire.wav",firetest,1) ; }
                else { (GaugeStopSound)(firetest); }
    Note that in the actual function call, no "quote marks" are required, since we're now passing a pointer name, and not a literal string.

    NOTE: My thanks go to Dave Nunyez from the Freelight Design forums for pointing out that my earlier "kludge" using an int wasn't really "safe hex" and could lead to all sorts of problems down the road.
    Last edited by n4gix; 06-07-2008 at 03:48 PM.
    Bill Leaming
    Gauge Programming - 3d Modeling Military Visualizations Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - EVGA GTX770 4GB - Win7 64bit Home Premium
    Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional
    Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium
    NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

Similar Threads

  1. GaugeSound.dll
    By IronmanMLR in forum FS2004
    Replies: 2
    Last Post: 09-15-2008, 09:49 AM
  2. MSVC++ .NET 2003 IDE Setup
    By n4gix in forum Panel & Gauge Design
    Replies: 2
    Last Post: 11-12-2005, 07:03 PM
  3. gaugesound.dll help
    By hobbitrocks in forum FS2004
    Replies: 2
    Last Post: 02-29-2004, 11:51 AM
  4. gaugesound.dll question
    By kc10 in forum FS2004
    Replies: 4
    Last Post: 02-23-2004, 10:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts