###OpenSLES Powered
方法 Methods
public
AudioPlayer()
构造播放引擎,初始化引擎
Initialize a player with engine.
int load(_const char_ URI)*
加载音乐资源,准备播放
Load the music resource, ready to play.
int unload()
卸载音乐资源.(析构时将自动进行)
Unload the music resource.(Called automatically on destroyed)
int setplay(bool played)
设置播放状态(true:播放,false:暂停)
Set play status.(true for play,false for pause)
int getstate()
获取播放状态
Get play status.
int getdur_static()
仅在暂停时获取音乐长度(毫秒)
Get the length of music when the status is "Paused"
int getdur_dynamic()
立刻获取音乐长度(毫秒)
Get the length of music at once.
~AudioPlayer()
释放音乐资源,销毁播放引擎.
Unload the music resource and destroy the engine and the player itself.
示例代码 Example Code
int main()
{
AudioPlayer a;
a.load("example.mp3");
a.setplay(true);
usleep(a.getdur_dynamic()*1000);
return 0;
}