Hi James,

It has been a while since I've looked at this so I have to dig a bit 
here. I don't think much has changed in the mean time though, except for 
adding positioning and directional parameters.

James Sleeman wrote:
> Erik I think you wrote the xmlsound.README file.  Do you know if there 
> is some other documentation I could look at, that might make it a bit 
> clearer as I think maybe your documentation is not quite up to date.
> 
> For example, I don't think that max-dist works any more (if it ever 
> did), a search of the current FG source doesn't turn it up in anything 
> (except mk_viii.cxx but that does not seem related, and of course your 
> xmlsound.README).

I'm not sure if such a configuration parameter was ever implemented as 
the idea at that time was could have been that it would be the same for 
every sound. Adding it might be a good idea though

> I also have not been able to find what the valid "range of values" for 
> <pitch> is, (<volume> I believe is 0 to 1 (silent to full)).  I'm also 
> having trouble understanding the interaction of offset, factor and 
> multiple volume/pitch sections for a single event.

OpenAL specifies the following:
volume: [0..1]
pitch: unspecified, may be clamped.
Actually the limiting factor for pitch is the Creative driver which 
limits pitch to [0..2]

Also, multiple offsets are added together (so be careful) and multiple 
factors are multiplied together.

> To give a specific example I am trying to accomplish, I want a given 
> sound to start to "fade in" when accelerating past say 300kts airspeed, 
> reach full volume at, say, 350kts, maintain full volume at or above 
> this, and then when decelerating start fading out from 350 and be 
> silenced by 300. 
> 
> In a functional description, I want:
>  volume = max(min(350,airspeed)-300,0)/50
> (where 0 <= volume <= 1) but I can't see how such a thing could be done 
> in a sound.xml

What I end up doing all the time is determining the maximum value of a 
property and set <factor> to 1/max

The easiest way would be to create a separate <volume> section for the 
divide by 50:

    <volume>
     <property>/velocities/airspeed-kt</property>
     <factor>0.002857</factor> <!-- 1/350 -->
     <offset>-0.8571</offset>   <!-- -300/350 -->
     <min>0.0</min>
     <max>1.0</max>
    </volume>
    <volume>
     <factor>0.02</factor> <!-- 1/50 -->
    </volume>

So one would divide every number by the maximum allowable value and 
substitute the property for '1' to get a normalized formula. For

volume(norm) = max(min(350/350,1/350)-(300/350),0)

this way you can set <min>0</min> and <max>1.0</max> and remove them 
from  the formula:

volume = (1/350) - (300/350)

And then you split up the factor and offset parts:

factor = (1/350) = 0.002857142
offset = (-300/350) = -0.875142857

It should be possible to fetch all this into one <volume> section but 
the division by 50 outside them min() and max() statement makes this 
rather tough.


Erik



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to