Hi
I am trying to play two soundfiles simultaneously, but not able to play. the same code, if i use wav files, it works, but not in case of ogg files.
I am trying to play two soundfiles simultaneously, but not able to play. the same code, if i use wav files, it works, but not in case of ogg files.
B4X:
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 playID1,playID2,loadid1,loadid2 As Int
Dim sp As SoundPool
Private Panel1 As Panel
Private Button_forest As Button
sp.
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout1")
Panel1.SetLayout(0,0,100%x,100%y)
Button_forest.SetLayout(10dip,50dip,100%x-20dip,50dip)
sp.Initialize(5)
loadid1=sp.Load(File.DirAssets,"Bird_in_Rain-Mike_Koenig-441535833.ogg")
loadid2=sp.Load(File.DirAssets,"river.ogg")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button_forest_Click
playID1=sp.Play(loadid1,1, 1, 1, -1, 1)
playID2=sp.Play(loadid2,1, 1, 2, -1, 1)
End Sub