-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SplitterChannel::requestSampleRate doesn't work as expected #284
Comments
If sampleRate is small relative to inRate, step (e.g. 44000/100) may be greater than inSamples, and it will generate no data. |
I think this is now corrected in I'll run your test code against the branch and see what we get. |
@JohnVidler @finneyj Here's a new test. test-adc-splitter.zip. Beware of this test code bringing it's own bugs! When compiled with tests/audio, the mic deactivates if the test doesn't poll levelSPL->getValue() often, even though the test creates an extra channel on the audio raw splitter. The SplitterChannel should only record the requested sample rate after the upstream has confirmed it can support it. I think that won't fix how it works with the ADC, because the ADC agrees to anything, even if it can't do it, and the actual delivery rate is lower than the agreed rate. |
(Reused text from another issue - there are a few here with strongly related problems) I've given a more complete update over in #356 but the gist is that this should no longer be the case when we merge the test branch(es) into master as the SplitterChannels should now automatically resample to match the requested rates. Thanks everyone for being patient on these issues. |
This should now finally be fixed with release v0.2.65 |
Requesting a lower rate from the SplitterChannel doesn't change the reported rate. After requesting a change to a higher rate, the SplitterChannel still reports the rate of it's upstream (higher than requested) rather than the requested rate.
I think the problem is this line should be
this->sampleRate = sampleRate;
codal-core/source/streams/StreamSplitter.cpp#L118
Once fixed, that line might need to be moved after the check on the upstream capability, to avoid this->sampleRate being greater than the upstream sample rate, which would make the calculated step value zero.
codal-core/source/streams/StreamSplitter.cpp#L68
SplitterChannel::pull uses a truncated integer step and always picks the first item in every buffer. This will tend to generate more samples than requested.
If I keep requesting a higher rate, it eventually hangs, even though I think this->sampleRate isn't being changed. I'm guessing this is because the adc doesn't protect itself against requests for very small sample periods. SplitterChannel::pull doesn't protect itself against the possibility that someone else has changed the upstream rate, leading to zero step.
The text was updated successfully, but these errors were encountered: