asbd
is not a pointer, but a structure. In RubyMotion that is represented by a class. The memset
is just initializing the memory of the structure to all zeros. I'm not sure if RubyMotion sets the fields to zero by default, so you could initialize each field manually like so (which is certainly more clear if a bit wordy):
asbd = AudioStreamBasicDescription.new
asbd.mSampleRate = 0.0
asbd.mFormatID = 0
asbd.mFormatFlags = 0
asbd.mBytesPerPacket = 0
asbd.mFramesPerPacket = 0
asbd.mBytesPerFrame = 0
asbd.mChannelsPerFrame = 0
asbd.mBitsPerChannel = 0
asbd.mReserved = 0
If you need a pointer to asbd
, I believe you do this:
asbd_ptr = Pointer.new(AudioStreamBasicDescription.type)
asbd_ptr[0] = asbd
So if wanted to pass &asbd
, you would pass asbd_ptr
instead.