Home Units Hierarchy Routines All identifiers

Class unavclWaveRiff

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unavclWaveRiff = class(unavclInOutWavePipe)

Description

Reads audio stream from a WAV file, producing PCM stream, or creates and writes new WAV file.

Usage: set fileName property to specify the file to use. Set isInput to true if you wish to read from WAV file. Set isInput to false if you wish to create and write into WAV file. Set active to true, or call the open() method to start reading or writing. Set active to false, or call the close() method to stop reading, or close the produced WAV file. Set realTime to true if you wish the stream read from WAV file will be available in real time manner.

Example reading: refer to the vcWavePlayer demo. Look for wavIn component, which is used to read the stream from WAV file. It has waveResampler as a consumer, that means read audio stream will be passed to waveResampler automatically.

Example writing: refer to the voiceRecDemo sample. Look for waveRiff component, which is a consumer of waveIn component. That means PCM stream, produced by waveIn will be passed to waveRiff automatically. In this demo waveRiff component is used to create the WAV file.

Hierarchy

Overview

Methods

Public function loadFromFile(const fileName: wString; asynchronous: bool = false): bool;
Public function loadFromStream(stream: tStream; asynchronous: bool = false): bool;
Public function saveToFile(const fileName: wString; data: pointer; size: uint; asynchronous: bool = false): bool;
Protected function applyDeviceFormat(format: PWAVEFORMATEXTENSIBLE; isSrc: bool = true): bool; override;
Protected function getFormatExchangeData(out data: pointer): uint; override;
Public procedure AfterConstruction(); override;
Protected procedure createNewDevice(); override;
Protected procedure doSetLoop(value: boolean); override;

Properties

Published property autoCloseOnDone: boolean read f_acod write f_acod default true;
Published property calcVolume;
Published property enableDataProcessing;
Published property fileName: wString read f_fileName write setFileName;
Published property formatTag;
Published property formatTagImmunable default true;
Published property isInput: boolean read f_isInput write setIsInput default true;
Published property loop;
Published property onStreamIsDone: unaOnRiffStreamIsDone read f_onStreamIsDone write f_onStreamIsDone;
Published property realTime;
Published property silenceDetectionMode;
Public property waveStream: unaRiffStream read getRiff;

Description

Methods

Public function loadFromFile(const fileName: wString; asynchronous: bool = false): bool;

Loads data from specified WAV file. If asynchronous = false (default), does not return until whole file is loaded, and closes the device after that. Otherwise returns immediately after opening the device. If autoCloseOnDone property is true (default) device will be closed automatically when reading from file is complete. Otherwise use onStreamIsDone() event to be notified when reading from file is complete.

This function sets realTime property to false and isInput property to true.

Public function loadFromStream(stream: tStream; asynchronous: bool = false): bool;

Loads data from specified stream. If asynchronous = false (default), does not return until whole file is loaded, and closes the device after that. Otherwise returns immediately after opening the device. If autoCloseOnDone property is true (default) device will be closed automatically when reading from file is complete. Otherwise use onStreamIsDone() event to be notified when reading from file is complete.

This function sets realTime property to false and isInput property to true.

Public function saveToFile(const fileName: wString; data: pointer; size: uint; asynchronous: bool = false): bool;

Saves data into specified WAV file. If asynchronous = false (default), does not return until whole data block is written, and closes the device after that. Otherwise returns immediately after opening the device and writing the data into it. Use the following code to verify if writing is complete: <CODE>if (waveStream.getDataAvailable(true) > chunkSize) then ...</CODE>

This function sets realTime and isInput properties to false.

Protected function applyDeviceFormat(format: PWAVEFORMATEXTENSIBLE; isSrc: bool = true): bool; override;

This method is supported in WAV-writing mode only (isInput = false), and only PCM formats are supported.

Protected function getFormatExchangeData(out data: pointer): uint; override;
 
Public procedure AfterConstruction(); override;

Creates Riff wave device.

Protected procedure createNewDevice(); override;

Creates Riff wave device.

Protected procedure doSetLoop(value: boolean); override;
 

Properties

Published property autoCloseOnDone: boolean read f_acod write f_acod default true;

When true, closes the device automatically when reading from file is complete.

Published property calcVolume;
 
Published property enableDataProcessing;

Specifies whether the component would produce or accept any data.

Published property fileName: wString read f_fileName write setFileName;

Specifies file to use with Riff wave device.

Published property formatTag;

Use this property to specify wave format of non-PCM WAVe files you wish to create.

Published property formatTagImmunable default true;

WaveWriter usually does not use the format tag provided by other PCM devices.

Published property isInput: boolean read f_isInput write setIsInput default true;

Specifies whether Riff wave device is used for reading or writing the audio.

Published property loop;

Specifies whether reading should continue from the start upon reaching the end of file.

Published property onStreamIsDone: unaOnRiffStreamIsDone read f_onStreamIsDone write f_onStreamIsDone;

Fired when reading from file is complete. Never fired if loop property is set to true.

Published property realTime;

Specifies whether reading and writing should be done in real time.

Published property silenceDetectionMode;
 
Public property waveStream: unaRiffStream read getRiff;

Returns Riff wave device.

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09