#ifndef FX_OCTAVER_H #define FX_OCTAVER_H #include #include #ifdef __cplusplus extern "C" { #endif #define FX_OCTAVER_BUFFER_SIZE 4096U /* buffer circulaire (puissance de 2) */ #define FX_OCTAVER_GRAIN_SIZE 2048U /* taille de grain, en echantillons (~43ms a 48kHz) : * doit largement couvrir la periode des notes les plus * graves jouees (ex. do2 ~65Hz, periode ~734 echantillons * a 48kHz) pour limiter les artefacts de phase entre les * deux grains en fondu croise. */ #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 */