Sound Playing

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
swordman
Posts: 27
Joined: Tue Dec 27, 2005 9:04 pm

Sound Playing

Post by swordman »

Hi all!
I've a problem. I'm trying to stop a program until the end of the current sound.
I want to
-update the screen
-play the sound
-update the screen

I can also update the screenduring playing but the sound ... blah
My current solution is

Code: Select all

--while a_sound:playing() do
DrawBackground()
screen:blit(px,py,a_image,0, 0, a_image:width(), a_image:height(), true)
screen.waitVblankStart()
screen.flip()
--end
a_sound:play()
.
.
update the screen
PS: if i try to enable the while i've an error "loog in gettable".
What does that mean?

Any Solutions???
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Re: Sound Playing

Post by Shine »

When you are calling "yourSound=Sound.load(...)" and then "yourSound.play()", you'll get a Voice object, on which you have to call playing:

Code: Select all

sound = Sound.load("test");
voice = sound:play();
while voice:playing()....
If this doesn't work, post a full small sample of your problem, which I can test.
swordman
Posts: 27
Joined: Tue Dec 27, 2005 9:04 pm

Post by swordman »

Thanks!!! now all function properly.
Thanks again!
Post Reply