iOS Question Imedia 1.2 - Audio Recording

maor_t

New Member
Licensed User
Longtime User
Hi,

i am a very fresh member and this is my first question, i am trying to record an audio file and then listen to it but it seems like i am doing something wrong.

would be great if someone could tell what it wrong in my code...

thanx, maor

B4X:
'Code module
#Region  Project Attributes
    #ApplicationLabel: Recorder
    #Version: 1.0.0
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
   
    Dim rec1 As AudioRecorder
    Dim mp1 As MediaPlayer
    Private Button1 As Button
    Private Button2 As Button
    Private Button3 As Button
End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
    NavControl.ShowPage(Page1)
    Page1.RootPanel.LoadLayout("main")
   
    rec1.Initialize(File.DirDocuments, "rec1.wav",22050, False,1, False)
   
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)

End Sub

Private Sub Application_Background
   
End Sub

Sub Button1_Click
    rec1.Record
End Sub
Sub Button3_Click
    rec1.Stop
End Sub
Sub Button2_Click

If File.Exists(File.DirDocuments,"rec1.wav") Then
    mp1.Initialize(File.DirDocuments,"rec1.wav","mp1")
    mp1.Volume = 1
    mp1.Play
    Log("file exist")
Else
Log("file does not exist")
End If
   
End Sub
 
Top