-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Audio buffer view improvements #8016
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
Audio buffer view improvements #8016
Conversation
--------- Co-authored-by: Sotonye Atemie <[email protected]>
sakertooth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a quick review, mostly looks fine.
|
I was making an |
|
I could template it I guess. |
|
@sakertooth How about this: template<class T, SampleType U, proc_ch_t channels = DynamicChannelCount>
concept AnyBufferView = std::convertible_to<T, InterleavedBufferView<U, channels>>
|| std::convertible_to<T, PlanarBufferView<U, channels>>;You could use it like this: void foo(AnyBufferView<const float, 2> auto in, AnyBufferView<float, 2> auto out)
{
}Or without using the abbreviated function template syntax: template<AnyBufferView<const float, 2> In, AnyBufferView<float, 2> Out>
void foo(In in, Out out)
{
}EDIT: For ease of use, void foo(AnyBufferView<const float, 2> auto buffer)
{
if constexpr (decltype(buffer)::interleaved())
{
// `buffer` is interleaved
}
else
{
// `buffer` is planar
}
} |
sakertooth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't done any testing but the changes look good as of right now. You can merge if you feel its ready.
|
Thought about it some more, and I think I prefer |
|
Apologies, I should've tested this PR in something like #7858 before approving. I think there was a slight error here: Shouldn't it be possible to convert from |
After some experience using the new audio buffer views in #7459 and #7858, it became clear that there was some useful quality-of-life functionality still missing (especially in
InterleavedBufferView).This PR adds that extra functionality we found useful.
EDIT: It looks like some of the commit messages got messed up due to me using backticks from the command-line.