Page 1 of 1
Adding background music
Posted: Mon Dec 29, 2014 7:24 pm
by michaeladair
Basically I want to add some background music to my game.
I found:
Code: Select all
source = love.audio.newSource( file, type )
And
Do I just make it like this?
Code: Select all
music = love.audio.newSource( libs/gangstersparadise, mp3 )
love.audio.play( music )
Any help would be great, thank you.
Re: Adding background music
Posted: Mon Dec 29, 2014 7:29 pm
by s-ol
michaeladair wrote:Basically I want to add some background music to my game.
I found:
Code: Select all
source = love.audio.newSource( file, type )
And
Do I just make it like this?
Code: Select all
music = love.audio.newSource( libs/gangstersparadise, mp3 )
love.audio.play( music )
Any help would be great, thank you.
Code: Select all
music = love.audio.newSource( 'libs/gangster paradise.mp3', 'dynamic' )
music:setLooping( true ) --so it doesnt stop
music:play()
Re: Adding background music
Posted: Mon Dec 29, 2014 7:33 pm
by michaeladair
S0lll0s wrote:michaeladair wrote:Basically I want to add some background music to my game.
Any help would be great, thank you.
Code: Select all
music = love.audio.newSource( 'libs/gangster paradise.mp3', 'dynamic' )
music:setLooping( true ) --so it doesnt stop
music:play()
It says that dynamic is an invalid source type...
Re: Adding background music
Posted: Mon Dec 29, 2014 7:36 pm
by Doctory
don't do dynamic.
Re: Adding background music
Posted: Mon Dec 29, 2014 7:37 pm
by michaeladair
Doctory wrote:don't do dynamic.
Then what should I do instead of it? And should i have this code inside a function?
Re: Adding background music
Posted: Mon Dec 29, 2014 10:01 pm
by Evine
"stream" or "static" is a thing, "dynamic" is not.
https://www.love2d.org/wiki/SourceType
Code: Select all
music = love.audio.newSource( 'libs/gangster paradise.mp3', 'stream' )
music:setLooping( true ) --so it doesnt stop
music:play()
michaeladair wrote:And should i have this code inside a function?
Either in love.load() or not in a function. (Just don't put it in love.update or love.draw)
Re: Adding background music
Posted: Tue Dec 30, 2014 2:32 pm
by s-ol
Evine wrote:"stream" or "static" is a thing, "dynamic" is not.
https://www.love2d.org/wiki/SourceType
Code: Select all
music = love.audio.newSource( 'libs/gangster paradise.mp3', 'stream' )
music:setLooping( true ) --so it doesnt stop
music:play()
michaeladair wrote:And should i have this code inside a function?
Either in love.load() or not in a function. (Just don't put it in love.update or love.draw)
Whoops, my fault for not looking it up in the wiki again