Jump to content

Recommended Posts

Guest VAPilot

This is quite a long post, so you might want a coffee before you start :-)After a few week trying to add a click sound to a switch, I have finally manged it, the problem is I can see how it works, but can not see why it works, read on an hopefully all will be come clear :-). I am using Jose Olivera DX Sound, but was getting a load of errors. So before qiving up on directsound and looking at an alternatives, I thought I would give it one last go. Before I made sure I had linked all the lib file, Include all I thought I needed to include and the compiler goes nuts and chucks out 120 + errors. So I wanted to see what what would happen if I include each one individually and see what errors it chuck up. Did that and my problem seem to be with sound.cpp and waveread.cpp, untill then compiled with a few errors, but compiled. Everything was starting to get a bit messy, so I started again, started a new project switch without sound and checked it compiled ok, which it did. Included sound.h to the resource file, and then added the code from Jose Olivera sample switch to my switches code, then added dsound.lib, winmm.lib, dxsounddebug.lib in the additional dependances, and in my haste compiled it, and it brought up three errors and two warnings. For once I understood what the problem was with my compiler the error: message defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library., also said MSVCRT.lib was already defined in LIBCMTD.lib. Went back in to proprites, linker,input, Ignore all default libraries and changed to yes (//NODEFAULTLIB), also added libcmtd.lib to additional dependances. Recompiled it and the dam thing compiles, there are a couple of warnings 2 being with the dxsounddebug.lib and the other one is: warning C4133: 'function' : incompatible types - from 'char [16]' to 'TCHAR *', but as it compiled the least I could do was try it in FS9. Added to the default cessna panel, started FS no errors/problems reported, created a flight, switch was in the middle of the window then with little apprehension click it and it works, was expecting a CTD nothing clicked the thing on and off for ages not CTD.Now for the bit I do not understand, in no way am I including sound.cpp, waveread.cpp or waveread.h. I had removed this from my include folder, I have check every folder, remove all trace of them from my hard drive and still compiles and works. If I remove the dxsound.lib gauge compiles and works, removed winmm.lib does the same, remove libcmtd.lib or dxsounddebug.lib and fails to compile. Bring back and include sound.cpp and wavread.cpp in the project 120 + errors.Figured there is something in the lib file, opened it in notepad and although some of it is corrupt there is refence to waveread.cpp, and sound.cpp but the directory it points to is not there (The directory d:jcarlosdesktopfsdxsoundsound libsound.cpp) D is my DVD-RW, and my name is not jcarlos. Did a search for dxsounddebug.lib on google, got; dxsounddebug.lib - did not match any documents I then looked through the newest direct x sdk, nothing, found an old one on a CD nothing. Where does dxsounddebug.lib come from ? and how does it work ? If add Jose old V7.0 code as a solution to V9.0 after upgrading it, it compiles with a couple of warnings, but works fine in FS9. Looking through his code I can not see where that include sound.cpp and waveread.cpp, it does however include a makefiles which when opened contains links to sound.cpp and waveread.cpp, but if I understand correctly my compiler would not use that, or does it ? but then my code does not use a makefile and that works. Any help/ideas with this would will be greatly appreachiated, as my head aches *:-*

Share this post


Link to post
Share on other sites

Hi RussOpening the .lib file is simply revealing some of Jose's old code references, hence the appearance of those odd paths and file names. dxsoundebug.lib sounds like it's possibly one of Jose's too. I guess (because I can't know) that your code is making some pretty nasty links to various libraries and dlls (by nasty I mean 'call-this' to 'call-this' to 'call-this' when one correctly referenced 'call-this' would have done the job). However, in C if it works....Makefiles are the old, now very-rarely used way of calling the compiler from a command line rather than the IDE.Your code absolutely *has* to call to waveread.cpp somewhere along the way as it is this function that parses and loads the wav file.If you are adding waveread.cpp and sound.cpp and are getting a shedload of compile errors, I am pretty sure that you have not added sound.h and waveread.h into the correct paths. The header files contain the prototype calls; if you check them, you will see that they call as 'extern' i.e. the .cpp files are not actually part of your gauge although they are compiled into it (I know, that doesn't make much sense. Sometimes I have a hard time understanding externs). Your gauge (my gauge code! :)) references the header files which in turn reference (and are referenced by) the .cpp files, hence all the correct calls are made to parse, load and play the wave file.-Dai

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...