MultiMedia Soft forum

MultiMedia Soft products => Audio recording components => Topic started by: ddonais on January 16, 2015, 12:50:23 AM

Title: AudioSoundRecorder1_RecordingStopped
Post by: ddonais on January 16, 2015, 12:50:23 AM
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.
Title: Re: AudioSoundRecorder1_RecordingStopped
Post by: Administrator on January 16, 2015, 12:56:30 AM
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
Title: Re: AudioSoundRecorder1_RecordingStopped
Post by: ddonais on January 17, 2015, 12:11:59 AM
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
Title: Re: AudioSoundRecorder1_RecordingStopped
Post by: Administrator on January 17, 2015, 12:00:39 PM
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 (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
Title: Re: AudioSoundRecorder1_RecordingStopped
Post by: ddonais on January 17, 2015, 07:14:56 PM
so should I set it to Synchronous mode
Title: Re: AudioSoundRecorder1_RecordingStopped
Post by: Administrator on January 17, 2015, 07:28:58 PM
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


Title: Re: AudioSoundRecorder1_RecordingStopped
Post by: ddonais on January 17, 2015, 08:55:18 PM
ah ok I understand now thank you very much.
Title: Re: AudioSoundRecorder1_RecordingStopped
Post by: ddonais on January 17, 2015, 10:51:02 PM
That solution worked like a charm!!