Howto:Reload sound configuration without restarting: Difference between revisions
Jump to navigation
Jump to search
m (Johan G moved page Howto:Reloading the sound configuration without restarting to Howto:Reload the sound configuration without restarting: Aargh grammar!) |
m (Johan G moved page Howto:Reload the sound configuration without restarting to Howto:Reload sound configuration without restarting: Better. Better get to bed as well...) |
(No difference)
|
Revision as of 02:00, 2 October 2015
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 (found in the Debug menu).
fgcommand("reinit", props.Node.new({ subsystem: "fx" }))
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. |
Reloading the sound config automatically
Here is a Nasal function which will automatically reload the sound configuration file when you make a change:
var reload_sound = func {
var sf = getprop('/tmp/sound-xml/path');
if(sf == nil)
{
sf = getprop('/sim/fg-root') ~ '/' ~ getprop('/sim/sound/path');
setprop('/tmp/sound-xml/path', sf);
}
var st = io.stat(sf);
var lm = getprop('/tmp/sound-xml/modified');
if(lm == nil)
{
lm = st[9];
setprop('/tmp/sound-xml/modified', lm);
}
elsif(lm < st[9])
{
setprop('/tmp/sound-xml/modified', st[9]);
fgcommand('reinit', props.Node.new({ subsystem: "fx" }));
}
settimer(reload_sound, 2);
}
reload_sound();