Wave
Audio Package v1.02
|
Copyright ©
Kambiz R. Khojasteh. All rights reserved.
Get future package updates from http://www.delphiarea.com.
Delphi 3 | Delphi 4 | Delphi 5 | Delphi 6 | Delphi 7 |
The Wave Audio Package provides seven components for playing and recording of wave audio formats, two components for storing wave data as Delphi resources, and one high resolution multimedia timer. The package has also a set of useful utility functions for working with wave audio formats.
The package's components are:
Although for using the components available in the Wave Audio package, you do not know to know about the details, however for some low level descriptions I've supposed you are familiar with Microsoft Multimedia terminology and API. To know more about details you can study "Microsoft Multimedia Programmer's Reference".
TPCMChannel
= (cMono, cStereo) |
TPCMSamplesPerSec
= (ss8000Hz, ss11025Hz, ss22050Hz, ss44100Hz); |
TPCMBitsPerSample
= (bs8Bit, bs16Bit); |
TWaveDeviceFormats
= set of TPCMFormat; |
TWaveOutDeviceSupport
= (dsVolume, dsStereoVolume, dsPitch, dsPlaybackRate, dsPosition,
dsAsynchronize, dsDirectSound);
|
TWaveOutDeviceSupports
= set of TWaveOutDeviceSupport; |
TWaveOutOption
= (woSetVolume, woSetPitch, woSetPlaybackRate);
|
TWaveOutOptions
= set of TWaveOutOption; |
TMS2StrFormat
= (msHMSh, msHMS, msMSh, msMS, msSh, msS, msAh, msA);
|
TWaveAudioEvent
= procedure(Sender: TObject) of object; |
TWaveAudioGetFormatEvent
= procedure(Sender: TObject; var pWaveFormat: PWaveFormatEx; var FreeIt:
Boolean) of object; |
TWaveAudioGetDataEvent
= function(Sender: TObject; const Buffer: Pointer; BufferSize: DWORD;
var NumLoops: DWORD): DWORD of object; |
TWaveAudioGetDataPtrEvent
= function(Sender: TObject; var Buffer: Pointer; var NumLoops: DWORD;
var FreeIt: Boolean): DWORD of object; |
TWaveAudioDataReadyEvent
= procedure(Sender: TObject; const Buffer: Pointer; BufferSize: DWORD;
var FreeIt: Boolean) of object; This event is used for wave audio events that informs the caller about the recorded wave audio data. The wave data stored in buffer specified by the Buffer parameter, and the size of the actual data in the buffer is specified by the BufferSize parameter. If the FreeIt parameter set to True, the component will automatically free the memory allocated for buffer. |
EWaveAudioError
= class(Exception) This class is the base exception class for wave audio exceptions. |
EWaveAudioSysError
= class(EWaveAudioError) This exception is raised if the operating system returns an error code for a wave audio device. The exception dialog contains the system message associated with the error. |
EWaveAudioInvalidOperation
= class(EWaveAudioError) This exception is raised if the when a component receives a request for an invalid operation. For example, if an application attempts to open an already open wave audio device, or change its wave format an EWaveAudioInvalidOperation exception is raised. |
TWave
= class(TMemoryStream);
|
TCustomWaveStorage
= class(TComponent);
(Abstract)
|
TWaveStorage
= class(TCustomWaveStorage);
|
TWaveCollection
= class(TCustomWaveStorage);
|
TWaveItems
= class(TCollection);
|
TWaveItem
= class(TCollectionItem);
|
TWaveAudioIO
= class(TComponent);
(Abstract)
|
TWaveAudioOut
= class(TWaveAudioIO);
(Abstract)
|
TWaveAudioIn
= class(TWaveAudioIO);
(Abstract)
|
TAudioPlayer
= class(TWaveAudioOut);
|
TStockAudioPlayer
= class(TWaveAudioOut);
|
TLiveAudioPlayer
= class(TWaveAudioOut);
|
TAudioRecorder
= class(TWaveAudioIn);
|
TStockAudioRecorder
= class(TWaveAudioIn);
|
TLiveAudioRecorder
= class(TWaveAudioIn);
|
TAudioRedirector
= class(TComponent);
|
TAudioIn
= class(TWaveAudioIn);
|
TAudioOut
= class(TWaveAudioOut);
|
TMultimediaTimer
= class(TComponent);
|
function
GetWaveAudioInfo(mmIO: HMMIO; var pWaveFormat: PWaveFormatEx; var
DataSize, DataOffset: DWORD): Boolean; |
function
GetStreamWaveAudioInfo(Stream: TStream; var pWaveFormat: PWaveFormatEx;
var DataSize, DataOffset: DWORD): Boolean; |
function
CreateWaveAudioInfo(mmIO: HMMIO; pWaveFormat: PWaveFormatEx; var ckRIFF,
ckData: TMMCKInfo): Boolean; Initializes a wave RIFF format in an open mmIO handle. |
function
CreateStreamWaveAudioInfo(Stream: TStream; pWaveFormat: PWaveFormatEx;
var ckRIFF, ckData: TMMCKInfo): HMMIO; |
function
GetWaveAudioFormat(pWaveFormat: PWaveFormatEx): String; Returns the string representation of a wave audio format. |
function
GetWaveAudioLength(pWaveFormat: PWaveFormatEx; DataSize: DWORD): DWORD; Returns the wave's length in milliseconds. |
function
GetWaveAudioBitRate(pWaveFormat: PWaveFormatEx): DWORD; Returns the wave's bit rate in kbps (kilo bit per socond). |
procedure
SetPCMAudioFormat(pWaveFormat: PWaveFormatEx; Channels: TPCMChannel;
SamplesPerSec: TPCMSamplesPerSec; BitsPerSample:
TPCMBitsPerSample); Initializes a standard PCM wave format header. The size of memory referenced by the pWaveFormat parameter must not be less than the size of TWaveFormatEx record. |
procedure
SetPCMAudioFormatS(pWaveFormat: PWaveFormatEx; PCMFormat: TPCMFormat); Initializes a standard PCM wave format header (shorcut form). The size of memory referenced by the pWaveFormat parameter must not be less than the size of TWaveFormatEx record. |
function
GetPCMAudioFormat(pWaveFormat: PWaveFormatEx): TPCMFormat; Returns the standard PCM format specifier of a wave format. |
function
MS2Str(Milliseconds: DWORD; Fmt: TMS2StrFormat):
String; |
function
mmioStreamProc(lpmmIOInfo: PMMIOInfo; uMsg, lParam1, lParam2: DWORD):
LRESULT; stdcall; User defined mmIOProc to handle Delphi streams by Windows' mmIO API functions. To open a stream using mmIO API functions, use the following code as sample: FillChar(mmioInfo, SizeOf(mmioInfo), 0); mmioInfo.pIOProc := @mmioStreamProc; mmioInfo.adwInfo[0] := DWORD(your_stream_instance); mmIO := mmioOpen(nil, @mmioInfo, dwOpenFlags); The flags specified by the dwOpenFlags parameter of mmioOpen function can be only one of MMIO_READ, MMIO_WRITE, and MMIO_READWRITE flags. If you use another flags, simply they will be ignored by this user defined function. |
The Wave Audio Package is freeware. You may copy package's files AS LONG AS YOU COPY ALL OF THEM. If you want to change the source code in order to improve the components' features, performance, etc. please send me the new source code so that I can have a look at it. The changed source code should contain descriptions what you have changed, and of course your name. The only thing you MAY NOT CHANGE is the ORIGINAL COPYRIGHT INFORMATION.
The Wave Audio Package is provided "AS IS" without any warranty of any kind, either express or implied. The entire risk as to the quality and performance of the software is with you. The author is NOT liable for any DAMAGES resulting from the use and misuse of the package, especially he is NOT liable for DAMAGES that were caused BY ANY VERSION WHICH HAS NOT BEEN PROGRAMMED BY THE AUTHOR HIMSELF.
|
END OF DOCUMENT |