Need some codeing advice

Jakey106

Member
Licensed User
Longtime User
Hey guys,
I have just joined up to the forum and i am a bit of a :sign0104: when it comes to coding and i am in need of some advice. At the moment i am learning as i go and i have created a button and when this button is clicked it plays a sound file, i have also added a stop button so i can stop the sound when i like, now both of the buttons are working fine, when i click play it plays and when i click stop it stops.
Now the sound file is only 30sec long so after 30sec it stops playing, what i want to do is to be able to keep the sound file playing continuously until i press the stop button, I was wondering if someone can give me some advice on how to make the sound file repeat itself after 30sec without any pause between the repeat. thanks, here is my code.

'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim btnplay As Button
Dim mp As MediaPlayer
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("mindexplosion")
mp.Initialize
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub



Sub btnplay_Click
mp.Load(File.DirAssets,"6000.wav")
mp.Play

End Sub

Sub btnstop_Click
mp.Stop
End Sub
 

mleffler

Member
Licensed User
Longtime User
Simplest way is to set

mp.looping = true

This will play the sound over and over.

If you want to get fancy then you would be looking at using a timer.
 
Upvote 0
Top