diff --git a/Lib/YMF262/Inc/YMF262/FNumberBlock.h b/Lib/YMF262/Inc/YMF262/FNumberBlock.h new file mode 100644 index 0000000..924897a --- /dev/null +++ b/Lib/YMF262/Inc/YMF262/FNumberBlock.h @@ -0,0 +1,19 @@ +// +// Created by gustavohenriquesantossouzademir on 24/03/2026. +// + +#ifndef YMF262DEVBOARDSOFTWARE_FNUMBERBLOCK_H +#define YMF262DEVBOARDSOFTWARE_FNUMBERBLOCK_H + +enum FNumberBlock { + BLOCK1, + BLOCK2, + BLOCK3, + BLOCK4, + BLOCK5, + BLOCK6, + BLOCK7, + BLOCK8, +}; + +#endif //YMF262DEVBOARDSOFTWARE_FNUMBERBLOCK_H \ No newline at end of file diff --git a/Lib/YMF262/Inc/YMF262/Notes.h b/Lib/YMF262/Inc/YMF262/Notes.h new file mode 100644 index 0000000..7b06bdb --- /dev/null +++ b/Lib/YMF262/Inc/YMF262/Notes.h @@ -0,0 +1,21 @@ +// +// Created by gustavohenriquesantossouzademir on 24/03/2026. +// + +#ifndef YMF262DEVBOARDSOFTWARE_NOTES_H +#define YMF262DEVBOARDSOFTWARE_NOTES_H +enum Notes { + NoteDo, + NoteDoSharp, + NoteRe, + NoteReSharp, + Note,Mi, + NoteFa, + NoteFaSharp, + NoteSol, + NoteSolSharp, + NoteLa, + NoteLaSharp, + NoteSi +}; +#endif //YMF262DEVBOARDSOFTWARE_NOTES_H \ No newline at end of file diff --git a/Lib/YMF262/Inc/YMF262/OPL3Tunning.h b/Lib/YMF262/Inc/YMF262/OPL3Tunning.h new file mode 100644 index 0000000..0154c64 --- /dev/null +++ b/Lib/YMF262/Inc/YMF262/OPL3Tunning.h @@ -0,0 +1,48 @@ +// +// Created by gustavohenriquesantossouzademir on 24/03/2026. +// + +#ifndef YMF262DEVBOARDSOFTWARE_OPL3TUNNING_H +#define YMF262DEVBOARDSOFTWARE_OPL3TUNNING_H +#include + +template +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 uint16_t POW2_BLOCKMINUS1[8] = { + 1,2,4,8,16,32,64,128 + }; + + /*! + * @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 + * * \f[ + * f_s = \frac{T_{CLOCK}}{288} + * \f] + */ + static constexpr uint32_t FS = TCLOCK / 288; +}; + + +#endif //YMF262DEVBOARDSOFTWARE_OPL3TUNNING_H \ No newline at end of file diff --git a/Lib/YMF262/Src/.placeholder b/Lib/YMF262/Src/.placeholder new file mode 100644 index 0000000..e69de29 diff --git a/Lib/YMF262/Src/OPL3Tunning.cpp b/Lib/YMF262/Src/OPL3Tunning.cpp new file mode 100644 index 0000000..1265535 --- /dev/null +++ b/Lib/YMF262/Src/OPL3Tunning.cpp @@ -0,0 +1,5 @@ +// +// Created by gustavohenriquesantossouzademir on 24/03/2026. +// + +#include "../include/YMF262/OPL3Tunning.h"