Example #1
0
File: main.c Project: ADTL/ARMWork
FRESULT Mp3PlayAllFiles(char* path)
{
  FILINFO fno;
  DIR dir;
  char fpath[50];

  chprintf((BaseChannel*)&SD2, "Mp3PlayAllFiles: Playing all files in \"%s\"\r\n", path);
  FRESULT res = f_opendir(&dir, path);
  if(res == FR_OK)
  {
    res = f_readdir(&dir, &fno);
    while((res == FR_OK) && (fno.fname[0] != 0))
    {
      strcpy(fpath, path);
      strcat(fpath, fno.fname);
      if(fno.fattrib & AM_DIR)
      {
        chprintf((BaseChannel*)&SD2, "Mp3PlayAllFiles: DIR \"%s\"\r\n", fpath);
      }
      else
      {
        chprintf((BaseChannel*)&SD2, "Mp3PlayAllFiles: FILE \"%s\"\r\n", fpath);
        size_t unLen = strlen(fpath);
        if(unLen > 3)
        {
          if(stricmp(fpath + unLen - 4, ".mp3") == 0)
          {
            Mp3Decode(fpath);
          }
        }
      }
      res = f_readdir(&dir, &fno);
    }
  }
  else
  {
    chprintf((BaseChannel*)&SD2, "Mp3PlayAllFiles: f_opendir failed %d\r\n", res);
  }
  chprintf((BaseChannel*)&SD2, "Mp3PlayAllFiles: Finished playing all files\r\n", path);

  return res;
}
Example #2
0
//---------------------------------------------------------------------------
// 函数:	ReadWaveData
// 功能:	读取波形数据
// 参数:	lpBuf	缓存
//			dwLen	长度	
// 返回:	DWORD	实际读取的长度
//---------------------------------------------------------------------------
DWORD KMp3Music::ReadWaveData(LPBYTE lpBuf, DWORD dwLen)
{
	return Mp3Decode(lpBuf, dwLen);
}