Showing posts with label Multimedia. Show all posts
Showing posts with label Multimedia. Show all posts

Thursday, June 14, 2012

Memperoleh Tag Sebuah File MP3 - VB6 Code

Option Explicit

Private Type eTagMP3
TagIdent As String * 3
Title As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 30
End Type

Private TagMP3 As eTagMP3

Private Function GetMP3Tag(Path As String) As String()
Dim fNum As Integer
fNum = FreeFile
Open Path For Binary As fNum
Seek #fNum, LOF(fNum) - 127
Get #fNum, , TagMP3.TagIdent
If TagMP3.TagIdent = "TAG" Then
Get #fNum, , TagMP3.Title
Get #fNum, , TagMP3.Artist
Get #fNum, , TagMP3.Album
Get #fNum, , TagMP3.Year
Get #fNum, , TagMP3.Comment
End If
Close #fNum
End Function


Private Sub Command1_Click()
GetMP3Tag "C:\ase.mp3"
MsgBox TagMP3.Comment
End Sub
READ MORE - Memperoleh Tag Sebuah File MP3 - VB6 Code

Tuesday, May 29, 2012

Memainkan file MP3 dengan Windows API di Visual Basic 6

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

Dim
lagu As String
lagu = "D:\musik.mp3"

'Kode pada event click tombol cmdPlay
Private Sub cmdPlay_Click()
Call mciSendString("open " & lagu & " type MPEGVideo alias lagu wait", vbNullString, 0&, 0&)
Call mciSendString("play " & lagu , vbNullString,0&, 0&)
End Sub

'Kode pada event click tombol cmdStop
Private Sub cmdStop_Click()
Call mciSendString("stop " & lagu, vbNullString, 0&, 0&)
Call mciSendString("close " & lagu &"wait", vbNullString, 0&, 0&)
End Sub
READ MORE - Memainkan file MP3 dengan Windows API di Visual Basic 6

Monday, May 28, 2012

Memeriksa Keberadaan Sound Card Pada Komputer

Di bawah ini merupakan fungsi untuk mengetahui apakah komputer memiliki souncard atau tidak.
Option Explicit 

Private Declare Function
waveOutGetNumDevs Lib "winmm.dll" ) As Long

Public Function
IsExistSoundCard() As Boolean
Dim I As Integer
I =
waveOutGetNumDevs()
IsExistSoundCard = I > 0)
End Function

Contoh penggunaan fungsi memeriksa keberadaan sound card pada komputer
Private Sub Command1_Click() 
MsgBox IsExistSoundCard
End Sub
READ MORE - Memeriksa Keberadaan Sound Card Pada Komputer

Menjalankan File .MP3 Menggunakan Microsoft Multimedia Control

Option Explicit 

Private Sub
Command1_Click()
MMC.FileName = OpenFile
Me.Caption = MMC.FileName
MMC.Command = "open"
MMC.Command = "play"
End Sub

Private Function
OpenFile() As String
With
CommonDialog1
.FileName = ""
.DialogTitle = "Open Files"
.InitDir = "C:\My Documents"
.Filter = "MP3 File (*.MP3)|*.MP3"
.ShowOpen
If .FileName = "" Then Exit Function
MMC.Command = "stop"
OpenFile = .FileName
End With
End Function

Private Sub
Command2_Click()
MMC.Command = "stop"
End Sub
READ MORE - Menjalankan File .MP3 Menggunakan Microsoft Multimedia Control

Sunday, May 27, 2012

Fungsi Untuk Menjalankan File .wav Menggunakan Visual Basic 6.0

Di bawah ini merupakan fungsi untuk menjalankan file .wav dengan menggunakan Visual Basic 6.0 disertai dengan beberapa argumen yang dibutuhkan.
Option Explicit 

Public Declare Function
sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Public Enum
SoundOption
SND_SYNC = &H0
SND_ASYNC = &H1
SND_NODEFAULT = &H2
SND_LOOP = &H8
SND_NOSTOP = &H10
End Enum

Public Sub
PlaySound(Filename As String, Optional OpsiSound As SoundOption = SND_ASYNC Or SND_NODEFAULT)
Dim sThewavsound As String, ret As Long
sThewavsound = Filename
ret = sndPlaySound(sThewavsound, OpsiSound)
End Sub
Contoh Penggunaan fungsi menjalankan file .wav menggunakan visual basic 6.0
Private Sub Command1_Click()
PlaySound Text1.Text, SND_ASYNC
End Sub
READ MORE - Fungsi Untuk Menjalankan File .wav Menggunakan Visual Basic 6.0

Sunday, April 4, 2010

VB6 Code - Menjalankan File .mp3

Di bawah ini merupakan contoh menggunakan Microsoft Multimedia Control yang digunakan untuk menjalankan file .mp3 menggunakan VB6.
Option Explicit

Private Sub Command1_Click()
MMC.FileName = OpenFile
Me.Caption = MMC.FileName
MMC.Command = "open"
MMC.Command = "play"
End Sub

Private Function OpenFile() As String
With CommonDialog1
.FileName = ""
.DialogTitle = "Open Files"
.InitDir = "C:\My Documents"
.Filter = "MP3 File (*.MP3)|*.MP3"
.ShowOpen
If .FileName = "" Then Exit Function
MMC.Command = "stop"
OpenFile = .FileName
End With
End Function

Private Sub Command2_Click()
MMC.Command = "stop"
End Sub
READ MORE - VB6 Code - Menjalankan File .mp3

Saturday, April 3, 2010

VB6 Code - Menjalankan File .wav Menggunakan Visual Basic

Di bawah ini merupakan fungsi VB6 untuk menjalankan file .wav dengan menggunakan Visual Basic 6.0 disertai dengan beberapa argumen yang dibutuhkan.
Option Explicit

Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Public Enum SoundOption
SND_SYNC = &H0
SND_ASYNC = &H1
SND_NODEFAULT = &H2
SND_LOOP = &H8
SND_NOSTOP = &H10
End Enum

Public Sub PlaySound(Filename As String, Optional OpsiSound As SoundOption = SND_ASYNC Or SND_NODEFAULT)
Dim sThewavsound As String, ret As Long
sThewavsound = Filename
ret = sndPlaySound(sThewavsound, OpsiSound)
End Sub
Contoh Penggunaan fungsi menjalankan file .wav menggunakan visual basic 6.0
Private Sub Command1_Click()
PlaySound Text1.Text, SND_ASYNC
End Sub
READ MORE - VB6 Code - Menjalankan File .wav Menggunakan Visual Basic