Mirage Source
http://miragesource.net/forums/

FMOD Sound Replacement
http://miragesource.net/forums/viewtopic.php?f=210&t=1235
Page 1 of 3

Author:  Lea [ Thu Jan 25, 2007 2:53 am ]
Post subject:  FMOD Sound Replacement

Hi guys

This code is to replace the current MSE sound system with FMod. Some features of this system include:
-Play MID or MP3 songs
-Sound fades in and out
-when you switch maps but they have the same music, the music keeps playing seamlessly.

You will need the FMod sound system, freely downloadable from fmod.org. You will need to put the FMod module into your project. You will need to include the FMOd.dll file with your project. This is written for use with FMod version 3.74
Also add this module to your project:
http://www.eternalflameonline.com/modsound.bas

Now the code to use it!
In your GameLoop, put this:
Code:
'Handle the volume of the music
        Call HandleVolume


At the end of the MapDone packet:
Code:
' Play music
    If LenB(MUSIC_EXT) <> 0 Then
        If CurrentSong = Map.Music Then Exit Sub
       
        Call SwitchSong(Map.Music)
    End If


In sub Main, add this:

Code:
Call SetStatus("Initializing FMod...")
FModInit = False
    'If LenB(MUSIC_EXT) <> 0 Then
    '    FModInit = True
    '    If FSOUND_Init(44100, 32, 0) = 0 Then
    '        FModInit = False
    '        'Error
    '        MsgBox "An error occured initializing fmod!  Sound will not play!" & vbCrLf & _
    '        FSOUND_GetErrorString(FSOUND_GetError), vbOKOnly
    '    End If
    '    FSOUND_SetVolume FSOUND_all, 0
    'End If


*******NOTE! If FMod isn't shutdown properly, VB will crash. If you plan to debug, make sure this is as is. When you actually want to use the sound, uncomment this code, and change the FIRST FModInit = False to be true. Don't understand? You'll find out soon enough. Save before you run :D

Lastly, In GameDestroy:
Code:
If LenB(MUSIC_EXT) <> 0 Then FSOUND_Close


YOu need to make a constant called MUSIC_EXT. It's a string, and it can have one of four values.
MUSIC_EXT = ".mid"
MUSIC_EXT = ".midi"
MUSIC_EXT = ".mp3"
MUSIC_EXT = "" ' No sound

You could also make this NOT a constant, and change it to whatever sound you choose to run... you decide.



Good luck... and happy... sound...ing...
~Dave

Author:  Da Undead [ Sat Apr 21, 2007 5:49 pm ]
Post subject: 

Error on exiting out.

Highlights

FMUSIC_FreeSong
Code:

for not defined..

Wat would we define as? String?

Author:  Lea [ Sun Apr 22, 2007 3:43 am ]
Post subject: 

Do you have Fmod 3.74?

Author:  Da Undead [ Sun Apr 22, 2007 4:25 am ]
Post subject: 

how do u add a .dll into project i forgot :\

Author:  Rian [ Sun Apr 22, 2007 7:54 am ]
Post subject: 

Project > References


Or Add Reference.

Something of that nature.

Author:  Da Undead [ Sun Apr 22, 2007 1:37 pm ]
Post subject: 

It said can't add reference to specified file... :(

------------

I just found out that i never had fmod module : x... so i re did this and used 3.75 (couldnt find 74), and i have an error on ur modSounds...

Highlights:
Code:
FileExist


Whole If Statement:
Code:
    If Not FileExist(FilePath, True) Then
        MsgBox "Music file " & Song & " doesn't exist"
        Exit Sub
    End If


Error:
Quote:
Wrong number of arguments or invalid property assignment

Author:  Lea [ Mon Apr 23, 2007 2:34 am ]
Post subject: 

The tutorial is made for MSE Build 1, and is unsupported otherwise.

Author:  Matt2 [ Sun Dec 02, 2007 8:52 pm ]
Post subject:  Re: FMOD Sound Replacement

Anyone wanna repost or upload or whatever, the necessary .bas file?

It's not here anymore, and I'd like to take a look at it.

Author:  Robin [ Sun Dec 02, 2007 8:54 pm ]
Post subject:  Re: FMOD Sound Replacement

Don't use FMOD.

Seriously.


Don't..

Author:  Rezeyu [ Sun Dec 02, 2007 9:00 pm ]
Post subject:  Re: FMOD Sound Replacement

Why not?


90% of my Xbox games use FMOD.
I never had trouble using it either.

It even has nifty shuffling features and such.

Author:  Robin [ Sun Dec 02, 2007 9:02 pm ]
Post subject:  Re: FMOD Sound Replacement

This isn't an xbox game.

Author:  Rezeyu [ Sun Dec 02, 2007 9:06 pm ]
Post subject:  Re: FMOD Sound Replacement

Rezeyu wrote:
I never had trouble using it either.

It even has nifty shuffling features and such.

Author:  Matt2 [ Sun Dec 02, 2007 9:16 pm ]
Post subject:  Re: FMOD Sound Replacement

I asked for the .bas, not for your opinion.

I wanted to look at it, not use it.

Author:  Rezeyu [ Sun Dec 02, 2007 9:17 pm ]
Post subject:  Re: FMOD Sound Replacement

http://www.fmod.org/

Has the D/L for all supported languages.
That's where I got mine.

Author:  Lea [ Sun Dec 02, 2007 10:02 pm ]
Post subject:  Re: FMOD Sound Replacement

The file you need is in the InstallDir/api/vb folder for the fmod EX api, It's either fmodexp or fmodex, try each :D

The code might not work with this new version, but it should be easy to port (it's the concept that counts, the actual names of the commands should be all that changes, if anything :))

Author:  Rezeyu [ Sun Dec 02, 2007 10:04 pm ]
Post subject:  Re: FMOD Sound Replacement

:(

You deleted my post just as I edited it saying that I mis-read your post.

Author:  Lea [ Sun Dec 02, 2007 10:05 pm ]
Post subject:  Re: FMOD Sound Replacement

Oh I get it... you posted in the wrong thread :D

Author:  Lea [ Sun Dec 02, 2007 10:16 pm ]
Post subject:  Re: FMOD Sound Replacement

So are you going to update the tutorial, Rez? :D

Author:  Dragoons Master [ Thu Dec 06, 2007 6:00 pm ]
Post subject:  Re: FMOD Sound Replacement

I used to use FMod but there were a lot of little things that I didn't like so I started to use WMPlayer dll. I love it, much easier to use and all the computers can have it with no more dlls since it's VB6(win only) and all wins have WMPlayer. I made a fade in/out effect veeery easily.

Author:  Robin [ Thu Dec 06, 2007 6:33 pm ]
Post subject:  Re: FMOD Sound Replacement

Dragoons Master wrote:
I used to use FMod but there were a lot of little things that I didn't like so I started to use WMPlayer dll. I love it, much easier to use and all the computers can have it with no more dlls since it's VB6(win only) and all wins have WMPlayer. I made a fade in/out effect veeery easily.


Yeah, me too.

Author:  Xlithan [ Thu Jan 01, 2009 9:08 pm ]
Post subject:  Re: FMOD Sound Replacement

modSound.bas?

Old topic but I need the tutorial.

Author:  Lea [ Thu Jan 01, 2009 10:17 pm ]
Post subject:  Re: FMOD Sound Replacement

go to fmod.org download the API and use that module instead.

Author:  Tony [ Fri Jan 02, 2009 5:36 am ]
Post subject:  Re: FMOD Sound Replacement

Yes, I support FMOD 100% now. >:D

Oh and note*, my modSound is a bit different than the one Lea posted.

I made a channel for sound, and a different channel for music. PlaySound, PlayMusic

Other tips; If your not used to terminating with your program and you accidently closed it through
the IDE then you can save AND then press OK. Then your VB6 will crash. Walaa you saved.

Attachments:
modSound.rar [14.03 KiB]
Downloaded 355 times

Author:  Lea [ Fri Jan 02, 2009 6:17 pm ]
Post subject:  Re: FMOD Sound Replacement

you can also set the IDE up to save automatically :)

Author:  Xlithan [ Sat Jan 03, 2009 10:26 pm ]
Post subject:  Re: FMOD Sound Replacement

FModInit - Variable not defined.

Maybe I need that 3.74 thing you're talking about. Downloading 3.75 now though.

Page 1 of 3 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/