Index: TWaveStream | TMemoryWaveStream | TFileWaveStream | TPCMWaveReader

WaveIO for Delphi

Developed by Carlos Barbosa
email: delphi@carlosb.com
home page: http://www.carlosb.com

 

TWaveStream object

Does the reading/writing of audio files in wave format. The file can be a standard file, a memory file, or an element of a custom storage system.

PROPERTIES

Format: PWaveFormatEx;
Read-only. Returns a pointer to the format of the wave data.
Position: Longint;
Position indicates the current offset, in samples, into the data.
Size: Longint;
Read-only. Returns the data size in samples.

METHODS

constructor Create( mmIO: hmmIO; WriteFormat: PWaveFormatEx );
Use Create to instantiate a wave stream. The mmIO must have a handle to a multimedia file returned by mmioOpen. Set WriteFormat to nil if reading from an existing wave file, or to a pointer for a wave format if creating a new wave file.
function Read(var Buffer; Count: Longint): Longint;
Read reads up to Count samples of data from the file into Buffer. Returns the number of samples actually read.
function Seek(Offset: Longint; Origin: Word): Longint;
Use Seek to move the current position by the indicated offset. Seek allows an application to read from or write to a particular location within the file.
The Origin parameter indicates how to interpret the Offset parameter. Origin should be one of the following values:
SEEK_CUR - Seeks to Offset samples from the current  position.
SEEK_END - Seeks to Offset samples from the end of the file.
SEEK_SET - Seeks to Offset samples from the beginning of the file.

Returns the new file position, in samples, relative to the beginning of the file. If there is an error, the return value is - 1.
function Write(var Buffer; Count: Longint): Longint;
Write writes up to Count samples of data from Buffer into the file. Returns the number of samples actually written.

 

TMemoryWaveStream object

It's a descendant of TWaveStream. You should use this for reading/writing from memory files.

METHODS

constructor Create( Memory: Pointer; Size: Longint; WriteFormat: PWaveFormatEx );
Use Create to instantiate a wave stream for reading/writing to the Size bytes starting at the Memory position. Set WriteFormat to nil if reading from an existing wave file, or to a pointer for a wave format if creating a new wave file.

 

TFileWaveStream object

It's a descendant of TWaveStream. You should use this for reading/writing from standard files.

METHODS

constructor Create( FileName: String; WriteFormat: PWaveFormatEx );
Use Create to instantiate a wave stream for reading/writing to the FileName file. Set WriteFormat to nil for reading from an existing wave file, or otherwise for creating a new wave file with the specified format.

 

TPCMWaveReader object

Use this object in conjuction with TWaveStream for reading compressed wave files in PCM format.

PROPERTIES

BufferLength: Longint;
Defines the size, in uncompressed format, of the buffer for buffered input.
Format: PWaveFormatEx;
Read-only. Returns a pointer to the format of the PCM wave data.
Position: Longint;
Position indicates the current offset, in PCM samples, into the data for reading.
Size: Longint;
Read-only. Returns the data size in PCM samples.
Stream: TWaveStream;
Read-only. Returns the wave stream object used for reading.

METHODS

constructor Create( Stream: TWaveStream );
Use Create to instantiate a PCM wave reader. Set Stream to reference the input file.
function Read(var Buffer; Count: Longint): Longint;
Read reads up to Count PCM samples of data from the file into Buffer. Returns the number of samples actually read.

 

Back To Top