Wow! Coolness! Yeah!

 BBS: Inland Empire Archive
Date: 07-25-92 (07:25)             Number: 200
From: PHIL HODGES                  Refer#: NONE
  To: RICH GELDREICH                Recvd: NO  
Subj: Wow! Coolness! Yeah!           Conf: (2) Quik_Bas
  Well, Rich...It's currently 4:05 a.m...I spent the last 45 minutes
checking out your speaker driver some more, and trying that code you
showed me to load samples...all I can say is...WOW! At first it was
doing something really weird...I added some code so I could enter the
name of the sample and the "TweakOn" freq to play it at. Well, the first
sample I loaded sounded great. After that, they started sounding the
same. Then I realized I had to do the CLEAR , , 2048 after each sample.

   One other little detail. I got the samples to sound fine in the
QB environment, but if you play one from a compiled .EXE, there's this
little "whine-ta-ching!" right before it plays it. Any idea why?

   Anyway, I got to expermenting, and decided to try something I wanted
to be able to do with other sound files, like .ROL's or what have you:
copy them all into one file. I did this, writing down the size of the
two samples. From there, here's what I did...and it works! PLEASE tell
me your MOD library works through the Sound Blaster as well! I'll
register that sucker so fast your head will swim double-time! Just as
long as it's not highway robbery <G>...

'An experiment with Rich Geldreich's Speaker Driver
'Demonstrates how to combine sample files into one big file
'and load one at your leisure! NOTE: This requires his speaker
'drive (fer-duh)


DEFINT A-Z
DECLARE SUB TweakOn (BYVAL freq%)
DECLARE SUB TweakOff ()
DECLARE SUB PlaySound (BYVAL Offset%, BYVAL Segment%, BYVAL
Length%, BYVAL freq
DECLARE FUNCTION TweakStatus ()

CLEAR , , 2048

OPEN "ONEBIG.SAM" FOR BINARY AS #1
    A$ = SPACE$(8100)      'The size of the 1st sample
    GET #1, , A$
    CLOSE #1
TweakOn 15000
PRINT "Playing STRINGS8.SAM..."
PlaySound VARPTR(A$), VARSEG(A$), LEN(A$), 8000

DO: LOOP WHILE TweakStatus
TweakOff: A$ = ""          'Clear that puppy...

CLEAR , , 2048
   OPEN "ONEBIG.SAM" FOR BINARY AS #1
   SEEK #1, 8101           'one byte after the 1st sample ends...

   B$ = SPACE$(18990)      'The size of the 2nd in the file...
   GET #1, , B$

TweakOn 15000
PRINT "Playing ORGAN6.SAM ..."
PlaySound VARPTR(B$), VARSEG(B$), LEN(B$), 4500
DO: LOOP WHILE TweakStatus
TweakOff
CLOSE #1: END


   This was only my first experiment. I'll have work on it some more.
I'm a little fuzzy in the department of strings. Was it necessary to
clear the A$ like I did above with A$="" ? Or is it possible to just
keep that in memory? I wonder if it's possible...nah! I was thinking,
"What if you could just store it in EMS???" Of course, I only have 640K,
so I couldn't even find out. I suppose I could keep a few small ones in
memory...well, I'll have to tinker with it some more, I guess. This is
great, Rich!
   What I was also thinking about trying was just appending a few of
the samples to the end of the .EXE file! It would work, since the extra
data would be completely ignored by DOS. Thing is, it would require
first compiling the program, seeing how big it is, then ...well, it's
fairly obvious. But worth it? Nah...

___
 X SLMR 2.1a X Eat the rich - the poor are tough and stringy.

--- Maximus/2 2.00
 * Origin: The Gamorian Vortex Project (1:105/601)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET