hi xavier,
i tried moving the usb initialization up before the osc init but it makes no difference. but also no freezes :-)
i then tried with your static void suggestion in osc.cpp and it works! (well partially)
with:
void Osc::tune( int tuneconfig) {
float tuneFactor[] = {435.0,435.5,436.0,436.5,437.0,437.5,438.0,438.5,439.0,439.5,440.0,440.5,441.0,441.5,442.0,442.5,443.0,443.5,444.0} ;
float frecAdjust = tuneFactor[tuneconfig] / 440.0f;
for (int k=0; k<127; k++) {
midiNoteTunedFrequency[k]= frequency[k] * frecAdjust;
}
// Set frequencyToUse to frequency (no Scala scale defined)
frequencyToUse = midiNoteTunedFrequency;
}
and the corresponding declaration in the public section in osc.h i have globaltune working after reboot! yehaa! i put a call to Osc::tune in preenFM.cpp at line 145 as you suggested.
i also tried to intercept when a new value is changed in synthstate.cpp like this:
if (fullState.midiConfigValue[fullState.menuSelect] == MIDICONFIG_GLOBAL_TUNE) {
Osc::tune(this->fullState.midiConfigValue[MIDICONFIG_GLOBAL_TUNE]);
}
but i get no realtime change. maybe i am using the variable addressing wrongly? (this is the part where i am still confused,hehe) or line 1029 is not the right place?
EDIT: it is the right place, because tuning is actually changing once i am in the menu and adjust globaltune. the only problem is it is a fixed value it changes to, i'm guessing the array nr. that represents MIDICONFIG_GLOBAL_TUNE and not the actual value i am changing...
anyhow, this is already a huge step forward, so thanks heaps for your help!!