home *** CD-ROM | disk | FTP | other *** search
/ Shareware 1 2 the Maxx / sw_1.zip / sw_1 / PROGRAM / SBDOS10.ZIP / README.1ST < prev    next >
Text File  |  1992-06-25  |  9KB  |  242 lines

  1. SBDOS v1.0 Distribution
  2. -------------------------
  3.  
  4. Michael Fulbright (msf@skaro.as.arizona.edu)
  5.  
  6.  
  7. INTRO
  8. -----
  9.  
  10. This distribution is derived from Steve Haehnichen's Sblast-BSD-1.4
  11. package for 386 UN*Xes to drive the Creative Labs(tm) Sound Blaster
  12. Pro(tm) (SBPro) card.  It should also work with the regular model as
  13. well (see APPENDIX 1).  I have converted the Sblast-BSD code into a set
  14. of linkable subroutines callable from MSC 5.1.  I believe it should be
  15. fairly straightfoward to make this package work with other MSDOS
  16. compilers.  I will discuss this point below in the section OTHER
  17. COMPILERS.
  18.  
  19. Be sure to read the other documentation files included, these are
  20. the original files that came with SBlast-BSD v1.4.
  21.  
  22. THIS CODE IS EXPERIENTAL - YOU ARE FREE TO DO WITH IT WHAT YOU WILL BUT
  23. I CAN NOT BE HELP RESPONSIBLE FOR DAMAGES/ETC.
  24.  
  25. REQUIREMENTS
  26. ------------
  27.  
  28. To fully utilize this package a SBPro is required, however, the SB is
  29. also supported.  This package supports recording and playing back
  30. samples with both cards.  The highest rate available with the SB,
  31. however, is around 22khz, while with the SBPro is approximately 44khz.
  32. Also, the mixer functions will only work if you have a SBPro, as the SB
  33. has no on-board mixer.  If you own a SB I believe you will also have to
  34. have a DSP v2.0 or higher, although I dont have an earlier board so I
  35. havent tested it.
  36.  
  37. I am currently stuck using MSC 5.1 in the LARGE model, so if you have a
  38. later compiler from Microsoft then these routines should work out of the
  39. box if your compiler is backwards compatable.  I think the Borland
  40. compilers should work as well, although I think some changes will be
  41. required.  If someone has a Borland compiler and gets this working
  42. please let me know what changes were required. I havent tried to get
  43. these routines to work in any memory model other than LARGE, so I dont
  44. make any guarantees about other memory models.
  45.  
  46.  
  47. FILES
  48. -----
  49.  
  50. The following source files should be in this distribution:
  51.  
  52. SB_DRIVE.C - Main driver, contains all callable routines
  53. RECORDER.C - Example file, records from the Mic input
  54. PLAYER.C   - Example file, plays raw or .VOC files
  55. RAW2VOC.C  - Stick a .VOC header on a raw sound file
  56. GETOPT.C   - GNU option parser, needed for RECORDER.C and PLAYER.C
  57.  
  58. SBLAST.H   - These two files contain constants and struct definitions
  59. SB_REGS.H  -    needed for calling SB_DRIVE routines.
  60. GETOPT.H   - Not needed, but should be distributed with GETOPT.C
  61.  
  62. Also you should have the following documents:
  63.  
  64. COPYING    - GNU policy, needed for GETOPT.* files
  65. INSTALL    - Original docs for Sblast-BSD v1.4 distribution
  66. README     -    "       "
  67. README.2   - This file
  68. VOCFILE.TXT - Info on the .VOC file format
  69.  
  70. And a sample sound file
  71.  
  72. SAMPLE.VOC - nice test sound
  73.  
  74.  
  75. GETTING STARTED
  76. ---------------
  77.  
  78. I havent created a Makefile for the test programs since everything
  79. is small and people use so many different make utilities.
  80.  
  81. First you need to look in SB_REGS.H and near the top set the #define
  82. SB_DMA_CHAN to whatever your card is set to.  The factory default is 1.
  83.  
  84. Next edit both recorder.c and player.c. Look for two lines which are
  85. something like
  86.  
  87. dev.addr = 0x220;
  88. dev.irq  = 7;
  89.  
  90. Change these two lines to whatever your card is setup for.  The factory
  91. defaults are 0x220 and 7.  The file INSTALL contains some useful
  92. information about the setup of your card.  If you arent sure how yor
  93. card is setup then one thing is too check your environment for the
  94. variable BLASTER.  You can check this by going into DOS and typing
  95.  
  96. SET
  97.  
  98. Look for the variable BLASTER which should look something like
  99.  
  100. BLASTER=A220 I7 D1 T2
  101.  
  102. which means my card uses address 0x220, irq 7 and DMA channel 1.
  103.  
  104. For those of you with Sound Blasters (not Pros) see Appendix 1 before
  105. proceeding.
  106.  
  107. If you still dont know how your card is setup I wouldnt go any farther
  108. till you find out.
  109.  
  110.  
  111. COMPILING THE TEST PROGRAMS
  112. ---------------------------
  113.  
  114. BE SURE YOU'VE READ THE SECTION "GETTING STARTED" FIRST!
  115.  
  116. Once you've made the changes given above, you can try out the example
  117. programs. If your compiler is MSC 5.1 or compat, then do the following
  118. to compile
  119.  
  120. cl /AL /Ox player.c getopt.c sb_drive.c
  121.  
  122. If all goes well then compile the second program
  123.  
  124. cl /AL /Ox recorder.c getopt sb_drive
  125.  
  126. (Note - since we've already compiled getopt and sb_drive no need to
  127.     do it again.)
  128.  
  129. First I would test the 'player' program first. Try the following command
  130.  
  131. player sample.voc
  132.  
  133. If you dont hear anything check that your card is setup ok (volume up,
  134. speaker connected, ect). If that doesnt help then contact me.
  135.  
  136. If that works then now you can try recording with the program 'recorder'.
  137. Try the following (make sure your microphone is connected):
  138.  
  139. record a.voc
  140.  
  141. The program will prompt you to hit return to start recording, and will
  142. stop recording when you press a key.  To play back what you just
  143. recorded try
  144.  
  145. player a.voc.
  146.  
  147. Look at the source code for both programs, there are many options
  148. controlling the data rate and volume.  Stereo output doesnt seem to work
  149. for me, if someone knows how to record/playback in stereo I would like
  150. to know how!
  151.  
  152. Also included is raw2voc.c, which shows how to create a .VOC header.
  153.  
  154.  
  155. WRITING YOUR OWN PROGRAMS
  156. -------------------------
  157.  
  158. Look at the two sample programs for ideas.  Read through the SB_DRIVE.C
  159. code as well as the two include files SB_REGS.H and SBLAST.H.  There is
  160. a wealth of information there, and its how I learned what I know about
  161. programming the SB.  Let me add a few comments.
  162.  
  163. The first thing to do when writing a program is to call sb_probe() to
  164. see if a card exists.  If there is a card then call sb_attach() to set
  165. things up.  You should make sure sb_unattach() is called when your
  166. program exits.  I have done that with MSC by using the atexit() function
  167. to ensure sb_unattach() is run whenever the program exits.  This
  168. function is supposed to be ANSI compatable, so most compilers should
  169. support it, but check your docs.
  170.  
  171. The sampling parameters are controlled by calls to functions starting
  172. with dsp_.  For example, dsp_set_speed sets the sampling/playback rate.
  173. Read through the SB_DRIVE.C program to get a feeling for the commands
  174. available.  In addition, for those with a SB Pro the mixer_* routines
  175. control the onboard mixer, allowing one to enable/disable filters,
  176. increase/decrease the volume levels of all inputs and outputs
  177. independently, and other neat stuff.  These functions WILL NOT work with
  178. a regular Sound Blaster.
  179.  
  180. I hope to have some more programs using these routines out soon.  I
  181. think if you spend some time reading the source you can figure it out,
  182. and then you can change it to how you would have done it if it so
  183. strikes you.  I'm releasing this code under the same arrangement as the
  184. original author.  I would like to hear about any changes you make or
  185. problems you have making it work.
  186.  
  187.  
  188.  
  189. OTHER COMPILERS
  190. ---------------
  191.  
  192. I'm not familiar with other compilers, but I think I can anticipate some
  193. potential problems.
  194.  
  195. 1) sb_intr: In SB_DRIVE.C there is a routine called sb_intr.  This
  196.         function services the interupt which occurs when a dma
  197.         function is completed.  Make sure the function declaration
  198.         is correct for your compiler, as your compiler must know to
  199.         do some special things since this is an interupt handler.
  200.  
  201. 2) init_timers:  This routine figures out how many loops/sec your machine
  202.          can do. Its used for various timing applications in the
  203.          code. The routine _bios_timeofday() returns the #
  204.          of timer ticks since midnight, where there are 18.3 ticks
  205.          a second. Your compiler may have a different way to
  206.          call this BIOS service.
  207.  
  208. 3) Pointers: I assume that far pointers are stored in a segment:offset
  209.          format in unsigned longs.  Your compiler may do this
  210.          differently (I cant see why, but..) so make sure this is
  211.          how yours does it.  The function find_dma_buffers() in
  212.          particular will die on this.
  213.  
  214.  
  215. APPENDIX 1 - Regular Sound Blaster Owners
  216. -----------------------------------------
  217.  
  218. These routines assume a SBPro is installed. You can use these
  219. routines, however, as long as no calls are made to the mixer_* functions.
  220. Also, you must not run things in HIGH SPEED MODE. I think a change
  221. will be required in dsp_open() to remove a reference to dsp_set_stereo(),
  222. which wont work on SB. If someone does get these routines to
  223. work with a SB please let me know what changes you made.
  224.  
  225.  
  226. ----------------------------------------------------------------------------
  227.  
  228. You can reach me at msf@skaro.as.arizona.edu with questions and comments.
  229. I am always interested in more information about the SB or Pro.
  230. If anyone wants to use the FM or MIDI functions which appear in the
  231. original Sblast-BSD v1.4, I dont think the conversion would be difficult.
  232. I you see what I did for the DSP functions then I think it would be
  233. straightforward to convert the FM/MIDI routines as well. Let me know if you
  234. want help. I didnt convert that code because I really wasnt sure what to
  235. do with them.  Also, in the future I would like to try to get some
  236. routines working under the DJGPP compiler, so if anyone knows anything
  237. about that please forward the info to me.
  238.  
  239. ENJOY!
  240. Michael Fulbright
  241. msf@skaro.as.arizona.edu
  242.