I'm writing data to an Indy IOHandler by moving the data from a TMemoryStream.Memory to a TIDBytes (array of byte) before writing it as I cannot find how to do it otherwise.
This works... AudioMS: TMemoryStream; Buffer: TIdBytes; // array of byte MemPos: PByte; .... MemPos := AudioMS.Memory; Inc(MemPos,FromPos); ToPos := Player.AudioMS.Position; SetLength(Buffer,ToPos-FromPos); Move(MemPos^,Buffer[0],Length(Buffer)); IOHandler.WriteDirect(Buffer); FromPos := ToPos; But there has to be a better way of writing direct from the AudioMS.Memory and getting rid of the Move operation. I've tried the following but produces pointer errors or access violations. IOHandler.WriteDirect(TIdBytes(MemPos),ToPos-FromPos); Also tried... IOHandler.WriteDirect(TIdBytes(MemPos^),ToPos-FromPos); There is a IOHandler.Write function that supports TStream but the memory stream is being appended to in a separate thread so I can't go changing the Position I want to access the data from. How should it be done? Cheers, Ross.
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@listserver.123.net.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@listserver.123.net.nz with Subject: unsubscribe