usb audio

another: in copytobuffers:

uint32_t *target = (uint32_t*) src + len;
[...]
while ((src < target - 2))
[..] src gets read. but with len=1 at a negative index.

may cause clicks, too + undefined behaviour.
 
I’d like to think it would make better use of your time to check the new USB code - see thread starting here; everything before that is a previous incomplete attempt and a bunch of one post wonders offering to help and not following through.

The outcome of this has had a reasonable amount of user testing, but AFAIK no picky AI run over it. It is also already in as a PR, which Paul said he’d merge for … oh, some release long gone … but also 1.63. Who knows?

It is way better than the current implementation, coping with up to 8 channels, sample rates up to 96kHz, and audio block sizes down to 16 samples.

If you find anything and submit a test case and corresponding PR, there’s a very good chance @alex6679 will merge it. Maybe not immediately, but at some point. If you just mention where an error can be found, I’d hazard a guess any response will at best be delayed, and at worst there won’t be one and you’ll have wasted your time. Up to you.
 
Do you see any chance that this will ever be merged?I'd be happy to take a look over the next few days if you want.
 
Do you see any chance that this will ever be merged?
Well, we have this post. Of course, we were previously told 1.61, it didn’t make it to 1.62, and 1.63 hasn’t started yet. I’m definitely not holding my breath, but it is getting a reasonable amount of traffic here, and there’s a fair few people who want it, let alone all those who would simply be content with working stereo, rather than the glitch-prone implementation we’re currently stuck with.

I'd be happy to take a look over the next few days if you want.
That would be great. The earlier any required fixes get in there, the less likely it is to get kicked out of the 1.63 campaign and have to wait for yet another cycle before it’s considered.
 
I just did a quick check. Good news—nothing significant was found.
However, the AI is nitpicking about a few minor issues, including the fact that the default constructor only partially initializes the variables. `resetHistory` is called, but the remaining members aren't initialized. There are also a few other things that would need to be tested.
Since I wasted a lot of time today, I have to take care of other things now. But I'll take another look at it, as promised.
 
That's helpful already. I've definitely experienced issues when statically-constructed class instances worked OK, but dynamically-constructed ones failed in unpredictable ways. It would be relatively unusual to use the USB audio classes dynamically (I'm not even sure it's possible to delete them safely), but the members definitely should be initialised!
 
another: in copytobuffers:

uint32_t *target = (uint32_t*) src + len;
[...]
while ((src < target - 2))
[..] src gets read. but with len=1 at a negative index.

may cause clicks, too + undefined behaviour.
I have to correct this; there is no read.
But:
This loop processes two source words per iteration. When len = 0 or len = 1, the boundary calculation is invalid: target - 2 attempts to form a pointer before the beginning of the source array, which results in undefined behavior in C/C++.
(-> the compiler is free to do do things you don't want)
The loop condition should therefore be rewritten to handle short buffers safely.
 
@h4yn0nnym0u5e
I checked out “main” from the repo.
My AI did not find real issues.If problems do arise, I would consider signing up for a paid Claude account for one month and having the specific problem investigated.
Just take another look at “util/LastCall.h” and the uninitialized configuration values I mentioned earlier.

Have fun with the code.

I've been struggling with USB-audio on the S3 for the past few days. Wow, that thing is finicky. That said, it's worth noting that the framework's USB audio code is still very new and is still suffering from a few teething problems. Once you've managed to get it working, though, it's very stable and there are no audible crackles.
 
Last edited:
Back
Top