Jump to content
Sign in to follow this  
dragonflightdesign

register_variable_by_name

Recommended Posts

I'm just at the tidying-up stage of a new sound gauge for FS9/FSX when I realise that what's good for me isn't good for the rest of you... i.e I've been playing sound files by referring to them as a number read from a list and not as a string. Looking down through the fsxgauges.h files, I seeregister_variable_by_name(PCSTRINGZ)which looks like it sorts the problem. Well, that problem anyway. Maybe. :). The follow-up problem is that if I register a string variable to carry the soundfile name, how do I read it at the other end?get_variable_by_nameby any chance? Anyone got any ideas....? samples....?-Dai

Share this post


Link to post
Share on other sites

Dai,I think you are referring to: ID (FSAPI *register_named_variable) (PCSTRINGZ name);This function creates an XML L:Variable, not a shared string variable.My suggestion would be to declare an old fashioned C gauge shared variable which will hold a pointer to the structure you have your sound names and .wav files stored in.Doug

Share this post


Link to post
Share on other sites

You want to use register_var_by_name. It supports any of the variable types.


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

Ed: Unless I'm completely mistaken (which is very definately not beyond the realms of possibility!) typedef_enum VAR_TYPE contains only numerical fields of various radices. I have to admit that the only var type that has me puzzled is TYPE_VARxx; it has to be something I've never needed to use and so I've never pursued it.Doug:The last time I tried to do that, the compiler repeatedly gave me the proverbial finger. Could I ask you to provide a code snippet example please? Email me if you think it's easier. I'd like to get this gauge out ASAP. I will state that it is only a stop-gap and that currently it will only play mono sounds - stereo and panning will come later.-Dai

Share this post


Link to post
Share on other sites

>Ed: >>Unless I'm completely mistaken (which is very definately not>beyond the realms of possibility!) typedef_enum VAR_TYPE>contains only numerical fields of various radices. I have to>admit that the only var type that has me puzzled is>TYPE_VARxx; it has to be something I've never needed to use>and so I've never pursued it.>You're completely mistaken... ;)Your variable is one of these: VAR_TYPE. Do a search in gauges.h. For a pointer you would use TYPE_VOID, for a pointer to a pointer you would use TYPE_PVOID. As an example, assume you have a variable declared as:char* wpt_id[40];To allow other gauges to 'see' this... you'd declare it like this:register_var_by_name(&wpt_id,TYPE_PVOID,"wpt_id");This would pass a pointer to the char* variable named wpt_id.


Ed Wilson

Mindstar Aviation
My Playland - I69

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...