⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 playlist.cpp

📁 在WCE4.2下面用EVC开发的一个带图型界面的音乐播放器,带音乐播放的一般功能,如快进快退,拖动,音量拖动调节,等功能,不到歌词显示功能,
💻 CPP
字号:
// Playlist.cpp: implementation of the CPlaylist class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "musicplayer.h"

#include "Playlist.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CPlaylist::CPlaylist()
{
	m_CurrentFile = 0;
	m_TotalFiles = 0;
	m_FileList.RemoveAll();
	m_FilePath = L"";
}

CPlaylist::~CPlaylist()
{

}

CString CPlaylist::GetNextWorkFileName(bool bForword, bool bRandom)
{
	
	if (bForword)			// 前一个文件pre
	{
		if (--m_CurrentFile < 0)
		{
			m_CurrentFile = m_TotalFiles - 1;
		}
	} 
	else			// 后一个文件next
	{
		if (++m_CurrentFile >= m_TotalFiles )
		{
			m_CurrentFile = 0;
		}
	}

	if (bRandom)		// 随机获取
	{	int  m = MakeRandom(m_CurrentFile);
		return m_FilePath + m_FileList.GetAt(m);
	}
	else		//顺序播放
	{	return m_FilePath + m_FileList.GetAt(m_CurrentFile);
	}
}



unsigned int CPlaylist::MakeRandom(int MaxNumber)
{
	return m_Seed[MaxNumber];
}



void CPlaylist::InitSeed()
{
	int NUM=m_TotalFiles;
	int k=0;
	int j=0;
	
	srand(Random());
	for (k=0;k<NUM;k++)
	{
		m_Seed[k]=rand()%NUM;
		for (j=0;j<k;j++) 
		{	
			if (m_Seed[j]==m_Seed[k]) 
			{	k--;						//重新取
				break;
			}
		}
	}
}



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -