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

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -