[0.3.1] music doesn't loop, question about issue tracker

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

[0.3.1] music doesn't loop, question about issue tracker

Post by qubodup »

love.audio.play(muzik, 0) is supposed to loop the music, right? It does not for me. It plays only once.

Debian Sid, LÖVE 0.3.1

Will there be an issue tracker? Or are we supposed to use this?
Attachments
musnoloop.love
function load()
noise = love.audio.newMusic("noise.ogg")
love.audio.play(noise, 0)
end
(262.14 KiB) Downloaded 325 times
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: [0.3.1] music doesn't loop, question about issue tracker

Post by rude »

Yeah, we really need to take a closer look at love.audio. It lacks lots of features and was hacked together way too quickly.

As for bug tracking, I suppose we could use that, yes.

Thanks for pointing out the bug! When fixed, we'll most likely change it to love.audio.play(muzak, love.loop_forever) or something similar.
User avatar
cag
Citizen
Posts: 65
Joined: Sun Jun 29, 2008 5:09 am

Re: [0.3.1] music doesn't loop, question about issue tracker

Post by cag »

It appears changing this:

Code: Select all

(Music.cpp)

void Music::play(int loop)
{
	Mix_PlayMusic(music, 0);
}
to this:

Code: Select all

void Music::play(int loop)
{
	if(loop) Mix_PlayMusic(music, 1);
	else Mix_PlayMusic(music, -1);
}
should work according to your current docs.

Then, you could define love.loop_forever in lua as the value false, and the love.loop_once as true.
Of course, it appears that you guys aren't too worried about backwards compatibility, so I would actually change it to this:

Code: Select all

void Music::play(int loop)
{
	Mix_PlayMusic(music, loop);
}
and define loop as a number where -1 is loop infinitely, and positive numbers are a finite number of times to loop, as per the SDL_mixer docs.

Of course, this is a relatively simple fix, so I imagine it's probably just waiting on the next minor numbered release, but... I really really really would love to have functional audio, as this means I don't have to go and actually write my own 2d lua-based game engine that I've been wanting to have.

Regards, hi, first post, yadayada.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: [0.3.1] music doesn't loop, question about issue tracker

Post by rude »

cag wrote:Of course, it appears that you guys aren't too worried about backwards compatibility
That's true. Not yet anyway.
cag wrote:I really really really would love to have functional audio, as this means I don't have to go and actually write my own 2d lua-based game engine that I've been wanting to have.
I can probably have 0.3.2 out in a few days with that fix if you really need it. Not sure if that qualifies for "functional audio" though. Bigger improvements to love.audio are planned too ... but will take longer.
cag wrote:Regards, hi, first post, yadayada.
lal.
Green_Hell
Citizen
Posts: 94
Joined: Thu Feb 21, 2008 1:11 am

Re: [0.3.1] music doesn't loop, question about issue tracker

Post by Green_Hell »

I have the same problem. I'm not sure that I get the point. :?

Is there any solution in 0.3.1 or should we wait for the next version?
>>I love LÖVE.<<
User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

Re: [0.3.1] music doesn't loop, question about issue tracker

Post by qubodup »

Green_Hell wrote:I have the same problem. I'm not sure that I get the point. :?

Is there any solution in 0.3.1 or should we wait for the next version?
In My Humble Opinion©, there is no clean solution, and one should be using the function the way it was meant to be used and wait for 0.3.1.
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: [0.3.1] music doesn't loop, question about issue tracker

Post by rude »

In fact, there was no workaround for 0.3.1, since the loop variable was never sent to SDL_mixer. 0 was always passed for Music objects.
User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

Re: [0.3.1] music doesn't loop, question about issue tracker

Post by qubodup »

the workaround was to make it a sound :p
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 8 guests