double tuningcents[128];
::fluid_synth_tuning_dump(m_pSynth, tuningBank, tuningProg, NULL, 0,
tuningcents);

Will work, because every c-array can decay to a pointer. You dont need
double* pTuningcents.

Basically you're missing one important thing: checking the return values!
And I bet it returns FLUID_FAILED. Why? Because you must first activate
some kind of tuning via
- fluid_synth_activate_tuning() or
- fluid_synth_activate_key_tuning() or
- fluid_synth_tune_notes() or
- fluid_synth_select_tuning()

that I dont see anywhere. The tuningBank and tuningProg you then request
from fluid_synth_tuning_dump() must be the same as you used in these
previous activation calls.


> "tuningcents" & "pTuningcents" are member variables of the "
qsynthTuningsForm" class.  Should they be public, private, or protected?

protected if you want to inherit "qsynthTuningsForm" and override "
qsynthTuningsForm::updateAllKeyTunings()". You probably dont want to, so
tuningcents should be private.


> Should "fluid_synth_tuning_dump" be a friend function to this class?

No. "fluid_synth_tuning_dump" is a plain old C function that is public to
everyone and everything.


Tom


2017-09-22 5:16 GMT+02:00 Liam McGillivray <liammcgillivra...@gmail.com>:

> I have a fork of QSynth on GitHub, in which I'm trying to add a menu for
> retuning notes.
>
> https://github.com/LiamM32/qsynth
>
> I am not experienced in programming or good at C/C++, so bear with me.
>
> First I'm trying to make it display the current values of each note, but I
> can't get the function "fluid_synth_tuning_dump" to work.  In the image I
> attached, you can see the strange numbers in the "detune" column, which are
> supposed to be set to the pitch of each note in cents.  Through a debugger,
> I have found that these are the default values from when the array was
> initialized (don't know why).  The function isn't actually modifying the
> values in this array as it's supposed to.
>
> Maybe I'm not properly passing the array into the function.  I used to
> simply pass the array into the function like this, back when I had a worse
> understanding of C++. (I shelved this project a while ago, but returned to
> it recently.)
>
> double tuningcents[128];
> ::fluid_synth_tuning_dump(m_pSynth, tuningBank, tuningProg, NULL, 0,
> tuningcents);
>
> This didn't work.  But looking at it now, I notice that the last parameter
> is supposed to be a pointer to a double.  So I changed it to this:
>
> double tuningcents[128];
> double* pTuningcents = tuningcents;
> ::fluid_synth_tuning_dump(m_pSynth, tuningBank, tuningProg, NULL, 0,
> pTuningcents);
>
> But it's still not changing the values in the "tuningcents" array.  You
> can see the exact lines I wrote in *qSynthTuningsForm.cpp
> <https://github.com/LiamM32/qsynth/blob/master/src/qsynthTuningsForm.cpp> *in
> function "qsynthTuningsForm::updateAllKeyTunings()".
>
> "tuningcents" & "pTuningcents" are member variables of the "
> qsynthTuningsForm" class.  Should they be public, private, or protected?
> Should "fluid_synth_tuning_dump" be a friend function to this class?
>
>
> _______________________________________________
> fluid-dev mailing list
> fluid-dev@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/fluid-dev
>
>
_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to