Music Player 2
Posted: Sat Mar 19, 2016 9:56 pm
This is the second version of my music player. I was going to give up but have decided to persevere. Thanks to everyone for their help. I want to create a music player that will look the same on EVERY iPhone and iPad regardless of screen resolution. Hopefully this updated code will work.
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
sw= SCREEN_WIDTH()
sh=SCREEN_HEIGHT()
PRINT "MUSIC"
BUTTON "1" TEXT "1" AT 0.24 * sw, 0.16 * sh
BUTTON "2" TEXT "2" AT 0.49 * sw, 0.16 * sh
BUTTON "3" TEXT "3" AT 0.74 * sw, 0.16 * sh
BUTTON "4" TEXT "4" AT 0.24 * sw, 0.32 * sh
BUTTON "5" TEXT "5" AT 0.49 * sw, 0.32 * sh
BUTTON "6" TEXT "6" AT 0.74 * sw, 0.32 * sh
BUTTON "7" TEXT "7" AT 0.24 * sw, 0.48 * sh
BUTTON "8" TEXT "8" AT 0.49 * sw, 0.48 * sh
BUTTON "9" TEXT "9" AT 0.74 * sw, 0.48 * sh
BUTTON "10" TEXT "10" AT 0.24 * sw, 0.64 * sh
BUTTON "11" TEXT "11" AT 0.49 * sw, 0.64 * sh
BUTTON "12" TEXT "12" AT 0.74 * sw, 0.64 * sh
BUTTON "13" TEXT "Stop" AT 0.47 * sw, 0.8 * sh
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/musictrack1.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/musictrack1.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/musictrack1.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/musictrack1.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
MUSIC 1 LOAD "files/musictrack1.wav"
MUSIC 1 PLAY
p=1
END IF
IF BUTTON_PRESSED("7") 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("8") 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("9") 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("10") 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("11") 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("12") 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("13") THEN
IF p=1 THEN
MUSIC 1 STOP
MUSIC 1 DELETE
END IF
p=0
END IF
GOTO LOOP