void dss_sawtoothwave_reset(struct node_description *node) { struct dss_sawtoothwave_context *context = node->context; PRECISION start; /* Establish starting phase, convert from degrees to radians */ start=(node->input[5]/360.0)*(2.0*PI); /* Make sure its always mod 2Pi */ context->phase=fmod(start,2.0*PI); /* Invert gradient depending on sawtooth type /|/|/|/|/| or |\|\|\|\|\ */ context->type=(node->input[4])?1:0; /* Step the node to set the output */ dss_sawtoothwave_step(node); }
void dss_sawtoothwave_reset(struct node_description *node) { struct dss_sawtoothwave_context *context = node->context; double start; /* Establish starting phase, convert from degrees to radians */ start=(DSS_SAWTOOTHWAVE__PHASE/360.0)*(2.0*M_PI); /* Make sure its always mod 2Pi */ context->phase=fmod(start,2.0*M_PI); /* Invert gradient depending on sawtooth type /|/|/|/|/| or |\|\|\|\|\ */ context->type=(DSS_SAWTOOTHWAVE__GRAD)?1:0; /* Step the node to set the output */ dss_sawtoothwave_step(node); }