I have created a slider that generates a tone. I need it to generate two tones but xcode is producing a plethora of errors any way I attempt it - is this impossible?
Here is some of the set up I'm using:
tone = AVTonePlayerUnit()
slider.value = 0.0
let format = AVAudioFormat(standardFormatWithSampleRate: tone.sampleRate, channels: 1)
print(format.sampleRate)
engine = AVAudioEngine()
engine.attachNode(tone)
let mixer = engine.mainMixerNode
engine.connect(tone, to: mixer, format: format)
do {
try engine.start()
} catch let error as NSError {
print(error)
}
EDIT:
I have solved the problem by creating a separate class for the AVTonePlyerUnit. I have a separate problem with creating a volume slider for the generator.
Aucun commentaire:
Enregistrer un commentaire