13,252
edits
(I encountered this problem on the concatenation of paths, "~" it is not enough you need to insert the character "/" then I replaced "~" with the string ~ '/' ~) |
(Separating out a suitable first section; + headings; copyediting; +rel: Howto:Add sound effects to aircraft) |
||
Line 1: | Line 1: | ||
__NOTOC__ | |||
'''Reloading the sound configuration without restarting''' can be a massive time saver for those working on sound configuration files. | |||
== Using the Nasal console == | |||
The following line of Nasal code can be entered in the [[Nasal Console|Nasal console]] (found in the Debug [[menu]]). | |||
<syntaxhighlight lang="nasal"> | |||
fgcommand("reinit", props.Node.new({ subsystem: "fx" })) | fgcommand("reinit", props.Node.new({ subsystem: "fx" })) | ||
</syntaxhighlight> | |||
Every time | Every time the line is executed the sound subsystem ("fx") is restarted and the configuration file reloaded, enabling you to test your changes instantly. | ||
{{tip|Remember to actually save your sound configuration file each time you want to test it, so that FG can see the most recent changes.}} | |||
<syntaxhighlight lang=" | == Reloading the sound config automatically == | ||
Here is a Nasal function which will automatically reload the sound configuration file when you make a change: | |||
<syntaxhighlight lang="nasal"> | |||
var reload_sound = func { | var reload_sound = func { | ||
var sf = getprop('/tmp/sound-xml/path'); | var sf = getprop('/tmp/sound-xml/path'); | ||
Line 31: | Line 41: | ||
reload_sound(); | reload_sound(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Related content == | |||
* [[Howto:Add sound effects to aircraft]] | |||
[[Category:Howto|Reload sound config without restarting]] | [[Category:Howto|Reload sound config without restarting]] |