gfxgfxFreeBASIC Games Directory Forumgfxgfx
gfx gfx
gfx
Welcome, Guest. Please login or register. May 21, 2013, 01:08:06 AM

Login with username, password and session length
11.5.2013 - Added a webpage for the latest FBGD competition.

13.3.2013 - Members registrations temporary disabled. For all membership requests, please email me: lachie13@yahoo.com

30.11.2012 - The ninth issue of BASIC Gaming is out! Read it here: http://games.freebasic.net/forum/index.php?topic=560.0

22.11.2012 - Be sure to check our currently running annual FBGD game making competition. This year's theme is SEASONS OF THE YEAR, 300 $ first place prize, and the competition runs till 18th of February. Link: http://games.freebasic.net/forum/index.php?topic=559.0
gfx
gfx
*
gfxgfx
gfxgfx gfxgfx
gfxgfx Home Help Search Login Register   gfxgfx
gfx gfx
gfx
Pages: [1]
Print
Author Topic: Sound?  (Read 928 times)
Brick Break
Forum Sage
*****
Gender: Male
Posts: 412



View Profile
« on: September 14, 2010, 07:57:14 PM »

So, it's that time again. Another user wants to put sound in his games. FMOD has an awful license, and DirectSound seems incredibly hard to use. I'm OK with Windows-only techniques, because I figure, if the Mac users have to use Wine, a Linux binary would be trivial and unappreciated. So, I've got a little code here- it works perfectly, but I'm not satisfied.

#ifdef __FB_WIN32__
    #include once "windows.bi"
    #include once "win\mmsystem.bi"
#else

#endif

dim shared as string*2 closeTriggerString=chr$(255)+"k"
dim shared as ubyte spacekey=0
dim shared as uinteger vertical=0

screenres 640,480,32,2,&h00
screenset 1,0
width 640/8,480/14

public sub soundplay(byval sound as string)
    PlaySound(sound,NULL,SND_NODEFAULT OR SND_ASYNC)
end sub

public sub soundloop(byval sound as string)
    PlaySound(sound,NULL,SND_LOOP OR SND_NODEFAULT OR SND_ASYNC)
end sub

public sub soundstop
    PlaySound(NULL,NULL,0)
end sub

public sub text(byval textX as integer,byval textY as integer,byval textData as string)
    draw string (textX,textY-1),textData
end sub

do
    if multikey(&h39) then
        spacekey=1
    else
        if spacekey=1 then
            spacekey=0
            if vertical>=480 then
                cls 0
                vertical=0
            end if
            'obviously you need bounce.wav
            soundplay("bounce.wav")
            text(0,vertical,"played")
            vertical+=20
        end if
    end if
    pcopy
    if multikey(&h38) and multikey(&h3E) or inkey$()=closeTriggerString or multikey(&h01) then end
loop

It only has one audio channel. Here are the options I'm considering:

a) Test winmm more thoroughly

b) Use FBSOUND (if you guys can give me help)

c) Use DirectSound (again, help!)

I can't find much information on waveOut, so I assume it's just for Windows CE and Vista+, correct? It seems complicated anyways, and it may be a part of winmm. So, I'll forget about waveOut.

What should I do? I'm really leaning towards either DirectSound or some winmm multichannel trick (even using the music track). Please give me some code or something to help me out. All I ask is that I have at least 2 audio channels to work with, so the sound experience isn't an ambient void.
Logged

creek23
Amoeba
*
Gender: Male
Posts: 4


KonsolScript Developer


View Profile WWW
« Reply #1 on: November 05, 2010, 09:37:42 PM »

fbsound have test files which demonstrates how easy it is to use. Wink
Logged

When somebody tells you this same line, "proprietary software created jobs", tell them "so did marijuana".
-------------------------------------------------------
KonsolScript | Programming Language designed for Games Development
Brick Break
Forum Sage
*****
Gender: Male
Posts: 412



View Profile
« Reply #2 on: November 05, 2010, 10:35:51 PM »

fbsound have test files which demonstrates how easy it is to use. Wink
THANK YOU! I HAD NO IDEA! IT HAS TEST FILES? WOW!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Logged

Pages: [1]
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
Cerberus design by Bloc
Valid XHTML 1.0! Valid CSS!
gfx
gfxgfx gfxgfx