mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-01 00:21:14 +00:00
fluid_voice: take care of fixed vel and key generators
This commit is contained in:
parent
83b62cfa80
commit
f3ab771541
2 changed files with 51 additions and 7 deletions
|
@ -1447,7 +1447,7 @@ int fluid_voice_is_sostenuto(fluid_voice_t* voice)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the voice is playing gets the midi channel the voice is playing on. Else the result is undefined.
|
* If the voice is playing, gets the midi channel the voice is playing on. Else the result is undefined.
|
||||||
* @param voice Voice instance
|
* @param voice Voice instance
|
||||||
* @return The channel assigned to this voice
|
* @return The channel assigned to this voice
|
||||||
* @since 1.1.7
|
* @since 1.1.7
|
||||||
|
@ -1458,9 +1458,31 @@ int fluid_voice_get_channel(fluid_voice_t* voice)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the voice is playing gets the midi key the voice is playing on. Else the result is undefined.
|
* If the voice is playing, gets the midi key the voice is actually playing at. Else the result is undefined.
|
||||||
|
* If the voice was started from an instrument which uses a fixed key generator, it returns that.
|
||||||
|
* Else returns the same as \c fluid_voice_get_key.
|
||||||
* @param voice Voice instance
|
* @param voice Voice instance
|
||||||
* @return The midi key assigned to this voice
|
* @return The midi key this voice is playing at
|
||||||
|
* @since 1.1.7
|
||||||
|
*/
|
||||||
|
int fluid_voice_get_actual_key(fluid_voice_t* voice)
|
||||||
|
{
|
||||||
|
fluid_real_t x = _GEN(voice, GEN_KEYNUM);
|
||||||
|
if (x >= 0)
|
||||||
|
{
|
||||||
|
return (int)x;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return fluid_voice_get_key(voice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the voice is playing, gets the midi key from the noteon event, by which the voice was initially turned on with.
|
||||||
|
* Else the result is undefined.
|
||||||
|
* @param voice Voice instance
|
||||||
|
* @return The midi key of the noteon event that originally turned on this voice
|
||||||
* @since 1.1.7
|
* @since 1.1.7
|
||||||
*/
|
*/
|
||||||
int fluid_voice_get_key(fluid_voice_t* voice)
|
int fluid_voice_get_key(fluid_voice_t* voice)
|
||||||
|
@ -1469,9 +1491,31 @@ int fluid_voice_get_key(fluid_voice_t* voice)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the voice is playing gets the midi velocity the voice is playing at. Else the result is undefined.
|
* If the voice is playing, gets the midi velocity the voice is actually playing at. Else the result is undefined.
|
||||||
|
* If the voice was started from an instrument which uses a fixed velocity generator, it returns that.
|
||||||
|
* Else returns the same as \c fluid_voice_get_velocity.
|
||||||
* @param voice Voice instance
|
* @param voice Voice instance
|
||||||
* @return The midi velocity assigned to this voice
|
* @return The midi velocity this voice is playing at
|
||||||
|
* @since 1.1.7
|
||||||
|
*/
|
||||||
|
int fluid_voice_get_actual_velocity(fluid_voice_t* voice)
|
||||||
|
{
|
||||||
|
fluid_real_t x = _GEN(voice, GEN_VELOCITY);
|
||||||
|
if (x > 0)
|
||||||
|
{
|
||||||
|
return (int)x;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return fluid_voice_get_velocity(voice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the voice is playing, gets the midi velocity from the noteon event, by which the voice was initially
|
||||||
|
* turned on with. Else the result is undefined.
|
||||||
|
* @param voice Voice instance
|
||||||
|
* @return The midi velocity which originally turned on this voice
|
||||||
* @since 1.1.7
|
* @since 1.1.7
|
||||||
*/
|
*/
|
||||||
int fluid_voice_get_velocity(fluid_voice_t* voice)
|
int fluid_voice_get_velocity(fluid_voice_t* voice)
|
||||||
|
|
|
@ -63,8 +63,8 @@ struct _fluid_voice_t
|
||||||
it's used for noteoff's */
|
it's used for noteoff's */
|
||||||
unsigned char status;
|
unsigned char status;
|
||||||
unsigned char chan; /* the channel number, quick access for channel messages */
|
unsigned char chan; /* the channel number, quick access for channel messages */
|
||||||
unsigned char key; /* the key, quick access for noteoff */
|
unsigned char key; /* the key of the noteon event, quick access for noteoff */
|
||||||
unsigned char vel; /* the velocity */
|
unsigned char vel; /* the velocity of the noteon event */
|
||||||
fluid_channel_t* channel;
|
fluid_channel_t* channel;
|
||||||
fluid_gen_t gen[GEN_LAST];
|
fluid_gen_t gen[GEN_LAST];
|
||||||
fluid_mod_t mod[FLUID_NUM_MOD];
|
fluid_mod_t mod[FLUID_NUM_MOD];
|
||||||
|
|
Loading…
Reference in a new issue