RecordedSound.GetDuration64()

Started by mjividen, July 06, 2021, 02:59:22 PM

Previous topic - Next topic

mjividen

Either I am confused about results from a call to RecordedSound.GetDuration64() or it's not working properly for me.  It seems the duration reported is only correct the first time called.  Subsequent requests during Append not only add the length of the previous session but also what seem to be random numbers.  Sometimes it's double the length of the previous session.  Sometimes something else.  The "Dictation" demo included with the software package doesn't do this but I simply can't figure out why my program... based in large part on Dictation... does this.  I have compared my code to the Dictation sample which is identical to the sample on every line having effect on duration and position.  Any thoughts?

mjividen

Although I continue to scratch my head trying to display a continuous recording length, the instability I reported was apparently a corrupted DLL.  After removing then re-installing the Audio Recorder package, the issue went away.

mjividen

As mentioned elsewhere on the forum, I'm revising an application to record hour-long radio shows.  What I need is an easier way to display the length of the recording as it's being made.  Currently, I do some saving and adding the available variables but this often gives inaccurate  values for some reason.  Do you have a sample routine to display the length of the full recording that takes into account INSERT, OVERWRITE?

Administrator

Hello,

as seen inside the "Dictation" sample, the best way to keep track of the total recording duration, including eventual mix/append/overwrite operations, is to catch the CallbackForRecordersEvents delegate, identify the EV_REC_POSITION event within its nEvent parameter and obtain the effective total duration from the nDataLow4 and nDataHigh4 parameters: please, note that duration is a 64 bits number so it should be stored inside a "long" variable. The EV_REC_POSITION event , as seen for the RecordedSound.GetDuration64() method, will only return the duration of the latest recording operation.

Hope this helps.

Kind Regards

Severino Delaurenti
MultiMedia Soft