Page 2 of 2

Re: Getting audio to work?

Posted: Thu Mar 29, 2012 11:57 am
by Petunien
If you renamed it easily how baconhawka7x said, try to convert the original .mp3 to .ogg with Super 2012 or another audio converter programm your choice.

I'm also a beginner, but if you want to set the audio function in a extern .lua file try it like this:

audio.lua:

Code: Select all

function playMusic()
       music = love.audio.newSource("hurricane.ogg")
       love.audio.setVolume(1.0)
       love.audio.play(music)
end
main.lua:

Code: Select all

require "audio"

function love.load()
       playMusic()
end

This will start the "playMusic" function in the audio.lua when the game starts.
Please correct me, if this is wrong or there are better solutions.

Re: Getting audio to work?

Posted: Thu Mar 29, 2012 2:42 pm
by tentus
I keep seeing this in this thread:

Code: Select all

require "audio.lua"
This is wrong and will not work in 0.8.0.

The right way to require files is thus:

Code: Select all

require "audio"

Re: Getting audio to work?

Posted: Thu Mar 29, 2012 3:06 pm
by Petunien
I changed it, thanks.
Some amendments in 0.8.0 are still unfamiliar. :)

@Thread creator

If you don't have experience with coding, these links will maybe help you to get familiar with lua:

http://www.lua.org/manual/5.1/
http://lua.lickert.net/index_en.html
http://www.youtube.com/user/DevHQLesson ... ?query=lua
http://lua.gts-stolberg.de/en/index.php

That helped me too.
:)

Re: Getting audio to work?

Posted: Thu Mar 29, 2012 3:51 pm
by Nixola
As far as I know, LÖVE still uses Lua 5.1, so the first link is http://www.lua.org/manual/5.1/

Re: Getting audio to work?

Posted: Thu Mar 29, 2012 7:47 pm
by rokit boy
I think it would be easier if you used an audiolib