Page 1 of 1
-Question-
Posted: Sun Oct 17, 2004 6:29 am
by Anonymous
Hey, i ahve some questions,so.....
Okay here i go:
1)How(or what code i need) to make q-basic play wav,midi,or mp3 music formats?.
2)How can i put in q-basic paints(jpg,bmp)?
Thanks in advance....
![Arrow :arrow:](./images/smilies/icon_arrow.gif)
Posted: Sun Oct 17, 2004 7:39 am
by Z!re
1) You need sound code, so you can send to the soundcard, and then you nede to get the format of Wav, Mid.. you cannot play MP3 in QB itself, it's just too slow. Do a search for DMALIB, or WavPlay
2) You use this code:
Code: Select all
DEFINT A-Z
TYPE BMPHeaderType
ID AS STRING * 2
Size AS LONG
RSV1 AS INTEGER
RSV2 AS INTEGER
offset AS LONG
HORZ AS LONG
WID AS LONG
HEI AS LONG
PLANES AS INTEGER
BPP AS INTEGER
COMPRESSION AS LONG
IMAGESIZE AS LONG
xRes AS LONG
yRes AS LONG
CLRUSED AS LONG
CLRIMPORT AS LONG
Pal AS STRING * 1024
END TYPE
DECLARE SUB LoadBMP (DestSeg%, SegxRes%, SegyRes%, File$, sX%, sY%, SwitchPal%, Trans%)
CLS : SCREEN 13
LoadBMP &HA000, 320, 200, "MyPic.BMP", 0, 0, 1, -1
'&HA000 = Video Segment, the segment of the screen
'320 and 200 is the resolution of the videosegment, in screen 13
'"MyPic.BMP" is just a BMP file, must be 256 color
'0, 0 is the top, left location to start drawing the image from
'1 is if it should change the palette to that in the BMP (0 is no)
'-1 is the color to treat as transperent, -1 means all will be drawn
SUB LoadBMP (DestSeg%, SegxRes%, SegyRes%, File$, sX, sY, SwitchPal%, Trans%)
DIM bmp AS BMPHeaderType
f% = FREEFILE
OPEN File$ FOR BINARY AS #f%
GET #f%, , bmp
IF SwitchPal% THEN
pall$ = bmp.Pal
IF LEN(pall$) = 1024 THEN
OUT &H3C8, 0
FOR I% = 1 TO 1024 STEP 4
b% = ASC(MID$(pall$, I%, 1)) \ 4
g% = ASC(MID$(pall$, I% + 1, 1)) \ 4
r% = ASC(MID$(pall$, I% + 2, 1)) \ 4
OUT &H3C9, r%
OUT &H3C9, g%
OUT &H3C9, b%
NEXT I%
END IF
END IF
Byte$ = SPACE$(bmp.WID)
DEF SEG = DestSeg%
wide% = bmp.WID - 1
Hite% = bmp.HEI - 1
offs& = LOC(f) + 1
FOR y% = Hite% TO 0 STEP -1
IF sY + y >= 0 AND sY + y < SegyRes THEN
GET #f%, offs&, Byte$
FOR x% = 0 TO wide%
IF sX + x >= 0 AND sX + x < SegxRes THEN
c% = ASC(MID$(Byte$, x% + 1, 1))
IF c% <> Trans% THEN
POKE (sX% + x%) + (sY% + y%) * (SegxRes + 0&), c%
END IF
END IF
NEXT x%
END IF
offs& = offs& + bmp.WID
NEXT y%
CLOSE #f
DEF SEG
END SUB
Posted: Sun Oct 17, 2004 8:48 am
by Guest
![Very Happy :D](./images/smilies/icon_biggrin.gif)
omg!thnx anyway.
Posted: Sun Oct 17, 2004 9:23 am
by Nodtveidt
The only way to play MP3s through QB is by using a DS4QB variant.
Posted: Wed Oct 20, 2004 4:10 am
by Anonymous
And then I wish DS4QB didn't have that file-access information exchange... it doesn't always work
![Sad :(](./images/smilies/icon_sad.gif)