| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- {========================================================================}
- {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
- {========================================================================}
- {= All Rights Reserved =}
- {========================================================================}
- {= D 01099 Dresden = Tel.: +0351-8012255 =}
- {= Loewenstr.7a = info@swiftsoft.de =}
- {========================================================================}
- {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
- {========================================================================}
- {= This code is for reference purposes only and may not be copied or =}
- {= distributed in any format electronic or otherwise except one copy =}
- {= for backup purposes. =}
- {= =}
- {= No Delphi Component Kit or Component individually or in a collection=}
- {= subclassed or otherwise from the code in this unit, or associated =}
- {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
- {= without express permission from SwiftSoft. =}
- {= =}
- {= For more licence informations please refer to the associated =}
- {= HelpFile. =}
- {========================================================================}
- {= $Date: 20.01.1998 - 18:00:00 $ =}
- {========================================================================}
- unit MMWavIn;
- {$C FIXED PRELOAD PERMANENT}
- {$I COMPILER.INC}
- {.$DEFINE _MMDEBUG}
- interface
- uses
- {$IFDEF WIN32}
- Windows,
- {$ELSE}
- WinTypes,
- WinProcs,
- {$ENDIF}
- SysUtils,
- Messages,
- Classes,
- Graphics,
- Controls,
- Forms,
- Dialogs,
- MMSystem,
- MMUtils,
- MMObj,
- MMString,
- MMDSPObj,
- MMDSPMtr,
- MMRegs,
- MMPCMSup,
- MMWaveIO
- {$IFDEF _MMDEBUG}
- ,MMDebug
- {$ENDIF};
- {$IFDEF _MMDEBUG}
- {$DEFINE NUMERATE}
- const
- DEBUGLEVEL = 2; { 0,1,2 }
- {$ENDIF}
- const
- MAXERRORLENGTH = 255;
- MAXINBUFFERS = 500;
- MINBUFFERSIZE = 32;
- type
- EMMWaveInError = class(Exception);
- TMMWaveInStates = (wisClose, wisOpen, wisRecord,wisPause);
- TMMWaveInState = set of TMMWaveInStates;
- { Pointers to waveOut headers }
- TMMWaveInHdrs = array[0..MAXINBUFFERS-1] of PWaveHdr;
- {$IFDEF WIN32}
- TMMWaveIn = class;
- {-- TMMWaveOutThread ---------------------------------------------------}
- TMMWaveInThread = class(TMMDSPThread)
- {$ENDIF}
- {-- TMMWAVEIN ----------------------------------------------------------}
- TMMWaveIn = class(TMMCustomSoundComponent)
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- procedure Open; virtual;
- procedure Close; virtual;
- procedure Start; virtual;
- procedure Pause; virtual;
- procedure Restart; virtual;
- procedure Stop; virtual;
- function QueryDevice(DeviceID: Integer; pwfx: PWaveFormatEx): Boolean;
- {$IFDEF WIN32}
- { maybe you must syncronize anything if UseThread = True ? }
- procedure SynchronizeVCL(VCLProc: TThreadMethod);
- {$ENDIF}
- property Handle: THandle read FHWaveIn;
- property WaveInCaps: TWaveInCaps read FWaveInCaps;
- property Numdevs: integer read FNumdevs;
- property State: TMMWaveInState read FState;
- property DriverVersion: integer read FDriverVersion;
- property BytesRecorded: Longint read FBytesRecorded;
- property Position: Longint read GetPosition;
- property WaveHdrs: TMMWaveInHdrs read FWaveInHdrs;
- property BufferIndex: integer read FBufferIndex;
- published
- { Events }
- property OnOpen: TNotifyEvent read FOnOpen write FOnOpen;
- property OnStart: TNotifyEvent read FOnStart write FOnStart;
- property OnPause: TNotifyEvent read FOnPause write FOnPause;
- property OnRestart: TNotifyEvent read FOnRestart write FOnRestart;
- property OnStop: TNotifyEvent read FOnStop write FOnStop;
- property OnClose: TNotifyEvent read FOnClose write FOnClose;
- property OnBufferReady;
- property Output;
- property BufferSize;
- property CallBackMode: TMMCBMode read FCallBackMode write SetCallBackMode default cmWindow;
- property DeviceID: Integer read FDeviceID write SetDeviceID default 0;
- property NumBuffers: integer read FNumBuffers write SetNumBuffers default 10;
- property Mode: TMMMode read FMode write SetMode default mMono;
- property BitLength: TMMBits read FBits write SetBits default b8Bit;
- property SampleRate: Longint read FRate write SetSampleRate default 11025;
- property ProductName: String read FProductName write SetProductName stored False;
- property TimeFormat: TMMTimeFormats read FTimeFormat write SetTimeFormat default tfByte;
- end;
- function WaveInGetDeviceName(DeviceID: integer): String;
- function DeviceFullDuplex(DeviceID: integer; pwfx: PWaveFormatEx): Boolean;
- implementation
|