0
0

Hello,

I had read many topics about capturing audio with lock(), unlock() and playing with "usercreatedsound". I also saw the example "record_realtimeplayback" but in my case I can’t do it like that.

Here are the questions that I have:

  1. Can I read only number of samples from the recorder using lock() – unlock() methods and leave some data for the next time, i.e. I want to not read all the currently captured data but only portion of it. I tried with setting buffer large enough in order to not experience buffer overrun and I set the "lastPosition" variable to point the position after the samples that I had read. However this is not working as I expected – I get a lot of gaps, so I used my own additional buffer to store the samples and read as much as I want from it but I really want to avoid this if possible.

  2. About the playback, I use as base the "usercreatedsound" example but when I’m creating the "Sound" object it automatically call the "pcmreadcallback" with x2 bigger size than the period size I set in "decodebuffersize" variable. In the same time I still do not have enough data to fill it and I get 1-2 seconds slow down of the playback. Is there a way to avoid this? Can it be done in a way like the WINMM API? When you have audio data for play you push it, when you do not have and the playback wants more – it just suspend until you push more. In this way there is no lag and delay.

Thank You for Your time. :)

  • You must to post comments
0
0

First question is solved. I was calculating wrongly the last position of the sound cursor.

Anyway I still can’t find a way to make FModEx to not call pcmreadcallback for prebuffering, so the second question stays.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.