Created The OPL3Tunning CLass that contains the Tunning info
This commit is contained in:
parent
627685b34f
commit
83d553f1ec
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// Created by gustavohenriquesantossouzademir on 24/03/2026.
|
||||
//
|
||||
|
||||
#ifndef YMF262DEVBOARDSOFTWARE_OPL3TUNNING_H
|
||||
#define YMF262DEVBOARDSOFTWARE_OPL3TUNNING_H
|
||||
#include <cstdint>
|
||||
|
||||
template <uint32_t TCLOCK = 14'318'180UL>
|
||||
class OPL3Tunning {
|
||||
private:
|
||||
/*!
|
||||
* @brief Precomputed power-of-two values for each F-Number block octave.
|
||||
*
|
||||
* Each entry corresponds to \f$ 2^{(octave - 1)} \f$, used in the F-Number formula:
|
||||
* \f[
|
||||
* F_{number} = \frac{f \cdot 2^{19}}{f_s \cdot 2^{octave - 1}}
|
||||
* \f]
|
||||
* Index 0 corresponds to Octave1, index 7 to Octave8.
|
||||
*/
|
||||
static constexpr float POW2_BLOCKMINUS1[8] = {
|
||||
1.0f,
|
||||
2.0f,
|
||||
4.0f,
|
||||
8.0f,
|
||||
16.0f,
|
||||
32.0f,
|
||||
64.0f,
|
||||
128.0f,
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Precomputed number for the \f$ 2^{19} \f$
|
||||
* This number is precomputed due the STM32 not having a POW function and this number is used
|
||||
* on the formula:
|
||||
* \f[
|
||||
* F_{number} = \frac{f \cdot 2^{19}}{f_s \cdot 2^{octave - 1}}
|
||||
* \f]
|
||||
* so it was added as static constexpr
|
||||
*/
|
||||
static constexpr uint32_t POW2_19 = 524288;
|
||||
|
||||
/*!
|
||||
* @brief Calculated Sampling Frequency
|
||||
* This Number is dependent on the Clock and is also used on the formula to calculate the F-Number
|
||||
*/
|
||||
static constexpr float FS = TCLOCK / 288;
|
||||
};
|
||||
|
||||
|
||||
#endif //YMF262DEVBOARDSOFTWARE_OPL3TUNNING_H
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
//
|
||||
// Created by gustavohenriquesantossouzademir on 24/03/2026.
|
||||
//
|
||||
|
||||
#include "../include/YMF262/OPL3Tunning.h"
|
||||
Loading…
Reference in New Issue