static void filter_default_ok_cb(GenericDialog *gd, gpointer data) { filter_reset(); filter_add_defaults(); filter_rebuild(); filter_store_populate(); }
Filter * filter_create (float sample_rate) { Filter *f = malloc(sizeof(Filter)); filter_reset(f, sample_rate); if (!f) { fprintf(stderr, "Could not allocate Filter.\n"); } return f; }
void tsproc_reset(struct tsproc *tsp, int full) { tsp->t1 = tmv_zero(); tsp->t2 = tmv_zero(); tsp->t3 = tmv_zero(); tsp->t4 = tmv_zero(); if (full) { tsp->clock_rate_ratio = 1.0; filter_reset(tsp->delay_filter); } }
static void rwand_update_state_running(struct rwand_dev *dev, struct rwand_status *new_status) { int new_filtered_period; /* We want the works */ rwand_ensure_mode(dev, new_status, RWAND_MODE_STALL_DETECT | RWAND_MODE_ENABLE_SYNC | RWAND_MODE_ENABLE_COIL | RWAND_MODE_ENABLE_DISPLAY); /* If our display just turned off, the firmware detected a stall. Go back * to the 'starting' state and give up this. */ if ((dev->status.mode & RWAND_MODE_ENABLE_DISPLAY) && !(new_status->mode & RWAND_MODE_ENABLE_DISPLAY)) { rwand_enter_state_starting(dev); return; } /* If our mode has changed, both force a timing update and reset the period filter */ if (new_status->mode != dev->status.mode) { dev->settings_dirty = 1; filter_reset(&dev->period_filter); } new_filtered_period = filter_push(&dev->period_filter, new_status->period); /* Only actually update the timings if our filtered period is noticeably * different than the last set period. This is mainly here to reduce * the bus bandwidth used by all the rwand_nb_request()s below when possible. */ if (abs(new_filtered_period - dev->filtered_period) > PERIOD_TOLERANCE) { dev->settings_dirty = 1; dev->filtered_period = new_filtered_period; } if (dev->settings_dirty) { struct rwand_timings timings; rwand_calc_timings(&dev->settings, new_filtered_period, &timings); rwand_nb_request(dev, RWAND_CTRL_SET_COIL_PHASE, timings.coil_begin, timings.coil_end); rwand_nb_request(dev, RWAND_CTRL_SET_COLUMN_WIDTH, timings.column_width, timings.gap_width); rwand_nb_request(dev, RWAND_CTRL_SET_DISPLAY_PHASE, timings.fwd_phase, timings.rev_phase); rwand_nb_request(dev, RWAND_CTRL_SET_NUM_COLUMNS, dev->settings.num_columns, 0); dev->settings_dirty = 0; } }