void Spectacle::set_delay_binmap_table(int *table, int len) { if (table == NULL || len == 0 || len != _delay_table_size) _delay_binmap_table = NULL; else _delay_binmap_table = table; update_bin_groups(_delay_bin_groups, _delay_binmap_table, _delay_minfreq, _delay_maxfreq, _delay_table_size); }
void Spectacle::set_binmap_table(int *table, int len) { if (table == NULL || len == 0 || len != _control_table_size) _binmaptable = NULL; else _binmaptable = table; update_bin_groups(_bin_groups, NULL, get_minfreq(), get_maxfreq(), _control_table_size); }
// ---------------------------------------------------------------- set_srate -- void Spectacle::set_srate(float srate) { if (_delay_maxfreq == _nyquist) _delay_maxfreq = 0.0f; SpectacleBase::set_srate(srate); if (_delay_maxfreq == 0.0f) // nyquist might have changed _delay_maxfreq = _nyquist; set_maxdeltime(_maxdeltime); update_bin_groups(_delay_bin_groups, _delay_binmap_table, _delay_minfreq, _delay_maxfreq, _delay_table_size); }
// ---------------------------------------------------------------- set_srate -- // Must call this before anything that updates bin groups in subclass. void SpectacleBase::set_srate(float srate) { if (srate != _srate) { _srate = srate; if (_maxfreq == _nyquist) _maxfreq = 0.0f; _nyquist = srate / 2; if (_maxfreq == 0.0f) _maxfreq = _nyquist; _fund_anal_freq = srate / float(_fftlen); update_bin_groups(_bin_groups, NULL, _minfreq, _maxfreq, _control_table_size); } }
// --------------------------------------------------------- set_eq_freqrange -- // Similar to set_freqrange in base class, but for _eq_bin_groups. bool SPECTACLE2::set_eq_freqrange(float min, float max) { if (min != _eq_minfreq || max != _eq_rawmaxfreq) { _eq_rawmaxfreq = max; if (max == 0.0f) max = _nyquist; if (max < min) _fswap(&min, &max); if (max > _nyquist) max = _nyquist; _eq_minfreq = _fclamp(0.0f, min, max); update_bin_groups(_eq_bin_groups, _eq_minfreq, max, _eqtablen, "EQ"); return true; } return false; }
bool SPECTACLE2_BASE::set_freqrange(float min, float max, const char *type) { if (min != _minfreq || max != _rawmaxfreq) { _rawmaxfreq = max; if (max == 0.0f) max = _nyquist; if (max < min) _fswap(&min, &max); if (max > _nyquist) max = _nyquist; _minfreq = _fclamp(0.0f, min, max); update_bin_groups(_bin_groups, _minfreq, max, _control_table_size, type); return true; } return false; }
bool SpectacleBase::set_freqrange(float min, float max) { if (min != _minfreq || max != _maxfreq) { if (max == 0.0f) max = _nyquist; if (max < min) _fswap(&min, &max); if (max > _nyquist) max = _nyquist; _maxfreq = max; _minfreq = _fclamp(0.0f, min, max); update_bin_groups(_bin_groups, NULL, _minfreq, max, _control_table_size); return true; } return false; }
// ------------------------------------------------------ set_delay_freqrange -- // Similar to set_freqrange in base class, but for _delay_bin_groups. bool Spectacle::set_delay_freqrange(float min, float max) { if (min != _delay_minfreq || max != _delay_maxfreq) { if (max == 0.0f) max = _nyquist; if (max < min) _fswap(&min, &max); if (max > _nyquist) max = _nyquist; _delay_maxfreq = max; _delay_minfreq = _fclamp(0.0f, min, max); update_bin_groups(_delay_bin_groups, _delay_binmap_table, _delay_minfreq, max, _delay_table_size); return true; } return false; }
// ------------------------------------------------------------- set_deltable -- void Spectacle::set_deltable(float *table, int len) { if (len == 0) { // no table set yet by caller _deltimeconst = 0.0; _deltimetable = NULL; } else if (len == 1) { _deltimeconst = table[0]; _deltimetable = NULL; // NB: don't set _delay_table_size to zero } else { _deltimeconst = 0.0; _deltimetable = table; if (len != _delay_table_size) { _delay_table_size = len; update_bin_groups(_delay_bin_groups, _delay_binmap_table, _delay_minfreq, _delay_maxfreq, _delay_table_size); } } }
// -------------------------------------------------------------- set_eqtable -- void Spectacle::set_eqtable(float *table, int len) { if (len == 0) { // no table set yet by caller _eqconst = 0.0; _eqtable = NULL; _control_table_size = 0; } else if (len == 1) { _eqconst = table[0]; _eqtable = NULL; _control_table_size = 0; } else { _eqconst = 0.0; _eqtable = table; if (len != _control_table_size) { _control_table_size = len; update_bin_groups(_bin_groups, NULL, get_minfreq(), get_maxfreq(), _control_table_size); } } }