AudioSoundRecorder1_RecordingStopped

Started by ddonais, January 16, 2015, 12:50:23 AM

Previous topic - Next topic

ddonais

is there a way to tell if the recording was stopped because of the
AudioRecorder1.Stop()
or from say a AudioSoundRecorder1.SetRecordingRange timeout

I Want to do things differently depending on which event it was.

Administrator

Hello,

unfortunately there is one single event only for the 2 mentioned cases but I think that a simple flag raised immediately before invoking the Stop method could be of help.

Kind Regards

Severino Delaurenti
MultiMedia Soft

ddonais

Ok I have added a flag, however if I do the following, it starts the recording again before the recordingstopped handler has run (in the code to change encoding parameters flag must be set to true again so that it will autostart after the setrange runs out)

flag = false
audiosoundrecorder1.stop()
code to change encoding parameters
audiosoundrecorder1.start()

Private Sub AudioSoundRecorder1_RecordingStopped(sender As Object, e As RecordingStoppedEventArgs) Handles AudioSoundRecorder1.RecordingStopped
    If not flag then
       exit sub
    else
        code for restarting recording
    end if
End Sub

Administrator

Hello,

it's highly recommended that you avoid restarting a recording session from within the event handler in that way; please, be sure to read the tutorial "How to synchronize the container application with the control" available inside the documentation:
http://www.multimediasoft.com/asrecnet/help/how_to_synchronize_the_contain.htm
the usage of a one-shot timer is recommended in this case so this will let the event handler to be consumed and the new recording session to be started with the delay set into the timer.

Kind Regards

Severino Delaurenti
MultiMedia Soft

ddonais


Administrator

Hello,

the synchronous mode is intended for usage with lengthy operations, for example loading a large sound file from disk or analyzing the sound's waveform: a regular recording session from a sound card is a different situation: my suggestion was related to the usage of a one-shot timer as described at the very end of the tutorial: when the RecordingStopped event is caught, you can start the timer and, inside the timer's tick handler, you can disable the timer itself (just to avoid unwanted recursions hence the name "one-shot timer") and immediately start the new recording session.

Kind Regards

Severino Delaurenti
MultiMedia Soft



ddonais

ah ok I understand now thank you very much.

ddonais