Vatansever
Asistan
- Katılım
- 23 Ağustos 2007
- Mesajlar
- 405
- Reaksiyon puanı
- 1
- Puanları
- 18
Arkadaşlar programımın hakkında formu açılınca ses çaldırıyorum elimde .xm formatında ses dosyası var çok güzel bunu kullanmak istedim 15KB boyutu var mp3'e çevirince birkaç MB oluyor bu yüzden xm formatını değiştirmeden kullanmak istiyorum araştırdım gerekli kodları buldum toparladım düzenledim şimdi xm formatlı ses dosyasını çaldırıyorum ama sadece çaldırıyorum bana lazım olan loop olarak çalsın sürekli bitince baştan başlasın birde sesi kapatma kodu lazım bu ikisini yapamadım. Kodlarda en üst kısımda dll fonksiyonları listelenmiş bunlar nasıl kullanılır nereye ne yazmak gerekir bu konudada bana bir ön bilgi verebilirseniz memnun olurum
Kod:
Module XMMOD
Public Declare Function FSOUND_Init Lib "fmod.dll" Alias "_FSOUND_Init@12" (ByVal mixrate As Integer, ByVal maxchannels As Integer, ByVal flags As Integer) As Byte
Public Declare Function FMUSIC_LoadSong Lib "fmod.dll" Alias "_FMUSIC_LoadSong@4" (ByVal name As String) As Integer
Public Declare Function FMUSIC_PlaySong Lib "fmod.dll" Alias "_FMUSIC_PlaySong@4" (ByVal module1 As Integer) As Byte
Public Declare Function FSOUND_DSP_Create Lib "fmod.dll" Alias "_FSOUND_DSP_Create@12" (ByVal Callback As DSPDelegate, ByVal Priority As Integer, ByVal param As Integer) As Integer
Public Delegate Function DSPDelegate(ByVal originalbuffer As Integer, ByVal newbuffer As Integer, ByVal length As Integer, ByVal param As Integer) As Integer
Public Declare Function FSOUND_SetBufferSize Lib "fmod.dll" Alias "_FSOUND_SetBufferSize@4" (ByVal lenms As Long) As Byte
Public Declare Function FSOUND_Init Lib "fmod.dll" Alias "_FSOUND_Init@12" (ByVal mixrate As Long, ByVal MaxChannels As Long, ByVal flags As Long) As Byte
Public Declare Function FSOUND_Close Lib "fmod.dll" Alias "_FSOUND_Close@0" () As Long
Public Declare Function FSOUND_SetHWND Lib "fmod.dll" Alias "_FSOUND_SetHWND@4" (ByVal hwnd As Long) As Byte
Public Declare Function FSOUND_Stream_Open Lib "fmod.dll" Alias "_FSOUND_Stream_Open@16" (ByVal FileName As String, ByVal mode As Long, ByVal Offset As Long, ByVal Length As Long) As Long
Public Declare Function FSOUND_Stream_PlayEx Lib "fmod.dll" Alias "_FSOUND_Stream_PlayEx@16" (ByVal channel As Long, ByVal stream As Long, ByVal dsp As Long, ByVal startpaused As Byte) As Long
Public Declare Function FSOUND_SetPaused Lib "fmod.dll" Alias "_FSOUND_SetPaused@8" (ByVal channel As Long, ByVal Paused As Byte) As Byte
Public Declare Function FSOUND_Stream_Stop Lib "fmod.dll" Alias "_FSOUND_Stream_Stop@4" (ByVal stream As Long) As Byte
Public Declare Function FSOUND_Stream_GetLengthMs Lib "fmod.dll" Alias "_FSOUND_Stream_GetLengthMs@4" (ByVal stream As Long) As Long
Public Declare Function FSOUND_Stream_GetTime Lib "fmod.dll" Alias "_FSOUND_Stream_GetTime@4" (ByVal stream As Long) As Long
Public Declare Function FSOUND_Stream_Close Lib "fmod.dll" Alias "_FSOUND_Stream_Close@4" (ByVal stream As Long) As Byte
Public Declare Function FSOUND_StopSound Lib "fmod.dll" Alias "_FSOUND_StopSound@4" (ByVal channel As Long) As Byte
Public Declare Function FSOUND_SetVolume Lib "fmod.dll" Alias "_FSOUND_SetVolume@8" (ByVal channel As Long, ByVal Vol As Long) As Byte
'Public Declare Function FMUSIC_LoadSong Lib "fmod.dll" Alias "_FMUSIC_LoadSong@4" (ByVal name As String) As Long
'Public Declare Function FMUSIC_PlaySong Lib "fmod.dll" Alias "_FMUSIC_PlaySong@4" (ByVal module1 As Long) As Byte
Public Declare Function FMUSIC_StopSong Lib "fmod.dll" Alias "_FMUSIC_StopSong@4" (ByVal module1 As Long) As Byte
Public Declare Function FMUSIC_SetPaused Lib "fmod.dll" Alias "_FMUSIC_SetPaused@8" (ByVal module1 As Long, ByVal Pause As Byte) As Byte
Public Declare Function FMUSIC_SetLooping Lib "fmod.dll" Alias "_FMUSIC_SetLooping@8" (ByVal module1 As Long, ByVal looping As Boolean) As Byte
Public Declare Function FMUSIC_GetOrder Lib "fmod.dll" Alias "_FMUSIC_GetOrder@4" (ByVal module1 As Long) As Long
Public Declare Function FMUSIC_GetNumOrders Lib "fmod.dll" Alias "_FMUSIC_GetNumOrders@4" (ByVal module1 As Long) As Long
Public Declare Function FMUSIC_IsFinished Lib "fmod.dll" Alias "_FMUSIC_IsFinished@4" (ByVal module1 As Long) As Byte
Public Declare Function FMUSIC_FreeSong Lib "fmod.dll" Alias "_FMUSIC_FreeSong@4" (ByVal module1 As Long) As Byte
Public Declare Function FMUSIC_SetMasterVolume Lib "fmod.dll" Alias "_FMUSIC_SetMasterVolume@8" (ByVal module1 As Long, ByVal Volume As Long) As Byte
Public Sub Sesmuzika()
FSOUND_Init(44001, 128, 0)
Dim XMFilename As String = "muzika.xm"
Dim TempPath As String = System.IO.Path.GetTempPath()
Dim ExtractPath As String = TempPath & "\" & XMFilename
Try
System.IO.File.WriteAllBytes(ExtractPath, My.Resources.Kaynak.muzika)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Dim XMPointer As Integer = 0
XMPointer = FMUSIC_LoadSong(System.IO.Path.GetTempPath() & "\muzika.xm")
FMUSIC_PlaySong(XMPointer)
'FMUSIC_SetLooping(XMPointer, 10)
End Sub
End Module