Mirage Source
Issue With Music - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: Issue With Music (/showthread.php?tid=2462)



Issue With Music - Xlithan - 31-12-2008

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?


Re: Issue With Music - DarkX - 01-01-2009

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.


Re: Issue With Music - Tony - 01-01-2009

What's your problem if it works then?


Re: Issue With Music - Xlithan - 01-01-2009

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.


Re: Issue With Music - Rian - 01-01-2009

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



Re: Issue With Music - Xlithan - 01-01-2009

No, because the Song variable only holds NameOfSong.mid