IntPtr p = BASS_ChannelGetTags(stream, BASS_TAG_ID3);// check, if ID3v1
string id = Marshal.PtrToStringAnsi(p, 3);
if (id != "TAG")
return false;// song title (comes after 'TAG')...
p = new IntPtr((byte*)p.ToPointer() + 3);
string title = Marshal.PtrToStringAnsi(p).TrimEnd('\0');
int idx = title.IndexOf('\0');
if (idx > 0)
title = title.Substring(0, idx);
// artist...
p = new IntPtr((byte*)p.ToPointer() + 30);
string artist = Marshal.PtrToStringAnsi(p, 30).TrimEnd('\0');
idx = artist.IndexOf('\0');
if (idx > 0)
artist = artist.Substring(0, idx);
// album...
p = new IntPtr((byte*)p.ToPointer() + 30);
string album = Marshal.PtrToStringAnsi(p, 30).TrimEnd('\0');
idx = album.IndexOf('\0');
if (idx > 0)
album = album.Substring(0, idx);
// year...
p = new IntPtr((byte*)p.ToPointer() + 30);
string year = Marshal.PtrToStringAnsi(p, 4).TrimEnd('\0');
idx = year.IndexOf('\0');
if (idx > 0)
year = year.Substring(0, idx);
// comment...
p = new IntPtr((byte*)p.ToPointer() + 4);
string comment = Marshal.PtrToStringAnsi(p, 30).TrimEnd('\0');
idx = comment.IndexOf('\0');
if (idx > 0)
comment = comment.Substring(0, idx);
// genre-id...
p = new IntPtr((byte*)p.ToPointer() + 30);
int genreId = (int)Marshal.ReadByte(p);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货