(if this post appears twice it's because I had the wrong return path-before,
wanted to make sure it got posted properly)

Hi guys!

I was experimenting with a friend's EWI (Electronic Wind Instrument) and
the breath controller didn't update the output volume after note on.

Anyway, I browsed the source code and decided to write a hack that changes
attenuation based on note on velocity and the controller value.
Here's what I have so far, it "works", but as you can see a lot of things
are missing, like changing voices for the current channel only, etc.

int
fluid_channel_breath_attenuation(fluid_channel_t* chan, int val)
{
    fluid_synth_t* synth;
    int i;
    int vel;
    float value;
    fluid_voice_t* voice;
    synth = chan->synth;
    for (i = 0; i < synth->polyphony; i++) {
        voice = synth->voice[i];
        vel = fluid_voice_gen_get(voice, GEN_VELOCITY);
        value = 1920.0 * (1.0 - (val - vel) / 127.0) - 960.0;
        fluid_voice_gen_set(voice, GEN_ATTENUATION, value);
        fluid_voice_update_param(voice, GEN_ATTENUATION);
    }
    return FLUID_OK;
}

Any hints on how to improve this snippet would be useful.
I'm not good with C and I just started looking at fluidsynth yesterday,
so I'm expecting a lot of useful feedback. :)

Thanks!



_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to