mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-10 15:01:40 +00:00
Fix dereference of voice->sample before NULL check
Signed-off-by: David Henningsson <diwic@ubuntu.com>
This commit is contained in:
parent
ee54995fab
commit
380fd258d7
1 changed files with 12 additions and 8 deletions
|
@ -763,15 +763,19 @@ fluid_voice_update_param(fluid_voice_t* voice, int gen)
|
||||||
* which offsets the original rate. This means that the fine tuning is
|
* which offsets the original rate. This means that the fine tuning is
|
||||||
* inverted with respect to the root note (so subtract it, not add).
|
* inverted with respect to the root note (so subtract it, not add).
|
||||||
*/
|
*/
|
||||||
if (voice->gen[GEN_OVERRIDEROOTKEY].val > -1) { //FIXME: use flag instead of -1
|
|
||||||
voice->root_pitch = voice->gen[GEN_OVERRIDEROOTKEY].val * 100.0f
|
|
||||||
- voice->sample->pitchadj;
|
|
||||||
} else {
|
|
||||||
voice->root_pitch = voice->sample->origpitch * 100.0f - voice->sample->pitchadj;
|
|
||||||
}
|
|
||||||
x = fluid_ct2hz(voice->root_pitch);
|
|
||||||
if (voice->sample != NULL) {
|
if (voice->sample != NULL) {
|
||||||
x *= (fluid_real_t) voice->output_rate / voice->sample->samplerate;
|
if (voice->gen[GEN_OVERRIDEROOTKEY].val > -1) //FIXME: use flag instead of -1
|
||||||
|
voice->root_pitch = voice->gen[GEN_OVERRIDEROOTKEY].val * 100.0f
|
||||||
|
- voice->sample->pitchadj;
|
||||||
|
else
|
||||||
|
voice->root_pitch = voice->sample->origpitch * 100.0f - voice->sample->pitchadj;
|
||||||
|
x = (fluid_ct2hz(voice->root_pitch) * ((fluid_real_t) voice->output_rate / voice->sample->samplerate));
|
||||||
|
} else {
|
||||||
|
if (voice->gen[GEN_OVERRIDEROOTKEY].val > -1) //FIXME: use flag instead of -1
|
||||||
|
voice->root_pitch = voice->gen[GEN_OVERRIDEROOTKEY].val * 100.0f;
|
||||||
|
else
|
||||||
|
voice->root_pitch = 0;
|
||||||
|
x = fluid_ct2hz(voice->root_pitch);
|
||||||
}
|
}
|
||||||
/* voice->pitch depends on voice->root_pitch, so calculate voice->pitch now */
|
/* voice->pitch depends on voice->root_pitch, so calculate voice->pitch now */
|
||||||
fluid_voice_calculate_gen_pitch(voice);
|
fluid_voice_calculate_gen_pitch(voice);
|
||||||
|
|
Loading…
Reference in a new issue