home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PCGPEV10.ZIP / SBPRO.TXT < prev    next >
Text File  |  1994-05-10  |  10KB  |  268 lines

  1.  
  2.                   ┌──────────────────────────────────┐
  3.                   │ Programming the SoundBlaster Pro │
  4.                   └──────────────────────────────────┘
  5.  
  6.                   Written for the PC-GPE by Mark Feldman
  7.               e-mail address : u914097@student.canberra.edu.au
  8.                                myndale@cairo.anu.edu.au
  9.  
  10.              ┌───────────────────────────────────────────┐
  11.              │      THIS FILE MAY NOT BE DISTRIBUTED     │
  12.              │ SEPARATE TO THE ENTIRE PC-GPE COLLECTION. │
  13.              └───────────────────────────────────────────┘
  14.  
  15.  
  16. ┌────────────┬───────────────────────────────────────────────────────────────
  17. │ Disclaimer │
  18. └────────────┘
  19.  
  20. I assume no responsibility whatsoever for any effect that this file, the
  21. information contained therein or the use thereof has on you, your sanity,
  22. computer, spouse, children, pets or anything else related to you or your
  23. existance. No warranty is provided nor implied with this information.
  24.  
  25. ┌──────────────┬─────────────────────────────────────────────────────────────
  26. │ Introduction │
  27. └──────────────┘
  28.  
  29. I still own a SoundBlaster 1.0 (don't laugh) so I haven't been able to
  30. test any of the information in this file, ie don't take any of this as
  31. fact.
  32.  
  33. ┌──────────────┬─────────────────────────────────────────────────────────────
  34. │ Stereo Sound │
  35. └──────────────┘
  36.  
  37. Generating stereo FM sound on the SB Pro is similar to the way it's done
  38. on the SB 1.x, you just use different ports for the left and right channels.
  39. The file ADLIB.TXT has more information on this.
  40.  
  41. Generating stereo sounds with the DSP is similar to the mono method, but you
  42. send *two* bytes for every sample. The first one goes to the left channel
  43. and the second one goes to the right. You also need to reset the mixer chip
  44. and tell the soundblaster you want to play a stereo sound (see below). This
  45. has the advantage in that you can store the info for both channels in a
  46. single data block and transfer it by still using only one DMA channel. The
  47. WAV file format actually stores it's audio waveform data like this (see the
  48. PC-GPE file WAV.TXT).
  49.  
  50.  
  51.   Left channel bytes
  52.  
  53.   0       1       2       3       4       5       6
  54. ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───
  55. │   │   │   │   │   │   │   │   │   │   │   │   │   │   │   ........
  56. └───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───
  57.       0       1       2       3       4       5       6
  58.  
  59.   Right channel bytes
  60.  
  61. To play the sound the SoundBlaster Pro is set for stereo output and the DMA
  62. chip is programmed to send this chunk as is.
  63.  
  64.  
  65. ┌────────────────────────┬───────────────────────────────────────────────────
  66. │ The CT 1345 Mixer Chip │
  67. └────────────────────────┘
  68.  
  69.  
  70. You access the mixer registers the same way you access the regular SB
  71. registers, but Port 2x4h is the index port and 2x5h is the data read/write
  72. port, where x = 2 for base address jumper setting 220h
  73.             x = 3 for base address jumper setting 230h
  74.             x = 4 for base address jumper setting 240h
  75.  
  76. So setting a mixer register to a given value can be accomplished with the
  77. following procedure:
  78.  
  79. { base = 220h, 230 or 240h }
  80. procedure SetMixerReg(base : word; index, value : byte);
  81. begin
  82.   Port[base + 4] := index;
  83.   Port[base + 5] := value;
  84. end;
  85.  
  86.  
  87. You can also read a register's current value:
  88.  
  89. function GetMixerReg(base : word; index : byte) : byte;
  90. begin
  91.   Port[base + 4] := index;
  92.   GetMixerReg := Port[base + 5];
  93. end;
  94.  
  95.  
  96.  
  97.  
  98.  
  99. The Data Reset register is used to reset the mixer chip. Set this register to
  100. 0 before changing any of the other mixer registers.
  101.  
  102.               Index = 00h
  103.               ┌───┬───┬───┬───┬───┬───┬───┬───┐
  104.               │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  105.               └───┴───┴───┴───┴───┴───┴───┴───┘
  106.                 └─────────────┬─────────────┘
  107.                               │
  108.                           Data Reset
  109.  
  110.  
  111.  
  112.  
  113. The Input register selects the SB Pro sound input source and filter type.
  114.  
  115.               Index = 0Ch
  116.               ┌───┬───┬───┬───┬───┬───┬───┬───┐
  117.               │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  118.               └───┴───┴───┴───┴───┴───┴───┴───┘
  119.                         └───┬───┘   └─┬─┘
  120.                             │         │
  121.                 ┌───────────┴─────┐ ┌─┴─────────────────┐
  122.                 │ In Filter       │ │ ADC Source        │
  123.                 │ 000 - Low       │ │ 00 - Microphone 1 │
  124.                 │ 001 - High      │ │ 01 - CD           │
  125.                 │ 010 - No Filter │ │ 10 - Microphone 2 │
  126.                 └─────────────────┘ │ 11 - Line In      │
  127.                                     └───────────────────┘
  128.  
  129.  
  130.  
  131. The Output register determines whether to output sound in stereo or mono, in
  132. stereo two bytes must be sent for each sample, the first one goes to the left
  133. channel and the next one goes to the right. This register allows you to
  134. bypass the output filter.
  135.  
  136.               Index = 0Eh
  137.               ┌───┬───┬───┬───┬───┬───┬───┬───┐
  138.               │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  139.               └───┴───┴───┴───┴───┴───┴───┴───┘
  140.                         │               │
  141.            ┌────────────┴──────────┐ ┌──┴─────────┐
  142.            │ DNFI                  │ │ VSTC       │
  143.            │ 0 - Use O/P Filter    │ │ 0 - Mono   │
  144.            │ 1 - Bypass O/P Filter │ │ 1 - Stereo │
  145.            └───────────────────────┘ └────────────┘
  146.  
  147.  
  148. The Master Volume register allows you to set the master volume of each
  149. channel:
  150.  
  151.               Index = 22h
  152.               ┌───┬───┬───┬───┬───┬───┬───┬───┐
  153.               │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  154.               └───┴───┴───┴───┴───┴───┴───┴───┘
  155.                 └─────┬─────┘   └─────┬─────┘
  156.                       │               │
  157.              ┌────────┴──────┐┌───────┴───────┐
  158.              │ Master Volume ││ Master Volume │
  159.              │     Left      ││     Right     │
  160.              └───────────────┘└───────────────┘
  161.  
  162.  
  163. The Voice Volume register allows you to set the volume of each channel for
  164. DSP output:
  165.  
  166.               Index = 04h
  167.               ┌───┬───┬───┬───┬───┬───┬───┬───┐
  168.               │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  169.               └───┴───┴───┴───┴───┴───┴───┴───┘
  170.                 └─────┬─────┘   └─────┬─────┘
  171.                       │               │
  172.               ┌───────┴──────┐┌───────┴──────┐
  173.               │ Voice Volume ││ Voice Volume │
  174.               │     Left     ││     Right    │
  175.               └──────────────┘└──────────────┘
  176.  
  177.                  Voice Volume    Voice Volume
  178.                     Left            Right
  179.  
  180.  
  181. The FM Volume register allows you to set the volume of each channel for
  182. FM wave synthesis:
  183.  
  184.  
  185.  
  186.               Index = 26h
  187.               ┌───┬───┬───┬───┬───┬───┬───┬───┐
  188.               │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  189.               └───┴───┴───┴───┴───┴───┴───┴───┘
  190.                 └─────┬─────┘   └─────┬─────┘
  191.                       │               │
  192.                 ┌─────┴─────┐   ┌─────┴─────┐
  193.                 │ FM Volume │   │ FM Volume │
  194.                 │   Left    │   │   Right   │
  195.                 └───────────┘   └───────────┘
  196.  
  197.  
  198. The CD Volume register allows you to set the volume of each channel for
  199. CD output:
  200.  
  201.               Index = 28h
  202.               ┌───┬───┬───┬───┬───┬───┬───┬───┐
  203.               │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  204.               └───┴───┴───┴───┴───┴───┴───┴───┘
  205.                 └─────┬─────┘   └─────┬─────┘
  206.                       │               │
  207.                 ┌─────┴─────┐   ┌─────┴─────┐
  208.                 │ CD Volume │   │ CD Volume │
  209.                 │   Left    │   │   Right   │
  210.                 └───────────┘   └───────────┘
  211.  
  212.  
  213. The Line Volume register allows you to set the volume of each channel for
  214. line in channel:
  215.  
  216.  
  217.               Index = 2Eh
  218.               ┌───┬───┬───┬───┬───┬───┬───┬───┐
  219.               │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  220.               └───┴───┴───┴───┴───┴───┴───┴───┘
  221.                 └─────┬─────┘   └─────┬─────┘
  222.                       │               │
  223.                ┌──────┴──────┐ ┌──────┴──────┐
  224.                │ Line Volume │ │ Line Volume │
  225.                │    Left     │ │    Right    │
  226.                └─────────────┘ └─────────────┘
  227.  
  228. The Mic Mixing register allows you to set the input volume for the
  229. microphone:
  230.  
  231.               Index = 0Ah
  232.               ┌───┬───┬───┬───┬───┬───┬───┬───┐
  233.               │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  234.               └───┴───┴───┴───┴───┴───┴───┴───┘
  235.                                     └───┬───┘
  236.                                         │
  237.                                  ┌──────┴─────┐
  238.                                  │ Mic Mixing │
  239.                                  └────────────┘
  240.  
  241. ┌────────────┬───────────────────────────────────────────────────────────────
  242. │ References │
  243. └────────────┘
  244.  
  245. Title : The SoundBlaster Developpers Kit
  246. Publishers : Creative Labs Inc
  247.              Creative Technology PTE LTD
  248.  
  249. Title : Sound Blaster - The Official Book
  250. Authors : Richard Heimlich, David M. Golden, Ivan Luk, Peter M. Ridge
  251. Publishers : Osborne/McGraw Hill
  252. ISBN : 0-07-881907-5
  253.  
  254. Some of the information in this file was either obtained from or verified
  255. by the source code in a public domain library called SOUNDX by Peter
  256. Sprenger. I haven't tried using his library yet (I don't have a C compiler
  257. at the moment) but it looks very well done and contains numerous sound card
  258. detection routines. Says Peter : "It would be nice, that when you make
  259. something commercial with my routines, that you send me a copy of your
  260. project or send me some bucks, just enough for pizza and coke to support my
  261. night programming sessions. If you send me nothing, ok. But USE the stuff,
  262. if you can need it!". Heh...a REAL programmer!
  263.  
  264. ftp site: ftp.uwp.edu
  265. directory: /pub/msdos/demos/programming/game-dev/source
  266. filename: soundx.zip
  267.  
  268.