mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Merge branch 'next' of https://github.com/Brumi-2021/portapack-mayhem into next
This commit is contained in:
commit
22a5ca7df7
@ -27,8 +27,6 @@
|
|||||||
#include "event_m4.hpp"
|
#include "event_m4.hpp"
|
||||||
#include "portapack_shared_memory.hpp"
|
#include "portapack_shared_memory.hpp"
|
||||||
|
|
||||||
#include "event_m4.hpp"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
void SpectrumCollector::on_message(const Message* const message) {
|
void SpectrumCollector::on_message(const Message* const message) {
|
||||||
@ -107,22 +105,22 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) {
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static typename T::value_type spectrum_window_none(const T& s, const size_t i) {
|
static typename T::value_type spectrum_window_none(const T& s, const size_t i) {
|
||||||
static_assert(power_of_two(s.size()), "Array size must be power of 2");
|
static_assert(power_of_two(ARRAY_ELEMENTS(s)), "Array number of elements must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions.
|
||||||
return s[i];
|
return s[i];
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static typename T::value_type spectrum_window_hamming_3(const T& s, const size_t i) {
|
static typename T::value_type spectrum_window_hamming_3(const T& s, const size_t i) {
|
||||||
static_assert(power_of_two(s.size()), "Array size must be power of 2");
|
static_assert(power_of_two(ARRAY_ELEMENTS(s)), "Array number of elements must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions.
|
||||||
constexpr size_t mask = s.size() - 1;
|
const size_t mask = s.size() - 1; // c/m compile error GCC10 , constexpr->const
|
||||||
// Three point Hamming window.
|
// Three point Hamming window.
|
||||||
return s[i] * 0.54f + (s[(i-1) & mask] + s[(i+1) & mask]) * -0.23f;
|
return s[i] * 0.54f + (s[(i-1) & mask] + s[(i+1) & mask]) * -0.23f;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static typename T::value_type spectrum_window_blackman_3(const T& s, const size_t i) {
|
static typename T::value_type spectrum_window_blackman_3(const T& s, const size_t i) {
|
||||||
static_assert(power_of_two(s.size()), "Array size must be power of 2");
|
static_assert(power_of_two(ARRAY_ELEMENTS(s)), "Array number of elements must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions.
|
||||||
constexpr size_t mask = s.size() - 1;
|
const size_t mask = s.size() - 1; // c/m compile error GCC10 , constexpr->const
|
||||||
// Three term Blackman window.
|
// Three term Blackman window.
|
||||||
constexpr float alpha = 0.42f;
|
constexpr float alpha = 0.42f;
|
||||||
constexpr float beta = 0.5f * 0.5f;
|
constexpr float beta = 0.5f * 0.5f;
|
||||||
|
@ -22,6 +22,9 @@
|
|||||||
#ifndef __SPECTRUM_COLLECTOR_H__
|
#ifndef __SPECTRUM_COLLECTOR_H__
|
||||||
#define __SPECTRUM_COLLECTOR_H__
|
#define __SPECTRUM_COLLECTOR_H__
|
||||||
|
|
||||||
|
#define ARRAY_ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
|
||||||
|
/* sizeof() compile-time operator that returns #bytes of (data type). We used it to get #elements_array */
|
||||||
|
|
||||||
#include "dsp_types.hpp"
|
#include "dsp_types.hpp"
|
||||||
#include "complex.hpp"
|
#include "complex.hpp"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user