如何在循环播放和音频文件 [英] How Do I Play and Audio file on Loop

查看:160
本文介绍了如何在循环播放和音频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个程序,我们可以将其称为游戏,我正在尝试将mp3音频文件合并到其中并尝试使其在程序运行时无休止地播放。

I am building a program, we can call it a game, and i am trying to incorporate an mp3 audio file in it and trying to make it play endlessly while the program is running.

推荐答案

这很容易。这里有一些来自微软的示例代码。你只需要在一个线程中构建一个带有一些分解代码的循环来播放。



It is quite easy. Here is some example code from microsoft. You only need to build a loop in a thread with some breakup code for playing.

//a global value, to access the loop 
bool stillRunning = true;
char * szFile  = "";//your dynamic path


while( stillRunning)
{
  hr = pGraph->RenderFile(szFile, NULL);
}


这篇关于如何在循环播放和音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆