Android Question Wait For event in another module

Humberto

Active Member
Licensed User
Longtime User
I´m trying to use "Wait For" and the event is in another modulo.

I´m waiting for convert file to "mp3"

B4X:
Log ("Waiting encode")
                Wait For  AudioRecord.LameEncoder_EncodeComplete(Success As Boolean)
                '            '                    xArq_Som_Anterior = "1.xx"
Log ("Continue..")

In modlule "AudioRecord" the event complete is

B4X:
public Sub LameEncoder_EncodeComplete(Success As Boolean)
    If Success Then
        File.Delete ( Main.gDir_Arq_Som, Main.gArq_Som_Ult )
        Log("** liblame Encode SUCCEEDED " & Main.gArq_Som_Ult )
        srv_location_firebase.Flag_Enconding = False
    Else
        Log("** liblame Encode FAILED " & Main.gArq_Som_Ult)
        Timer_Convert.Enabled = True
    End If
End Sub


The Log windows shows the "Waiting" message and the finish encode and the message "Continue .." doesn´t show

B4X:
FusedLocationProvider1_LocationChanged
Distancia 0.27272313833236694
xDatab - xData_Envento  > gIntervalo_Envio : 120 - 100
Waiting encode
*** inicio encode env_5511988356959170616094653_12.mp3
** liblame Encode SUCCEEDED env_5511988356959170616094653_12.wav
FusedLocationProvider1_LocationChanged
Distancia 0.441598117351532
xDatab - xData_Envento  > gIntervalo_Envio : 20 - 100

What´s wrong ?
 

Humberto

Active Member
Licensed User
Longtime User
In fact I´m waiting finish the encode "Mp3" so I put waiting for a flag the the job is finished and I use sleep command

B4X:
                Do While AudioRecord.gFlag_Convert_Complete = False
#if log
Log ("Waiting ...")
#End If
                    Sleep (1000)
                Loop

Thanks
 
Upvote 0
Top