LUA Orbiter sound controlled by LUA

Thanatox

New member
Joined
Mar 2, 2011
Messages
10
Reaction score
0
Points
1
Hey everyone. I am working on some mission scripts for orbiter and I would love to invoke orbiter sound to play radio instructions from mission control at various points during the scenario.

These would be based on events rather than timing so I can't really use the time based utility that comes with orbiter sound.

I'm currently looking into playing the sounds directly from LUA using the audio library but that seems... shall we say ... inelegant.

Is there any known way to play sound files based on events?

Thanks in advance.
 
Hey everyone. I am working on some mission scripts for orbiter and I would love to invoke orbiter sound to play radio instructions from mission control at various points during the scenario.

These would be based on events rather than timing so I can't really use the time based utility that comes with orbiter sound.

I'm currently looking into playing the sounds directly from LUA using the audio library but that seems... shall we say ... inelegant.

Is there any known way to play sound files based on events?

Thanks in advance.
Read this post,it's about ProaudioRT,that should do the trick,this addon uses it for sound within LUA script. http://orbiter-forum.com/showthread.php?p=429917&postcount=8
 
Read this post,it's about ProaudioRT,that should do the trick,this addon uses it for sound within LUA script. http://orbiter-forum.com/showthread....17&postcount=8

That worked Thanks! :thumbup:

For posterity's sake here is what I wound up with:

I copied proAudioRt.dll, lua51.dll and the folder proteaAudio_lua_090204 from the addon by dgatsoulis to my orbiter folder.

then I modified a scenario to run soundtest.lua on startup.

soundtest.lua:
Code:
require "proAudioRt"
if not proAudio.create() then os.exit(1) end

intro = 'Testing sound playing \n This is a test of proAudio \n a sound should play after 10 seconds'
note = oapi.create_annotation()
testAudio = proAudio.sampleFromFile("Sound/SIREN.ogg")

note:set_pos (0.3, 0.05, 0.9, 0.95)
note:set_colour ({r=.2, g = 0.9, b = 0.2})
note:set_text (intro)

function wait(dt)
	t0 = oapi.get_simtime()
	t1 = oapi.get_simtime()
	while t1-t0 < dt do
		t1 = oapi.get_simtime()
		proc.skip()
	end
end


wait(10)
proAudio.soundPlay( testAudio )

Here is the sound I used but any sound will do. :cheers:
View attachment SIREN.zip
 
Back
Top