- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
FMOD_RESULT result;
FMOD::System *system;
result = FMOD::System_Create(&system);
if (result != FMOD_OK)
{
printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
}
result = system->init(100, FMOD_INIT_NORMAL, 0);
if (result != FMOD_OK)
{
printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
}
FMOD::Sound *sound;
result = system->createSound("01.mp3", FMOD_DEFAULT, 0, &sound); // FMOD_DEFAULT uses the defaults. These are the same as FMOD_LOOP_OFF | FMOD_2D | FMOD_HARDWARE.
ERRCHECK(result);
FMOD::Channel *channel;
result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
ERRCHECK(result);
我跟踪了上面的代码,没有错误/警告,但是没有播放01.mp3
,为什么?
最佳答案
虽然代码对我来说看起来不错,但请注意 playSound()
是异步的。如果您之后直接退出,声音将永远没有时间播放。例如:
int main() {
// ...
sytem->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
// playSound() returns directly, program exits without sound being heard
}
作为测试的快速解决方法(并且不知道您的应用程序的结构),您可以等待来自控制台的输入:
result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
// ...
std::cout << "Press return to quit." << std::endl;
std::cin.get();
关于c++ - 为什么 playSound 在 Windows 上使用 FMOD 实际上不输出任何声音?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3328593/
渐进增强和优雅降级基本是一回事吗? 最佳答案 不完全是。他们从不同的 Angular 解决类似的问题。 “优雅的降级”意味着你有漂亮的功能,并且可以在不支持它的浏览器中处理它不那么漂亮(但仍然需要它以
在过去的几周里,我一直在调优和处理 PostgreSQL,我将在我的下一个项目中使用它。 我的规范是: DigitalOcean 8 核 16GB SSD x2(一个用于数据库,另一个用于 Web)
我看过很多关于负数模的问题的答案。每一个答案都放了标准 (a/b)*b + a%b is equal to a 解释。我可以用这种方法计算任何模数,而且我知道有必要使用一个模数函数,如果它是负数,则将
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 9 年前。 Improve
The docs假设所有标签都存储在 .hgtags 中,但这里显然存在一些黑魔法。 我的标签如下所示: mbayazit:~/test$ cat .hgtags 0d80b6ba4ba3b51a44
我正在尝试强制删除待处理的更改列表。所有文件(20 个旧文件)都是新文件,但尚未提交/提交。所以在 p4Win 中,它们显示红色 + 十字。我无法从更改列表中删除这些文件。我该如何删除这些文件? 感谢
如果我要删除的文件不属于工作区,那么如何从工作区的目录中删除文件? 我的文件系统上有一个目录,其中包含从 perforce 获取的文件,但在某些进程运行后,它会在这些目录中创建一些新文件。 是否有 p
就是好奇这个。以下是同一功能的两个代码片段: void MyFunc1() { int i = 10; object obj = null; if(something) ret
我对使用约束布局还很陌生,我在调整布局大小方面遇到了问题,我希望它能够响应,这样我就不必再为不同的屏幕尺寸制作 10 个布局。在布局编辑器中,一切在不同尺寸下看起来都很完美,但实际上并非如此。 我做了
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
如果试图修改声明为 const 的对象,const 类型限定符会导致编译器发出错误消息,但这还不够保护。例如以下程序修改声明为 const 的数组的两个元素: #include int main(v
我不得不问这个,因为:我唯一知道的是,如果断言失败,应用程序就会崩溃。这就是为什么要使用 NSAssert 的原因吗?或者这样做还有什么好处?将 NSAssert 置于我在代码中所做的任何假设之上是否
我正在处理我的操作系统项目的 POSIX 子系统,并且我已经达到了我想要处理 pthreads 支持的地步。但是,我不确定我应该在多大程度上实现它们。 最常用的 pthreads 功能是什么?现在有什
这个问题不太可能对任何 future 的访客有帮助;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,通常不适用于互联网的全局受众。如需帮助使这个问题更广泛适用,visit the h
我正在尝试运行测试类,但抛出错误实际上有零交互。 class Xtractor{ void extractValues(request,Map m1, Map m2,Map m3){
我有一个抽象类UIObject,如下所示: public abstract class UIObject { private final int tabOrder; public UI
这是我尝试在 emacs lisp 中进行一些计算时得到的... (+ 2082844800. 1274511600.0) => 1209872752.0 (+ 2082844800.0 127451
我想用一条垂直线将屏幕分成两部分。垂直线应该从屏幕底部一直延伸到导航栏。如果我们使用 html/css,我只会有 2 个 div,并在右侧 div 上放置一个左边框。如果有办法在 View 的单侧放置
我有一个EC2实例可以正常工作数月(仍在开发中,应用程序尚未启用),但是我只是意识到我什至不知道如何根据流量来扩大/缩小EC2实例。 亚马逊提供的大量服务是压倒性的,我对此感到非常困惑。 最初,虽然我
考虑这个代码: int i = 1; int x = ++i + ++i; 我们对编译器可能会为这段代码做些什么有一些猜测,假设它可以编译。 两者 ++i返回 2 ,导致 x=4 . 一 ++i返回
我是一名优秀的程序员,十分优秀!