_____ ______ ______ _____ ______ / _ \ | __ \ | __ \ / _ \ | __ \ | / \__| | | \ | | | \ | | / \__| | | | | | \___ | |__/ | | | | | | \___ | |__| | \___ \ | __ < | | | | \___ \ | ___/ __ \ | | | \ | | | | | __ \ | | | | \_/ | | |__/ | | |__/ | | \ / | | | \_____/ |______/ |______/ \_____/ |____| Version 1.03 (9/23/94) Written by Ethan Brodsky Copyright 1994 by Ethan Brodsky. All rights reserved. This library is distributed AS IS. The author specifically disclaims any responsibility for any loss of profit or any consequential, incidental, or other damages. SBDSP is freeware and is distributed with full Turbo Pascal source code. You are free to incorporate parts of the code into your own programs as long as you give credit to Ethan Brodsky. This source code may only be distributed in it's original form, including this documentation file. ------------------------------------------------------------------------ You may have used my SBVox and SBVoice units. They played VOC files on a Sound Blaster using Creative Labs' CT-VOICE driver. Since they used the CT-VOICE driver, they wouldn't work on other sound cards. The driver needed to be included with the program, either in a separate file or linked into the executable. SBDSP performs the same functions as the SBVox unit without using the CT-VOICE driver. It has only been tested on a SB16 and PAS16, but it should work on all Sound Blaster compatible sound cards. By using DMA transfers, it plays sound without using the CPU, saving processor cycles for your program. I have many improvements planned, including 16-bit sound, stereo effects, and mixing, along with new library for FM music. But I NEED FEEDBACK! If you use my code, tell me about it! If you make any modifications, send them to me! If you have any suggestions for improvements, tell me about them! If you want me to write a C version, or a version to play WAV files, tell me! You don't need to pay me for using this unit. All you have to do is put my name in the credits for your product. I'd appreciate it if you'd send me a message telling me how you used SBDSP. (If you used it in a game, tell me where I can get it) And finally, if you ever have a sound programming job, think of me. You can find out most of the things you need to know in order to use this library by looking at the PlayVOC example program, but I'll go over it again. The first thing you need to do is to reset the DSP, initialize SBDSP's internal variables, and install the interrupt handler. In order to do this, you need to know the sound cards base address, IRQ number, and 8-bit DMA channel. If this is being used on a Sound Blaster, this information can be obtained from the BLASTER environment variable. I don't know whether other cards use this. You can use the EnvironmentSet function to find out if the environment variable is set. If it is, you can call the function InitSBFromEnv. Otherwise, you'll have to find out the settings some other way and pass them to the InitSB function. Use the LoadVOCFile function to allocate a sound buffer. Make sure that you save the value returned from this function. It is the size of the allocated buffer. It will be needed when you deallocate the buffer. The memory needed for Sound will be allocated inside this function. You do NOT need to allocate it beforehand. Before you can play any sounds, you have to turn on the speaker output. Do this by calling TurnSpeakerOn. Make sure you turn it off at the end of the program. If you want to install a marker handler, make sure you do it now by calling SetMarkerProc. A marker handler will be called each time a marker block is reached. Before you install your marker handler, save the old one using GetMarkerProc. If the value returned is not nil, then another marker procedure has been installed. Call it each time your marker procedure is called. This is a good practice to get into when setting up a handler such as this. It will make it possible to install more than one marker procedure. To play a sound, pass a pointer to the sound buffer to PlaySound. Any sound output in progress will be stopped. To find out if the sound is finished, check the SoundPlaying variable. The VOC file format has a provision for repeating sounds. The sound can be set to repeat for a number of times (Or forever) You can break out of the loop by calling BreakLoop. The current iteration will finish and it will continue to the next block. When the program is completely finished playing sound, call the ShutDownSB procedure. This will stop any sound output in progress and remove the interrupt handler. You should deallocate all sound buffers by using FreeBuffer. The pointer to the buffer should be typecasted as a pointer. Make sure that you pass the buffer size that was returned by LoadVOCFile so that the right amount of memory is deallocated. This library will not allow you to play 16 bit or stereo VOC files. It will not work in protected mode since it uses DMA transfers. If you have any other questions, feel free to ask. If you would like me to make any modifications or a customized version of this unit to use in your program, contact me and we can work out some arrangements. There are several ways to contact me: E-Mail: ericbrodsky@psl.wisc.edu (Preferred) Phone: (608) 238-4830 Mail: Ethan Brodsky 4010 Cherokee Dr. Madison, WI 53711 Bug fixes and other announcements will be posted in: comp.lang.pascal comp.sys.ibm.pc.soundcard comp.sys.ibm.pc.soundcard.tech rec.games.programmer Revision history: 1.00 - First release 1.01 - Fixed bug that caused problems with sound cards with an IRQ settings 8-15. 1.02 - Fixed bug that caused problems initializing sound card from the BLASTER environment variable. Improved documentation. 1.03 - Fixed a bug that caused problems initializing sound card from the environment. The GetSettings function has an uninitialized return value.