Print Page | Close Window

Music On/Off

Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=160
Printed Date: 20 December 2006 at 5:52pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Music On/Off
Posted By: Sync
Subject: Music On/Off
Date Posted: 11 February 2006 at 3:11pm
Difficulty: Easy 2/5

Originaly Posted By: Dragoons Master

Music ON/OFF
 
Here it is...

1st create 2 option boxes named optMusicON and optMusicOFF in your options menu, put this code in there:

Private Sub optMusicON_Click()
    Call WriteINI("OPTIONS", "Music", "ON", (App.Path & "\config.ini"))
    If Map.Music > 0 Then
             Call PlayMidi("music" & Trim(STR(Map.Music)) & ".mid")
    End If
End Sub
Private Sub optMusicOFF_Click()
    Call WriteINI("OPTIONS", "Music", "OFF", (App.Path & "\config.ini"))
    Call StopMidi
End Sub

Now, in modSound replace all

Public Sub PlayMidi(Song As String)


Blablabla


with:

Public Sub PlayMidi(Song As String)
Dim i As Long
Dim FileName As String
Dim ONOFF As String
    FileName = App.Path & "\config.ini"
    If FileExist("config.ini") Then
        ONOFF = ReadINI("OPTIONS", "Music", FileName)
        If ONOFF = "ON" Then
             i = mciSendString("close all", 0, 0, 0)
             i = mciSendString("open " & Song & " type sequencer alias background", 0, 0, 0)
             i = mciSendString("play background notify", 0, 0, frmMirage.hWnd)
        End If
    Else
        Call WriteINI("OPTIONS", "Music", "ON", (App.Path & "\config.ini"))
    End If
End Sub


THAT´S IT!



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info