VisualBasic Source Code
On this page you will find the VB6 source code to my partially completed program, as well as some related files. To begin with, here is a ZIP file containing the source code:
Note: It seems that somewhere along the line, this copy of the source code got out of sync with the compiled executable below. The executable will play a DAT through your sound card. The source code doesn't. I haven't looked at the source in quite some time and don't have VB installed on my computer any more, so I'm not inclined to figure it out. I think the source has the appropriate sound routines, I probably just commented them out while testing other things. As I stated elsewhere, the sound routines need replacing, anyway. Feel free to write better ones. If you do, let me know and I'll post your improved version.
To compile and run this, you will also need a wrapper DLL that translates the VB function calls to the ASPI functions in Win32. Adaptec wrote all of the ASPI functions using C calling conventions (all the examples in the ASPI SDK are in C). What this means is that VB is passing all arguments on the stack in one order and the ASPI functions are expecting them in the reverse order. I had a friend create the following wrapper DLL for me, as I don't know enough C to create it myself.
Note: This wrapper DLL was created for an earlier version of the ASPI SDK (dated January 2, 1997). The later SDK (dated July 1, 1998) added three more functions. ASPIwrap.dll does not include these three functions. However, ASPIwrap.dll does still work with the later SDK.
You should also get the ASPI SDK and related files from Adaptec (this link is broken, so here it is locally).
Adaptec has released a new version of their ASPI layer software for Win32 platforms. This is not the SDK, just the end-user ASPI interface. However, in the Zip file is a Word document that describes the ASPI programming interface. I have included the Zip file and a separate copy of the Word document, that I have converted to a PDF.
Here is a little program from Adaptec that tells you whether ASPI is correctly installed on Win95/98/NT.
If you just want to run something to see your audio-capable DAT drive play a tape, here is a ZIP that contains my partially completed program, already compiled. (Needless to say, if your computer catches fire and turns into a molten pool after running this, I don't want to know about it.) This ZIP contains a VB6 installation package that will install the VB runtime files, my executable and the ASPIwrap.dll file. To install this, just run SETUP.
The only buttons that do anything are the BOT (beginning of tape), EOT (end of tape), PLAY and EJECT. The displays are not updated and the group of buttons on the right side do nothing of consequence (these were to allow direct seeking to a particular time or program). The "save to a wave file" function is not working on the menu, but if I remember, the functionality is in the program (I wrote the save functions before the play, so it's in there somewhere).
Note that reading (not playing) the tape is 2.1 times faster than a DAT audio deck will play the tape. In other words, if you stop the read process after exactly 1 minute, you will have 2.1 minutes of audio. This is due to the fact that a data DAT drive moves the tape faster than an audio DAT deck. This also applies if you are only saving audio to a wave file and not playing (when playing, you are only reading what you need at the time and making the tape drive wait between reads).
To detect an audio-capable drive, I do a Mode Sense, save the current density, do a Mode Select 80H and see if it takes, then restore the old density. In case you're wondering, the tape density setting of 80H is what distinguishes an audio tape from a data tape.
There are many things wrong with the program as it stands.
There is a problem with ASPI itself, in regards to this program. There is no way to stop a tape command that is in progress. What this means is that if you issue a command to seek to the end of the tape (or a particular program number or time), you can't then issue a command to stop the tape. You have to wait until the original command has completed. Where this really hurts is that with ASPI, you can't implement a CUE/REVIEW function.
Here is an excerpt of an email I sent to someone about this and the reply:
I noted in DATlib that the programmer had to patch the Sun Solaris SCSI driver to handle this problem (see section 4.3 in his doc file). It may be possible to make this work by calling the Win32 SCSI functions directly, bypassing ASPI. I don't know for sure, I'm just guessing.
© Copyright 2000 by Joseph Gray