Class TAdBuffer

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TAdBuffer = class(TObject)

Description

TAdBuffer is class that allows you to buffer data by writing data to the end of the buffer and reading it from the beginning. TAdBuffer is not thread safe, you have to protect every function call with a critical section when using multiple threads.

Hierarchy

Overview

Methods

Public constructor Create;
Public destructor Destroy; override;
Public procedure Write(Buf: PByte; Size: Integer; Tag: Cardinal = 0);
Public function Read(Buf: PByte; Size: Integer): integer;
Public function Seek(Offset: Integer): Boolean;
Public procedure Clear;

Properties

Public property Filled: integer read FFilled;
Public property CurrentTag: Cardinal read FCurrentTag;

Description

Methods

Public constructor Create;

Creates an instance of TAdBuffer.

Public destructor Destroy; override;

Destroys the instance of TAdBuffer.

Public procedure Write(Buf: PByte; Size: Integer; Tag: Cardinal = 0);

Writes "Size"-Bytes from "Buf" to the buffer. Every write operation stores the data in a different buffer bucket. Be sure to write relatively big buffers to the buffer. The size of the written data should also not variate. The "Tag" parameter allows you to give the data a special tag. This parameter is very usefull, e.g. if you want to add the playback position to your decoded audio data that you want to store in the buffer.

Public function Read(Buf: PByte; Size: Integer): integer;

Reads data from the buffer and returns the count of bytes that were actually read.

Public function Seek(Offset: Integer): Boolean;

Seeks forward or backward in the buffer. The given value is relative to the current stream position. A negative value will make the buffer seek backwards, a positive value will make it seek forward.

Public procedure Clear;

Clears the buffer.

Properties

Public property Filled: integer read FFilled;

Returns the amount of data that is currently in the buffer.

Public property CurrentTag: Cardinal read FCurrentTag;

Current tag is the tag you specified in the write method of the last buffer bucket that was read.

SourceForge.net Logo


Generated by PasDoc 0.11.0 on 2008-12-31 14:31:58