void dss_squarewave2_reset(struct node_description *node) { struct dss_squarewave_context *context = node->context; PRECISION start; /* Establish starting phase, convert from degrees to radians */ start = (node->input[5] / (node->input[2] + node->input[3])) * (2.0 * PI); /* Make sure its always mod 2Pi */ context->phase = fmod(start, 2.0 * PI); /* Step the output */ dss_squarewave2_step(node); }
void dss_squarewave2_reset(struct node_description *node) { struct dss_squarewave_context *context = node->context; double start; /* Establish starting phase, convert from degrees to radians */ /* Only valid if we have set the on/off time */ if((DSS_SQUAREWAVE2__T_OFF + DSS_SQUAREWAVE2__T_ON) != 0.0) start = (DSS_SQUAREWAVE2__SHIFT / (DSS_SQUAREWAVE2__T_OFF + DSS_SQUAREWAVE2__T_ON)) * (2.0 * M_PI); else start = 0.0; /* Make sure its always mod 2Pi */ context->phase = fmod(start, 2.0 * M_PI); /* Step the output */ dss_squarewave2_step(node); }