1 //----------------------------------------------------------------------------- 2 // LICENSE 3 // (c) 2004-2018, Steinberg Media Technologies GmbH, All Rights Reserved 4 // (c) 2018, Guillaume Piolat (contact@auburnsounds.com) 5 //----------------------------------------------------------------------------- 6 // 7 // This Software Development Kit is licensed under the terms of the General 8 // Public License (GPL) Version 3. 9 // 10 // Details of that license can be found at: www.gnu.org/licenses/gpl-3.0.html 11 //----------------------------------------------------------------------------- 12 module dplug.vst3.ibstream; 13 14 version(VST3): 15 16 import dplug.vst3.ftypes; 17 18 /** Base class for streams. 19 \ingroup pluginBase 20 - read/write binary data from/to stream 21 - get/set stream read-write position (read and write position is the same) 22 */ 23 interface IBStream: FUnknown 24 { 25 public: 26 nothrow: 27 @nogc: 28 29 alias IStreamSeekMode = int; 30 enum : IStreamSeekMode 31 { 32 kIBSeekSet = 0, ///< set absolute seek position 33 kIBSeekCur, ///< set seek position relative to current position 34 kIBSeekEnd ///< set seek position relative to stream end 35 } 36 37 /** Reads binary data from stream. 38 \param buffer : destination buffer 39 \param numBytes : amount of bytes to be read 40 \param numBytesRead : result - how many bytes have been read from stream (set to 0 if this is of no interest) */ 41 tresult read (void* buffer, int32 numBytes, int32* numBytesRead = null); 42 43 /** Writes binary data to stream. 44 \param buffer : source buffer 45 \param numBytes : amount of bytes to write 46 \param numBytesWritten : result - how many bytes have been written to stream (set to 0 if this is of no interest) */ 47 tresult write (void* buffer, int32 numBytes, int32* numBytesWritten = null); 48 49 /** Sets stream read-write position. 50 \param pos : new stream position (dependent on mode) 51 \param mode : value of enum IStreamSeekMode 52 \param result : new seek position (set to 0 if this is of no interest) */ 53 tresult seek (int64 pos, int32 mode, int64* result = null); 54 55 /** Gets current stream read-write position. 56 \param pos : is assigned the current position if function succeeds */ 57 tresult tell (int64* pos); 58 59 __gshared immutable TUID iid = INLINE_UID(0xC3BF6EA2, 0x30994752, 0x9B6BF990, 0x1EE33E9B); 60 } 61 62 /+ 63 /** Stream with a size. 64 \ingroup pluginBase 65 [extends IBStream] when stream type supports it (like file and memory stream) */ 66 class ISizeableStream: FUnknown 67 { 68 public: 69 70 /** Return the stream size */ 71 virtual tresult PLUGIN_API getStreamSize (int64& size) = 0; 72 /** Set the steam size. File streams can only be resized if they are write enabled. */ 73 virtual tresult PLUGIN_API setStreamSize (int64 size) = 0; 74 75 76 static const FUID iid; 77 }; 78 DECLARE_CLASS_IID (ISizeableStream, 0x04F9549E, 0xE02F4E6E, 0x87E86A87, 0x47F4E17F) 79 80 +/