home *** CD-ROM | disk | FTP | other *** search
/ ftp.muug.mb.ca / 2014.06.ftp.muug.mb.ca.tar / ftp.muug.mb.ca / pub / openh323.tar.gz / openh323.tar / openh323 / include / ixjDefs.h < prev    next >
C/C++ Source or Header  |  2002-03-21  |  40KB  |  902 lines

  1. /*
  2.     ixjDefs.h
  3.  
  4.     Copyright (c) 1996-1998, Quicknet Technologies, Inc.
  5.     All Rights Reserved.
  6.  
  7.     Internet PhoneJACK, Internet LineJACK, etc. definitions.
  8.  
  9.     -----------------------------------------------------------------
  10.  
  11.     $Header: /cvsroot/openh323/openh323/include/ixjDefs.h,v 1.4 2002/03/21 21:21:10 craigs Exp $
  12.  
  13.   $Log: ixjDefs.h,v $
  14.   Revision 1.4  2002/03/21 21:21:10  craigs
  15.   Move idb stuff to separate file
  16.  
  17.     
  18. */
  19.  
  20. #ifndef _IXJDEFS_H
  21. #define _IXJDEFS_H
  22.  
  23. #include <ixjIdb.h>
  24.  
  25. //==========================================================================
  26. //==========================================================================
  27. //
  28. //    Constants and structures for Quicknet's Internet PhoneJACK and
  29. //    Internet LineJACK cards.
  30. //
  31. //==========================================================================
  32.  
  33. //------------------------------------------------
  34. //    Plug and Play IDs
  35. //------------------------------------------------
  36. #define MODEL_INTERNET_PHONEJACK        0x0100
  37. #define MODEL_INTERNET_BLACKJACK        0x0200
  38. #define MODEL_INTERNET_LINEJACK            0x0300
  39. #define MODEL_INTERNET_PHONEJACK_LITE    0x0400
  40. #define MODEL_INTERNET_PHONEJACK_PCI    0x0500
  41. #define MODEL_INTERNET_PHONEJACK_TJPCI    0x0501
  42. #define MODEL_INTERNET_PHONECARD        0x0600
  43.  
  44. //--------------------------------------------------------------------------
  45. //    Codec support
  46. //--------------------------------------------------------------------------
  47. //
  48. #define CODEC_RATE_4000Hz  4000
  49. #define CODEC_RATE_5500Hz  5500
  50. #define CODEC_RATE_6000Hz  6000
  51. #define CODEC_RATE_7333Hz  7333
  52. #define CODEC_RATE_8000Hz  8000
  53. #define CODEC_RATE_11025Hz 11025
  54. #define CODEC_RATE_16000Hz 16000
  55. #define CODEC_RATE_22050Hz 22050
  56. #define CODEC_RATE_32000Hz 32000
  57. #define CODEC_RATE_33075Hz 33075
  58. #define CODEC_RATE_44100Hz 44100
  59. #define CODEC_RATE_48000Hz 48000
  60.  
  61. #define OLD_CODEC_RATE_4000Hz  1000
  62. #define OLD_CODEC_RATE_5500Hz  1010
  63. #define OLD_CODEC_RATE_6000Hz  1020
  64. #define OLD_CODEC_RATE_7333Hz  1030
  65. #define OLD_CODEC_RATE_8000Hz  1040
  66. #define OLD_CODEC_RATE_11025Hz 1050
  67. #define OLD_CODEC_RATE_16000Hz 1060
  68. #define OLD_CODEC_RATE_22050Hz 1070
  69. #define OLD_CODEC_RATE_32000Hz 1080
  70. #define OLD_CODEC_RATE_33075Hz 1090
  71. #define OLD_CODEC_RATE_44100Hz 1100
  72. #define OLD_CODEC_RATE_48000Hz 1110
  73.  
  74. //    XTAL = 3.8912 MHz
  75. //    Clock = 10*XTAL = 38.912 MHz
  76. //
  77. //    Rules:
  78. //        SCLK = Clock/(N+1)
  79. //        FSYNC = SCLK/(M+1)
  80. //
  81. //        4 <= (N+1) <= 32
  82. //        For 8-bit Codec:  SCLK >= 16*FSYNC
  83. //        For 16-bit Codec: SCLK >= 32*FSYNC
  84. //
  85. //    8Khz Playback/Record:
  86. //        SCLK = Clock/( 18+1) = 2.048 MHz
  87. //        FSYNC = SCLK/(255+1) =  8000 Hz ( 8,000.0 Hz =   8,000 Hz standard + 0%)
  88. //    11Khz Playback/Record:
  89. //        SCLK = Clock/( 13+1) = 2.779 MHz
  90. //        FSYNC = SCLK/(251+1) =  11025 Hz (11,029.5 Hz = 11,025 Hz standard + -0.04%)
  91. //    22Khz Playback/Record:
  92. //        SCLK = Clock/( 9+1)  = 3.8912 MHz
  93. //        FSYNC = SCLK/(175+1) =  22050 Hz (22,109.1 Hz = 22,050 Hz standard + ?.?%) +59.1
  94. //
  95. //        SCLK = Clock/( 13+1) = 2.779 MHz
  96. //        FSYNC = SCLK/(125+1) =  22050 Hz (22,059.0 Hz = 22,050 Hz standard + ?.?%) 
  97. //
  98.  
  99. //    XTAL = 3.8912 MHz
  100. //    Clock = 10*XTAL = 38.912 MHz
  101. //
  102. //    SCLK = Clock/( 18+1) = 2.048 MHz
  103. //    FSYNC = SCLK/(371+1) =  5505 Hz ( 5,505.4 Hz =  5,500 Hz standard + x%)
  104. //    FSYNC = SCLK/(340+1) =  6006 Hz ( 6,005.9 Hz =  6,000 Hz standard + x%)
  105. //    FSYNC = SCLK/(278+1) =  7341 Hz ( 7,340.5 Hz =  7,333 Hz standard + x%)
  106. //    FSYNC = SCLK/(255+1) =  8000 Hz ( 8,000.0 Hz =  8,000 Hz standard + 0%)
  107. //    FSYNC = SCLK/(127+1) = 16000 Hz (16,000.0 Hz = 16,000 Hz standard + 0%)
  108. //    FSYNC = SCLK/( 63+1) = 32000 Hz (32,000.0 Hz = 32,000 Hz standard + 0%)
  109. //    FSYNC = SCLK/( 61+1) = 33032 Hz (33,032.3 Hz = 33,075 Hz standard + x%)
  110. //    FSYNC = SCLK/( 45+1) = 44522 Hz (44,521.7 Hz = 44,100 Hz standard + x%)
  111. //    FSYNC = SCLK/( 42+1) = 47628 Hz (47,627.9 Hz = 48,000 Hz standard - x%)
  112.  
  113. //    Selects: Sets the division factor used to divide the SCLK clock to generate FSYNC.
  114. #define CODEC_FSYNC_RATE_371 371
  115. #define CODEC_FSYNC_RATE_340 340
  116. #define CODEC_FSYNC_RATE_278 278
  117. #define CODEC_FSYNC_RATE_255 255
  118. #define CODEC_FSYNC_RATE_251 251
  119. #define CODEC_FSYNC_RATE_185 185
  120. #define CODEC_FSYNC_RATE_175 175
  121. #define CODEC_FSYNC_RATE_127 127
  122. #define CODEC_FSYNC_RATE_125 125
  123. #define CODEC_FSYNC_RATE_92   92
  124. #define CODEC_FSYNC_RATE_63   63
  125. #define CODEC_FSYNC_RATE_61   61
  126. #define CODEC_FSYNC_RATE_45   45
  127. #define CODEC_FSYNC_RATE_42   42
  128.  
  129. //    Selects: Sets the division factor used to divide the main CT8020 clock to generate SCLK.
  130. #define CODEC_CO_RATE_9 9
  131. #define CODEC_CO_RATE_13 13
  132. #define CODEC_CO_RATE_19 19
  133. #define CODEC_CO_RATE_18 18
  134.  
  135. const WORD CODEC_WIDTH_8BIT  = 0;    //    Selects 8-bit Mu-law codec.
  136. const WORD CODEC_WIDTH_16BIT = 1;    //    Selects 16-bit linear codec.
  137.  
  138. const WORD CODEC_LAW_MULAW = 0;    //    Selects external Mu-law codec.
  139.  
  140. const WORD CODEC_MASTER_SLAVE  = 0;    //    Selects save mode (FSYNC and SCLK are inputs - default after reset).
  141. const WORD CODEC_MASTER_MASTER = 1;    //    Selects master mode (FSYNC and SCLK are outputs).
  142.  
  143. const WORD CODEC_LONG_SHORTFRAME = 0;    //    Selects short frame sync mode when WIDE=0.
  144. const WORD CODEC_LONG_LONGFRAME  = 1;    //    Selects long frame sync mode when WIDE=1.
  145.  
  146. const WORD CODEC_OUTPUT_CODEC_DEFAULT = 0;    //    Selects: default output codec routing.
  147. const WORD CODEC_OUTPUT_CODEC_CODEC1  = 1;    //    Selects: output signal goes to codec 1 only.
  148. const WORD CODEC_OUTPUT_CODEC_CODEC0  = 2;    //    Selects: output signal goes to codec 0 only.
  149. const WORD CODEC_OUTPUT_CODEC_BOTH    = 3;    //    Selects: output signal goes to both codec 0 and codec 1.
  150.  
  151. const WORD CODEC_INPUT_CODEC_NORMAL   = 0;    //    Selects: normal input codec routing.
  152. const WORD CODEC_INPUT_CODEC_EXCHANGE = 1;    //    Selects: input from codec 0 and codec 1 exchanged.
  153.  
  154. const WORD CODEC_SET_RATE_NOACTION = 0;    //    Selects: no action.
  155. const WORD CODEC_SET_RATE_NEXTCMD  = 1;    //    Selects: next command word programs codec sample rate dividers.
  156.  
  157. const WORD CODEC_WIDE_1SCLK      = 0;        //    Selects: FSYNC is 1 SCLK period wide.
  158. const WORD CODEC_WIDE_8OR16SCLKS = 1;        //    Selects: FSYNC is 8 SCLK periods wide if Width=0 or 16 SCLK periods wide if Width=1.
  159.  
  160. const DWORD XTAL_38912 = 3891200;
  161. const DWORD XTAL_4000 = 4000000;
  162. const DWORD XTAL_4096 = 4096000;
  163.  
  164. const DWORD SCLK_2048 = 2048000;
  165. const DWORD SCLK_512 = 512000;
  166. const DWORD SCLK_1024 = 1024000;
  167. const DWORD SCLK_2000 = 2000000;
  168. const DWORD SCLK_MAX = 1835008; // 300373; // 2097152; // 2095600;
  169.  
  170. //==========================================================================
  171. //--------------------------------------------------------------------------
  172. //    Compression/Decompression support
  173. //--------------------------------------------------------------------------
  174. //
  175. #define COMPRESS_MODE_TRUESPEECH  0    //    Selects: TrueSpeech 8.5, 6.3, 5.3, 4.8 or 4.1 Kbps
  176. #define COMPRESS_MODE_ULAW        2    //    Selects: 64 Kbit/sec U-law PCM
  177. #define COMPRESS_MODE_16LINEAR    6    //    Selects: 128 Kbit/sec 16-bit linear
  178. #define COMPRESS_MODE_8LINEAR     4    //    Selects: 64 Kbit/sec 8-bit signed linear
  179. #define COMPRESS_MODE_8LINEAR_WSS 5    //    Selects: 64 Kbit/sec WSS 8-bit unsigned linear
  180.  
  181. //    TrueSpeech compress modes: 8.5 - 4.1
  182. #define COMPRESS_RATE_TS85 0    //    Selects TrueSpeech 8.5 play mode.
  183. #define COMPRESS_RATE_TS63 1    //    Selects TrueSpeech 6.3 play mode.
  184. #define COMPRESS_RATE_TS53 2    //    Selects TrueSpeech 5.3 play mode.
  185. #define COMPRESS_RATE_TS48 3    //    Selects TrueSpeech 4.8 play mode.
  186. #define COMPRESS_RATE_TS41 4    //    Selects TrueSpeech 4.1 play mode.
  187.  
  188. //    G.723.1 record/compress modes: 6.3 & 5.3
  189. //    NOTE: Same as TrueSpeech 6.3 & 5.3 modes.
  190. #define COMPRESS_RATE_G7231_TS63 1    //    Selects TrueSpeech 6.3 play mode.
  191. #define COMPRESS_RATE_G7231_TS53 2    //    Selects TrueSpeech 5.3 play mode.
  192.  
  193. // ------------------------
  194.  
  195. #define COMPRESS_FRAME_TRUESPEECH  0    //    TrueSpeech 8.5, 6.3, 5.3, 4.8 or 4.1 Kbps
  196. #define COMPRESS_FRAME_ULAW        120    //    64 Kbit/sec U-law PCM
  197. #define COMPRESS_FRAME_16LINEAR    240    //    128 Kbit/sec 16-bit linear
  198. #define COMPRESS_FRAME_8LINEAR     120    //    64 Kbit/sec 8-bit signed linear
  199. #define COMPRESS_FRAME_8LINEAR_WSS 120    //    64 Kbit/sec WSS 8-bit unsigned linear
  200.  
  201. //    TrueSpeech recording modes: 8.5 - 4.1
  202. #define COMPRESS_FRAME_TS85 16    //    TrueSpeech 8.5 record frame.
  203. #define COMPRESS_FRAME_TS63 12    //    TrueSpeech 6.3 record frame.
  204. #define COMPRESS_FRAME_TS53 10    //    TrueSpeech 5.3 record frame.
  205. #define COMPRESS_FRAME_TS48 9        //    TrueSpeech 4.8 record frame.
  206. #define COMPRESS_FRAME_TS41 8        //    TrueSpeech 4.1 record frame.
  207.  
  208. //    G.723.1 recording modes: 6.3 & 5.3
  209. //    NOTE: Same as TrueSpeech 6.3 & 5.3 modes.
  210. #define COMPRESS_FRAME_G7231_TS63 COMPRESS_FRAME_TS63    //    TrueSpeech 6.3 record frame.
  211. #define COMPRESS_FRAME_G7231_TS53 COMPRESS_FRAME_TS53    //    TrueSpeech 5.3 record frame.
  212.  
  213. #define COMPRESS_MAX_BUFFER_SIZE COMPRESS_FRAME_16LINEAR    //    Max buffer size: Tx or Rx.
  214.  
  215. //    Additional bit patterns to 'Or' into Command Base 'words'
  216. const WORD COMPRESS_TFRMODE_80X5 = 0;    //    Selects Data transfer via Software Control and Status Registers (CT8015/CT8005 protocol mode).
  217. const WORD COMPRESS_TFRMODE_8020 = 3;    //    Selects Data transfer via Host Transmit Data Buffer Access Port.
  218.  
  219. const WORD COMPRESS_SYNC_MODE_CODEC = 0;
  220. const WORD COMPRESS_SYNC_MODE_DATA  = 1;
  221. const WORD COMPRESS_SYNC_MODE_POLL  = 2;
  222. const WORD COMPRESS_SYNC_MODE_HOST  = 3;
  223.  
  224. //==========================================================================
  225. //--------------------------------------------------------------------------
  226. //    Device support
  227. //--------------------------------------------------------------------------
  228. //
  229. //    Additional bit patterns to 'Or' into Command Base 'words'
  230. //const WORD DEVCTRL_TONE_MODE_SYNC  = 0;    //    Selects Synchronous Tone mode
  231. //const WORD DEVCTRL_TONE_MODE_ASYNC = 1;    //    Selects Asynchronous Tone mode
  232.  
  233. // Analog source for the Codec #1.
  234. //    Analog source is determined by the GPIO bits: 6 & 7.
  235. //                    | GPIO6    | GPIO7    |
  236. //------------------|-------|-------|-------
  237. //    POTS Phone        |   0    |   0    |
  238. //    Speakerphone    |   0    |   1    |
  239. //    Handset Phone    |   1    |   0    |
  240. //      ??????        |   1   |   1   |
  241. //-------------------------------------------
  242. //
  243. #define ANALOG_SOURCE_POTSPHONE        (0x0)
  244. #define ANALOG_SOURCE_SPEAKERPHONE    (0x1)
  245. #define ANALOG_SOURCE_HANDSETPHONE    (0x2)
  246. #define ANALOG_SOURCE_PSTNLINE        (0x2)
  247.  
  248. #define LINEJACK_MODE_PHONEJACK        (0x0)
  249. #define LINEJACK_MODE_LINEJACK        (0x1)
  250. #define LINEJACK_MODE_STANDALONE    (0x2)
  251.  
  252. #define DEVICE_SPEAKERPHONE 0x01
  253. #define DEVICE_POTS 0x02
  254. #define DEVICE_HANDSET 0x04
  255. #define DEVICE_PSTN 0x08
  256.  
  257. #define COEFF_US            0
  258. #define COEFF_UK            1
  259. #define COEFF_FRANCE        2
  260. #define COEFF_GERMANY       3
  261. #define COEFF_AUSTRALIA     4
  262. #define COEFF_JAPAN         5
  263. #define COEFF_CTR21         6
  264. #define COEFF_CZECH         7
  265. #define COEFF_GERMANY2      8
  266. #define COEFF_ITALY         9
  267. #define COEFF_SOUTH_KOREA  10
  268. #define COEFF_NEW_ZEALAND  11
  269. #define COEFF_NORWAY       12
  270. #define COEFF_PHILIPPINES  13
  271. #define COEFF_POLAND       14
  272. #define COEFF_SOUTH_AFRICA 15
  273. #define COEFF_SWEDEN       16
  274.  
  275. // SLIC States
  276. //    SLIC State is determined by the GPIO bits: 1,2,3
  277. //                    | GPIO3    | GPIO2    | GPIO1    | !GPIO1 |
  278. //                    |   C3    |   C2    |   C1    |  B2EN     |
  279. //------------------|-------|-------|-------|--------|
  280. //    Open Circuit    |   0    |   0    |   0    |   1     |
  281. //    Ringing           |   0    |   0    |   1    |   0     |
  282. //    Active           |   0    |   1    |   0    |   1     |
  283. //----------------------------------------------------
  284. //
  285. #define SLIC_STATE_OPENCIRCUIT    0
  286. #define SLIC_STATE_RINGING        1
  287. #define SLIC_STATE_ACTIVE        2
  288. #define SLIC_STATE_OHT            3
  289. #define SLIC_STATE_TIPOPEN        4
  290. #define SLIC_STATE_STANDBY        5
  291. #define SLIC_STATE_APR            6
  292. #define SLIC_STATE_OHTPR        7
  293.  
  294. // Switch Hook States
  295. //    Switch Hook State is determined by GPIO 5
  296. //                    | GPIO5     |
  297. //------------------|--------|
  298. //    Off Hook        |   0     |
  299. //    On Hook            |   1     |
  300. //----------------------------
  301. //
  302. #define SLIC_OFF_HOOK    (0x0)
  303. #define SLIC_ON_HOOK    (0x1)
  304.  
  305. // LineJack Test error codes
  306. #define LINE_TEST_OK 0
  307. #define LINE_TEST_TESTING 1
  308. #define LINE_TEST_POTS_OFF_HOOK 2
  309. #define LINE_TEST_LINE_CONNECTED_TO_POTS 3
  310. #define LINE_TEST_NO_LINE_PRESENT 4
  311.  
  312. // The ring pattern is a 12-bit sequence.
  313. // Each bit represents 1/2 second of ring
  314. // on or off for a total of 6 seconds.
  315. #define RING_PATTERN_MASK (0x0FFF)
  316.  
  317. #define DEVCTRL_HOOKSTATE_INIT            0
  318. #define DEVCTRL_HOOKSTATE_ON_HOOK_1        1
  319. #define DEVCTRL_HOOKSTATE_ON_HOOK_2        2
  320. #define DEVCTRL_HOOKSTATE_ON_HOOK_3        3
  321. #define DEVCTRL_HOOKSTATE_OFF_HOOK_1    4
  322. #define DEVCTRL_HOOKSTATE_OFF_HOOK_2    5
  323. #define DEVCTRL_HOOKSTATE_OFF_HOOK_3    6
  324.  
  325. #define DEVCTRL_RINGSTATE_INIT        0
  326. #define DEVCTRL_RINGSTATE_RING_0    1
  327. #define DEVCTRL_RINGSTATE_RING_1    2
  328. #define DEVCTRL_RINGSTATE_RING_2    3
  329. #define DEVCTRL_RINGSTATE_RING_3    4
  330. #define DEVCTRL_RINGSTATE_RING_4    5
  331. #define DEVCTRL_RINGSTATE_RING_5    6
  332. #define DEVCTRL_RINGSTATE_RING_6    7
  333. #define DEVCTRL_RINGSTATE_RING_7    8
  334. #define DEVCTRL_RINGSTATE_RING_8    9
  335. #define DEVCTRL_RINGSTATE_RING_9    10
  336. #define DEVCTRL_RINGSTATE_RING_10    11
  337. #define DEVCTRL_RINGSTATE_RING_11    12
  338.  
  339. //==========================================================================
  340. //--------------------------------------------------------------------------
  341. //    Filter support
  342. //--------------------------------------------------------------------------
  343. //
  344. //    Additional bit patterns to 'Or' into Command Base 'words'
  345. #define FILTER_MODE_SYNC  0
  346. #define FILTER_MODE_ASYNC 1
  347.  
  348. #define FILTER_LINE_VOLUME_POS_0DB 2    //    +0 dB
  349. #define FILTER_LINE_VOLUME_MUTE    3    //    Mute Microphone (also resets AEC)
  350.  
  351. #define FILTER_SPEAKER_VOLUME_POS_14DB 0    //    +14 dB
  352. #define FILTER_SPEAKER_VOLUME_POS_12DB 1    //    +12 dB
  353. #define FILTER_SPEAKER_VOLUME_POS_10DB 2    //    +10 dB
  354. #define FILTER_SPEAKER_VOLUME_POS_8DB  3    //    +8 dB
  355. #define FILTER_SPEAKER_VOLUME_POS_6DB  4    //    +6 dB
  356. #define FILTER_SPEAKER_VOLUME_POS_4DB  5    //    +4 dB
  357. #define FILTER_SPEAKER_VOLUME_POS_2DB  6    //    +2 dB
  358. #define FILTER_SPEAKER_VOLUME_POS_0DB  7    //    0 dB
  359. #define FILTER_SPEAKER_VOLUME_NEG_2DB  8    //    -2 dB
  360. #define FILTER_SPEAKER_VOLUME_NEG_4DB  9    //    -4 dB
  361. #define FILTER_SPEAKER_VOLUME_NEG_6DB  10    //    -6 dB
  362. #define FILTER_SPEAKER_VOLUME_NEG_8DB  11    //    -8 dB
  363. #define FILTER_SPEAKER_VOLUME_NEG_10DB 12    //    -10 dB
  364. #define FILTER_SPEAKER_VOLUME_NEG_12DB 13    //    -12 dB
  365. #define FILTER_SPEAKER_VOLUME_NEG_14DB 14    //    -14 dB
  366. #define FILTER_SPEAKER_VOLUME_MUTE     15    //    Mute Filter
  367.  
  368. #define FILTER_DTMFSTATE_INIT            0
  369. #define FILTER_DTMFSTATE_NOT_VALID_1    1
  370. #define FILTER_DTMFSTATE_NOT_VALID_2    2
  371. #define FILTER_DTMFSTATE_NOT_VALID_3    3
  372. #define FILTER_DTMFSTATE_VALID_1        4
  373. #define FILTER_DTMFSTATE_VALID_2        5
  374. #define FILTER_DTMFSTATE_VALID_3        6
  375.  
  376. #define FrameCount( LineMonitor ) ((LineMonitor>>12)&0x0f)
  377. #define FilterBits( LineMonitor ) ((LineMonitor>>8)&0x0f)
  378. #define Peak( LineMonitor ) ((LineMonitor>>6)&1)
  379. #define DTMFValid( LineMonitor ) ((LineMonitor>>5)&1)
  380. #define CPFValid( LineMonitor ) ((LineMonitor>>4)&1)
  381. #define DTMFDigit( LineMonitor ) (LineMonitor&0x0f)
  382.  
  383.  
  384. //==========================================================================
  385. //--------------------------------------------------------------------------
  386. //    Idle support
  387. //--------------------------------------------------------------------------
  388. //
  389. #define IDLE_TONE_MODE_SYNC  0    //    Selects Synchronous Tone mode
  390. #define IDLE_TONE_MODE_ASYNC 1    //    Selects Asynchronous Tone mode
  391.  
  392. #define IDLE_TONE_NOTONE    0
  393. #define IDLE_TONE_1        1
  394. #define IDLE_TONE_2        2
  395. #define IDLE_TONE_3        3
  396. #define IDLE_TONE_4        4
  397. #define IDLE_TONE_5        5
  398. #define IDLE_TONE_6        6
  399. #define IDLE_TONE_7        7
  400. #define IDLE_TONE_8        8
  401. #define IDLE_TONE_9        9
  402. #define IDLE_TONE_STAR    10
  403. #define IDLE_TONE_0        11
  404. #define IDLE_TONE_POUND    12
  405. #define IDLE_TONE_DIAL    25
  406. #define IDLE_TONE_RING    26
  407. #define IDLE_TONE_BUSY    27
  408. #define IDLE_TONE_A        28
  409. #define IDLE_TONE_B        29
  410. #define IDLE_TONE_C        30
  411. #define IDLE_TONE_D        31
  412.  
  413. //    Table from TelTone M-991 Spec sheet (table 4).
  414. //    Tone Name                Frequency (Hz)            Interruption Rate
  415. //                             1             2
  416. //-------------------------------------------------------------------------------------------
  417. //    Dial                |    350        |    440        |    Steady
  418. //    Reorder                |    480        |    620        |    Repeat, tones on and off 250 ms +- 25ms
  419. //    Busy                |    480        |    620        |    Repeat,    tones on and off 500 ms +- 50ms
  420. //    Audible Ring        |    480        |    480        |    Repeat,    tones on 2 +- 0.2sec, tones off 4 +- 0.4sec
  421. //    Recall Dial            |    350        |    440        |    Three bursts tones on and off 100 ms +- 20ms each followed by dial tone
  422. //    Special AR            |    440        |    480        |    Tones on 1 +- 0.2sec, followed by single 440Hz on for 0.2sec on, and silence for 3 +- 0.3sec, repeat
  423. //    Intercept            |    440        |    620        |    Repeat alternating tones, each on for 230ms +- 70ms with total cycle of 500 +- 50ms
  424. //    Call Waiting        |    440        |    Off        |    One burst 200 +- 100ms
  425. //    Busy Verification    |    440        |    Off        |    One burst of tone on 1.75 +- 0.25sec before attendant intrudes, followed by burst of tone 0.65 +- 0.15sec on, 8 to 20 sec apart for as long as the call lasts.
  426. //    Executive Override    |    440        |    Off        |    One burst of tone for 3 +- 1sec before overriding station intrudes.
  427. //    Confirmation        |    350        |    440        |    Three bursts on and off 100ms each or 100ms on, 100ms off, 300 ms on.
  428.  
  429. #define TONE_DIAL                0
  430. #define    TONE_REORDER            1
  431. #define TONE_BUSY                2
  432. #define    TONE_AUDIBLE_RING        3
  433. #define    TONE_RECALL_DIAL        4
  434. #define    TONE_SPECIAL_AR            5
  435. #define    TONE_INTERCEPT            6
  436. #define    TONE_CALL_WAITING        7
  437. #define    TONE_BUSY_VERIFICATION    8
  438. #define    TONE_EXECUTIVE_OVERRIDE    9
  439. #define    TONE_CONFIRMATION        10
  440.  
  441. typedef struct
  442. {
  443.     DWORD dwToneIndex;
  444.     DWORD dwDuration;
  445.     DWORD dwToneOnPeriod;
  446.     DWORD dwToneOffPeriod;
  447.     DWORD dwMasterGain;
  448. } IDLE_TONE;
  449.  
  450. typedef struct
  451. {
  452.     DWORD dwToneIndex;   // 1-31, 0 reserved for silence
  453.     DWORD dwFrequencyFactor0; // dwFrequencyFactor0 = 32767 * cos( 2*Pi*(frequency0/8000) )
  454.     DWORD dwGain0;   // 0-15 See Tone Level Table
  455.     DWORD dwFrequencyFactor1; // dwFrequencyFactor1 = 32767 * cos( 2*Pi*(frequency1/8000) )
  456.     DWORD dwGain1;   // 0-15 See Tone Level Table
  457. } IDLE_NEW_TONE;
  458.  
  459. //==========================================================================
  460. // 
  461. // Tone Level Table
  462. //____________________________________________________________
  463. // Index     Codec Output Level (dB relative to 0.707 Vrms)
  464. //____________________________________________________________
  465. //      0                   +6
  466. //      1                   +4
  467. //      2                   +2
  468. //      3                     0
  469. //      4                    -2
  470. //      5                    -4
  471. //      6                    -6
  472. //      7                    -8
  473. //      8                  -10
  474. //      9                  -12
  475. //     10                 -14
  476. //     11                 -16
  477. //     12                 -18
  478. //     13                 -20
  479. //     14                 -22
  480. //     15                 -24
  481.  
  482. //==========================================================================
  483. //--------------------------------------------------------------------------
  484. //    Mixer support
  485. //--------------------------------------------------------------------------
  486. //
  487. // Playback mixer lines
  488. #define PlaybackMaster            0
  489. #define PlaybackMicrophone        1
  490. #define PlaybackWave            2
  491. #define PlaybackCD                3
  492. #define PlaybackLineIn            4
  493. #define PlaybackPhoneIn            5
  494. #define PlaybackPhoneOut        6
  495. #define PlaybackPhoneLineOut    7
  496. #define PlaybackDeviceCount        8
  497.  
  498. // Record mixer lines
  499. #define RecordMaster        0
  500. #define RecordMicrophone    1
  501. #define RecordWave            2
  502. #define RecordCD            3
  503. #define RecordLineIn        4
  504. #define RecordPhoneIn        5
  505. #define RecordPhoneLineIn    6
  506. #define RecordDeviceCount    7
  507.  
  508. // Output mixer lines
  509. #define OutputMicrophone    PlaybackMicrophone
  510. #define OutputWave            PlaybackWave
  511. #define OutputCD            PlaybackCD
  512. #define OutputLineIn        PlaybackLineIn
  513. #define OutputPhoneIn        PlaybackPhoneIn
  514.  
  515. // Input mixer lines
  516. #define InputMicrophone    RecordMicrophone
  517. #define InputWave        RecordWave
  518. #define InputCD            RecordCD
  519. #define InputLineIn        RecordLineIn
  520. #define InputPhoneIn    RecordPhoneIn
  521.  
  522. // Mixer line structure
  523. typedef struct _MIXER_LINE
  524. {
  525.     DWORD dwLineID;
  526.     DWORD dwMute;
  527.     DWORD dwLeftVolume;
  528.     DWORD dwRightVolume;
  529. }
  530. MIXER_LINE;
  531.  
  532. #define MIXER_ACCESS TEXT( "MixerAccess" )
  533.  
  534. //==========================================================================
  535. //--------------------------------------------------------------------------
  536. //    Playback support
  537. //--------------------------------------------------------------------------
  538. //
  539. //    Additional bit patterns to 'Or' into Command Base 'words'
  540. #define PLAYBACK_TFRMODE_80X5 0    //    Selects Data transfer via Software Control and Status Registers (CT8015/CT8005 protocol mode).
  541. #define PLAYBACK_TFRMODE_8020 3    //    Selects Data transfer via Host Transmit Data Buffer Access Port.
  542.  
  543. #define PLAYBACK_SYNC_MODE_CODEC    0
  544. #define PLAYBACK_SYNC_MODE_DATA        1
  545. #define PLAYBACK_SYNC_MODE_POLL        2
  546. #define PLAYBACK_SYNC_MODE_HOST        3
  547.  
  548. //    Playback modes
  549. #define PLAYBACK_MODE_COMPRESSED        0    //    Selects: Compressed modes, TrueSpeech 8.5-4.1, G.723.1, G.722, G.728, G.729
  550. #define PLAYBACK_MODE_TRUESPEECH_V40    0    //    Selects: TrueSpeech 8.5, 6.3, 5.3, 4.8 or 4.1 Kbps
  551. #define PLAYBACK_MODE_TRUESPEECH        8    //    Selects: TrueSpeech 8.5, 6.3, 5.3, 4.8 or 4.1 Kbps Version 5.1
  552. #define PLAYBACK_MODE_ULAW                2    //    Selects: 64 Kbit/sec MuA-law PCM
  553. #define PLAYBACK_MODE_ALAW                10    //    Selects: 64 Kbit/sec A-law PCM
  554. #define PLAYBACK_MODE_16LINEAR            6    //    Selects: 128 Kbit/sec 16-bit linear
  555. #define PLAYBACK_MODE_8LINEAR            4    //    Selects: 64 Kbit/sec 8-bit signed linear
  556. #define PLAYBACK_MODE_8LINEAR_WSS        5    //    Selects: 64 Kbit/sec WSS 8-bit unsigned linear
  557.  
  558. //    Playback rates
  559. #define PLAYBACK_RATE_TS85        0    //    Selects TrueSpeech 8.5 playback rate.
  560. #define PLAYBACK_RATE_TS63        1    //    Selects TrueSpeech 6.3 playback rate.
  561. #define PLAYBACK_RATE_TS53        2    //    Selects TrueSpeech 5.3 playback rate.
  562. #define PLAYBACK_RATE_TS48        3    //    Selects TrueSpeech 4.8 playback rate.
  563. #define PLAYBACK_RATE_TS41        4    //    Selects TrueSpeech 4.1 playback rate.
  564. #define PLAYBACK_RATE_G722        7    //    Selects G.722 playback rate.
  565. #define PLAYBACK_RATE_G723_63    PLAYBACK_RATE_TS63    //    Selects G.723.1 (6.3 kbps) playback rate.
  566. #define PLAYBACK_RATE_G723_53    PLAYBACK_RATE_TS53    //    Selects G.723.1 (5.3 kbps) playback rate.
  567. #define PLAYBACK_RATE_G728        5    //    Selects G.728 playback rate.
  568. #define PLAYBACK_RATE_G729        6    //    Selects G.729 playback rate.
  569.  
  570. // Frame sizes in WORD units
  571. #define PLAYBACK_TS85_WORDS                16        //    TrueSpeech 8.5, 30ms frame size
  572. #define PLAYBACK_TS63_WORDS                12        //    TrueSpeech 6.3, 30ms frame size
  573. #define PLAYBACK_TS53_WORDS                10        //    TrueSpeech 5.3, 30ms frame size
  574. #define PLAYBACK_TS48_WORDS                9        //    TrueSpeech 4.8, 30ms frame size
  575. #define PLAYBACK_TS41_WORDS                8        //    TrueSpeech 4.1, 30ms frame size
  576. #define PLAYBACK_ALAW_WORDS                120        //    64 Kbit/sec A-law PCM, 30ms frame size
  577. #define PLAYBACK_ALAW_30MS_WORDS        120        //    64 Kbit/sec A-law PCM, 30ms frame size
  578. #define PLAYBACK_ALAW_20MS_WORDS        80        //    64 Kbit/sec A-law PCM, 20ms frame size
  579. #define PLAYBACK_ALAW_10MS_WORDS        40        //    64 Kbit/sec A-law PCM, 10ms frame size
  580. #define PLAYBACK_ULAW_WORDS                120        //    64 Kbit/sec Mu-law PCM, 30ms frame size
  581. #define PLAYBACK_ULAW_30MS_WORDS        120        //    64 Kbit/sec Mu-law PCM, 30ms frame size
  582. #define PLAYBACK_ULAW_20MS_WORDS        80        //    64 Kbit/sec Mu-law PCM, 20ms frame size
  583. #define PLAYBACK_ULAW_10MS_WORDS        40        //    64 Kbit/sec Mu-law PCM, 10ms frame size
  584. #define PLAYBACK_16LINEAR_WORDS            240        //    128 Kbit/sec 16-bit linear, 30ms frame size
  585. #define PLAYBACK_16LINEAR_30MS_WORDS    240        //    128 Kbit/sec 16-bit linear, 30ms frame size
  586. #define PLAYBACK_16LINEAR_20MS_WORDS    160        //    128 Kbit/sec 16-bit linear, 20ms frame size
  587. #define PLAYBACK_16LINEAR_10MS_WORDS    80        //    128 Kbit/sec 16-bit linear, 10ms frame size
  588. #define PLAYBACK_8LINEAR_WORDS            120        //    64 Kbit/sec 8-bit signed linear, 30ms frame size
  589. #define PLAYBACK_8LINEAR_30MS_WORDS        120        //    64 Kbit/sec 8-bit signed linear, 30ms frame size
  590. #define PLAYBACK_8LINEAR_20MS_WORDS        80        //    64 Kbit/sec 8-bit signed linear, 20ms frame size
  591. #define PLAYBACK_8LINEAR_10MS_WORDS        40        //    64 Kbit/sec 8-bit signed linear, 10ms frame size
  592. #define PLAYBACK_8LINEAR_WSS_WORDS        120        //    64 Kbit/sec WSS 8-bit unsigned linear, 30ms frame size
  593. #define PLAYBACK_8LINEAR_WSS_30MS_WORDS    120        //    64 Kbit/sec WSS 8-bit unsigned linear, 30ms frame size
  594. #define PLAYBACK_8LINEAR_WSS_20MS_WORDS    80        //    64 Kbit/sec WSS 8-bit unsigned linear, 20ms frame size
  595. #define PLAYBACK_8LINEAR_WSS_10MS_WORDS    40        //    64 Kbit/sec WSS 8-bit unsigned linear, 10ms frame size
  596. #define PLAYBACK_G722_WORDS                40        //    64 Kbit/sec G.722, 10ms frame size
  597. #define PLAYBACK_G723_63_WORDS            PLAYBACK_TS63_WORDS    //    6.3 Kbit/sec G.723.1, 30ms frame size
  598. #define PLAYBACK_G723_53_WORDS            PLAYBACK_TS53_WORDS    //    5.3 Kbit/sec G.723.1, 30ms frame size
  599. #define PLAYBACK_G728_10MS_WORDS        16        //    16 Kbit/sec G.728, 10ms frame size
  600. #define PLAYBACK_G728_20MS_WORDS        32        //    16 Kbit/sec G.728, 20ms frame size
  601. #define PLAYBACK_G728_30MS_WORDS        48        //    16 Kbit/sec G.728, 30ms frame size
  602. #define PLAYBACK_G729_10MS_WORDS        6        //    8 Kbit/sec G.729, 10ms frame size
  603. #define PLAYBACK_G729_20MS_WORDS        12        //    8 Kbit/sec G.729, 20ms frame size
  604. #define PLAYBACK_G729_30MS_WORDS        18        //    8 Kbit/sec G.729, 30ms frame size
  605.  
  606. // Frame sizes in bytes
  607. #define PLAYBACK_FRAME_TS85                (PLAYBACK_TS85_WORDS*2)
  608. #define PLAYBACK_FRAME_TS63                (PLAYBACK_TS63_WORDS*2)
  609. #define PLAYBACK_FRAME_TS53                (PLAYBACK_TS53_WORDS*2)
  610. #define PLAYBACK_FRAME_TS48                (PLAYBACK_TS48_WORDS*2)
  611. #define PLAYBACK_FRAME_TS41                (PLAYBACK_TS41_WORDS*2)
  612. #define PLAYBACK_FRAME_ALAW                (PLAYBACK_ALAW_WORDS*2)
  613. #define PLAYBACK_FRAME_ALAW_30MS        (PLAYBACK_ALAW_30MS_WORDS*2)
  614. #define PLAYBACK_FRAME_ALAW_20MS        (PLAYBACK_ALAW_20MS_WORDS*2)
  615. #define PLAYBACK_FRAME_ALAW_10MS        (PLAYBACK_ALAW_10MS_WORDS*2)
  616. #define PLAYBACK_FRAME_ULAW                (PLAYBACK_ULAW_WORDS*2)
  617. #define PLAYBACK_FRAME_ULAW_30MS        (PLAYBACK_ULAW_30MS_WORDS*2)
  618. #define PLAYBACK_FRAME_ULAW_20MS        (PLAYBACK_ULAW_20MS_WORDS*2)
  619. #define PLAYBACK_FRAME_ULAW_10MS        (PLAYBACK_ULAW_10MS_WORDS*2)
  620. #define PLAYBACK_FRAME_16LINEAR            (PLAYBACK_16LINEAR_WORDS*2)
  621. #define PLAYBACK_FRAME_16LINEAR_30MS    (PLAYBACK_16LINEAR_30MS_WORDS*2)
  622. #define PLAYBACK_FRAME_16LINEAR_20MS    (PLAYBACK_16LINEAR_20MS_WORDS*2)
  623. #define PLAYBACK_FRAME_16LINEAR_10MS    (PLAYBACK_16LINEAR_10MS_WORDS*2)
  624. #define PLAYBACK_FRAME_8LINEAR            (PLAYBACK_8LINEAR_WORDS*2)
  625. #define PLAYBACK_FRAME_8LINEAR_30MS        (PLAYBACK_8LINEAR_30MS_WORDS*2)
  626. #define PLAYBACK_FRAME_8LINEAR_20MS        (PLAYBACK_8LINEAR_20MS_WORDS*2)
  627. #define PLAYBACK_FRAME_8LINEAR_10MS        (PLAYBACK_8LINEAR_10MS_WORDS*2)
  628. #define PLAYBACK_FRAME_8LINEAR_WSS        (PLAYBACK_8LINEAR_WSS_WORDS*2)
  629. #define PLAYBACK_FRAME_8LINEAR_WSS_30MS    (PLAYBACK_8LINEAR_WSS_30MS_WORDS*2)
  630. #define PLAYBACK_FRAME_8LINEAR_WSS_20MS    (PLAYBACK_8LINEAR_WSS_20MS_WORDS*2)
  631. #define PLAYBACK_FRAME_8LINEAR_WSS_10MS    (PLAYBACK_8LINEAR_WSS_10MS_WORDS*2)
  632. #define PLAYBACK_FRAME_G722                (PLAYBACK_G722_WORDS*2)
  633. #define PLAYBACK_FRAME_G723_63            (PLAYBACK_G723_63_WORDS*2)
  634. #define PLAYBACK_FRAME_G723_53            (PLAYBACK_G723_53_WORDS*2)
  635. #define PLAYBACK_FRAME_G728_10MS        (PLAYBACK_G728_10MS_WORDS*2)
  636. #define PLAYBACK_FRAME_G728_20MS        (PLAYBACK_G728_20MS_WORDS*2)
  637. #define PLAYBACK_FRAME_G728_30MS        (PLAYBACK_G728_30MS_WORDS*2)
  638. #define PLAYBACK_FRAME_G729_10MS        (PLAYBACK_G729_10MS_WORDS*2)
  639. #define PLAYBACK_FRAME_G729_20MS        (PLAYBACK_G729_20MS_WORDS*2)
  640. #define PLAYBACK_FRAME_G729_30MS        (PLAYBACK_G729_30MS_WORDS*2)
  641.  
  642. #define PLAYBACK_MAX_BUFFER_WORDS    PLAYBACK_16LINEAR_WORDS    //    Max buffer size: Tx or Rx.
  643. #define PLAYBACK_MAX_BUFFER_SIZE    PLAYBACK_FRAME_16LINEAR    //    Max buffer size: Tx or Rx.
  644.  
  645. #define PLAYBACK_TS85_AVG_RATE    1067    //    TrueSpeech 8.5 Average bytes per second.
  646. #define PLAYBACK_TS63_AVG_RATE    800        //    TrueSpeech 6.3 Average bytes per second.
  647. #define PLAYBACK_TS53_AVG_RATE    667        //    TrueSpeech 5.3 Average bytes per second.
  648. #define PLAYBACK_TS48_AVG_RATE    600        //    TrueSpeech 4.8 Average bytes per second.
  649. #define PLAYBACK_TS41_AVG_RATE    533        //    TrueSpeech 4.1 Average bytes per second.
  650.  
  651. //==========================================================================
  652. //--------------------------------------------------------------------------
  653. //    Record support
  654. //--------------------------------------------------------------------------
  655. //
  656. //    Additional bit patterns to 'Or' into Command Base 'words'
  657. #define RECORD_TFRMODE_80X5 0    //    Selects Data transfer via Software Control and Status Registers (CT8015/CT8005 protocol mode).
  658. #define RECORD_TFRMODE_8020 3    //    Selects Data transfer via Host Transmit Data Buffer Access Port.
  659.  
  660. #define RECORD_SYNC_MODE_CODEC 0
  661. #define RECORD_SYNC_MODE_DATA  1
  662. #define RECORD_SYNC_MODE_POLL  2
  663. #define RECORD_SYNC_MODE_HOST  3
  664.  
  665. //    Automatic Gain Control (AGC)
  666. #define RECORD_AGC_MIN_GAIN     0    //    Sets AGC Min Gain
  667. #define RECORD_AGC_MAX_GAIN     1    //    Sets AGC Max Gain
  668. #define RECORD_AGC_START_GAIN   2    //    Sets AGC Start Gain
  669. #define RECORD_AGC_HOLD_TIME    3    //    Sets AGC Hold Time
  670. #define RECORD_AGC_ATTACK_TIME  4    //    Sets AGC Attack Time Constant
  671. #define RECORD_AGC_DECAY_TIME   5    //    Sets AGC Decay Time Constant
  672. #define RECORD_AGC_ATTACK_THRES 6    //    Sets AGC Attack Threshold
  673. #define RECORD_AGC_ON_OFF       7    //    Sets AGC On/Off. Enable/Disable AGC.
  674.  
  675. //    AGC Time Contants
  676. #define RECORD_AGC_250_us  0
  677. #define RECORD_AGC_512_us  1
  678. #define RECORD_AGC_1_ms    2
  679. #define RECORD_AGC_2_ms    3
  680. #define RECORD_AGC_4_ms    4
  681. #define RECORD_AGC_8_ms    5
  682. #define RECORD_AGC_16_ms   6
  683. #define RECORD_AGC_32_ms   7
  684. #define RECORD_AGC_64_ms   8
  685. #define RECORD_AGC_128_ms  9
  686. #define RECORD_AGC_256_ms  10
  687. #define RECORD_AGC_512_ms  11
  688. #define RECORD_AGC_1024_ms 12
  689. #define RECORD_AGC_2048_ms 13
  690. #define RECORD_AGC_4096_ms 14
  691. #define RECORD_AGC_8192_ms 15
  692.  
  693. //    Record modes
  694. #define RECORD_MODE_COMPRESSED        0    //    Selects: Compressed modes, TrueSpeech 8.5-4.1, G.723.1, G.722, G.728, G.729
  695. #define RECORD_MODE_TRUESPEECH        0    //    Selects: TrueSpeech 8.5, 6.3, 5.3, 4.8 or 4.1 Kbps
  696. #define RECORD_MODE_ULAW            4    //    Selects: 64 Kbit/sec Mu-law PCM
  697. #define RECORD_MODE_ALAW            12    //    Selects: 64 Kbit/sec A-law PCM
  698. #define RECORD_MODE_16LINEAR        5    //    Selects: 128 Kbit/sec 16-bit linear
  699. #define RECORD_MODE_8LINEAR            6    //    Selects: 64 Kbit/sec 8-bit signed linear
  700. #define RECORD_MODE_8LINEAR_WSS        7    //    Selects: 64 Kbit/sec WSS 8-bit unsigned linear
  701.  
  702. //    Record rates
  703. #define RECORD_RATE_TS85    0    //    Selects TrueSpeech 8.5 record rate.
  704. #define RECORD_RATE_TS63    1    //    Selects TrueSpeech 6.3 record rate.
  705. #define RECORD_RATE_TS53    2    //    Selects TrueSpeech 5.3 record rate.
  706. #define RECORD_RATE_TS48    3    //    Selects TrueSpeech 4.8 record rate.
  707. #define RECORD_RATE_TS41    4    //    Selects TrueSpeech 4.1 record rate.
  708. #define RECORD_RATE_G722    7    //    Selects G.722 record rate.
  709. #define RECORD_RATE_G723_63    RECORD_RATE_TS63    //    Selects G.723.1 (6.3 kbps) record rate.
  710. #define RECORD_RATE_G723_53    RECORD_RATE_TS53    //    Selects G.723.1 (5.3 kbps) record rate.
  711. #define RECORD_RATE_G728    5    //    Selects G.728 record rate.
  712. #define RECORD_RATE_G729    6    //    Selects G.729 record rate.
  713.  
  714. // Frame sizes in WORD units
  715. #define RECORD_TS85_WORDS                16        //    TrueSpeech 8.5, 30ms frame size
  716. #define RECORD_TS63_WORDS                12        //    TrueSpeech 6.3, 30ms frame size
  717. #define RECORD_TS53_WORDS                10        //    TrueSpeech 5.3, 30ms frame size
  718. #define RECORD_TS48_WORDS                9        //    TrueSpeech 4.8, 30ms frame size
  719. #define RECORD_TS41_WORDS                8        //    TrueSpeech 4.1, 30ms frame size
  720. #define RECORD_ALAW_WORDS                120        //    64 Kbit/sec A-law PCM, 30ms frame size
  721. #define RECORD_ALAW_30MS_WORDS            120        //    64 Kbit/sec A-law PCM, 30ms frame size
  722. #define RECORD_ALAW_20MS_WORDS            80        //    64 Kbit/sec A-law PCM, 20ms frame size
  723. #define RECORD_ALAW_10MS_WORDS            40        //    64 Kbit/sec A-law PCM, 10ms frame size
  724. #define RECORD_ULAW_WORDS                120        //    64 Kbit/sec Mu-law PCM, 30ms frame size
  725. #define RECORD_ULAW_30MS_WORDS            120        //    64 Kbit/sec Mu-law PCM, 30ms frame size
  726. #define RECORD_ULAW_20MS_WORDS            80        //    64 Kbit/sec Mu-law PCM, 20ms frame size
  727. #define RECORD_ULAW_10MS_WORDS            40        //    64 Kbit/sec Mu-law PCM, 10ms frame size
  728. #define RECORD_16LINEAR_WORDS            240        //    128 Kbit/sec 16-bit linear, 30ms frame size
  729. #define RECORD_16LINEAR_30MS_WORDS        240        //    128 Kbit/sec 16-bit linear, 30ms frame size
  730. #define RECORD_16LINEAR_20MS_WORDS        160        //    128 Kbit/sec 16-bit linear, 20ms frame size
  731. #define RECORD_16LINEAR_10MS_WORDS        80        //    128 Kbit/sec 16-bit linear, 10ms frame size
  732. #define RECORD_8LINEAR_WORDS            120        //    64 Kbit/sec 8-bit signed linear, 30ms frame size
  733. #define RECORD_8LINEAR_30MS_WORDS        120        //    64 Kbit/sec 8-bit signed linear, 30ms frame size
  734. #define RECORD_8LINEAR_20MS_WORDS        80        //    64 Kbit/sec 8-bit signed linear, 20ms frame size
  735. #define RECORD_8LINEAR_10MS_WORDS        40        //    64 Kbit/sec 8-bit signed linear, 10ms frame size
  736. #define RECORD_8LINEAR_WSS_WORDS        120        //    64 Kbit/sec WSS 8-bit unsigned linear, 30ms frame size
  737. #define RECORD_8LINEAR_WSS_30MS_WORDS    120        //    64 Kbit/sec WSS 8-bit unsigned linear, 30ms frame size
  738. #define RECORD_8LINEAR_WSS_20MS_WORDS    80        //    64 Kbit/sec WSS 8-bit unsigned linear, 20ms frame size
  739. #define RECORD_8LINEAR_WSS_10MS_WORDS    40        //    64 Kbit/sec WSS 8-bit unsigned linear, 10ms frame size
  740. #define RECORD_G722_WORDS                40        //    64 Kbit/sec G.722, 10ms frame size
  741. #define RECORD_G723_63_WORDS            RECORD_TS63_WORDS    //    6.3 Kbit/sec G.723.1, 30ms frame size
  742. #define RECORD_G723_53_WORDS            RECORD_TS53_WORDS    //    5.3 Kbit/sec G.723.1, 30ms frame size
  743. #define RECORD_G728_10MS_WORDS            16        //    16 Kbit/sec G.728, 10ms frame size
  744. #define RECORD_G728_20MS_WORDS            32        //    16 Kbit/sec G.728, 20ms frame size
  745. #define RECORD_G728_30MS_WORDS            48        //    16 Kbit/sec G.728, 30ms frame size
  746. #define RECORD_G729_10MS_WORDS            6        //    8 Kbit/sec G.729, 10ms frame size
  747. #define RECORD_G729_20MS_WORDS            12        //    8 Kbit/sec G.729, 20ms frame size
  748. #define RECORD_G729_30MS_WORDS            18        //    8 Kbit/sec G.729, 30ms frame size
  749.  
  750. // Frame sizes in bytes
  751. #define RECORD_FRAME_TS85                (RECORD_TS85_WORDS*2)
  752. #define RECORD_FRAME_TS63                (RECORD_TS63_WORDS*2)
  753. #define RECORD_FRAME_TS53                (RECORD_TS53_WORDS*2)
  754. #define RECORD_FRAME_TS48                (RECORD_TS48_WORDS*2)
  755. #define RECORD_FRAME_TS41                (RECORD_TS41_WORDS*2)
  756. #define RECORD_FRAME_ALAW                (RECORD_ALAW_WORDS*2)
  757. #define RECORD_FRAME_ALAW_30MS            (RECORD_ALAW_30MS_WORDS*2)
  758. #define RECORD_FRAME_ALAW_20MS            (RECORD_ALAW_20MS_WORDS*2)
  759. #define RECORD_FRAME_ALAW_10MS            (RECORD_ALAW_10MS_WORDS*2)
  760. #define RECORD_FRAME_ULAW                (RECORD_ULAW_WORDS*2)
  761. #define RECORD_FRAME_ULAW_30MS            (RECORD_ULAW_30MS_WORDS*2)
  762. #define RECORD_FRAME_ULAW_20MS            (RECORD_ULAW_20MS_WORDS*2)
  763. #define RECORD_FRAME_ULAW_10MS            (RECORD_ULAW_10MS_WORDS*2)
  764. #define RECORD_FRAME_16LINEAR            (RECORD_16LINEAR_WORDS*2)
  765. #define RECORD_FRAME_16LINEAR_30MS        (RECORD_16LINEAR_30MS_WORDS*2)
  766. #define RECORD_FRAME_16LINEAR_20MS        (RECORD_16LINEAR_20MS_WORDS*2)
  767. #define RECORD_FRAME_16LINEAR_10MS        (RECORD_16LINEAR_10MS_WORDS*2)
  768. #define RECORD_FRAME_8LINEAR            (RECORD_8LINEAR_WORDS*2)
  769. #define RECORD_FRAME_8LINEAR_30MS        (RECORD_8LINEAR_30MS_WORDS*2)
  770. #define RECORD_FRAME_8LINEAR_20MS        (RECORD_8LINEAR_20MS_WORDS*2)
  771. #define RECORD_FRAME_8LINEAR_10MS        (RECORD_8LINEAR_10MS_WORDS*2)
  772. #define RECORD_FRAME_8LINEAR_WSS        (RECORD_8LINEAR_WSS_WORDS*2)
  773. #define RECORD_FRAME_8LINEAR_WSS_30MS    (RECORD_8LINEAR_WSS_30MS_WORDS*2)
  774. #define RECORD_FRAME_8LINEAR_WSS_20MS    (RECORD_8LINEAR_WSS_20MS_WORDS*2)
  775. #define RECORD_FRAME_8LINEAR_WSS_10MS    (RECORD_8LINEAR_WSS_10MS_WORDS*2)
  776. #define RECORD_FRAME_G722                (RECORD_G722_WORDS*2)
  777. #define RECORD_FRAME_G723_63            (RECORD_G723_63_WORDS*2)
  778. #define RECORD_FRAME_G723_53            (RECORD_G723_53_WORDS*2)
  779. #define RECORD_FRAME_G728_10MS            (RECORD_G728_10MS_WORDS*2)
  780. #define RECORD_FRAME_G728_20MS            (RECORD_G728_20MS_WORDS*2)
  781. #define RECORD_FRAME_G728_30MS            (RECORD_G728_30MS_WORDS*2)
  782. #define RECORD_FRAME_G729_10MS            (RECORD_G729_10MS_WORDS*2)
  783. #define RECORD_FRAME_G729_20MS            (RECORD_G729_20MS_WORDS*2)
  784. #define RECORD_FRAME_G729_30MS            (RECORD_G729_30MS_WORDS*2)
  785.  
  786. #define RECORD_MAX_BUFFER_WORDS    RECORD_16LINEAR_WORDS    //    Max buffer size: Tx or Rx.
  787. #define RECORD_MAX_BUFFER_SIZE    RECORD_FRAME_16LINEAR    //    Max buffer size: Tx or Rx.
  788.  
  789. #define RECORD_TS85_AVG_RATE    1067    //    TrueSpeech 8.5 Average bytes per second.
  790. #define RECORD_TS63_AVG_RATE    800        //    TrueSpeech 6.3 Average bytes per second.
  791. #define RECORD_TS53_AVG_RATE    667        //    TrueSpeech 5.3 Average bytes per second.
  792. #define RECORD_TS48_AVG_RATE    600        //    TrueSpeech 4.8 Average bytes per second.
  793. #define RECORD_TS41_AVG_RATE    533        //    TrueSpeech 4.1 Average bytes per second.
  794.  
  795. //==========================================================================
  796. //--------------------------------------------------------------------------
  797. //    Speakerphone support
  798. //--------------------------------------------------------------------------
  799. //
  800. //    Additional bit patterns to 'Or' into Command Base 'words'
  801. #define SPKRPHONE_LINE_VOLUME_POS_8DB    0    //    +8 dB
  802. #define SPKRPHONE_LINE_VOLUME_POS_4DB    1    //    +4 dB
  803. #define SPKRPHONE_LINE_VOLUME_POS_0DB    2    //    +0 dB
  804. #define SPKRPHONE_LINE_VOLUME_MUTE        3    //    Mute Microphone (also resets AEC)
  805.  
  806. #define SPKRPHONE_SPEAKER_VOLUME_POS_14DB    0    //    +14 dB
  807. #define SPKRPHONE_SPEAKER_VOLUME_POS_12DB    1    //    +12 dB
  808. #define SPKRPHONE_SPEAKER_VOLUME_POS_10DB    2    //    +10 dB
  809. #define SPKRPHONE_SPEAKER_VOLUME_POS_8DB    3    //    +8 dB
  810. #define SPKRPHONE_SPEAKER_VOLUME_POS_6DB    4    //    +6 dB
  811. #define SPKRPHONE_SPEAKER_VOLUME_POS_4DB    5    //    +4 dB
  812. #define SPKRPHONE_SPEAKER_VOLUME_POS_2DB    6    //    +2 dB
  813. #define SPKRPHONE_SPEAKER_VOLUME_POS_0DB    7    //    0 dB
  814. #define SPKRPHONE_SPEAKER_VOLUME_NEG_2DB    8    //    -2 dB
  815. #define SPKRPHONE_SPEAKER_VOLUME_NEG_4DB    9    //    -4 dB
  816. #define SPKRPHONE_SPEAKER_VOLUME_NEG_6DB    10    //    -6 dB
  817. #define SPKRPHONE_SPEAKER_VOLUME_NEG_8DB    11    //    -8 dB
  818. #define SPKRPHONE_SPEAKER_VOLUME_NEG_10DB    12    //    -10 dB
  819. #define SPKRPHONE_SPEAKER_VOLUME_NEG_12DB    13    //    -12 dB
  820. #define SPKRPHONE_SPEAKER_VOLUME_NEG_14DB    14    //    -14 dB
  821. #define SPKRPHONE_SPEAKER_VOLUME_MUTE        15    //    Mute Speaker
  822.  
  823. // AEC bit positions
  824. #define SPKRPHONE_AEC_ON    1
  825. #define SPKRPHONE_AEC_LO    2
  826. #define SPKRPHONE_AEC_HI    4
  827.  
  828. //==========================================================================
  829. //--------------------------------------------------------------------------
  830. //    VxD support
  831. //
  832. //    NOTE: These names will be changed in the future to a generic 'driver'
  833. //        naming convention.
  834. //--------------------------------------------------------------------------
  835. //
  836. // Event bit fields.
  837. #define EVENT_TYPE_INT_DTMF                        0x0002
  838. #define EVENT_TYPE_INT_TX_READY                    0x0004
  839. #define EVENT_TYPE_INT_RX_READY                    0x0008
  840. #define EVENT_TYPE_INT_HOOK                        0x0010
  841. #define EVENT_TYPE_INT_RING                        0x0020
  842. #define EVENT_TYPE_INT_WRITE_DONE                0x0040
  843. #define EVENT_TYPE_INT_PLAYBACK_VOLUME_CHANGE    0x0080
  844. #define EVENT_TYPE_INT_RECORD_VOLUME_CHANGE        0x0100
  845. #define EVENT_TYPE_INT_ANALOG_SOURCE_CHANGE        0x0200
  846. #define EVENT_TYPE_INT_AEC_CHANGE                0x0400
  847. #define EVENT_TYPE_INT_PLAYBACK_MUTE_CHANGE        0x0800
  848. #define EVENT_TYPE_INT_RECORD_MUTE_CHANGE        0x1000
  849. #define EVENT_TYPE_INT_MIXER_CHANGE                0x2000
  850.  
  851. //---------------------------------------
  852. //    This is included for legacy support.
  853. //    This name is used by Ring 3 Drivers that use a software interrupt to
  854. //    get the PM entry point to the VxD. If it changes here, all users of this
  855. //    define must recompile.
  856. #define IPJ_VXDNAME        "QTIPJ   "
  857.  
  858. #define IXJ_DRV_NAME    TEXT("qtxjack.drv")
  859. #define IXJ_INST_NAME    TEXT("Internet PhoneJACK/Internet LineJACK")
  860.  
  861. // Typedefs
  862.  
  863. // For IOCTL_VxD_AddPerformanceStat & fnVxD_AddPerformanceStat
  864. typedef struct
  865. {
  866.     DWORD ulFlags;
  867.     LPSTR pszStatName;
  868.     LPSTR pszStatDescription;
  869.     LPVOID pStatFunc;
  870. } PERF_STAT, FAR *LPPERF_STAT;
  871.  
  872. // Set lpBufPointer to lpPerfStat, dwBufSize to sizeof( PERF_STAT )
  873.  
  874. /* pStatFunc points either directly to data (always a DWORD for now) */
  875. /* or, if PSTF_FUNCPTR_BIT is set, to a _cdecl function.  This function   */
  876. /* accepts a stat handle as it's argument and returns the stat in eax     */
  877. // The following #defines come from <perf.h>.
  878.  
  879. #ifndef PSTF_FUNCPTR
  880. #define PSTF_FUNCPTR    0x00000001
  881. #define PSTF_COUNT        0x00000000
  882. #define PSTF_RATE        0x00000002
  883. #endif
  884.  
  885. typedef struct ipj_vxd_devio
  886. {
  887.     DWORD    dwSize;
  888.     DEVNODE    dnDevNode;
  889.     DWORD    dwFunctionCode;
  890.     DWORD    dwReturn;
  891.     DWORD    dwSetData;
  892.     DWORD    dwBufSize;
  893.     LPVOID    lpBufPointer;
  894.     DWORD    dwOutBufSize;
  895.     LPVOID    lpOutBufPointer;
  896.     DWORD    dwReserved;    // Must be zero
  897. } IPJ_VXD_DEVIO;
  898.  
  899. #endif
  900.  
  901. //    eof: ixjDefs.h
  902.