Jump to content

[SOLVED] - CreateSource sound


AggrorJorn
 Share

Recommended Posts

I'm trying to get Create, Play and Stop Source to work in Lua. Who can tell me what I am doing wrong here? Using this results in crashing the engine.

ambient=LoadSound("abstract::ambient.ogg")
test =CreateSource(ambient,SOURCE_LOOP)

-- a part of the MAIN LOOP
if KeyHit(KEY_E)==1 then
	PlaySource(test)
end

if KeyHit(KEY_F)==1 then
	StopSource(test)
end

Link to comment
Share on other sites

good thing you got it working, but what do you mean by SOURCE_LOOP has to be 1?

 

he means with the code he showed, this line:

test =CreateSource(ambient,SOURCE_LOOP)

needs to be this:

test =CreateSource(ambient,1)

but if he added this to the top of his script:

require("Scripts/constants/engine_const")

he could have left it as SOURCE_LOOP, because SOURCE_LOOP is defined as 1 in that script... or he could have just made his own script that had that defined in it... or he could have just defined SOURCE_LOOP=1 in his script :unsure:

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...