Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue With Music
#1
This is a really annoying error which I can't seem to figure out.

Here's my sound module (OMG I GIVETH OUT TEH SOURCE!)
Code:
Option Explicit
Private Const SND_ASYNC        As Long = &H1
Private Const SND_NODEFAULT    As Long = &H2
Private CurrentSong            As String
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, _
                                                                               ByVal lpstrReturnString As String, _
                                                                               ByVal uReturnLength As Long, _
                                                                               ByVal hwndCallback As Long) As Long
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _
                                                                             ByVal uFlags As Long) As Long
Public Sub MakeMidiLoop()
Dim SBuffer As String * 256
    mciSendString "STATUS background MODE", SBuffer, 256, 0
    If Left$(SBuffer, 7) = "stopped" Then
        mciSendString "PLAY background FROM 0", vbNullString, 0, 0
    End If
End Sub
Public Sub PlayMidi(Song As String)
    If ReadINI("CONFIG", "Music", App.Path & "\config.dcf") = 1 Then
        If CurrentSong  Song Then
            CurrentSong = Song
            mciSendString "close all", 0, 0, 0
            mciSendString "open """ & App.Path & "\music\" & Song & """ type sequencer alias background", 0, 0, 0
            mciSendString "play background notify", 0, 0, frmGame.hwnd
        End If
    Else
        StopMidi
    End If
End Sub

Now, check this line:
Code:
mciSendString "open """ & App.Path & "\music\" & Song & """ type sequencer alias background", 0, 0, 0

It doesn't work, unless I change it to this:
Code:
mciSendString "open """ & App.Path & "\" & Song & """ type sequencer alias background", 0, 0, 0

What teh feck?
Reply
#2
Where is your music located? here's mine for example
Code:
mciSendString "open """ & App.Path & "\Data\Music\" & Song & """ type sequencer alias background", 0, 0, 0
and it works perfectly (also though, I am using MS3.0.3) the sound part that you posted is not that much different or at all any different.
Reply
#3
What's your problem if it works then?
Reply
#4
Because I don't want all my music in the main directory, I want the music in a Music folder, but when I type in a folder, it doesn't work.
Reply
#5
Dunno, haven't programmed in ages, but perhaps:

Code:
mciSendString "open """ & App.Path & "\music\" & Song & """ type sequencer alias background", 0, 0, 0

Code:
mciSendString "open """ & App.Path & "\music" & Song & """ type sequencer alias background", 0, 0, 0
Reply
#6
No, because the Song variable only holds NameOfSong.mid
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)