Mirage Source

Free ORPG making software.
It is currently Sun Apr 28, 2024 4:50 am

All times are UTC




Post new topic Reply to topic  [ 50 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: FMOD Sound Replacement
PostPosted: Thu Jan 25, 2007 2:53 am 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
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

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 21, 2007 5:49 pm 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
Error on exiting out.

Highlights

FMUSIC_FreeSong
Code:

for not defined..

Wat would we define as? String?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 3:43 am 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
Do you have Fmod 3.74?

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 4:25 am 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
how do u add a .dll into project i forgot :\


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 7:54 am 
Offline
Persistant Poster
User avatar

Joined: Tue May 30, 2006 2:07 am
Posts: 836
Location: Nashville, Tennessee, USA
Google Talk: rs.ruggles@gmail.com
Project > References


Or Add Reference.

Something of that nature.

_________________
I'm on Facebook! Google Plus My Youtube Channel My Steam Profile

Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 1:37 pm 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 23, 2007 2:34 am 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
The tutorial is made for MSE Build 1, and is unsupported otherwise.

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Sun Dec 02, 2007 8:52 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
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.

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
PostPosted: Sun Dec 02, 2007 8:54 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Don't use FMOD.

Seriously.


Don't..

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
PostPosted: Sun Dec 02, 2007 9:00 pm 
Offline
Pro
User avatar

Joined: Thu Dec 14, 2006 3:20 am
Posts: 495
Location: California
Google Talk: Rezeyu@Gmail.com
Why not?


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

It even has nifty shuffling features and such.


Top
 Profile  
 
PostPosted: Sun Dec 02, 2007 9:02 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
This isn't an xbox game.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
PostPosted: Sun Dec 02, 2007 9:06 pm 
Offline
Pro
User avatar

Joined: Thu Dec 14, 2006 3:20 am
Posts: 495
Location: California
Google Talk: Rezeyu@Gmail.com
Rezeyu wrote:
I never had trouble using it either.

It even has nifty shuffling features and such.


Top
 Profile  
 
PostPosted: Sun Dec 02, 2007 9:16 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
I asked for the .bas, not for your opinion.

I wanted to look at it, not use it.

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
PostPosted: Sun Dec 02, 2007 9:17 pm 
Offline
Pro
User avatar

Joined: Thu Dec 14, 2006 3:20 am
Posts: 495
Location: California
Google Talk: Rezeyu@Gmail.com
http://www.fmod.org/

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


Top
 Profile  
 
PostPosted: Sun Dec 02, 2007 10:02 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
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 :))

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Sun Dec 02, 2007 10:04 pm 
Offline
Pro
User avatar

Joined: Thu Dec 14, 2006 3:20 am
Posts: 495
Location: California
Google Talk: Rezeyu@Gmail.com
:(

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


Top
 Profile  
 
PostPosted: Sun Dec 02, 2007 10:05 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
Oh I get it... you posted in the wrong thread :D

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Sun Dec 02, 2007 10:16 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
So are you going to update the tutorial, Rez? :D

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 6:00 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
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.

_________________
http://www.blackages.com.br
Image
Dave wrote:
GameBoy wrote:
www.FreeMoney.com
I admit I clicked. I immediately closed upon realizing there was, in fact, no free money.
Robin wrote:
I love you and your computer.Marry me.


Top
 Profile  
 
PostPosted: Thu Dec 06, 2007 6:33 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
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.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
PostPosted: Thu Jan 01, 2009 9:08 pm 
Offline
Pro
User avatar

Joined: Wed Sep 20, 2006 1:06 pm
Posts: 368
Location: UK
Google Talk: steve.bluez@googlemail.com
modSound.bas?

Old topic but I need the tutorial.


Top
 Profile  
 
PostPosted: Thu Jan 01, 2009 10:17 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
go to fmod.org download the API and use that module instead.

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Fri Jan 02, 2009 5:36 am 
Offline
Persistant Poster
User avatar

Joined: Wed Nov 29, 2006 11:25 pm
Posts: 860
Location: Ayer
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 350 times

_________________
Image
Top
 Profile  
 
PostPosted: Fri Jan 02, 2009 6:17 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
you can also set the IDE up to save automatically :)

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
PostPosted: Sat Jan 03, 2009 10:26 pm 
Offline
Pro
User avatar

Joined: Wed Sep 20, 2006 1:06 pm
Posts: 368
Location: UK
Google Talk: steve.bluez@googlemail.com
FModInit - Variable not defined.

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 50 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group