ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º º º Sound System Source for your own productions (games&demos) º º º º coded and provided in 1995 by the Frontman of Crew242 !!! º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ RELEASE 3 Enhanced SB/SBPro player with volume amplifying and interpolation. Added SB16 and PAS+/16 player with maximum quality and speed (hope so). Added C interface for Borland C 3.1 Added auto-detection routines coded by Chicken of S!P. Included TheCrab.MOD from the great game 'Future Dimension'. RELEASE 2 Minor changes because of wrong config filename (sorry)! Took out the specific file-volume routines of Future Dimension. Added one of my favourite modules that always reminds me on good ol' C-64. This is Thalamus.MOD by good ol' Rob Hubbard and converted by M. Simmonds. RELEASE 1 First release. ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ This Sound System Source package includes: SOUNDSYS.DOC This file DETSOUND.ASM Auto-detection for all cards provided SBMOD.COM SoundBlaster (Pro) module player, eg. SBMOD THECRAB.MOD SBMOD.ASM SoundBlaster (Pro) player source SB16MOD.COM SoundBlaster 16 module player, eg. SB16MOD COMPLICA.MOD SB16MOD.ASM SoundBlaster 16 player source PASMOD.COM Pro Audio Spectrum +/16 module player, eg. PASMOD THALAMUS.MOD PASMOD.ASM Pro Audio Spectrum player source USMOD.COM Gravis UltraSound module player, eg. USMOD CYBRNOID.MOD USMOD.ASM Gravis UltraSound player source CPLAY.C Sample of a player in C CINTSS3.C C interface for all players. CPLAY.PRJ Project file to compile & link with Borland's C 3.1 IDE SS3.CFG Configuration file and some object files... Agreement: This programs are free software only and may not be sold other than the cost of the disk or physical handling. You can redistribute it only in the same form as you have received it. This program is distributed WITHOUT ANY WARRANTY nor is it responsible for any damage of computer software and/or hardware. ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ What does this Sound System ? For SoundBlaster (Pro/16): - 4/8 channels Protracker/Fasttracker module playing - 2/4 channels for FX - Full Protracker 2.1A effects support - 4 times amplified and linear interpolated mixing - Mixing rates 10000 - 22222 Hz - SBPro/SB16 stereo support - 656 KB EMS support for FX - 100% Assembler for high perfomance -> takes only 15% cpu time - 12kb code, 8kb mixbuf, 16kb volumetable, 0-64kb trackbuf, 0-???kb samples For Soundblaster 16 and Pro Audio Spectrum +/16: - 4/8 8/16bit channels Protracker/Fasttracker module playing - 8 8/16bit channels with panning for stereo FX - Full Protracker 2.1A effects support - Extended MOD effects support (Panning Effect E8x) - 4 times amplified and 16bit interpolated mixing - Mixing rates 10000 - 44100 Hz - Always stereo - 592 KB EMS support for FX - 11kb code, 32kb mixbuf, 32kb volumetable, 0-???kb samples For Gravis UltraSound: - 4/6/8 channels Protracker/Fasttracker module playing - 16 channels with panning for stereo FX - Extended MOD effects support (Panning Effect E8x) - Mixing rate always 44100 Hz - Always stereo - Full 8/16-bit DMA support for sample upload (optional without) - Max 1 MB GUS memory for samples - 100% Assembler for high perfomance -> takes almost no cpu time - 13kb code, 0-64kb trackbuf ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Where from, why, what for ? This Sound System has actually been developed for FUTURE DIMENSION of Crew242, a new, commercial, neckbreaking shootem up game of the new generation. I decided to spread the Sound System as freeware (yes! the source is freeware) because I dont like adlib neither midi sounds very much. Modules for everyone. Anyway, modules produce the best sound and UltraSound is the best card for it. Use it in any manner for your productions. For major assimilations it is necessary to change the source, eg. you need an object instead of a com-file, you dont want to have a configuration file, etc. The sources are written for Borland C, Tasm 3.1 and its Tlink /t option for COMs. Some people experienced that Tasm 4.0 doesn't work correctly, so don't waste time and get a copy of Tasm 3.1. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º º º All I want is a short credit in your production for the Sound System like: º º º º "Sound System by Frontman of Crew242" or "Sound System by Silvio Turello" º º º º I will also do that for the pioneers of module sound. Thanks goes to: º º º º Adrian Studer for running the kewlest Swiss coder mailbox º º (Chicken/S!P) º º Lars "Zap" Hamre for inventing the protracker de facto standard º º (Amiga Freelancers) º º Joshua C. Jensen for porting it to pc º º (Form. Renaissance) º º Serge Huber for giving me a hint, how to make a SB-player º º (Numerus/Imphobia) º º Robert Adolfsson for showing me, how to make a GUSPLAY (-er) º º (Robban/Cascada) º º º º Give always the complete package away ! º º º º If you want to be nice and you are allowed to give away a copy of your º º production, I would really appreciate to get a copy of it just because º º I am always interested in good sounding soft. I will of course respect º º any requests not to spread the copy you send me. It will be exclusively º º for the Frontman of Crew242. Refer to the address below: º º º º Silvio Turello, Giebeleichstr. 58, 8152 Glattbrugg, Switzerland º º º º Tel.: ++/1/810 70 96 Fax: ++/1/810 85 63 º º º º Email address until 1999: sturello@iiic.ethz.ch º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ How ? Now it is time to give some technical details about the routines. The COM-format is quite unusual, but it has some important advantages, eg. you always now, what is going on, because you can load it in your own segment (at offset 100h) without relocating. the start address is 100h with a jump table for its functions. the functions can be reached with a far call to seg:104h, seg:108h, etc. The following code is a prototyp of a possible implementation in your program: ;============================================================================= INIT_MUSIC PROC NEAR CALL ALLOC_MUSIC ;ALLOCATE MEMORY FOR PLAYER CALL LOAD_PLAYER ;LOAD THE RIGHT PLAYER MOV MUSIC_FILE,0 RET INIT_MUSIC ENDP ;============================================================================= START_MUSIC PROC NEAR CMP PLAYER,0 ;IS A PLAYER IN THE MEMORY? JE SHORT GMUA1 MOV MUSIC_FILE,AX ;LOAD MUSIC MOV DX,OFFSET MOD_NAME MOV BP,2 CALL PLAYER_FUNCTION JC SHORT GMUA2 CALL MUSIC_SETTINGS ;SET PLAYING PARMS CALL LOAD_SAMPLES ;LOAD SAMPLES MOV BP,3 ;START MUSIC CALL PLAYER_FUNCTION JNC SHORT GMUA1 GMUA2: CALL STOP_MUSIC ;DISABLE ALL MUSIC AFTER ERROR MOV PLAYER,0 CALL FREE_MUSIC GMUA1: RET START_MUSIC ENDP ;============================================================================= STOP_MUSIC PROC NEAR CMP MUSIC_FILE,0 JE SHORT GMUC1 MOV BP,4 ;STOP MUSIC CALL PLAYER_FUNCTION MOV BP,8 ;REMOVE SAMPLES CALL PLAYER_FUNCTION MOV BP,5 ;REMOVE MUSIC CALL PLAYER_FUNCTION GMUC1: MOV MUSIC_FILE,0 RET STOP_MUSIC ENDP ;============================================================================= CLOSE_MUSIC PROC NEAR CALL DEALLOC_MUSIC ;REMOVE PLAYER RET CLOSE_MUSIC ENDP ;============================================================================= PLAYER_FUNCTION PROC NEAR PUSHA PUSH DS SHL BP,2 ADD BP,0100H MOV MUSIC_CALL,BP CALL DWORD PTR DS:[MUSIC_CALL] ;MUSIC_CALL IS A FAR POINTER POP DS POPA RET PLAYER_FUNCTION ;============================================================================= The functions of the players are translated to a number in BP: BP = 1 CONFIG_INIT IF CARRY RETURNED IS 1 THEN ERROR 2 LOAD_MOD DS:DX IS POINTER TO FILENAME 3 PLAY_MUSIC IF CARRY RETURNED IS 1 THEN ERROR 4 STOP_MUSIC 5 END_MUSIC 6 LOAD_SAMPLE DS:DX IS POINTER TO FILENAME CL=0/80H AMIGA/PC SAMPLE RETURNED AX IS HANDLE OF THE SAMPLE 7 PLAY_SAMPLE BX= HANDLE, CX= FREQUENCY 8 END_SAMPLE 9 SET_SAMPLERATE AX=RATE 10000-44100 10 GET_VOLUME \ AL=MASTER_VOLUME 11 SET_VOLUME / BL=MUSIC_VOL, BH=FX_VOL 12 SET_SONGLOOP AL=PATTERN ORDER, >127 IS NO LOOP 13 GET_SONGPOSITION \ AL=0..127 POSITION IN PATTERN ORDER SET_SONGPOSITION / 14 GET_SONGMOD \ AL=0 MUSIC & FX, =1 MUSIC ONLY 15 SET_SONGMOD / =2 FX ONLY, =3 NO SOUND Each .ASM module is actually a full player for itself. The default of the assembler variable "COM_OR_OBJ" is 0 that the .COM output is a player that can be used in DOS, eg. USMOD TheCrab.MOD. The .COM files provided in SoundSS3 have a DOS-interface and are ready for use. If "COM_OR_OBJ" is <> 0, the output is the .OBJ file and the .COM cannot be used as player because the DOS-interface is replaced by the C-interface. Remember that for use in C you must set "COM_OR_OBJ=1" and recompile. After that you can use the .OBJ for linking with C modules. The .OBJ files provided in SoundSS3 are already like this and ready for linking with C modules, eg. CPLAY. For implementations in C refer to CPLAY. ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Some hints... The players use a 1024 Hz interrupt generated by the timer or by the realtime clock. If it is the timer, the old irq is chained at the normal frequency. Most options can be set in the SS3.CFG configuration file. The SoundBlaster player uses in this version 656/592kb EMS for FX and only conventional memory to hold the whole module. It should be no problem to use EMS for the module data too. All players are very stable. That means, that they wont crash because of a wrong baseport, irq, dma, etc. It may happen that DMA stops after use of Playfile or some other players. In this case start ultrinit before using usmod. If you encounter problems, remember that the interface does never recover any registers especially es, ds segment registers because it is speed and memory optimized code. The players dont use the MOD patterns as internal format because of too many repetitions in channels. The loader splits up the patterns into tracks for each channel and generates instead of the pattern order table a track order table for each channel. That means, if a channel plays always the same like a drum channel, it needs just the memory of one track. It is similar to the MTM format. The differences between MOD and MTM's memory requirements for the same song can range from 20 to over 100kb. The SB/SBPro/SB16/PAS players precalculate most periods to notes. Refer to the actual loader for more details about the internal format. If you encounter speed problems with SB16 or PAS players, you should use a lower samplerate. In case of SB16 you can also use the SBPro player that is also stereo on SB16 (fixed and working now) but much faster. The big speed difference between SBPro and SB16 player is caused by the 16bit calculating and the panning (each channel is mixed twice!) FAQ (frequently asked questions): 1. Q: Can you help me implementing your SoundSystem in my demo/game? A: Sorry, I have my own projects and even for them not enough spare time. I have already spent a lot of time providing this SoundSystem... 2. Q: Can you help me making a interface for a higher programming language because I don't know Assembler very well? A: With the C-interface provided in this version you have the base to make another interface, eg. for TP. But in general I strongly recommend to know Assembler. 3. Q: Where can I get docs/infos about Assembler? How can I learn it? A: I have learnt Assembler with books. There are a lot of ASM beginner books around, but you need such a book only if you are an absolut beginner and don't even know what a binary/hex number is. After a while you just want to have a reference like the Tasm reference book. This book describes all CPU instructions very detailed but doesn't feed up with unnecessary comment. 4. Q: I cannot make it running with a higher prog. language? A: Note that in Assembler everything is very clear but in a higher prog. language you don't know how the compiler does the code. In most cases the compiler does something you don't expect and causes the problem, eg. compiler uses some registers for internal variables you don't see in your program but when you call an ASM procedure you should recover these registers. Critical registers are DS, BP, SI, DI, ES, etc. 5. Q: When and how can I get an update? A: You will see new versions on some very well known ftp servers first. 6. Q: When will you support other music formats? A: The SoundSystem is designed for non-specific music programs. This means, you should not plan to make a player like Iplay or DMP but for games and demos you can choose your own music format and this should be MOD (maybe it is not the best but it is still powerful enough to realize your project) ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Personal greetings... Maxwood of Majic12, how about your game? Is it out now? As I told you, it does pay for you to update the SoundSystem... (compare the quality of SB16 sound to the one before!!!) Andr‚ Baresel & Craig Jackson, great and complete docs about SoundBlaster, unfortunately I already had the SoundBlaster Profibuch from Addison-Wesley... Stuart C. (The Dooze) from Australia, here you are. Look at the C-interface and maybe you'll find a way to implement SoundSS3 in TP7... Guiseppe Alleva from Milano/Italy, this is now the new version. It is a major update so I think it does pay when you also update your graphics library... PCheng from Vancouver/Canada, sorry, but I'm still avoiding TP... Steven J Streeting from the UK, have you got now a copy of TASM3.1? (Even better a copy of the whole Borland C++ 3.1 with the IDE)... Roger Wong from the US, how about POWball? Unfortunately at the time I'm writing our game is not out yet but it will be in 2-3 weeks... Btw there is a book out now with a lot of programming tricks called "PC underground", maybe there you find something you were looking for... Alec Lazarescu, I think the C-interface is what you are looking for... Guy English from the US, hope you got a copy of TASM3.1... and all that appreciate SoundSystemSource3... ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Happy coding... Frontman of Crew242 ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ