Trey
08/18/2023, 2:31 PMval opusOutData = allocArray<opus_int16Var>(outputLen)
// pass CArrayPointer to C library to be filled
...
// Pull the new data out of the CArrayPointer to be used?
return (0 until outputLen).map { opusOutData.get(it) }.toTypedArray()
Jeff Lockhart
08/18/2023, 3:17 PMByteArray
itself to fill in C. Then you don't need to copy the memory.
val byteArray = ByteArray(outputLen * sizeOf<opus_int16Var>())
byteArray.usePinned {
// pass it.addressOf(0).reinterpret<opus_int16Var>() to C library to be filled
}
return byteArray
Trey
08/18/2023, 3:32 PM