MMWAVIN.INT 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. {========================================================================}
  2. {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
  3. {========================================================================}
  4. {= All Rights Reserved =}
  5. {========================================================================}
  6. {= D 01099 Dresden = Tel.: +0351-8012255 =}
  7. {= Loewenstr.7a = info@swiftsoft.de =}
  8. {========================================================================}
  9. {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
  10. {========================================================================}
  11. {= This code is for reference purposes only and may not be copied or =}
  12. {= distributed in any format electronic or otherwise except one copy =}
  13. {= for backup purposes. =}
  14. {= =}
  15. {= No Delphi Component Kit or Component individually or in a collection=}
  16. {= subclassed or otherwise from the code in this unit, or associated =}
  17. {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
  18. {= without express permission from SwiftSoft. =}
  19. {= =}
  20. {= For more licence informations please refer to the associated =}
  21. {= HelpFile. =}
  22. {========================================================================}
  23. {= $Date: 20.01.1998 - 18:00:00 $ =}
  24. {========================================================================}
  25. unit MMWavIn;
  26. {$C FIXED PRELOAD PERMANENT}
  27. {$I COMPILER.INC}
  28. {.$DEFINE _MMDEBUG}
  29. interface
  30. uses
  31. {$IFDEF WIN32}
  32. Windows,
  33. {$ELSE}
  34. WinTypes,
  35. WinProcs,
  36. {$ENDIF}
  37. SysUtils,
  38. Messages,
  39. Classes,
  40. Graphics,
  41. Controls,
  42. Forms,
  43. Dialogs,
  44. MMSystem,
  45. MMUtils,
  46. MMObj,
  47. MMString,
  48. MMDSPObj,
  49. MMDSPMtr,
  50. MMRegs,
  51. MMPCMSup,
  52. MMWaveIO
  53. {$IFDEF _MMDEBUG}
  54. ,MMDebug
  55. {$ENDIF};
  56. {$IFDEF _MMDEBUG}
  57. {$DEFINE NUMERATE}
  58. const
  59. DEBUGLEVEL = 2; { 0,1,2 }
  60. {$ENDIF}
  61. const
  62. MAXERRORLENGTH = 255;
  63. MAXINBUFFERS = 500;
  64. MINBUFFERSIZE = 32;
  65. type
  66. EMMWaveInError = class(Exception);
  67. TMMWaveInStates = (wisClose, wisOpen, wisRecord,wisPause);
  68. TMMWaveInState = set of TMMWaveInStates;
  69. { Pointers to waveOut headers }
  70. TMMWaveInHdrs = array[0..MAXINBUFFERS-1] of PWaveHdr;
  71. {$IFDEF WIN32}
  72. TMMWaveIn = class;
  73. {-- TMMWaveOutThread ---------------------------------------------------}
  74. TMMWaveInThread = class(TMMDSPThread)
  75. {$ENDIF}
  76. {-- TMMWAVEIN ----------------------------------------------------------}
  77. TMMWaveIn = class(TMMCustomSoundComponent)
  78. public
  79. constructor Create(AOwner: TComponent); override;
  80. destructor Destroy; override;
  81. procedure Open; virtual;
  82. procedure Close; virtual;
  83. procedure Start; virtual;
  84. procedure Pause; virtual;
  85. procedure Restart; virtual;
  86. procedure Stop; virtual;
  87. function QueryDevice(DeviceID: Integer; pwfx: PWaveFormatEx): Boolean;
  88. {$IFDEF WIN32}
  89. { maybe you must syncronize anything if UseThread = True ? }
  90. procedure SynchronizeVCL(VCLProc: TThreadMethod);
  91. {$ENDIF}
  92. property Handle: THandle read FHWaveIn;
  93. property WaveInCaps: TWaveInCaps read FWaveInCaps;
  94. property Numdevs: integer read FNumdevs;
  95. property State: TMMWaveInState read FState;
  96. property DriverVersion: integer read FDriverVersion;
  97. property BytesRecorded: Longint read FBytesRecorded;
  98. property Position: Longint read GetPosition;
  99. property WaveHdrs: TMMWaveInHdrs read FWaveInHdrs;
  100. property BufferIndex: integer read FBufferIndex;
  101. published
  102. { Events }
  103. property OnOpen: TNotifyEvent read FOnOpen write FOnOpen;
  104. property OnStart: TNotifyEvent read FOnStart write FOnStart;
  105. property OnPause: TNotifyEvent read FOnPause write FOnPause;
  106. property OnRestart: TNotifyEvent read FOnRestart write FOnRestart;
  107. property OnStop: TNotifyEvent read FOnStop write FOnStop;
  108. property OnClose: TNotifyEvent read FOnClose write FOnClose;
  109. property OnBufferReady;
  110. property Output;
  111. property BufferSize;
  112. property CallBackMode: TMMCBMode read FCallBackMode write SetCallBackMode default cmWindow;
  113. property DeviceID: Integer read FDeviceID write SetDeviceID default 0;
  114. property NumBuffers: integer read FNumBuffers write SetNumBuffers default 10;
  115. property Mode: TMMMode read FMode write SetMode default mMono;
  116. property BitLength: TMMBits read FBits write SetBits default b8Bit;
  117. property SampleRate: Longint read FRate write SetSampleRate default 11025;
  118. property ProductName: String read FProductName write SetProductName stored False;
  119. property TimeFormat: TMMTimeFormats read FTimeFormat write SetTimeFormat default tfByte;
  120. end;
  121. function WaveInGetDeviceName(DeviceID: integer): String;
  122. function DeviceFullDuplex(DeviceID: integer; pwfx: PWaveFormatEx): Boolean;
  123. implementation