Adding BuffersInUse in play_queue? (Audio Library)

Bertrand

Member
Hi,
I'm working on an T4.1 ethernet based intercom system and in order to do sample rate synchronization, i need to know how many audiobuffers are in use for a specific queue. Depending on the number of buffers in use, i can decide to increase or decreae the sample rate slightly, to prevent buffer under- or overruns.
I manually added a function in the play-queue .cpp and .h files, but i would prefer if this can be added to the standard distribution / updates.
Alternatively, i would like to know if i can access the relevant parameters outside the library to achieve the same goal.
These are my modifications:

Added in play_queue.h: (public: section)

C++:
int buffersInUse(void);  //BH

Added functionality in play_queue.cpp:

C++:
int AudioPlayQueue::buffersInUse(void) //BH
{
int8_t r=0;
uint8_t h = head;
uint8_t t = tail;
if (h==head && t==tail)
{
r=h-t;
if(r<0) r=r+max_buffers;
}
return r;
}

Thanks for your feedback

(repost since i got no reaction on post in Technical Support & Questions section)
 
Guessing the lack of response is due to you already having a solution to your immediate problem, and a feeling that “if you have to ask, you probably don’t have the knowledge to do” a change to the official Audio library source.

The usual way would be to have a GitHub account, fork the Audio library from Paul’s repository, create a suitably named branch for your new feature, make the change(s) and test them, and put in a pull request to have your branch merged into Paul’s master branch. If and when he does the merge, it’s now an official feature and you can delete your development branch.

If that last paragraph is so much gobbledegook to you, then you have a bit of learning to to … we were all there once. It’s quite a steep learning curve to get to grips with git and GitHub, but very worthwhile.
 
Back
Top