/// <summary> /// Gets the collection of tags associated with the specified sound. /// </summary> private static SongTagCollection GetTags(FMOD_SOUND *sound, out String name, out String artist, out String album) { var numtags = 0; var result = default(FMOD_RESULT); result = FMOD_Sound_GetNumTags(sound, &numtags, null); if (result != FMOD_OK) { throw new FMODException(result); } var tags = new SongTagCollection(); for (int i = 0; i < numtags; i++) { var tag = GetTag(sound, i); if (tag != null) { tags.Add(tag); } } name = tags["name"]?.Value ?? tags["title"]?.Value; artist = tags["artist"]?.Value; album = tags["album"]?.Value; return(tags); }
/// <summary> /// Reads any supported tags which are contained by the specified stream. /// </summary> private static SongTagCollection GetTags(UInt32 stream, out String name, out String artist, out String album) { var result = new SongTagCollection(); var tags = new Dictionary <String, String>(); if (ReadID3TagsFromStream(stream, out tags) || ReadOggTagsFromStream(stream, out tags)) { foreach (var tag in tags) { result.Add(tag.Key, tag.Value); } } name = result["name"]?.Value ?? result["title"]?.Value; artist = result["artist"]?.Value; album = result["album"]?.Value; return(result); }