I created an oscillator with AudioKit resp. SoundpipeAudioKit and I might wish to let the consumer change the waveform at runtime. I am simply exhibiting the related elements:
let osc = DynamicOscillator(amplitude: 0)
[...]
osc.setWaveform(Desk(.sine))
The chosen waveform comes from a GroupBox that comprises a number of waveforms in an HStack. I guess this isn’t related, I am simply studying the chosen waveform right into a string, like this:
.onTapGesture {
waveForm = waveForms[index]
}
Someway AudioKit is utilizing an enum for the waveforms. Learn how to take the string worth to assign as an enum?
This doesn’t work:
osc.setWaveform(Desk(waveForm))
It returns
No precise matches in name to initator
That is the definition of “Desk”:
public class Desk: MutableCollection {
[...]
}
And this are the Enums:
/// Supported default desk sorts
public enum TableType {
/// Commonplace sine waveform
case sine
[....]
}