Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 8754 → Rev 8770

/source/audiolib/src/tsf.h
997,8 → 997,9
if (dynamicLowpass)
{
float fres = tmpInitialFilterFc + v->modlfo.level * tmpModLfoToFilterFc + v->modenv.level * tmpModEnvToFilterFc;
tmpLowpass.active = (fres <= 13500.0f);
if (tmpLowpass.active) tsf_voice_lowpass_setup(&tmpLowpass, tsf_cents2Hertz(fres) / tmpSampleRate);
float lowpassFc = (fres <= 13500 ? tsf_cents2Hertz(fres) / f->outSampleRate : 1.0f);
tmpLowpass.active = (lowpassFc < 0.499f);
if (tmpLowpass.active) tsf_voice_lowpass_setup(&tmpLowpass, lowpassFc);
}
 
if (dynamicPitchRatio)
1243,7 → 1244,7
voicePlayIndex = f->voicePlayIndex++;
for (region = f->presets[preset_index].regions, regionEnd = region + f->presets[preset_index].regionNum; region != regionEnd; region++)
{
struct tsf_voice *voice, *v, *vEnd; TSF_BOOL doLoop; float filterQDB;
struct tsf_voice *voice, *v, *vEnd; TSF_BOOL doLoop; float lowpassFilterQDB, lowpassFc;
if (key < region->lokey || key > region->hikey || midiVelocity < region->lovel || midiVelocity > region->hivel) continue;
 
voice = TSF_NULL, v = f->voices, vEnd = v + f->voiceNum;
1294,11 → 1295,12
tsf_voice_envelope_setup(&voice->modenv, &region->modenv, key, midiVelocity, TSF_FALSE, f->outSampleRate);
 
// Setup lowpass filter.
filterQDB = region->initialFilterQ / 10.0f;
voice->lowpass.QInv = 1.0 / TSF_POW(10.0, (filterQDB / 20.0));
lowpassFc = (region->initialFilterFc <= 13500 ? tsf_cents2Hertz((float)region->initialFilterFc) / f->outSampleRate : 1.0f);
lowpassFilterQDB = region->initialFilterQ / 10.0f;
voice->lowpass.QInv = 1.0 / TSF_POW(10.0, (lowpassFilterQDB / 20.0));
voice->lowpass.z1 = voice->lowpass.z2 = 0;
voice->lowpass.active = (region->initialFilterFc <= 13500);
if (voice->lowpass.active) tsf_voice_lowpass_setup(&voice->lowpass, tsf_cents2Hertz((float)region->initialFilterFc) / f->outSampleRate);
voice->lowpass.active = (lowpassFc < 0.499f);
if (voice->lowpass.active) tsf_voice_lowpass_setup(&voice->lowpass, lowpassFc);
 
// Setup LFO filters.
tsf_voice_lfo_setup(&voice->modlfo, region->delayModLFO, region->freqModLFO, f->outSampleRate);