libzplay开发【播放音乐】笔记1
来源:互联网 发布:网络教育英文翻译 编辑:程序博客网 时间:2024/05/20 03:39
库方面的配置网上都有
/*
* libZPlay example
*
* Play test.mp3 to sound card output.
*
*/
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include "libzplay.h"
using namespace libZPlay;
int main(int argc, char **argv)
{
printf("Playing test.mp3\n\nPress q to end\n\n");
// create class instance using class factory.
ZPlay *player = CreateZPlay();
// open file
int result = player->OpenFile("test.mp3", sfAutodetect);
if(result == 0)
{
// display error message
printf("Error: %s\n", player->GetError());
player->Release();
return 0;
}
// get song length
TStreamInfo info;
player->GetStreamInfo(&info);
printf("Length: %02u:%02u:%02u:%03u\n\n", info.Length.hms.hour,
info.Length.hms.minute,
info.Length.hms.second,
info.Length.hms.millisecond);
// start playing
player->Play();
// display position and wait for song end
while(1)
{
// check key press
if(kbhit())
{
int a = getch();
if(a == 'q' || a == 'Q')
break; // end program if Q key is pressed
}
// get stream status to check if song is still playing
TStreamStatus status;
player->GetStatus(&status);
if(status.fPlay == 0)
break; // exit checking loop
// get current position
TStreamTime pos;
player->GetPosition(&pos);
// display position
printf("Pos: %02u:%02u:%02u:%03u\r", pos.hms.hour, pos.hms.minute, pos.hms.second, pos.hms.millisecond);
Sleep(300); // wait 300 ms
}
// destroy class instance
player->Release();
return 0;
}
- libzplay开发【播放音乐】笔记1
- 使用 libZPlay 播放音乐文件
- 【Cocos2D-X游戏开发笔记1】播放音乐&CocosDenshion
- 开发音乐播放器【1】
- Android 音乐播放器开发笔记
- Android开发笔记之音乐播放器
- Qt基于libzplay库的音乐播放工具
- 音乐播放器笔记
- android应用开发:音乐播放器(1)
- 音乐播放器开发
- Android开发笔记之简易音乐播放器
- android开发笔记之多媒体—播放音频(音乐)
- libzplay简单的播放音频例子
- Android开发音乐播放器-音乐扫描
- Android开发音乐播放器
- Android开发音乐播放器
- 独立开发音乐播放器
- Android开发音乐播放器
- 关于Hibernate的commit、flush方法与对象的三种状态
- com组件和一般dll的区别
- vs2010 调试快捷键
- hibernate快速入门实例
- as3 批量替换字符串 使用正则式
- libzplay开发【播放音乐】笔记1
- Python_ test your web applications using Splinter
- mac pro 配置配置iPhone开发环境 第一天
- 你可能不知道的Shell
- 数据库优化之一(索引)
- FUSE——用户空间文件系统
- 云计算和大数据让IT界上演SaaS回归大戏
- linux下tomcat服务的相关命令
- 监控 走廊模式