I've just forgotten to activate recording and playing sound in the android emulator... sorry.
But now, i can't get no sound.
Can you help me ?
This is my source code :
But now, i can't get no sound.
Can you help me ?
This is my source code :
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim TurnOn As AudioRecorder
Dim Value As Int
Dim maxi As Int
Dim maxstr As StringBuilder
Dim MediaPlayer1 As MediaPlayer
Dim cpt As Int
Dim sd As StringBuilder
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 On As Button
Dim Off As Button
Dim Clear As Button
Dim quit As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
MediaPlayer1.Initialize
activity.LoadLayout("l1")
maxi=0
cpt=1
sd.Initialize
If File.ExternalWritable Then
sd.Append(File.DirDefaultExternal)
Else
Msgbox("No SDCARD access !","Error")
ExitApplication
End If
Do While cpt<=1000 AND maxi=0
maxstr.Initialize
maxstr.Append("mikemy")
maxstr.Append(cpt)
If File.Exists(sd,maxstr)=False Then
maxi=cpt-1
End If
cpt=cpt+1
Loop
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub On_Click
Dim MP3 As Int
If maxi<1000 AND TurnOn.state=0 Then
If MediaPlayer1.IsPlaying=True Then MediaPlayer1.Stop
maxi=maxi+1
maxstr.Initialize
maxstr.Append(sd)
maxstr.Append("/mikemy")
maxstr.Append(maxi)
TurnOn.startRecording(MP3,".mp3",maxstr)
End If
End Sub
Sub Off_Click
If maxi>0 Then
If TurnOn.state=1 Then
TurnOn.stopRecording
TurnOn.startPlayback
Value=Rnd(1,maxi)
maxstr.Initialize
maxstr.Append("mikemy")
maxstr.Append(Value)
maxstr.Append(".mp3")
'MediaPlayer1.Load(sd, maxstr)
'MediaPlayer1.Play
End If
End If
End Sub
Sub quit_Click
ExitApplication
End Sub
Sub Clear_Click
For i=1 To 1000
maxstr.Initialize
maxstr.Append("mikemy")
maxstr.Append(i)
maxstr.Append(".mp3")
If File.Exists(sd,maxstr)=True Then File.Delete(File.DirRootExternal,maxstr)
Next
End Sub