I have 2 threads not see each other setting a global variable.
When tmrTemp_Tick fires it disables itself and calls stop recording.
stopRecording sets audio streamer.stopRecording and the Global IsRecording = False
The problem is, there is still data in the audio buffer so streamer_RecordBuffer executes, and thinks IsRecording is true, even though IsRecording was set false by stopRecording.
Why does streamer_RecordBuffer think IsRecording = true?
How can I IsRecording so all objects see the updated vale?
When tmrTemp_Tick fires it disables itself and calls stop recording.
stopRecording sets audio streamer.stopRecording and the Global IsRecording = False
The problem is, there is still data in the audio buffer so streamer_RecordBuffer executes, and thinks IsRecording is true, even though IsRecording was set false by stopRecording.
Why does streamer_RecordBuffer think IsRecording = true?
How can I IsRecording so all objects see the updated vale?
B4X:
Sub tmrTemp_Tick
tmrTemp.Enabled = False
stopRecording
End Sub
Sub stopRecording
Dim dateString As String
streamer.stopRecording
IsRecording = False
DoEvents
DisplayResult
End Sub
Sub streamer_RecordBuffer (Buffer() As Byte)
Dim tempString As String
Dim temperature As Double
temperature = AudioUtils.GetTemperature(Buffer)
tempString = temperature
tempString = tempString.SubString2(0,tempString.IndexOf(".") + 2)
surveyTransaction.temperatureMeasured = tempString
DoEvents
If IsRecording Then
DisplayProcessingPanel(PROCESSING)
End If
End Sub