home *** CD-ROM | disk | FTP | other *** search
/ Sound, Music & MIDI Collection 2 / SMMVOL2.bin / PROG / SOUNDSS3.ZIP / SOUNDSYS.DOC < prev    next >
Encoding:
Text File  |  1995-03-11  |  16.6 KB  |  400 lines

  1. ╔════════════════════════════════════════════════════════════╗
  2. ║                                                            ║
  3. ║ Sound System Source for your own productions (games&demos) ║
  4. ║                                                            ║
  5. ║ coded and provided in 1995 by the Frontman of Crew242 !!!  ║
  6. ║                                                            ║
  7. ╚════════════════════════════════════════════════════════════╝
  8.  
  9. RELEASE 3
  10.  
  11. Enhanced SB/SBPro player with volume amplifying and interpolation.
  12. Added SB16 and PAS+/16 player with maximum quality and speed (hope so).
  13. Added C interface for Borland C 3.1
  14. Added auto-detection routines coded by Chicken of S!P.
  15. Included TheCrab.MOD from the great game 'Future Dimension'.
  16.  
  17. RELEASE 2
  18.  
  19. Minor changes because of wrong config filename (sorry)!
  20. Took out the specific file-volume routines of Future Dimension.
  21.  
  22. Added one of my favourite modules that always reminds me on good ol' C-64.
  23. This is Thalamus.MOD by good ol' Rob Hubbard and converted by M. Simmonds.
  24.  
  25. RELEASE 1
  26.  
  27. First release.
  28.  
  29. ══════════════════════════════════════════════════════════════════════════════
  30.  
  31. This Sound System Source package includes:
  32.  
  33. SOUNDSYS.DOC  This file
  34.  
  35. DETSOUND.ASM  Auto-detection for all cards provided
  36.  
  37. SBMOD.COM     SoundBlaster (Pro) module player, eg. SBMOD THECRAB.MOD
  38. SBMOD.ASM     SoundBlaster (Pro) player source
  39.  
  40. SB16MOD.COM   SoundBlaster 16 module player, eg. SB16MOD COMPLICA.MOD
  41. SB16MOD.ASM   SoundBlaster 16 player source
  42.  
  43. PASMOD.COM    Pro Audio Spectrum +/16 module player, eg. PASMOD THALAMUS.MOD
  44. PASMOD.ASM    Pro Audio Spectrum player source
  45.  
  46. USMOD.COM     Gravis UltraSound  module player, eg. USMOD CYBRNOID.MOD
  47. USMOD.ASM     Gravis UltraSound  player source
  48.  
  49. CPLAY.C       Sample of a player in C
  50. CINTSS3.C     C interface for all players.
  51. CPLAY.PRJ     Project file to compile & link with Borland's C 3.1 IDE
  52.  
  53. SS3.CFG       Configuration file
  54.  
  55. and some object files...
  56.  
  57.  
  58. Agreement:
  59.  
  60. This programs are free software only and may not be sold other than the cost
  61. of the disk or physical handling. You can redistribute it only in the same
  62. form as you have received it.
  63. This program is distributed WITHOUT ANY WARRANTY nor is it responsible for
  64. any damage of computer software and/or hardware.
  65.  
  66. ══════════════════════════════════════════════════════════════════════════════
  67.  
  68. What does this Sound System ?
  69.  
  70.  
  71. For SoundBlaster (Pro/16):
  72.  
  73. - 4/8 channels Protracker/Fasttracker module playing
  74. - 2/4 channels for FX
  75. - Full Protracker 2.1A effects support
  76. - 4 times amplified and linear interpolated mixing
  77. - Mixing rates 10000 - 22222 Hz
  78. - SBPro/SB16 stereo support
  79. - 656 KB EMS support for FX
  80. - 100% Assembler for high perfomance -> takes only 15% cpu time
  81. - 12kb code, 8kb mixbuf, 16kb volumetable, 0-64kb trackbuf, 0-???kb samples
  82.  
  83.  
  84. For Soundblaster 16 and Pro Audio Spectrum +/16:
  85.  
  86. - 4/8 8/16bit channels Protracker/Fasttracker module playing
  87. - 8 8/16bit channels with panning for stereo FX
  88. - Full Protracker 2.1A effects support
  89. - Extended MOD effects support (Panning Effect E8x)
  90. - 4 times amplified and 16bit interpolated mixing
  91. - Mixing rates 10000 - 44100 Hz
  92. - Always stereo
  93. - 592 KB EMS support for FX
  94. - 11kb code, 32kb mixbuf, 32kb volumetable, 0-???kb samples
  95.  
  96.  
  97. For Gravis UltraSound:
  98.  
  99. - 4/6/8 channels Protracker/Fasttracker module playing
  100. - 16 channels with panning for stereo FX
  101. - Extended MOD effects support (Panning Effect E8x)
  102. - Mixing rate always 44100 Hz
  103. - Always stereo
  104. - Full 8/16-bit DMA support for sample upload (optional without)
  105. - Max 1 MB GUS memory for samples
  106. - 100% Assembler for high perfomance -> takes almost no cpu time
  107. - 13kb code, 0-64kb trackbuf
  108.  
  109.  
  110. ══════════════════════════════════════════════════════════════════════════════
  111.  
  112. Where from, why, what for ?
  113.  
  114.  
  115. This Sound System has actually been developed for FUTURE DIMENSION of Crew242,
  116. a new, commercial, neckbreaking shootem up game of the new generation.
  117.  
  118. I decided to spread the Sound System as freeware (yes! the source is freeware)
  119. because I dont like adlib neither midi sounds very much. Modules for everyone.
  120. Anyway, modules produce the best sound and UltraSound is the best card for it.
  121.  
  122. Use it in any manner for your productions. For major assimilations it is
  123. necessary to change the source, eg. you need an object instead of a com-file,
  124. you dont want to have a configuration file, etc.
  125. The sources are written for Borland C, Tasm 3.1 and its Tlink /t option
  126. for COMs. Some people experienced that Tasm 4.0 doesn't work correctly,
  127. so don't waste time and get a copy of Tasm 3.1.
  128.  
  129. ╔════════════════════════════════════════════════════════════════════════════╗
  130. ║                                                                            ║
  131. ║ All I want is a short credit in your production for the Sound System like: ║
  132. ║                                                                            ║
  133. ║ "Sound System by Frontman of Crew242" or "Sound System by Silvio Turello"  ║
  134. ║                                                                            ║
  135. ║ I will also do that for the pioneers of module sound. Thanks goes to:      ║
  136. ║                                                                            ║
  137. ║ Adrian Studer       for running the kewlest Swiss coder mailbox            ║
  138. ║ (Chicken/S!P)                                                              ║
  139. ║ Lars "Zap" Hamre    for inventing the protracker de facto standard         ║
  140. ║ (Amiga Freelancers)                                                        ║
  141. ║ Joshua C. Jensen    for porting it to pc                                   ║
  142. ║ (Form. Renaissance)                                                        ║
  143. ║ Serge Huber         for giving me a hint, how to make a SB-player          ║
  144. ║ (Numerus/Imphobia)                                                         ║
  145. ║ Robert Adolfsson    for showing me, how to make a GUSPLAY (-er)            ║
  146. ║ (Robban/Cascada)                                                           ║
  147. ║                                                                            ║
  148. ║ Give always the complete package away !                                    ║
  149. ║                                                                            ║
  150. ║ If you want to be nice and you are allowed to give away a copy of your     ║
  151. ║ production, I would really appreciate to get a copy of it just because     ║
  152. ║ I am always interested in good sounding soft. I will of course respect     ║
  153. ║ any requests not to spread the copy you send me. It will be exclusively    ║
  154. ║ for the Frontman of Crew242. Refer to the address below:                   ║
  155. ║                                                                            ║
  156. ║ Silvio Turello, Giebeleichstr. 58, 8152 Glattbrugg, Switzerland            ║
  157. ║                                                                            ║
  158. ║ Tel.: ++/1/810 70 96    Fax: ++/1/810 85 63                                ║
  159. ║                                                                            ║
  160. ║ Email address until 1999: sturello@iiic.ethz.ch                            ║
  161. ║                                                                            ║
  162. ╚════════════════════════════════════════════════════════════════════════════╝
  163.  
  164. ══════════════════════════════════════════════════════════════════════════════
  165.  
  166. How ?
  167.  
  168.  
  169. Now it is time to give some technical details about the routines.
  170. The COM-format is quite unusual, but it has some important advantages,
  171. eg. you always now, what is going on, because you can load it in your own
  172. segment (at offset 100h) without relocating. the start address is 100h with
  173. a jump table for its functions. the functions can be reached with a far call
  174. to seg:104h, seg:108h, etc.
  175.  
  176. The following code is a prototyp of a possible implementation in your program:
  177.  
  178. ;=============================================================================
  179. INIT_MUSIC PROC NEAR
  180.     CALL    ALLOC_MUSIC        ;ALLOCATE MEMORY FOR PLAYER
  181.     CALL    LOAD_PLAYER        ;LOAD THE RIGHT PLAYER
  182.     MOV    MUSIC_FILE,0
  183.     RET
  184. INIT_MUSIC ENDP
  185. ;=============================================================================
  186. START_MUSIC PROC NEAR
  187.     CMP    PLAYER,0        ;IS A PLAYER IN THE MEMORY?
  188.     JE    SHORT GMUA1
  189.     MOV    MUSIC_FILE,AX        ;LOAD MUSIC
  190.     MOV    DX,OFFSET MOD_NAME
  191.     MOV    BP,2
  192.     CALL    PLAYER_FUNCTION
  193.     JC    SHORT GMUA2
  194.     CALL    MUSIC_SETTINGS        ;SET PLAYING PARMS
  195.     CALL    LOAD_SAMPLES        ;LOAD SAMPLES
  196.     MOV    BP,3            ;START MUSIC
  197.     CALL    PLAYER_FUNCTION
  198.     JNC    SHORT GMUA1
  199. GMUA2:    CALL    STOP_MUSIC        ;DISABLE ALL MUSIC AFTER ERROR
  200.     MOV    PLAYER,0
  201.     CALL    FREE_MUSIC
  202. GMUA1:    RET
  203. START_MUSIC ENDP
  204. ;=============================================================================
  205. STOP_MUSIC PROC NEAR
  206.     CMP    MUSIC_FILE,0
  207.     JE    SHORT GMUC1
  208.     MOV    BP,4            ;STOP MUSIC
  209.     CALL    PLAYER_FUNCTION
  210.     MOV    BP,8            ;REMOVE SAMPLES
  211.     CALL    PLAYER_FUNCTION
  212.     MOV    BP,5            ;REMOVE MUSIC
  213.     CALL    PLAYER_FUNCTION
  214. GMUC1:    MOV    MUSIC_FILE,0
  215.     RET
  216. STOP_MUSIC ENDP
  217. ;=============================================================================
  218. CLOSE_MUSIC PROC NEAR
  219.     CALL    DEALLOC_MUSIC        ;REMOVE PLAYER
  220.     RET
  221. CLOSE_MUSIC ENDP
  222. ;=============================================================================
  223. PLAYER_FUNCTION PROC NEAR
  224.     PUSHA
  225.     PUSH    DS
  226.     SHL    BP,2
  227.     ADD    BP,0100H
  228.     MOV    MUSIC_CALL,BP
  229.     CALL    DWORD PTR DS:[MUSIC_CALL]    ;MUSIC_CALL IS A FAR POINTER
  230.     POP    DS
  231.     POPA
  232.     RET
  233. PLAYER_FUNCTION
  234. ;=============================================================================
  235.  
  236. The functions of the players are translated to a number in BP:
  237.  
  238. BP =  1    CONFIG_INIT               IF CARRY RETURNED IS 1 THEN ERROR
  239.       2    LOAD_MOD                  DS:DX IS POINTER TO FILENAME
  240.  
  241.       3    PLAY_MUSIC                IF CARRY RETURNED IS 1 THEN ERROR
  242.       4    STOP_MUSIC
  243.       5    END_MUSIC
  244.  
  245.       6    LOAD_SAMPLE               DS:DX IS POINTER TO FILENAME
  246.                                   CL=0/80H AMIGA/PC SAMPLE
  247.                       RETURNED AX IS HANDLE OF THE SAMPLE
  248.       7    PLAY_SAMPLE               BX= HANDLE, CX= FREQUENCY
  249.       8    END_SAMPLE
  250.  
  251.       9    SET_SAMPLERATE            AX=RATE 10000-44100
  252.  
  253.      10    GET_VOLUME              \ AL=MASTER_VOLUME
  254.      11    SET_VOLUME              / BL=MUSIC_VOL, BH=FX_VOL
  255.  
  256.      12    SET_SONGLOOP              AL=PATTERN ORDER, >127 IS NO LOOP
  257.  
  258.      13    GET_SONGPOSITION        \ AL=0..127 POSITION IN PATTERN ORDER
  259.     SET_SONGPOSITION        /
  260.  
  261.      14    GET_SONGMOD             \ AL=0 MUSIC & FX, =1 MUSIC ONLY
  262.      15    SET_SONGMOD             /   =2 FX ONLY, =3 NO SOUND
  263.  
  264. Each .ASM module is actually a full player for itself. The default of the
  265. assembler variable "COM_OR_OBJ" is 0 that the .COM output is a player that
  266. can be used in DOS, eg. USMOD TheCrab.MOD. The .COM files provided in
  267. SoundSS3 have a DOS-interface and are ready for use.
  268. If "COM_OR_OBJ" is <> 0, the output is the .OBJ file and the .COM cannot be
  269. used as player because the DOS-interface is replaced by the C-interface.
  270. Remember that for use in C you must set "COM_OR_OBJ=1" and recompile. After
  271. that you can use the .OBJ for linking with C modules. The .OBJ files
  272. provided in SoundSS3 are already like this and ready for linking with
  273. C modules, eg. CPLAY. For implementations in C refer to CPLAY.
  274.  
  275. ══════════════════════════════════════════════════════════════════════════════
  276.  
  277. Some hints...
  278.  
  279.  
  280. The players use a 1024 Hz interrupt generated by the timer or by the realtime
  281. clock. If it is the timer, the old irq is chained at the normal frequency.
  282. Most options can be set in the SS3.CFG configuration file.
  283.  
  284. The SoundBlaster player uses in this version 656/592kb EMS for FX and only
  285. conventional memory to hold the whole module. It should be no problem to
  286. use EMS for the module data too.
  287.  
  288. All players are very stable. That means, that they wont crash because of
  289. a wrong baseport, irq, dma, etc. It may happen that DMA stops after use
  290. of Playfile or some other players. In this case start ultrinit before
  291. using usmod. If you encounter problems, remember that the interface does
  292. never recover any registers especially es, ds segment registers because
  293. it is speed and memory optimized code.
  294.  
  295. The players dont use the MOD patterns as internal format because of too many
  296. repetitions in channels. The loader splits up the patterns into tracks for
  297. each channel and generates instead of the pattern order table a track order
  298. table for each channel. That means, if a channel plays always the same like
  299. a drum channel, it needs just the memory of one track. It is similar to the
  300. MTM format. The differences between MOD and MTM's memory requirements for the
  301. same song can range from 20 to over 100kb.
  302. The SB/SBPro/SB16/PAS players precalculate most periods to notes.
  303. Refer to the actual loader for more details about the internal format.
  304.  
  305. If you encounter speed problems with SB16 or PAS players, you should use
  306. a lower samplerate. In case of SB16 you can also use the SBPro player that
  307. is also stereo on SB16 (fixed and working now) but much faster.
  308. The big speed difference between SBPro and SB16 player is caused by the
  309. 16bit calculating and the panning (each channel is mixed twice!)
  310.  
  311.  
  312. FAQ (frequently asked questions):
  313.  
  314. 1. Q: Can you help me implementing your SoundSystem in my demo/game?
  315.    A: Sorry, I have my own projects and even for them not enough spare time.
  316.       I have already spent a lot of time providing this SoundSystem...
  317.  
  318. 2. Q: Can you help me making a interface for a higher programming
  319.       language because I don't know Assembler very well?
  320.    A: With the C-interface provided in this version you have the base
  321.       to make another interface, eg. for TP. But in general I strongly
  322.       recommend to know Assembler.
  323.  
  324. 3. Q: Where can I get docs/infos about Assembler? How can I learn it?
  325.    A: I have learnt Assembler with books. There are a lot of ASM beginner
  326.       books around, but you need such a book only if you are an absolut
  327.       beginner and don't even know what a binary/hex number is. After a
  328.       while you just want to have a reference like the Tasm reference book.
  329.       This book describes all CPU instructions very detailed but doesn't
  330.       feed up with unnecessary comment.
  331.  
  332. 4. Q: I cannot make it running with a higher prog. language?
  333.    A: Note that in Assembler everything is very clear but in a higher prog.
  334.       language you don't know how the compiler does the code. In most
  335.       cases the compiler does something you don't expect and causes the
  336.       problem, eg. compiler uses some registers for internal variables you
  337.       don't see in your program but when you call an ASM procedure you
  338.       should recover these registers. Critical registers are DS, BP, SI, DI,
  339.       ES, etc.
  340.  
  341. 5. Q: When and how can I get an update?
  342.    A: You will see new versions on some very well known ftp servers first.
  343.  
  344. 6. Q: When will you support other music formats?
  345.    A: The SoundSystem is designed for non-specific music programs.
  346.       This means, you should not plan to make a player like Iplay or DMP
  347.       but for games and demos you can choose your own music format and this
  348.       should be MOD (maybe it is not the best but it is still powerful enough
  349.       to realize your project)
  350.  
  351. ══════════════════════════════════════════════════════════════════════════════
  352.  
  353. Personal greetings...
  354.  
  355. Maxwood of Majic12,
  356. how about your game? Is it out now? As I told you, it does pay for you to
  357. update the SoundSystem...
  358. (compare the quality of SB16 sound to the one before!!!)
  359.  
  360. André Baresel & Craig Jackson,
  361. great and complete docs about SoundBlaster, unfortunately I already had
  362. the SoundBlaster Profibuch from Addison-Wesley...
  363.  
  364. Stuart C. (The Dooze) from Australia,
  365. here you are. Look at the C-interface and maybe you'll find a way to
  366. implement SoundSS3 in TP7...
  367.  
  368. Guiseppe Alleva from Milano/Italy,
  369. this is now the new version. It is a major update so I think it does pay
  370. when you also update your graphics library...
  371.  
  372. PCheng from Vancouver/Canada,
  373. sorry, but I'm still avoiding TP...
  374.  
  375. Steven J Streeting from the UK,
  376. have you got now a copy of TASM3.1?
  377. (Even better a copy of the whole Borland C++ 3.1 with the IDE)...
  378.  
  379. Roger Wong from the US,
  380. how about POWball? Unfortunately at the time I'm writing our game is not
  381. out yet but it will be in 2-3 weeks...
  382. Btw there is a book out now with a lot of programming tricks called
  383. "PC underground", maybe there you find something you were looking for...
  384.  
  385. Alec Lazarescu,
  386. I think the C-interface is what you are looking for...
  387.  
  388. Guy English from the US,
  389. hope you got a copy of TASM3.1...
  390.  
  391. and all that appreciate SoundSystemSource3...
  392.  
  393. ══════════════════════════════════════════════════════════════════════════════
  394.  
  395. Happy coding...
  396.  
  397. Frontman of Crew242
  398.  
  399. ══════════════════════════════════════════════════════════════════════════════
  400.