objective c - how to write block with arg. "UnsafeMutablePointer<UnsafeMutablePointer<Float>>" in Swift closure -
please syntax:
__weak typeof (self) weakself = self; [self.audiofile getwaveformdatawithcompletionblock:^(float **waveformdata, int length) { [weakself.audioplot updatebuffer:waveformdata[0] withbuffersize:length]; }];
the waveform data array of float arrays, 1 each channel, , length indicates total length of each float array. @param waveformdata array of float arrays, each representing channel of audio data file @param length int representing length of each channel of float audio data
in swift have:
cell.audiofile.getwaveformdatawithcompletionblock { (unsafemutablepointer<unsafemutablepointer<float>>, int32) -> void }
i stuck on unsafemutablepointer>
i need use arg. in:
cell.audiowaveview.updatebuffer(buffer: unsafemutablepointer, withbuffersize: int32)
i know may old question, struggling same thing , solved:
you need pass argument block waveformdatacompletionblock closure, , parameters should unsafemutablepointer , uint32. code should this:
self.audiofile = ezaudiofile(url: self.soundfileurl) var waveclosure: waveformdatacompletionblock = { (wavefordata: unsafemutablepointer<float>, length: uint32) in //do } self.audiofile.getwaveformdatawithcompletionblock(waveclosure)
i hope useful :)
Comments
Post a Comment