Difference between revisions of "GW-Basic/SoundCard"

From GPWiki
Jump to: navigation, search
(Created page with "=Using A Sound Card In GW-Basic Programs= ==Introduction== <B>!!!!! Big, Fat, IMPORTANT NOTICE: !!!!!</B> Versions of Microsoft Windows later than Win 98 are apparently retar...")
 
Line 3: Line 3:
 
==Introduction==
 
==Introduction==
 
<B>!!!!! Big, Fat, IMPORTANT NOTICE: !!!!!</B>
 
<B>!!!!! Big, Fat, IMPORTANT NOTICE: !!!!!</B>
Versions of Microsoft Windows later than Win 98 are apparently retarded, and they want to play God with the sound card and other hardware, so if you try & run this program in a standard "Dos" window, you'll soon be hearing a whole lot of NUTHIN'!  For this reason, you need to download and install a "Dos Emulator" program to get the sound card to work.  I use "DosBox", which can downloaded for free from their Web site ( Just Google 'em - you'll find it. ), and have had no troubles playing sounds in GW-Basic or any other Dos program.  So, if you don't hear anything, don't come cryin' to me - all I know is it works on my box, so just give it a shot & hope for the best!
+
 
 +
Versions of Microsoft Windows later than Win 98 are apparently retarded, and they want to play God with the sound card and other hardware, so if you try & run this program in a standard "Dos" window, you'll soon be hearing a whole lot of NUTHIN'!  For this reason, you need to download and install a "Dos Emulator" program to get the sound card to work.  I use "DosBox", which can be downloaded for free from their Web site ( Just Google 'em - you'll find it. ), and I've had no troubles playing sounds in GW-Basic or any other Dos program.  So, if you don't hear anything, don't come cryin' to me - all I know is it works on my box, so just give it a shot & hope for the best!
  
 
Now, then:
 
Now, then:

Revision as of 08:05, 3 February 2014

Using A Sound Card In GW-Basic Programs

Introduction

!!!!! Big, Fat, IMPORTANT NOTICE: !!!!!

Versions of Microsoft Windows later than Win 98 are apparently retarded, and they want to play God with the sound card and other hardware, so if you try & run this program in a standard "Dos" window, you'll soon be hearing a whole lot of NUTHIN'! For this reason, you need to download and install a "Dos Emulator" program to get the sound card to work. I use "DosBox", which can be downloaded for free from their Web site ( Just Google 'em - you'll find it. ), and I've had no troubles playing sounds in GW-Basic or any other Dos program. So, if you don't hear anything, don't come cryin' to me - all I know is it works on my box, so just give it a shot & hope for the best!

Now, then:

Example Program

1 LOCATE 1,1: PRINT  "GWave.bas Copyright 2009 By: Daryl R. Dubbs"
2 BASEPT = &H220: RESETPT = BASEPT + 6: COMMANDPT = BASEPT + 12
3 FOR T = 1 TO 10: OUT RESETPT, 1: NEXT T
4 FOR T = 1 TO 10: OUT RESETPT, 0: NEXT T
5 OUT COMMANDPT, &HD1         'Turn on speaker.
6 GOSUB 100 'Close open files, get and open new file
7 GOSUB 200 'Read wave file & output to speakers
8 GOTO 6
100 CLS: LOCATE 1,1: PRINT"GWave3.bas  Copyright 2010 By: Daryl R. Dubbs"
101 INPUT "Please select file to play (Press ENTER to quit.): ",FILENAME$
102 IF LEN(FILENAME$)= 0 THEN END
103 PATH$ ="C:\Waves\": FILENAME$ = PATH$ + FILENAME$
104 CLOSE #1: OPEN FILENAME$ FOR RANDOM AS #1 LEN =1
105 RETURN
200 FIELD 1,1 AS DAT$
201 WHILE EOF(1) = 0
202 GET #1
203 OUT COMMANDPT, &H10
204 OUT COMMANDPT, ASC(DAT$)
205 WEND
206 RETURN