ios - AudioUnitSetProperty Swift errors -


i trying set bands in equalizer using audiounitsetproperty cant figure out syntax in swift. code looks this:

var eqfrequencies: nsarray = [ 32, 250, 500, 1000, 2000, 16000 ]     var nobands = uint32(eqfrequencies.count)  audiounitsetproperty(self.myappunit, audiounitparameterid(kaunbandeqproperty_numberofbands), audiounitscope(kaudiounitscope_global), 0, 6, uint32(sizeof(nobands))) 

anyone know correct way of doing this?

try (compiles me in xcode 6.3):

    var eqfrequencies: [uint32] = [ 32, 250, 500, 1000, 2000, 16000 ]      audiounitsetproperty(         self.myappunit,         audiounitpropertyid(kaunbandeqproperty_numberofbands),         audiounitscope(kaudiounitscope_global),         0,         eqfrequencies,         uint32(eqfrequencies.count*sizeof(uint32))     ) 

swift griped various int types, hence casts, , size calculation wrong, band swift array of uint32s (not nsarray) should convert automatically unsafepointer<void>.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -