private bool GetWMATags(int stream) { tags = Bass.BASS_ChannelGetTagsMF(stream); if (tags != null) { for (int i = 0; i < tags.Length; i++) { frameId = tags[i].Split('=')[0]; value = tags[i].Split('=')[1]; switch (frameId) { case "Title": title = value; break; case "Author": artist = value; break; case "WM/AlbumTitle": album = value; break; case "Description": comment = value; break; case "WM/Year": year = value; break; case "WM/Genre": genre = value; break; } } return(true); } return(false); }
/// <summary> /// 使用Bass获得歌曲艺术家 /// </summary> /// <param name="stream">Bass音乐流</param> /// <param name="extension">音乐格式(扩展名)</param> /// <returns>艺术家</returns> private string Bass_Artist(string Path, int stream, string extension) { string content = null; switch (extension) { case ".mp3": case ".m4a": case ".flac": case ".aif": case ".aac": { string[] tags = Bass.BASS_ChannelGetTagsID3V2(stream); string[] tags7 = Bass.BASS_ChannelGetTagsID3V1(stream); string[] tags8 = Bass.BASS_ChannelGetTagsArrayNullTermAnsi(stream, BASSTag.BASS_TAG_FLAC_CUE); string[] tags9 = Bass.BASS_ChannelGetTagsArrayNullTermAnsi(stream, BASSTag.BASS_TAG_FLAC_PICTURE); BASS_TAG_FLAC_PICTURE[] tags10 = Bass.BASS_ChannelGetTagsFLACPictures(stream); string[] tags2 = Bass.BASS_ChannelGetTagsMETA(stream); string[] tags3 = Bass.BASS_ChannelGetTagsBWF(stream); string[] tags4 = Bass.BASS_ChannelGetTagsICY(stream); string[] tags5 = Bass.BASS_ChannelGetTagsMF(stream); string[] tags6 = Bass.BASS_ChannelGetTagsRIFF(stream); if (tags != null) { foreach (string x in tags) { if (x.Contains("TPE")) { content = x.Remove(0, 5); break; } } } break; } case ".ogg": { string[] tags = Bass.BASS_ChannelGetTagsOGG(stream); if (tags != null) { foreach (string x in tags) { if (x.Contains("ARTIST")) { content = x.Remove(0, 7); break; } else { content = null; } } } break; } case ".ape": { string[] tags = Bass.BASS_ChannelGetTagsAPE(stream); if (tags != null) { foreach (string x in tags) { if (x.Contains("Artist")) { content = x.Split(new char[] { '=' })[1]; break; } } } break; } case ".dff": case ".dsf": { stream = Bass.BASS_StreamCreateFile(Path, 0L, 0L, BASSFlag.BASS_SAMPLE_FLOAT); content = Bass.BASS_ChannelGetTagsDSDArtist(stream); break; } } return(content); }