Skip to: Site menu | Main content

### Welcome to PSP-Programming.com, a place for developers to get together.

Welcome to the forums. Here you can find other user tutorials as well as homebrew releases and the source code repository. You can also ask for help with your code here and post your own homebrew!

PSP-Programming.com Forums |

October 09, 2007, 12:25:00 PM
Welcome, Guest. Please login or register. Did you miss your activation email? Login with username, password and session length |

News: Check out the Code Section! |

|  | Home |  | Help | Search | Shop | Login | Register |

Pages: [1] |
| Print |

| Author | Topic: Few questions about LUA (Read 187 times)

masterMIND Newbie Karma: +0/-0 Offline Posts: 7 468.46 points View Inventory Send Money to masterMIND |
| Few questions about LUA « on: August 09, 2007, 02:44:52 AM » |
Hi everyone, I started programming in LUA (I'm programming in C++ too, but I have had many problems whit cygwin so I took LUA for PSP programming) and I have some questions: 1. Is C++ far more better than LUA (in PSP programming) 2. Can I create EBOOT in LUA (if I can, how) 3. Please can you tell me program wich converts most common music files to .xm 4. Can I load my mp3 files in LUA and build mp3 player (do I need for mp3 smth as libraries in C++)
« Last Edit: August 09, 2007, 02:51:25 AM by masterMIND » | Logged
michaelp Jr. Member Karma: +2/-28 Offline Posts: 95 39.90 points View Inventory Send Money to michaelp |
| Re: Few questions about LUA « Reply #1 on: August 09, 2007, 07:39:40 AM » |
1. Better in the way that C++ is more powerful, and can do more than LUA can. By powerful, I mean faster, and probably more image and sound formats. 2. Yes. Download LUAPlayer for the PSP (whatever version you want) Inside the "luaplayer" folder, delete everything in it expect the "System folder". (So delete applications folder, and whatever else is in there.) Put the file that you want to be ran in the luaplayer folder, and rename "index.lua". (Assuming it isn't already named that.) Now use it like normal homebrew. 3. I don't know. 4. Yes you can load Mp3 files in LUA using the version of luaplayer: Lua Player mod 4 You will find the mp3 functions on the page, and the downloads at the bottom.
| Logged
WIP tic-tac-toe http://www.psp-programming.com/forums/index.php?topic=2496.0
masterMIND Newbie Karma: +0/-0 Offline Posts: 7 468.46 points View Inventory Send Money to masterMIND |
| Re: Few questions about LUA « Reply #2 on: August 09, 2007, 09:06:25 AM » |
Thank you very much,you have helped me much.
| Logged
Soulkiller Hero Member Karma: +77/-5 Offline Posts: 1151 83.50 points View Inventory Send Money to Soulkiller |
| Re: Few questions about LUA « Reply #3 on: August 09, 2007, 09:16:56 AM » |
1. Depends what you mean by powerful. C is more powerful in the fact that it executes a lot faster than Lua. Lua is more powerful in the fact that its more forgiving and lets you write a lot less then it would take to write a C equivalent. 2.yes Step by Step instructions: http://luaplayer.org/forums/index.php?topic=18.0 3. XM is a MOD type format of music, meaning that is comprised of playing smaller "samples" at different frequencies at certain times and with different effects. This is not how conventional music formats play like mp3, wav, ogg, etc. Therefore their is no converter to convert conventional music to MOD type music, but you can convert MOD type music to conventional. If you want you could mickey-mouse it and just have the MOD music play a long sample thats really just conventional music but I wouldn't recommend it if you like huge file sizes that would probably never load into Luaplayer anyway. If you would like to make your own MOD music then you need a tracker. I would recommend this one Mod Plug Tracker 4.Their are custom versions of Luaplayer that added support for it like Cools mod 4, you can find it here Lua Player cools mod 4 Their is no need to link different libs into Lua code like you have to in C
| Logged
masterMIND Newbie Karma: +0/-0 Offline Posts: 7 468.46 points View Inventory Send Money to masterMIND |
| Re: Few questions about LUA « Reply #4 on: August 09, 2007, 10:27:05 AM » |
Tnx,very much by question is C++ more powerful than LUA I wanted to ask can I do more things and more complex code in C++ . I have one more question: Can you tell me why do i get error on this line: Code:
    ff7=Mp3.load("music/ff7.mp3")
| Logged
BoBo124 Newbie Karma: +2/-0 Offline Posts: 22 1072.38 points View Inventory Send Money to BoBo124 |
| Re: Few questions about LUA « Reply #5 on: August 09, 2007, 10:46:05 AM » |
Make sure the path to the file is correct. Also, if you have capitals in the folder/file names, include them (not sure if that will make a difference, but worth a shot). Also, you could be missing something like a ")" on the line before, in that case it would give the error on the next line. It would help if we knew the error.
| Logged
michaelp Jr. Member Karma: +2/-28 Offline Posts: 95 39.90 points View Inventory Send Money to michaelp |
| Re: Few questions about LUA « Reply #6 on: August 09, 2007, 10:48:02 AM » |
This one gave me a thought too when I first used it. You don't actually assign a variable to the Mp3. You can only load one. Use it like this: Code:
    Mp3.load("music/filename.mp3")
    Mp3.play()
When you use Mp3.play(), it will just play the Mp3 that you loaded.
| Logged
WIP tic-tac-toe http://www.psp-programming.com/forums/index.php?topic=2496.0
masterMIND Newbie Karma: +0/-0 Offline Posts: 7 468.46 points View Inventory Send Money to masterMIND |
| Re: Few questions about LUA « Reply #7 on: August 09, 2007, 11:02:44 AM » |
Tnx,problem solved Can I load more MP3 files and when I press X player will play first song, if I press O player will play second song.. I've tried whit this: Code:
    ff7=Mp3.load("music/ff7.mp3")
    sw=Mp3.load("music/sw.mp3")
    sw=Mp3.load("music/sw1.mp3")
    while true do

              screen:blit(0, 0, background, false)
              pad = Controls.read()
    if pad:right() then
                        screen:blit(90, 65, right)
                        screen:print(160, 150,"ONE WINGED ANGEL",black)
                        screen.flip()
                        screen.waitVblankStart(240)
                        Mp3.play(ff7)
              end

              if pad:down() then
                        screen:blit(60, 80, down)
                        screen.flip()
              end

              if pad:left() then
                        screen:blit(30, 65, left)
                        screen.flip()
                        Mp3.stop()
              end

              if pad:l() then
                        screen:blit(4, 6, l)
                        screen.flip()
                        Mp3.play(sw)
              end

              if pad:r() then
                        screen:blit(403, 4, r)
                        screen.flip()
                        Mp3.play(swi)
              end
    end
but this didn't work.
| Logged
BoBo124 Newbie Karma: +2/-0 Offline Posts: 22 1072.38 points View Inventory Send Money to BoBo124 |
| Re: Few questions about LUA « Reply #8 on: August 09, 2007, 01:38:13 PM » |
You can try this Code:
    while true do

       pad = Controls.read()

       if pad:right then
          Mp3.stop()
          Mp3.load("music/ff1.mp3")
          Mp3.play()
       end

       if pad:l() then
          Mp3.stop()
          Mp3.load("music/sw.mp3")
          Mp3.play()
       end

       if pad:r() then
          Mp3.stop()
          Mp3.load("music/swi")
          Mp3.play()
       end

       if pad:start() then
          break
       end

    end
I haven't used the MP3 plugin, but by what I've read, you can only have one MP3 loaded at a time. And when you use Mp3.stop() it delets the MP3 from memory, so you have to load it again, or load another. Also, I don't know if this will work or not, it only took me about a minute.
| Logged
masterMIND Newbie Karma: +0/-0 Offline Posts: 7 468.46 points View Inventory Send Money to masterMIND |
| Re: Few questions about LUA « Reply #9 on: August 09, 2007, 02:57:24 PM » |
Thanks it worked, thank you all for help, and sorry for bothering
| Logged

Pages: [1] |
| Print |

Jump to:

| Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC |

Page created in 0.694 seconds with 33 queries.
Loading...