Files
CelloEffects/Appli/Core/Inc/fx_octaver.h
T
2026-09-05 18:51:17 +02:00

45 lines
1.3 KiB
C

#ifndef FX_OCTAVER_H
#define FX_OCTAVER_H
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define FX_OCTAVER_BUFFER_SIZE 2048U /* buffer circulaire (puissance de 2) */
#define FX_OCTAVER_GRAIN_SIZE 1024U /* taille de grain, en echantillons (~21ms a 48kHz) */
#define FX_OCTAVER_NUM_VOICES 4U /* -2oct, -1oct, +1oct, +2oct (la voie seche est geree a part) */
typedef struct
{
bool enabled;
float level_down2; /* niveau voix -2 octaves, 0.0 a 1.0 */
float level_down1; /* niveau voix -1 octave, 0.0 a 1.0 */
float level_dry; /* niveau voix originale, 0.0 a 1.0 */
float level_up1; /* niveau voix +1 octave, 0.0 a 1.0 */
float level_up2; /* niveau voix +2 octaves, 0.0 a 1.0 */
} FxOctaverParams;
typedef struct
{
float delay[2]; /* decalage courant (en echantillons) des deux grains en fondu croise */
} FxOctaverVoiceState;
typedef struct
{
float buffer[FX_OCTAVER_BUFFER_SIZE];
uint32_t write_idx;
FxOctaverVoiceState voices[FX_OCTAVER_NUM_VOICES];
} FxOctaverState;
void FxOctaver_Init(FxOctaverState *state, FxOctaverParams *params);
float FxOctaver_Process(FxOctaverState *state, const FxOctaverParams *params, float input);
#ifdef __cplusplus
}
#endif
#endif /* FX_OCTAVER_H */