-
I can not open an mp3 as binary. I did this
Code:
Dim LocData() As Byte
Dim LenData As Long
Dim sendloop As Long
Dim path As String
path = "d:\program files\napster\music\Hows it gonna be.mp3"
Open path For Binary As #1
ReDim LocData(1 To 2048) As Byte ' Work in 2kb chunks
LenData = LOF(1) ' Get length of file
For sendloop = 1 To LenData \ 2048 ' Go through file
Get #1, , LocData 'Get data from the file nCnt is from where to start the get
Form1.Winsock1(index).SendData LocData 'Send the chunk
Next
but it wont do it, it is saying when i get the the lenData, it is saying it is 0. Any sudgestions?
-
Well you have spaces in the file name, and that's not healthy :)
Try putting the string in quotes, Windows likes it better that way:
Code:
Dim LocData() As Byte
Dim LenData As Long
Dim sendloop As Long
Dim path As String
path = """d:\program files\napster\music\Hows it gonna be.mp3"""
Open path For Binary As #1
ReDim LocData(1 To 2048) As Byte ' Work in 2kb chunks
LenData = LOF(1) ' Get length of file
For sendloop = 1 To LenData \ 2048 ' Go through file
Get #1, , LocData 'Get data from the file nCnt is from where to start the get
Form1.Winsock1(index).SendData LocData 'Send the chunk
Next
-
Get MP3 Tag info
A function to receive MP3 tag info is below.
Code:
option explicit
Private Type TagInfo
Tag As String * 3
Songname As String * 30
artist As String * 30
album As String * 30
year As String * 4
comment As String * 30
genre As String * 1
End Type
Private CurrentTag As TagInfo
Public Function GetTagInfo(Filename As String) As String
Open Filename For Binary As #1
With CurrentTag
Get #1, FileLen(Filename) - 127, .Tag
If Not .Tag = "TAG" Then
GetTagInfo = "Other"
Close #1
Exit Function
End If
Get #1, , .Songname
Get #1, , .artist
Get #1, , .album
Get #1, , .year
Get #1, , .comment
Get #1, , .genre
Close #1
GetTagInfo = RTrim(.artist) & " - " & RTrim(.Songname)
End With
End Function
This just gets the basic tag info, if that's what you want.
Just put it in a separate module.