本文整理汇总了C++中CMusicInfoTag::GetDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ CMusicInfoTag::GetDuration方法的具体用法?C++ CMusicInfoTag::GetDuration怎么用?C++ CMusicInfoTag::GetDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMusicInfoTag
的用法示例。
在下文中一共展示了CMusicInfoTag::GetDuration方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CSong::CSong(CMusicInfoTag& tag)
{
SYSTEMTIME stTime;
tag.GetReleaseDate(stTime);
strTitle = tag.GetTitle();
genre = tag.GetGenre();
strFileName = tag.GetURL();
artist = tag.GetArtist();
strAlbum = tag.GetAlbum();
albumArtist = tag.GetAlbumArtist();
strMusicBrainzTrackID = tag.GetMusicBrainzTrackID();
strMusicBrainzArtistID = tag.GetMusicBrainzArtistID();
strMusicBrainzAlbumID = tag.GetMusicBrainzAlbumID();
strMusicBrainzAlbumArtistID = tag.GetMusicBrainzAlbumArtistID();
strMusicBrainzTRMID = tag.GetMusicBrainzTRMID();
strComment = tag.GetComment();
rating = tag.GetRating();
iYear = stTime.wYear;
iTrack = tag.GetTrackAndDiskNumber();
iDuration = tag.GetDuration();
bCompilation = tag.GetCompilation();
embeddedArt = tag.GetCoverArtInfo();
strThumb = "";
iStartOffset = 0;
iEndOffset = 0;
idSong = -1;
iTimesPlayed = 0;
iKaraokeNumber = 0;
iKaraokeDelay = 0; //! Karaoke song lyrics-music delay in 1/10 seconds.
iAlbumId = -1;
}
示例2:
CSong::CSong(CMusicInfoTag& tag)
{
SYSTEMTIME stTime;
tag.GetReleaseDate(stTime);
strTitle = tag.GetTitle();
strGenre = tag.GetGenre();
strFileName = tag.GetURL();
strArtist = tag.GetArtist();
strAlbum = tag.GetAlbum();
strAlbumArtist = tag.GetAlbumArtist();
strComment = tag.GetComment();
strLabel = tag.GetLabel(); // Laureon: Added getLabel
strISRC = tag.GetISRC(); // Laureon: Added getISRC
iVisible = 1; // Laureon: Added: Song Visibility
rating = tag.GetRating();
iYear = stTime.wYear;
iTrack = tag.GetTrackAndDiskNumber();
iDuration = tag.GetDuration();
strThumb = "";
iStartOffset = 0;
iEndOffset = 0;
idSong = -1;
iTimesPlayed = 0;
iKaraokeNumber = 0;
iKaraokeDelay = 0; //! Karaoke song lyrics-music delay in 1/10 seconds.
iArtistId = -1;
iAlbumId = -1;
}
示例3: GetSongDuration
int CMusicInfoScanner::GetSongDuration(const CStdString& strFullFileName) {
CMusicInfoTag tag;
auto_ptr<IMusicInfoTagLoader> pLoader (CMusicInfoTagLoaderFactory::CreateLoader(strFullFileName));
if (pLoader.get() == NULL) return 0;
pLoader->Load(strFullFileName, tag);
return tag.GetDuration();
}
示例4: AddSong
int CScrobbler::AddSong(const CMusicInfoTag& tag)
{
if ((!g_guiSettings.GetBool("lastfm.enable") && !g_guiSettings.GetBool("lastfm.recordtoprofile")) || !g_guiSettings.GetBool("network.enableinternet"))
return 0;
if (tag.GetDuration() <= MINLENGTH || tag.GetDuration() > MAXLENGTH) // made <= to minlength to stop iTMS previews being submitted in iTunes
return 0;
if (!tag.Loaded() || tag.GetArtist().IsEmpty() || tag.GetTitle().IsEmpty())
return 0;
if(m_bSubmitInProgress)
{
StatusUpdate(S_NOT_SUBMITTING,"Previous submission still in progress");
return 0;
}
char ti[20];
struct tm *today = gmtime(&m_SongStartTime);
strftime(ti, sizeof(ti), "%Y-%m-%d %H:%M:%S", today);
CStdString a, b, t;
// our tags are stored as UTF-8, so no conversion needed
a = tag.GetArtist();
b = tag.GetAlbum();
t = tag.GetTitle();
CStdString i=ti;
CStdString m=tag.GetMusicBrainzTrackID();
CUtil::URLEncode(a);
CUtil::URLEncode(b);
CUtil::URLEncode(t);
CUtil::URLEncode(i);
CUtil::URLEncode(m);
CStdString strSubmitStr;
strSubmitStr.Format("a[%i]=%s&t[%i]=%s&b[%i]=%s&m[%i]=%s&l[%i]=%i&i[%i]=%s&", m_iSongNum, a.c_str(), m_iSongNum, t.c_str(), m_iSongNum, b.c_str(), m_iSongNum, m.c_str(), m_iSongNum, tag.GetDuration(), m_iSongNum, i.c_str());
if(m_strPostString.find(ti) != m_strPostString.npos)
{
// we have already tried to add a song at this time stamp
// I have no idea how this could happen but apparently it does so
// we stop it now
StatusUpdate(S_NOT_SUBMITTING,strSubmitStr);
StatusUpdate(S_NOT_SUBMITTING,m_strPostString);
StatusUpdate(S_NOT_SUBMITTING,"Submission error, duplicate subbmission time found");
return 3;
}
m_strPostString += strSubmitStr;
m_iSongNum++;
SaveCache(m_strPostString.c_str(), m_iSongNum);
time_t now;
time (&now);
if ((m_Interval + m_LastConnect) < now)
{
DoSubmit();
return 1;
}
else
{
CStdString strMsg;
strMsg.Format("Not submitting, caching for %i more seconds. Cache is %i entries.", (int)(m_Interval + m_LastConnect - now), m_iSongNum);
StatusUpdate(S_NOT_SUBMITTING,strMsg);
return 2;
}
}
示例5: Load
//.........这里部分代码省略.........
{
char* szTitle = reg.GetReplaceString("\\1");
char* szArtist = reg.GetReplaceString("\\2");
char* szMins = NULL;
char* szSecs = NULL;
CRegExp reg2;
reg2.RegComp("(.*) \\(([0-9]*):([0-9]*)\\)");
if (reg2.RegFind(szTitle) > -1)
{
szMins = reg2.GetReplaceString("\\2");
szSecs = reg2.GetReplaceString("\\3");
char* szTemp = reg2.GetReplaceString("\\1");
free(szTitle);
szTitle = szTemp;
}
tag.SetLoaded(true);
tag.SetURL(strFileToLoad);
tag.SetTrackNumber(iTrack);
if (szMins && szSecs)
tag.SetDuration(atoi(szMins)*60+atoi(szSecs));
tag.SetTitle(szTitle);
tag.SetArtist(szArtist);
if( szTitle )
free(szTitle);
if( szArtist )
free(szArtist);
if( szMins )
free(szMins);
if( szSecs )
free(szSecs);
}
}
sprintf(temp,"%s\\%s",g_settings.GetDatabaseFolder().c_str(),"sidlist.csv"); // changeme?
std::ifstream f2(temp);
if( !f2.good() ) {
CLog::Log(LOGINFO,"MusicInfoTagLoaderSid::Load(..) unable to locate sidlist.csv");
tag.SetLoaded(false);
return( false );
}
while( !f2.eof() ) {
f2.getline(temp,8191);
CStdString strTemp(temp);
strTemp.MakeLower();
unsigned int iFind = strTemp.find(strHVSCpath);
if (iFind == string::npos)
continue;
char temp2[1024];
char temp3[1024];
strncpy(temp3,temp+iFind,strlen(strHVSCpath));
temp3[strlen(strHVSCpath)] = '\0';
sprintf(temp2,"\"%s\",\"[^\"]*\",\"[^\"]*\",\"([^\"]*)\",\"([^\"]*)\",\"([0-9]*)[^\"]*\",\"[0-9]*\",\"[0-9]*\",\"",temp3);
for (int i=0;i<iTrack-1;++i)
strcat(temp2,"[0-9]*:[0-9]* ");
strcat(temp2,"([0-9]*):([0-9]*)");
if( !reg.RegComp(temp2) )
{
CLog::Log(LOGINFO,"MusicInfoTagLoaderSid::Load(..): failed to compile regular expression");
tag.SetLoaded(false);
return( false );
}
if( reg.RegFind(temp) >= 0 ) {
char* szTitle = reg.GetReplaceString("\\1");
char* szArtist = reg.GetReplaceString("\\2");
char* szYear = reg.GetReplaceString("\\3");
char* szMins = reg.GetReplaceString("\\4");
char* szSecs = reg.GetReplaceString("\\5");
tag.SetLoaded(true);
tag.SetTrackNumber(iTrack);
if (tag.GetDuration() == 0)
tag.SetDuration(atoi(szMins)*60+atoi(szSecs));
if (tag.GetTitle() == "")
tag.SetTitle(szTitle);
if (tag.GetArtist() == "")
tag.SetArtist(szArtist);
SYSTEMTIME dateTime;
dateTime.wYear = atoi(szYear);
tag.SetReleaseDate(dateTime);
if( szTitle )
free(szTitle);
if( szArtist )
free(szArtist);
if( szYear )
free(szYear);
if( szMins )
free(szMins);
if( szSecs )
free(szSecs);
f2.close();
return( true );
}
}
f2.close();
tag.SetLoaded(false);
return( false );
}
示例6: Init
bool SPCCodec::Init(const CStdString &strFile, unsigned int filecache)
{
// SNESAPU can ONLY be opened and used by one instance (lot's of statics).
// So to work around this problem with SNESAPU, we need to make sure that
// each instance of SPCCodec has it's own instance of SNESAPU. Do this by
// coping DLL_PATH_SPC_CODEC into special://temp and using a unique name. Then
// loading this unique named SNESAPU as the library.
// This forces the shared lib loader to load a per-instance copy of SNESAPU.
#ifdef _LINUX
m_loader_name = CUtil::GetNextFilename("special://temp/SNESAPU-%03d.so", 999);
XFILE::CFile::Cache(DLL_PATH_SPC_CODEC, m_loader_name);
m_loader = new SoLoader(m_loader_name);
#else
m_loader_name = CUtil::GetNextFilename("special://temp/SNESAPU-%03d.dll", 999);
XFILE::CFile::Cache(DLL_PATH_SPC_CODEC, m_loader_name);
m_loader = new Win32DllLoader(m_loader_name);
#endif
if (!m_loader)
{
XFILE::CFile::Delete(m_loader_name);
return false;
}
if (!m_loader->Load())
{
delete m_loader;
m_loader = NULL;
XFILE::CFile::Delete(m_loader_name);
return false;
}
m_loader->ResolveExport("LoadSPCFile",(void**)&m_dll.LoadSPCFile);
m_loader->ResolveExport("EmuAPU",(void**)&m_dll.EmuAPU);
m_loader->ResolveExport("SeekAPU",(void**)&m_dll.SeekAPU);
#ifdef _LINUX
m_loader->ResolveExport("InitAPU",(void**)&m_dll.InitAPU);
m_loader->ResolveExport("ResetAPU",(void**)&m_dll.ResetAPU);
#endif
CFile file;
if (!file.Open(strFile))
{
CLog::Log(LOGERROR,"SPCCodec: error opening file %s!",strFile.c_str());
return false;
}
m_szBuffer = new char[0x10200];
if (!file.Read(m_szBuffer,0x10200))
{
delete[] m_szBuffer;
m_szBuffer = NULL;
file.Close();
CLog::Log(LOGERROR,"SPCCodec: error reading file %s!",strFile.c_str());
return false;
}
file.Close();
m_pApuRAM = new u8[65536];
#ifdef _LINUX
m_dll.InitAPU();
m_dll.ResetAPU();
#endif
m_dll.LoadSPCFile(m_szBuffer);
m_SampleRate = 32000;
m_Channels = 2;
m_BitsPerSample = 16;
CMusicInfoTagLoaderSPC tagLoader;
CMusicInfoTag tag;
tagLoader.Load(strFile,tag);
if (tag.Loaded())
m_TotalTime = tag.GetDuration()*1000;
else
m_TotalTime = 4*60*1000; // default
m_iDataPos = 0;
return true;
}