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:
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.
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.
- The Storm asked 7 years ago
- You must login to post comments
Please login first to submit.