add more getters for fluid_voice_t to public API

for channel, key and velocity
This commit is contained in:
derselbst 2017-08-13 15:08:22 +02:00
parent 84095fead8
commit 712ce4b935
4 changed files with 37 additions and 6 deletions

View file

@ -54,6 +54,9 @@ FLUIDSYNTH_API void fluid_voice_gen_incr(fluid_voice_t* voice, int gen, float va
FLUIDSYNTH_API unsigned int fluid_voice_get_id(fluid_voice_t* voice);
FLUIDSYNTH_API int fluid_voice_is_playing(fluid_voice_t* voice);
FLUIDSYNTH_API int fluid_voice_get_channel(fluid_voice_t* voice);
FLUIDSYNTH_API int fluid_voice_get_key(fluid_voice_t* voice);
FLUIDSYNTH_API int fluid_voice_get_velocity(fluid_voice_t* voice);
FLUIDSYNTH_API int fluid_voice_optimize_sample(fluid_sample_t* s);

View file

@ -3678,7 +3678,7 @@ fluid_synth_get_channel_info (fluid_synth_t *synth, int chan,
}
/**
* Get list of voices.
* Get list of currently playing voices.
* @param synth FluidSynth instance
* @param buf Array to store voices to (NULL terminated if not filled completely)
* @param bufsize Count of indexes in buf

View file

@ -1403,6 +1403,39 @@ int fluid_voice_is_playing(fluid_voice_t* voice)
return _PLAYING(voice);
}
/**
* If the voice is playing gets the midi channel the voice is playing on. Else the result is undefined.
* @param voice Voice instance
* @return The channel assigned to this voice
* @since 1.1.7
*/
int fluid_voice_get_channel(fluid_voice_t* voice)
{
return voice->chan;
}
/**
* If the voice is playing gets the midi key the voice is playing on. Else the result is undefined.
* @param voice Voice instance
* @return The midi key assigned to this voice
* @since 1.1.7
*/
int fluid_voice_get_key(fluid_voice_t* voice)
{
return voice->key;
}
/**
* If the voice is playing gets the midi velocity the voice is playing at. Else the result is undefined.
* @param voice Voice instance
* @return The midi velocity assigned to this voice
* @since 1.1.7
*/
int fluid_voice_get_velocity(fluid_voice_t* voice)
{
return voice->vel;
}
/*
* fluid_voice_get_lower_boundary_for_attenuation
*

View file

@ -184,12 +184,7 @@ fluid_voice_unlock_rvoice(fluid_voice_t* voice)
}
#define fluid_voice_get_channel(voice) ((voice)->channel)
#define fluid_voice_set_id(_voice, _id) { (_voice)->id = (_id); }
#define fluid_voice_get_chan(_voice) (_voice)->chan
#define _PLAYING(voice) (((voice)->status == FLUID_VOICE_ON) || \
_SUSTAINED(voice) || \