Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ibstream.h 3.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //-----------------------------------------------------------------------------
  2. // Project : SDK Core
  3. //
  4. // Category : SDK Core Interfaces
  5. // Filename : pluginterfaces/base/ibstream.h
  6. // Created by : Steinberg, 01/2004
  7. // Description : Interface for reading/writing streams
  8. //
  9. //-----------------------------------------------------------------------------
  10. // This file is part of a Steinberg SDK. It is subject to the license terms
  11. // in the LICENSE file found in the top-level directory of this distribution
  12. // and at www.steinberg.net/sdklicenses.
  13. // No part of the SDK, including this file, may be copied, modified, propagated,
  14. // or distributed except according to the terms contained in the LICENSE file.
  15. //-----------------------------------------------------------------------------
  16. #pragma once
  17. #include "funknown.h"
  18. namespace Steinberg {
  19. //------------------------------------------------------------------------
  20. /** Base class for streams.
  21. \ingroup pluginBase
  22. - read/write binary data from/to stream
  23. - get/set stream read-write position (read and write position is the same)
  24. */
  25. //------------------------------------------------------------------------
  26. class IBStream: public FUnknown
  27. {
  28. public:
  29. enum IStreamSeekMode
  30. {
  31. kIBSeekSet = 0, ///< set absolute seek position
  32. kIBSeekCur, ///< set seek position relative to current position
  33. kIBSeekEnd ///< set seek position relative to stream end
  34. };
  35. //------------------------------------------------------------------------
  36. /** Reads binary data from stream.
  37. \param buffer : destination buffer
  38. \param numBytes : amount of bytes to be read
  39. \param numBytesRead : result - how many bytes have been read from stream (set to 0 if this is of no interest) */
  40. virtual tresult PLUGIN_API read (void* buffer, int32 numBytes, int32* numBytesRead = 0) = 0;
  41. /** Writes binary data to stream.
  42. \param buffer : source buffer
  43. \param numBytes : amount of bytes to write
  44. \param numBytesWritten : result - how many bytes have been written to stream (set to 0 if this is of no interest) */
  45. virtual tresult PLUGIN_API write (void* buffer, int32 numBytes, int32* numBytesWritten = 0) = 0;
  46. /** Sets stream read-write position.
  47. \param pos : new stream position (dependent on mode)
  48. \param mode : value of enum IStreamSeekMode
  49. \param result : new seek position (set to 0 if this is of no interest) */
  50. virtual tresult PLUGIN_API seek (int64 pos, int32 mode, int64* result = 0) = 0;
  51. /** Gets current stream read-write position.
  52. \param pos : is assigned the current position if function succeeds */
  53. virtual tresult PLUGIN_API tell (int64* pos) = 0;
  54. //------------------------------------------------------------------------
  55. static const FUID iid;
  56. };
  57. DECLARE_CLASS_IID (IBStream, 0xC3BF6EA2, 0x30994752, 0x9B6BF990, 0x1EE33E9B)
  58. //------------------------------------------------------------------------
  59. /** Stream with a size.
  60. \ingroup pluginBase
  61. [extends IBStream] when stream type supports it (like file and memory stream) */
  62. //------------------------------------------------------------------------
  63. class ISizeableStream: public FUnknown
  64. {
  65. public:
  66. //------------------------------------------------------------------------
  67. /** Return the stream size */
  68. virtual tresult PLUGIN_API getStreamSize (int64& size) = 0;
  69. /** Set the steam size. File streams can only be resized if they are write enabled. */
  70. virtual tresult PLUGIN_API setStreamSize (int64 size) = 0;
  71. //------------------------------------------------------------------------
  72. static const FUID iid;
  73. };
  74. DECLARE_CLASS_IID (ISizeableStream, 0x04F9549E, 0xE02F4E6E, 0x87E86A87, 0x47F4E17F)
  75. //------------------------------------------------------------------------
  76. } // namespace Steinberg