Music Player
Posted: Fri Jan 08, 2016 10:40 pm
I have created a music player. I will change its name and track names later.
I hope to develop this as an app and sell it in the app store.
Can you tell me if this code is any good? Will it work on all iphones and iPads?
The idea is that when a user presses a track it deletes the current music, loads the new music and plays it.
This is the first time I have ever programmed anything in my life.
I hope to develop this as an app and sell it in the app store.
Can you tell me if this code is any good? Will it work on all iphones and iPads?
Code: Select all
SET UNDERGROUND ON
SET ORIENTATION PORTRAIT
SET TOOLBAR OFF
SET OUTPUT BACK COLOR 0,0,0
SET OUTPUT FONT SIZE 32
SET OUTPUT FONT COLOR 0,0,1
SET BUTTONS FONT SIZE 24
DRAW COLOR 1,1,0
FILL COLOR 0,0,0
FILL AlPHA 0
SET BUTTONS CUSTOM
p=0
PRINT "Music Volume 1"
BUTTON "1" TEXT "Track 1" AT 30, 100
BUTTON "2" TEXT "Track 2" AT 30, 200
BUTTON "3" TEXT "Track 3" AT 30, 300
BUTTON "4" TEXT "Track 4" AT 30, 400
BUTTON "5" TEXT "Track 5" AT 30, 500
BUTTON "6" TEXT "Stop" AT 30, 700
LOOP:
IF BUTTON_PRESSED("1") THEN
IF p=1 THEN
MUSIC 1 STOP
MUSIC 1 DELETE
END IF
MUSIC 1 LOAD "files/musictrack1.wav"
MUSIC 1 PLAY
p=1
END IF
IF BUTTON_PRESSED("2") THEN
IF p=1 THEN
MUSIC 1 STOP
MUSIC 1 DELETE
END IF
MUSIC 1 LOAD "files/musictrack2.wav"
MUSIC 1 PLAY
p=1
END IF
IF BUTTON_PRESSED("3") THEN
IF p=1 THEN
MUSIC 1 STOP
MUSIC 1 DELETE
END IF
MUSIC 1 LOAD "files/musictrack3.wav"
MUSIC 1 PLAY
p=1
END IF
IF BUTTON_PRESSED("4") THEN
IF p=1 THEN
MUSIC 1 STOP
MUSIC 1 DELETE
END IF
MUSIC 1 LOAD "files/musictrack4.wav"
MUSIC 1 PLAY
p=1
END IF
IF BUTTON_PRESSED("5") THEN
IF p=1 THEN
MUSIC 1 STOP
MUSIC 1 DELETE
END IF
MUSIC 1 LOAD "files/musictrack5.wav"
MUSIC 1 PLAY
p=1
END IF
IF BUTTON_PRESSED("6") THEN
IF p=1 THEN
MUSIC 1 STOP
MUSIC 1 DELETE
END IF
p=0
END IF
GOTO LOOP
The idea is that when a user presses a track it deletes the current music, loads the new music and plays it.
This is the first time I have ever programmed anything in my life.