本文整理汇总了C++中fmod::Sound::getNumTags方法的典型用法代码示例。如果您正苦于以下问题:C++ Sound::getNumTags方法的具体用法?C++ Sound::getNumTags怎么用?C++ Sound::getNumTags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fmod::Sound
的用法示例。
在下文中一共展示了Sound::getNumTags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
switch (key)
{
case ' ' :
{
if (channel)
{
bool paused;
channel->getPaused(&paused);
channel->setPaused(!paused);
}
break;
}
case 'm' :
case 'M' :
{
if (channel)
{
channel->getMute(&mute);
channel->setMute(!mute);
}
break;
}
}
}
system->update();
if (channel)
{
bool playing = false;
int tagsupdated = 0;
sound->getNumTags(0, &tagsupdated);
if (tagsupdated)
{
printf("\n");
printf("\n");
for (;;)
{
FMOD_TAG tag;
if (sound->getTag(0, -1, &tag) != FMOD_OK)
{
break;
}
if (tag.datatype == FMOD_TAGDATATYPE_STRING)
{
printf("[%-11s] %s (%d bytes)\n", tag.name, tag.data, tag.datalen);
sound->getFormat(&gSoundType, 0, 0, 0);
if (!strcmp(tag.name, "ARTIST"))
{
if (strncmp(gCurrentTrackArtist, (const char *)tag.data, 256))
{
strncpy(gCurrentTrackArtist, (const char *)tag.data, 256);
gUpdateFileName = true;
}
}
if (!strcmp(tag.name, "TITLE"))
{
if (strncmp(gCurrentTrackTitle, (const char *)tag.data, 256))
{
示例2: main
int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *sound;
FMOD_RESULT result;
FMOD_TAG tag;
int numtags, numtagsupdated, count;
unsigned int version;
printf("==================================================================\n");
printf("ReadTags Example. Copyright (c) Firelight Technologies 2004-2011.\n");
printf("==================================================================\n\n");
/*
Global Settings
*/
result = FMOD::System_Create(&system);
ERRCHECK(result);
result = system->getVersion(&version);
ERRCHECK(result);
if (version < FMOD_VERSION)
{
printf("Error! You are using an old version of FMOD %08x. This program requires %08x\n", version, FMOD_VERSION);
getch();
return 0;
}
result = system->init(100, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);
/*
Open the specified file. Use FMOD_CREATESTREAM and FMOD_OPENONLY so it opens quickly
*/
result = system->createSound("../media/wave.mp3", FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM | FMOD_OPENONLY, 0, &sound);
ERRCHECK(result);
/*
Read and display all tags associated with this file
*/
for (;;)
{
/*
An index of -1 means "get the first tag that's new or updated".
If no tags are new or updated then getTag will return FMOD_ERR_TAGNOTFOUND.
This is the first time we've read any tags so they'll all be new but after we've read them,
they won't be new any more.
*/
if (sound->getTag(0, -1, &tag) != FMOD_OK)
{
break;
}
if (tag.datatype == FMOD_TAGDATATYPE_STRING)
{
printf("%s = %s (%d bytes)\n", tag.name, (char *)tag.data, tag.datalen);
}
else
{
printf("%s = <binary> (%d bytes)\n", tag.name, tag.datalen);
}
}
printf("\n");
/*
Read all the tags regardless of whether they're updated or not. Also show the tag type.
*/
result = sound->getNumTags(&numtags, &numtagsupdated);
ERRCHECK(result);
for (count=0; count < numtags; count++)
{
result = sound->getTag(0, count, &tag);
ERRCHECK(result);
switch (tag.type)
{
case FMOD_TAGTYPE_UNKNOWN :
printf("FMOD_TAGTYPE_UNKNOWN ");
break;
case FMOD_TAGTYPE_ID3V1 :
printf("FMOD_TAGTYPE_ID3V1 ");
break;
case FMOD_TAGTYPE_ID3V2 :
printf("FMOD_TAGTYPE_ID3V2 ");
break;
case FMOD_TAGTYPE_VORBISCOMMENT :
printf("FMOD_TAGTYPE_VORBISCOMMENT ");
break;
case FMOD_TAGTYPE_SHOUTCAST :
printf("FMOD_TAGTYPE_SHOUTCAST ");
break;
case FMOD_TAGTYPE_ICECAST :
printf("FMOD_TAGTYPE_ICECAST ");
break;
//.........这里部分代码省略.........