Fixed bug with operators

This commit is contained in:
Ryzerth 2021-03-29 22:28:26 +02:00
parent 27394a091f
commit 38c1949538
2 changed files with 8 additions and 8 deletions

View File

@ -124,7 +124,7 @@ namespace dsp {
}
if constexpr (std::is_same_v<T, complex_t>) {
volk_32fc_x2_multiply_32fc(out.writeBuf, _a->readBuf, _b->readBuf, a_count);
volk_32fc_x2_multiply_32fc((lv_32fc_t*)out.writeBuf, (lv_32fc_t*)_a->readBuf, (lv_32fc_t*)_b->readBuf, a_count);
}
else {
volk_32f_x2_multiply_32f(out.writeBuf, _a->readBuf, _b->readBuf, a_count);

View File

@ -2,19 +2,19 @@
namespace dsp {
struct complex_t {
complex_t& operator*(const float& b) {
complex_t operator*(const float b) {
return complex_t{re*b, im*b};
}
complex_t& operator*(const complex_t& b) {
complex_t operator*(const complex_t& b) {
return complex_t{(re*b.re) - (im*b.im), (im*b.re) + (re*b.im)};
}
complex_t& operator+(const complex_t& b) {
complex_t operator+(const complex_t& b) {
return complex_t{re+b.re, im+b.im};
}
complex_t& operator-(const complex_t& b) {
complex_t operator-(const complex_t& b) {
return complex_t{re-b.re, im-b.im};
}
@ -27,15 +27,15 @@ namespace dsp {
};
struct stereo_t {
stereo_t& operator*(const float& b) {
stereo_t operator*(const float b) {
return stereo_t{l*b, r*b};
}
stereo_t& operator+(const stereo_t& b) {
stereo_t operator+(const stereo_t& b) {
return stereo_t{l+b.l, r+b.r};
}
stereo_t& operator-(const stereo_t& b) {
stereo_t operator-(const stereo_t& b) {
return stereo_t{l-b.l, r-b.r};
}