-
Notifications
You must be signed in to change notification settings - Fork 2.2k
audio: Added SDL_PutAudioStreamDataNoCopy. #13118
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
Conversation
I’m not sure about the name, it almost implies that since it’s const, then you’re going to make a copy of it. |
|
SDL_PutAudioStreamDataPointer? SDL_PutAudioStreamExternalData? |
SDL_PutAudioStreamZeroCopyData works too (tho ig it gets copied eventually?) |
Renamed it to SDL_PutAudioStreamDataPointer, added a callback that fires when the buffer is totally consumed (safe to free or reuse), so you don't have to guess. |
I'm still on the fence on the naming, but conceptually the idea is great. |
SDL_PutAudioStreamDataPointer() makes you wonder if the other function doesn't take a pointer. |
Sam and I discussed this and we're going with SDL_PutAudioStreamDataNoCopy. We don't have (afaict) anything else in SDL that maps to the same concept; usually we'll copy data when we need it past the end of an API call, so we don't have any other naming scheme to match. |
250c652
to
0e11bda
Compare
This is rebased with the new name, so if the builders like it and everyone is happy, we can merge it. |
This allows an app to add data to an audio stream without an allocating a copy, if they are maintaining the data elsewhere.