Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sound through speakers in QB
#1
I know its possible but how do you do it?
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Reply
#2
Quote:I know its possible but how do you do it?

Your contradicting yourself. Tongue

You would either have to make (or download) a music player, that can read music and play it using outs and inps, or asm. The other alternative is to use a library, such as QMIDI or BWSB. I'd Highly recommend BWSB: DS4QB doesn't work well on windows xp or 2k (it works if done right, but most people can't get it to) and QMIDI, i've found it to not work well with 2k or xp: the music is distorted. BWSB is the best IMO: Even though you need VDMSound to get it to work in 2K or XP, the music isn't distorted.
Jumping Jahoolipers!
Reply
#3
No i know its possible without using libraries ive seen it done but i didnt quite get it
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Reply
#4
as far as i kno, the only way to do it without a lib is direct SB manipulation. this is extremely complicated... take a look at this to get an idea of what youre getting into. lots of interrupt calls n such

http://www.fortunecity.com/skyscraper/pa...bsound.zip

heh, use FB


oh, heres a snippet to record from a mic (i guess, havent tested either of these, next time try google)


Code:
DECLARE FUNCTION samplebyte% (bp%)
DECLARE SUB writedsp (byte%, bp%)
DECLARE SUB sbreset (bp%)

'QB4.5 code to record a sample from the
'Soundblaster's Mic/Line Input and then
'play it back.  It does not detect for a
'Soundblaster, it's assumed that one is
'available.

'This will be too slow in the IDE - run
'as a standalone .EXE file.

'(C) Copyright 1994 by Tim Gerchmez
'This code may be freely shared and
'distributed by any means desired.

bp% = &H220   'Soundblaster Base Port, change to &h240 or whatever
              'for different hardware configuration

CALL sbreset(bp%) 'Reset the Soundblaster card

CLS : PRINT
PRINT "Soundblaster Sample/Playback (direct, non-DMA)"
PRINT
INPUT "Length of Sample (1-32766)"; ls%
IF ls% < 1 OR ls% > 32766 THEN END
PRINT
PRINT "Speak into the Microphone or start input to"
PRINT "Line In jack.  Press a key to begin sampling."
SLEEP
PRINT : PRINT "Now Sampling..."

REDIM smp%(1 TO ls%)

FOR t% = 1 TO ls%
        smp%(t%) = samplebyte(bp%)
        FOR u% = 1 TO 25: NEXT u%  'Delay a little
NEXT t%

'Now play the sample back

CALL writedsp(&HD1, bp%)  'Turn speaker on
FOR t% = 1 TO ls%
        CALL writedsp(&H10, bp%)
        CALL writedsp(smp%(t%), bp%)
NEXT t%
CALL writedsp(&HD3, bp%)  'Turn speaker off

FUNCTION samplebyte% (bp%)

'Samples a byte from the SB's ADC, and returns
'the resultant byte.  Call with BP% = SB base port
'(normally &h220)


CALL writedsp(&H20, bp%) 'Command to sample one byte
datavail% = bp% + 14
dly:
        IF INP(datavail%) AND &H80 = 0 THEN GOTO dly
datread% = bp% + 10
bt% = INP(datread%)
samplebyte% = bt%

END FUNCTION

SUB sbreset (bp%)

'Resets the Soundblaster chip -
'call with bp% = Base Port (normally &h220)

dspreset% = bp% + 6
OUT dspreset%, 1
FOR t% = 1 TO 10
        a% = INP(dspreset%)  'Delay loop, give SB time to reset
NEXT t%
OUT dspreset%, 0
dspread% = bp% + 10
FOR t% = 1 TO 10
        a% = INP(dspread%)
NEXT t%

END SUB

SUB writedsp (byte%, bp%)

'Writes to the Soundblaster's DSP Command Channel -
'call with bp% = SB base port (normally &h220)
'byte% = byte to write to DSP

dspcmd% = bp% + 12
FOR t% = 1 TO 8
        q% = INP(dspcmd%) 'Delay to give SB time to process code
NEXT t%
OUT dspcmd%, byte%



END SUB
Reply
#5
i would recommend looking at a rpg demo called ff2 demo, available at rpg-dev.net. It has a .wav player that works quite nicely without using vdmsound.
Jumping Jahoolipers!
Reply
#6
ive tried several sound programs and there not working is there a setting i have to change in order to use sound is dos or sumthing like that?
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Reply
#7
Getting sound under DOS is hard.. it was hard 5 years ago, it's even harder now..

I recomend you abandon all hopes of sound in DOS, and move to freebasic, getting sound in FB is easy, 30 minutes work and you're done with the sound engine you'll ever need.

Or you can use an existing one, 10 minutes and you're done. ^_^
Reply
#8
Pyrokid:
All answer forgot to mention one thing:
If you are working in bare DOS you must have an old! Soundblaster 16 card or something with a fully compatible API.

If you are in windows XP you should VDMSound, it replaces the standard DOS box and makes any soundcard appear to DOS as a SB16.

"Slave" libraries as DS4QB++ use the Windows services to do sound and don't require a given model of card.

Better switch to FB, it makes things easier....
Antoni
Reply
#9
ok, how do you do it in FB?
i]"But...it was so beautifully done"[/i]
Reply
#10
http://forum.qbasicnews.com/viewtopic.php?t=9231
Antoni
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)