Music Player တခု ေရးၾကမယ္
သီခ်င္း ၁၀ ပုဒ္ပါတဲ့ Music Player တခု ေရးပါမယ္။ ကိုယ္ထည့္မဲ့ music file ေတြကို ရိုးရွင္းတဲ့ english name ေျပာင္းထားပါ။ ၿပီးရင္ BMP AddFiles ကေန add လုပ္ထားပါ။ အခု နမူနာမွာေတာ့ music1.mp3 ... music10.mp3 ျဖစ္ပါတယ္။ music ဖိုင္ကို ေရြးခ်ယ္ဖို႔ listView ကို သံုးပါမယ္။ play, pause, stop အတြက္ button ၃ခု သံုးထားပါတယ္။ listView မွာ သီခ်င္း ေရြးလိုက္ရင္၊ play/pause/stop ႏွိပ္ရင္ ထိပ္ဆံုးက label မွာ info display လုပ္မွာပါ။
Version 2.0 မွာ တပုဒ္ခ်င္း ပဲ play လုပ္ႏိုင္ပါဦးမယ္။ version 2.1 က်မွ playlist ကို ဆက္တိုက္ play ႏိုင္မွာပါ။
=============
Views Panel
=============
AddLabel("lbl1",0,97,719,225,"")
SetText("lbl1","music1.mp3 : Stopped")
AddListView("lv1",0,340,720,628,"")
AddButton("btn1",19,988,210,118,"")
SetText("btn1","Play")
AddButton("btn2",268,990,212,114,"")
SetText("btn2","Pause")
AddButton("btn3",506,991,203,111,"")
SetText("btn3","Stop")
FileCopy(DirAssets,"music1.mp3",DirStorage,"music1.mp3")
Add("lv1","music1.mp3")
FileCopy(DirAssets,"music2.mp3",DirStorage,"music2.mp3")
Add("lv1","music2.mp3")
FileCopy(DirAssets,"music3.mp3",DirStorage,"music3.mp3")
Add("lv1","music3.mp3")
FileCopy(DirAssets,"music4.mp3",DirStorage,"music4.mp3")
Add("lv1","music4.mp3")
FileCopy(DirAssets,"music5.mp3",DirStorage,"music5.mp3")
Add("lv1","music5.mp3")
FileCopy(DirAssets,"music6.mp3",DirStorage,"music6.mp3")
Add("lv1","music6.mp3")
FileCopy(DirAssets,"music7.mp3",DirStorage,"music7.mp3")
Add("lv1","music7.mp3")
FileCopy(DirAssets,"music8.mp3",DirStorage,"music8.mp3")
Add("lv1","music8.mp3")
FileCopy(DirAssets,"music9.mp3",DirStorage,"music9.mp3")
Add("lv1","music9.mp3")
FileCopy(DirAssets,"music10.mp3",DirStorage,"music10.mp3")
Add("lv1","music10.mp3")
LoadAudioFile(DirStorage,"music1.mp3")
song="music1.mp3"
============
Events Panel
============
Sub Activity_Pause(UserClosed)
pauseaudio
SetText("lbl1",song & " : Paused")
End Sub
Sub Activity_Resume
End Sub
Sub ListView_ItemClick(who, pos, value)
stopaudio
song=value
LoadAudioFile(DirStorage,song)
SetText("lbl1",song & " : Playing")
playaudio
End Sub
Sub Button_Click(Who)
select who
case "btn1"
playaudio
SetText("lbl1",song & " : Playing ...")
case "btn2"
pauseaudio
SetText("lbl1",song & " : Paused")
case "btn3"
SetText("lbl1",song & " : Stopped")
stopaudio
end select
End Sub
==============
ေက်းဇူးတင္ပါတယ္အကို music ကို name ေလးနဲ႔လုပ္လို႔ရရင္ပိုေကာင္းမယ္...
ReplyDelete