Rev 8752 | Rev 8770 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8752 | Rev 8754 | ||
---|---|---|---|
Line 548... | Line 548... | ||
548 | if (!p->keynumToDecay) p->decay = (p->decay < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->decay)); |
548 | if (!p->keynumToDecay) p->decay = (p->decay < -11950.0f ? 0.0f : tsf_timecents2Secsf(p->decay)); |
549 | 549 | ||
550 | if (p->sustain < 0.0f) p->sustain = 0.0f; |
550 | if (p->sustain < 0.0f) p->sustain = 0.0f; |
551 | else if (sustainIsGain) p->sustain = tsf_decibelsToGain(-p->sustain / 10.0f); |
551 | else if (sustainIsGain) p->sustain = tsf_decibelsToGain(-p->sustain / 10.0f); |
552 | else p->sustain = 1.0f - (p->sustain / 1000.0f); |
552 | else p->sustain = 1.0f - (p->sustain / 1000.0f); |
- | 553 | ||
- | 554 | p->sustain = clamp(p->sustain, 0, 1.f); |
|
553 | }
|
555 | }
|
554 | 556 | ||
555 | static void tsf_load_presets(tsf* res, struct tsf_hydra *hydra, unsigned int fontSampleCount) |
557 | static void tsf_load_presets(tsf* res, struct tsf_hydra *hydra, unsigned int fontSampleCount) |
556 | {
|
558 | {
|
557 | enum { GenInstrument = 41, GenKeyRange = 43, GenVelRange = 44, GenSampleID = 53 }; |
559 | enum { GenInstrument = 41, GenKeyRange = 43, GenVelRange = 44, GenSampleID = 53 }; |
Line 1263... | Line 1265... | ||
1263 | 1265 | ||
1264 | voice->region = region; |
1266 | voice->region = region; |
1265 | voice->playingPreset = preset_index; |
1267 | voice->playingPreset = preset_index; |
1266 | voice->playingKey = key; |
1268 | voice->playingKey = key; |
1267 | voice->playIndex = voicePlayIndex; |
1269 | voice->playIndex = voicePlayIndex; |
1268 | voice->noteGainDB = f->globalGainDB - region->attenuation - tsf_gainToDecibels(1.0f / vel); |
1270 | voice->noteGainDB = f->globalGainDB - clamp(region->attenuation, 0.f, 144.f) - tsf_gainToDecibels(1.0f / vel); |
1269 | 1271 | ||
1270 | if (f->channels) |
1272 | if (f->channels) |
1271 | {
|
1273 | {
|
1272 | f->channels->setupVoice(f, voice); |
1274 | f->channels->setupVoice(f, voice); |
1273 | }
|
1275 | }
|