Jump to content

Music Playing


Sargeant12344
 Share

Recommended Posts

Put a pivot anywhere on your map, create a script, attach the script to the pivot you just created and copy & paste the code below.

 

Script.Music = "" --path "Music" "Waveform Audio File Format (*.wav):wav|Sound"

 

function Script:Start()

 

local music = Sound:Load(self.Music)

 

self.source = Source:Create()

self.source:SetSound(music)

self.source:SetLoopMode(true)

self.source:Play()

 

end

 

You should see something like this in the "Script" tab of the pivot you created.

71e41981bc24f456fb5660054cc237ad.png

So just set it to whatever you want and you're good to go ! biggrin.png

 

You could also add something like this ( in the updatephysics function ) to mute / unmute

db1daaaf1e09e3bd5b516ce9e3346dc3.png

Link to comment
Share on other sites

in c++ you load the sound file then....

 

 

source = Source::Create();

source->SetSound(sound);

source->SetLoopMode(true);

 

 

 

source->Play();

not too different in lua I think.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

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...