Dear all,
I'm using the impressing AdioTrack V. 1.03 by stevel05.
However, by trying to use the LoopStart and LoopEnd properties, it does not loop at all.
May be I didn't set something right. I use the flag MODE_STATIC for the Audiotrack, and set the looping points (start and end) after I call the play method of the audiotrack.
The file (a simple .wav file) is reproduced only once, and seems that the looping points are complete ignored.
Am I doing something wrong here ?
Any help would be greatly appreciated.
The code:
I'm using the impressing AdioTrack V. 1.03 by stevel05.
However, by trying to use the LoopStart and LoopEnd properties, it does not loop at all.
May be I didn't set something right. I use the flag MODE_STATIC for the Audiotrack, and set the looping points (start and end) after I call the play method of the audiotrack.
The file (a simple .wav file) is reproduced only once, and seems that the looping points are complete ignored.
Am I doing something wrong here ?
Any help would be greatly appreciated.
The code:
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
Dim AT As AudioTrack
Dim Ra As RandomAccessFile
'...
Dim BufferSize As Int
Dim SampleRate As Int
Dim ChannelConfig As Int
Dim AudioFormat As Int
Dim Buffer() As Byte
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
File.Copy(File.DirAssets,"1.wav",File.DirInternal,"1.wav")
Ra.Initialize2(File.DirInternal, "1.wav", True, True)
SampleRate=44100
ChannelConfig=AT.Ch_Conf_Stereo
AudioFormat=AT.Af_PCM_16
BufferSize=Ra.Size - 44 ' RIFF header size is 44 bytes
Dim Buffer(BufferSize) As Byte
AT.Initialize(AT.Stream_Music,SampleRate,ChannelConfig,AudioFormat,BufferSize,AT.MODE_STATIC)
Ra.ReadBytes(Buffer, 0, BufferSize, 44)
AT.WriteByte(Buffer, 0, BufferSize)
AT.Play
AT.SetLoopPoints(0, 500, 5)'must be called AFTER calling the .Play Method
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
xui.MsgboxAsync("Hello world!", "B4X")
End Sub
Last edited: