void CButterXOver::denormalise() { if(IS_DENORMAL(outA1)) outA1=0.f; if(IS_DENORMAL(out_2_A2)) out_2_A2=0.f; if(IS_DENORMAL(out_1_A2)) out_1_A2=0.f; }
static t_int *ear_perform(t_int *w) { t_float *out = (t_float *)(w[3]); t_earctl *ctl = (t_earctl *)(w[1]); t_float attack = ctl->c_attack; t_float release = ctl->c_release; t_float state = ctl->c_state; t_float target = ctl->c_target; t_int n = (t_int)(w[2]); t_int i; if (target) /* attack phase */ for (i = 0; i < n; i++) { *out++ = state; state += attack*(1 - state); } else /* release phase */ for (i = 0; i < n; i++) { *out++ = state; state -= release*state; } ctl->c_state = IS_DENORMAL(state) ? 0 : state; return (w+4); }
t_int *nead_perform(t_int *w) { t_sample *out = (t_float *)(w[3]); t_neadctl *ctl = (t_neadctl *)(w[1]); t_sample state = ctl->c_state; int n = (int)(w[2]); int target = ctl->c_target; t_stage stage; if (target){ /* attack */ stage = ctl->c_attack; while(n){ n--;/*put inside of while so n != -1*/ *out++ = state; #ifdef FP_FAST_FMA state = fma(state, stage.op, stage.base); #else state = state*stage.op + stage.base; #endif if(state >= 1.0) { state = 1.0; target = 0; ctl->c_linr = ctl->c_decay.base; break; } } } if (!target) { /*decay*/ if(state == 0.0) while(n--) *out++ = 0.0; else { stage = ctl->c_decay; stage.base = ctl->c_linr; while(n--){ *out++ = state; #ifdef FP_FAST_FMA state = fma(state, stage.op, stage.base); #else state = state*stage.op + stage.base; #endif if(state <= 0.0) { state = 0.0; for(;n;n--) *out++ = state; } } } } /* save state */ ctl->c_state = IS_DENORMAL(state) ? 0 : state; ctl->c_target = target; return (w+4); }
t_int *near_perform(t_int *w) { t_float *out = (t_float *)(w[3]); t_nearctl *ctl = (t_nearctl *)(w[1]); t_float state = ctl->c_state; char target = ctl->c_target; int n = (int)(w[2]); t_stage stage; if (!target) { /*release*/ if(state == 0.0) while(n--) *out++ = 0.0; else { stage = ctl->c_release; stage.base = ctl->c_linr; while(n--){ *out++ = state; state = fma(state, stage.op, stage.base); if(state <= 0.0) { state = 0.0; for(;n;n--) *out++ = state; } } } } else { /* attack */ stage = ctl->c_attack; if(state == 1.0) while(n--) *out++ = 1.0; else while(n--){ *out++ = state; state = fma(state, stage.op, stage.base); if(state >= 1.0) { state = 1.0; for(;n;n--) *out++ = state; } } } /* save state */ ctl->c_state = IS_DENORMAL(state) ? 0 : state; ctl->c_target = target; return (w+4); }
void CPolyphase::denormalise() { if(IS_DENORMAL(lout[0])) lout[0] = 0.f; if(IS_DENORMAL(lout[1])) lout[1] = 0.f; if(IS_DENORMAL(lout[2])) lout[2] = 0.f; if(IS_DENORMAL(uout[0])) uout[0] = 0.f; if(IS_DENORMAL(uout[1])) uout[1] = 0.f; if(IS_DENORMAL(uout[2])) uout[2] = 0.f; }
INLINE void Denorm32(float &value) { if (fpscr.DN) { u32* v=(u32*)&value; if (IS_DENORMAL(v) && (*v&0x7fFFFFFF)!=0) { *v&=0x80000000; //printf("Denormal ..\n"); } if ((*v<=0x007FFFFF) && *v>0) { *v=0; printf("Fixed +denorm\n"); } else if ((*v<=0x807FFFFF) && *v>0x80000000) { *v=0x80000000; printf("Fixed -denorm\n"); } } }