Reputation: 7316
I have an existing ByteArray in AS3 which I want to process (read and write) in Alchemy. All the examples I've seen of how to do this involve either using stream functions (fread, fwrite, etc), or copying the ByteArray data first into another buffer before using it.
Is there a way to directly access a ByteArray's memory in C/alchemy, without any intermediary?
My assumption is that using stream functions won't be as efficient as directly writing to memory.
Edit: My friend raises a good point. Is it possible that ByteArray data isn't necessarily physically contiguous in memory? In which case it'd be a bit of a nightmare wrangling with Adobe's proprietary memory format. Anyone know either way?
Upvotes: 2
Views: 834
Reputation: 6563
The ByteArray isn't part of Alchemy's RAM. So the only way to access it is via AS3 functions. However, you could copy the ByteArray data into Alchemy's RAM (which is itself a ByteArray). Then you could access the copied data via a pointer.
See this SO question for some techniques on how to do it.
Upvotes: 1
Reputation: 1800
You can use AS3_ByteArray_seek, AS3_ByteArray_readBytes and AS3_ByteArray_writeBytes C Alchemy API functions.
Upvotes: 0