QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

[Lua]Music lags like crazy! Is too much memory being used??

This is a discussion on [Lua]Music lags like crazy! Is too much memory being used?? within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; ....Alrighty.....once again let me ask a question that only a complete nub cake would and hopefully you'll humor me and ...

Reply
 
LinkBack Thread Tools
Old 02-12-2007, 07:18 PM   #1
 
Join Date: Jul 2006
Location: Under your bed..
Posts: 227
Trader Feedback: 0
Default [Lua]Music lags like crazy! Is too much memory being used??

....Alrighty.....once again let me ask a question that only a complete nub cake would and hopefully you'll humor me and answer it lol! Okay now my problem is that the .wav file I'm trying to load lags no matter what! It could be a 5 kb file or a 90 kb file and it will be all staticy (<--- did I spell that right?) and it will sound like someone is someone is choking to death....even if no one is singing....the two songs I tried to load were the 300 bars and runnin instrumental version (around 10 kb..I clipped it down quite a bit), which sounded like fingernails on a chalk board! And I also tried Cobrastyle by the Teddybears and it sounded like the guy was choking to death (around 90 kb..no clipping)....my .wav files were all PCM mono 16 kb files and they were encoded in Goldwave Audio Editor...oh btw...if you're gonna try to help I just want to mention first that I am using cools newest Lua mod which is capable of loading Mp3 files and Ogg files and I had even worse luck with them....

okay...well thanks for your time guys....here's my code

Code:
-- **PRELOAD** --
font0 = Font.load("System/font0.ttf")
font0:setPixelSizes(14,18)
screen:fontPrint(font0,365,245, "Now Loading...", Color.new(253,173,33))
screen.flip( )
screen.waitVblankStart( )

-- **ITEMS TO LOAD** --
font1 = Font.load("System/font1.ttf")
alphaValue = 255
blackfader = Image.createEmpty(480,272)
blackfaderColor = Color.new(0,0,0,alphaValue)
blackfader:clear(blackfaderColor)
selector = { image = Image.createEmpty(85,25), x = 195,y = 117 }
selector.image:clear(Color.new(90,0,0))
menuScrollSound = Sound.load("Music/Sounds/sound0.wav",false)
screen:clear( )

-- **MAIN LOOP** --
-- fade in "Brought to you by.." text then fade it out again
while true do
screen:clear( )
font0:setPixelSizes(20,24)
screen:fontPrint(font1, 155, 135, "Brought to you by",Color.new(255,255,255)) -- write "Brought to you by.." to screen using font0
screen:blit(0,0,blackfader)
if alphaValue > 0 then
alphaValue = alphaValue - 5
else
break
end
blackfaderColor = Color.new(0,0,0,alphaValue)
blackfader:clear(blackfaderColor)
screen.waitVblankStart( )
screen.flip( )
end
screen.waitVblankStart(100)
while true do
screen:clear( )
font1:setPixelSizes(20,24)
screen:fontPrint(font1, 155, 135, "Brought to you by",Color.new(255,255,255))
screen:blit(0,0,blackfader)
if alphaValue < 255 then
alphaValue = alphaValue + 5
else
break
end
blackfaderColor = Color.new(0,0,0,alphaValue)
blackfader:clear(blackfaderColor)
screen.waitVblankStart( )
screen.flip( )
end

-- fade in "maker_logo" logo then fade it out again
while true do
screen:clear( )
screen:blit(0,0,Image.load("Images/maker_logo.png"))
screen:blit(0,0,blackfader) -- create black fader
if alphaValue > 0 then
alphaValue = alphaValue - 5
else
break
end
blackfaderColor = Color.new(0,0,0,alphaValue)
blackfader:clear(blackfaderColor)
screen.waitVblankStart( )
screen.flip( )
end
screen.waitVblankStart(100)
while true do
screen:clear( )
screen:blit(0,0,Image.load("Images/maker_logo.png"))
screen:blit(0,0,blackfader)
if alphaValue < 255 then
alphaValue = alphaValue + 5
else
break
end
blackfaderColor = Color.new(0,0,0,alphaValue)
blackfader:clear(blackfaderColor)
screen.waitVblankStart( )
screen.flip( )
end

--define gamestate
gamestate = "menu"

function createMenu( )
pad = Controls.read( )
screen:clear(Color.new(255,255,255))
screen:blit(selector.x,selector.y,selector.image)
font1:setPixelSizes(34,38)
font0:setPixelSizes(11,15)
screen:fontPrint(font1, 112, 65, "Header",Color.new(0,0,0))
screen:fontPrint(font0, 215, 135, "Text",Color.new(0,0,0))
screen:fontPrint(font0, 215, 160, "Text",Color.new(0,0,0))
screen:fontPrint(font0, 215, 185, "Text",Color.new(0,0,0))
screen:fontPrint(font0, 215, 210, "Text",Color.new(0,0,0))
screen:fontPrint(font0, 215, 235, "Text",Color.new(0,0,0))
if pad:down( ) and selector.y < 217 then
selector.y = selector.y + 25
local sound = menuScrollSound
voice = sound:play()
end
if pad:up( ) and selector.y > 117 then
selector.y = selector.y - 25
local sound = menuScrollSound
voice = sound:play()
end
end

while true do
if gamestate == "menu" then
createMenu( )
screen.flip( )
screen.waitVblankStart( )
oldpad = pad
end
end
ArchAngel214 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-12-2007, 08:12 PM   #2

Developer
 
Join Date: Mar 2006
Posts: 1,026
Trader Feedback: 0
Default

I don't know Lua but...

This part seems illogical:

Code:
local sound = menuScrollSound
voice = sound:play()
Surely it should be something like:

Code:
menuScrollSound:play()
Maybe?
__________________

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197

Quote:
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
Insert_Witty_Name is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-12-2007, 08:27 PM   #3

total-Z
 
youresam's Avatar
 
Join Date: Jul 2005
Location: texas
Posts: 2,803
Trader Feedback: 0
Default

Its not memory thats the issue, its CPU. It is very hard to get sound playing smoothly, especially when you dont know enough lua to fully optimize your code. Try to smoothen out your code, maybe sprinkling in a few System.sleep(1)'s
__________________
牧来栠摩琠敨映汩獥
PSN: youresam
From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
youresam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-12-2007, 11:20 PM   #4

Developer in Making...
 
BlackShark's Avatar
 
Join Date: Oct 2006
Location: Pimp'en in the US F#cking A!!!
Posts: 1,254
Trader Feedback: 0
Default

its all the fonts you are loading, I have the same problem when playing MP3's.
also what does the System.sleep() do exactly Youresam?
__________________
The Wentire Worls in two Sectors....
When did I get dev statz?
Spoiler for my PSP homebrewReleases:
Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
(PvP Pong DL'ed well over 2403 times combined! get yours now!)
Spoiler for Great Quotes:

"No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.
BlackShark is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-13-2007, 02:02 AM   #5
 
gameo's Avatar
 
Join Date: Sep 2006
Location: Denmark
Posts: 664
Trader Feedback: 0
Default

The PSP can't handle playing an mp3/wav/ogg song while fading in and out.

Sorry m8, i wanted to do the same thing, but fading most be removed if you want to have music.
__________________
My PSP Projects:
[B]___________________[/B]
None.
gameo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-13-2007, 03:02 AM   #6

Developer
 
Raphael's Avatar
 
Join Date: Jan 2006
Location: Germany
Posts: 919
Trader Feedback: 0
Default

It's not that PSP isn't capable of doing it, it's LUA that isn't capable of doing it on PSP :P
__________________
Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.
Raphael is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-13-2007, 04:11 AM   #7
 
 
Join Date: Feb 2006
Location: Australia - A.C.T.
Posts: 1,519
Trader Feedback: 0
Default

ttf and music don't work togetter in lua.
__________________
[CENTER]
[SPOILER="LOL"]
[IMG]http://myextralife.com/strips/01-05-2007.jpg[/IMG]
[/SPOILER]
[/CENTER]
1337PSPer is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
crazy , lags , luamusic , memory

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 07:16 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us