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

[EO] Adding Mp3 support to EO - VERY BASIC


damian666
 Share

Recommended Posts

  • Replies 109
  • Created
  • Last Reply

Top Posters In This Topic

  • 3 weeks later...
> Now in modGeneral, in Public sub PopulateLists, look for :
>
> Code: [Select]
> ' music in map properties
>     frmEditor_MapProperties.lstMusic.Clear
>     frmEditor_MapProperties.lstMusic.AddItem "None."
>     strLoad = Dir(App.Path & MUSIC_PATH & "*.mid")
>     Do While strLoad > vbNullString
>       frmEditor_MapProperties.lstMusic.AddItem strLoad
>       strLoad = Dir
>     Loop
>
> after that, add :
>
> Fix by Anthony:
> Code: [Select]
>     strLoad = Dir(App.Path & MUSIC_PATH & "*.mp3")
>     Do While strLoad > vbNullString
>         ReDim Preserve musicCache(1 To i) As String
>         musicCache(i) = strLoad
>         strLoad = Dir
>         i = i + 1
>     Loop
>
> this will make sure the mp3 files are found so they show up in mapeditor.

all i have is

```
Public Sub PopulateLists()
Dim strLoad As String, i As Long

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    ' Cache music list
    strLoad = Dir(App.Path & MUSIC_PATH & "*.mid")
    i = 1
    Do While strLoad > vbNullString
        ReDim Preserve musicCache(1 To i) As String
        musicCache(i) = strLoad
        strLoad = Dir
        i = i + 1
    Loop

    ' Cache sound list
    strLoad = Dir(App.Path & SOUND_PATH & "*.wav")
    i = 1
    Do While strLoad > vbNullString
        ReDim Preserve soundCache(1 To i) As String
        soundCache(i) = strLoad
        strLoad = Dir
        i = i + 1
    Loop

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "PopulateLists", "modGeneral", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
my code dont have that same thing?
Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...
  • 2 months later...
There is no
```
' music in map properties
    frmEditor_MapProperties.lstMusic.Clear
    frmEditor_MapProperties.lstMusic.AddItem "None."
    strLoad = Dir(App.Path & MUSIC_PATH & "*.mid")
    Do While strLoad > vbNullString
      frmEditor_MapProperties.lstMusic.AddItem strLoad
      strLoad = Dir
    Loop

```
Link to comment
Share on other sites

  • 2 weeks later...
Can't find the following
```
' music in map properties
    frmEditor_MapProperties.lstMusic.Clear
    frmEditor_MapProperties.lstMusic.AddItem "None."
    strLoad = Dir(App.Path & MUSIC_PATH & "*.mid")
    Do While strLoad > vbNullString
      frmEditor_MapProperties.lstMusic.AddItem strLoad
      strLoad = Dir
    Loop

```
Link to comment
Share on other sites

  • 4 weeks later...
Can't find
```
' music in map properties
    frmEditor_MapProperties.lstMusic.Clear
    frmEditor_MapProperties.lstMusic.AddItem "None."
    strLoad = Dir(App.Path & MUSIC_PATH & "*.mid")
    Do While strLoad > vbNullString
      frmEditor_MapProperties.lstMusic.AddItem strLoad
      strLoad = Dir
    Loop

```I did a full project check. The nearest I am getting to is
```
  ' Cache music list
    strLoad = Dir(App.Path & MUSIC_PATH & "*.mid")
    i = 1
    Do While strLoad > vbNullString
        ReDim Preserve musicCache(1 To i) As String
        musicCache(i) = strLoad
        strLoad = Dir
        i = i + 1
    Loop

```
Link to comment
Share on other sites

@abhi2011:

> Can't find
> ```
> ' music in map properties
>     frmEditor_MapProperties.lstMusic.Clear
>     frmEditor_MapProperties.lstMusic.AddItem "None."
>     strLoad = Dir(App.Path & MUSIC_PATH & "*.mid")
>     Do While strLoad > vbNullString
>       frmEditor_MapProperties.lstMusic.AddItem strLoad
>       strLoad = Dir
>     Loop
>
> ```I did a full project check. The nearest I am getting to is
> ```
>   ' Cache music list
>     strLoad = Dir(App.Path & MUSIC_PATH & "*.mid")
>     i = 1
>     Do While strLoad > vbNullString
>         ReDim Preserve musicCache(1 To i) As String
>         musicCache(i) = strLoad
>         strLoad = Dir
>         i = i + 1
>     Loop
>    
>
> ```

And what happens if you put it after that?`
Link to comment
Share on other sites

@Lollicat:

> "Compile error: sub or function not defined"
> highlights "LoopMp3" in modGameLogic

Did you download both of the files that are attachments and add them to your project?

@abhi2011:

> I forgot about this topic. It never runs the MP3.

Does it not run in the Map Editor, while playing, or both?
Link to comment
Share on other sites

  • 4 weeks later...
For me its working
Just do it like the tutorial…
and post this
```
    strLoad = Dir(App.Path & MUSIC_PATH & "*.mp3")
    Do While strLoad > vbNullString
        ReDim Preserve musicCache(1 To i) As String
        musicCache(i) = strLoad
        strLoad = Dir
        i = i + 1
    Loop
```under this
```
  ' Cache music list
    strLoad = Dir(App.Path & MUSIC_PATH & "*.mid")
    i = 1
    Do While strLoad > vbNullString
        ReDim Preserve musicCache(1 To i) As String
        musicCache(i) = strLoad
        strLoad = Dir
        i = i + 1
    Loop

```Dont forget to make an reference ;-)
Link to comment
Share on other sites

I do not have```
' music in map properties
    frmEditor_MapProperties.lstMusic.Clear
    frmEditor_MapProperties.lstMusic.AddItem "None."
    strLoad = Dir(App.Path & MUSIC_PATH & "*.mid")
    Do While strLoad > vbNullString
      frmEditor_MapProperties.lstMusic.AddItem strLoad
      strLoad = Dir
    Loop

```
When i paste it in and then add everything as it is in the tutorial i get:

"sub or function not defined" at "For i = 0 To UBound(**Sound**()) - 1"

in

```
Private Sub HandleStopSound(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim str As String, i As Long

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    For i = 0 To UBound(Sound()) - 1
        SoundStop (i)
    Next
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "HandleFadeoutBGM", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

```
fix this or delete this very bad tutorial
Link to comment
Share on other sites

Try it yourself with an clean copy of Eclipse Origins Even System 2.3, i am pretty sure it does not work…...

Here is what i do:

I download the 2 attached files, i place them in client/src, i add ModDxShow.bas to my project, i add the reference.

I Post

```
strLoad = Dir(App.Path & MUSIC_PATH & "*.mp3")
    Do While strLoad > vbNullString
        ReDim Preserve musicCache(1 To i) As String
        musicCache(i) = strLoad
        strLoad = Dir
        i = i + 1
    Loop
```
under this

```
  ' Cache music list
    strLoad = Dir(App.Path & MUSIC_PATH & "*.mid")
    i = 1
    Do While strLoad > vbNullString
        ReDim Preserve musicCache(1 To i) As String
        musicCache(i) = strLoad
        strLoad = Dir
        i = i + 1
    Loop
```   

The .mp3 files show up now in the Map Properties, but they do not play at all, not even if i click on "Play". And the .mp3 file i added to the .ini for the main music does not play neither.

Usually i would have to add this:

```
'loop mapmusic if needed and its a mp3 file
LoopMp3

```
But as soon as i add this i get this error:

"Sub or function not defined" at:

Private Sub HandleStopSound(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim str As String, i As Long

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    For i = 0 To UBound(Sound()) - 1
        SoundStop (i)
    Next
    ' Error handler
    Exit Sub
errorhandler:
    HandleError "HandleFadeoutBGM", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

So it does not work
Link to comment
Share on other sites

  • 8 months later...

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...