Add a do_play_audio_message() function which is tied to the
"play-audio-function" command. This function can be called from internal code, from nasal scripts, or from external scripts to play a single one-off wav file. File/audio data is loaded and unloaded on the fly automatically.
This commit is contained in:
parent
4132b41470
commit
3ed73e16b6
1 changed files with 20 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
|||
# include <Scripting/scriptmgr.hxx>
|
||||
#endif
|
||||
#include <Scripting/NasalSys.hxx>
|
||||
#include <Sound/fg_fx.hxx>
|
||||
#include <Time/sunsolver.hxx>
|
||||
#include <Time/tmp.hxx>
|
||||
|
||||
|
@ -1143,6 +1144,24 @@ do_gui_redraw (const SGPropertyNode * arg)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Built-in command: play an audio message (i.e. a wav file) This is
|
||||
* fire and forget. Call this once per message and it will get dumped
|
||||
* into a queue. Messages are played sequentially so they do not
|
||||
* overlap.
|
||||
*/
|
||||
static bool
|
||||
do_play_audio_message (const SGPropertyNode * arg)
|
||||
{
|
||||
FGFX *fx = (FGFX *)globals->get_subsystem("fx");
|
||||
string path = arg->getStringValue("path");
|
||||
string file = arg->getStringValue("file");
|
||||
cout << "playing " << path << " / " << file << endl;
|
||||
fx->play_message( path, file );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Built-in command: commit presets (read from in /sim/presets/)
|
||||
*/
|
||||
|
@ -1383,6 +1402,7 @@ static struct {
|
|||
{ "dialog-update", do_dialog_update },
|
||||
{ "dialog-apply", do_dialog_apply },
|
||||
{ "gui-redraw", do_gui_redraw },
|
||||
{ "play-audio-message", do_play_audio_message },
|
||||
{ "presets-commit", do_presets_commit },
|
||||
{ "log-level", do_log_level },
|
||||
{ "replay", do_replay },
|
||||
|
|
Loading…
Add table
Reference in a new issue