--vmp3 by mrafenne



mov1 = 0
mov2 = 0

color1 = Color.new(127,127,0)
color2 = Color.new(127,255,0)
color3 = Color.new(0,255,0)
color4 = Color.new(0,255,127)
color5 = Color.new(0,127,127)
color6 = Color.new(0,127,255)
color7 = Color.new(0,0,255)
color8 = Color.new(127,0,255)
color9 = Color.new(127,0,127)
color10 = Color.new(255,0,127)
color11 = Color.new(255,0,0)
color12 = Color.new(255,127,0)
color13 = Color.new(255,127,0)


function nomvis1()
mov2 = 0
if preiw == "fasle" and next == "fasle" then
if mov1 <= 251 and mov1 >= 0 then
mov1 = mov1 +8
end
end
end

function exitMenu()
color1 = nil
color2 = nil
color3 = nil
color4 = nil
color5 = nil
color6 = nil
color7 = nil
color8 = nil
color9 = nil
color10 = nil
color11 = nil
color12 = nil
color13 = nil
mov1 = nil
mov2 = nil
collectgarbage()
end


function drawCircle(x, y, r, color) 
if color==nil then color = Color.new(0, 0, 0) end 
pi = math.pi 
step = 2/(r*r*0.03) 
for i=0,2, step do 
a = x+r*math.cos(pi*i) 
b = y+r*math.sin(pi*i) 
screen:pixel(a, b, color) 
end 
end 


statut = "defaut"

while true do
screen:clear()

if pad:circle() then
statut = "affiche"
end

if statut == "affiche" then
nomvis1() 
screen:fillRect(40,mov1,400,1,white)
screen:fillRect(40,mov1,Mp3me.percent()*4,1,green)
screen:fontPrint(font,mov1+120,253,Mp3me.gettime(),green)
screen:fontPrint(font,mov1+120,270,Mp3me.songTime(),white)
screen:fontPrint(font,mov1-215,253,Mp3me.title(),white)
screen:fontPrint(font,mov1-215,270,Mp3me.album(),white)


end
if pad:square() then
statut = "defaut"
end

if Mp3me.vis(0) <= 120 then
r = 20
colorc = color1
end

if Mp3me.vis(0) <= 110 then
r = 30
colorc = color2
end

if Mp3me.vis(0) <= 100 then
r = 40
colorc = color3
end

if Mp3me.vis(0) <= 90 then
r = 50
colorc = color4
end

if Mp3me.vis(0) <= 80 then
r = 60
colorc = color5
end

if Mp3me.vis(0) <= 70 then
r = 70
colorc = color6
end

if Mp3me.vis(0) <= 60 then
r = 80
colorc = color7
end

if Mp3me.vis(0) <= 50 then
r = 90
colorc = color8
end

if Mp3me.vis(0) <= 40 then
r = 100
colorc = color9
end

if Mp3me.vis(0) <= 30 then
r = 110
colorc = color10
end

if Mp3me.vis(0) <= 20 then
r = 120
colorc = color11
end

if Mp3me.vis(10) <= 120 then
r1 = 20
colorc1 = color1
end

if Mp3me.vis(100) <= 110 then
r1 = 30
colorc1 = color2
end

if Mp3me.vis(100) <= 100 then
r1 = 40
colorc1 = color3
end

if Mp3me.vis(100) <= 90 then
r1 = 50
colorc1 = color4
end

if Mp3me.vis(100) <= 80 then
r1 = 60
colorc1 = color5
end

if Mp3me.vis(100) <= 70 then
r1 = 70
colorc1 = color6
end

if Mp3me.vis(100) <= 60 then
r1 = 80
colorc1 = color7
end

if Mp3me.vis(100) <= 50 then
r1 = 90
colorc1 = color8
end

if Mp3me.vis(100) <= 40 then
r1 = 100
colorc1 = color9
end

if Mp3me.vis(100) <= 30 then
r1 = 110
colorc1 = color10
end

if Mp3me.vis(100) <= 20 then
r1 = 120
colorc1 = color11
end

drawCircle(240,136,r-12, colorc)
drawCircle(240,136,r-9, colorc)
drawCircle(240,136,r-6, colorc)
drawCircle(240,136,r-3, colorc)
drawCircle(240,136,r, colorc)
drawCircle(240,136,r1, colorc1)
drawCircle(240,136,r1+3, colorc1)
drawCircle(240,136,r1+6, colorc1)
drawCircle(240,136,r1+9, colorc1)
drawCircle(240,136,r1+12, colorc1)


pad = Controls.read()

if pad:r() and not oldpad:r() then
if fbrowser.s < (fbrowser.nf + 1) then
i = fbrowser.s + 1
if i < (fbrowser.nf + 1) then
if string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".mp3" or
string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".MP3" then
fbrowser.s = fbrowser.s + 1
Mp3me.stop()
screen:clear()
Mp3me.load(fbrowser.fl[fbrowser.s].name)
Mp3me.play()
end
end
end
end

if pad:l() and not oldpad:l() then
if fbrowser.s < (fbrowser.nf + 1) and fbrowser.s > 2 then
i = fbrowser.s - 1
if i < (fbrowser.nf + 1) and i > 2 then
if string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".mp3" or
string.lower(string.sub(fbrowser.fl[i].name, -4)) == ".MP3" then
Mp3me.stop()
screen:clear()
fbrowser.s = fbrowser.s - 1
Mp3me.load(fbrowser.fl[fbrowser.s].name)
Mp3me.play()
end
end
end
end

if pad:cross() and not oldpad:cross() then
Mp3me.pause()
end

if pad:left() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/Ibis/vmp312.lua")
exitMenu()
end

if pad:right() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/Ibis/vmp314.lua")
exitMenu()
end

if pad:triangle() then
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/menu.lua")
end


if pad:start() then 
screen.waitVblankStart(50)
dofile("ms0:/PSP/GAME/vmp3 v1/script1.lua")
exitMenu()
end


screen.waitVblankStart()
screen.flip()
oldpad = pad
end


