Fixed fine tuning problem which caused out of tune instruments and

applied big endian long long bug fix patch.
This commit is contained in:
Element Green 2005-06-10 07:57:28 +00:00
parent 37d805cb0f
commit 196ca5724c
3 changed files with 24 additions and 3 deletions

View file

@ -1,3 +1,11 @@
2005-06-10 <jgreen@users.sourceforge.net>
* src/fluid_phase.h: Patch from Sean Bolton to fix big endian long long
phase combined 64 bit value type fluid_phase_t
* src/fluid_voice.c (fluid_voice_update_param): case GEN_OVERRIDEROOTKEY
was incorrectly adding pitchadj fine tune amount instead of subtracting
it. Also, fine tuning should be applied to root key override as well.
2005-06-07 <jgreen@users.sourceforge.net>
* Applied Sean Bolton's DSSI patch (SB patch) which adds the ability to

View file

@ -22,6 +22,9 @@
#ifndef _FLUID_PHASE_H
#define _FLUID_PHASE_H
#if HAVE_CONFIG_H
#include "config.h"
#endif
/*
* phase
@ -51,8 +54,13 @@
typedef union {
struct{
/* Note, that the two 32-bit ints form a 64-bit int! */
#ifdef WORDS_BIGENDIAN
sint32 index;
uint32 fract;
#else
uint32 fract;
sint32 index;
#endif
} b32;
#ifdef USE_LONGLONG
long long b64;

View file

@ -1158,11 +1158,16 @@ fluid_voice_update_param(fluid_voice_t* voice, int gen)
case GEN_OVERRIDEROOTKEY:
/* This is a non-realtime parameter. Therefore the .mod part of the generator
* can be neglected. */
* can be neglected.
* NOTE: origpitch sets MIDI root note while pitchadj is a fine tuning amount
* which offsets the original rate. This means that the fine tuning is
* 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 = 100.0f * voice->gen[GEN_OVERRIDEROOTKEY].val;
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;
voice->root_pitch = voice->sample->origpitch * 100.0f - voice->sample->pitchadj;
}
voice->root_pitch = fluid_ct2hz(voice->root_pitch);
if (voice->sample != NULL) {