getTag() public method

public getTag ( string name, int index, TAG &tag ) : RESULT
name string
index int
tag TAG
return RESULT
示例#1
0
        //Returns the song name retrieved by the tag "Artist".
        //Some additional checks must be made here to ensure no
        //garbage data is allowed through. If there is no data in the
        //artist tag, garbage is returned. Still have to code around
        //that for the C# version
        public string getArtistName()
        {
            string title;

            audio.getTag("", 0, ref tag);

            audio.getTag("ARTIST", 0, ref tag);
            title = tag.data.ToString();

            //if (title && strcmp(title, "major_brand") != 0 && stringValid(title))
            //    return title;
            //else
            //    return "none";

            return(title);
        }
示例#2
0
            public Tag?this[string name, int index]
            {
                get
                {
                    TAG tag;
                    if (!_fmodSound.getTag(name, index, out tag).Check(_suppressions))
                    {
                        return(null);
                    }

                    return(new Tag(tag));
                }
            }
示例#3
0
        private string GetTag(string tagName)
        {
            string tagResult = "";

            FMOD.TAG tag;

            _sound.getTag(tagName, 0, out tag);

            //switch (tag.datatype)
            //{
            //	case FMOD.TAGDATATYPE.INT:
            //		//return wstring(AsString(*((int *) tag.data)));
            //		OutputDebugStringA("INT\n"); break;
            //	case FMOD.TAGDATATYPE.FLOAT:
            //		//return wstring(AsString(*((float *) tag.data)));
            //		OutputDebugStringA("FLOAT\n"); break;
            //	case FMOD.TAGDATATYPE.STRING:
            //		//return ToUnicode((const char *) tag.data, CHARSET_WIN1250);// + atoi(GetUserLocale(LOCALE_IDEFAULTANSICODEPAGE)) - 1250);
            //		//OutputDebugStringA("STRING\n"); break;
            //		break;
            //	case FMOD.TAGDATATYPE.STRING_UTF16:
            //	case FMOD.TAGDATATYPE.STRING_UTF16BE:
            //	case FMOD.TAGDATATYPE.STRING_UTF8:
            //		OutputDebugStringA("WSTRING\n"); break;
            //	//return FromUnicode(WString((const wchar *) tag.data));
            //	//return wstring((const wchar *) tag.data);

            //	//tag.data;
            //}



            if (tag.datatype == FMOD.TAGDATATYPE.STRING)
            {
                tagResult = System.Runtime.InteropServices.Marshal.PtrToStringAuto(tag.data);
            }



            return(tagResult);
        }
示例#4
0
        private string GetSoundName(Sound sound)
        {
            //original implementation did not return all characters
            //StringBuilder name = new StringBuilder(0x100);
            //sound.getName(name, name.Capacity);

            //begin custom implementation
            string name = "";
            var tagCount = 0;
            var tagsUpdated = 0;
            sound.getNumTags(ref tagCount, ref tagsUpdated);
            TAG tag = new TAG();
            for (var i = 0; i < tagCount; i++) {
                sound.getTag(null, i, ref tag);
                if (tag.name == "TIT2") {
                    name = Marshal.PtrToStringAnsi(tag.data);
                    break;
                }
            }
            return name;
        }