Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Adding FMOD to eo 2.0


santa-clause
 Share

Recommended Posts

**THERE IS A BAD FILE ERROR IN THIS CODE SO PLEASE DON'T USE IT UNTIL I FIXED THAT ERROR!!**

**USE ERWINS TUTORIAL INSTEAD THAT ONE WORKS ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png)**

[http://www.touchofde…rom-csde-in-eo/](http://www.touchofdeathforums.com/community/index.php?/topic/122847-eo-add-music-system-from-csde-in-eo/)

All the credits go to Robin for the making of FMOD for crystalshire.

And credits to Sephir0th for the making of clsFMOD.cls

Ok to start simply download the attachment and add it to you're project

Also add FMOD.dll from the attachment.

**ALL CLIENT SIDE**

Find Private Sub cmdPlay_Click() and Private Sub cmdStop_Click()

and replace all of that with this:

```

Private Sub cmdPlay_Click()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

FMOD.Music_Stop

FMOD.Music_Play lstMusic.List(lstMusic.ListIndex)

' Error handler

Exit Sub

errorhandler:

HandleError "cmdPlay_Click", "frmEditor_MapProperties", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Private Sub cmdStop_Click()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

FMOD.Music_Stop

' Error handler

Exit Sub

errorhandler:

HandleError "cmdStop_Click", "frmEditor_MapProperties", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

Find

```
If Len(Trim$(Options.MenuMusic)) > 0 Then PlayMidi Trim$(Options.MenuMusic)
```
And replace it whit:

```

If Len(Trim$(Options.MenuMusic)) > 0 Then FMOD.Music_Play Trim$(Options.MenuMusic)

```

Find(In Sub GameInit()):

```

'stop the song playing

StopMidi

```

Replace that whit this:

```

' play music

Dim MusicFile As String

MusicFile = Trim$(Map.Music)

If Not MusicFile = "None." Then

FMOD.Music_Play MusicFile

Else

FMOD.Music_Stop

End If

```

Find (In Public Sub DestroyGame()):

```

Call DestroyTCP

```
After That add:

```

' destroy music & sound engines

FMOD.Destroy

```

In Private Sub HandleMapDone():

Replace:

```

MusicFile = Trim$(Map.Music)

If Not MusicFile = "None." Then

PlayMidi MusicFile

Else

StopMidi

End If

```
Whit:

```

' player music

MusicFile = Trim$(Map.Music)

If Not MusicFile = "None." Then

FMOD.Music_Play MusicFile

Else

FMOD.Music_Stop

End If

```

Replace all the:

```

PlaySound Sound_Buttonclick

```
With this:

```

FMOD.Sound_Play Sound_Buttonclick

```

In Private Sub optMOn_Click()

Replace:

```

' start music playing

MusicFile = Trim$(Map.Music)

If Not MusicFile = "None." Then

PlayMidi MusicFile

Else

StopMidi

End If

```
whit:

```

' start music playing

MusicFile = Trim$(Map.Music)

If Not MusicFile = "None." Then

FMOD.Music_Play MusicFile

Else

FMOD.Music_Stop

End If

```

And in Private Sub optMOff_Click()

Replace

```

StopMidi

```
Whit:

```

FMOD.Music_Stop

```

Find:

```

PlaySound Sound_ButtonHover

```
And replace all of them whit:

```

FMOD.Sound_Play Sound_ButtonHover

```

In Public Sub PlayMapSound:

Replace:

```

' play the sound

PlaySound soundName

```
Whit:

```

' play the sound

FMOD.Sound_Play soundName

```

Add this to ModConstants:

```

' Constants for FMOD tutorial by Santa

Public Const Sound_ButtonHover As String = "Cursor1.wav"

Public Const Sound_Buttonclick As String = "Click.wav"

```

In modglobals after:

```

Option Explicit

```
add:

```

'******************************************************

'This is base object decalaration for FMOD sound engine TUT by santa

Public FMOD As New clsFMOD

'******************************************************

```

In Sub GameLoop find:

```

StopMidi

PlayMidi Options.MenuMusic

```
And replace it with:

```

FMOD.Music_Stop

FMOD.Music_Play Options.MenuMusic

```

In Sub Main

Replace:

```

' load music/sound engine

InitSound

InitMusic

```
With this:

```

' initialise sound & music engines

FMOD.Init

```

Replace the hole Private Sub HandlePlayBGM

with:

```

Private Sub HandlePlayBGM(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim Buffer As clsBuffer

Dim str As String

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer

Buffer.WriteBytes Data()

str = Buffer.ReadString

FMOD.Music_Stop

FMOD.Music_Play str

Set Buffer = Nothing

' Error handler

Exit Sub

errorhandler:

HandleError "HandlePlayBGM", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

That's it normally now you have succesfully installed FMOD ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)

If you find any bugs then just ask how to fix it because this is working perfectly on my engine ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png)

PAY ATTENTION:

its not playing the sound on debug mode…

So copile the client then can you hear the sounds …
Link to comment
Share on other sites

whit fmod you can play any kind of music ,,,

mp3,mp4,ogg, etc….

Erwins music system

[http://www.touchofdeathforums.com/community/index.php?/topic/122847-eo-add-music-system-from-csde-in-eo/](http://www.touchofdeathforums.com/community/index.php?/topic/122847-eo-add-music-system-from-csde-in-eo/)
Link to comment
Share on other sites

> Are you people still trying to get FMOD to work? It's broken as hell and doesn't offer nearly as much as BASS.

But with BASS you must use also bassmidi to get something that trivial like playing midis to work. And becouse many people prefer midis above MP3s and OGGs becouse of filesize (like me, i am using MP3 only sometimes, otherwise i am using mainly midis for music becouse i do not want that my game will be +100MB in size just becouse of music)
Link to comment
Share on other sites

> But with BASS you must use also bassmidi to get something that trivial like playing midis to work. And becouse many people prefer midis above MP3s and OGGs becouse of filesize (like me, i am using MP3 only sometimes, otherwise i am using mainly midis for music becouse i do not want that my game will be +100MB in size just becouse of music)

People who prefer .midi over .mp3, .ogg, .flac, etc have massive problems.
Link to comment
Share on other sites

> People who prefer .midi over .mp3, .ogg, .flac, etc have massive problems.

People who wanna have Eclipse game with size above 100MB aren´t normal too. And why? It is like comparing LPs with CDs. And who are saying about people who are listening to LPs that they are idiots? Noone.
Link to comment
Share on other sites

> People who wanna have Eclipse game with size above 100MB have massive problems.

It's not the dark ages. People can download over 100mb now without caring.
Link to comment
Share on other sites

> It's not the dark ages. People can download over 100mb now without caring.

But that type of peoples will rather download Unreal Tournament ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...