Please set your own sound file in a_setPlayData().
This sample song is from "Muff&Huff" by MankaiSeisakusho(freely available).
// audio test // Write your own sound file name // This sample music from "Muff&Huff" by MankaiSeisakusho. int sno=a_setPlayData("EARTH SONG #1.mp3") if (sno=-2) then { print "sound file not found." end } int wx // dim int touchNo(10) :// touch area number int touchCnt :// the number of touch area font("IPAGothic") int fzenhan int WX=64:if deviceType()<>1 then WX=48 int WY=width(WX,,fzenhan) int xw=1 if fzenhan then xw=2 str exit$ if isLocalizeJapan() then { exit$="中断" } else { exit$="exit" } int x=WX/2-18 int y=WY/2 // 012345678901234567890123456789 locate(x,y+0):print " ┏━┓" locate(x,y+1):print " ┃8┃" locate(x,y+2):print " ┗━┛" locate(x,y+3):print "┏━┓┏━┓┏━┓ ┏━━┓" locate(x,y+4):print "┃4┃┃?┃┃6┃ ┃";exit$;"┃" locate(x,y+5):print "┗━┛┗━┛┗━┛ ┗━━┛" locate(x,y+6):print " ┏━┓" locate(x,y+7):print " ┃2┃" locate(x,y+8):print " ┗━┛" int i=0 touchNo(inc(i))=setTouchArea(textX2Gx(x+ 6),textY2Gy(y ),textX2Gx(xw*3),textY2Gy(3),'8',YES, 0,50,55,220) touchNo(inc(i))=setTouchArea(textX2Gx(x+ 6),textY2Gy(y+6),textX2Gx(xw*3),textY2Gy(3),'2',YES, 0,50,55,220) touchNo(inc(i))=setTouchArea(textX2Gx(x ),textY2Gy(y+3),textX2Gx(xw*3),textY2Gy(3),'4',YES, 0,50,55,220) touchNo(inc(i))=setTouchArea(textX2Gx(x+12),textY2Gy(y+3),textX2Gx(xw*3),textY2Gy(3),'6',YES, 0,50,55,220) // touchNo(inc(i))=setTouchArea(textX2Gx(x+ 6),textY2Gy(y+3),textX2Gx(xw*3),textY2Gy(3),'?',YES,150,50, 5,120) touchNo(inc(i))=setTouchArea(textX2Gx(x+22),textY2Gy(y+3),textX2Gx(xw*4),textY2Gy(3),'!',YES,150, 5 ,5,120) touchCnt=i // keyRepeatTime(0,0):// repeat none // setFunctionKey(0,exit$,'!') setFunctionKey(1,"V-UP",'u') setFunctionKey(2,"V-DN",'d') setFunctionKey(3,"SPD",'S') setFunctionKey(4,"LP=1",'1') setFunctionKey(5,"LP∞" ,'0') setFunctionKey(6,"LP=2",'2') setFunctionKey(7,"PAN",'c') setFunctionKey(8,"stop",'s') setFunctionKey(9,"cont",'C') setFunctionKeyBackgroundImage("funcBack.png") displayFunctionKeyAll(YES) int speed=0 int pan=0 str cs int dt=0,t int ts=time():/* start time locate(20,1) a_play(sno) while YES // while a_stat(sno) // timer count until key input while (not kbhit()) /* キー入力の無い間 t=time() if t-ts>dt then { :/* change second dt=dt+1 locate(20,0):print dt; beep2(0) locate(20,1) } endwhile // key operation cs=inkey$() switch cs case "u":a_volume(sno,1.0):break case "d":a_volume(sno,0.05):break case "S": switch speed case 0:a_speed(sno,2.0):break case 1:a_speed(sno,0.5):break case 2:a_speed(sno,1.0):break endswitch speed=speed+1 break case "1": a_loop(sno,1):print "loop=1" break case "2": a_loop(sno,2):print "loop=2" break case "0": a_loop(sno,0):print "loop=∞" break case "c": switch pan case 0:a_pan(sno,-1.0):inc(pan):break case 1:a_pan(sno, 0.0):inc(pan):break case 2:a_pan(sno, 1.0):pan=0:break endswitch break case "r" break case "s":a_stop(sno):break case "C":a_cont(sno):break endswitch print cs; if cs="!" then break endwhile a_end(sno) print "end" end func resetTouchArea() // remove touch area int i for i=0 to touchCnt removeTouchArea(touchNo(i)) next touchCnt=0 endfuncZip file including sample sound file is here : XBaudioTest.zip
No comments:
Post a Comment