MFC中使用SDL播放音频没有声音的解决方法
来源:互联网 发布:招行香港一卡通 mac 编辑:程序博客网 时间:2024/04/30 11:02
本文所说的音频是指的纯音频,不包含视频的那种。
在控制台中使用SDL播放音频,一般情况下不会有问题。
但是在MFC中使用SDL播放音频的时候,会出现没有声音的情况。经过长时间探索,没有找到特别好的解决方案,但是有一种方式可以让声音播放出来:那就是让SDL显示图像(视频)时候的那个对话框弹出来,声音就会出现了。
具体的方法可以加载一张图片(比如说BMP),下图所示代码片段为加载BMP图片的代码。
SDL_Surface *screen = SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE);SDL_Surface *image;/* Load the BMP file into a surface */image = SDL_LoadBMP("background.bmp");if (image == NULL) {return 0;}/** Palettized screen modes will have a default palette (a standard* 8*8*4 colour cube), but if the image is palettized as well we can* use that palette for a nicer colour matching*/if (image->format->palette && screen->format->palette) {SDL_SetColors(screen, image->format->palette->colors, 0,image->format->palette->ncolors);}/* Blit onto the screen surface */if(SDL_BlitSurface(image, NULL, screen, NULL) < 0)fprintf(stderr, "BlitSurface error: %s\n", SDL_GetError());SDL_UpdateRect(screen, 0, 0, image->w, image->h);
不明白这是为什么,但是程序就可以出声了。
- MFC中使用SDL播放音频没有声音的解决方法
- SDL没有窗口就没有声音的解决方法
- ffmpeg+SDL的使用之使用SDL播放音频流
- 播放flash没有声音的解决方法
- 使用sdl播放音频流
- 关于部分手机使用听筒模式播放音频时没有声音的问题
- MFC中播放声音
- MFC中播放声音的方法
- [原创]暴风影音播放视频没有声音的解决方法
- 使用SDL播放PCM音频裸流
- SDL声音播放设备
- SDL音频播放
- SDL音频播放
- SDL音频播放
- 使用音频引擎MITA播放声音源代码
- ubuntu无法播放在线视频或者播放在线视频时只有图像没有声音的解决方法
- html5控制音频播放的声音
- ubuntu没有声音的解决方法
- STL 队列的使用方法
- bias和variance
- java项目web.xml文件报错
- p45-09
- STL 栈的使用
- MFC中使用SDL播放音频没有声音的解决方法
- Oracle学习笔记 之 sqlplus 用法
- 如何给Archlinux进行ip设置
- Node.js 入门
- 5.2 CMMI5级——组织革新与部署(Organizational Innovation and Deployment)
- 程序员求职:选择大公司还是小公司
- 在win7后安装fedora系统
- Windows平台下的内存管理
- TCPMon使用总结