News:

SMF - Just Installed!

Main Menu

Obtaining total record time

Started by mjividen, March 12, 2024, 03:25:41 PM

Previous topic - Next topic

mjividen

Hello, Severino,

I've written an audio recording application for recording magazines and books that would later be listened to by persons who are blind.  The recordings are typically a half-hour to an hour long.  I've included a total time display but I haven't successfully made it work.  I've attempted to use the record position and record duration numbers but I when the I pause or stop and restart the recording, I'm not coming up with the total length of the recording in minutes and seconds.  Can you suggest a way to do this.  I'm most comfortable in visual basic. 


Administrator

Hello,

if you look into the RecordedSoundEditor VB6 sample project, you will see how the duration of a recording session is currently managed into the LabelTotalDuration label: it's important to note that, after a recording session is "stopped" instead of "paused", you will have to restart it using the SetRecordingMode method with the REC_MODE_APPEND option.

You will also notice that, when a new recording session is started in append mode, the RecordingDuration event will return the duration of the current session only; if you should need to know the total sum of the durations of previous appended sessions as well, you would have to catch the RecordingPosition event instead of the RecordingDuration event.

Hope this helps

Kind Regards

Severino Delaurenti
MultiMedia Soft

mjividen

Thanks for the answer.  My problem is not APPEND but is displaying the total recording length in INSERT and OVERWRITE modes.  (I'm writing code in VB on Visual Studio).

Administrator

Hello, you are welcome.

In this case unfortunately no specific event is available but you may obtain the total duration by applying a couple of arithmetic operations:

- in "Insert" mode you can simply add the duration of the previous session, which can be obtained through the RecordedSound.GetDuration method, to the duration of the current session as reported by the RecordingDuration event

- in "overwrite" mode is a bit more tricky because you need to keep count of the overwrite position and add to this position the duration of the current session as reported by the RecordingDuration event:

   a) if the result of this sum is smaller than the duration of the previous session, which can be obtained through the RecordedSound.GetDuration method, then the total duration is still represented by the value returned by the previous call to the RecordedSound.GetDuration method

   b) if the result of this sum is higher, then the new total duration will be the sum between the overwrite position and the duration of the current session as reported by the RecordingDuration event.

In both cases, please, keep count that the RecordedSound.GetDuration method needs to be invoked before starting the recording session or it will return the error ERR_RECORDER_BUSY (-64).

Hope this helps.

Kind regards

Severino Delaurenti
MultiMedia Soft