Skip to content
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

int32_t, float 32bits #13

Open
todo bot opened this issue Jul 17, 2021 · 4 comments
Open

int32_t, float 32bits #13

todo bot opened this issue Jul 17, 2021 · 4 comments
Assignees
Milestone

Comments

@todo
Copy link

todo bot commented Jul 17, 2021

https://github.com/Raffaello/sdl2-sonic-drivers/blob/42a377e397cfe6e70fc779400d5664809ab983d2/sdl2-sonic-drivers/test/TestWaveGenerators.cpp#L23-L28


This issue was generated by todo based on a TODO comment in 42a377e when #6 was merged. cc @Raffaello.
@todo todo bot added the todo 🗒️ label Jul 17, 2021
@todo todo bot assigned Raffaello Jul 17, 2021
This was referenced Jul 17, 2021
@Raffaello
Copy link
Owner

to process audio at float or int32_t without volume is possible with the same size type.

@Raffaello
Copy link
Owner

float is a problem as it is not an integer number and there are a lot of assumption of integer type being used.

this requires to change slightly the templates.
something similar to:

#include <type_traits>

if constexpr (std::is_integral_v<T>) {  // constexpr only necessary on first statement
    ...
} else if (std::is_floating_point_v<T>) {  // automatically constexpr
    ...
}

could be done

@Raffaello
Copy link
Owner

for float type other constexpr are an issue:

template<typename T> constexpr int32_t unsigned_max = (std::numeric_limits<T>::max() - std::numeric_limits<T>::min());

as it as a int32_t return type and won't match the float type.

float type probably requires a specialization from integers....

@Raffaello
Copy link
Owner

int32_t introduce overflows and not easily replaceable with just int64_t for eg.

@Raffaello Raffaello added this to the PC Speaker milestone Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant