Home Units Hierarchy Routines All identifiers

Class unaRiffStream

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unaRiffStream = class(unaWaveSoftwareDevice)

Description

RIFF WAVE stream. Use this class to read or create RIFF WAVE files. Non-PCM files will be automatically converted to PCM format when possible. Creation of non-PCM files is also possible.

Hierarchy

Overview

Methods

Public constructor create(const fileName: wString; realTime: bool = false; loop: bool = false; acm: unaMsAcm = nil);
Public constructor createNew(const fileName: wString; const srcFormat: WAVEFORMATEX; dstFormatTag: unsigned = WAVE_FORMAT_PCM; acm: unaMsAcm = nil);
Public constructor createNewExt(const fileName: wString; srcFormat: pWAVEFORMATEXTENSIBLE; dstFormatTag: unsigned = WAVE_FORMAT_PCM; acm: unaMsAcm = nil);
Public destructor Destroy(); override;
Public function assignRIFile(const fileName: wString): int;
Public function assignRIFileWriteDst(const fileName: wString; dstFormat: pWAVEFORMATEX): int;
Public function assignRIFileWriteSrc(const fileName: wString; srcFormat: pWAVEFORMATEX; dstFormatTag: unsigned = WAVE_FORMAT_PCM): int;
Public function readData(buf: pointer; maxSize: unsigned): unsigned;
Protected function afterOpen(): MMRESULT; override;
Protected function doGetPosition(): int64; override;
Protected function doWrite(buf: pointer; size: unsigned): unsigned; override;
Protected function flush2(waitForComplete: bool = true): bool; override;
Protected function onHeaderDone(header: unaWaveHeader; wakeUpByHeaderDone: bool): bool; override;
Public procedure AfterConstruction(); override;
Public procedure passiveOpen();
Protected procedure afterClose(closeResult: MMRESULT); override;

Properties

Public property codec: unaMsAcmCodec read f_codec;
Public property factSize: unsigned read f_factSize;
Public property fileName: wString read f_fileName;
Public property fileType: int read f_fileType;
Public property loop: bool read f_loop write f_loop;
Public property mpegFrameSize: int read getMpegFS;
Public property onStreamIsDone: unaOnRiffStreamIsDone read f_onStreamIsDone write f_onStreamIsDone;
Public property status: int read f_status;
Public property streamIsDone: bool read f_streamIsDone;
Public property streamPosition: unsigned read f_streamPos write setStreamPos;
Public property streamSize: unsigned read f_streamSize;

Description

Methods

Public constructor create(const fileName: wString; realTime: bool = false; loop: bool = false; acm: unaMsAcm = nil);

Opens existing file for reading.

Public constructor createNew(const fileName: wString; const srcFormat: WAVEFORMATEX; dstFormatTag: unsigned = WAVE_FORMAT_PCM; acm: unaMsAcm = nil);

Creates new RIFF WAVE file for writing.

Public constructor createNewExt(const fileName: wString; srcFormat: pWAVEFORMATEXTENSIBLE; dstFormatTag: unsigned = WAVE_FORMAT_PCM; acm: unaMsAcm = nil);
 
Public destructor Destroy(); override;
 
Public function assignRIFile(const fileName: wString): int;

Assigns new existing file for reading.

Public function assignRIFileWriteDst(const fileName: wString; dstFormat: pWAVEFORMATEX): int;

Assigns ouput file for writing.

Public function assignRIFileWriteSrc(const fileName: wString; srcFormat: pWAVEFORMATEX; dstFormatTag: unsigned = WAVE_FORMAT_PCM): int;

Assigns ouput file for writing.

Public function readData(buf: pointer; maxSize: unsigned): unsigned;
 
Protected function afterOpen(): MMRESULT; override;
 
Protected function doGetPosition(): int64; override;

Returns current position in wav stream.

Protected function doWrite(buf: pointer; size: unsigned): unsigned; override;
 
Protected function flush2(waitForComplete: bool = true): bool; override;

Forces all awaiting data to be resampled.

Protected function onHeaderDone(header: unaWaveHeader; wakeUpByHeaderDone: bool): bool; override;
 
Public procedure AfterConstruction(); override;
 
Public procedure passiveOpen();
 
Protected procedure afterClose(closeResult: MMRESULT); override;
 

Properties

Public property codec: unaMsAcmCodec read f_codec;

Codec used for compression or decompression.

Public property factSize: unsigned read f_factSize;

Number of bytes indicated in 'fact' chunk.

Public property fileName: wString read f_fileName;

WAV file name.

Public property fileType: int read f_fileType;

Type of file (RIFF/MP3, etc), see c_unaRiffFileType_XXXX constants.

Public property loop: bool read f_loop write f_loop;

Set this property to true if you wish to loop the file reading operation from end to beginning.

Public property mpegFrameSize: int read getMpegFS;

Frame saze (in samples) of mpeg audio stream.

Public property onStreamIsDone: unaOnRiffStreamIsDone read f_onStreamIsDone write f_onStreamIsDone;

This event is fired when reading from file is done.

Public property status: int read f_status;

5 - output riff: no filename was specified 4 - output riff: cannot locate required codec format 3 - output riff: cannot locate required codec 2 - output riff: cannot create output stream 1 - output riff: OK ——- 0 - input riff: OK -1 - input riff: file is not valid RIFF -2 - input riff: file is valid RIFF file, but is not a valid WAVE file -3 - input riff: not acm was specified (but it is required for conversion) -4 - input riff: unknown driver (cannot locate MS ACM codec) -5 - input riff: unknown format (for selected MS ACM codec) $0FFFFFFF - no init

Public property streamIsDone: bool read f_streamIsDone;

True when no more data can be read from stream (and loop = false).

Public property streamPosition: unsigned read f_streamPos write setStreamPos;

Current position in WAVe stream in bytes.

Public property streamSize: unsigned read f_streamSize;

WAVe stream size in bytes.

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09