📄 tw8a32.pas
字号:
{
TurboWay语音卡常量及函数定义单元(for Delphi 4.0/Win95)
北京泰兴数据工程有限公司 陈国华
}
unit tw8a32;
interface
const
MAX_ADAPTERS=8;
MAX_CHANNELS=(8 * MAX_ADAPTERS);
FILE_FLAG=1; { For TW_PlaySentence(...) }
DTMF_LEN=32;
{ Return code for function call }
E_DRIVER = $ff; { TW8A driver not installed }
E_OK = $00; { OK }
E_COMMAND = $01; { Invalid command }
E_LENGTH = $02; { Too few buffer length }
E_PLAY_RECORD = $03; { Play/Record conflict }
E_CHANNEL = $04; { Invalid channel number }
E_INTERRUPT = $05;
{const for channel type}
CT_INTERNAL = 0; { Internal channel }
CT_EXTERNAL = 1; { External channel }
CT_EMPTY = 2; { Empty channel }
{const for compress ratio}
RATE_64K = 0;
RATE_32K = 1;
RATE_16K = 2;
RATE_8K = 3;
RATE_48K = 4;
RATE_24K = 5;
RATE_12K = 6;
RATE_6K = 7;
SIGNAL_TYPE = 8;
{ Signal type }
SIG_UNKNOWN = $60;
SIG_TIMEOUT = $61;
SIG_OFFHOOK = $62;
SIG_NOBODY = $63;
SIG_SILENCE = $40;
SIG_DIAL = $41;
SIG_RING = $00;
SIG_BUSY1 = $01;
SIG_BUSY2 = $02;
type
PCB_STRUCT = record
SilenceSigMin: word;
DialSigMin: word;
SignalPara: array[0..SIGNAL_TYPE-1,0..3] of word;
end;
PPCB_STRUCT = ^PCB_STRUCT;{parameter control block struct}
SP_STRUCT = record
MajorVer: byte;
MinorVer: byte;
IRQNo: byte;
IntrNo: byte;
PCBAddr: PPCB_STRUCT;
AdapterNum: word;
ChannelNum: word;
TW8ASeg: array[0..MAX_ADAPTERS-1] of word;
end; { System Parameter Structure }
CHAR_NAME =(
CN_END, { End of sentence(Also end of string) }
CN_NOTHING, { Do nothing }
CN_DIGIT0, CN_DIGIT1, CN_DIGIT2, CN_DIGIT3, CN_DIGIT4, { 0 - 4 }
CN_DIGIT5, CN_DIGIT6, CN_DIGIT7, CN_DIGIT8, CN_DIGIT9, { 5 - 9 }
CN_TEN, { 10 }
CN_HUNDRED, { 100 }
CN_THOUSAND, { 1,000 }
CN_10THOUSAND, { 10,000 }
CN_100MILLION, { 100,000,000 }
CN_POINT, { "." }
CN_NEGATIVE, { "-" }
CN_LAST { To be continued by YOU ! }
);
const
DllFile='tw2a.dll';
{ 初始化函数 }
function TW_Installed: WORD; stdcall;
procedure TW_Initialize; stdcall;
procedure TW_Disable; stdcall;
{ 检测及控制函数 }
function TW_ChannelType(ch: WORD): WORD; stdcall;
function TW_OffHookDetect(ch: WORD): Boolean; stdcall;
function TW_RingDetect(ch: WORD): WORD; stdcall;
procedure TW_HangUpCtrl(ch: WORD); stdcall;
procedure TW_OffHookCtrl(ch: WORD); stdcall;
procedure TW_RingCtrl(ch: WORD); stdcall;
procedure TW_PowerCtrl(ch: WORD); stdcall;
procedure TW_CompressRatio(ch: WORD); stdcall;
procedure TW_GenerateSignal(ch: WORD; chtype: WORD);stdcall;
procedure TW_GenerateRing(ch: WORD);stdcall;
procedure TW_StartMonitor(ch: WORD); stdcall;
function TW_MonitorOffHook(ch: WORD; len: WORD): Boolean; stdcall;
function TW_MonitorBusy(ch: WORD; stype: WORD; num: Cardinal): Boolean; stdcall;
procedure TW_StartTimer(ch: WORD; sec: longint);stdcall;
function TW_TimerElapsed(ch: WORD): longint;stdcall;
function TW_CheckSignal(ch: WORD; var num, len: Cardinal): WORD; stdcall;
function TW_ListenerOffHook(ch: WORD): Boolean; stdcall;
procedure TW_GetSerial(sn: Pchar); stdcall;
procedure TW_SysPara(var sp: SP_STRUCT); stdcall;
procedure TW_SetVoicei(num: integer; vs: PChar); stdcall;
procedure TW_PulseMode(md:byte);stdcall;
function TW_SetLength(NewLength:Longword):Longword;stdcall;
{ 拨号及收发DTMF码函数 }
function TW_StartDial(ch: WORD; s: PChar): Cardinal; stdcall;
function TW_StopDial(ch: WORD): Cardinal; stdcall;
function TW_DialRest(ch: WORD): Cardinal; stdcall;
procedure TW_FlushDTMF(ch: WORD); stdcall;
function TW_GetDTMFChar(ch: WORD): integer;stdcall;
function TW_GetDTMFStr(ch:WORD;s:PChar):PChar;stdcall;
{ 通道连接交换函数 }
procedure TW_ConnectChannels(ch1, ch2: WORD); stdcall;
procedure TW_DisconnectChannels(ch1, ch2: WORD); stdcall;
procedure TW_ConnectTo(ch1, ch2: WORD); stdcall;
procedure TW_Disconnect(ch: WORD); stdcall;
procedure TW_Connect3(ch1, ch2, ch3: WORD); stdcall;
procedure TW_Disconnect3(ch, ch2, ch3: WORD); stdcall;
{ 录放音函数 }
function TW_StartRecordFile(ch: WORD; filename: PChar; start, bytes: Cardinal): longint; stdcall;
function TW_RecordFileRest(ch: WORD): longint; stdcall;
function TW_StopRecordFile(ch: WORD): longint; stdcall;
function TW_StartPlayFile(ch: WORD; filename: PChar; start: Cardinal; bytes: Cardinal): longint; stdcall;
function TW_PlayFileRest(ch: WORD): longint; stdcall;
function TW_StopPlayFile(ch: WORD): longint; stdcall;
procedure TW_MakeSentence(n: double; s: PChar); stdcall;
function TW_PlaySentence(ch: WORD; s: PChar): longint; stdcall;
function TW_PlaySentenceRest(ch: WORD): longint; stdcall;
implementation
function TW_Installed; external DllFile;
procedure TW_Initialize; external DllFile;
procedure TW_Disable; external DllFile;
function TW_ChannelType; external DllFile;
function TW_OffHookDetect; external DllFile;
function TW_RingDetect; external DllFile;
procedure TW_HangUpCtrl; external DllFile;
procedure TW_OffHookCtrl; external DllFile;
procedure TW_RingCtrl; external DllFile;
procedure TW_PowerCtrl; external DllFile;
procedure TW_CompressRatio; external DllFile;
procedure TW_StartMonitor; external DllFile;
function TW_MonitorOffHook; external DllFile;
function TW_MonitorBusy; external DllFile;
procedure TW_StartTimer; external DllFile;
function TW_TimerElapsed; external DllFile;
function TW_CheckSignal; external DllFile;
function TW_ListenerOffHook; external DllFile;
procedure TW_GetSerial; external DllFile;
procedure TW_SysPara; external DllFile;
procedure TW_SetVoicei; external DllFile;
procedure TW_PulseMode; external DllFile;
function TW_SetLength; external DllFile;
function TW_StartDial; external DllFile;
function TW_StopDial; external DllFile;
function TW_DialRest; external DllFile;
procedure TW_FlushDTMF; external DllFile;
function TW_GetDTMFChar; external DllFile;
function TW_GetDTMFStr; external DllFile;
procedure TW_ConnectChannels; external DllFile;
procedure TW_DisconnectChannels; external DllFile;
procedure TW_ConnectTo; external DllFile;
procedure TW_Disconnect; external DllFile;
procedure TW_Connect3; external DllFile;
procedure TW_Disconnect3; external DllFile;
procedure TW_GenerateSignal; external DllFile;
procedure TW_GenerateRing; external DllFile;
function TW_StartRecordFile; external DllFile;
function TW_RecordFileRest; external DllFile;
function TW_StopRecordFile; external DllFile;
function TW_StartPlayFile; external DllFile;
function TW_PlayFileRest; external DllFile;
function TW_StopPlayFile; external DllFile;
procedure TW_MakeSentence; external DllFile;
function TW_PlaySentence; external DllFile;
function TW_PlaySentenceRest;external DllFile;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -