![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
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 ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
![]() |
....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
|
|
|
|
|
|
#2 | |
![]() ![]() Developer
|
I don't know Lua but...
This part seems illogical: Code:
local sound = menuScrollSound voice = sound:play() Code:
menuScrollSound:play()
__________________
![]() Check out my homebrew & C tutorials at http://insomniac.0x89.org/ Coder formerly known as Insomniac197 Quote:
|
|
|
|
|
|
|
#3 |
![]() ![]() total-Z
|
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 |
|
|
|
|
|
#4 |
![]() ![]() Developer in Making...
|
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?
__________________
NEWMy New BLOG!NEW The Wentire Worls in two Sectors.... When did I get dev statz?Spoiler for my PSP homebrewReleases:
Spoiler for Great Quotes:
|
|
|
|
|
|
#5 |
![]() |
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. |
|
|
|
|
|
#6 |
![]() ![]() Developer
|
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. |
|
|
|
![]() |
| Tags |
| crazy , lags , luamusic , memory |
| Thread Tools | |
|
|