Antiguo 17-nov-2008, 18:34   #1 (permalink)
●Parra Fan
 
Avatar de Standelf
 
Ingreso: abril-2008
Ubicación: Atras tuyo
Edad: 15
Mensajes: 105
Puntos: 13.818, Nivel: 15 Puntos: 13.818, Nivel: 15 Puntos: 13.818, Nivel: 15
Nivel máximo: 16% Nivel máximo: 16% Nivel máximo: 16%
Actividad: 4% Actividad: 4% Actividad: 4%
El usuario posee 1x Acceso Vip
Poder: 109 Standelf is a splendid one to beholdStandelf is a splendid one to beholdStandelf is a splendid one to beholdStandelf is a splendid one to beholdStandelf is a splendid one to beholdStandelf is a splendid one to beholdStandelf is a splendid one to beholdStandelf is a splendid one to behold
Predeterminado [Aporte] Cambiar los MIDI por MP3

Bueno, el titulo lo dice todo, el codigo es para cambiar los midi por mp3, usando los sonidos de los mapas normales

El codigo lo hice a base del posteado por risse, lo posteo para los que no saben como usarlo bien, o quiren cambiar todo el sistema de midis, y no saben como.

1 - Creamos un nuevo Modulo de clase con el nombre:

Cita:
clsMP3Player
2 - Adentro le ponemos:

Código:
Option Explicit
 
Private mvarmp3file 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 GetShortPathName Lib "Kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As Long
 
Dim mVolume As Integer
 
Public Sub pauseMP3()
mciSendString "pause audio1", 0, 0, 0
End Sub
 
Public Sub playMP3()
Dim rtn As Long
Dim filename As String
Dim lngRes As Long, strPath As String
 
strPath = String$(165, 0)  'Create a buffer
lngRes = GetShortPathName(mvarmp3file, strPath, 164)
filename = Trim(Left$(strPath, lngRes))
 
rtn = mciSendString("Open " & filename & " Alias audio1", 0&, 0, 0)
rtn = mciSendString("play audio1", 0&, 0, 0)
 
End Sub
 
Public Sub stopMP3()
Dim rtn As Long
 
rtn = mciSendString("stop audio1", 0&, 0, 0)
rtn = mciSendString("close audio1", 0&, 0, 0)
 
End Sub
 
Public Property Let mp3file(ByVal vData As String)
    mvarmp3file = vData
End Property
 
Public Property Get mp3file() As String
    mp3file = mvarmp3file
End Property
 
Public Property Let Volume(ByVal nVolume As Integer)
    mciSendString "setaudio audio1 volume to " & nVolume, "", 0, 0
    mVolume = nVolume
End Property
 
Public Property Get Volume() As Integer
    Volume = mVolume
End Property
 
'setaudio MP3 volume to " + NewVolume
Public Function Position(secs As Boolean) As String
'Returns the track's current position as "mm:ss".
'Returns tracks's current position in seconds if secs = True
 
Static P As String * 30
Dim sec As Integer
Dim mins As Integer
 
mciSendString "set audio1 Time Format milliseconds", "", 0, 0
mciSendString "status audio1 position", P, Len(P), 0
sec = Round(Val(mid$(P, 1, Len(P))) / 1000)
 
If secs Then
    Position = sec
Else
    If sec < 60 Then Position = "0:" & Format(sec, "00")
    If sec > 59 Then
        mins = Int(sec / 60)
        sec = sec - (mins * 60)
        Position = Format(mins, "00") & ":" & Format(sec, "00")
    End If
End If
 
End Function
 
Public Function TrackLength(secs As Boolean) As String
'Returns the track's length as "mm:ss".
'Returns tracks's length in seconds if secs = True
 
Static L As String * 30
Dim sec As Integer
Dim mins As Integer
 Dim TrackLenghth As String
mciSendString "set audio1 Time Format milliseconds", "", 0, 0
mciSendString "status audio1 length", L, Len(L), 0
 
sec = Round(Val(mid$(L, 1, Len(L))) / 1000)
 
If secs Then
    TrackLength = sec
Else
    If sec < 60 Then
        TrackLenghth = "0:" & Format(sec, "00")
    Else
        mins = Int(sec / 60)
        sec = sec - (mins * 60)
        TrackLength = Format(mins, "00") & ":" & Format(sec, "00")
    End If
End If
 
End Function
 
Public Function IsItPlaying() As Boolean
'Returns true if the file is playing. False otherwise.
 
Static yn As String * 30
 
mciSendString "status audio1 mode", yn, Len(yn), 0
IsItPlaying = (mid$(yn, 1, 7) = "playing")
 
End Function
3 - Buscamos:
Código:
Public currentMidi As Long
y lo reemplazamos por:

Código:
Public CurrentMP3 As Long
4 - buscamos:
Código:
                    If Not Audio.PlayingMusic Then
                        Musica = True
                        Audio.PlayMIDI CStr(currentMidi) & ".mid"
                    Else
                        Musica = False
                        Audio.StopMidi
                    End If
y lo reemplazamos por:
Código:
                    If Not Audio.PlayingMusic Then
                        Musica = True
                        MP3P.mp3file = App.Path + "MP3" & CurrentMP3 & ".mp3"
                        MP3P.playMP3
                    Else
                        Musica = False
                        MP3P.stopMP3
                    End If
5 - Buscamos:
Código:
Case "TM"           ' >>>>> Play un MIDI :: TM
reemplazamos todo ese case por este:

Código:
        Case "TM"           ' >>>>> Play un MIDI :: TM
            Rdata = Right$(Rdata, Len(Rdata) - 2)
            CurrentMP3 = Rdata
                        
                If Musica Then
                    MP3P.stopMP3
                        MP3P.mp3file = App.Path + "MP3" & Rdata & ".mp3"
                    MP3P.playMP3
                End If
            Exit Sub
6 - Buscamos:

Código:
        If Musica Then
            Musica = False
            Command1(0).Caption = "Musica Desactivada"
            Audio.StopMidi
        Else
            Musica = True
            Command1(0).Caption = "Musica Activada"
            Call Audio.PlayMIDI(CStr(currentMidi) & ".mid")
        End If
y lo reemplazamos por:

Código:
        If Musica Then
            Musica = False
            Command1(0).Caption = "Musica Desactivada"
            MP3P.stopMP3
        Else
            Musica = True
            Command1(0).Caption = "Musica Activada"
            MP3P.mp3file = App.Path + "MP3" & MP3Now & ".mp3"
            MP3P.playMP3
        End If
7 - Buscan:
Código:
    If Musica Then
        Call Audio.PlayMIDI(MIdi_Inicio & ".mid")
    End If
y lo reemplazan por:
Código:
    If Musica Then
        MP3P.mp3file = App.Path + "MP3" & MIdi_Inicio & ".mp3"
    End If
8 - buscan:
Código:
        If Musica Then
            Call Audio.PlayMIDI("2.mid")
        End If
y lo reemplazan por:
Código:
    If Musica Then
        MP3P.mp3file = App.Path + "MP32.mp3"
    End If
9 - Buscan:
Código:
        If Musica Then
            Call Audio.PlayMIDI("7.mid")
        End If
y lo reemplazan por:
Código:
    If Musica Then
        MP3P.mp3file = App.Path + "MP37.mp3"
    End If
10 - En el Sub main agregan:

Código:
Set MP3P = New clsMP3Player
11 - Declaran:
Código:
Public MP3P As clsMP3Player
Listo ^^
En la carpeta del cliente, debe ir una carpeta llamada MP·, aentro los archivos deben llamarse por numero, como los midis

Suerte

Echo por mi a base del codigo de risse ^^
__________________

[Solo Miembros registrados ven los enlaces. ]

Última edición por Standelf; 17-nov-2008 a las 18:40.
Standelf está desconectado  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
Responder Citando
Sponsored Links
Respuesta

Marcadores

Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
caritas están Activado
[IMG] está Activado
Código HTML está Desactivado
Trackbacks are Desactivado
Pingbacks are Desactivado
Refbacks are Desactivado
Ir al Foro

Te recomendamos visitar estos sitios

PasionChat  Blogs  UASU lite  El Foro Latino  Argentum Online  Host Gratis  Bazar de dominios


La franja horaria es GMT -5. Ahora son las 16:27.



Desarrollado por: vBulletin® Versión 3.7.5
Derechos de Autor ©2000 - 2009, Jelsoft Enterprises Ltd.
Traducido por mcloud
Copyright UASU Group - Azmum Multimedios 2002-2008Ad Management by RedTyger
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.